Pine Analyticstasteless-amethyst copy copy
    Updated 2024-11-21
    with tab1 as (
    SELECT
    taker as wallet,
    tx_hash,
    fee_usd,
    usd_amount

    from (
    SELECT
    tx_hash,
    block_timestamp,
    decoded_log:taker as taker,
    decoded_log:maker as maker,
    decoded_log:fee / power(10, 18) as fee_usd,
    case when decoded_log:takerAssetId = 0 then decoded_log:takerAmountFilled
    when decoded_log:makerAssetId = 0 then decoded_log:makerAmountFilled
    end / power(10, 18) as USD_amount
    FROM blast.core.fact_decoded_event_logs
    where contract_address in (lower('0x739f0331594029064C252559436eDce0E468E37a'), lower('0x6a3796c21e733a3016bc0ba41edf763016247e72'))
    and event_name LIKE 'OrderFilled'
    )

    UNION all
    SELECT
    maker as wallet,
    tx_hash,
    0 as fee_usd,
    usd_amount

    from (
    SELECT
    tx_hash,
    block_timestamp,
    decoded_log:taker as taker,
    QueryRunArchived: QueryRun has been archived