SalehBridger Destinations-after bridge(Destination)-date
    Updated 2022-09-14
    with lst_token as (
    select
    case
    when ADDRESS='0x15ee120fd69bec86c1d38502299af7366a41d1a6' then 'BitANT'
    when ADDRESS='0x431ad2ff6a9c365805ebad47ee021148d6f7dbe0' then 'dForce'
    when ADDRESS='0x9f8f72aa9304c8b593d555f12ef6589cc3a579a2' then 'Maker'
    when ADDRESS='0x08d32b0da63e2c3bcf8019c9c5d849d7a9d791e6' then 'Dentacoin'
    else symbol
    end symbol_name
    ,ADDRESS
    ,DECIMALS
    from ethereum.core.dim_contracts
    )
    ,lst_price as (
    select
    HOUR::date as day
    ,TOKEN_ADDRESS
    ,avg(PRICE) as usd_price
    from ethereum.core.fact_hourly_token_prices
    group by 1,2
    )
    ,lst_all as (
    select
    f.block_timestamp
    ,symbol_name
    ,ORIGIN_FROM_ADDRESS
    ,tx_hash
    ,EVENT_INPUTS:value/pow(10,decimals) as native_amount
    ,native_amount*(select avg(PRICE) from ethereum.core.fact_hourly_token_prices where TOKEN_ADDRESS=CONTRACT_ADDRESS and HOUR::date=block_timestamp::date) as price_usd
    from ethereum.core.fact_event_logs f
    join lst_token on lst_token.address = CONTRACT_ADDRESS
    where ORIGIN_TO_ADDRESS='0x99c9fc46f92e8a1c0dec1b1747d010903e884be1' --Optimism: Gateway
    and block_timestamp >= CURRENT_DATE-30
    and EVENT_NAME='Transfer'
    and TX_STATUS='SUCCESS'
    and EVENT_REMOVED=false
    Run a query to Download Data