here is quick question. From uniswap pool, which one is base token? token0
or token1
?
2 Answers
Price in Uniswap pools is tracked in terms of token1/token0
, so token1
is the numeraire token if that's what you're asking.
-
like when i flashloan from the pool, the loan must be repayed by base token. this is the reason i ask the question. so i must pay the loan in token1. Right? Commented Oct 29, 2023 at 14:50
-
@BirukDamte you can make a flash loan or a flash swap with Uni, but where does the name "base" comes from?– kfxCommented Oct 29, 2023 at 17:35
-
from youtube tutorial. Any way ur answer helped me. Thanks bro Commented Oct 29, 2023 at 19:14
There is no on-chain way to determine which token is a base token or which is a quote token if token0 and token1 are mapped to normal trading pairs.
The trading pair base-quote token order is a human-made concept for making natural reading easier. Thus, you need to have your own rules that determine which of the tokens is a quote token (determining quote is usually easier than determining base).
Here are some rules that can help you
First determine if a token is stablecoin. Have a hierarchy of stablecoins to determine a "better stablecoin for stable-stable pairs.
Then check for a native token. A quote token is usually ETH (WETH), MATIC (WMATIC), AVAX (WAVAX) or similar. All "large cap tokens", including BTC (WBTC) are good quote tokens.
If you still cannot determine then flip a coin. However, in this case, it's an exotic pair you probably do not want to trade in the first place.