Skip to main content

Get Supply and Marketcap of a Token

We will use the Transaction Balance Tracker APIs for this query.

{
EVM(network: eth) {
TransactionBalances(
limit: { count: 1 }
orderBy: { descending: Block_Time }
where: {
TokenBalance: {
Currency: {
SmartContract: { is: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" }
Fungible: true
}
}
}
) {
Block {
Time
Number
}
TokenBalance {
Currency {
Symbol
Name
SmartContract
Decimals
}
TotalSupply
Marketcap: TotalSupplyInUSD
}
}
}
}

Alternative Method Using Transfer Cube

Get Supply of a Token

query MyQuery {
EVM(network: eth, dataset: combined) {
Transfers(
where: {
Transfer: {
Currency: {
SmartContract: { is: "0x582d872A1B094FC48F5DE31D3B73F2D9bE47def1" }
}
Success: true
}
}
) {
minted: sum(
of: Transfer_Amount
if: {
Transfer: {
Sender: { is: "0x0000000000000000000000000000000000000000" }
}
}
)
burned: sum(
of: Transfer_Amount
if: {
Transfer: {
Receiver: { is: "0x0000000000000000000000000000000000000000" }
}
}
)
}
}
}

Getting Marketcap

{
EVM(dataset: combined) {
Transfers(
limit: {count: 1}
where: {Call: {Create: true}, Transfer: {Currency: {SmartContract: {is: "0x0f7dc5d02cc1e1f5ee47854d534d332a1081ccc8"}}, Sender: {is: "0x0000000000000000000000000000000000000000"}}}
) {
Transfer {
Amount
Sender
Receiver
}
joinDEXTradeByTokens(
limit: {count: 1}
join: inner
Trade_Currency_SmartContract: Transfer_Currency_SmartContract
) {
Trade {
Price(maximum: Block_Time)
PriceInUSD
}
}
}
}
}

First the query gets supply in the amount field then query uses join to get the PriceInUSD. Multiplying both of these will give you marketcap of the token. In this example, we are calculating marketcap of Pepes Dog (ZEUS) token which has smart contract address 0x0f7dC5D02CC1E1f5Ee47854d534D332A1081cCC8. Try the query here.

Video Tutorial