IndexStorage.sol
As the Diamond pattern relies on delegatecall, state must be carefully managed to avoid storage collisions. Blok Capital uses the Diamond Storage pattern.
Main Focus: Protocol Guardrails
This library defines the exact Arbitrum One Mainnet addresses for oracles and sets the strict financial boundaries for rebalancing operations.
Crucial Builder Snippet: Financial Limits & Storage Layout
Builders must understand these hardcoded thresholds. For example, a swap route that loses more than 50 basis points (0.5%) of the total portfolio value will automatically revert.
// Rebalancing Parameters
uint256 internal constant BALANCE_THRESHOLD_BPS = 200; // 2% tolerance per asset
uint256 internal constant REBALANCE_INTERVAL = 1 hours; // Minimum cooldown
uint256 internal constant MAX_VALUE_LOSS_BPS = 50; // 0.5% max portfolio loss
uint256 internal constant INTENT_EXPIRY = 10 minutes;
// Diamond Storage Layout
struct Layout {
address indexAddress;
uint256 lastRebalanceTimestamp;
uint256 lastIntentTimestamp;
bool rebalancing; // Custom reentrancy guard
PendingIntent pendingIntent;
uint256 lastIntentBlock; // Flash loan protection
}