0xHaM-dTransfer
    Updated 2024-12-11
    -- forked from marqu / Magic Eden - $ME Claim Txs. @ https://flipsidecrypto.xyz/marqu/q/GSnx5348E9im/magic-eden---me-claim-txs.
    with claim_txs as (
    select
    block_timestamp
    , tx_id
    , signers[0] as fee_payer
    , instruction :accounts[4]::string as claimant
    , utils.udf_hex_to_int(to_char(reverse(to_binary(substr(utils.udf_base58_to_hex(instruction :data), 19, 16))))) / pow(10, 6) as amount
    from solana.core.fact_events
    where succeeded
    and fact_events.program_id = 'disGCfSiJKFigEphfou4PGHn1rukMfbs9cg9GpTM6oe'
    and substr(utils.udf_base58_to_hex(fact_events.instruction :data), 3, 16) = '4eb1627bd215bb53' -- New Claim
    and block_timestamp >= '2024-12-10 14:05:13.000'
    )
    , transferEvent as (
    SELECT
    BLOCK_TIMESTAMP,
    TX_ID,
    TX_TO as user,
    AMOUNT as transfer_amount
    FROM solana.core.fact_transfers
    WHERE MINT = 'MEFNBXixkEbait3xn9bkm8WsJzXtVsaJEn4c8Sam21u'
    UNION ALL
    SELECT
    BLOCK_TIMESTAMP,
    TX_ID,
    TX_FROM as user,
    -1*AMOUNT as transfer_amount
    FROM solana.core.fact_transfers
    WHERE MINT = 'MEFNBXixkEbait3xn9bkm8WsJzXtVsaJEn4c8Sam21u'
    )
    SELECT
    trunc(BLOCK_TIMESTAMP, 'hour') as date,
    count(*) as n_transfers,
    count(DISTINCT user) as n_transferrers,
    sum(transfer_amount) as transfered_amount,
    QueryRunArchived: QueryRun has been archived