boomer77kek paraswap
    Updated 2021-12-15
    with claiming_tx as (
    select * from ethereum.udm_events
    where contract_address = lower('0xcAfE001067cDEF266AfB7Eb5A286dCFD277f3dE5')
    and origin_function_name = 'claim'
    ),
    claim_psp_tx as (
    select date_trunc('day', block_timestamp) as dt, tx_id,
    origin_address as claimer,
    amount / 1e18 as amount_claim,
    amount_usd / 1e18 as amount_claim_usd
    from ethereum.udm_events
    where tx_id in (select tx_id from claiming_tx)
    group by 1,2,3,4,5
    ),

    claim_stat as (
    select sum(amount_claim) as total_claim, sum(amount_claim_usd) as total_claim_usd,
    count(distinct claimer) as num_claimers, dt
    from claim_psp_tx
    group by 4
    ),

    sell_tx as (
    select amount , origin_address as seller,
    date_trunc('day',block_timestamp) as dt
    from ethereum.udm_events
    where contract_address = lower('0xcafe001067cdef266afb7eb5a286dcfd277f3de5')
    and to_address in (lower('0x4a73a7e29988F171910119d660c4dd548282bF2a') ,lower('0xB4bBb0d88631d843b344892c24E3123F25801705'))
    and origin_address in (select claimer from claim_psp_tx)
    and from_address = origin_address
    ),

    sell_stat as (
    select sum(amount/1e18) as total_sell, count(distinct seller) as num_seller,
    Run a query to Download Data