KaskoazulAlgorand Bridge
    Updated 2022-11-20
    with app_calls as (
    SELECT tx_id
    FROM algorand.core.ez_transaction_application_call
    WHERE block_timestamp > CURRENT_DATE - {{days}}
    AND app_id = 842126029
    ),


    -- algorand: {
    -- core: "842125965",
    -- token_bridge: "842126029",
    -- nft_bridge: undefined, https://github.com/wormhole-foundation/wormhole/blob/dev.v2/sdk/js/src/utils/consts.ts

    transfers_raw as (
    SELECT tr.block_timestamp,
    tr.tx_group_id,
    tr.tx_id,
    tr.inner_tx,
    tr.tx_sender,
    tr.fee,
    tr.asset_id,
    tr.asset_name,
    tr.asset_amount / pow(10,tr.decimals) as amount,
    amount * ps.price_usd as amount_usd,
    tr.tx_message
    FROM algorand.core.ez_transaction_asset_transfer tr
    LEFT JOIN algorand.core.ez_price_swap ps
    ON tr.asset_id = ps.asset_id and date_trunc('hour', tr.block_timestamp) = block_hour
    WHERE tr.tx_id IN (SELECT tx_id FROM app_calls)
    )

    select block_timestamp::date as fecha,
    asset_id,
    asset_name,
    sum(amount_usd)
    from transfers_raw
    Run a query to Download Data