Four Meme API
In this section, we will see some APIs that return on-chain data related to Four Meme Exchange on BSC network. We will be using DEX Trades API to get insightful trades and trading activity related data.
Track Four Meme Token Migrations
Use the below query track four meme token migrations in realtime. Test it here.
Click to expand GraphQL query
subscription {
EVM(network: bsc) {
Events(
where: {
Log: { Signature: { Name: { in: ["PairCreated", "PoolCreated"] } } }
Transaction: {
To: { is: "0x5c952063c7fc8610ffdb798152d69f0b9550762b" }
}
}
) {
Arguments {
Name
Value {
... on EVM_ABI_Address_Value_Arg {
address
}
}
}
Transaction {
Hash
}
}
}
}
Bonding Curve Progress API
Bonding Curve Progress Formula
- Formula: BondingCurveProgress = 100 - ((leftTokens * 100) / initialRealTokenReserves)
Where:
leftTokens = realTokenReserves - reservedTokens
initialRealTokenReserves = totalSupply - reservedTokens
Definitions:
initialRealTokenReserves
=totalSupply
-reservedTokens
totalSupply
: 1,000,000,000 (Four meme Token)reservedTokens
: 200,000,000- Therefore,
initialRealTokenReserves
: 800,000,000
leftTokens
=realTokenReserves
-reservedTokens
realTokenReserves
: Token balance at the market address.
Simplified Formula: BondingCurveProgress = 100 - (((balance - 200000000) * 100) / 800000000)
Additional Notes
- Balance Retrieval:
- The
balance
is the four meme token balance at this Four Meme: Proxy address (0x5c952063c7fc8610FFDB798152D69F0B9550762b). - Use this query to fetch the balance: Query Link.
- The
Click to expand GraphQL query
query MyQuery {
EVM(dataset: combined, network: bsc) {
BalanceUpdates(
where: {
BalanceUpdate: {
Address: { is: "0x5c952063c7fc8610FFDB798152D69F0B9550762b" }
}
Currency: {
SmartContract: { is: "0x366f446d2583fa4e703aa24721c820d5e5424444" }
}
}
orderBy: { descendingByField: "balance" }
) {
Currency {
Name
}
balance: sum(of: BalanceUpdate_Amount)
BalanceUpdate {
Address
}
}
}
}
Get Four Meme Tokens which are above 95% Bonding Curve Progress
Using the above Bonding Curve formula, we can calculate the token balances for the Four Meme Proxy contract (0x5c952063c7fc8610FFDB798152D69F0B9550762b) corresponding to approximately 95% to 100% progress along the bonding curve, that comes out to be 200,000,000
to 240,000,000
. The tokens in the response are arranged in the ascending order of Bonding Curve Percentage, i.e., 95% to 100%. You can run and test the saved query here.
Click to expand GraphQL query
query MyQuery {
EVM(dataset: combined, network: bsc) {
BalanceUpdates(
limit: { count: 10 }
where: {
BalanceUpdate: {
Address: { is: "0x5c952063c7fc8610FFDB798152D69F0B9550762b" }
}
}
orderBy: { descendingByField: "balance" }
) {
Currency {
SmartContract
Name
}
balance: sum(
of: BalanceUpdate_Amount
selectWhere: { ge: "200000000", le: "240000000" }
)
BalanceUpdate {
Address
}
}
}
}
Get Newly Created Tokens on Four Meme
Using this query we could get newly created tokens that are listed on the exchange.
Click to expand GraphQL query
{
EVM(dataset: realtime, network: bsc) {
Transfers(
orderBy: { descending: Block_Time }
limit: { count: 10 }
where: {
Transaction: {
To: { is: "0x5c952063c7fc8610ffdb798152d69f0b9550762b" }
}
Transfer: {
Sender: { is: "0x0000000000000000000000000000000000000000" }
}
}
) {
Transfer {
Amount
AmountInUSD
Currency {
Name
Symbol
SmartContract
Decimals
}
Id
Index
Success
Type
URI
Sender
Receiver
}
Call {
From
Value
To
Signature {
Name
Signature
}
}
Log {
SmartContract
Signature {
Name
}
}
TransactionStatus {
Success
}
Transaction {
Hash
From
To
}
Block {
Time
Number
}
}
}
}
You can refer to this example to track latest trades of a token on other particular DEX's such as Pancake Swap.
Subscribe the Latest Trades on Four Meme
Using subscriptions you can subscribe to the latest trades on Four Meme as shown in this example. The subscription returns latest trade info such as buyers and sellers, buy and sell currency details and amount of currency.
Click to expand GraphQL query
subscription {
EVM(network: bsc) {
DEXTrades(
where: { Trade: { Dex: { ProtocolName: { is: "fourmeme_v1" } } } }
) {
Trade {
Buy {
Buyer
Currency {
Name
Symbol
SmartContract
}
Amount
}
Sell {
Seller
Currency {
Name
Symbol
SmartContract
}
Amount
}
}
Transaction {
Hash
}
}
}
}
Get Latest Buys and Sells for a Four Meme Token
This query retrieves the most recent token buy and sell trades of a specific token on Four Meme Exchange.
Click to expand GraphQL query
query MyQuery($currency: String) {
EVM(network: bsc, dataset: combined) {
buys: DEXTrades(
where: {
Trade: {
Buy: { Currency: { SmartContract: { is: $currency } } }
Success: true
Dex: { ProtocolName: { is: "fourmeme_v1" } }
}
}
orderBy: { descending: Block_Time }
) {
Block {
Time
}
Trade {
Buy {
Amount
Buyer
Price
PriceInUSD
Seller
}
Sell {
Currency {
Name
Symbol
SmartContract
}
}
}
}
sells: DEXTrades(
where: {
Trade: {
Sell: { Currency: { SmartContract: { is: $currency } } }
Success: true
Dex: { ProtocolName: { is: "fourmeme_v1" } }
}
}
orderBy: { descending: Block_Time }
) {
Block {
Time
}
Trade {
Buy {
Currency {
Name
Symbol
SmartContract
}
}
Sell {
Amount
Buyer
Price
PriceInUSD
Seller
}
}
}
}
}
{
"currency": "0x9b48a54bcce09e59b0479060e9328ab7dbdb0d40"
}
You can also check if the token is listed on other DEX using this example.
Get OHLCV data of a Four Meme Token
Use the below query to get four meme token OHLCV data. Test it here.
Click to expand GraphQL query
query tradingView($network: evm_network, $token: String) {
EVM(network: $network, dataset: combined) {
DEXTradeByTokens(
limit: { count: 10 }
orderBy: { descendingByField: "Block_Time" }
where: {
Trade: {
Currency: { SmartContract: { is: $token } }
PriceAsymmetry: { lt: 0.1 }
Dex: { ProtocolName: { is: "fourmeme_v1" } }
}
}
) {
Block {
Time(interval: { count: 5, in: minutes })
}
Trade {
open: PriceInUSD(minimum: Block_Number)
close: PriceInUSD(maximum: Block_Number)
max: PriceInUSD(maximum: Trade_PriceInUSD)
min: PriceInUSD(minimum: Trade_PriceInUSD)
}
volumeUSD: sum(of: Trade_Side_AmountInUSD, selectWhere: { gt: "0" })
}
}
}
{
"network": "bsc",
"token": "0x9b48a54bcce09e59b0479060e9328ab7dbdb0d40"
}
Monitor trades of traders on Four meme
You can use our streams to monitor real time trades of a trader on Four Meme, for example run this stream.
Click to expand GraphQL query
subscription {
EVM(network: bsc) {
DEXTrades(
where: {
Trade: { Dex: { ProtocolName: { is: "fourmeme_v1" } }, Success: true }
Transaction: {
From: { is: "0x7db00d1f5b8855d40827f34bb17f95d31990306e" }
}
}
) {
Trade {
Buy {
Buyer
Currency {
Name
Symbol
SmartContract
}
Amount
Price
PriceInUSD
}
Sell {
Seller
Currency {
Name
Symbol
SmartContract
}
Amount
}
}
Transaction {
Hash
}
}
}
}
You can also get the trade activities of a user on Pancake Swap using our Pancake Swap APIs.
Track Latest and Historical Trades of a Four Meme User
You can use DEX Trades API with combined dataset to get latest and historic trades of a user. Run this query for example.
Click to expand GraphQL query
query MyQuery($address: String) {
EVM(dataset: combined, network: bsc) {
DEXTrades(
where: {
Trade: { Dex: { ProtocolName: { is: "fourmeme_v1" } }, Success: true }
Transaction: { From: { is: $address } }
}
orderBy: { descending: Block_Time }
) {
Block {
Time
}
Trade {
Buy {
Buyer
Currency {
Name
Symbol
SmartContract
}
Amount
Price
PriceInUSD
}
Sell {
Seller
Currency {
Name
Symbol
SmartContract
}
Amount
}
}
Transaction {
Hash
}
}
}
}
{
"address": "0x7db00d1f5b8855d40827f34bb17f95d31990306e"
}
Top Buyers for a Token on Four Meme
This query returns top buyers of a particular token on Four Meme, with currency smart contract as 0x9b48a54bcce09e59b0479060e9328ab7dbdb0d40
for this example.
Click to expand GraphQL query
query MyQuery($currency: String) {
EVM(network: bsc, dataset: combined) {
DEXTrades(
where: {
Trade: {
Buy: { Currency: { SmartContract: { is: $currency } } }
Success: true
Dex: { ProtocolName: { is: "fourmeme_v1" } }
}
}
limit: { count: 100 }
) {
Trade {
Buy {
Buyer
}
}
trades: count
bought: sum(of: Trade_Buy_Amount)
}
}
}
{
"currency": "0x9b48a54bcce09e59b0479060e9328ab7dbdb0d40"
}
Get Trade Volume and Number of Trades for a Four Meme Token
This query returns the traded volume and number of trades for a particular Four Meme token in different time frames, namely 24 hours, 1 hour and 5 minutes.
Click to expand GraphQL query
query MyQuery(
$currency: String
$time_24hr_ago: DateTime
$time_1hr_ago: DateTime
$time_5min_ago: DateTime
) {
EVM(network: bsc) {
DEXTradeByTokens(
where: {
Trade: { Currency: { SmartContract: { is: $currency } }, Success: true }
Block: { Time: { since: $time_24hr_ago } }
}
) {
Trade {
Currency {
Name
Symbol
SmartContract
}
}
volume_24hr: sum(of: Trade_Side_AmountInUSD)
volume_1hr: sum(
of: Trade_Side_AmountInUSD
if: { Block: { Time: { since: $time_1hr_ago } } }
)
volume_5min: sum(
of: Trade_Side_AmountInUSD
if: { Block: { Time: { since: $time_5min_ago } } }
)
trades_24hr: count
trades_1hr: count(if: { Block: { Time: { since: $time_1hr_ago } } })
trades_5min: count(if: { Block: { Time: { since: $time_5min_ago } } })
}
}
}
{
"currency": "0x9b48a54bcce09e59b0479060e9328ab7dbdb0d40",
"time_24hr_ago": "2024-03-23T15:00:00Z",
"time_1hr_ago": "2024-03-24T14:00:00Z",
"time_5min_ago": "2024-03-24T15:55:00Z"
}
Get Market Cap of a Four Meme Token
To get the market cap of a token we need two things, the latest PriceInUSD
and total supply
of the token. This query helps with getting the latest USD price of a token.
Click to expand GraphQL query
query MyQuery($currency: String) {
EVM(network: bsc) {
DEXTradeByTokens(
where: { Trade: { Currency: { SmartContract: { is: $currency } } } }
orderBy: { descending: Block_Time }
limit: { count: 1 }
) {
Trade {
PriceInUSD
}
}
}
}
{
"currency": "0x9b48a54bcce09e59b0479060e9328ab7dbdb0d40"
}
Also, this query returns the total supply of a token.
Click to expand GraphQL query
query MyQuery($currency: String) {
EVM(network: bsc, dataset: combined) {
Transfers(
where: {
Transfer: {
Currency: { SmartContract: { is: $currency } }
Success: true
}
}
) {
minted: sum(
of: Transfer_Amount
if: {
Transfer: {
Sender: { is: "0x0000000000000000000000000000000000000000" }
}
}
)
burned: sum(
of: Transfer_Amount
if: {
Transfer: {
Receiver: { is: "0x0000000000000000000000000000000000000000" }
}
}
)
}
}
}
{
"currency": "0x9b48a54bcce09e59b0479060e9328ab7dbdb0d40"
}
Now, to get market cap we need to multiply the total supply and price, that is:
Market Cap = Total Supply * PriceInUSD
Track Liquidity Add Events for All Tokens on Four Meme
This query tracks all liquidity addition events on the Four Meme Exchange. It listens for LiquidityAdded
events emitted from the four meme exchange's smart contract (0x5c952063c7fc8610ffdb798152d69f0b9550762b)
You can run the query here
Click to expand GraphQL query
{
EVM(dataset: realtime, network: bsc) {
Events(
limit: {count: 20}
where: {LogHeader: {Address: {is: "0x5c952063c7fc8610ffdb798152d69f0b9550762b"}},
Log: {Signature: {Name: {is: "LiquidityAdded"}}}}
) {
Block {
Time
Number
Hash
}
Receipt {
ContractAddress
}
Topics {
Hash
}
TransactionStatus {
Success
}
LogHeader {
Address
Index
Data
}
Transaction {
Hash
From
To
}
Log {
EnterIndex
ExitIndex
Index
LogAfterCallIndex
Pc
SmartContract
Signature {
Name
Signature
}
}
Arguments {
Name
Value {
... on EVM_ABI_Integer_Value_Arg {
integer
}
... on EVM_ABI_Address_Value_Arg {
address
}
... on EVM_ABI_String_Value_Arg {
string
}
... on EVM_ABI_BigInt_Value_Arg {
bigInteger
}
... on EVM_ABI_Bytes_Value_Arg {
hex
}
... on EVM_ABI_Boolean_Value_Arg {
bool
}
}
}
}
}
}
Track Liquidity Add Events for a Token on Four Meme
This query tracks liquidity addition events for a specific token on the Four Meme Exchange. It listens for LiquidityAdded
events emitted from the exchange's smart contract (0x5c952063c7fc8610ffdb798152d69f0b9550762b
) BNB network
In this example, the query monitors liquidity events for a specific token (0x5a49ce64a1e44f6fce07e9ff38f54dde8a8a0e94
) by filtering the event arguments to only include actions related to this token.
You can run the query here
Click to expand GraphQL query
{
EVM(dataset: realtime, network: bsc) {
Events(
limit: {count: 20}
where: {LogHeader: {Address: {is: "0x5c952063c7fc8610ffdb798152d69f0b9550762b"}}, Log: {Signature: {Name: {is: "LiquidityAdded"}}}, Arguments: {includes: {Name: {is: "token1"}, Value: {Address: {is: "0x5a49ce64a1e44f6fce07e9ff38f54dde8a8a0e94"}}}}}
) {
Block {
Time
Number
Hash
}
Receipt {
ContractAddress
}
Topics {
Hash
}
TransactionStatus {
Success
}
LogHeader {
Address
Index
Data
}
Transaction {
Hash
From
To
}
Log {
EnterIndex
ExitIndex
Index
LogAfterCallIndex
Pc
SmartContract
Signature {
Name
Signature
}
}
Arguments {
Name
Value {
... on EVM_ABI_Integer_Value_Arg {
integer
}
... on EVM_ABI_Address_Value_Arg {
address
}
... on EVM_ABI_String_Value_Arg {
string
}
... on EVM_ABI_BigInt_Value_Arg {
bigInteger
}
... on EVM_ABI_Bytes_Value_Arg {
hex
}
... on EVM_ABI_Boolean_Value_Arg {
bool
}
}
}
}
}
}
Top Traders of a token
This query will fetch you top traders of a Four Meme token for the BSC network. You can test the query here.
Click to expand GraphQL query
query topTraders($network: evm_network, $token: String) {
EVM(network: $network, dataset: combined) {
DEXTradeByTokens(
orderBy: {descendingByField: "volumeUsd"}
limit: {count: 100}
where: {Trade: {Currency: {SmartContract: {is: $token}}, Dex: {ProtocolName: {is: "fourmeme_v1"}}}}
) {
Trade {
Buyer
Dex {
OwnerAddress
ProtocolFamily
ProtocolName
}
}
buyVolume: sum(of: Trade_Amount, if: {Trade: {Side: {Type: {is: buy}}}})
sellVolume: sum(of: Trade_Amount, if: {Trade: {Side: {Type: {is: sell}}}})
volume: sum(of: Trade_Amount)
volumeUsd: sum(of: Trade_Side_AmountInUSD)
}
}
}
{
"network": "bsc",
"token": "0x37e3a59843b056e063780402ef25e12dca394444"
}
Get liquidity of a Four Meme token
Using below API you can get the liquidity of a four meme token. Subtract 200000000
from the Balance that this query returns because 200M tokens are reserved which gets transferred to pancakeswap when this fourmeme token graduates. Test the API here.
Click to expand GraphQL query
query MyQuery {
EVM(dataset: combined, network: bsc) {
BalanceUpdates(
where: {BalanceUpdate: {Address: {is: "0x5c952063c7fc8610FFDB798152D69F0B9550762b"}}, Currency: {SmartContract: {is: "0x87c5b3da05b062480b55c2dbf374ccd084f74444"}}}
orderBy: {descendingByField: "balance"}
) {
Currency {
Name
}
balance: sum(of: BalanceUpdate_Amount)
BalanceUpdate {
Address
}
}
}
}