Description: While the code uses checked_*
operations in many places, there are still potential overflow/underflow vulnerabilities in the liquidity calculations, particularly when converting between u128 and u64 types. The liquidity_calculation
function calculates the square root of the product of token amounts, but doesn't properly check if the result exceeds u64 max value before casting.
Impact: An attacker could manipulate token amounts to cause overflows, potentially minting more LP tokens than they should receive or stealing funds from the pool.
Proof of Concept: Provide extremely large token amounts that, when multiplied and square rooted, would exceed u64 max value but appear valid when cast down from u128.
Recommended Mitigation: Add explicit checks before casting from u128 to u64 to ensure the value fits within u64 range:
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.