Afonso_DiazTop Collections
    Updated 2025-04-24
    with

    ton_prices as (
    select
    hour::date as date,
    avg(price) as ton_price
    from
    crosschain.price.ez_prices_hourly
    where
    token_address = '0x76a797a59ba2c17726896976b7b3747bfd1d220f'
    and blockchain = 'bsc'
    group by 1
    ),

    main as (
    select
    tx_hash,
    block_timestamp,
    nft_item_address as nft_address,
    collection_address,
    prev_owner as seller,
    owner_address as buyer,
    sale_price / 1e9 as price,
    (sale_price / 1e9) * ton_price as price_usd,
    marketplace_fee / 1e9 as marketplace_fee,
    (marketplace_fee / 1e9) * ton_price as marketplace_fee_usd,
    royalty_address,
    royalty_amount / 1e9 as royalty_amount,
    (royalty_amount / 1e9) * ton_price as royalty_amount_usd
    from
    ton.nft.fact_nft_events s
    left join
    ton_prices tp on s.block_timestamp::date = tp.date
    where
    type = sale_type
    and sale_type = 'sale'
    QueryRunArchived: QueryRun has been archived