Storage Subquery

Query a storage slot in the past

Description

Storage Subqueries provide information about a contract's storage slot at some past block number. A very useful tool for looking up storage slots for contract addresses is evm.storage.

Limits

Maximum of 32 (Account + Storage + Nested Mapping) subqueries per Query.

Builder

buildStorageSubquery(blockNum)

Examples

const storageSubquery: StorageSubquery = buildStorageSubquery(9000000)
    .address("0xd9e10c6b1bd26de4e2749ce8afe8dd64294bcbf5")
    .slot(3);
const mappedSlot = getSlotForMapping(
    2,  // slot of the mapping 
    "address",  // data type of the mapping key
    "0x4C5252bE8474664e14c9C122C295AB4e06D37cF0"  // mapping key
);
const storageSubquery: StorageSubquery = buildStorageSubquery(9000000)
    .address("0xd9e10c6b1bd26de4e2749ce8afe8dd64294bcbf5")
    .slot(mappedSlot);
const arraySlot = getSlotForArray(
    5,  // slot of the array
    "uint128",  // data type of the array
    10  // index of the data in the array
);
const storageSubquery: StorageSubquery = buildStorageSubquery(9000000)
    .address("0xd9e10c6b1bd26de4e2749ce8afe8dd64294bcbf5")
    .slot(arraySlot);

Last updated