Skip to content
Dune Analytics

@kroeger0x / Compound Balances at Block Height

SQL query

1DROP TABLE IF EXISTS dune_user_generated.ctoken_transfers_at_block_height;
2CREATE TABLE dune_user_generated.ctoken_transfers_at_block_height AS (
3    WITH
4        tr_to AS (
5            SELECT
6                "to" AS address
7                , token_symbol
8                , underlying_token
9                , SUM(amount) AS token_amount
10            FROM compound."view_transfer_ctoken"
11            WHERE
12                block_time < '2020-10-17 00:00'
13            GROUP BY 1,2,3
14        )
15        , tr_from AS (
16            SELECT
17                "from" AS address
18                , token_symbol
19                , underlying_token
20                , -SUM(amount) AS token_amount
21            FROM compound."view_transfer_ctoken"
22            WHERE
23                block_time < '2020-10-17 00:00'
24            GROUP BY 1,2,3
25        )...

SQL query results

Loading