Add Market: LINK

My apologies for screwing up the initialExchangeRateMantissa_ … I was copying from the cWBTC2 contract deployment rather than doing the math myself. Unfortunately this one for LINK is different because underlying decimals for ChainLink Token are 18. I’ve corrected my earlier post with this new value.

The standard cToken initial exchange rate for Compound is 0.02 scaled. The goal is to have 50 cTokens = 1 underlyingToken when the market is first deployed. In our case for cLINK, the math is:

  • 0.02 * 10^(18 + underlyingDecimals - cTokenDecimals)
  • = 0.02 * 10^(18+18-8)
  • = 0.02 * 10^28 … floating-point representation …
  • = 2e26 … unsigned scaled integer representation … (value used for constructor)

Your math looks good to me!

1 Like