require( _accountAccessController.isAccountAllowed(_sender),"Account not allowed to deposit");
require( !_accountAccessController.isAccountBlocked(_sender),"Account not allowed to deposit");
``
========================================================================
3. Can save gas usage by using only `<` or `>` operator
Proof of Concept:
https://github.com/code-423n4/2022-03-prepo/blob/main/contracts/core/PrePOMarket.sol#L185
https://github.com/code-423n4/2022-03-prepo/blob/main/contracts/core/PrePOMarket.sol#L189
Recommended Mitigation Steps:
Example:
require(
_newFinalLongPrice > _floorLongPrice,
"Price cannot be below floor"
);
========================================================================
4. unused code
Proof of Concept:
https://github.com/code-423n4/2022-03-prepo/blob/main/contracts/core/AccountAccessController.sol#L15
Recommended Mitigation Steps:
remove it
========================================================================
5. using `unchecked` can save gas
Proof of Concept:
https://github.com/code-423n4/2022-03-prepo/blob/main/contracts/core/Collateral.sol#L70
https://github.com/code-423n4/2022-03-prepo/blob/main/contracts/core/Collateral.sol#L166
Recommended Mitigation Steps:
add `unchecked`
========================================================================
6. considered using `uint128` can save gas
Proof of Concept:
https://github.com/code-423n4/2022-03-prepo/blob/main/contracts/core/interfaces/ICollateral.sol#L20
Recommended Mitigation Steps:
Proof of Concept: https://github.com/code-423n4/2022-03-prepo/blob/main/contracts/core/Collateral.sol#L81
Recommended Mitigation Steps: considered remove 0 value can save gas
========================================================================
Proof of Concept: https://github.com/code-423n4/2022-03-prepo/blob/main/contracts/core/DepositHook.sol#L31
Recommended Mitigation Steps: Example:
require( _newFinalLongPrice > _floorLongPrice, "Price cannot be below floor" );
struct WithdrawalRequest { uint128 amount; uint128 blockNumber; }