KelHoggs-T6h_ROGains Network Perp Volume + Traders copy
    Updated 2024-07-01
    -- forked from 0xnirmal / Gains Network Perp Volume + Traders @ https://flipsidecrypto.xyz/0xnirmal/q/WBQ5msVGjjEz/gains-network-perp-volume-traders

    with
    arbitrum as (
    select
    block_timestamp::date as date,
    DECODED_LOG:positionSizeDai::number / 1e18 positionSizeDai,
    FULL_DECODED_LOG:data[1]:value[7]::number leverage,
    positionSizeDai * leverage as volume,
    FULL_DECODED_LOG:data[1]:value[0] trader,
    *
    from
    arbitrum.core.ez_decoded_event_logs
    where
    lower(contract_address) = lower('0x298a695906e16aeA0a184A2815A76eAd1a0b7522')
    and (Event_Name = 'MarketExecuted')
    UNION
    select
    block_timestamp::date as date,
    DECODED_LOG:positionSizeDai::number / 1e18 positionSizeDai,
    FULL_DECODED_LOG:data[0]:value[7]::number leverage,
    positionSizeDai * leverage as volume,
    FULL_DECODED_LOG:data[0]:value[0] trader,
    *
    from
    arbitrum.core.ez_decoded_event_logs
    where
    lower(contract_address) = lower('0x298a695906e16aeA0a184A2815A76eAd1a0b7522')
    and (Event_Name = 'LimitExecuted')
    ),
    polygon as (
    select
    block_timestamp::date as date,
    DECODED_LOG:positionSizeDai::number / 1e18 positionSizeDai,
    FULL_DECODED_LOG:data[1]:value[7]::number leverage,
    positionSizeDai * leverage as volume,
    QueryRunArchived: QueryRun has been archived