Afonso_DiazMint Table copy
    Updated 2024-03-19
    -- forked from Mint Table @ https://flipsidecrypto.xyz/edit/queries/e6f46d91-18af-4658-b666-07fc17ffaa06

    -- To obtain mint transactions, it's crucial to recognize that the payload_function must be '0x86a32dcdd605152e58b984ac2538168214bb57ab4661c591a095563b3d2d6a37::launchpad::create_mint%'. The minting process in the Mercato launchpad involves two transactions. Initially, the user deposits the mint amount along with the platform fee in a transaction. Subsequently, in the next transaction, Mercato transfers the NFT to the user's account.

    -- The relevant information is contained in both transactions. One transaction is identified by event_resource = CreateMintTokenOrderEvent, and the other by event_resource = MintTokenEvent. Both transactions fall under event_module=launchpad.

    -- To locate these transactions, we can use the identifier. If event_data:id has the same value in both transactions, it indicates that these two transactions are for minting purposes. Therefore, the relationship condition should be set as a.event_data:id = b.event_data:id.

    -- To determine the amount, calculate all deposit transfers that haven't been sent to the address 0x86a32dcdd605152e58b984ac2538168214bb57ab4661c591a095563b3d2d6a37 (as this address is in Mercato). It's crucial to calculate only the deposit transactions directed to the address 0x86a32dcdd605152e58b984ac2538168214bb57ab4661c591a095563b3d2d6a37.

    -- Note that the calculated USD value may be null due to potential incompleteness in the price table


    with

    pricet as (
    select
    hour::date as date,
    avg(price) as apt_price
    from aptos.price.ez_hourly_token_prices
    where token_address = '0x1::aptos_coin::aptoscoin'
    group by 1
    ),


    main as (
    select
    b.block_number,
    b.tx_hash,
    b.block_timestamp,
    'Mercato' as project_name,

    -- Sender in fact_transaction is the minter address
    sender as minter,

    -- We can use f to find collection name from the first part of name item
    QueryRunArchived: QueryRun has been archived