Skip to content

Commit 1bc343c

Browse files
committed
Add usdt
1 parent 1bad982 commit 1bc343c

File tree

4 files changed

+316
-161
lines changed

4 files changed

+316
-161
lines changed

config.yaml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# yaml-language-server: $schema=./node_modules/envio/evm.schema.json
2-
name: usdc-stablecoin-indexer
3-
description: Comprehensive USDC stablecoin indexer
2+
name: stablecoin-indexer
3+
description: Multi-token stablecoin indexer (USDC, USDT)
44

55
field_selection:
66
transaction_fields:
@@ -17,7 +17,9 @@ chains:
1717
start_block: 0
1818
contracts:
1919
- name: ERC20
20-
address: 0x078D782b760474a361dDA0AF3839290b0EF57AD6
20+
address:
21+
- 0x078D782b760474a361dDA0AF3839290b0EF57AD6
22+
- 0x9151434b16b9763660705744891fA906F660EcC5
2123
# - id: 42161 # Arbitrum.
2224
# start_block: 0
2325
# contracts:

schema.graphql

Lines changed: 54 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ enum TransferType {
44
BURN
55
}
66

7-
type Transfer @index(fields: ["chainId", ["blockTimestamp", "DESC"]]) {
8-
id: ID! # ${chainId}_${blockNumber}_${logIndex}
7+
type Transfer @index(fields: ["token", ["blockTimestamp", "DESC"]]) {
8+
id: ID! # ${chainId}_${token}_${blockNumber}_${logIndex}
99
chainId: Int!
10+
token: String! @index
1011
blockNumber: Int!
1112
blockTimestamp: Int!
1213
logIndex: Int!
@@ -17,9 +18,10 @@ type Transfer @index(fields: ["chainId", ["blockTimestamp", "DESC"]]) {
1718
transferType: TransferType!
1819
}
1920

20-
type Account {
21-
id: ID! # ${chainId}-${address}
21+
type Account @index(fields: ["token", ["balance", "DESC"]]) {
22+
id: ID! # ${chainId}-${token}-${address}
2223
chainId: Int! @index
24+
token: String! @index
2325
address: String! @index
2426
balance: BigInt!
2527
transfersIn: Int!
@@ -32,19 +34,21 @@ type Account {
3234
approvalsReceived: [Approval!]! @derivedFrom(field: "spender")
3335
}
3436

35-
type Approval {
36-
id: ID! # ${chainId}-${owner}-${spender}
37+
type Approval @index(fields: ["token", "chainId"]) {
38+
id: ID! # ${chainId}-${token}-${owner}-${spender}
3739
chainId: Int! @index
40+
token: String! @index
3841
amount: BigInt!
3942
owner: Account!
4043
spender: Account!
4144
lastUpdatedBlock: Int!
4245
lastUpdatedTimestamp: Int!
4346
}
4447

45-
type ChainSupply {
46-
id: ID! # ${chainId}-supply
48+
type TokenSupply @index(fields: ["chainId", "token"]) {
49+
id: ID! # ${chainId}-${token}-supply
4750
chainId: Int!
51+
token: String! @index
4852
totalSupply: BigInt!
4953
totalMinted: BigInt!
5054
totalBurned: BigInt!
@@ -55,10 +59,28 @@ type ChainSupply {
5559
lastUpdatedTimestamp: Int!
5660
}
5761

58-
type DailySnapshot @index(fields: ["chainId", ["dayId", "DESC"]]) {
59-
id: ID! # ${chainId}-${dayId}
60-
chainId: Int!
61-
dayId: Int!
62+
type HourlySnapshot @index(fields: ["token", ["hourId", "DESC"]]) {
63+
id: ID! # ${chainId}-${token}-${hourId}
64+
chainId: Int! @index
65+
token: String! @index
66+
hourId: Int! @index
67+
hourStartTimestamp: Int!
68+
volume: BigInt!
69+
transferCount: Int!
70+
mintVolume: BigInt!
71+
burnVolume: BigInt!
72+
mintCount: Int!
73+
burnCount: Int!
74+
endOfHourSupply: BigInt!
75+
firstBlockOfHour: Int!
76+
lastBlockOfHour: Int!
77+
}
78+
79+
type DailySnapshot @index(fields: ["token", ["dayId", "DESC"]]) {
80+
id: ID! # ${chainId}-${token}-${dayId}
81+
chainId: Int! @index
82+
token: String! @index
83+
dayId: Int! @index
6284
dayStartTimestamp: Int!
6385
dailyVolume: BigInt!
6486
dailyTransferCount: Int!
@@ -71,9 +93,27 @@ type DailySnapshot @index(fields: ["chainId", ["dayId", "DESC"]]) {
7193
lastBlockOfDay: Int!
7294
}
7395

74-
type AccountDailyActivity {
75-
id: ID! # ${chainId}-${address}-${dayId}
96+
type WeeklySnapshot @index(fields: ["token", ["weekId", "DESC"]]) {
97+
id: ID! # ${chainId}-${token}-${weekId}
98+
chainId: Int! @index
99+
token: String! @index
100+
weekId: Int! @index
101+
weekStartTimestamp: Int!
102+
weeklyVolume: BigInt!
103+
weeklyTransferCount: Int!
104+
weeklyMintVolume: BigInt!
105+
weeklyBurnVolume: BigInt!
106+
weeklyMintCount: Int!
107+
weeklyBurnCount: Int!
108+
endOfWeekSupply: BigInt!
109+
firstBlockOfWeek: Int!
110+
lastBlockOfWeek: Int!
111+
}
112+
113+
type AccountDailyActivity @index(fields: ["account", "token", ["dayId", "DESC"]]) {
114+
id: ID! # ${chainId}-${token}-${address}-${dayId}
76115
chainId: Int! @index
116+
token: String! @index
77117
account: String! @index
78118
dayId: Int! @index
79119
transferCount: Int!

0 commit comments

Comments
 (0)