Pool Addresses
#
OverviewFor each token pair, there are possibly many multiple pools with different configurations. As such, it is necessary to specify which pools are to be used for fetching token rates, trade execution and liquidity provision.
#
getPoolsThe best way to get all pools for a specific token pair is to call getPools on the factory, then selecting one of the pools from the returned array. If none exists, an empty array is returned.
#
Selecting The Right PoolGiven a token pair, the DMM website will show the unamplified pool and those created by the Kyber team.
#
Unamplified PoolFor direct smart contract integrations, the unamplified pool (amplification factor 1) is recommended for simplicity. This pool supports an infinite price range, and therefore should always have liquidity. The pool address can be fetched by calling getUnamplifiedPool on the factory.
#
Pool with best liquidityAn alternative method is to call the factory's getPools method to fetch all pools for the token pair, then sorting by liquidity.
This can be done by fetching each pool's kLast method, then whichever pool has the highest kLast
value should be used. We provide a short code snippet below.
To save on gas costs, this process is recommended to be performed off-chain, then have the pool address(es) specified as an input. See the first method in the example below.
#
ExampleWe showcase 3 methods for getting pool addresses to calculate the USDT amount needed to obtain 100 DAI.
Note that we import the router and factory interfaces.