RayyykOptimism Bridge 7
    Updated 2022-10-23
    with table_1 as (select address
    from ethereum.core.dim_labels
    where label like '%optimism%'
    and label_type = 'layer2'),

    table_2 as (select date_trunc('{{Periodical}}', block_timestamp) as month,
    symbol,
    count(distinct(tx_hash)) as tx_count,
    sum(amount_usd) as usd_volume
    from ethereum.core.ez_token_transfers a
    inner join ethereum.core.dim_labels b on b.address = a.from_address
    where to_address in (select address from table_1)
    and block_timestamp >= '{{Starting_Date}}'
    group by 1,2
    union
    select date_trunc('{{Periodical}}', block_timestamp) as month,
    'ETH' as symbol,
    count(distinct(tx_hash)) as tx_count,
    sum(amount_usd) as usd_volume
    from ethereum.core.ez_eth_transfers
    where eth_to_address in (select address from table_1)
    and block_timestamp >= '{{Starting_Date}}'
    group by 1,2),

    table_3 as (select address
    from ethereum.core.dim_labels
    where label like '%hop%'
    and label_type = 'layer2'),

    table_4 as (select date_trunc('{{Periodical}}', block_timestamp) as month,
    symbol,
    count(distinct(tx_hash)) as tx_count,
    sum(amount_usd) as usd_volume
    from ethereum.core.ez_token_transfers a
    inner join ethereum.core.dim_labels b on b.address = a.from_address
    where to_address in (select address from table_3)
    Run a query to Download Data