Moe1 FUNG
    Updated 2023-05-19
    with prices as (
    select
    RECORDED_HOUR::date date,
    -- ID TOKEN_CONTRACT,
    TOKEN,
    avg(CLOSE) as price
    from
    flow.core.fact_hourly_prices
    where
    date >= CURRENT_DATE - {{days_back}}
    group by
    1,
    2
    )
    ,
    mid as (
    select
    * ,


    case
    when TOKEN_CONTRACT ilike '%REVV%' then 'Revv'
    when TOKEN_CONTRACT ilike '%Starly%' then 'Starly'
    when TOKEN_CONTRACT ilike '%Sportium%' then 'Sportium'
    when TOKEN_CONTRACT ilike '%40a61.FlowToken%' then 'Flow'
    when TOKEN_CONTRACT ilike '%TeleportedTetherToken%' then 'USDT'
    when TOKEN_CONTRACT ilike '%FiatToken%' then 'USDC'
    when TOKEN_CONTRACT ilike '%FUSD%' then 'FUSD'
    when TOKEN_CONTRACT ilike '%Blocto%' then 'Blocto'
    end as token from flow.core.ez_bridge_transactions
    )
    select
    date_trunc(week,BLOCK_TIMESTAMP)::date weeks ,
    b.token ,
    count(distinct TX_ID) as bridge_count,
    sum(bridge_count)over(partition by b.token order by weeks rows between unbounded preceding and current row ) as cumulative_bridge_count,
    Run a query to Download Data