@paraswap/dex-lib 4.3.5 → 4.3.6
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/build/abi/algebra-integral/AlgebraFactory.abi.json +947 -0
- package/build/abi/algebra-integral/Quoter.abi.json +231 -0
- package/build/abi/algebra-integral/SwapRouter.abi.json +810 -0
- package/build/abi/ekubo/twamm-data-fetcher.json +216 -0
- package/build/abi/ekubo/twamm.json +720 -0
- package/build/abi/ring-v2/few-wrapped-token.json +587 -0
- package/build/abi/ring-v2/ring-v2-factory.json +125 -0
- package/build/abi/ring-v2/ring-v2-pool.json +461 -0
- package/build/abi/ring-v2/ring-v2-router.json +332 -0
- package/build/abi/uniswap-v2/ring-v2-router.json +332 -0
- package/build/dex/algebra-integral/algebra-integral-factory.d.ts +29 -0
- package/build/dex/algebra-integral/algebra-integral-factory.js +159 -0
- package/build/dex/algebra-integral/algebra-integral-factory.js.map +1 -0
- package/build/dex/algebra-integral/algebra-integral.d.ts +43 -0
- package/build/dex/algebra-integral/algebra-integral.js +425 -0
- package/build/dex/algebra-integral/algebra-integral.js.map +1 -0
- package/build/dex/algebra-integral/config.d.ts +3 -0
- package/build/dex/algebra-integral/config.js +17 -0
- package/build/dex/algebra-integral/config.js.map +1 -0
- package/build/dex/algebra-integral/types.d.ts +35 -0
- package/build/dex/algebra-integral/types.js +10 -0
- package/build/dex/algebra-integral/types.js.map +1 -0
- package/build/dex/balancer-v3/balancer-v3.js +13 -2
- package/build/dex/balancer-v3/balancer-v3.js.map +1 -1
- package/build/dex/balancer-v3/utils.d.ts +10 -0
- package/build/dex/balancer-v3/utils.js +32 -0
- package/build/dex/balancer-v3/utils.js.map +1 -1
- package/build/dex/ekubo/pools/base.d.ts +36 -0
- package/build/dex/ekubo/pools/base.js +289 -0
- package/build/dex/ekubo/pools/base.js.map +1 -0
- package/build/dex/ekubo/pools/full-range.d.ts +23 -0
- package/build/dex/ekubo/pools/full-range.js +99 -0
- package/build/dex/ekubo/pools/full-range.js.map +1 -0
- package/build/dex/ekubo/pools/iface.d.ts +46 -0
- package/build/dex/ekubo/pools/iface.js +75 -0
- package/build/dex/ekubo/pools/iface.js.map +1 -0
- package/build/dex/ekubo/pools/math/twamm/exp2.d.ts +1 -0
- package/build/dex/ekubo/pools/math/twamm/exp2.js +86 -0
- package/build/dex/ekubo/pools/math/twamm/exp2.js.map +1 -0
- package/build/dex/ekubo/pools/math/twamm/sqrt-ratio.d.ts +1 -0
- package/build/dex/ekubo/pools/math/twamm/sqrt-ratio.js +56 -0
- package/build/dex/ekubo/pools/math/twamm/sqrt-ratio.js.map +1 -0
- package/build/dex/ekubo/pools/oracle.d.ts +8 -0
- package/build/dex/ekubo/pools/oracle.js +19 -0
- package/build/dex/ekubo/pools/oracle.js.map +1 -0
- package/build/dex/ekubo/pools/twamm.d.ts +38 -0
- package/build/dex/ekubo/pools/twamm.js +253 -0
- package/build/dex/ekubo/pools/twamm.js.map +1 -0
- package/build/dex/ekubo/pools/utils.d.ts +28 -0
- package/build/dex/ekubo/pools/utils.js +80 -0
- package/build/dex/ekubo/pools/utils.js.map +1 -0
- package/build/dex/miro-migrator/constants.d.ts +1 -1
- package/build/dex/miro-migrator/constants.js +1 -1
- package/build/dex/miro-migrator/miro-migrator-pool.d.ts +5 -5
- package/build/dex/miro-migrator/miro-migrator-pool.js +13 -22
- package/build/dex/miro-migrator/miro-migrator-pool.js.map +1 -1
- package/build/dex/miro-migrator/miro-migrator-state.d.ts +27 -0
- package/build/dex/miro-migrator/miro-migrator-state.js +89 -0
- package/build/dex/miro-migrator/miro-migrator-state.js.map +1 -0
- package/build/dex/miro-migrator/miro-migrator.js +4 -2
- package/build/dex/miro-migrator/miro-migrator.js.map +1 -1
- package/build/dex/uniswap-v2/ring-v2.d.ts +35 -0
- package/build/dex/uniswap-v2/ring-v2.js +223 -0
- package/build/dex/uniswap-v2/ring-v2.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,332 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"inputs": [
|
|
4
|
+
{ "internalType": "address", "name": "_factory", "type": "address" },
|
|
5
|
+
{ "internalType": "address", "name": "_WETH", "type": "address" },
|
|
6
|
+
{ "internalType": "address", "name": "_fewFactory", "type": "address" },
|
|
7
|
+
{ "internalType": "address", "name": "_fwWETH", "type": "address" }
|
|
8
|
+
],
|
|
9
|
+
"stateMutability": "nonpayable",
|
|
10
|
+
"type": "constructor"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"inputs": [],
|
|
14
|
+
"name": "WETH",
|
|
15
|
+
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
|
|
16
|
+
"stateMutability": "view",
|
|
17
|
+
"type": "function"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"inputs": [
|
|
21
|
+
{ "internalType": "address", "name": "tokenA", "type": "address" },
|
|
22
|
+
{ "internalType": "address", "name": "tokenB", "type": "address" },
|
|
23
|
+
{
|
|
24
|
+
"internalType": "uint256",
|
|
25
|
+
"name": "amountADesired",
|
|
26
|
+
"type": "uint256"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"internalType": "uint256",
|
|
30
|
+
"name": "amountBDesired",
|
|
31
|
+
"type": "uint256"
|
|
32
|
+
},
|
|
33
|
+
{ "internalType": "uint256", "name": "amountAMin", "type": "uint256" },
|
|
34
|
+
{ "internalType": "uint256", "name": "amountBMin", "type": "uint256" },
|
|
35
|
+
{ "internalType": "address", "name": "to", "type": "address" },
|
|
36
|
+
{ "internalType": "uint256", "name": "deadline", "type": "uint256" }
|
|
37
|
+
],
|
|
38
|
+
"name": "addLiquidity",
|
|
39
|
+
"outputs": [
|
|
40
|
+
{ "internalType": "uint256", "name": "amountA", "type": "uint256" },
|
|
41
|
+
{ "internalType": "uint256", "name": "amountB", "type": "uint256" },
|
|
42
|
+
{ "internalType": "uint256", "name": "liquidity", "type": "uint256" }
|
|
43
|
+
],
|
|
44
|
+
"stateMutability": "nonpayable",
|
|
45
|
+
"type": "function"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"inputs": [
|
|
49
|
+
{ "internalType": "address", "name": "token", "type": "address" },
|
|
50
|
+
{
|
|
51
|
+
"internalType": "uint256",
|
|
52
|
+
"name": "amountTokenDesired",
|
|
53
|
+
"type": "uint256"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"internalType": "uint256",
|
|
57
|
+
"name": "amountTokenMin",
|
|
58
|
+
"type": "uint256"
|
|
59
|
+
},
|
|
60
|
+
{ "internalType": "uint256", "name": "amountETHMin", "type": "uint256" },
|
|
61
|
+
{ "internalType": "address", "name": "to", "type": "address" },
|
|
62
|
+
{ "internalType": "uint256", "name": "deadline", "type": "uint256" }
|
|
63
|
+
],
|
|
64
|
+
"name": "addLiquidityETH",
|
|
65
|
+
"outputs": [
|
|
66
|
+
{ "internalType": "uint256", "name": "amountToken", "type": "uint256" },
|
|
67
|
+
{ "internalType": "uint256", "name": "amountETH", "type": "uint256" },
|
|
68
|
+
{ "internalType": "uint256", "name": "liquidity", "type": "uint256" }
|
|
69
|
+
],
|
|
70
|
+
"stateMutability": "payable",
|
|
71
|
+
"type": "function"
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"inputs": [],
|
|
75
|
+
"name": "factory",
|
|
76
|
+
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
|
|
77
|
+
"stateMutability": "view",
|
|
78
|
+
"type": "function"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"inputs": [],
|
|
82
|
+
"name": "fewFactory",
|
|
83
|
+
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
|
|
84
|
+
"stateMutability": "view",
|
|
85
|
+
"type": "function"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"inputs": [],
|
|
89
|
+
"name": "fwWETH",
|
|
90
|
+
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
|
|
91
|
+
"stateMutability": "view",
|
|
92
|
+
"type": "function"
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"inputs": [
|
|
96
|
+
{ "internalType": "uint256", "name": "amountOut", "type": "uint256" },
|
|
97
|
+
{ "internalType": "uint256", "name": "reserveIn", "type": "uint256" },
|
|
98
|
+
{ "internalType": "uint256", "name": "reserveOut", "type": "uint256" }
|
|
99
|
+
],
|
|
100
|
+
"name": "getAmountIn",
|
|
101
|
+
"outputs": [
|
|
102
|
+
{ "internalType": "uint256", "name": "amountIn", "type": "uint256" }
|
|
103
|
+
],
|
|
104
|
+
"stateMutability": "pure",
|
|
105
|
+
"type": "function"
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
"inputs": [
|
|
109
|
+
{ "internalType": "uint256", "name": "amountIn", "type": "uint256" },
|
|
110
|
+
{ "internalType": "uint256", "name": "reserveIn", "type": "uint256" },
|
|
111
|
+
{ "internalType": "uint256", "name": "reserveOut", "type": "uint256" }
|
|
112
|
+
],
|
|
113
|
+
"name": "getAmountOut",
|
|
114
|
+
"outputs": [
|
|
115
|
+
{ "internalType": "uint256", "name": "amountOut", "type": "uint256" }
|
|
116
|
+
],
|
|
117
|
+
"stateMutability": "pure",
|
|
118
|
+
"type": "function"
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
"inputs": [
|
|
122
|
+
{ "internalType": "uint256", "name": "amountOut", "type": "uint256" },
|
|
123
|
+
{ "internalType": "address[]", "name": "path", "type": "address[]" }
|
|
124
|
+
],
|
|
125
|
+
"name": "getAmountsIn",
|
|
126
|
+
"outputs": [
|
|
127
|
+
{ "internalType": "uint256[]", "name": "amounts", "type": "uint256[]" }
|
|
128
|
+
],
|
|
129
|
+
"stateMutability": "view",
|
|
130
|
+
"type": "function"
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
"inputs": [
|
|
134
|
+
{ "internalType": "uint256", "name": "amountIn", "type": "uint256" },
|
|
135
|
+
{ "internalType": "address[]", "name": "path", "type": "address[]" }
|
|
136
|
+
],
|
|
137
|
+
"name": "getAmountsOut",
|
|
138
|
+
"outputs": [
|
|
139
|
+
{ "internalType": "uint256[]", "name": "amounts", "type": "uint256[]" }
|
|
140
|
+
],
|
|
141
|
+
"stateMutability": "view",
|
|
142
|
+
"type": "function"
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
"inputs": [
|
|
146
|
+
{ "internalType": "uint256", "name": "amountA", "type": "uint256" },
|
|
147
|
+
{ "internalType": "uint256", "name": "reserveA", "type": "uint256" },
|
|
148
|
+
{ "internalType": "uint256", "name": "reserveB", "type": "uint256" }
|
|
149
|
+
],
|
|
150
|
+
"name": "quote",
|
|
151
|
+
"outputs": [
|
|
152
|
+
{ "internalType": "uint256", "name": "amountB", "type": "uint256" }
|
|
153
|
+
],
|
|
154
|
+
"stateMutability": "pure",
|
|
155
|
+
"type": "function"
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
"inputs": [
|
|
159
|
+
{ "internalType": "address", "name": "tokenA", "type": "address" },
|
|
160
|
+
{ "internalType": "address", "name": "tokenB", "type": "address" },
|
|
161
|
+
{ "internalType": "uint256", "name": "liquidity", "type": "uint256" },
|
|
162
|
+
{ "internalType": "uint256", "name": "amountAMin", "type": "uint256" },
|
|
163
|
+
{ "internalType": "uint256", "name": "amountBMin", "type": "uint256" },
|
|
164
|
+
{ "internalType": "address", "name": "to", "type": "address" },
|
|
165
|
+
{ "internalType": "uint256", "name": "deadline", "type": "uint256" }
|
|
166
|
+
],
|
|
167
|
+
"name": "removeLiquidity",
|
|
168
|
+
"outputs": [
|
|
169
|
+
{ "internalType": "uint256", "name": "amountA", "type": "uint256" },
|
|
170
|
+
{ "internalType": "uint256", "name": "amountB", "type": "uint256" }
|
|
171
|
+
],
|
|
172
|
+
"stateMutability": "nonpayable",
|
|
173
|
+
"type": "function"
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
"inputs": [
|
|
177
|
+
{ "internalType": "address", "name": "token", "type": "address" },
|
|
178
|
+
{ "internalType": "uint256", "name": "liquidity", "type": "uint256" },
|
|
179
|
+
{
|
|
180
|
+
"internalType": "uint256",
|
|
181
|
+
"name": "amountTokenMin",
|
|
182
|
+
"type": "uint256"
|
|
183
|
+
},
|
|
184
|
+
{ "internalType": "uint256", "name": "amountETHMin", "type": "uint256" },
|
|
185
|
+
{ "internalType": "address", "name": "to", "type": "address" },
|
|
186
|
+
{ "internalType": "uint256", "name": "deadline", "type": "uint256" }
|
|
187
|
+
],
|
|
188
|
+
"name": "removeLiquidityETH",
|
|
189
|
+
"outputs": [
|
|
190
|
+
{ "internalType": "uint256", "name": "amountToken", "type": "uint256" },
|
|
191
|
+
{ "internalType": "uint256", "name": "amountETH", "type": "uint256" }
|
|
192
|
+
],
|
|
193
|
+
"stateMutability": "nonpayable",
|
|
194
|
+
"type": "function"
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
"inputs": [
|
|
198
|
+
{ "internalType": "address", "name": "token", "type": "address" },
|
|
199
|
+
{ "internalType": "uint256", "name": "liquidity", "type": "uint256" },
|
|
200
|
+
{
|
|
201
|
+
"internalType": "uint256",
|
|
202
|
+
"name": "amountTokenMin",
|
|
203
|
+
"type": "uint256"
|
|
204
|
+
},
|
|
205
|
+
{ "internalType": "uint256", "name": "amountETHMin", "type": "uint256" },
|
|
206
|
+
{ "internalType": "address", "name": "to", "type": "address" },
|
|
207
|
+
{ "internalType": "uint256", "name": "deadline", "type": "uint256" },
|
|
208
|
+
{ "internalType": "bool", "name": "approveMax", "type": "bool" },
|
|
209
|
+
{ "internalType": "uint8", "name": "v", "type": "uint8" },
|
|
210
|
+
{ "internalType": "bytes32", "name": "r", "type": "bytes32" },
|
|
211
|
+
{ "internalType": "bytes32", "name": "s", "type": "bytes32" }
|
|
212
|
+
],
|
|
213
|
+
"name": "removeLiquidityETHWithPermit",
|
|
214
|
+
"outputs": [
|
|
215
|
+
{ "internalType": "uint256", "name": "amountToken", "type": "uint256" },
|
|
216
|
+
{ "internalType": "uint256", "name": "amountETH", "type": "uint256" }
|
|
217
|
+
],
|
|
218
|
+
"stateMutability": "nonpayable",
|
|
219
|
+
"type": "function"
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
"inputs": [
|
|
223
|
+
{ "internalType": "address", "name": "tokenA", "type": "address" },
|
|
224
|
+
{ "internalType": "address", "name": "tokenB", "type": "address" },
|
|
225
|
+
{ "internalType": "uint256", "name": "liquidity", "type": "uint256" },
|
|
226
|
+
{ "internalType": "uint256", "name": "amountAMin", "type": "uint256" },
|
|
227
|
+
{ "internalType": "uint256", "name": "amountBMin", "type": "uint256" },
|
|
228
|
+
{ "internalType": "address", "name": "to", "type": "address" },
|
|
229
|
+
{ "internalType": "uint256", "name": "deadline", "type": "uint256" },
|
|
230
|
+
{ "internalType": "bool", "name": "approveMax", "type": "bool" },
|
|
231
|
+
{ "internalType": "uint8", "name": "v", "type": "uint8" },
|
|
232
|
+
{ "internalType": "bytes32", "name": "r", "type": "bytes32" },
|
|
233
|
+
{ "internalType": "bytes32", "name": "s", "type": "bytes32" }
|
|
234
|
+
],
|
|
235
|
+
"name": "removeLiquidityWithPermit",
|
|
236
|
+
"outputs": [
|
|
237
|
+
{ "internalType": "uint256", "name": "amountA", "type": "uint256" },
|
|
238
|
+
{ "internalType": "uint256", "name": "amountB", "type": "uint256" }
|
|
239
|
+
],
|
|
240
|
+
"stateMutability": "nonpayable",
|
|
241
|
+
"type": "function"
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
"inputs": [
|
|
245
|
+
{ "internalType": "uint256", "name": "amountOut", "type": "uint256" },
|
|
246
|
+
{ "internalType": "address[]", "name": "path", "type": "address[]" },
|
|
247
|
+
{ "internalType": "address", "name": "to", "type": "address" },
|
|
248
|
+
{ "internalType": "uint256", "name": "deadline", "type": "uint256" }
|
|
249
|
+
],
|
|
250
|
+
"name": "swapETHForExactTokens",
|
|
251
|
+
"outputs": [
|
|
252
|
+
{ "internalType": "uint256[]", "name": "amounts", "type": "uint256[]" }
|
|
253
|
+
],
|
|
254
|
+
"stateMutability": "payable",
|
|
255
|
+
"type": "function"
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
"inputs": [
|
|
259
|
+
{ "internalType": "uint256", "name": "amountOutMin", "type": "uint256" },
|
|
260
|
+
{ "internalType": "address[]", "name": "path", "type": "address[]" },
|
|
261
|
+
{ "internalType": "address", "name": "to", "type": "address" },
|
|
262
|
+
{ "internalType": "uint256", "name": "deadline", "type": "uint256" }
|
|
263
|
+
],
|
|
264
|
+
"name": "swapExactETHForTokens",
|
|
265
|
+
"outputs": [
|
|
266
|
+
{ "internalType": "uint256[]", "name": "amounts", "type": "uint256[]" }
|
|
267
|
+
],
|
|
268
|
+
"stateMutability": "payable",
|
|
269
|
+
"type": "function"
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
"inputs": [
|
|
273
|
+
{ "internalType": "uint256", "name": "amountIn", "type": "uint256" },
|
|
274
|
+
{ "internalType": "uint256", "name": "amountOutMin", "type": "uint256" },
|
|
275
|
+
{ "internalType": "address[]", "name": "path", "type": "address[]" },
|
|
276
|
+
{ "internalType": "address", "name": "to", "type": "address" },
|
|
277
|
+
{ "internalType": "uint256", "name": "deadline", "type": "uint256" }
|
|
278
|
+
],
|
|
279
|
+
"name": "swapExactTokensForETH",
|
|
280
|
+
"outputs": [
|
|
281
|
+
{ "internalType": "uint256[]", "name": "amounts", "type": "uint256[]" }
|
|
282
|
+
],
|
|
283
|
+
"stateMutability": "nonpayable",
|
|
284
|
+
"type": "function"
|
|
285
|
+
},
|
|
286
|
+
{
|
|
287
|
+
"inputs": [
|
|
288
|
+
{ "internalType": "uint256", "name": "amountIn", "type": "uint256" },
|
|
289
|
+
{ "internalType": "uint256", "name": "amountOutMin", "type": "uint256" },
|
|
290
|
+
{ "internalType": "address[]", "name": "path", "type": "address[]" },
|
|
291
|
+
{ "internalType": "address", "name": "to", "type": "address" },
|
|
292
|
+
{ "internalType": "uint256", "name": "deadline", "type": "uint256" }
|
|
293
|
+
],
|
|
294
|
+
"name": "swapExactTokensForTokens",
|
|
295
|
+
"outputs": [
|
|
296
|
+
{ "internalType": "uint256[]", "name": "amounts", "type": "uint256[]" }
|
|
297
|
+
],
|
|
298
|
+
"stateMutability": "nonpayable",
|
|
299
|
+
"type": "function"
|
|
300
|
+
},
|
|
301
|
+
{
|
|
302
|
+
"inputs": [
|
|
303
|
+
{ "internalType": "uint256", "name": "amountOut", "type": "uint256" },
|
|
304
|
+
{ "internalType": "uint256", "name": "amountInMax", "type": "uint256" },
|
|
305
|
+
{ "internalType": "address[]", "name": "path", "type": "address[]" },
|
|
306
|
+
{ "internalType": "address", "name": "to", "type": "address" },
|
|
307
|
+
{ "internalType": "uint256", "name": "deadline", "type": "uint256" }
|
|
308
|
+
],
|
|
309
|
+
"name": "swapTokensForExactETH",
|
|
310
|
+
"outputs": [
|
|
311
|
+
{ "internalType": "uint256[]", "name": "amounts", "type": "uint256[]" }
|
|
312
|
+
],
|
|
313
|
+
"stateMutability": "nonpayable",
|
|
314
|
+
"type": "function"
|
|
315
|
+
},
|
|
316
|
+
{
|
|
317
|
+
"inputs": [
|
|
318
|
+
{ "internalType": "uint256", "name": "amountOut", "type": "uint256" },
|
|
319
|
+
{ "internalType": "uint256", "name": "amountInMax", "type": "uint256" },
|
|
320
|
+
{ "internalType": "address[]", "name": "path", "type": "address[]" },
|
|
321
|
+
{ "internalType": "address", "name": "to", "type": "address" },
|
|
322
|
+
{ "internalType": "uint256", "name": "deadline", "type": "uint256" }
|
|
323
|
+
],
|
|
324
|
+
"name": "swapTokensForExactTokens",
|
|
325
|
+
"outputs": [
|
|
326
|
+
{ "internalType": "uint256[]", "name": "amounts", "type": "uint256[]" }
|
|
327
|
+
],
|
|
328
|
+
"stateMutability": "nonpayable",
|
|
329
|
+
"type": "function"
|
|
330
|
+
},
|
|
331
|
+
{ "stateMutability": "payable", "type": "receive" }
|
|
332
|
+
]
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Interface } from '@ethersproject/abi';
|
|
2
|
+
import { DeepReadonly } from 'ts-essentials';
|
|
3
|
+
import { IDexHelper } from '../../dex-helper/idex-helper';
|
|
4
|
+
import { StatefulEventSubscriber } from '../../stateful-event-subscriber';
|
|
5
|
+
import { Address, Log, Logger } from '../../types';
|
|
6
|
+
import { LogDescription } from 'ethers/lib/utils';
|
|
7
|
+
import { FactoryState, Pool } from './types';
|
|
8
|
+
export declare class AlgebraIntegralFactory extends StatefulEventSubscriber<FactoryState> {
|
|
9
|
+
readonly parentName: string;
|
|
10
|
+
protected network: number;
|
|
11
|
+
protected dexHelper: IDexHelper;
|
|
12
|
+
protected factoryAddress: Address;
|
|
13
|
+
protected subgraphURL: string;
|
|
14
|
+
protected factoryIface: Interface;
|
|
15
|
+
handlers: {
|
|
16
|
+
[event: string]: (event: any) => Promise<void>;
|
|
17
|
+
};
|
|
18
|
+
logDecoder: (log: Log) => any;
|
|
19
|
+
private pools;
|
|
20
|
+
constructor(parentName: string, network: number, dexHelper: IDexHelper, logger: Logger, factoryAddress: Address, subgraphURL: string, factoryIface?: Interface);
|
|
21
|
+
initialize(blockNumber: number): Promise<void>;
|
|
22
|
+
generateState(): FactoryState;
|
|
23
|
+
protected processLog(_: DeepReadonly<FactoryState>, log: Readonly<Log>): Promise<FactoryState>;
|
|
24
|
+
getAvailablePoolsForPair(srcToken: Address, destToken: Address, blockNumber: number): Promise<Pool[]>;
|
|
25
|
+
queryAllAvailablePools(blockNumber: number): Promise<Pool[]>;
|
|
26
|
+
private queryOnePageForAllAvailablePoolsFromSubgraph;
|
|
27
|
+
handleNewPool(event: LogDescription): Promise<void>;
|
|
28
|
+
handleNewCustomPool(event: LogDescription): Promise<void>;
|
|
29
|
+
}
|
|
@@ -0,0 +1,159 @@
|
|
|
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.AlgebraIntegralFactory = void 0;
|
|
7
|
+
const abi_1 = require("@ethersproject/abi");
|
|
8
|
+
const AlgebraFactory_abi_json_1 = __importDefault(require("../../abi/algebra-integral/AlgebraFactory.abi.json"));
|
|
9
|
+
const stateful_event_subscriber_1 = require("../../stateful-event-subscriber");
|
|
10
|
+
const constants_1 = require("../../constants");
|
|
11
|
+
/*
|
|
12
|
+
* "Stateless" event subscriber in order to capture "PoolCreated" event on new pools created.
|
|
13
|
+
* State is present, but it's a placeholder to actually make the events reach handlers (if there's no previous state - `processBlockLogs` is not called)
|
|
14
|
+
*/
|
|
15
|
+
class AlgebraIntegralFactory extends stateful_event_subscriber_1.StatefulEventSubscriber {
|
|
16
|
+
parentName;
|
|
17
|
+
network;
|
|
18
|
+
dexHelper;
|
|
19
|
+
factoryAddress;
|
|
20
|
+
subgraphURL;
|
|
21
|
+
factoryIface;
|
|
22
|
+
handlers = {};
|
|
23
|
+
logDecoder;
|
|
24
|
+
pools = [];
|
|
25
|
+
constructor(parentName, network, dexHelper, logger, factoryAddress, subgraphURL, factoryIface = new abi_1.Interface(AlgebraFactory_abi_json_1.default)) {
|
|
26
|
+
super(parentName, `${parentName} Factory`, dexHelper, logger, false);
|
|
27
|
+
this.parentName = parentName;
|
|
28
|
+
this.network = network;
|
|
29
|
+
this.dexHelper = dexHelper;
|
|
30
|
+
this.factoryAddress = factoryAddress;
|
|
31
|
+
this.subgraphURL = subgraphURL;
|
|
32
|
+
this.factoryIface = factoryIface;
|
|
33
|
+
this.addressesSubscribed = [factoryAddress];
|
|
34
|
+
this.logDecoder = (log) => this.factoryIface.parseLog(log);
|
|
35
|
+
this.handlers['Pool'] = this.handleNewPool.bind(this);
|
|
36
|
+
this.handlers['CustomPool'] = this.handleNewCustomPool.bind(this);
|
|
37
|
+
}
|
|
38
|
+
async initialize(blockNumber) {
|
|
39
|
+
this.pools = await this.queryAllAvailablePools(blockNumber);
|
|
40
|
+
}
|
|
41
|
+
generateState() {
|
|
42
|
+
return {};
|
|
43
|
+
}
|
|
44
|
+
async processLog(_, log) {
|
|
45
|
+
const event = this.logDecoder(log);
|
|
46
|
+
if (event.name in this.handlers) {
|
|
47
|
+
await this.handlers[event.name](event);
|
|
48
|
+
}
|
|
49
|
+
return {};
|
|
50
|
+
}
|
|
51
|
+
async getAvailablePoolsForPair(srcToken, destToken, blockNumber) {
|
|
52
|
+
const _srcToken = this.dexHelper.config.wrapETH(srcToken);
|
|
53
|
+
const _destToken = this.dexHelper.config.wrapETH(destToken);
|
|
54
|
+
const [_srcAddress, _destAddress] = [
|
|
55
|
+
_srcToken.toLowerCase(),
|
|
56
|
+
_destToken.toLowerCase(),
|
|
57
|
+
];
|
|
58
|
+
return this.pools
|
|
59
|
+
.filter(pool => (pool.token0 === _srcAddress && pool.token1 === _destAddress) ||
|
|
60
|
+
(pool.token0 === _destAddress && pool.token1 === _srcAddress))
|
|
61
|
+
.sort((a, b) => {
|
|
62
|
+
// sort by tvl
|
|
63
|
+
const tvlDiff = b.tvlUSD - a.tvlUSD;
|
|
64
|
+
if (tvlDiff !== 0) {
|
|
65
|
+
return tvlDiff;
|
|
66
|
+
}
|
|
67
|
+
return 1;
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
async queryAllAvailablePools(blockNumber) {
|
|
71
|
+
const defaultPerPageLimit = 1000;
|
|
72
|
+
let pools = [];
|
|
73
|
+
let skip = 0;
|
|
74
|
+
let currentPools = await this.queryOnePageForAllAvailablePoolsFromSubgraph(blockNumber, skip, defaultPerPageLimit);
|
|
75
|
+
pools = pools.concat(currentPools);
|
|
76
|
+
while (currentPools.length === defaultPerPageLimit) {
|
|
77
|
+
skip += defaultPerPageLimit;
|
|
78
|
+
currentPools = await this.queryOnePageForAllAvailablePoolsFromSubgraph(blockNumber, skip, defaultPerPageLimit);
|
|
79
|
+
pools = pools.concat(currentPools);
|
|
80
|
+
}
|
|
81
|
+
return pools;
|
|
82
|
+
}
|
|
83
|
+
async queryOnePageForAllAvailablePoolsFromSubgraph(blockNumber, skip, limit, latestBlock = false) {
|
|
84
|
+
const poolsQuery = `query ($skip: Int!, $first: Int!) {
|
|
85
|
+
pools(
|
|
86
|
+
${latestBlock ? '' : `block: { number: ${blockNumber} }`}
|
|
87
|
+
orderBy: totalValueLockedUSD
|
|
88
|
+
orderDirection: desc
|
|
89
|
+
skip: $skip
|
|
90
|
+
first: $first
|
|
91
|
+
) {
|
|
92
|
+
id
|
|
93
|
+
deployer
|
|
94
|
+
totalValueLockedUSD
|
|
95
|
+
token0 {
|
|
96
|
+
id
|
|
97
|
+
}
|
|
98
|
+
token1 {
|
|
99
|
+
id
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}`;
|
|
103
|
+
const res = await this.dexHelper.httpRequest.querySubgraph(this.subgraphURL, {
|
|
104
|
+
query: poolsQuery,
|
|
105
|
+
variables: {
|
|
106
|
+
skip,
|
|
107
|
+
first: limit,
|
|
108
|
+
},
|
|
109
|
+
}, { timeout: constants_1.SUBGRAPH_TIMEOUT });
|
|
110
|
+
if (res.errors && res.errors.length) {
|
|
111
|
+
if (res.errors[0].message.includes('missing block')) {
|
|
112
|
+
this.logger.info(`${this.parentName}: subgraph fallback to the latest block...`);
|
|
113
|
+
return this.queryOnePageForAllAvailablePoolsFromSubgraph(blockNumber, skip, limit, true);
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
throw new Error(res.errors[0].message);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return res.data.pools.map(pool => ({
|
|
120
|
+
poolAddress: pool.id.toLowerCase(),
|
|
121
|
+
token0: pool.token0.id.toLowerCase(),
|
|
122
|
+
token1: pool.token1.id.toLowerCase(),
|
|
123
|
+
deployer: pool.deployer.toLowerCase(),
|
|
124
|
+
tvlUSD: parseFloat(pool.totalValueLockedUSD) || 0,
|
|
125
|
+
}));
|
|
126
|
+
}
|
|
127
|
+
async handleNewPool(event) {
|
|
128
|
+
const token0 = event.args.token0.toLowerCase();
|
|
129
|
+
const token1 = event.args.token1.toLowerCase();
|
|
130
|
+
const deployer = constants_1.NULL_ADDRESS; // Regular pools have zero address as deployer
|
|
131
|
+
const poolAddress = event.args.pool?.toLowerCase() || '';
|
|
132
|
+
if (poolAddress) {
|
|
133
|
+
this.pools.push({
|
|
134
|
+
poolAddress,
|
|
135
|
+
token0,
|
|
136
|
+
token1,
|
|
137
|
+
deployer,
|
|
138
|
+
tvlUSD: 0,
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
async handleNewCustomPool(event) {
|
|
143
|
+
const token0 = event.args.token0.toLowerCase();
|
|
144
|
+
const token1 = event.args.token1.toLowerCase();
|
|
145
|
+
const deployer = event.args.deployer.toLowerCase();
|
|
146
|
+
const poolAddress = event.args.pool?.toLowerCase() || '';
|
|
147
|
+
if (poolAddress) {
|
|
148
|
+
this.pools.push({
|
|
149
|
+
poolAddress,
|
|
150
|
+
token0,
|
|
151
|
+
token1,
|
|
152
|
+
deployer,
|
|
153
|
+
tvlUSD: 0,
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
exports.AlgebraIntegralFactory = AlgebraIntegralFactory;
|
|
159
|
+
//# sourceMappingURL=algebra-integral-factory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"algebra-integral-factory.js","sourceRoot":"","sources":["../../../src/dex/algebra-integral/algebra-integral-factory.ts"],"names":[],"mappings":";;;;;;AAAA,4CAA+C;AAE/C,iHAA4E;AAE5E,+EAA0E;AAI1E,+CAAiE;AAEjE;;;GAGG;AACH,MAAa,sBAAuB,SAAQ,mDAAqC;IAUpE;IACC;IACA;IAEA;IACA;IACA;IAfZ,QAAQ,GAEJ,EAAE,CAAC;IAEP,UAAU,CAAoB;IAEtB,KAAK,GAAW,EAAE,CAAC;IAE3B,YACW,UAAkB,EACjB,OAAe,EACf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WAAW,EAAE,CAAC;QAEnD,MAAM,WAAW,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;QACzD,IAAI,WAAW,EAAE,CAAC;YAChB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;gBACd,WAAW;gBACX,MAAM;gBACN,MAAM;gBACN,QAAQ;gBACR,MAAM,EAAE,CAAC;aACV,CAAC,CAAC;QACL,CAAC;IACH,CAAC;CACF;AApND,wDAoNC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Token, Address, ExchangePrices, PoolPrices, AdapterExchangeParam, PoolLiquidity, TransferFeeParams, Logger, DexExchangeParam, NumberAsString } from '../../types';
|
|
2
|
+
import { SwapSide, Network } from '../../constants';
|
|
3
|
+
import { Interface } from 'ethers/lib/utils';
|
|
4
|
+
import { IDex } from '../../dex/idex';
|
|
5
|
+
import { IDexHelper } from '../../dex-helper/idex-helper';
|
|
6
|
+
import { AlgebraIntegralData, Pool } from './types';
|
|
7
|
+
import { SimpleExchange } from '../simple-exchange';
|
|
8
|
+
export declare class AlgebraIntegral extends SimpleExchange implements IDex<AlgebraIntegralData> {
|
|
9
|
+
readonly network: Network;
|
|
10
|
+
readonly dexKey: string;
|
|
11
|
+
readonly dexHelper: IDexHelper;
|
|
12
|
+
readonly routerIface: Interface;
|
|
13
|
+
readonly quoterIface: Interface;
|
|
14
|
+
readonly config: import("./types").DexParams;
|
|
15
|
+
readonly hasConstantPriceLargeAmounts = false;
|
|
16
|
+
readonly needWrapNative = true;
|
|
17
|
+
readonly isFeeOnTransferSupported = true;
|
|
18
|
+
private readonly factory;
|
|
19
|
+
static dexKeysWithNetwork: {
|
|
20
|
+
key: string;
|
|
21
|
+
networks: Network[];
|
|
22
|
+
}[];
|
|
23
|
+
logger: Logger;
|
|
24
|
+
private uniswapMulti;
|
|
25
|
+
constructor(network: Network, dexKey: string, dexHelper: IDexHelper, routerIface?: Interface, quoterIface?: Interface, config?: import("./types").DexParams);
|
|
26
|
+
initializePricing(blockNumber: number): Promise<void>;
|
|
27
|
+
getAdapters(side: SwapSide): {
|
|
28
|
+
name: string;
|
|
29
|
+
index: number;
|
|
30
|
+
}[] | null;
|
|
31
|
+
getPoolIdentifier(srcAddress: Address, destAddress: Address, deployerAddress: Address): string;
|
|
32
|
+
getPoolIdentifiers(srcToken: Token, destToken: Token, side: SwapSide, blockNumber: number): Promise<string[]>;
|
|
33
|
+
getPricingFromRpc(from: Token, to: Token, amounts: bigint[], side: SwapSide, pools: Pool[], transferFees?: TransferFeeParams): Promise<ExchangePrices<AlgebraIntegralData> | null>;
|
|
34
|
+
getPricesVolume(srcToken: Token, destToken: Token, amounts: bigint[], side: SwapSide, blockNumber: number, limitPools?: string[], transferFees?: TransferFeeParams): Promise<null | ExchangePrices<AlgebraIntegralData>>;
|
|
35
|
+
getCalldataGasCost(poolPrices: PoolPrices<AlgebraIntegralData>): number | number[];
|
|
36
|
+
getDexParam(srcToken: Address, destToken: Address, srcAmount: NumberAsString, destAmount: NumberAsString, recipient: Address, data: AlgebraIntegralData, side: SwapSide): DexExchangeParam;
|
|
37
|
+
getAdapterParam(srcToken: string, destToken: string, srcAmount: string, destAmount: string, data: AlgebraIntegralData, side: SwapSide): AdapterExchangeParam;
|
|
38
|
+
getTopPoolsForToken(tokenAddress: Address, limit: number): Promise<PoolLiquidity[]>;
|
|
39
|
+
private _querySubgraph;
|
|
40
|
+
private _encodePath;
|
|
41
|
+
private _sortTokens;
|
|
42
|
+
private _getLoweredAddresses;
|
|
43
|
+
}
|