Smart Contract Events
smartContractEvents type allows you to retrieve all events emitted by different smart contracts on Ethereum Blockchain.
Here's an exmaple query that retrieves 10 latest events from USDT smart contract from Celo Blockchain:
query {
ethereum(network: celo_mainnet) {
smartContractEvents(
smartContractAddress: {is: "0xdac17f958d2ee523a2206206994597c13d831ec7"}
options: {desc: "block.timestamp.iso8601", limit: 10}
date: {after: "2023-07-17T00:00:00Z"}
) {
block {
timestamp {
iso8601
}
}
smartContractEvent {
name
signature
signatureHash
}
transaction {
hash
}
}
}
}
Filtering Transactions
Smart Contract Events can be filtered using following arguments:
-
any: -
date: Filter by date on which smart contract event happened. Date should be in ISO8601-encoded datetime string. Ex, June 17th, 2023 will be2023-07-17T00:00:00Z. Available comparision operators areafter,before,between,in,is,not,notIn,since,tiil. -
height: Filter by height of block where smart contract event happened. Available comparision operators arebetween,gt,gteq,in,is,lt,lteq,not,notIn. -
options: Filter returned data by ordering, limiting and constrainting smart contract events data. Available fields:asc,ascByInteger,desc,descByInteger,limit,limitBy,offset -
smartContractAddress: Filter by address of the smart contract. Available comaprision operators arein,is,not,notIn. -
smartContractType: Filter by type of the smart contract on which event happened. Avaiable comparision operators arein,is,not,notIn. -
time: Filter by time when smart contract event happened. Time should be in ISO8601-encoded datetime string. Ex, June 17th, 2023 will be2023-07-17T00:00:00Z. Available comparision operator areafter,before,between,in,is,not,notIn,since,tiil. -
txFrom: Filter by the address responsible for creating the transaction that emitted an event. Available comparision operators arein,is,not,notIn. -
txHash: Filter by transaction hash of the transaction which emitted smart contract event. Available comparision operators areis,in,not,notIn.
smartContractEvents field has following subfields which returns relevant information about smart contract evevts.
any:arguments: eturns details about arguments passed to smart contract events.block: returns block details in which smart contract event happenedcount: returns aggregate count of smart contract eventscountBigInt: returns aggregate count of smart contract events inBigIntformatdate: returns date of smart contract eventexpression: performs arithematic operation and returns value of the operationmaximum: returns maximum of selected measurable fields ofsmartContractEventsminimum: returns minimum of selected measurable fields ofsmartContractEventssmartContract: returns details of smart contract on which event happenedsmartContractEvent: returns details about smart contract event like name, signature, and signature hashtransaction: returns details about transaction which emitted smart contract event