code-423n4 / 2022-05-bunker-findings

1 stars 0 forks source link

Gas Optimizations #117

Open code423n4 opened 2 years ago

code423n4 commented 2 years ago

gas1:

changing visibility modifiers from public to external saves gas

gas2:

fix pragma, avoid floating pragma and better if atleast 0.8.4 to get compiler benefits and optimisations

gas3:

use indexed for address in events comptroller.sol #21-24

    event MarketEntered(CToken cToken, address account);

    /// @notice Emitted when an account exits a market
    event MarketExited(CToken cToken, address account);

gas4:

use prefix ++i rather than suffix i++ to save gas and no need to init i, as done in other contracts comptroller.sol #119,199,591,949,1223

  for (uint i = 0; i < cTokens.length; i++)