andurilSMB Royalties on ME
    Updated 2022-12-06
    /*

    tx_id = '3UphPZXD8JCZBWzDqJBFZ63n4bYbJVQRahdyKZaVG9dR5gcC2NhcyjNLzsPyi1GP14ma9MroGF5nqB9ZM5mV9Yvh'



    select
    *
    from
    solana.core.fact_transactions
    where tx_id = '3UphPZXD8JCZBWzDqJBFZ63n4bYbJVQRahdyKZaVG9dR5gcC2NhcyjNLzsPyi1GP14ma9MroGF5nqB9ZM5mV9Yvh'
    */

    with magic_eden_txs as (
    select
    distinct tx_id
    from solana.core.fact_events
    where
    date(block_timestamp) >= '2022-01-01' and
    and succeeded = 'TRUE'
    program_id = 'M2mx93ekt1fmXSVkTrUL9xVFHkmME8HTUi5Cyc5aF7K' --magic eden v2
    )

    select
    date(block_timestamp) as date,
    count(distinct tx_id) as royalty_paid_txs,
    sum(amount) as royalty_paid_sol,
    avg(amount) as avg_royalty_paid_sol
    from
    solana.core.fact_transfers t
    inner join magic_eden_txs
    using (tx_id)
    where
    --tx_id = '3UphPZXD8JCZBWzDqJBFZ63n4bYbJVQRahdyKZaVG9dR5gcC2NhcyjNLzsPyi1GP14ma9MroGF5nqB9ZM5mV9Yvh'
    tx_to = '9uBX3ASjxWvNBAD1xjbVaKA74mWGZys3RGSF7DdeDD3F' -- smb creator address
    and mint = 'So11111111111111111111111111111111111111112'
    Run a query to Download Data