code-423n4 / 2022-06-badger-findings

0 stars 0 forks source link

Gas Optimizations #145

Open code423n4 opened 2 years ago

code423n4 commented 2 years ago
  1. Title : Remove function for saving gas

When tend with no-op it could be this function below just doesn't do anything. It can be deleted instead for saving more gas

    // Example tend is a no-op which returns the values, could also just revert
    function _tend() internal override returns (TokenAmount[] memory tended) {
        revert("no op");
    }
  1. Title : : Using short reason string can be used for saving more gas

Every reason string takes at least 32 bytes. Use short reason strings that fits in 32 bytes or it will become more expensive.

Tool Used

Manual Review

Occurances

contracts/MyStrategy.sol#L186            "You have to wait for unlock or have to manually rebalance out of it"
GalloDaSballo commented 2 years ago

Personally a reverting tend is more fun and is more compatible when you work with 20 other people