Open code423n4 opened 2 years ago
Flagging that this QA report contains Approve Not Set To Zero First
which I confirmed as a mid-risk issue elsewhere.
Flagging that this QA report contains
Approve Not Set To Zero First
which I confirmed as a mid-risk issue elsewhere.
Thanks but judged that as QA in #221.
Mismatch In The Number Of Parameters
The
wfCashLogic.mintViaUnderlying
andwfCashLogic.mintViaAsset
functions only accept four (4) parameters.https://github.com/code-423n4/2022-06-notional-coop/blob/6f8c325f604e2576e2fe257b6b57892ca181509a/notional-wrapped-fcash/contracts/wfCashLogic.sol#L27
However, within the
NotionalTradeModule._mint
, it attempts to call thewfCashLogic.mintViaUnderlying
andwfCashLogic.mintViaAsset
functions with five (5) parameters. For consistency, remove the last parameter from the ABI encoding as shown below:https://github.com/code-423n4/2022-06-notional-coop/blob/6f8c325f604e2576e2fe257b6b57892ca181509a/index-coop-notional-trade-module/contracts/protocol/modules/v1/NotionalTradeModule.sol#L510
Lack of Input Validation
For defence-in-depth purpose, it is recommended to perform additional validation against the amount that the user is attempting to deposit, mint, withdraw and redeem to ensure that the submitted amount is valid.
https://github.com/OpenZeppelin/openzeppelin-contracts/blob/7c75b8aa89073376fb67d78a40f6d69331092c94/contracts/token/ERC20/extensions/ERC20TokenizedVault.sol#L94
Approve Not Set To Zero First
Vulnerability Details
Not calling approve(0) first might cause the protocol to be vulnerable to Front-Run/Double-Spend Attack.
https://github.com/code-423n4/2022-06-notional-coop/blob/6f8c325f604e2576e2fe257b6b57892ca181509a/index-coop-notional-trade-module/contracts/protocol/modules/v1/NotionalTradeModule.sol#L493
Recommended Mitigation Steps
Approve with a zero amount first before setting the actual amount.
Floating Pragma
Proof-of-Concept
The contract makes use of the floating-point pragma ^0.8.0. Contracts should be deployed using the same compiler version. Locking the pragma helps ensure that contracts are not unintentionally deployed using another pragma, such as an obsolete version, that may introduce issues in the contract system.
https://github.com/code-423n4/2022-06-notional-coop/blob/6f8c325f604e2576e2fe257b6b57892ca181509a/notional-wrapped-fcash/contracts/wfCashERC4626.sol#L2
Recommended Mitigation Steps
Consider locking the pragma version. It is advised that floating pragma should not be used in production
Unused Function
Proof-of-Concept
Following function was defined, but not used in any of the contracts.
https://github.com/code-423n4/2022-06-notional-coop/blob/6f8c325f604e2576e2fe257b6b57892ca181509a/notional-wrapped-fcash/contracts/wfCashERC4626.sol#L243
Recommended Mitigation Steps
It is recommended to remove this function if it is not required.