query_v1_to_v2_test_update

Returns the latest DEX trade on Ethereum, where buy currency smart contract is 0x3b60…3e5e, sell currency smart contract is 0xc02a…6cc2 and currency smart contract is 0x3b60…3e5e: block number, block time, transaction index, buy currency symbol, buy price, sell currency name, sell price and 3 more fields.

By lukas · saved 25 September 2023 · Bitquery API v2

What it returns

Filters

The query

query MyQuery {
  EVM(dataset: archive, network: eth) {
    DEXTrades(
      where: {Trade: {Buy: {Currency: {SmartContract: {is: "0x3b6060850d818adbcfff23d5b42c855eff043e5e"}}}, Sell: {Currency: {SmartContract: {is: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"}}}}}
      orderBy: {descending: Block_Number, descendingByField: "Transaction_Index"}
      limit: {count: 1}
    ) {
      Block {
        Number
        Time
      }
      Transaction {
        Index
      }
      Trade {
        Buy {
          Currency {
            Symbol
          }
          Price
        }
        Sell {
          Currency {
            Name
          }
          Price
        }
      }
    }
    Transfers(
      where: {Transfer: {Currency: {SmartContract: {is: "0x3b6060850d818adbcfff23d5b42c855eff043e5e"}}}}
    ) {
      minted: sum(
        of: Transfer_Amount
        if: {Transfer: {Sender: {is: "0x0000000000000000000000000000000000000000"}, Amount: {gt: "0"}}}
      )
      burned: sum(
        of: Transfer_Amount
        if: {Transfer: {Sender: {in: ["0x0000000000000000000000000000000000000000", "0x000000000000000000000000000000000000dead"]}, Amount: {gt: "0"}}}
      )
      Transfer {
        Currency {
          Symbol
          Name
        }
      }
    }
  }
}

Similar queries