code-423n4 / 2022-10-inverse-findings

0 stars 0 forks source link

Gas Optimizations #568

Closed code423n4 closed 1 year ago

code423n4 commented 1 year ago

Gas Optimizations:

[G-01] Use constant instead of immutable
[G-02] Use external instead of public
[G-03] Use payable for onlyOwner function

Details:

[G-01] Use constant instead of immutable for gas efficiency

src/Market.sol

Recommend changing from immutable to constant

IERC20 public constant dola = IERC20(0x865377367054516e17014CcdED1e7d814EDC9ce4);

[G-02] Use external instead of public

src/Market.sol onlyGov:

src/DBR.sol onlyOperator:

Recommend changing to external since these functions are not called by internal methods

[G-03] Use payable for onlyGov and onlyOperator function

Since these functions are only for developers, chances of accidentally sending ETH along are very low src/Market.sol onlyGov:

src/DBR.sol onlyOperator:

Recommend marking these functions payable to save some gas

c4-judge commented 1 year ago

0xean marked the issue as grade-c