Closed code423n4 closed 2 years ago
cmichel
The Swap.constructor allows arbitrary swap fees, even > 100%. It should check that the fee is at most 100% as in setSwapFee.
Swap.constructor
setSwapFee
Setting swap fees > 100% will revert the contract on trades when trying to pay out more than received.
Consider adding a require(swapFee_ < SWAP_FEE_DIVISOR, "Swap::setSwapFee: Swap fee must not exceed 100%"); statement to the constructor.
require(swapFee_ < SWAP_FEE_DIVISOR, "Swap::setSwapFee: Swap fee must not exceed 100%");
Duplicate of #25.
Handle
cmichel
Vulnerability details
The
Swap.constructor
allows arbitrary swap fees, even > 100%. It should check that the fee is at most 100% as insetSwapFee
.Impact
Setting swap fees > 100% will revert the contract on trades when trying to pay out more than received.
Recommended Mitigation Steps
Consider adding a
require(swapFee_ < SWAP_FEE_DIVISOR, "Swap::setSwapFee: Swap fee must not exceed 100%");
statement to the constructor.