-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathsubgraph.template.yaml
320 lines (309 loc) · 10.3 KB
/
subgraph.template.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
specVersion: 0.0.4
description: Perpetual Protocol Curie (V2) Subgraph
repository: https://github.com/perpetual-protocol/perp-curie-subgraph
schema:
file: ./schema.graphql
dataSources:
- kind: ethereum/contract
name: MarketRegistry
network: {{ network }}
source:
abi: MarketRegistry
address: "{{ core.contracts.MarketRegistry.address }}"
startBlock: {{ core.contracts.MarketRegistry.createdBlockNumber }}
mapping:
kind: ethereum/events
apiVersion: 0.0.6
language: wasm/assemblyscript
file: ./src/mappings/marketRegistry.ts
entities:
- Protocol
- ProtocolEventInfo
- Market
abis:
- name: MarketRegistry
file: ./abis/MarketRegistry.json
eventHandlers:
- event: PoolAdded(indexed address,indexed uint24,indexed address)
handler: handlePoolAdded
- event: FeeRatioChanged(address,uint24)
handler: handleFeeRatioChanged
- kind: ethereum/contract
name: Vault
network: {{ network }}
source:
abi: Vault
address: "{{ core.contracts.Vault.address }}"
startBlock: {{ core.contracts.Vault.createdBlockNumber }}
mapping:
kind: ethereum/events
apiVersion: 0.0.6
language: wasm/assemblyscript
file: ./src/mappings/vault.ts
entities:
- Deposited
- Withdrawn
- CollateralLiquidated
- BadDebtSettled
- Protocol
- ProtocolEventInfo
- ProtocolTokenBalance
- Trader
- TraderTokenBalance
- Token
abis:
- name: Vault
file: ./abis/Vault.json
eventHandlers:
- event: Deposited(indexed address,indexed address,uint256)
handler: handleDeposited
- event: Withdrawn(indexed address,indexed address,uint256)
handler: handleWithdrawn
- event: CollateralLiquidated(indexed address,indexed address,indexed address,uint256,uint256,uint256,uint24)
handler: handleCollateralLiquidated
- event: BadDebtSettled(indexed address,uint256)
handler: handleBadDebtSettled
- kind: ethereum/contract
name: Exchange
network: {{ network }}
source:
abi: Exchange
address: "{{ core.contracts.Exchange.address }}"
startBlock: {{ core.contracts.Exchange.createdBlockNumber }}
mapping:
kind: ethereum/events
apiVersion: 0.0.6
language: wasm/assemblyscript
file: ./src/mappings/exchange.ts
entities:
- FundingUpdated
- ProtocolEventInfo
abis:
- name: Exchange
file: ./abis/Exchange.json
eventHandlers:
- event: FundingUpdated(indexed address,uint256,uint256)
handler: handleFundingUpdated
- kind: ethereum/contract
name: ClearingHouse
network: {{ network }}
source:
abi: ClearingHouse
address: "{{ core.contracts.ClearingHouse.address }}"
startBlock: {{ core.contracts.ClearingHouse.createdBlockNumber }}
mapping:
kind: ethereum/events
apiVersion: 0.0.6
language: wasm/assemblyscript
file: ./src/mappings/clearingHouse.ts
entities:
- PositionChanged
- PositionClosed
- PositionLiquidated
- LiquidityChanged
- FundingPaymentSettled
- Protocol
- ProtocolEventInfo
- Market
- Trader
- TraderMarket
- Maker
- OpenOrder
- TraderDayData
- ReferralCodeDayData
- ReferralCode
abis:
- name: ClearingHouse
file: ./abis/ClearingHouse.json
eventHandlers:
- event: PositionChanged(indexed address,indexed address,int256,int256,uint256,int256,int256,uint256)
handler: handlePositionChanged
- event: PositionClosed(indexed address,indexed address,int256,int256,int256,int256,uint256)
handler: handlePositionClosed
- event: PositionLiquidated(indexed address,indexed address,uint256,uint256,uint256,address)
handler: handlePositionLiquidated
- event: LiquidityChanged(indexed address,indexed address,indexed address,int24,int24,int256,int256,int128,uint256)
handler: handleLiquidityChanged
- event: FundingPaymentSettled(indexed address,indexed address,int256)
handler: handleFundingPaymentSettled
- event: ReferredPositionChanged(indexed bytes32)
handler: handleReferralPositionChanged
- kind: ethereum/contract
name: AccountBalance
network: {{ network }}
source:
abi: AccountBalance
address: "{{ core.contracts.AccountBalance.address }}"
startBlock: {{ core.contracts.AccountBalance.createdBlockNumber }}
mapping:
kind: ethereum/events
apiVersion: 0.0.6
language: wasm/assemblyscript
file: ./src/mappings/accountBalance.ts
entities:
- PnlRealized
- Trader
- ProtocolEventInfo
abis:
- name: AccountBalance
file: ./abis/AccountBalance.json
eventHandlers:
- event: PnlRealized(indexed address,int256)
handler: handlePnlRealized
- kind: ethereum/contract
name: InsuranceFund
network: {{ network }}
source:
abi: InsuranceFund
address: "{{ core.contracts.InsuranceFund.address }}"
startBlock: {{ core.contracts.InsuranceFund.createdBlockNumber }}
mapping:
kind: ethereum/events
apiVersion: 0.0.6
language: wasm/assemblyscript
file: ./src/mappings/insuranceFund.ts
entities:
- Repaid
- FeeDistributed
- DistributionThresholdChanged
- Protocol
- ProtocolEventInfo
abis:
- name: InsuranceFund
file: ./abis/InsuranceFund.json
eventHandlers:
- event: Repaid(uint256,uint256)
handler: handleRepaid
- event: FeeDistributed(uint256,uint256,uint256,uint256)
handler: handleFeeDistributed
- event: DistributionThresholdChanged(uint256)
handler: handleDistributionThresholdChanged
- kind: ethereum/contract
name: CollateralManager
network: {{ network }}
source:
abi: CollateralManager
address: "{{ core.contracts.CollateralManager.address }}"
startBlock: {{ core.contracts.CollateralManager.createdBlockNumber }}
mapping:
kind: ethereum/events
apiVersion: 0.0.6
language: wasm/assemblyscript
file: ./src/mappings/collateralManager.ts
entities:
- CollateralAdded
- Token
- ProtocolEventInfo
abis:
- name: CollateralManager
file: ./abis/CollateralManager.json
eventHandlers:
- event: CollateralAdded(indexed address,address,uint24,uint24,uint256)
handler: handleCollateralAdded
- kind: ethereum/contract
name: DelegateApproval
network: {{ network }}
source:
abi: DelegateApproval
address: "{{ core.contracts.DelegateApproval.address }}"
startBlock: {{ core.contracts.DelegateApproval.createdBlockNumber }}
mapping:
kind: ethereum/events
apiVersion: 0.0.6
language: wasm/assemblyscript
file: ./src/mappings/delegateApproval.ts
entities:
- DelegationApproved
- DelegationRevoked
- ProtocolEventInfo
abis:
- name: DelegateApproval
file: ./abis/DelegateApproval.json
eventHandlers:
- event: DelegationApproved(indexed address,address,uint8)
handler: handleDelegationApproved
- event: DelegationRevoked(indexed address,address,uint8)
handler: handleDelegationRevoked
- kind: ethereum/contract
name: LimitOrderBook
network: {{ network }}
source:
abi: LimitOrderBook
address: "{{ periphery.contracts.LimitOrderBook.address }}"
startBlock: {{ periphery.contracts.LimitOrderBook.createdBlockNumber }}
mapping:
kind: ethereum/events
apiVersion: 0.0.6
language: wasm/assemblyscript
file: ./src/mappings/limitOrderBook.ts
entities:
- LimitOrderFilled
- LimitOrderCancelled
- ProtocolEventInfo
abis:
- name: LimitOrderBook
file: ./abis/LimitOrderBook.json
eventHandlers:
- event: LimitOrderFilled(indexed address,indexed address,bytes32,uint8,address,int256,int256,uint256)
handler: handleLimitOrderFilled
- event: LimitOrderCancelled(indexed address,indexed address,bytes32,uint8,int256,int256)
handler: handleLimitOrderCancelled
- kind: ethereum/contract
name: LimitOrderRewardVault
network: {{ network }}
source:
abi: LimitOrderRewardVault
address: "{{ periphery.contracts.LimitOrderRewardVault.address }}"
startBlock: {{ periphery.contracts.LimitOrderRewardVault.createdBlockNumber }}
mapping:
kind: ethereum/events
apiVersion: 0.0.6
language: wasm/assemblyscript
file: ./src/mappings/limitOrderRewardVault.ts
entities:
- Disbursed
- ProtocolEventInfo
abis:
- name: LimitOrderRewardVault
file: ./abis/LimitOrderRewardVault.json
eventHandlers:
- event: Disbursed(bytes32,address,address,uint256)
handler: handleDisbursed
{{#periphery.externalContracts.PerpetualProtocolReferrer}}
- kind: ethereum/contract
name: Referrer
network: {{ network }}
source:
abi: Referrer
address: "{{ periphery.externalContracts.PerpetualProtocolReferrer }}"
startBlock: {{ core.contracts.ClearingHouse.createdBlockNumber }}
mapping:
kind: ethereum/events
apiVersion: 0.0.6
language: wasm/assemblyscript
file: ./src/mappings/referrer.ts
entities:
- ReferralCode
- ReferralCodeDayData
- Trader
- ProtocolEventInfo
abis:
- name: Referrer
file: ./abis/Referrer.json
eventHandlers:
- event: OnReferralCodeCreated(address,address,uint256,string)
handler: handleReferralCodeCreated
- event: OnReferralCodeUpserted(address,uint8,uint256,string,string)
handler: handleReferralCodeUpserted
- event: OnUncappedPartnerAssigned(address,string)
handler: handleUncappedPartnerUpserted
- event: OnUncappedPartnerRemoved(address)
handler: handleUncappedPartnerRemoved
{{/periphery.externalContracts.PerpetualProtocolReferrer}}
{{#graft}}
features:
- grafting
graft:
base: {{ graft.base }}
block: {{ graft.block }}
{{/graft}}