Closed ashpoolin closed 2 years ago
I WAS WRONG. It is a convention for quoting currency pairs that the first currency is the base, and the latter is the quote currency. So in RAY/SOL, as before, RAY is the base token and SOL is the quote token. However unintuitive this may be, it is not a deficiency in the software. I am satisfied, and will be closing this issue.
Howdy,
For the serum client of this repo, I believe there is some confusion regarding the definitions of "base" and "quote" token accounts. These accounts are for storing unsettled tokens used within serum, and represent available funds to trade. Considering the trading pair RAY/SOL, it is my opinion that the "quote" token is the token you intend to buy, e.g. are "quoting" in a buy order, so in this case, RAY. Similarly, the "base" token should be the base of the pair (SOL), or the token that you sell in exchange for the quoted token during a buy order. It is helpful to remember every tx has both a "buy" and a "sell."
This isn't how serum appears to work, however. I can confirm that, when intending to buy RAY (for example), the payer must be the public key from the quote token account (which oddly accesses an address containing SOL). Conversely, to sell RAY, the RAY tokens will be found in the base token account. This is how I am accessing the base and quote token accounts, and setting up the payer for placing orders:
The definitions for the functions
findBaseTokenAccountsForOwner(...)
andfindQuoteTokenAccountsForOwner(...)
are found in themarket.ts
file, but I'm a bit of an idiot so it's not immediately obvious if the mixup takes place there, or if this is just some misunderstanding--on my part--about what a "quote" or "base" account is.Thanks for looking into this, and please let me know if I can help!