chain_data
Postgres schema written by eth-indexer. Full column notes: eth-indexer/DATA_GUIDE.md.
Every event row FKs to tx via tx_id. Join contract_address to tokens / pools for metadata.
Tables
| Table | Contents |
|---|---|
tx | tx_hash, block_number, date_block (UTC), success |
token_transfer | ERC-20 Transfer |
token_mint / token_burn | mint / burn |
faucet_give | faucet payouts |
pool_swap | Swap / SwapSettlement |
pool_deposit | deposits (including the deposit half of a swap) |
index_active | activation flips on an index |
ownership_change | OwnershipTransferred |
tokens / pools | metadata; removed=true means delisted, row kept |
Idempotency: (tx_id, …, log_index).
Values are raw integers. Scale with power(10, token_decimals).
pool_swap.fee, protocol_fee, and all out amounts are in token_out. quoted_out_value / nominal_out_value / protocol_fee are NULL below pool_settlement_block. Treat NULL as unknown, not zero.
Example
SELECT
tt.contract_address,
tk.token_symbol,
COUNT(*) AS transfer_count,
SUM(tt.transfer_value / power(10, tk.token_decimals)) AS total_volume
FROM token_transfer tt
JOIN tx ON tx.id = tt.tx_id
JOIN tokens tk ON tk.contract_address = tt.contract_address
WHERE tx.success = true AND tk.removed = false
GROUP BY tt.contract_address, tk.token_symbol
ORDER BY total_volume DESC;