Description: The AMM doesn't normalize token decimals when calculating swap amounts and liquidity provision, leading to potential imbalances with tokens of different decimal places. The AMM performs calculations directly on token amounts without normalizing for different decimal places. When tokens with different decimal places (e.g., USDC with 6 decimals and WETH with 18 decimals) are paired, this leads to imbalanced liquidity provision and incorrect swap rates. The liquidity_operations::liquidity_calculation
function and swap calculations treat all token amounts as if they have the same decimal precision.
Impact: Users providing liquidity or performing swaps with token pairs that have different decimal places will experience unexpected and unfair token exchange rates. This could lead to:
Imbalanced liquidity provision where one token is over-represented
Incorrect pricing during swaps
Potential economic loss for users
Proof of Concept: Consider a pool with USDC (6 decimals) and WETH (18 decimals):
Recommended Mitigation: Implement decimal normalization in all calculations by scaling token amounts to a common decimal base:
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.