From 86d556dcf0318f926f8e3292c164b7bad074c60b Mon Sep 17 00:00:00 2001 From: Centaur AI Date: Thu, 14 May 2026 18:28:18 +0000 Subject: [PATCH 1/2] docs(querying-tempo): replace static SQL with interactive IndexSupply widgets Convert static code blocks to components so readers can run the example queries live against Tempo mainnet (chain 4217). Uses the existing IndexSupplyQuery component already used in the orderbook guide. Amp-Thread-ID: https://ampcode.com/threads/T-019e0369-6a2a-7159-a746-cb64baa9b7d8 --- src/pages/quickstart/querying-tempo.mdx | 84 ++++++++++++++++--------- 1 file changed, 54 insertions(+), 30 deletions(-) diff --git a/src/pages/quickstart/querying-tempo.mdx b/src/pages/quickstart/querying-tempo.mdx index 046efcbf..717aa517 100644 --- a/src/pages/quickstart/querying-tempo.mdx +++ b/src/pages/quickstart/querying-tempo.mdx @@ -4,11 +4,13 @@ description: Write correct analytics queries for Tempo. Covers fee units, TIP-20 showOutline: 1 --- +import { IndexSupplyQuery } from '../../components/IndexSupplyQuery' + # Querying Tempo Tempo is EVM-compatible, so most query patterns you already know work here. There are a handful of differences that will silently produce wrong numbers if you carry over Ethereum assumptions. -Examples use generic SQL — table and column names will vary by platform. +These examples use [Index Supply](https://www.indexsupply.net) as the indexing provider. Each query runs against Tempo mainnet (chain 4217) — click **Run Query** to execute live. ## 1. Fees are in USD, not ETH @@ -16,13 +18,19 @@ On Ethereum, gas price is in wei (10⁻¹⁸ ETH). On Tempo, it's in **attodolla Round to the nearest microdollar (how fees actually settle): -```sql -SELECT date_trunc('day', block_time) AS day, - SUM(CEIL(effective_gas_price * gas_used / 1e12) / 1e6) AS usd_fees -FROM transactions -GROUP BY 1 -ORDER BY 1; -``` + ## 2. TIP-20 tokens use 6 decimals, not 18 @@ -32,14 +40,22 @@ Divide token amounts by `1e6`. Using `1e18` gives a result 10¹² times too smal `tx.value` is always zero on Tempo. All token movement is in `Transfer` events. -```sql -SELECT date_trunc('day', block_time) AS day, - token_address, - SUM(amount) / 1e6 AS volume_usd -FROM tip20_transfers -GROUP BY 1, 2 -ORDER BY 1; -``` + `TransferWithMemo` (used by MPP) also emits a standard `Transfer`. Query only `Transfer` to avoid double-counting. @@ -55,6 +71,10 @@ GROUP BY 1 ORDER BY 2 DESC; ``` +:::note +The `fee_payer` column is available on platforms like Dune that decode Tempo-specific fields. In Index Supply's base `txs` table, use `"from"` for sender attribution. +::: + ## 5. Exclude system transactions from user metrics `from = 0x0000…0000` is system-level. Include in raw chain metrics, exclude when measuring users. @@ -63,20 +83,24 @@ ORDER BY 2 DESC; Genesis mints may not emit `Mint`. Derive supply from `Transfer`: mints have `from = 0x0…0`, burns have `to = 0x0…0`. -```sql -SELECT - SUM(CASE WHEN "from" = '0x0000000000000000000000000000000000000000' - THEN amount / 1e6 ELSE 0 END) AS total_minted, - SUM(CASE WHEN "to" = '0x0000000000000000000000000000000000000000' - THEN amount / 1e6 ELSE 0 END) AS total_burned, - SUM(CASE WHEN "from" = '0x0000000000000000000000000000000000000000' - THEN amount / 1e6 - WHEN "to" = '0x0000000000000000000000000000000000000000' - THEN -amount / 1e6 - ELSE 0 END) AS supply -FROM tip20_transfers -WHERE token_address = ; -``` + ## Key addresses From b9b7f1e77f8a35b2b2ad720a457e6553a2512eb5 Mon Sep 17 00:00:00 2001 From: Centaur AI Date: Thu, 14 May 2026 18:33:53 +0000 Subject: [PATCH 2/2] fix: replace :::note with blockquote (vocs-compatible) Amp-Thread-ID: https://ampcode.com/threads/T-019e0369-6a2a-7159-a746-cb64baa9b7d8 --- src/pages/quickstart/querying-tempo.mdx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/pages/quickstart/querying-tempo.mdx b/src/pages/quickstart/querying-tempo.mdx index 717aa517..c70f2dc3 100644 --- a/src/pages/quickstart/querying-tempo.mdx +++ b/src/pages/quickstart/querying-tempo.mdx @@ -71,9 +71,7 @@ GROUP BY 1 ORDER BY 2 DESC; ``` -:::note -The `fee_payer` column is available on platforms like Dune that decode Tempo-specific fields. In Index Supply's base `txs` table, use `"from"` for sender attribution. -::: +> **Note:** The `fee_payer` column is available on platforms like Dune that decode Tempo-specific fields. In Index Supply's base `txs` table, use `"from"` for sender attribution. ## 5. Exclude system transactions from user metrics