Submitted by DOWSERS, also found by Lambda
The assert_slippage_tolerance function does not properly account for the non-linear pricing curve of StableSwap pools, which are influenced by the amplification factor (A). Specifically, the function calculates slippage tolerance based solely on a simple ratio of total deposits and pool tokens without integrating the StableSwap invariant (D). This oversight can lead to the acceptance of transactions with higher actual slippage than allowed, exposing the protocol to user losses or economic inefficiencies.
/contracts/pool-manager/src/helpers.rs#L423
Failure to account for the StableSwap invariant (D) and amplification factor (A) allows for:
Example: Incorrect slippage validation:
Steps:
Real slippage using StableSwap invariant
Lets say initial = 2000 (perfect equilibrium)
final = StableSwapinvariantrecalculated
Lets say final = 2105.
Relative change:
Comparison with Tolerance:
Implement a StableSwap-specific slippage calculation that incorporates the invariant (D) and amplification factor (A):
jvr0x (MANTRA) confirmed
