The function getInputAmountBasedOnOutput is multiplying by 10000 but instead it should be 1000.
Wrong math.
Users pay more output token when doing swap using swapExactOutput.
Reading the code.
Fix the formula
function getInputAmountBasedOnOutput(
uint256 outputAmount,
uint256 inputReserves,
uint256 outputReserves
)
public
pure
revertIfZero(outputAmount)
revertIfZero(outputReserves)
returns (uint256 inputAmount)
{
return
((inputReserves * outputAmount) * 1000) / // <<< here the multiplication should be 1000 instead of 10000
((outputReserves - outputAmount) * 997);
}
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.