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
Looping over state variables is expensive (roughly 100 gas per iteration), recommend storing to the stack and looping over that. For a small gas optimization per loop can also replace i++ with ++i. Will save a temp variable being created every loop (roughly 5 gas per iteration).
The same with treasure being set to address(0) as the default value and then reassigned in the constructor. Booster.sol#L114
Custom Errors
For the contracts using a compiler version > 0.8.4 you can replace their revert strings with custom errors. This is both cheaper in deployment and on runtime costs.
Uints > 0 in require Statements
If not using custom errors, in require statements if checking whether a uint is > 0 it is cheaper to replace with != 0.
Default values
When initizalising a variable to the default value it can be left blank to save some gas.
AuraBalRewardPool.sol#L35
AuraBalRewardPool.sol#L38-L39
AuraLocker.sol#L72
AuraMerkleDrop.sol#L29
BaseRewardPool.sol#L71-L77
Booster.sol#L29
ConvexMasterChef.sol#L63
CrvDepositor.sol#L36
VirtualBalanceRewardPool.sol#L89-L95
For Loop Optimisations
Looping over state variables is expensive (roughly 100 gas per iteration), recommend storing to the stack and looping over that. For a small gas optimization per loop can also replace i++ with ++i. Will save a temp variable being created every loop (roughly 5 gas per iteration).
Booster.sol#L379
BaseRewardPool.sol#L214
BaseRewardPool.sol#L230
BaseRewardPool.sol#L262
BaseRewardPool.sol#L296
Update Variable With Same Value
isShutdown is already set to false on contract creation as the default value and does not need to be reassigned to false in constructor.
Booster.sol#L108
The same with treasure being set to address(0) as the default value and then reassigned in the constructor.
Booster.sol#L114
Custom Errors
For the contracts using a compiler version > 0.8.4 you can replace their revert strings with custom errors. This is both cheaper in deployment and on runtime costs.
Uints > 0 in require Statements
If not using custom errors, in require statements if checking whether a uint is > 0 it is cheaper to replace with != 0.
Aura.sol#L68
AuraBalRewardPool.sol#L121
AuraBalRewardPool.sol#L139
AuraBalRewardPool.sol#L157
AuraBalRewardPool.sol#L210
AuraLocker.sol#L259
AuraLocker.sol#L359
AuraLocker.sol#L385
AuraLocker.sol#L431
AuraLocker.sol#L471
AuraLocker.sol#L822
AuraLocker.sol#L851
AuraMerkleDrop.sol#L122
AuraPenaltyForwarder.sol#L52
BalLiquidityProvider.sol#L57
BalLiquidityProvider.sol#L70
ExtraRewardsDistributor.sol#L171
PoolManagerSecondaryProxy.sol#L104
CrvDepositor.sol#L169
BaseRewardPool.sol#L211
BaseRewardPool.sol#L227
The text was updated successfully, but these errors were encountered: