Skip to content

For AI agents: a documentation index is available at /llms.txt. Every page is also available as Markdown at the same URL with a .md suffix, or by requesting Accept: text/markdown.

BLOK Capital

IndexStorage.sol

As the Diamond pattern relies on , state must be carefully managed to avoid storage collisions. Blok Capital uses the Diamond Storage pattern.

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 days; // Minimum cooldown
uint256 internal constant MAX_VALUE_LOSS_BPS = 50;     // 0.5% max portfolio loss
uint256 internal constant INTENT_EXPIRY = 10 minutes;
uint256 internal constant INTENT_INTERVAL = 11 minutes; // Must exceed INTENT_EXPIRY
uint256 internal constant STORAGE_LAYOUT_VERSION = 2;
 
// Diamond Storage Layout (v2)
struct Layout {
    address indexAddress;
    uint256 lastRebalanceTimestamp;
    uint256 lastIntentTimestamp;
    bool rebalancing; // Custom reentrancy guard
    PendingIntent pendingIntent;
    uint256 lastIntentBlock; // Flash loan protection
 
    // Appended in v2: configured at install, not compile-time constants
    address indexFactory;
    address indexComponentRegistry;
    address poolRegistry;
}

Two details worth noting here.

The rebalance cooldown is a full day, not an hour. Because each execution can lose at most 0.5% of portfolio value, a daily interval is what bounds worst-case extraction from repeatedly triggering a permissionless rebalance.

INTENT_INTERVAL must stay strictly greater than INTENT_EXPIRY. If the two were equal, a new intent could overwrite a still-valid pending one at the exact expiry boundary, which would let someone grief or front-run an in-flight rebalance.

Registry addresses moved into storage (v2)#

Earlier versions hardcoded the IndexFactory, IndexComponentRegistry and LiquidityPoolRegistry addresses as compile-time constants in this library. They now live in the storage layout instead, set by the deployer at install time.

The reason is practical: redeploying a protocol component no longer requires recompiling and re-cutting every facet that referenced it. If you're reading an older deployment, expect to find those addresses baked into the bytecode rather than readable from storage.