Balances
Overview
Block-level balances of assets on EVM-compatible blockchains.
We support balances for the following asset types:
Asset Type | Description |
---|---|
Fungible | Fungible assets models contains erc20 tokens and native (gas) token. |
Native | Native tokens are the gas tokens of the blockchain, such as ETH, BNB, POL, AVAX, etc. |
ERC20 | ERC20 tokens are the tokens that follow the ERC20 standard, such as USDC, USDT, etc. |
ERC721 | ERC721 tokens are the tokens that follow the ERC721 standard, such as Pudgy Penguins, etc. |
ERC1155 | ERC1155 tokens are the tokens that follow the ERC1155 standard, such as OpenSea Collection StoreFront, etc. |
Balance Tracking Methodology
Asset Type | Methodology |
---|---|
Fungible (ERC20 & Native) | We detect balance-changing events (transfers, mints, burns) and fetch balance at each relevant block height directly from the blockchain and index it into the balances table. |
Non-Fungible (ERC721 & ERC1155) | We track transfers through standard events: ERC721: Transfer() events and ERC1155: TransferSingle() and TransferBatch() events. From there, we build credit-debit tables to calculate cumulative ownership, accounting for multiple token transfers. |
Precision Handling
To maintain numerical precision, especially for tokens with large supplies or many decimal places:
- Raw balances are stored as VARCHAR to preserve exact values.
- Normalized balances are calculated using high-precision arithmetic with custom Snowflake UDFs.
- Both raw and human-readable balances are provided.
This approach ensures:
- No loss of precision from floating-point arithmetic.
- Accurate balance tracking over time.
- Reliable historical data for analysis.