@paraswap/dex-lib 3.7.9-dex-deprecation.0 → 3.8.1
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/curve-v1-factory/CurveV1Router.abi.json +331 -0
- package/build/config.js +1 -1
- package/build/dex/curve-v1-factory/config.js +47 -10
- package/build/dex/curve-v1-factory/config.js.map +1 -1
- package/build/dex/curve-v1-factory/curve-v1-factory.d.ts +2 -2
- package/build/dex/curve-v1-factory/curve-v1-factory.js +96 -36
- package/build/dex/curve-v1-factory/curve-v1-factory.js.map +1 -1
- package/build/dex/curve-v1-factory/optimizer.d.ts +2 -0
- package/build/dex/curve-v1-factory/optimizer.js +54 -0
- package/build/dex/curve-v1-factory/optimizer.js.map +1 -0
- package/build/dex/curve-v1-factory/price-handlers/functions/constants.js.map +1 -1
- package/build/dex/curve-v1-factory/price-handlers/functions/get_dx.js +13 -1
- package/build/dex/curve-v1-factory/price-handlers/functions/get_dx.js.map +1 -1
- package/build/dex/curve-v1-factory/state-polling-pools/custom-pool-polling.d.ts +2 -2
- package/build/dex/curve-v1-factory/state-polling-pools/custom-pool-polling.js +1 -1
- package/build/dex/curve-v1-factory/state-polling-pools/custom-pool-polling.js.map +1 -1
- package/build/dex/curve-v1-factory/state-polling-pools/factory-pool-polling.js +1 -1
- package/build/dex/curve-v1-factory/state-polling-pools/factory-pool-polling.js.map +1 -1
- package/build/dex/curve-v1-factory/state-polling-pools/pool-polling-base.d.ts +4 -3
- package/build/dex/curve-v1-factory/state-polling-pools/pool-polling-base.js +24 -9
- package/build/dex/curve-v1-factory/state-polling-pools/pool-polling-base.js.map +1 -1
- package/build/dex/curve-v1-factory/types.d.ts +20 -4
- package/build/dex/curve-v1-factory/types.js +11 -3
- package/build/dex/curve-v1-factory/types.js.map +1 -1
- package/build/dex/curve-v1-stable-ng/config.js +18 -0
- package/build/dex/curve-v1-stable-ng/config.js.map +1 -1
- package/build/dex/index.js +3 -3
- package/build/dex/index.js.map +1 -1
- package/build/generic-swap-transaction-builder.js +1 -3
- package/build/generic-swap-transaction-builder.js.map +1 -1
- package/build/router/simpleswap.js +1 -3
- package/build/router/simpleswap.js.map +1 -1
- package/build/utils.d.ts +1 -1
- package/package.json +2 -2
- package/src/abi/curve-v1-factory/CurveV1Router.abi.json +331 -0
- package/src/config.ts +1 -1
- package/src/dex/curve-v1-factory/config.ts +47 -10
- package/src/dex/curve-v1-factory/curve-v1-factory-e2e.test.ts +92 -16
- package/src/dex/curve-v1-factory/curve-v1-factory-integration.test.ts +125 -5
- package/src/dex/curve-v1-factory/curve-v1-factory.ts +137 -45
- package/src/dex/curve-v1-factory/optimizer.ts +61 -0
- package/src/dex/curve-v1-factory/price-handlers/functions/constants.ts +0 -2
- package/src/dex/curve-v1-factory/price-handlers/functions/get_dx.ts +24 -1
- package/src/dex/curve-v1-factory/state-polling-pools/custom-pool-polling.ts +3 -2
- package/src/dex/curve-v1-factory/state-polling-pools/factory-pool-polling.ts +1 -0
- package/src/dex/curve-v1-factory/state-polling-pools/pool-polling-base.ts +31 -10
- package/src/dex/curve-v1-factory/types.ts +22 -6
- package/src/dex/curve-v1-stable-ng/config.ts +18 -0
- package/src/dex/curve-v1-stable-ng/curve-v1-stable-ng-e2e.test.ts +17 -0
- package/src/dex/index.ts +3 -2
- package/src/generic-swap-transaction-builder.ts +1 -3
- package/src/router/simpleswap.ts +1 -3
- package/tests/constants-e2e.ts +1 -1
- package/tests/utils-e2e.ts +2 -0
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"name": "Exchange",
|
|
4
|
+
"inputs": [
|
|
5
|
+
{
|
|
6
|
+
"name": "sender",
|
|
7
|
+
"type": "address",
|
|
8
|
+
"indexed": true
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"name": "receiver",
|
|
12
|
+
"type": "address",
|
|
13
|
+
"indexed": true
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"name": "route",
|
|
17
|
+
"type": "address[11]",
|
|
18
|
+
"indexed": false
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"name": "swap_params",
|
|
22
|
+
"type": "uint256[5][5]",
|
|
23
|
+
"indexed": false
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"name": "pools",
|
|
27
|
+
"type": "address[5]",
|
|
28
|
+
"indexed": false
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"name": "in_amount",
|
|
32
|
+
"type": "uint256",
|
|
33
|
+
"indexed": false
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"name": "out_amount",
|
|
37
|
+
"type": "uint256",
|
|
38
|
+
"indexed": false
|
|
39
|
+
}
|
|
40
|
+
],
|
|
41
|
+
"anonymous": false,
|
|
42
|
+
"type": "event"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"stateMutability": "payable",
|
|
46
|
+
"type": "fallback"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"stateMutability": "nonpayable",
|
|
50
|
+
"type": "constructor",
|
|
51
|
+
"inputs": [
|
|
52
|
+
{
|
|
53
|
+
"name": "_weth",
|
|
54
|
+
"type": "address"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"name": "_stable_calc",
|
|
58
|
+
"type": "address"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"name": "_crypto_calc",
|
|
62
|
+
"type": "address"
|
|
63
|
+
}
|
|
64
|
+
],
|
|
65
|
+
"outputs": []
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"stateMutability": "payable",
|
|
69
|
+
"type": "function",
|
|
70
|
+
"name": "exchange",
|
|
71
|
+
"inputs": [
|
|
72
|
+
{
|
|
73
|
+
"name": "_route",
|
|
74
|
+
"type": "address[11]"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"name": "_swap_params",
|
|
78
|
+
"type": "uint256[5][5]"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"name": "_amount",
|
|
82
|
+
"type": "uint256"
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"name": "_min_dy",
|
|
86
|
+
"type": "uint256"
|
|
87
|
+
}
|
|
88
|
+
],
|
|
89
|
+
"outputs": [
|
|
90
|
+
{
|
|
91
|
+
"name": "",
|
|
92
|
+
"type": "uint256"
|
|
93
|
+
}
|
|
94
|
+
]
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
"stateMutability": "payable",
|
|
98
|
+
"type": "function",
|
|
99
|
+
"name": "exchange",
|
|
100
|
+
"inputs": [
|
|
101
|
+
{
|
|
102
|
+
"name": "_route",
|
|
103
|
+
"type": "address[11]"
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
"name": "_swap_params",
|
|
107
|
+
"type": "uint256[5][5]"
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
"name": "_amount",
|
|
111
|
+
"type": "uint256"
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
"name": "_min_dy",
|
|
115
|
+
"type": "uint256"
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
"name": "_pools",
|
|
119
|
+
"type": "address[5]"
|
|
120
|
+
}
|
|
121
|
+
],
|
|
122
|
+
"outputs": [
|
|
123
|
+
{
|
|
124
|
+
"name": "",
|
|
125
|
+
"type": "uint256"
|
|
126
|
+
}
|
|
127
|
+
]
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
"stateMutability": "payable",
|
|
131
|
+
"type": "function",
|
|
132
|
+
"name": "exchange",
|
|
133
|
+
"inputs": [
|
|
134
|
+
{
|
|
135
|
+
"name": "_route",
|
|
136
|
+
"type": "address[11]"
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
"name": "_swap_params",
|
|
140
|
+
"type": "uint256[5][5]"
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
"name": "_amount",
|
|
144
|
+
"type": "uint256"
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
"name": "_min_dy",
|
|
148
|
+
"type": "uint256"
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
"name": "_pools",
|
|
152
|
+
"type": "address[5]"
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
"name": "_receiver",
|
|
156
|
+
"type": "address"
|
|
157
|
+
}
|
|
158
|
+
],
|
|
159
|
+
"outputs": [
|
|
160
|
+
{
|
|
161
|
+
"name": "",
|
|
162
|
+
"type": "uint256"
|
|
163
|
+
}
|
|
164
|
+
]
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
"stateMutability": "view",
|
|
168
|
+
"type": "function",
|
|
169
|
+
"name": "get_dy",
|
|
170
|
+
"inputs": [
|
|
171
|
+
{
|
|
172
|
+
"name": "_route",
|
|
173
|
+
"type": "address[11]"
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
"name": "_swap_params",
|
|
177
|
+
"type": "uint256[5][5]"
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
"name": "_amount",
|
|
181
|
+
"type": "uint256"
|
|
182
|
+
}
|
|
183
|
+
],
|
|
184
|
+
"outputs": [
|
|
185
|
+
{
|
|
186
|
+
"name": "",
|
|
187
|
+
"type": "uint256"
|
|
188
|
+
}
|
|
189
|
+
]
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
"stateMutability": "view",
|
|
193
|
+
"type": "function",
|
|
194
|
+
"name": "get_dy",
|
|
195
|
+
"inputs": [
|
|
196
|
+
{
|
|
197
|
+
"name": "_route",
|
|
198
|
+
"type": "address[11]"
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
"name": "_swap_params",
|
|
202
|
+
"type": "uint256[5][5]"
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
"name": "_amount",
|
|
206
|
+
"type": "uint256"
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
"name": "_pools",
|
|
210
|
+
"type": "address[5]"
|
|
211
|
+
}
|
|
212
|
+
],
|
|
213
|
+
"outputs": [
|
|
214
|
+
{
|
|
215
|
+
"name": "",
|
|
216
|
+
"type": "uint256"
|
|
217
|
+
}
|
|
218
|
+
]
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
"stateMutability": "view",
|
|
222
|
+
"type": "function",
|
|
223
|
+
"name": "get_dx",
|
|
224
|
+
"inputs": [
|
|
225
|
+
{
|
|
226
|
+
"name": "_route",
|
|
227
|
+
"type": "address[11]"
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
"name": "_swap_params",
|
|
231
|
+
"type": "uint256[5][5]"
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
"name": "_out_amount",
|
|
235
|
+
"type": "uint256"
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
"name": "_pools",
|
|
239
|
+
"type": "address[5]"
|
|
240
|
+
}
|
|
241
|
+
],
|
|
242
|
+
"outputs": [
|
|
243
|
+
{
|
|
244
|
+
"name": "",
|
|
245
|
+
"type": "uint256"
|
|
246
|
+
}
|
|
247
|
+
]
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
"stateMutability": "view",
|
|
251
|
+
"type": "function",
|
|
252
|
+
"name": "get_dx",
|
|
253
|
+
"inputs": [
|
|
254
|
+
{
|
|
255
|
+
"name": "_route",
|
|
256
|
+
"type": "address[11]"
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
"name": "_swap_params",
|
|
260
|
+
"type": "uint256[5][5]"
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
"name": "_out_amount",
|
|
264
|
+
"type": "uint256"
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
"name": "_pools",
|
|
268
|
+
"type": "address[5]"
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
"name": "_base_pools",
|
|
272
|
+
"type": "address[5]"
|
|
273
|
+
}
|
|
274
|
+
],
|
|
275
|
+
"outputs": [
|
|
276
|
+
{
|
|
277
|
+
"name": "",
|
|
278
|
+
"type": "uint256"
|
|
279
|
+
}
|
|
280
|
+
]
|
|
281
|
+
},
|
|
282
|
+
{
|
|
283
|
+
"stateMutability": "view",
|
|
284
|
+
"type": "function",
|
|
285
|
+
"name": "get_dx",
|
|
286
|
+
"inputs": [
|
|
287
|
+
{
|
|
288
|
+
"name": "_route",
|
|
289
|
+
"type": "address[11]"
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
"name": "_swap_params",
|
|
293
|
+
"type": "uint256[5][5]"
|
|
294
|
+
},
|
|
295
|
+
{
|
|
296
|
+
"name": "_out_amount",
|
|
297
|
+
"type": "uint256"
|
|
298
|
+
},
|
|
299
|
+
{
|
|
300
|
+
"name": "_pools",
|
|
301
|
+
"type": "address[5]"
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
"name": "_base_pools",
|
|
305
|
+
"type": "address[5]"
|
|
306
|
+
},
|
|
307
|
+
{
|
|
308
|
+
"name": "_base_tokens",
|
|
309
|
+
"type": "address[5]"
|
|
310
|
+
}
|
|
311
|
+
],
|
|
312
|
+
"outputs": [
|
|
313
|
+
{
|
|
314
|
+
"name": "",
|
|
315
|
+
"type": "uint256"
|
|
316
|
+
}
|
|
317
|
+
]
|
|
318
|
+
},
|
|
319
|
+
{
|
|
320
|
+
"stateMutability": "view",
|
|
321
|
+
"type": "function",
|
|
322
|
+
"name": "version",
|
|
323
|
+
"inputs": [],
|
|
324
|
+
"outputs": [
|
|
325
|
+
{
|
|
326
|
+
"name": "",
|
|
327
|
+
"type": "string"
|
|
328
|
+
}
|
|
329
|
+
]
|
|
330
|
+
}
|
|
331
|
+
]
|
package/src/config.ts
CHANGED
|
@@ -228,7 +228,7 @@ const baseConfigs: { [network: number]: BaseConfig } = {
|
|
|
228
228
|
adapterAddresses: {
|
|
229
229
|
AvalancheAdapter01: '0x745Ec73855CeC7249E5fF4c9DD81cc65b4D297a9',
|
|
230
230
|
AvalancheAdapter02: '0xA10c9a84E72d9DfF424Fe2284B6460784bed407E',
|
|
231
|
-
AvalancheBuyAdapter: '
|
|
231
|
+
AvalancheBuyAdapter: '0xaB38a72de187Cd5d6D9bACD6D13D090E841EC330',
|
|
232
232
|
},
|
|
233
233
|
uniswapV2ExchangeRouterAddress:
|
|
234
234
|
'0x53e693c6C7FFC4446c53B205Cf513105Bf140D7b',
|
|
@@ -25,6 +25,7 @@ const CurveV1FactoryConfig: DexConfigMap<DexParams> = {
|
|
|
25
25
|
maxPlainCoins: FACTORY_MAX_PLAIN_COINS,
|
|
26
26
|
},
|
|
27
27
|
],
|
|
28
|
+
router: '0x16C6521Dff6baB339122a0FE25a9116693265353', // https://github.com/curvefi/curve-router-ng
|
|
28
29
|
stateUpdatePeriodMs: 5 * 1000,
|
|
29
30
|
disabledPools: new Set([
|
|
30
31
|
'0x28B0Cf1baFB707F2c6826d10caf6DD901a6540C5', // It is rug pool token
|
|
@@ -221,11 +222,8 @@ const CurveV1FactoryConfig: DexConfigMap<DexParams> = {
|
|
|
221
222
|
address: '0x722272D36ef0Da72FF51c5A65Db7b870E2e8D4ee',
|
|
222
223
|
maxPlainCoins: FACTORY_MAX_PLAIN_COINS,
|
|
223
224
|
},
|
|
224
|
-
{
|
|
225
|
-
address: '0x1764ee18e8B3ccA4787249Ceb249356192594585', // factory stable ng
|
|
226
|
-
isStableNg: true,
|
|
227
|
-
},
|
|
228
225
|
],
|
|
226
|
+
router: '0x0DCDED3545D565bA3B19E683431381007245d983', // https://github.com/curvefi/curve-router-ng
|
|
229
227
|
stateUpdatePeriodMs: 2 * 1000,
|
|
230
228
|
disabledPools: new Set([
|
|
231
229
|
'0x666Dc3b4baBfd063FaF965BD020024AF0dC51B64',
|
|
@@ -337,6 +335,7 @@ const CurveV1FactoryConfig: DexConfigMap<DexParams> = {
|
|
|
337
335
|
maxPlainCoins: FACTORY_MAX_PLAIN_COINS,
|
|
338
336
|
},
|
|
339
337
|
],
|
|
338
|
+
router: '0x0DCDED3545D565bA3B19E683431381007245d983', // https://github.com/curvefi/curve-router-ng
|
|
340
339
|
stateUpdatePeriodMs: 2 * 1000,
|
|
341
340
|
disabledPools: new Set([]),
|
|
342
341
|
disabledImplementations: new Set([]),
|
|
@@ -457,6 +456,7 @@ const CurveV1FactoryConfig: DexConfigMap<DexParams> = {
|
|
|
457
456
|
maxPlainCoins: FACTORY_MAX_PLAIN_COINS,
|
|
458
457
|
},
|
|
459
458
|
],
|
|
459
|
+
router: '0x0DCDED3545D565bA3B19E683431381007245d983', // https://github.com/curvefi/curve-router-ng
|
|
460
460
|
stateUpdatePeriodMs: 2 * 1000,
|
|
461
461
|
// FIX: This must be removed when we go for full CurveV1 event based support
|
|
462
462
|
disabledPools: new Set(['0x16a7da911a4dd1d83f3ff066fe28f3c792c50d90']),
|
|
@@ -543,6 +543,7 @@ const CurveV1FactoryConfig: DexConfigMap<DexParams> = {
|
|
|
543
543
|
maxPlainCoins: FACTORY_MAX_PLAIN_COINS,
|
|
544
544
|
},
|
|
545
545
|
],
|
|
546
|
+
router: '0x2191718CD32d02B8E60BAdFFeA33E4B5DD9A0A0D', // https://github.com/curvefi/curve-router-ng
|
|
546
547
|
stateUpdatePeriodMs: 2 * 1000,
|
|
547
548
|
disabledPools: new Set([]),
|
|
548
549
|
disabledImplementations: new Set([]),
|
|
@@ -674,6 +675,7 @@ const CurveV1FactoryConfig: DexConfigMap<DexParams> = {
|
|
|
674
675
|
maxPlainCoins: FACTORY_MAX_PLAIN_COINS,
|
|
675
676
|
},
|
|
676
677
|
],
|
|
678
|
+
router: '0x0DCDED3545D565bA3B19E683431381007245d983', // https://github.com/curvefi/curve-router-ng
|
|
677
679
|
stateUpdatePeriodMs: 2 * 1000,
|
|
678
680
|
disabledPools: new Set([]),
|
|
679
681
|
disabledImplementations: new Set([]),
|
|
@@ -786,6 +788,7 @@ const CurveV1FactoryConfig: DexConfigMap<DexParams> = {
|
|
|
786
788
|
maxPlainCoins: FACTORY_MAX_PLAIN_COINS,
|
|
787
789
|
},
|
|
788
790
|
],
|
|
791
|
+
router: '0x4f37A9d177470499A2dD084621020b023fcffc1F', // https://github.com/curvefi/curve-router-ng
|
|
789
792
|
stateUpdatePeriodMs: 2 * 1000,
|
|
790
793
|
disabledPools: new Set([]),
|
|
791
794
|
disabledImplementations: new Set([]),
|
|
@@ -824,13 +827,10 @@ export const Adapters: Record<number, AdapterMappings> = {
|
|
|
824
827
|
index: 3,
|
|
825
828
|
},
|
|
826
829
|
],
|
|
827
|
-
|
|
828
|
-
[Network.BSC]: {
|
|
829
|
-
[SwapSide.SELL]: [
|
|
830
|
-
// use for beltfi (deprecated)
|
|
830
|
+
[SwapSide.BUY]: [
|
|
831
831
|
{
|
|
832
|
-
name: '
|
|
833
|
-
index:
|
|
832
|
+
name: 'BuyAdapter02',
|
|
833
|
+
index: 5,
|
|
834
834
|
},
|
|
835
835
|
],
|
|
836
836
|
},
|
|
@@ -841,6 +841,12 @@ export const Adapters: Record<number, AdapterMappings> = {
|
|
|
841
841
|
index: 3,
|
|
842
842
|
},
|
|
843
843
|
],
|
|
844
|
+
[SwapSide.BUY]: [
|
|
845
|
+
{
|
|
846
|
+
name: 'PolygonBuyAdapter',
|
|
847
|
+
index: 10,
|
|
848
|
+
},
|
|
849
|
+
],
|
|
844
850
|
},
|
|
845
851
|
[Network.AVALANCHE]: {
|
|
846
852
|
[SwapSide.SELL]: [
|
|
@@ -849,6 +855,12 @@ export const Adapters: Record<number, AdapterMappings> = {
|
|
|
849
855
|
index: 5,
|
|
850
856
|
},
|
|
851
857
|
],
|
|
858
|
+
[SwapSide.BUY]: [
|
|
859
|
+
{
|
|
860
|
+
name: 'AvalancheBuyAdapter',
|
|
861
|
+
index: 9,
|
|
862
|
+
},
|
|
863
|
+
],
|
|
852
864
|
},
|
|
853
865
|
[Network.FANTOM]: {
|
|
854
866
|
[SwapSide.SELL]: [
|
|
@@ -857,6 +869,12 @@ export const Adapters: Record<number, AdapterMappings> = {
|
|
|
857
869
|
index: 3,
|
|
858
870
|
},
|
|
859
871
|
],
|
|
872
|
+
[SwapSide.BUY]: [
|
|
873
|
+
{
|
|
874
|
+
name: 'FantomBuyAdapter',
|
|
875
|
+
index: 6,
|
|
876
|
+
},
|
|
877
|
+
],
|
|
860
878
|
},
|
|
861
879
|
[Network.ARBITRUM]: {
|
|
862
880
|
[SwapSide.SELL]: [
|
|
@@ -865,6 +883,12 @@ export const Adapters: Record<number, AdapterMappings> = {
|
|
|
865
883
|
index: 6,
|
|
866
884
|
},
|
|
867
885
|
],
|
|
886
|
+
[SwapSide.BUY]: [
|
|
887
|
+
{
|
|
888
|
+
name: 'ArbitrumBuyAdapter',
|
|
889
|
+
index: 12,
|
|
890
|
+
},
|
|
891
|
+
],
|
|
868
892
|
},
|
|
869
893
|
[Network.OPTIMISM]: {
|
|
870
894
|
[SwapSide.SELL]: [
|
|
@@ -873,6 +897,12 @@ export const Adapters: Record<number, AdapterMappings> = {
|
|
|
873
897
|
index: 5,
|
|
874
898
|
},
|
|
875
899
|
],
|
|
900
|
+
[SwapSide.BUY]: [
|
|
901
|
+
{
|
|
902
|
+
name: 'OptimismBuyAdapter',
|
|
903
|
+
index: 8,
|
|
904
|
+
},
|
|
905
|
+
],
|
|
876
906
|
},
|
|
877
907
|
[Network.BASE]: {
|
|
878
908
|
[SwapSide.SELL]: [
|
|
@@ -881,6 +911,12 @@ export const Adapters: Record<number, AdapterMappings> = {
|
|
|
881
911
|
index: 3,
|
|
882
912
|
},
|
|
883
913
|
],
|
|
914
|
+
[SwapSide.BUY]: [
|
|
915
|
+
{
|
|
916
|
+
name: 'BaseBuyAdapter',
|
|
917
|
+
index: 9,
|
|
918
|
+
},
|
|
919
|
+
],
|
|
884
920
|
},
|
|
885
921
|
};
|
|
886
922
|
|
|
@@ -946,6 +982,7 @@ export const configAddressesNormalizer = (
|
|
|
946
982
|
address: e.address.toLowerCase(),
|
|
947
983
|
}))
|
|
948
984
|
: _config.factories,
|
|
985
|
+
router: _config.router,
|
|
949
986
|
stateUpdatePeriodMs: _config.stateUpdatePeriodMs,
|
|
950
987
|
factoryPoolImplementations,
|
|
951
988
|
customPools,
|
|
@@ -10,13 +10,14 @@ dotenv.config();
|
|
|
10
10
|
|
|
11
11
|
export function testForNetwork(
|
|
12
12
|
network: Network,
|
|
13
|
-
dexKey: string,
|
|
13
|
+
dexKey: string | string[],
|
|
14
14
|
tokenASymbol: string,
|
|
15
15
|
tokenBSymbol: string,
|
|
16
16
|
tokenAAmount: string,
|
|
17
17
|
tokenBAmount: string,
|
|
18
18
|
sideToContractMethods: Map<SwapSide, ContractMethod[]> = new Map([
|
|
19
19
|
[SwapSide.SELL, [ContractMethod.swapExactAmountIn]],
|
|
20
|
+
[SwapSide.BUY, [ContractMethod.swapExactAmountOut]],
|
|
20
21
|
]),
|
|
21
22
|
) {
|
|
22
23
|
const provider = new StaticJsonRpcProvider(
|
|
@@ -26,8 +27,6 @@ export function testForNetwork(
|
|
|
26
27
|
const tokens = Tokens[network];
|
|
27
28
|
const holders = Holders[network];
|
|
28
29
|
|
|
29
|
-
// const sideToContractMethods = ;
|
|
30
|
-
|
|
31
30
|
describe(`${network}`, () => {
|
|
32
31
|
sideToContractMethods.forEach((contractMethods, side) =>
|
|
33
32
|
describe(`${side}`, () => {
|
|
@@ -62,6 +61,11 @@ export function testForNetwork(
|
|
|
62
61
|
contractMethod,
|
|
63
62
|
network,
|
|
64
63
|
provider,
|
|
64
|
+
undefined,
|
|
65
|
+
undefined,
|
|
66
|
+
undefined,
|
|
67
|
+
undefined,
|
|
68
|
+
5000,
|
|
65
69
|
);
|
|
66
70
|
});
|
|
67
71
|
});
|
|
@@ -72,25 +76,78 @@ export function testForNetwork(
|
|
|
72
76
|
}
|
|
73
77
|
|
|
74
78
|
describe('CurveV1Factory E2E', () => {
|
|
75
|
-
const dexKey = 'CurveV1Factory';
|
|
79
|
+
const dexKey = ['CurveV1Factory', 'CurveV1StableNg'];
|
|
76
80
|
|
|
77
81
|
describe('Mainnet', () => {
|
|
78
82
|
const network = Network.MAINNET;
|
|
79
83
|
|
|
80
|
-
|
|
81
|
-
|
|
84
|
+
describe('USDT -> USDD', () => {
|
|
85
|
+
const tokenASymbol: string = 'USDT';
|
|
86
|
+
const tokenBSymbol: string = 'USDD';
|
|
82
87
|
|
|
83
|
-
|
|
84
|
-
|
|
88
|
+
const tokenAAmount: string = '100000000';
|
|
89
|
+
const tokenBAmount: string = '111000000000000000000';
|
|
85
90
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
91
|
+
testForNetwork(
|
|
92
|
+
network,
|
|
93
|
+
dexKey,
|
|
94
|
+
tokenASymbol,
|
|
95
|
+
tokenBSymbol,
|
|
96
|
+
tokenAAmount,
|
|
97
|
+
tokenBAmount,
|
|
98
|
+
);
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
describe('GHO -> USDC', () => {
|
|
102
|
+
const tokenASymbol: string = 'GHO';
|
|
103
|
+
const tokenBSymbol: string = 'USDC';
|
|
104
|
+
|
|
105
|
+
const tokenAAmount: string = '1000000000000000000';
|
|
106
|
+
const tokenBAmount: string = '100000000';
|
|
107
|
+
|
|
108
|
+
testForNetwork(
|
|
109
|
+
network,
|
|
110
|
+
dexKey,
|
|
111
|
+
tokenASymbol,
|
|
112
|
+
tokenBSymbol,
|
|
113
|
+
tokenAAmount,
|
|
114
|
+
tokenBAmount,
|
|
115
|
+
);
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
describe('GHO -> crvUSD', () => {
|
|
119
|
+
const tokenASymbol: string = 'GHO';
|
|
120
|
+
const tokenBSymbol: string = 'crvUSD';
|
|
121
|
+
|
|
122
|
+
const tokenAAmount: string = '1000000000000000000';
|
|
123
|
+
const tokenBAmount: string = '1000000000000000000';
|
|
124
|
+
|
|
125
|
+
testForNetwork(
|
|
126
|
+
network,
|
|
127
|
+
dexKey,
|
|
128
|
+
tokenASymbol,
|
|
129
|
+
tokenBSymbol,
|
|
130
|
+
tokenAAmount,
|
|
131
|
+
tokenBAmount,
|
|
132
|
+
);
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
describe('GHO -> USDT', () => {
|
|
136
|
+
const tokenASymbol: string = 'GHO';
|
|
137
|
+
const tokenBSymbol: string = 'USDT';
|
|
138
|
+
|
|
139
|
+
const tokenAAmount: string = '10000000000000000000';
|
|
140
|
+
const tokenBAmount: string = '1000000';
|
|
141
|
+
|
|
142
|
+
testForNetwork(
|
|
143
|
+
network,
|
|
144
|
+
dexKey,
|
|
145
|
+
tokenASymbol,
|
|
146
|
+
tokenBSymbol,
|
|
147
|
+
tokenAAmount,
|
|
148
|
+
tokenBAmount,
|
|
149
|
+
);
|
|
150
|
+
});
|
|
94
151
|
});
|
|
95
152
|
describe('Mainnet Native', () => {
|
|
96
153
|
const network = Network.MAINNET;
|
|
@@ -322,6 +379,7 @@ describe('CurveV1Factory E2E', () => {
|
|
|
322
379
|
SwapSide.SELL,
|
|
323
380
|
[ContractMethod.swapExactAmountIn, ContractMethod.directCurveV1Swap],
|
|
324
381
|
],
|
|
382
|
+
[SwapSide.BUY, [ContractMethod.swapExactAmountOut]],
|
|
325
383
|
// [
|
|
326
384
|
// SwapSide.SELL,
|
|
327
385
|
// [
|
|
@@ -349,5 +407,23 @@ describe('CurveV1Factory E2E', () => {
|
|
|
349
407
|
sideToContractMethods,
|
|
350
408
|
);
|
|
351
409
|
});
|
|
410
|
+
|
|
411
|
+
describe('USDM -> crvUSD', () => {
|
|
412
|
+
const tokenASymbol: string = 'USDM';
|
|
413
|
+
const tokenBSymbol: string = 'crvUSD';
|
|
414
|
+
|
|
415
|
+
const tokenAAmount: string = '1000000000000000000';
|
|
416
|
+
const tokenBAmount: string = '1000000000000000000';
|
|
417
|
+
|
|
418
|
+
testForNetwork(
|
|
419
|
+
network,
|
|
420
|
+
dexKey,
|
|
421
|
+
tokenASymbol,
|
|
422
|
+
tokenBSymbol,
|
|
423
|
+
tokenAAmount,
|
|
424
|
+
tokenBAmount,
|
|
425
|
+
sideToContractMethods,
|
|
426
|
+
);
|
|
427
|
+
});
|
|
352
428
|
});
|
|
353
429
|
});
|