curvefi / curve-contract

Vyper contracts used in Curve.fi exchange pools.
https://www.curve.fi/
Other
1.03k stars 384 forks source link

Some doubts on StableSwapIB (Curve IronBank Pool) #183

Closed barakman closed 1 year ago

barakman commented 1 year ago

From the code:

PRECISION_MUL: constant(uint256[N_COINS]) = [1, 1000000000000, 1000000000000]

In any other pool, this array of values reflects 10 ** (18 - coin.decimals) for each coin in the pool.

The decimals value of each one of the coins in this pool (iDAI, iUSDC, iUSDT) is set to 8.

This means that the array above would typically be initialized as:

PRECISION_MUL: constant(uint256[N_COINS]) = [10000000000, 10000000000, 10000000000]

What is the reason behind this notable difference between the IB pool and all other pools in this repository?

barakman commented 1 year ago

The decimals to use in this specific case are of the underlying coins (DAI, USDC, USDT).

These coins are available either via function underlying_coins in the IB pool contract, or via function underlying in each one of the coin contracts (iDAI, iUSDC, iUSDT).

BTW, the same issue goes for the Yv2 pool (deployed at 0x8925D9d9B4569D737a48499DeF3f67BaA5a144b9), which is not included in this repository for some reason.