Skip to content

Commit 4e9b4c3

Browse files
Merge pull request #160 from Divyn/main
token supply EVM update
2 parents 9d28793 + de27859 commit 4e9b4c3

File tree

1 file changed

+48
-11
lines changed

1 file changed

+48
-11
lines changed

docs/blockchain/Ethereum/transfers/total-supply.mdx

Lines changed: 48 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,49 @@ sidebar_position: 2
44

55
# Get Supply and Marketcap of a Token
66

7-
## Get Supply of a Token
7+
We will use the [Transaction Balance Tracker APIs](https://docs.bitquery.io/docs/blockchain/Ethereum/balances/transaction-balance-tracker/) for this query.
88

9-
Let's see how to get the supply of a Token. We are taking TONCOIN token example in the following query. The token address for TONCOIN token is [0x582d872A1B094FC48F5DE31D3B73F2D9bE47def1](https://etherscan.io/token/0x582d872a1b094fc48f5de31d3b73f2d9be47def1)
10-
You can check out the query [here](https://ide.bitquery.io/Total-supply-of-a-token-on-ethereum-mainnet_1).
119

12-
import VideoPlayer from "../../../../src/components/videoplayer.js";
1310

1411
```graphql
12+
{
13+
EVM(network: eth) {
14+
TransactionBalances(
15+
limit: { count: 1 }
16+
orderBy: { descending: Block_Time }
17+
where: {
18+
TokenBalance: {
19+
Currency: {
20+
SmartContract: { is: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" }
21+
Fungible: true
22+
}
23+
}
24+
}
25+
) {
26+
Block {
27+
Time
28+
Number
29+
}
30+
TokenBalance {
31+
Currency {
32+
Symbol
33+
Name
34+
SmartContract
35+
Decimals
36+
}
37+
TotalSupply
38+
Marketcap: TotalSupplyInUSD
39+
}
40+
}
41+
}
42+
}
43+
```
44+
45+
## Alternative Method Using Transfer Cube
46+
47+
### Get Supply of a Token
48+
49+
```
1550
query MyQuery {
1651
EVM(network: eth, dataset: combined) {
1752
Transfers(
@@ -45,11 +80,7 @@ query MyQuery {
4580
}
4681
```
4782

48-
## Get Marketcap of a token
49-
50-
Below query can be used to calculate Marketcap of a Token, 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.
51-
In this example, we are calculating marketcap of Pepes Dog (ZEUS) token which has smart contract address `0x0f7dC5D02CC1E1f5Ee47854d534D332A1081cCC8`.
52-
Try the query [here](https://ide.bitquery.io/supply-and-latest-price-of-token-to-get-marketcap).
83+
### Getting Marketcap
5384

5485
```
5586
{
@@ -78,6 +109,12 @@ Try the query [here](https://ide.bitquery.io/supply-and-latest-price-of-token-to
78109
}
79110
```
80111

81-
## Video Tutorial | How to get Supply and Market Cap of a Token
112+
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.
113+
In this example, we are calculating marketcap of Pepes Dog (ZEUS) token which has smart contract address `0x0f7dC5D02CC1E1f5Ee47854d534D332A1081cCC8`.
114+
Try the query [here](https://ide.bitquery.io/supply-and-latest-price-of-token-to-get-marketcap).
115+
116+
## Video Tutorial
117+
118+
import VideoPlayer from "../../../../src/components/videoplayer.js";
82119

83-
<VideoPlayer url="https://www.youtube.com/watch?v=O6GAYu8Belk" />
120+
<VideoPlayer url="https://www.youtube.com/watch?v=FW7jkNEqasE" />

0 commit comments

Comments
 (0)