forked from streamingfast/substreams-uniswap-v3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
substreams.yaml
270 lines (241 loc) · 6.5 KB
/
substreams.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
specVersion: v0.1.0
package:
name: uniswap_v3
version: v0.2.8
url: https://github.com/streamingfast/substreams-uniswap-v3
doc: |
These substream modules compose all the things to build up the Uniswap v3 substreams.
See individual modules docs for help.
imports:
entity: https://github.com/streamingfast/substreams-entity-change/releases/download/v1.1.0/substreams-entity-change-v1.1.0.spkg
protobuf:
files:
- uniswap/v1/uniswap.proto
importPaths:
- ./proto
binaries:
default:
type: wasm/rust-v1
file: target/wasm32-unknown-unknown/release/substreams_uniswap_v3.wasm
modules:
- name: map_pools_created
kind: map
initialBlock: 12369621
inputs:
- source: sf.ethereum.type.v2.Block
output:
type: proto:uniswap.types.v1.Pools
doc: |
Dynamic data sources pattern for Uniswap V3 pools. This module will loop over block transactions and detect
pools created events. Once the pool created events have been detected, we will create `Pools` structs.
Try with
```
substreams gui substreams.yaml map_pools_created -e $SUBSTREAMS_ENDPOINT -t +1000
```
- name: store_pools_created
kind: store
updatePolicy: set
valueType: proto:uniswap.types.v1.Pool
inputs:
- map: map_pools_created
- name: store_tokens
kind: store
updatePolicy: add
valueType: int64
inputs:
- map: map_pools_created
- name: store_pool_count
kind: store
updatePolicy: add
valueType: bigint
inputs:
- map: map_pools_created
- name: map_tokens_whitelist_pools
kind: map
initialBlock: 12369621
inputs:
- map: map_pools_created
output:
type: proto:uniswap.types.v1.ERC20Tokens
- name: store_tokens_whitelist_pools
kind: store
updatePolicy: append
valueType: string
inputs:
- map: map_tokens_whitelist_pools
- name: map_extract_data_types
kind: map
initialBlock: 12369621
inputs:
- source: sf.ethereum.type.v2.Block
- store: store_pools_created
output:
type: proto:uniswap.types.v1.Events
- name: store_pool_sqrt_price
kind: store
updatePolicy: set
valueType: proto:uniswap.types.v1.Events.PoolSqrtPrice
inputs:
- map: map_extract_data_types
- name: store_prices
kind: store
updatePolicy: set
initialBlock: 12369621
valueType: bigdecimal
inputs:
- source: sf.substreams.v1.Clock
- map: map_extract_data_types
- store: store_pools_created
- name: store_pool_liquidities
kind: store
updatePolicy: set
initialBlock: 12369621
valueType: bigint
inputs:
- source: sf.substreams.v1.Clock
- map: map_extract_data_types
- name: store_total_tx_counts
kind: store
updatePolicy: add
valueType: bigint
inputs:
- source: sf.substreams.v1.Clock
- map: map_extract_data_types
- name: store_swaps_volume
kind: store
updatePolicy: add
valueType: bigdecimal
inputs:
- source: sf.substreams.v1.Clock
- map: map_extract_data_types
- store: store_pools_created
- store: store_total_tx_counts
- store: store_eth_prices
- name: store_native_amounts
kind: store
updatePolicy: set
valueType: bigdecimal
inputs:
- map: map_extract_data_types
- name: store_eth_prices
kind: store
updatePolicy: set
initialBlock: 12369621
valueType: bigdecimal
inputs:
- source: sf.substreams.v1.Clock
- map: map_extract_data_types
- store: store_pools_created
- store: store_prices
- store: store_tokens_whitelist_pools
- store: store_native_amounts
- store: store_pool_liquidities
- name: store_token_tvl
kind: store
initialBlock: 12369621
updatePolicy: add
valueType: bigdecimal
inputs:
- map: map_extract_data_types
- name: store_derived_tvl
kind: store
initialBlock: 12369621
updatePolicy: set
valueType: bigdecimal
inputs:
- source: sf.substreams.v1.Clock
- map: map_extract_data_types
- store: store_token_tvl
- store: store_pools_created
- store: store_eth_prices
- name: store_derived_factory_tvl
kind: store
initialBlock: 12369621
updatePolicy: add
valueType: bigdecimal
inputs:
- source: sf.substreams.v1.Clock
- store: store_derived_tvl
mode: deltas
- name: store_ticks_liquidities
kind: store
updatePolicy: add
valueType: bigint
inputs:
- source: sf.substreams.v1.Clock
- map: map_extract_data_types
doc: |
### Hello world
This is how you use this:
```
substreams gui blah blah
```
- name: store_positions
kind: store
updatePolicy: set
valueType: proto:uniswap.types.v1.Events.PositionEvent
inputs:
- map: map_extract_data_types
- name: store_min_windows
kind: store
updatePolicy: min
valueType: bigdecimal
inputs:
- source: sf.substreams.v1.Clock
- store: store_prices
mode: deltas
- store: store_eth_prices
mode: deltas
- name: store_max_windows
kind: store
updatePolicy: max
valueType: bigdecimal
inputs:
- source: sf.substreams.v1.Clock
- store: store_prices
mode: deltas
- store: store_eth_prices
mode: deltas
- name: graph_out
kind: map
initialBlock: 12369621
inputs:
- source: sf.substreams.v1.Clock
- store: store_pool_count
mode: deltas
- store: store_total_tx_counts
mode: deltas
- store: store_swaps_volume
mode: deltas
- store: store_derived_factory_tvl
mode: deltas
- store: store_eth_prices
mode: deltas
- map: map_extract_data_types
- map: map_pools_created
- store: store_pool_sqrt_price
mode: deltas
- store: store_pool_sqrt_price
- store: store_pool_liquidities
mode: deltas
- store: store_token_tvl
mode: deltas
- store: store_prices
mode: deltas
- store: store_prices
- store: store_tokens
- store: store_tokens_whitelist_pools
mode: deltas
- store: store_derived_tvl
mode: deltas
- store: store_ticks_liquidities
mode: deltas
- store: store_total_tx_counts
- store: store_eth_prices
- store: store_positions
- store: store_min_windows
mode: deltas
- store: store_max_windows
mode: deltas
output:
type: proto:sf.substreams.entity.v1.EntityChanges