Skip to content
Lattice

StrategyManagerLib Constants

Git Source

STRATEGY_MANAGER_STORAGE_SLOT

keccak256(abi.encode(uint256(keccak256("lattice.storage.StrategyManager")) - 1)) & ~bytes32(uint256(0xff)). Precomputed: 0x1b00913e47c53f1d64d326bde2ad6a7904ed791d4ee4432bc133be907894ca00

bytes32 constant STRATEGY_MANAGER_STORAGE_SLOT = 0x1b00913e47c53f1d64d326bde2ad6a7904ed791d4ee4432bc133be907894ca00;

STRATEGY_MANAGER_ERC165_STORAGE_LOCATION

ERC-165 storage location (shared across all Lattice modules). keccak256(abi.encode(uint256(keccak256("diamond.lib.storage.ERC165")) - 1)) & ~bytes32(uint256(0xff)).

bytes32 constant STRATEGY_MANAGER_ERC165_STORAGE_LOCATION =
    0x9ca7f3e2e2bfb15fdf072b85dde92837cddacee6cf2f6b38cd06c9457c1c4200;

ERC165_MAP_ISTRATEGYMANAGER_SLOT

0xcce4011b is type(IStrategyManager).interfaceId. keccak256(abi.encode(bytes4(0xcce4011b), 0x9ca7f3e2e2bfb15fdf072b85dde92837cddacee6cf2f6b38cd06c9457c1c4200)).

bytes32 constant ERC165_MAP_ISTRATEGYMANAGER_SLOT = 0x3d05027e9ebc1daac4235d8ac5fc59b9acea5ece08ff307b79ab5b69ad569930;

ERC165_MAP_ISTRATEGYMANAGERRECOVERY_SLOT

0xd352d843 is type(IStrategyManagerRecovery).interfaceId. keccak256(abi.encode(bytes4(0xd352d843), 0x9ca7f3e2e2bfb15fdf072b85dde92837cddacee6cf2f6b38cd06c9457c1c4200)).

bytes32 constant ERC165_MAP_ISTRATEGYMANAGERRECOVERY_SLOT =
    0x59c693771151cd0d11eb26b1e9fd28dca5722cdc5fa2b4db3a12e7d9be8d4e2c;

MAX_STRATEGIES

Maximum number of strategies that can be registered simultaneously. Limits the iteration cost of totalAllocated() (read by every ERC-4626 conversion, preview, max* view and mutator via VaultCore.totalAssets()) and rebalance(), preventing gas-based DoS.

uint256 constant MAX_STRATEGIES = 20;

REBALANCE_SHORTFALL_TOLERANCE

Largest value loss, in the asset's smallest unit, that rebalance() accepts on one strategy recall: the drop in the strategy's reported balance may exceed what the vault received by at most this much. Sized for share/index rounding (a few wei); anything larger is a real loss and reverts with IStrategyManager.StrategyManagerWithdrawShortfall. Fixed by design: not configurable, no storage.

uint256 constant REBALANCE_SHORTFALL_TOLERANCE = 10;

ERC165_SUPPORTS_INTERFACE_SELECTOR

IERC165.supportsInterface(bytes4), probed before rebalance() calls an adapter's deploy().

bytes4 constant ERC165_SUPPORTS_INTERFACE_SELECTOR = 0x01ffc9a7;