namanasync2024-06-27 01:27 PM
    Updated 2024-06-27
    SELECT t.*,
    price * sent_quantity as sent_cost_usd,
    price * received_quantity as received_cost_usd,
    price * fee_amount as fee_cost_usd

    FROM

    (


    select
    block_timestamp,
    tx_hash,
    'crypto withdrawal' type,
    'token' asset_type,
    from_address sender_address,
    amount sent_quantity,
    symbol as sent_currency,
    CONTRACT_ADDRESS asset_address,
    to_address received_address,
    0 received_quantity,
    '' received_currency,

    0 as fee_amount,
    '' as fee_currency

    from ethereum.core.ez_token_transfers
    where from_address = lower('0x72d7a7636FFED0d9e68818Dc80D246c41B12FcB4')
    and block_timestamp >= DATEADD(day, -6000, CURRENT_TIMESTAMP)

    UNION ALL

    select
    block_timestamp,
    tx_hash,
    'crypto deposit' type,
    QueryRunArchived: QueryRun has been archived