You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Remove this line from LongShortToken import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
Save gas with unchecked
Impact
If arithmetic will not overflow, use unchecked to save gas. There are several locations where safeMath is not needed and unchecked can lower gas consumption.
Proof of Concept
In this code from Collateral.sol, _balanceAfter ≥ _balanceBefore so unchecked can be used
Solidity does not recognize null as a value, so uint variables are initialized to zero. Setting a uint variable to zero is redundant and can waste gas.
Unused Import
Impact
Importing ReentrancyGuard.sol is unnecessary in LongShortToken.sol because the import is never used
Proof of Concept
https://github.com/code-423n4/2022-03-prepo/blob/main/contracts/core/LongShortToken.sol
Tools Used
Manual analysis
Recommended Mitigation Steps
Remove this line from LongShortToken
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
Save gas with unchecked
Impact
If arithmetic will not overflow, use unchecked to save gas. There are several locations where safeMath is not needed and unchecked can lower gas consumption.
Proof of Concept
In this code from Collateral.sol, _balanceAfter ≥ _balanceBefore so unchecked can be used
Instead, replace the last line with
Tools Used
Manual analysis
Recommended Mitigation Steps
Use unchecked for arithmetic gas optimizations
Redundant zero initialization
Impact
Solidity does not recognize null as a value, so uint variables are initialized to zero. Setting a uint variable to zero is redundant and can waste gas.
Proof of Concept
https://github.com/code-423n4/2022-03-prepo/blob/main/contracts/core/Collateral.sol#L81
Tools Used
Manual analysis
Recommended Mitigation Steps
Remove the redundant zero initialization
uint256 _shares;
The text was updated successfully, but these errors were encountered: