The claimAndSwap
function currently validates slippage by comparing the raw difference in token quantities before and after the swap, without accounting for variations in the conversion rate between tokens. This approach may incorrectly revert transactions when the value of the received token (alETH) exceeds the claimed token (WETH) amount in terms of value, even if the raw quantity does not meet the _minOut
threshold. A value-based comparison, considering token conversion rates, would provide a more accurate slippage validation
The claimandSwap
function is called only when WETH price is bigger than alETH or alETH price is lower than WETH.
Example:
Calling the function with _amountClaim -> 20
setting _minOut -> 21 since minOut cannot be lower than the amountClaim (this assures you always swap on win)
If WETH swap to alETH and its 41 + it will pass, but if alETH swaps for 22 (its still good swap and thats the idea of the protocol and function you get 20 WETH swap it for more alETH)
so if you swap it for 22, function will fail since 22-20 = 2 >= 21 -> reverts
so instead of balAfter - balBefore it should be just balAfter
Manual Review
do not deduct in the require just use balAfter
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.