yiming2023-09-21 10:14 PM
    Updated 2023-09-24
    -- Hard_coded Tokens Based on SEI document
    with
    -- IBC Transfers
    ibc_transfer as (
    select DISTINCT
    tx_id,
    trunc(block_timestamp, 'hour') as hourly,
    'IBC' as bridge,
    amount,
    currency,
    sender,
    receiver
    from
    sei.core.fact_transfers
    where
    receiver like 'osmo%'
    and sender like 'sei%'
    and TX_SUCCEEDED = 'true'
    and block_timestamp >= '2023-08-15 00:00:00'
    and block_timestamp <= '2023-08-18 12:00:00'
    and transfer_type = 'IBC_TRANSFER_OUT'
    ),
    -- ATOM and Osmo Prices
    price_ibc as (
    select
    RECORDED_HOUR::date as date,
    case
    when symbol = 'OSMO' then 'ibc/ED07A3391A112B175915CD8FAF43A2DA8E4790EDE12566649D0C2F97716B8518'
    when symbol = 'ATOM' then 'ibc/6CDD4663F2F09CD62285E2D45891FC149A3568E316CE3EBBE201A71A78A69388'
    end as token_address,
    symbol,
    avg(price) as prices
    from
    osmosis.core.ez_prices
    where
    RECORDED_HOUR::date >= '2023-08-01'
    Run a query to Download Data