code-423n4 / 2021-10-tally-findings

0 stars 0 forks source link

Validate `swapFee` #38

Closed code423n4 closed 2 years ago

code423n4 commented 2 years ago

Handle

cmichel

Vulnerability details

The Swap.constructor allows arbitrary swap fees, even > 100%. It should check that the fee is at most 100% as in setSwapFee.

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.

Shadowfiend commented 2 years ago

Duplicate of #25.