Make sense of tokens like UNI-V1 ETH-cDAI

Sometimes, a DeFi token contains several other tokens, and to calculate their price, you need to know their underlying assets. For example, a Uniswap V1 cDAI pool consists of ETH and cDAI. cDAI, in turn, has DAI as an underlying token. With DeFi SDK you can call

// Uniswap V1 cDAI pool
getFinalFullTokenBalance("Uniswap V1 pool token", 0x34E89740adF97C3A9D3f63Cc2cE4a914382c230b)

and fetch the decomposition of UNI-token into ERC20 tokens, like ETH and DAI

0.98 ETH
215.6 DAI

Last updated