Closed code423n4 closed 2 years ago
Methods with slippage control already exits in wfCashLogic: https://github.com/code-423n4/2022-06-notional-coop/blob/6f8c325f604e2576e2fe257b6b57892ca181509a/notional-wrapped-fcash/contracts/wfCashLogic.sol#L166-L170
Lines of code
https://github.com/code-423n4/2022-06-notional-coop/blob/6f8c325f604e2576e2fe257b6b57892ca181509a/notional-wrapped-fcash/contracts/wfCashERC4626.sol#L205-L223
Vulnerability details
https://github.com/code-423n4/2022-06-notional-coop/blob/6f8c325f604e2576e2fe257b6b57892ca181509a/notional-wrapped-fcash/contracts/wfCashERC4626.sol#L205-L223
The current implementation of
redeem()
->_redeemInternal()
provides no parameter for slippage control.https://github.com/code-423n4/2022-06-notional-coop/blob/6f8c325f604e2576e2fe257b6b57892ca181509a/notional-wrapped-fcash/contracts/wfCashLogic.sol#L202-L257
However, when redeeming before maturity, the fCash will be market sold on Notional AMM, and a slippage control can and should be done to prevent the sandwich attack.
Recommendation
Since
wfCashERC4626
is an ERC4626 compatible contract, and the standardredeem()
method from ERC4626 has no parameter for slippage control, in order to remain ERC4626 compatible, instead of updating theredeem()
method, consider adding a new function withminReceiveAmount
parameter for redeeming before maturity, and the ERC4626-compatibleredeem()
without slippage control can only be used after maturity.