smartymetricstest exercise stables
    Updated 2024-10-25
    -- find an address of choice, aggregate the amount of eth sent out by month this year
    -- with raw as (
    -- SELECT
    -- block_timestamp,
    -- amount
    -- FROM ethereum.core.ez_native_transfers
    -- WHERE
    -- from_address = lower('0x4838b106fce9647bdf1e7877bf73ce8b0bad5f97')
    -- AND
    -- block_timestamp :: date >= CURRENT_DATE - interval '1 year'
    -- )

    -- SELECT
    -- date_trunc('month', block_timestamp) as month,
    -- sum(amount)
    -- FROM raw
    -- GROUP BY all

    -- compare number of times stablecoins are sent - usdc, usdt, dai in May 2024

    with raw as (
    SELECT
    COUNT (tx_hash) as n_txn,
    symbol,
    date_trunc('day', block_timestamp) as day
    FROM ethereum.core.ez_token_transfers
    WHERE
    contract_address IN ('0xdac17f958d2ee523a2206206994597c13d831ec7', '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', '0x6b175474e89094c44da98b954eedeac495271d0f')
    AND
    block_timestamp :: date BETWEEN '2024-05-01' AND '2024-05-31'
    GROUP BY all
    ORDER BY day
    )

    SELECT *
    from raw
    QueryRunArchived: QueryRun has been archived