Storage & deploys
storage layout & packing
Paste a contract’s state variables or a struct and see its storage layout slot by slot (same as solc’s storageLayout), the bytes wasted between variables, and a reordering that packs them into fewer slots, with the gas it saves.
not in storage: MAX_FEE (constant)
- 0decimals31 bytes free
- 1totalAssets
- 2ownerpaused11 bytes free
- 3shares
- 4lastHarvestcap8 bytes free
- 5strategyfeeBpsinitialized7 bytes free
name type slot offset bytes
decimals uint8 0 0 1
totalAssets uint256 1 0 32
owner address 2 0 20
paused bool 2 20 1
shares mapping(address => uint256) 3 0 32
lastHarvest uint64 4 0 8
cap uint128 4 8 16
strategy address 5 0 20
feeBps uint32 5 20 4
initialized bool 5 24 1- 0strategydecimalspausedinitialized9 bytes free
- 1ownerlastHarvestfeeBps
- 2cap16 bytes free
- 3totalAssets
- 4shares
address public strategy;
uint8 public decimals;
bool public paused;
bool public initialized;
address public owner;
uint64 public lastHarvest;
uint32 public feeBps;
uint128 public cap;
uint256 public totalAssets;
mapping(address => uint256) public shares;1 fewer slot: about 20,000 less gas the first time they are all set, and 2,100 per cold read when used togetheronly reorder storage before the first deploy. an upgradeable contract that's live has its slots fixed forever: append new variables at the end instead.
