@paraswap/dex-lib 3.8.16 → 3.8.17-insert-amount-solidly-v3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.vscode/launch.json +53 -0
- package/.vscode/settings.json +2 -0
- package/.vscode/tasks.json +15 -0
- package/build/abi/maverick-v2/MaverickV2Router.json +778 -0
- package/build/abi/uniswap-v3/AlienBaseV3Router.abi.json +52 -0
- package/build/abi/wombat/pool.json +1289 -0
- package/build/dex/aave-v1/aave-v1.js +1 -0
- package/build/dex/aave-v1/aave-v1.js.map +1 -1
- package/build/dex/aave-v2/tokens-avalanche.json +44 -0
- package/build/dex/aave-v2/tokens-mainnet.json +188 -0
- package/build/dex/aave-v2/tokens-polygon.json +44 -0
- package/build/dex/bProtocol.d.ts +18 -0
- package/build/dex/bProtocol.js +39 -0
- package/build/dex/bProtocol.js.map +1 -0
- package/build/dex/bancor.d.ts +26 -0
- package/build/dex/bancor.js +58 -0
- package/build/dex/bancor.js.map +1 -0
- package/build/dex/compound.d.ts +18 -0
- package/build/dex/compound.js +46 -0
- package/build/dex/compound.js.map +1 -0
- package/build/dex/curve-v2.d.ts +58 -0
- package/build/dex/curve-v2.js +180 -0
- package/build/dex/curve-v2.js.map +1 -0
- package/build/dex/dodo-v1.d.ts +33 -0
- package/build/dex/dodo-v1.js +63 -0
- package/build/dex/dodo-v1.js.map +1 -0
- package/build/dex/lido.d.ts +19 -0
- package/build/dex/lido.js +42 -0
- package/build/dex/lido.js.map +1 -0
- package/build/dex/maker-psm/scripts/gem.abi.json +136 -0
- package/build/dex/maker-psm/scripts/validate-state.d.ts +0 -0
- package/build/dex/maker-psm/scripts/validate-state.js +185 -0
- package/build/dex/maker-psm/scripts/validate-state.js.map +1 -0
- package/build/dex/maker-psm/scripts/vat.abi.json +243 -0
- package/build/dex/onebit.d.ts +25 -0
- package/build/dex/onebit.js +42 -0
- package/build/dex/onebit.js.map +1 -0
- package/build/dex/platypus/platypus.js +17 -3
- package/build/dex/platypus/platypus.js.map +1 -1
- package/build/dex/smoothy.d.ts +26 -0
- package/build/dex/smoothy.js +48 -0
- package/build/dex/smoothy.js.map +1 -0
- package/build/dex/solidly-v3/scripts/check-event-pool-event.d.ts +1 -0
- package/build/dex/solidly-v3/scripts/check-event-pool-event.js +53 -0
- package/build/dex/solidly-v3/scripts/check-event-pool-event.js.map +1 -0
- package/build/dex/solidly-v3/solidly-v3.js +7 -0
- package/build/dex/solidly-v3/solidly-v3.js.map +1 -1
- package/build/dex/stable-pool.d.ts +28 -0
- package/build/dex/stable-pool.js +55 -0
- package/build/dex/stable-pool.js.map +1 -0
- package/build/dex/swaap-v1/swaap-v1.js +4 -0
- package/build/dex/swaap-v1/swaap-v1.js.map +1 -1
- package/build/dex/trader-joe-v2.1/base.d.ts +18 -0
- package/build/dex/trader-joe-v2.1/base.js +99 -0
- package/build/dex/trader-joe-v2.1/base.js.map +1 -0
- package/build/dex/trader-joe-v2.1/trader-joe-v2.1-new.d.ts +7 -0
- package/build/dex/trader-joe-v2.1/trader-joe-v2.1-new.js +20 -0
- package/build/dex/trader-joe-v2.1/trader-joe-v2.1-new.js.map +1 -0
- package/build/dex/trader-joe-v2.1/trader-joe-v2.2.d.ts +7 -0
- package/build/dex/trader-joe-v2.1/trader-joe-v2.2.js +20 -0
- package/build/dex/trader-joe-v2.1/trader-joe-v2.2.js.map +1 -0
- package/build/dex/trader-joe-v2.1.d.ts +43 -0
- package/build/dex/trader-joe-v2.1.js +79 -0
- package/build/dex/trader-joe-v2.1.js.map +1 -0
- package/build/dex/uniswap-v3/forks/alien-base-v3/alien-base-v3.d.ts +17 -0
- package/build/dex/uniswap-v3/forks/alien-base-v3/alien-base-v3.js +64 -0
- package/build/dex/uniswap-v3/forks/alien-base-v3/alien-base-v3.js.map +1 -0
- package/build/dex/uniswap-v3/forks/alien-v3/alien-v3.d.ts +17 -0
- package/build/dex/uniswap-v3/forks/alien-v3/alien-v3.js +79 -0
- package/build/dex/uniswap-v3/forks/alien-v3/alien-v3.js.map +1 -0
- package/build/executor/types.d.ts +2 -1
- package/build/executor/types.js +1 -0
- package/build/executor/types.js.map +1 -1
- package/build/generic-swap-transaction-builder.js +8 -3
- package/build/generic-swap-transaction-builder.js.map +1 -1
- package/config.ts +1946 -0
- package/package.json +1 -1
- package/src/dex/dexs.txt +58 -0
- package/src/dex/solidly-v3/solidly-v3.ts +7 -0
- package/src/executor/types.ts +1 -0
- package/src/generic-swap-transaction-builder.ts +14 -3
- package/build/abi/inception/inception-ineth-pool.json +0 -1062
- package/build/abi/inception/inception-ineth.json +0 -609
- package/build/abi/inception/inception-ratio-feed.json +0 -93
- package/build/abi/inception/inception-vault.json +0 -991
- package/build/abi/infusion/InfusionFactory.json +0 -147
- package/build/abi/infusion/InfusionPair.json +0 -658
- package/build/abi/infusion/InfusionRouter.json +0 -442
- package/build/abi/oswap/oswap.abi.json +0 -452
- package/build/dex/idle-dao/idle-dao-pool.d.ts +0 -56
- package/build/dex/idle-dao/idle-dao-pool.js +0 -176
- package/build/dex/idle-dao/idle-dao-pool.js.map +0 -1
- package/build/dex/idle-dao/idle-dao-pooling-pool.d.ts +0 -16
- package/build/dex/idle-dao/idle-dao-pooling-pool.js +0 -57
- package/build/dex/idle-dao/idle-dao-pooling-pool.js.map +0 -1
- package/build/dex/idle-dao/scripts.d.ts +0 -9
- package/build/dex/idle-dao/scripts.js +0 -552
- package/build/dex/idle-dao/scripts.js.map +0 -1
- package/build/dex/inception/config.d.ts +0 -5
- package/build/dex/inception/config.js +0 -112
- package/build/dex/inception/config.js.map +0 -1
- package/build/dex/inception/inception-event-pool.d.ts +0 -23
- package/build/dex/inception/inception-event-pool.js +0 -34
- package/build/dex/inception/inception-event-pool.js.map +0 -1
- package/build/dex/inception/inception-native.d.ts +0 -43
- package/build/dex/inception/inception-native.js +0 -131
- package/build/dex/inception/inception-native.js.map +0 -1
- package/build/dex/inception/inception-pool.d.ts +0 -18
- package/build/dex/inception/inception-pool.js +0 -32
- package/build/dex/inception/inception-pool.js.map +0 -1
- package/build/dex/inception/inception-price-feed.d.ts +0 -19
- package/build/dex/inception/inception-price-feed.js +0 -51
- package/build/dex/inception/inception-price-feed.js.map +0 -1
- package/build/dex/inception/inception.d.ts +0 -44
- package/build/dex/inception/inception.js +0 -162
- package/build/dex/inception/inception.js.map +0 -1
- package/build/dex/inception/tokens.d.ts +0 -9
- package/build/dex/inception/tokens.js +0 -28
- package/build/dex/inception/tokens.js.map +0 -1
- package/build/dex/inception/types.d.ts +0 -22
- package/build/dex/inception/types.js +0 -3
- package/build/dex/inception/types.js.map +0 -1
- package/build/dex/inception/utils.d.ts +0 -7
- package/build/dex/inception/utils.js +0 -58
- package/build/dex/inception/utils.js.map +0 -1
- package/build/dex/infusion/config.d.ts +0 -4
- package/build/dex/infusion/config.js +0 -25
- package/build/dex/infusion/config.js.map +0 -1
- package/build/dex/infusion/infusion-stable-pool.d.ts +0 -4
- package/build/dex/infusion/infusion-stable-pool.js +0 -74
- package/build/dex/infusion/infusion-stable-pool.js.map +0 -1
- package/build/dex/infusion/infusion.d.ts +0 -54
- package/build/dex/infusion/infusion.js +0 -510
- package/build/dex/infusion/infusion.js.map +0 -1
- package/build/dex/infusion/types.d.ts +0 -47
- package/build/dex/infusion/types.js +0 -3
- package/build/dex/infusion/types.js.map +0 -1
- package/build/dex/infusion/utils/isStablePair.d.ts +0 -2
- package/build/dex/infusion/utils/isStablePair.js +0 -18
- package/build/dex/infusion/utils/isStablePair.js.map +0 -1
- package/build/dex/oswap/config.d.ts +0 -5
- package/build/dex/oswap/config.js +0 -31
- package/build/dex/oswap/config.js.map +0 -1
- package/build/dex/oswap/oswap-pool.d.ts +0 -51
- package/build/dex/oswap/oswap-pool.js +0 -150
- package/build/dex/oswap/oswap-pool.js.map +0 -1
- package/build/dex/oswap/oswap.d.ts +0 -46
- package/build/dex/oswap/oswap.js +0 -263
- package/build/dex/oswap/oswap.js.map +0 -1
- package/build/dex/oswap/types.d.ts +0 -20
- package/build/dex/oswap/types.js +0 -3
- package/build/dex/oswap/types.js.map +0 -1
|
@@ -1,452 +0,0 @@
|
|
|
1
|
-
[
|
|
2
|
-
{
|
|
3
|
-
"inputs": [],
|
|
4
|
-
"stateMutability": "nonpayable",
|
|
5
|
-
"type": "constructor"
|
|
6
|
-
},
|
|
7
|
-
{
|
|
8
|
-
"anonymous": false,
|
|
9
|
-
"inputs": [
|
|
10
|
-
{
|
|
11
|
-
"indexed": false,
|
|
12
|
-
"internalType": "address",
|
|
13
|
-
"name": "previousAdmin",
|
|
14
|
-
"type": "address"
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
"indexed": false,
|
|
18
|
-
"internalType": "address",
|
|
19
|
-
"name": "newAdmin",
|
|
20
|
-
"type": "address"
|
|
21
|
-
}
|
|
22
|
-
],
|
|
23
|
-
"name": "AdminChanged",
|
|
24
|
-
"type": "event"
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
"anonymous": false,
|
|
28
|
-
"inputs": [
|
|
29
|
-
{
|
|
30
|
-
"indexed": false,
|
|
31
|
-
"internalType": "address",
|
|
32
|
-
"name": "previousAdmin",
|
|
33
|
-
"type": "address"
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
"indexed": false,
|
|
37
|
-
"internalType": "address",
|
|
38
|
-
"name": "newAdmin",
|
|
39
|
-
"type": "address"
|
|
40
|
-
}
|
|
41
|
-
],
|
|
42
|
-
"name": "OperatorChanged",
|
|
43
|
-
"type": "event"
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
"anonymous": false,
|
|
47
|
-
"inputs": [
|
|
48
|
-
{
|
|
49
|
-
"indexed": false,
|
|
50
|
-
"internalType": "uint256",
|
|
51
|
-
"name": "traderate0",
|
|
52
|
-
"type": "uint256"
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
"indexed": false,
|
|
56
|
-
"internalType": "uint256",
|
|
57
|
-
"name": "traderate1",
|
|
58
|
-
"type": "uint256"
|
|
59
|
-
}
|
|
60
|
-
],
|
|
61
|
-
"name": "TraderateChanged",
|
|
62
|
-
"type": "event"
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
"inputs": [],
|
|
66
|
-
"name": "approveStETH",
|
|
67
|
-
"outputs": [],
|
|
68
|
-
"stateMutability": "nonpayable",
|
|
69
|
-
"type": "function"
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
"inputs": [
|
|
73
|
-
{
|
|
74
|
-
"internalType": "uint256[]",
|
|
75
|
-
"name": "requestIds",
|
|
76
|
-
"type": "uint256[]"
|
|
77
|
-
}
|
|
78
|
-
],
|
|
79
|
-
"name": "claimStETHWithdrawalForETH",
|
|
80
|
-
"outputs": [],
|
|
81
|
-
"stateMutability": "nonpayable",
|
|
82
|
-
"type": "function"
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
"inputs": [
|
|
86
|
-
{
|
|
87
|
-
"internalType": "uint256[]",
|
|
88
|
-
"name": "requestIds",
|
|
89
|
-
"type": "uint256[]"
|
|
90
|
-
}
|
|
91
|
-
],
|
|
92
|
-
"name": "claimStETHWithdrawalForWETH",
|
|
93
|
-
"outputs": [],
|
|
94
|
-
"stateMutability": "nonpayable",
|
|
95
|
-
"type": "function"
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
"inputs": [
|
|
99
|
-
{
|
|
100
|
-
"internalType": "uint256",
|
|
101
|
-
"name": "amount",
|
|
102
|
-
"type": "uint256"
|
|
103
|
-
}
|
|
104
|
-
],
|
|
105
|
-
"name": "depositETHForStETH",
|
|
106
|
-
"outputs": [],
|
|
107
|
-
"stateMutability": "nonpayable",
|
|
108
|
-
"type": "function"
|
|
109
|
-
},
|
|
110
|
-
{
|
|
111
|
-
"inputs": [
|
|
112
|
-
{
|
|
113
|
-
"internalType": "uint256",
|
|
114
|
-
"name": "amount",
|
|
115
|
-
"type": "uint256"
|
|
116
|
-
}
|
|
117
|
-
],
|
|
118
|
-
"name": "depositWETHForStETH",
|
|
119
|
-
"outputs": [],
|
|
120
|
-
"stateMutability": "nonpayable",
|
|
121
|
-
"type": "function"
|
|
122
|
-
},
|
|
123
|
-
{
|
|
124
|
-
"inputs": [],
|
|
125
|
-
"name": "minimumFunds",
|
|
126
|
-
"outputs": [
|
|
127
|
-
{
|
|
128
|
-
"internalType": "uint256",
|
|
129
|
-
"name": "",
|
|
130
|
-
"type": "uint256"
|
|
131
|
-
}
|
|
132
|
-
],
|
|
133
|
-
"stateMutability": "view",
|
|
134
|
-
"type": "function"
|
|
135
|
-
},
|
|
136
|
-
{
|
|
137
|
-
"inputs": [],
|
|
138
|
-
"name": "operator",
|
|
139
|
-
"outputs": [
|
|
140
|
-
{
|
|
141
|
-
"internalType": "address",
|
|
142
|
-
"name": "",
|
|
143
|
-
"type": "address"
|
|
144
|
-
}
|
|
145
|
-
],
|
|
146
|
-
"stateMutability": "view",
|
|
147
|
-
"type": "function"
|
|
148
|
-
},
|
|
149
|
-
{
|
|
150
|
-
"inputs": [],
|
|
151
|
-
"name": "owner",
|
|
152
|
-
"outputs": [
|
|
153
|
-
{
|
|
154
|
-
"internalType": "address",
|
|
155
|
-
"name": "",
|
|
156
|
-
"type": "address"
|
|
157
|
-
}
|
|
158
|
-
],
|
|
159
|
-
"stateMutability": "view",
|
|
160
|
-
"type": "function"
|
|
161
|
-
},
|
|
162
|
-
{
|
|
163
|
-
"inputs": [
|
|
164
|
-
{
|
|
165
|
-
"internalType": "uint256[]",
|
|
166
|
-
"name": "amounts",
|
|
167
|
-
"type": "uint256[]"
|
|
168
|
-
}
|
|
169
|
-
],
|
|
170
|
-
"name": "requestStETHWithdrawalForETH",
|
|
171
|
-
"outputs": [
|
|
172
|
-
{
|
|
173
|
-
"internalType": "uint256[]",
|
|
174
|
-
"name": "requestIds",
|
|
175
|
-
"type": "uint256[]"
|
|
176
|
-
}
|
|
177
|
-
],
|
|
178
|
-
"stateMutability": "nonpayable",
|
|
179
|
-
"type": "function"
|
|
180
|
-
},
|
|
181
|
-
{
|
|
182
|
-
"inputs": [
|
|
183
|
-
{
|
|
184
|
-
"internalType": "uint256",
|
|
185
|
-
"name": "_minimumFunds",
|
|
186
|
-
"type": "uint256"
|
|
187
|
-
}
|
|
188
|
-
],
|
|
189
|
-
"name": "setMinimumFunds",
|
|
190
|
-
"outputs": [],
|
|
191
|
-
"stateMutability": "nonpayable",
|
|
192
|
-
"type": "function"
|
|
193
|
-
},
|
|
194
|
-
{
|
|
195
|
-
"inputs": [
|
|
196
|
-
{
|
|
197
|
-
"internalType": "address",
|
|
198
|
-
"name": "newOperator",
|
|
199
|
-
"type": "address"
|
|
200
|
-
}
|
|
201
|
-
],
|
|
202
|
-
"name": "setOperator",
|
|
203
|
-
"outputs": [],
|
|
204
|
-
"stateMutability": "nonpayable",
|
|
205
|
-
"type": "function"
|
|
206
|
-
},
|
|
207
|
-
{
|
|
208
|
-
"inputs": [
|
|
209
|
-
{
|
|
210
|
-
"internalType": "address",
|
|
211
|
-
"name": "newOwner",
|
|
212
|
-
"type": "address"
|
|
213
|
-
}
|
|
214
|
-
],
|
|
215
|
-
"name": "setOwner",
|
|
216
|
-
"outputs": [],
|
|
217
|
-
"stateMutability": "nonpayable",
|
|
218
|
-
"type": "function"
|
|
219
|
-
},
|
|
220
|
-
{
|
|
221
|
-
"inputs": [
|
|
222
|
-
{
|
|
223
|
-
"internalType": "uint256",
|
|
224
|
-
"name": "buyT1",
|
|
225
|
-
"type": "uint256"
|
|
226
|
-
},
|
|
227
|
-
{
|
|
228
|
-
"internalType": "uint256",
|
|
229
|
-
"name": "sellT1",
|
|
230
|
-
"type": "uint256"
|
|
231
|
-
}
|
|
232
|
-
],
|
|
233
|
-
"name": "setPrices",
|
|
234
|
-
"outputs": [],
|
|
235
|
-
"stateMutability": "nonpayable",
|
|
236
|
-
"type": "function"
|
|
237
|
-
},
|
|
238
|
-
{
|
|
239
|
-
"inputs": [],
|
|
240
|
-
"name": "steth",
|
|
241
|
-
"outputs": [
|
|
242
|
-
{
|
|
243
|
-
"internalType": "contract IERC20",
|
|
244
|
-
"name": "",
|
|
245
|
-
"type": "address"
|
|
246
|
-
}
|
|
247
|
-
],
|
|
248
|
-
"stateMutability": "view",
|
|
249
|
-
"type": "function"
|
|
250
|
-
},
|
|
251
|
-
{
|
|
252
|
-
"inputs": [
|
|
253
|
-
{
|
|
254
|
-
"internalType": "uint256",
|
|
255
|
-
"name": "amountIn",
|
|
256
|
-
"type": "uint256"
|
|
257
|
-
},
|
|
258
|
-
{
|
|
259
|
-
"internalType": "uint256",
|
|
260
|
-
"name": "amountOutMin",
|
|
261
|
-
"type": "uint256"
|
|
262
|
-
},
|
|
263
|
-
{
|
|
264
|
-
"internalType": "address[]",
|
|
265
|
-
"name": "path",
|
|
266
|
-
"type": "address[]"
|
|
267
|
-
},
|
|
268
|
-
{
|
|
269
|
-
"internalType": "address",
|
|
270
|
-
"name": "to",
|
|
271
|
-
"type": "address"
|
|
272
|
-
},
|
|
273
|
-
{
|
|
274
|
-
"internalType": "uint256",
|
|
275
|
-
"name": "deadline",
|
|
276
|
-
"type": "uint256"
|
|
277
|
-
}
|
|
278
|
-
],
|
|
279
|
-
"name": "swapExactTokensForTokens",
|
|
280
|
-
"outputs": [
|
|
281
|
-
{
|
|
282
|
-
"internalType": "uint256[]",
|
|
283
|
-
"name": "amounts",
|
|
284
|
-
"type": "uint256[]"
|
|
285
|
-
}
|
|
286
|
-
],
|
|
287
|
-
"stateMutability": "nonpayable",
|
|
288
|
-
"type": "function"
|
|
289
|
-
},
|
|
290
|
-
{
|
|
291
|
-
"inputs": [
|
|
292
|
-
{
|
|
293
|
-
"internalType": "uint256",
|
|
294
|
-
"name": "amountOut",
|
|
295
|
-
"type": "uint256"
|
|
296
|
-
},
|
|
297
|
-
{
|
|
298
|
-
"internalType": "uint256",
|
|
299
|
-
"name": "amountInMax",
|
|
300
|
-
"type": "uint256"
|
|
301
|
-
},
|
|
302
|
-
{
|
|
303
|
-
"internalType": "address[]",
|
|
304
|
-
"name": "path",
|
|
305
|
-
"type": "address[]"
|
|
306
|
-
},
|
|
307
|
-
{
|
|
308
|
-
"internalType": "address",
|
|
309
|
-
"name": "to",
|
|
310
|
-
"type": "address"
|
|
311
|
-
},
|
|
312
|
-
{
|
|
313
|
-
"internalType": "uint256",
|
|
314
|
-
"name": "deadline",
|
|
315
|
-
"type": "uint256"
|
|
316
|
-
}
|
|
317
|
-
],
|
|
318
|
-
"name": "swapTokensForExactTokens",
|
|
319
|
-
"outputs": [
|
|
320
|
-
{
|
|
321
|
-
"internalType": "uint256[]",
|
|
322
|
-
"name": "amounts",
|
|
323
|
-
"type": "uint256[]"
|
|
324
|
-
}
|
|
325
|
-
],
|
|
326
|
-
"stateMutability": "nonpayable",
|
|
327
|
-
"type": "function"
|
|
328
|
-
},
|
|
329
|
-
{
|
|
330
|
-
"inputs": [],
|
|
331
|
-
"name": "token0",
|
|
332
|
-
"outputs": [
|
|
333
|
-
{
|
|
334
|
-
"internalType": "contract IERC20",
|
|
335
|
-
"name": "",
|
|
336
|
-
"type": "address"
|
|
337
|
-
}
|
|
338
|
-
],
|
|
339
|
-
"stateMutability": "view",
|
|
340
|
-
"type": "function"
|
|
341
|
-
},
|
|
342
|
-
{
|
|
343
|
-
"inputs": [],
|
|
344
|
-
"name": "token1",
|
|
345
|
-
"outputs": [
|
|
346
|
-
{
|
|
347
|
-
"internalType": "contract IERC20",
|
|
348
|
-
"name": "",
|
|
349
|
-
"type": "address"
|
|
350
|
-
}
|
|
351
|
-
],
|
|
352
|
-
"stateMutability": "view",
|
|
353
|
-
"type": "function"
|
|
354
|
-
},
|
|
355
|
-
{
|
|
356
|
-
"inputs": [],
|
|
357
|
-
"name": "traderate0",
|
|
358
|
-
"outputs": [
|
|
359
|
-
{
|
|
360
|
-
"internalType": "uint256",
|
|
361
|
-
"name": "",
|
|
362
|
-
"type": "uint256"
|
|
363
|
-
}
|
|
364
|
-
],
|
|
365
|
-
"stateMutability": "view",
|
|
366
|
-
"type": "function"
|
|
367
|
-
},
|
|
368
|
-
{
|
|
369
|
-
"inputs": [],
|
|
370
|
-
"name": "traderate1",
|
|
371
|
-
"outputs": [
|
|
372
|
-
{
|
|
373
|
-
"internalType": "uint256",
|
|
374
|
-
"name": "",
|
|
375
|
-
"type": "uint256"
|
|
376
|
-
}
|
|
377
|
-
],
|
|
378
|
-
"stateMutability": "view",
|
|
379
|
-
"type": "function"
|
|
380
|
-
},
|
|
381
|
-
{
|
|
382
|
-
"inputs": [
|
|
383
|
-
{
|
|
384
|
-
"internalType": "address",
|
|
385
|
-
"name": "to",
|
|
386
|
-
"type": "address"
|
|
387
|
-
},
|
|
388
|
-
{
|
|
389
|
-
"internalType": "uint256",
|
|
390
|
-
"name": "amount",
|
|
391
|
-
"type": "uint256"
|
|
392
|
-
}
|
|
393
|
-
],
|
|
394
|
-
"name": "transferEth",
|
|
395
|
-
"outputs": [],
|
|
396
|
-
"stateMutability": "nonpayable",
|
|
397
|
-
"type": "function"
|
|
398
|
-
},
|
|
399
|
-
{
|
|
400
|
-
"inputs": [
|
|
401
|
-
{
|
|
402
|
-
"internalType": "address",
|
|
403
|
-
"name": "token",
|
|
404
|
-
"type": "address"
|
|
405
|
-
},
|
|
406
|
-
{
|
|
407
|
-
"internalType": "address",
|
|
408
|
-
"name": "to",
|
|
409
|
-
"type": "address"
|
|
410
|
-
},
|
|
411
|
-
{
|
|
412
|
-
"internalType": "uint256",
|
|
413
|
-
"name": "amount",
|
|
414
|
-
"type": "uint256"
|
|
415
|
-
}
|
|
416
|
-
],
|
|
417
|
-
"name": "transferToken",
|
|
418
|
-
"outputs": [],
|
|
419
|
-
"stateMutability": "nonpayable",
|
|
420
|
-
"type": "function"
|
|
421
|
-
},
|
|
422
|
-
{
|
|
423
|
-
"inputs": [],
|
|
424
|
-
"name": "weth",
|
|
425
|
-
"outputs": [
|
|
426
|
-
{
|
|
427
|
-
"internalType": "contract IWEth",
|
|
428
|
-
"name": "",
|
|
429
|
-
"type": "address"
|
|
430
|
-
}
|
|
431
|
-
],
|
|
432
|
-
"stateMutability": "view",
|
|
433
|
-
"type": "function"
|
|
434
|
-
},
|
|
435
|
-
{
|
|
436
|
-
"inputs": [],
|
|
437
|
-
"name": "withdrawal",
|
|
438
|
-
"outputs": [
|
|
439
|
-
{
|
|
440
|
-
"internalType": "contract IStETHWithdrawal",
|
|
441
|
-
"name": "",
|
|
442
|
-
"type": "address"
|
|
443
|
-
}
|
|
444
|
-
],
|
|
445
|
-
"stateMutability": "view",
|
|
446
|
-
"type": "function"
|
|
447
|
-
},
|
|
448
|
-
{
|
|
449
|
-
"stateMutability": "payable",
|
|
450
|
-
"type": "receive"
|
|
451
|
-
}
|
|
452
|
-
]
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import BigNumber from 'bignumber.js';
|
|
2
|
-
import { Contract } from 'web3-eth-contract';
|
|
3
|
-
import { Interface } from '@ethersproject/abi';
|
|
4
|
-
import { DeepReadonly } from 'ts-essentials';
|
|
5
|
-
import { Log, Logger } from '../../types';
|
|
6
|
-
import { StatefulEventSubscriber } from '../../stateful-event-subscriber';
|
|
7
|
-
import { IDexHelper } from '../../dex-helper/idex-helper';
|
|
8
|
-
import { PoolState, IdleToken } from './types';
|
|
9
|
-
import { IdleDao } from './idle-dao';
|
|
10
|
-
declare type BlocksTransfers = Record<number, {
|
|
11
|
-
underlyingAmount: BigNumber;
|
|
12
|
-
idleAmount: BigNumber;
|
|
13
|
-
processed: boolean;
|
|
14
|
-
}>;
|
|
15
|
-
export declare class IdleDaoEventPool extends StatefulEventSubscriber<PoolState> {
|
|
16
|
-
readonly parentName: string;
|
|
17
|
-
protected network: number;
|
|
18
|
-
protected dexHelper: IDexHelper;
|
|
19
|
-
protected logger: Logger;
|
|
20
|
-
protected idleToken: IdleToken;
|
|
21
|
-
protected IdleDao: IdleDao;
|
|
22
|
-
handlers: {
|
|
23
|
-
[event: string]: (event: any, state: DeepReadonly<PoolState>, log: Readonly<Log>) => Promise<DeepReadonly<PoolState> | null>;
|
|
24
|
-
};
|
|
25
|
-
logDecoder: (log: Log) => any;
|
|
26
|
-
cdoContract: Contract;
|
|
27
|
-
poolInterface: Interface;
|
|
28
|
-
addressesSubscribed: string[];
|
|
29
|
-
blocksTransfers: BlocksTransfers;
|
|
30
|
-
constructor(parentName: string, network: number, dexHelper: IDexHelper, logger: Logger, idleToken: IdleToken, IdleDao: IdleDao);
|
|
31
|
-
/**
|
|
32
|
-
* The function is called every time any of the subscribed
|
|
33
|
-
* addresses release log. The function accepts the current
|
|
34
|
-
* state, updates the state according to the log, and returns
|
|
35
|
-
* the updated state.
|
|
36
|
-
* @param state - Current state of event subscriber
|
|
37
|
-
* @param log - Log released by one of the subscribed addresses
|
|
38
|
-
* @returns Updates state of the event subscriber after the log
|
|
39
|
-
*/
|
|
40
|
-
protected processLog(state: DeepReadonly<PoolState>, log: Readonly<Log>): Promise<DeepReadonly<PoolState> | null>;
|
|
41
|
-
/**
|
|
42
|
-
* The function generates state using on-chain calls. This
|
|
43
|
-
* function is called to regenerate state if the event based
|
|
44
|
-
* system fails to fetch events and the local state is no
|
|
45
|
-
* more correct.
|
|
46
|
-
* @param blockNumber - Blocknumber for which the state should
|
|
47
|
-
* should be generated
|
|
48
|
-
* @returns state of the event subscriber at blocknumber
|
|
49
|
-
*/
|
|
50
|
-
generateState(blockNumber: number): Promise<DeepReadonly<PoolState>>;
|
|
51
|
-
setBlockState(blockNumber: number, state: PoolState): void;
|
|
52
|
-
handleCoinTransfer(event: any, state: PoolState, log: Log): Promise<DeepReadonly<PoolState> | null>;
|
|
53
|
-
processBlockTransfer(blockNumber: number, state: PoolState): PoolState;
|
|
54
|
-
handleCoinTransfer_old(event: any, state: PoolState, log: Log): Promise<DeepReadonly<PoolState> | null>;
|
|
55
|
-
}
|
|
56
|
-
export {};
|
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.IdleDaoEventPool = void 0;
|
|
7
|
-
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
|
8
|
-
const abi_1 = require("@ethersproject/abi");
|
|
9
|
-
const utils_1 = require("../../utils");
|
|
10
|
-
const erc20_json_1 = __importDefault(require("../../abi/erc20.json"));
|
|
11
|
-
const idle_cdo_json_1 = __importDefault(require("../../abi/idle-dao/idle-cdo.json"));
|
|
12
|
-
const stateful_event_subscriber_1 = require("../../stateful-event-subscriber");
|
|
13
|
-
const idle_dao_pooling_pool_1 = require("./idle-dao-pooling-pool");
|
|
14
|
-
const tokens_1 = require("./tokens");
|
|
15
|
-
class IdleDaoEventPool extends stateful_event_subscriber_1.StatefulEventSubscriber {
|
|
16
|
-
constructor(parentName, network, dexHelper, logger, idleToken, IdleDao) {
|
|
17
|
-
// TODO: Add pool name
|
|
18
|
-
super(parentName, idleToken.idleSymbol, dexHelper, logger);
|
|
19
|
-
this.parentName = parentName;
|
|
20
|
-
this.network = network;
|
|
21
|
-
this.dexHelper = dexHelper;
|
|
22
|
-
this.logger = logger;
|
|
23
|
-
this.idleToken = idleToken;
|
|
24
|
-
this.IdleDao = IdleDao;
|
|
25
|
-
this.handlers = {};
|
|
26
|
-
this.blocksTransfers = {};
|
|
27
|
-
this.poolInterface = new abi_1.Interface(erc20_json_1.default);
|
|
28
|
-
// TODO: make logDecoder decode logs that
|
|
29
|
-
this.logDecoder = (log) => this.poolInterface.parseLog(log);
|
|
30
|
-
this.addressesSubscribed = [idleToken.address.toLowerCase()];
|
|
31
|
-
const cdoTokens = (0, tokens_1.getTokensByCdoAddress)(this.idleToken.cdoAddress);
|
|
32
|
-
if (cdoTokens) {
|
|
33
|
-
cdoTokens.forEach((idleToken) => {
|
|
34
|
-
if (!this.addressesSubscribed.includes(idleToken.idleAddress.toLowerCase())) {
|
|
35
|
-
this.addressesSubscribed.push(idleToken.idleAddress.toLowerCase());
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
// this.logger.debug('addressesSubscribed', this.idleToken.idleAddress, this.addressesSubscribed)
|
|
40
|
-
// Add handlers
|
|
41
|
-
this.handlers['Transfer'] = this.handleCoinTransfer.bind(this);
|
|
42
|
-
this.idleToken = idleToken;
|
|
43
|
-
this.cdoContract = new dexHelper.web3Provider.eth.Contract(idle_cdo_json_1.default, this.idleToken.cdoAddress);
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* The function is called every time any of the subscribed
|
|
47
|
-
* addresses release log. The function accepts the current
|
|
48
|
-
* state, updates the state according to the log, and returns
|
|
49
|
-
* the updated state.
|
|
50
|
-
* @param state - Current state of event subscriber
|
|
51
|
-
* @param log - Log released by one of the subscribed addresses
|
|
52
|
-
* @returns Updates state of the event subscriber after the log
|
|
53
|
-
*/
|
|
54
|
-
async processLog(state, log) {
|
|
55
|
-
try {
|
|
56
|
-
const event = this.logDecoder(log);
|
|
57
|
-
if (event.name in this.handlers) {
|
|
58
|
-
const result = await this.handlers[event.name](event, state, log);
|
|
59
|
-
return result;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
catch (e) {
|
|
63
|
-
(0, utils_1.catchParseLogError)(e, this.logger);
|
|
64
|
-
}
|
|
65
|
-
return null;
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* The function generates state using on-chain calls. This
|
|
69
|
-
* function is called to regenerate state if the event based
|
|
70
|
-
* system fails to fetch events and the local state is no
|
|
71
|
-
* more correct.
|
|
72
|
-
* @param blockNumber - Blocknumber for which the state should
|
|
73
|
-
* should be generated
|
|
74
|
-
* @returns state of the event subscriber at blocknumber
|
|
75
|
-
*/
|
|
76
|
-
async generateState(blockNumber) {
|
|
77
|
-
const tranchePrice = await this.cdoContract.methods['virtualPrice'](this.idleToken.idleAddress).call({}, blockNumber);
|
|
78
|
-
return {
|
|
79
|
-
tokenPrice: BigInt(tranchePrice),
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
setBlockState(blockNumber, state) {
|
|
83
|
-
this.logger.debug('setBlockState', blockNumber, this.idleToken.idleAddress, state);
|
|
84
|
-
return this._setState(state, blockNumber);
|
|
85
|
-
}
|
|
86
|
-
async handleCoinTransfer(event, state, log) {
|
|
87
|
-
const idleTokens = (0, tokens_1.getTokensByCdoAddress)(this.idleToken.cdoAddress);
|
|
88
|
-
if (!idleTokens)
|
|
89
|
-
return null;
|
|
90
|
-
const pollingPool = new idle_dao_pooling_pool_1.IdleDaoPollingPool(this.parentName, this.parentName, this.dexHelper, idleTokens, this.logger);
|
|
91
|
-
const blockNumber = log.blockNumber;
|
|
92
|
-
let poolsState = null;
|
|
93
|
-
if (log.address.toLowerCase() === this.idleToken.address.toLowerCase()) {
|
|
94
|
-
if (event.args.dst.toLowerCase() ===
|
|
95
|
-
this.idleToken.cdoAddress.toLowerCase() ||
|
|
96
|
-
event.args.src.toLowerCase() === this.idleToken.cdoAddress.toLowerCase()) {
|
|
97
|
-
poolsState = await pollingPool.getAggregatedBlockData(blockNumber);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
else if (this.addressesSubscribed.includes(log.address.toLowerCase())) {
|
|
101
|
-
poolsState = await pollingPool.getAggregatedBlockData(blockNumber);
|
|
102
|
-
}
|
|
103
|
-
// Update pools with the new state
|
|
104
|
-
if (poolsState) {
|
|
105
|
-
Object.keys(poolsState.value).forEach((idleAddress) => {
|
|
106
|
-
const poolState = poolsState?.value?.[idleAddress];
|
|
107
|
-
if (poolState) {
|
|
108
|
-
this.IdleDao.setEventPoolStateBlock(idleAddress, poolsState.blockNumber, poolState);
|
|
109
|
-
// Overwrite state
|
|
110
|
-
if (idleAddress === this.idleToken.idleAddress) {
|
|
111
|
-
state = poolState;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
return state;
|
|
117
|
-
}
|
|
118
|
-
processBlockTransfer(blockNumber, state) {
|
|
119
|
-
if (!this.blocksTransfers[blockNumber] ||
|
|
120
|
-
this.blocksTransfers[blockNumber].processed)
|
|
121
|
-
return state;
|
|
122
|
-
const idleAmount = this.blocksTransfers[blockNumber].idleAmount.div(1e18);
|
|
123
|
-
const underlyingAmount = this.blocksTransfers[blockNumber].underlyingAmount.div(`1e${this.idleToken.decimals}`);
|
|
124
|
-
if (idleAmount.gt(0) && underlyingAmount.gt(0)) {
|
|
125
|
-
const tokenPrice = BigInt(bignumber_js_1.default.maximum(idleAmount, underlyingAmount)
|
|
126
|
-
.div(bignumber_js_1.default.minimum(idleAmount, underlyingAmount))
|
|
127
|
-
.times(`1e${this.idleToken.decimals}`)
|
|
128
|
-
.toFixed(0));
|
|
129
|
-
this.logger.debug('tokenPrice', blockNumber, this.idleToken.idleSymbol, this.idleToken.decimals, idleAmount.toString(), underlyingAmount.toString(), tokenPrice.toString());
|
|
130
|
-
this.blocksTransfers[blockNumber].processed = true;
|
|
131
|
-
return {
|
|
132
|
-
tokenPrice,
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
|
-
return state;
|
|
136
|
-
}
|
|
137
|
-
async handleCoinTransfer_old(event, state, log) {
|
|
138
|
-
// Handle underlying token transfer
|
|
139
|
-
if (log.address.toLowerCase() === this.idleToken.address.toLowerCase()) {
|
|
140
|
-
if (event.args.dst.toLowerCase() ===
|
|
141
|
-
this.idleToken.cdoAddress.toLowerCase() ||
|
|
142
|
-
event.args.src.toLowerCase() === this.idleToken.cdoAddress.toLowerCase()) {
|
|
143
|
-
if (!this.blocksTransfers[log.blockNumber]) {
|
|
144
|
-
this.blocksTransfers[log.blockNumber] = {
|
|
145
|
-
processed: false,
|
|
146
|
-
idleAmount: (0, bignumber_js_1.default)(0),
|
|
147
|
-
underlyingAmount: (0, bignumber_js_1.default)(0),
|
|
148
|
-
};
|
|
149
|
-
}
|
|
150
|
-
this.logger.debug('UnderlyingAmount', log.blockNumber, 'event', event, 'log', log, (0, bignumber_js_1.default)(BigInt(event.args.wad).toString()).toFixed());
|
|
151
|
-
this.blocksTransfers[log.blockNumber].underlyingAmount = (0, bignumber_js_1.default)(BigInt(event.args.wad).toString());
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
// Handle idle token transfer
|
|
155
|
-
else if (log.address.toLowerCase() === this.idleToken.idleAddress.toLowerCase()) {
|
|
156
|
-
this.logger.debug('IdleToken Transfer', log.blockNumber, 'event', event, 'log', log);
|
|
157
|
-
if (event.args.src.toLowerCase() ===
|
|
158
|
-
'0x0000000000000000000000000000000000000000' ||
|
|
159
|
-
event.args.dst.toLowerCase() ===
|
|
160
|
-
'0x0000000000000000000000000000000000000000') {
|
|
161
|
-
if (!this.blocksTransfers[log.blockNumber]) {
|
|
162
|
-
this.blocksTransfers[log.blockNumber] = {
|
|
163
|
-
processed: false,
|
|
164
|
-
idleAmount: (0, bignumber_js_1.default)(0),
|
|
165
|
-
underlyingAmount: (0, bignumber_js_1.default)(0),
|
|
166
|
-
};
|
|
167
|
-
}
|
|
168
|
-
this.logger.debug('IdleAmount', log.blockNumber, 'event', event, 'log', log, (0, bignumber_js_1.default)(BigInt(event.args.wad).toString()).toFixed());
|
|
169
|
-
this.blocksTransfers[log.blockNumber].idleAmount = (0, bignumber_js_1.default)(BigInt(event.args.wad).toString());
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
return this.processBlockTransfer(log.blockNumber, state);
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
exports.IdleDaoEventPool = IdleDaoEventPool;
|
|
176
|
-
//# sourceMappingURL=idle-dao-pool.js.map
|