## Table Schema

| Column           | Type       | Description                                                                                                                                         |
|------------------|------------|-----------------------------------------------------------------------------------------------------------------------------------------------------|
| `blockchain`     | `varchar`  | Chain identifier (e.g. `ethereum`)                                                                                                               |
| `address`        | `varbinary`| Account address                                                                                                                                   |
| `token_address`  | `varbinary`| Token contract address. Native tokens use the standardized address from `dune.blockchains` (zero address on most EVMs, `0x0000…1010` on Polygon). |
| `token_standard` | `varchar`  | `native` or `erc20`                                                                                                                               |
| `token_symbol`   | `varchar`  | Token symbol from `tokens_<chain>.erc20` (nullable)                                                                                              |
| `balance_raw`    | `uint256`  | Current balance in raw units (always `> 0`)                                                                                                       |
| `balance`        | `double`    | Current balance in display units (`balance_raw / 10^decimals`, falls back to 18 decimals when unknown)                                            |
| `balance_usd`    | `double`    | `balance * prices.latest.price`. `NULL` when no price is available for that token; `coalesce(balance_usd, 0)` if you need to sum across mixed-coverage tokens. |
| `block_number`   | `bigint`   | Block of the most recent balance update                                                                                                            |
| `updated_at`     | `timestamp` | Block time of the most recent balance update                                                                                                      |

## Example Queries

**Current portfolio for a wallet, USD-sorted:**

```
SELECT token_symbol, token_address, balance, balance_usd
FROM balances_ethereum.latest
WHERE address = 0xd8da6bf26964af9d7eed9e03e53415d37aa96045
ORDER BY balance_usd DESC NULLS LAST
```

**Top 50 holders of a token:**

```
SELECT address, balance, balance_usd
FROM balances_ethereum.latest
WHERE token_address = 0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48 -- USDC
ORDER BY balance DESC
LIMIT 50
```

**Native ETH locked in the WETH contract (equals current wrapped ETH supply):**

```
SELECT balance AS eth_wrapped
FROM balances_ethereum.latest
WHERE address = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2 -- WETH
  AND token_address = 0x0000000000000000000000000000000000000000 -- native ETH
```
