nickpayiatis_2023-02-22 09:21 AM
    select
    BLOCK_TIMESTAMP::date as date,
    tx_hash,
    tx_receipt[1]:outcome:executor_id as contract_in_near,
    case
    when contract_in_near = 'wrap.near' then 'NEAR'
    when contract_in_near = 'aurora' then '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2' -- WETH
    else concat('0x', substring(contract_in_near, 1, CHARINDEX('.', contract_in_near)-1))
    end as token_address,
    TX_RECEIPT[1]:outcome:logs[0] as log,
    substring(log, 1, CHARINDEX(' from aurora to ', log)) as first_part,
    regexp_replace(first_part, '[^0-9]', '') as asset_amount,
    substring(log, CHARINDEX('from aurora to ', log)+15, len(log)) as receiver
    from near.core.fact_transactions n_t
    --
    where tx_signer = 'relay.aurora'
    and tx_receiver = 'aurora'
    and (contract_in_near like '%.factory.bridge.near' -- ERC20-Assets
    or contract_in_near like 'aurora' -- ETH
    or contract_in_near like 'wrap.near' -- NEAR
    )
    and TX_RECEIPT[1]:outcome:logs[0] like 'Transfer % from aurora %'
    and block_timestamp::date >= '2023-02-17'
    Run a query to Download Data