Ali3NWeekdays Activity (KaiaSwap Kaia)
    Updated 2024-10-28
    with timetable as (
    select case when '{{TimeFrame}}' = 'Last 7 Days' then 7
    when '{{TimeFrame}}' = 'Last 30 Days' then 30
    when '{{TimeFrame}}' = 'Last 60 Days' then 60
    when '{{TimeFrame}}' = 'Last 90 Days' then 90
    when '{{TimeFrame}}' = 'Last 180 Days' then 180
    when '{{TimeFrame}}' = 'Last 365 Days' then 365
    when '{{TimeFrame}}' = 'All Time' then 5000
    else 5000 end as timeframe),


    --CREDIT: HESS https://flipsidecrypto.xyz/hess/q/-5OrmKjiPFhM/total-trading
    table1 as (
    select block_timestamp,
    tx_hash,
    origin_from_address,
    amount_in_usd,
    amount_out_usd,
    amount_in,
    amount_out,
    token_in,
    token_out,
    symbol_in,
    symbol_out
    from kaia.defi.ez_dex_swaps
    where platform ilike '%kaiaswap%'),

    swapst as (
    select *,
    case when token_in in ('0x5c13e303a62fc5dedf5b52d66873f2e59fedadc2','0x608792deb376cce1c9fa4d0e6b7b44f507cffa6a','0x4e4a231e864219704ccc1acd81043129157c1901','0xe2053bcf56d2030d2470fb454574237cf9ee3d4b','0xcee8faf64bb97a73bb51e115aa89c17ffa8dd167','0x754288077d0ff82af7a5317c7cb8c444d421d103','0x7d8142a696ddbb8eaaa937696c35772190b234cb','0xcb2c7998696ef7a582dfd0aafadcd008d03e791a') then amount_in else amount_in_usd end as amount_1,
    case when token_out in ('0x5c13e303a62fc5dedf5b52d66873f2e59fedadc2','0x608792deb376cce1c9fa4d0e6b7b44f507cffa6a','0x4e4a231e864219704ccc1acd81043129157c1901','0xe2053bcf56d2030d2470fb454574237cf9ee3d4b','0xcee8faf64bb97a73bb51e115aa89c17ffa8dd167','0x754288077d0ff82af7a5317c7cb8c444d421d103','0x7d8142a696ddbb8eaaa937696c35772190b234cb','0xcb2c7998696ef7a582dfd0aafadcd008d03e791a') then amount_out else amount_out_usd end as amount_2,
    case when token_in = '0xaaecb956075daf626bc5d507bb38764e122cf209' then 'ACE'
    when token_in = '0xd3f78c32af988d67c16f02c3631bf4047ffda617' then 'oETH'
    when token_in = '0x57f6f9d14bbd43d06188a87882e240d42ddd1393' then 'PrayOzys'
    when token_in = '0xe3f85b41a284ed965826adc98365e70e67a2f556' then 'KKAK'
    when token_in = '0x27397bfbefd58a437f2636f80a8e70cfc363d4ff' then 'GPC'
    Auto-refreshes every 24 hours
    QueryRunArchived: QueryRun has been archived