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

0 stars 0 forks source link

Gas Optimization: Struct layout #245

Closed code423n4 closed 2 years ago

code423n4 commented 2 years ago

Handle

gzeon

Vulnerability details

Impact

Minor saving by grouping non 256-bit types https://github.com/code-423n4/2021-12-amun/blob/98f6e2ff91f5fcebc0489f5871183566feaec307/contracts/basket/contracts/facets/Basket/LibBasketStorage.sol#L10

    struct BasketStorage {
        uint256 lockBlock;
        uint256 maxCap;
        uint256 entryFee;
        uint256 entryFeeBeneficiaryShare; // amount of entry fee that goes to feeBeneficiary
        uint256 exitFee;
        uint256 exitFeeBeneficiaryShare; // amount of exit fee that goes to the pool itself
        uint256 annualizedFee;
        uint256 lastAnnualizedFeeClaimed;
        IERC20[] tokens;
        mapping(address => bool) inPool;
        address feeBeneficiary;
    }
0xleastwood commented 2 years ago

I don't see where there would be gas savings here.