Madidefi platform no
    Updated 2023-05-04
    with delegates as (
    select DISTINCT EVENT_INPUTS:toDelegate as Delegate
    from arbitrum.core.fact_event_logs
    where EVENT_NAME = 'DelegateChanged'
    and CONTRACT_ADDRESS = '0x912ce59144191c1204e64559fe8253a0e49e6548' -- ARB tokens
    and TX_STATUS = 'SUCCESS' and EVENT_REMOVED = 'false'
    and BLOCK_TIMESTAMP != current_date)

    select
    BLOCK_TIMESTAMP::date as date,
    initcap(project_NAME) as platfrom,
    count(DISTINCT TX_HASH) as count_tx
    from arbitrum.core.fact_event_logs a JOIN
    arbitrum.core.dim_labels b on a.CONTRACT_ADDRESS = b.address
    where ORIGIN_FROM_ADDRESS not in (select * from delegates)
    and BLOCK_TIMESTAMP >= '2023-01-01' and LABEL_TYPE in ('defi')
    and TX_STATUS = 'SUCCESS' and EVENT_REMOVED = 'false'
    and initcap(project_NAME) in ('Stargate Finance','Gmx','Radiant','Dopex','Aave')
    --,'Rage Trade','Vesta Finance','Aave','Gains Network','Frax Finance')
    group by 1,2




    Run a query to Download Data