Intermediate max-input-amount check in _joinTokenSingle
is unnecessary
#196
Labels
bug
Something isn't working
G (Gas Optimization)
sponsor acknowledged
Technically the issue is correct, but we're not going to resolve it for XYZ reasons
Handle
cmichel
Vulnerability details
The
SingleTokenJoin._joinTokenSingle
function computes an intermediatemaxAmountIn
value ofamountsIn[0]
:It's not required to compute the input amount that is needed for the exact output swap, just do the swap and use a maxAmountIn of
type(uint256).max
.The final min return check on the entire amount (
outputAmount == _joinTokenStruct.outputAmount
) is enough to guarantee no sandwiching.The text was updated successfully, but these errors were encountered: