adriaparcerisasavalanche swaps vs l2 24
    Updated 2024-09-17
    with
    avax as (
    select
    case when token_in = lower('0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e') then symbol_out else symbol_in end as token,
    count(distinct tx_hash) as txs,
    count(distinct origin_from_address) as users,
    sum(case when token_in = lower('0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e') then amount_in else amount_out end) as volume,
    rank() over (order by txs desc) as ranks
    from avalanche.defi.ez_dex_swaps
    where token_out = lower('0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e') --or token_out = lower('0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e'))
    and block_timestamp >= '2022-01-01'
    group by 1
    ),
    opt as (
    SELECT
    case when token_in = lower('0x7F5c764cBc14f9669B88837ca1490cCa17c31607') then symbol_out else symbol_in end as token,
    count(distinct tx_hash) as txs,
    count(distinct origin_from_address) as users,
    sum(case when token_in = lower('0x7F5c764cBc14f9669B88837ca1490cCa17c31607') then amount_in else amount_out end) as volume,
    rank() over (order by txs desc) as ranks
    from optimism.defi.ez_dex_swaps
    where token_out = lower('0x7F5c764cBc14f9669B88837ca1490cCa17c31607') --or token_out = lower('0x7F5c764cBc14f9669B88837ca1490cCa17c31607'))
    and block_timestamp >= '2022-01-01'
    group by 1
    )
    , poly as (
    select
    case when token_in = lower('0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174') then symbol_out else symbol_in end as token,
    count(distinct tx_hash) as txs,
    count(distinct origin_from_address) as users,
    sum(case when token_in = lower('0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174') then amount_in else amount_out end) as volume,
    rank() over (order by txs desc) as ranks
    from polygon.defi.ez_dex_swaps
    where token_out = lower('0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174') --or token_out = lower('0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174'))
    and block_timestamp >= '2022-01-01'
    QueryRunArchived: QueryRun has been archived