SajjadiiiBridge Volume 2
    Updated 2022-07-03
    --*/Q17. What is the gross bridge activity (in usd, by day) for Blocto Teleport and cBridge to and from the FLOW blockchain?

    --Hint: Prices for non-native tokens (like ceMATIC) can be found in ethereum.core.fact_hourly_token_prices

    --payout 43.1 flow
    --gp 129.31 flow


    --*/

    with list as (select block_timestamp::date as date ,BRIDGE,DIRECTION,
    SPLIT_PART(TOKEN_CONTRACT, '.', 3) AS token,
    sum(AMOUNT)as amount,
    count(distinct tx_id)as n_bridgh
    from flow.core.fact_bridge_transactions
    group by 1,2,3,4),


    prises as (select date_trunc('day',HOUR)as date,SYMBOL,
    avg (PRICE)as price
    from ethereum.core.fact_hourly_token_prices
    group by 1,2)


    select a.date ,BRIDGE,DIRECTION,
    amount * price as volume ,
    n_bridgh
    from list a
    join prises b
    on a.token = b.SYMBOL
    and a.date = b.date
    order by a.date
    Run a query to Download Data