code-423n4 / 2021-12-yetifinance-findings

0 stars 0 forks source link

Change `public` constant variables to `private` / `internal` can save gas #271

Closed code423n4 closed 2 years ago

code423n4 commented 2 years ago

Handle

WatchPug

Vulnerability details

https://github.com/code-423n4/2021-12-yetifinance/blob/5f5bf61209b722ba568623d8446111b1ea5cb61c/packages/contracts/contracts/TroveManager.sol#L29-L29

uint constant public SECONDS_IN_ONE_MINUTE = 60;

https://github.com/code-423n4/2021-12-yetifinance/blob/5f5bf61209b722ba568623d8446111b1ea5cb61c/packages/contracts/contracts/YETI/CommunityIssuance.sol#L21-L21

uint constant public SECONDS_IN_ONE_MINUTE = 60;

https://github.com/code-423n4/2021-12-yetifinance/blob/5f5bf61209b722ba568623d8446111b1ea5cb61c/packages/contracts/contracts/YETI/LockupContract.sol#L25-L25

uint constant public SECONDS_IN_ONE_YEAR = 31536000;

For the constants that should not be public, changing them to private / internal can save some gas.

kingyetifinance commented 2 years ago

Duplicate #95