You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description
The provide_liquidity function triggers an integer underflow issue when at least one of the tokens of the pair use more than 18 decimals. This prevents liquidity providers from adding funds to the pool.
This is due to the following pow function, which expects an u32 number. Should greatest_precision be greater than DECIMAL_PRECISION, the provide_liquidity function would end execution with a panic.
let divisor = 10u128.pow(DECIMAL_PRECISION - greatest_precision);
The likelihood of this issue occurring was determined to be low, as tokens with more than 18 decimals are less likely to exist.
Recommendation
Contemplate the case where greatest_precision is greater than DECIMAL_PRECISION, similarly to what is done in the scale_value value function.
Otherwise, clearly document this limitation and prevent tokens with more than 18 decimals from being included in stable liquidity pools.
The text was updated successfully, but these errors were encountered:
Location
Description
The provide_liquidity function triggers an integer underflow issue when at least one of the tokens of the pair use more than 18 decimals. This prevents liquidity providers from adding funds to the pool.
This is due to the following pow function, which expects an u32 number. Should greatest_precision be greater than DECIMAL_PRECISION, the provide_liquidity function would end execution with a panic.
The likelihood of this issue occurring was determined to be low, as tokens with more than 18 decimals are less likely to exist.
Recommendation
Contemplate the case where greatest_precision is greater than
DECIMAL_PRECISION
, similarly to what is done in thescale_value
value function.Otherwise, clearly document this limitation and prevent tokens with more than 18 decimals from being included in stable liquidity pools.
The text was updated successfully, but these errors were encountered: