where(m.contract_address=lower('0x87E1F1824C9356733A25d6beD6b9c87A3b31E107')-- include all txs related to the NFT address
or(m.contract_address=lower('0x760afe86e5de5fa0ee542fc7b7b713e1c5425701')andm.origin_to_address='0x224ecb4eae96d31372d1090c3b0233c8310dbbab'))-- include txs that involve a payment for a NFT on Magic Eden
-- and m.block_timestamp >= '2025-03-03 18:33:00' -- start of minting phase
andt.tx_succeeded= TRUE
),
transfersas-- this part decodes hexadecimal values to numeric and make sure only the relevant tx hashes are included
(
select
m.block_timestamp,
m.tx_hash,
m.contract_addressASnft_contract,
m.origin_from_address,
m.origin_to_address,
m.topic_0,
m.topic_1,
m.topic_2,
CASE
whentopic_3=NULL
then0
elseTO_NUMERIC(utils.udf_hex_to_int(topic_3))-- convert tokenid to numeric
thenTO_NUMERIC(utils.udf_hex_to_int(REPLACE(m.data, '0x0000000000000000000000000000000000000000000000', '')))/POWER(10,18)-- make the hex WMON value numeric