phu[Ethereum] daily cumulative swap from vs minted rETH
    Updated 2022-09-12
    with
    minted_cte as (
    select
    BLOCK_TIMESTAMP::date date
    , sum(RAW_AMOUNT / 1e18) minted
    from ethereum.core.ez_token_transfers
    where 1=1
    and FROM_ADDRESS = '0x0000000000000000000000000000000000000000'
    and CONTRACT_ADDRESS = '0xae78736cd615f374d3085123a210448e74fc6393'
    and ORIGIN_TO_ADDRESS in ('0x4d05e3d48a938db4b7a9a59a802d5b45011bde58','0x2cac916b2a963bf162f076c0a8a4a8200bcfbfb4')
    group by 1
    )
    , price_cte as (
    select
    date_trunc('day',hour)::date date
    , avg(price) price
    from ethereum.core.fact_hourly_token_prices
    where 1=1
    and (
    -- TOKEN_ADDRESS = '0xd01ef7c0a5d8c432fc2d1a85c66cf2327362e5c6'
    -- or
    -- TOKEN_ADDRESS = '0xe95a203b1a91a908f9b9ce46459d101078c2c3cb'
    -- or
    -- TOKEN_ADDRESS = '0xae7ab96520de3a18e5e111b5eaab095312d7fe84'
    -- or
    TOKEN_ADDRESS = '0xae78736cd615f374d3085123a210448e74fc6393'
    )
    and date >= '2021-11-23'
    group by 1
    )
    , swap_cte as (
    select
    a.date
    , AMOUNT_USD / price swap
    from (
    select
    Run a query to Download Data