Axiom V2 Docs Old
  • Introduction
    • What is Axiom?
    • Quickstart
  • Examples
    • Autonomous Airdrop
      • AxiomREPL Code
      • Contract
      • Web App
      • DataQuery-only Version
  • Developers
    • Axiom for Developers
    • Specifying a Query into Axiom
    • AxiomREPL
      • AxiomREPL Examples
    • Exporting a Client Side Prover
    • Handling Axiom Callbacks
    • Common Issues
      • Callback Debugging
  • SDK and REPL Reference
    • Axiom SDK Reference
      • QueryBuilderV2
      • Data Subqueries
        • Header Subquery
        • Account Subquery
        • Storage Subquery
        • Transaction Subquery
        • Receipt Subquery
        • Solidity Nested Mapping Subquery
    • AxiomREPL Reference
      • Circuit Types
      • Circuit Functions
      • Data Functions
      • Compute Functions
  • Protocol Design
    • Architecture Overview
    • Caching Block Hashes
    • Axiom Query Protocol
      • Axiom Query Format
    • ZK Circuits for Axiom Queries
    • Ethereum On-chain Data
    • Guardrails
  • Transparency and Security
    • KZG Trusted Setup
    • Contract Addresses
    • On-chain ZK Verifiers
    • Security
  • Zero Knowledge Proofs
    • Introduction to ZK
    • ZK Examples
    • Getting Started with halo2
    • halo2-repl
  • Additional Resources
    • Axiom V2 Explorer
    • Github
    • Website
    • Telegram
    • Discord
    • Axiom V1 Docs
Powered by GitBook
On this page
  • Description
  • Limits
  • Builder
  • Examples
  1. SDK and REPL Reference
  2. Axiom SDK Reference
  3. Data Subqueries

Storage Subquery

Query a storage slot in the past

PreviousAccount SubqueryNextTransaction Subquery

Last updated 1 year ago

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 .

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);
evm.storage