maybeyonasdai_market
    Updated 2022-05-15
    with
    dai_move as (
    select
    date(block_timestamp) as date,
    sum(amount) as dai_vol,
    count(distinct tx_hash) as txs
    from flipside_prod_db.ethereum_core.ez_token_transfers
    where contract_address = '0x6b175474e89094c44da98b954eedeac495271d0f'
    and block_timestamp >= current_date - interval '365 days'
    group by 1
    ),
    maker_colls as (
    select
    date,
    sum(usd_assets) over (order by date rows between unbounded preceding and current row) as total_collateral
    from (
    select
    date(block_timestamp) as date,
    count(tx_id) as deposits,
    sum(amount) as asset,
    sum(amount_usd) as usd_assets
    from ethereum.udm_events
    where
    ( event_type ='erc20_transfer' or event_type = 'native_eth') and
    to_label='maker'
    and amount_usd is not null
    group by 1
    )
    ),
    eth_prices as (
    select
    date(hour) as date,
    median(price) as eth_price
    from flipside_prod_db.ethereum_core.fact_hourly_token_prices
    where symbol = 'WETH'
    group by 1
    Run a query to Download Data