API to get Ethereum Smart Contract Events
As we know Ethereum blockchain only output events and transactions. Therefore, events provide very important insights into smart contract activities.
However, extracting, storing, and indexing these events can be troublesome for many developers.
Therefore, we provide Blockchain GraphQL APIs to get events data for any Ethereum smart contract.
In this article, we will see how to get smart contract events from famous Ethereum protocols using Bitquery GraphQL API.
Tether denylist and destroying funds for denylisted users
Tether (USDT) stablecoin smart contract has a mechanism to embargo addresses and destroyed funds of those addresses by simply subtracting the balance from the total supply.
Every time Tether bans a user, it will emit an “AddBlackList” event. Using the following query you can get these events.
{
ethereum {
smartContractEvents(options: {desc: "block.height", limit: 10},
smartContractEvent: {is: "AddedBlackList"},
smartContractAddress:
{is: "0xdac17f958d2ee523a2206206994597c13d831ec7"}) {
block {
height
timestamp {
iso8601
unixtime
}
}
arguments {
value
argument
}
}
}
}
If you also want to know about the destroyed USDT funds of embargoed users. You can track the “DestroyedBlackFunds” event.
{
ethereum {
smartContractEvents(options: {desc: "block.height", limit: 10},
smartContractEvent: {is: "DestroyedBlackFunds"},
smartContractAddress:
{is: "0xdac17f958d2ee523a2206206994597c13d831ec7"}) {
block {
height
timestamp {
iso8601
unixtime
}
}
arguments {
value
argument
}
}
}
}
Tracking ENS registrations
If you want to know the newly registered ENS domains, you can track the “NameRegistered” event of the ENS Base Registrar smart contract by using the query below.
{
ethereum {
smartContractEvents(options: {desc: "block.height", limit: 10},
smartContractEvent: {is: "NameRegistered"},
smartContractAddress:
{is: "0x57f1887a8bf19b14fc0df6fd9b2acc9af147ea85"}) {
block {
height
timestamp {
iso8601
unixtime
}
}
arguments {
value
argument
}
}
}
}
Tracking Aave Flash loans
Interested in flash loans? use the following query to get the latest FlashLoan events emitted by the Aave’s Lending pool smart contract.
{
ethereum {
smartContractEvents(options: {desc: "block.height", limit: 10},
smartContractEvent: {is: "FlashLoan"},
smartContractAddress:
{is: "0x398eC7346DcD622eDc5ae82352F02bE94C62d119"}) {
block {
height
timestamp {
iso8601
unixtime
}
}
eventIndex
arguments {
value
argument
}
}
}
}
Uniswap’s newly created Pools/Pools
Want to know about newly created Uniswap pools/pairs? Use the query below to track the “PairCreated” event emitted by the Uniswap Factory smart contract.
{
ethereum {
smartContractEvents(options: {desc: "block.height", limit: 10},
smartContractEvent: {is: "PairCreated"},
smartContractAddress:
{is: "0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f"}) {
block {
height
timestamp {
iso8601
unixtime
}
}
eventIndex
arguments {
value
argument
}
}
}
}
If you have any questions, you can ask them on our Telegram channel. Also, let us know if you are looking for blockchain data APIs.
You might also be interested in:
- Why GraphQL is better for blockchain data APIs
- APIs to get Latest Uniswap Pair Listing
- Simple rest APIs to get Uniswap data (DEX Data APIs)
- API to Get Ethereum Token Balance
- Simple API To Get Ethereum Supply And Data
- Who is actually using Ethereum?
About Bitquery
Bitquery is a set of software tools that parse, index, access, search, and use information across blockchain networks in a unified way. Our products are:
-
Coinpath® APIs provide blockchain money flow analysis for more than 24 blockchains. With Coinpath’s APIs, you can monitor blockchain transactions, investigate crypto crimes such as bitcoin money laundering, and create crypto forensics tools. Read this to get started with Coinpath®.
-
Digital Assets API provides index information related to all major cryptocurrencies, coins, and tokens.
-
DEX API provides real-time deposits and transactions, trades, and other related data on different DEX protocols like Uniswap, Kyber Network, Airswap, Matching Network, etc.
If you have any questions about our products, ask them on our Telegram channel or email us at sales@bitquery.io. Also, subscribe to our newsletter below, we will keep you updated with the latest in the cryptocurrency world.
Subscribe to our newsletter
Subscribe and never miss any updates related to our APIs, new developments & latest news etc. Our newsletter is sent once a week on Monday.