Afonso_DiazNet staked
    Updated 2024-09-17
    with

    main as (
    select
    tx_hash,
    block_timestamp,
    amount,
    iff(from_address = '0x0000000000000000000000000000000000000000', 'Mint', 'Redeem') as event_type,
    origin_from_address as user
    from
    avalanche.core.ez_token_transfers
    where
    contract_address = '0x698c34bad17193af7e1b4eb07d1309ff6c5e715e'
    and '0x0000000000000000000000000000000000000000' in (from_address, to_address)
    and origin_to_address is not null
    )

    select * from (
    select
    date_trunc('{{ period }}', block_timestamp) as date,
    sum(iff(event_type = 'Mint', 1, -1) * amount) as net_volume,
    sum(net_volume) over (order by date) as cumulative_net_volume
    from
    main
    group by 1
    )
    where
    date between '{{ start_date }}' and '{{ end_date }}'
    order by date



    QueryRunArchived: QueryRun has been archived