MLDZMNptg1
    Updated 2023-02-19
    select
    'Deposit' as actions,
    count(distinct ORIGIN_FROM_ADDRESS) as no_users,
    count(distinct tx_hash) as no_txn,
    sum(RAW_AMOUNT / 1e6) as total_amount,
    avg(RAW_AMOUNT / 1e6) as avg_amount,
    median(RAW_AMOUNT / 1e6) as median_amount,
    no_txn/count(distinct date_trunc(day, block_timestamp)) as average_txn_per_day,
    total_amount/count(distinct date_trunc(day, block_timestamp)) as volume_per_day

    from optimism.core.fact_token_transfers
    where BLOCK_TIMESTAMP >= CURRENT_DATE - {{Time_period_days}}
    and contract_address = lower('0x625E7708f30cA75bfd92586e17077590C60eb4cD')
    and TO_ADDRESS= lower('0x4ecB5300D9ec6BCA09d66bfd8Dcb532e3192dDA1')
    group by 1
    union all
    select
    'Withdraw' as actions,
    count(distinct ORIGIN_from_ADDRESS) as no_users,
    count(distinct tx_hash) as no_txn,
    sum(RAW_AMOUNT / 1e6) as total_amount,
    avg(RAW_AMOUNT / 1e6) as avg_amount,
    median(RAW_AMOUNT / 1e6) as median_amount,
    no_txn/count(distinct date_trunc(day, block_timestamp)) as average_txn_per_day,
    total_amount/count(distinct date_trunc(day, block_timestamp)) as volume_per_day

    from optimism.core.fact_token_transfers
    where BLOCK_TIMESTAMP >= CURRENT_DATE - {{Time_period_days}}
    and contract_address = lower('0x625E7708f30cA75bfd92586e17077590C60eb4cD')
    and FROM_ADDRESS= lower('0x4ecB5300D9ec6BCA09d66bfd8Dcb532e3192dDA1')
    group by 1


    Run a query to Download Data