@paraswap/dex-lib 2.14.0 → 2.14.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.
Files changed (64) hide show
  1. package/build/config.js +23 -5
  2. package/build/config.js.map +1 -1
  3. package/build/dex/index.js +2 -2
  4. package/build/dex/index.js.map +1 -1
  5. package/build/dex/simple-exchange.d.ts +1 -0
  6. package/build/dex/simple-exchange.js +2 -0
  7. package/build/dex/simple-exchange.js.map +1 -1
  8. package/build/lib/decoders.d.ts +2 -1
  9. package/build/lib/decoders.js +8 -1
  10. package/build/lib/decoders.js.map +1 -1
  11. package/build/lib/multi-wrapper.d.ts +2 -1
  12. package/build/lib/multi-wrapper.js.map +1 -1
  13. package/build/lib/tokens/balancer-fetcher.js +4 -5
  14. package/build/lib/tokens/balancer-fetcher.js.map +1 -1
  15. package/build/lib/tokens/utils.d.ts +2 -2
  16. package/build/lib/tokens/utils.js +1 -1
  17. package/build/lib/tokens/utils.js.map +1 -1
  18. package/build/types.d.ts +3 -0
  19. package/dex-template/__DexName__-e2e.test.ts.template +1 -0
  20. package/dex-template/__DexName__-events.test.ts.template +1 -0
  21. package/dex-template/__DexName__-integration.test.ts.template +1 -0
  22. package/dex-template/__DexName__-pool.ts.template +8 -5
  23. package/package.json +1 -1
  24. package/scripts/generate-bytecode.ts +2 -0
  25. package/src/abi/woo-fi-v2/IntegrationHelper.abi.json +116 -0
  26. package/src/abi/{woo-fi/Wooracle.abi.json → woo-fi-v2/WooOracleV2.abi.json} +148 -50
  27. package/src/abi/{woo-fi/WooPP.abi.json → woo-fi-v2/WooPPV2.abi.json} +201 -169
  28. package/src/config.ts +27 -5
  29. package/src/dex/balancer-v2/balancer-v2-e2e.test.ts +0 -1
  30. package/src/dex/index.ts +2 -2
  31. package/src/dex/simple-exchange.ts +3 -0
  32. package/src/dex/woo-fi-v2/config.ts +87 -0
  33. package/src/dex/woo-fi-v2/constants.ts +22 -0
  34. package/src/dex/woo-fi-v2/decoders.ts +45 -0
  35. package/src/dex/woo-fi-v2/types.ts +63 -0
  36. package/src/dex/woo-fi-v2/utils.ts +19 -0
  37. package/src/dex/woo-fi-v2/woo-fi-v2-e2e.test.ts +216 -0
  38. package/src/dex/woo-fi-v2/woo-fi-v2-integration.test.ts +495 -0
  39. package/src/dex/woo-fi-v2/woo-fi-v2-math.ts +195 -0
  40. package/src/dex/woo-fi-v2/woo-fi-v2-pool.ts +112 -0
  41. package/src/dex/woo-fi-v2/woo-fi-v2.ts +487 -0
  42. package/src/lib/decoders.ts +12 -1
  43. package/src/lib/log-messages-suppressor.ts +173 -0
  44. package/src/lib/multi-wrapper.ts +2 -1
  45. package/src/lib/stateful-rpc-poller/state-polling-manager.ts +320 -0
  46. package/src/lib/stateful-rpc-poller/stateful-rpc-poller.ts +604 -0
  47. package/src/lib/stateful-rpc-poller/types.ts +66 -0
  48. package/src/lib/stateful-rpc-poller/utils.ts +23 -0
  49. package/src/lib/tokens/balancer-fetcher.ts +5 -6
  50. package/src/lib/tokens/utils.ts +5 -3
  51. package/src/types.ts +4 -0
  52. package/tests/constants-e2e.ts +8 -3
  53. package/tests/tenderly-simulation.ts +1 -1
  54. package/tests/utils-e2e.ts +2 -0
  55. package/tests/utils.ts +2 -0
  56. package/src/abi/woo-fi/WooFeeManager.abi.json +0 -318
  57. package/src/dex/woo-fi/config.ts +0 -141
  58. package/src/dex/woo-fi/constants.ts +0 -21
  59. package/src/dex/woo-fi/types.ts +0 -55
  60. package/src/dex/woo-fi/woo-fi-decimal-math.ts +0 -45
  61. package/src/dex/woo-fi/woo-fi-e2e.test.ts +0 -183
  62. package/src/dex/woo-fi/woo-fi-integration.test.ts +0 -416
  63. package/src/dex/woo-fi/woo-fi-math.ts +0 -527
  64. package/src/dex/woo-fi/woo-fi.ts +0 -693
@@ -0,0 +1,116 @@
1
+ [
2
+ {
3
+ "inputs": [
4
+ { "internalType": "address", "name": "_quoteToken", "type": "address" },
5
+ {
6
+ "internalType": "address[]",
7
+ "name": "_baseTokens",
8
+ "type": "address[]"
9
+ }
10
+ ],
11
+ "stateMutability": "nonpayable",
12
+ "type": "constructor"
13
+ },
14
+ {
15
+ "anonymous": false,
16
+ "inputs": [
17
+ {
18
+ "indexed": true,
19
+ "internalType": "address",
20
+ "name": "previousOwner",
21
+ "type": "address"
22
+ },
23
+ {
24
+ "indexed": true,
25
+ "internalType": "address",
26
+ "name": "newOwner",
27
+ "type": "address"
28
+ }
29
+ ],
30
+ "name": "OwnershipTransferred",
31
+ "type": "event"
32
+ },
33
+ {
34
+ "inputs": [
35
+ { "internalType": "address", "name": "token", "type": "address" }
36
+ ],
37
+ "name": "addBaseToken",
38
+ "outputs": [],
39
+ "stateMutability": "nonpayable",
40
+ "type": "function"
41
+ },
42
+ {
43
+ "inputs": [],
44
+ "name": "allBaseTokens",
45
+ "outputs": [
46
+ { "internalType": "address[]", "name": "", "type": "address[]" }
47
+ ],
48
+ "stateMutability": "view",
49
+ "type": "function"
50
+ },
51
+ {
52
+ "inputs": [],
53
+ "name": "allBaseTokensLength",
54
+ "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
55
+ "stateMutability": "view",
56
+ "type": "function"
57
+ },
58
+ {
59
+ "inputs": [],
60
+ "name": "getSupportTokens",
61
+ "outputs": [
62
+ { "internalType": "address", "name": "", "type": "address" },
63
+ { "internalType": "address[]", "name": "", "type": "address[]" }
64
+ ],
65
+ "stateMutability": "view",
66
+ "type": "function"
67
+ },
68
+ {
69
+ "inputs": [],
70
+ "name": "owner",
71
+ "outputs": [{ "internalType": "address", "name": "", "type": "address" }],
72
+ "stateMutability": "view",
73
+ "type": "function"
74
+ },
75
+ {
76
+ "inputs": [],
77
+ "name": "quoteToken",
78
+ "outputs": [{ "internalType": "address", "name": "", "type": "address" }],
79
+ "stateMutability": "view",
80
+ "type": "function"
81
+ },
82
+ {
83
+ "inputs": [
84
+ { "internalType": "address", "name": "token", "type": "address" }
85
+ ],
86
+ "name": "removeBaseToken",
87
+ "outputs": [],
88
+ "stateMutability": "nonpayable",
89
+ "type": "function"
90
+ },
91
+ {
92
+ "inputs": [],
93
+ "name": "renounceOwnership",
94
+ "outputs": [],
95
+ "stateMutability": "nonpayable",
96
+ "type": "function"
97
+ },
98
+ {
99
+ "inputs": [
100
+ { "internalType": "address", "name": "_quoteToken", "type": "address" }
101
+ ],
102
+ "name": "setQutoeToken",
103
+ "outputs": [],
104
+ "stateMutability": "nonpayable",
105
+ "type": "function"
106
+ },
107
+ {
108
+ "inputs": [
109
+ { "internalType": "address", "name": "newOwner", "type": "address" }
110
+ ],
111
+ "name": "transferOwnership",
112
+ "outputs": [],
113
+ "stateMutability": "nonpayable",
114
+ "type": "function"
115
+ }
116
+ ]
@@ -1,24 +1,5 @@
1
1
  [
2
2
  { "inputs": [], "stateMutability": "nonpayable", "type": "constructor" },
3
- {
4
- "anonymous": false,
5
- "inputs": [
6
- {
7
- "indexed": true,
8
- "internalType": "address",
9
- "name": "previousOwner",
10
- "type": "address"
11
- },
12
- {
13
- "indexed": true,
14
- "internalType": "address",
15
- "name": "newOwner",
16
- "type": "address"
17
- }
18
- ],
19
- "name": "OwnershipTransferPrepared",
20
- "type": "event"
21
- },
22
3
  {
23
4
  "anonymous": false,
24
5
  "inputs": [
@@ -40,31 +21,30 @@
40
21
  },
41
22
  {
42
23
  "inputs": [],
43
- "name": "_NEW_OWNER_",
44
- "outputs": [{ "internalType": "address", "name": "", "type": "address" }],
24
+ "name": "bound",
25
+ "outputs": [{ "internalType": "uint64", "name": "", "type": "uint64" }],
45
26
  "stateMutability": "view",
46
27
  "type": "function"
47
28
  },
48
29
  {
49
- "inputs": [],
50
- "name": "_OWNER_",
51
- "outputs": [{ "internalType": "address", "name": "", "type": "address" }],
30
+ "inputs": [{ "internalType": "address", "name": "", "type": "address" }],
31
+ "name": "clOracles",
32
+ "outputs": [
33
+ { "internalType": "address", "name": "oracle", "type": "address" },
34
+ { "internalType": "uint8", "name": "decimal", "type": "uint8" },
35
+ { "internalType": "bool", "name": "cloPreferred", "type": "bool" }
36
+ ],
52
37
  "stateMutability": "view",
53
38
  "type": "function"
54
39
  },
55
- {
56
- "inputs": [],
57
- "name": "claimOwnership",
58
- "outputs": [],
59
- "stateMutability": "nonpayable",
60
- "type": "function"
61
- },
62
40
  {
63
41
  "inputs": [
64
42
  { "internalType": "address", "name": "base", "type": "address" }
65
43
  ],
66
- "name": "getCoeff",
67
- "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
44
+ "name": "cloAddress",
45
+ "outputs": [
46
+ { "internalType": "address", "name": "clo", "type": "address" }
47
+ ],
68
48
  "stateMutability": "view",
69
49
  "type": "function"
70
50
  },
@@ -72,8 +52,11 @@
72
52
  "inputs": [
73
53
  { "internalType": "address", "name": "base", "type": "address" }
74
54
  ],
75
- "name": "getPrice",
76
- "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
55
+ "name": "cloPrice",
56
+ "outputs": [
57
+ { "internalType": "uint256", "name": "", "type": "uint256" },
58
+ { "internalType": "uint256", "name": "", "type": "uint256" }
59
+ ],
77
60
  "stateMutability": "view",
78
61
  "type": "function"
79
62
  },
@@ -81,8 +64,8 @@
81
64
  "inputs": [
82
65
  { "internalType": "address", "name": "base", "type": "address" }
83
66
  ],
84
- "name": "getSpread",
85
- "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
67
+ "name": "decimals",
68
+ "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }],
86
69
  "stateMutability": "view",
87
70
  "type": "function"
88
71
  },
@@ -98,23 +81,28 @@
98
81
  "type": "function"
99
82
  },
100
83
  {
101
- "inputs": [
102
- { "internalType": "address", "name": "newOwner", "type": "address" }
103
- ],
104
- "name": "initOwner",
105
- "outputs": [],
106
- "stateMutability": "nonpayable",
84
+ "inputs": [{ "internalType": "address", "name": "", "type": "address" }],
85
+ "name": "isAdmin",
86
+ "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
87
+ "stateMutability": "view",
107
88
  "type": "function"
108
89
  },
109
90
  {
110
91
  "inputs": [
111
92
  { "internalType": "address", "name": "base", "type": "address" }
112
93
  ],
113
- "name": "isFeasible",
94
+ "name": "isWoFeasible",
114
95
  "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
115
96
  "stateMutability": "view",
116
97
  "type": "function"
117
98
  },
99
+ {
100
+ "inputs": [],
101
+ "name": "owner",
102
+ "outputs": [{ "internalType": "address", "name": "", "type": "address" }],
103
+ "stateMutability": "view",
104
+ "type": "function"
105
+ },
118
106
  {
119
107
  "inputs": [
120
108
  { "internalType": "address", "name": "base", "type": "address" },
@@ -185,7 +173,7 @@
185
173
  ],
186
174
  "name": "price",
187
175
  "outputs": [
188
- { "internalType": "uint256", "name": "priceNow", "type": "uint256" },
176
+ { "internalType": "uint256", "name": "priceOut", "type": "uint256" },
189
177
  { "internalType": "bool", "name": "feasible", "type": "bool" }
190
178
  ],
191
179
  "stateMutability": "view",
@@ -198,9 +186,57 @@
198
186
  "stateMutability": "view",
199
187
  "type": "function"
200
188
  },
189
+ {
190
+ "inputs": [],
191
+ "name": "renounceOwnership",
192
+ "outputs": [],
193
+ "stateMutability": "nonpayable",
194
+ "type": "function"
195
+ },
196
+ {
197
+ "inputs": [
198
+ { "internalType": "address", "name": "addr", "type": "address" },
199
+ { "internalType": "bool", "name": "flag", "type": "bool" }
200
+ ],
201
+ "name": "setAdmin",
202
+ "outputs": [],
203
+ "stateMutability": "nonpayable",
204
+ "type": "function"
205
+ },
206
+ {
207
+ "inputs": [
208
+ { "internalType": "uint64", "name": "_bound", "type": "uint64" }
209
+ ],
210
+ "name": "setBound",
211
+ "outputs": [],
212
+ "stateMutability": "nonpayable",
213
+ "type": "function"
214
+ },
215
+ {
216
+ "inputs": [
217
+ { "internalType": "address", "name": "token", "type": "address" },
218
+ { "internalType": "address", "name": "_oracle", "type": "address" },
219
+ { "internalType": "bool", "name": "_cloPreferred", "type": "bool" }
220
+ ],
221
+ "name": "setCLOracle",
222
+ "outputs": [],
223
+ "stateMutability": "nonpayable",
224
+ "type": "function"
225
+ },
226
+ {
227
+ "inputs": [
228
+ { "internalType": "address", "name": "token", "type": "address" },
229
+ { "internalType": "bool", "name": "_cloPreferred", "type": "bool" }
230
+ ],
231
+ "name": "setCloPreferred",
232
+ "outputs": [],
233
+ "stateMutability": "nonpayable",
234
+ "type": "function"
235
+ },
201
236
  {
202
237
  "inputs": [
203
- { "internalType": "address", "name": "newQuoteToken", "type": "address" }
238
+ { "internalType": "address", "name": "_quote", "type": "address" },
239
+ { "internalType": "address", "name": "_oracle", "type": "address" }
204
240
  ],
205
241
  "name": "setQuoteToken",
206
242
  "outputs": [],
@@ -233,10 +269,17 @@
233
269
  ],
234
270
  "name": "state",
235
271
  "outputs": [
236
- { "internalType": "uint256", "name": "priceNow", "type": "uint256" },
237
- { "internalType": "uint256", "name": "spreadNow", "type": "uint256" },
238
- { "internalType": "uint256", "name": "coeffNow", "type": "uint256" },
239
- { "internalType": "bool", "name": "feasible", "type": "bool" }
272
+ {
273
+ "components": [
274
+ { "internalType": "uint128", "name": "price", "type": "uint128" },
275
+ { "internalType": "uint64", "name": "spread", "type": "uint64" },
276
+ { "internalType": "uint64", "name": "coeff", "type": "uint64" },
277
+ { "internalType": "bool", "name": "woFeasible", "type": "bool" }
278
+ ],
279
+ "internalType": "struct IWooracleV2.State",
280
+ "name": "",
281
+ "type": "tuple"
282
+ }
240
283
  ],
241
284
  "stateMutability": "view",
242
285
  "type": "function"
@@ -256,5 +299,60 @@
256
299
  "outputs": [],
257
300
  "stateMutability": "nonpayable",
258
301
  "type": "function"
302
+ },
303
+ {
304
+ "inputs": [
305
+ { "internalType": "address", "name": "base", "type": "address" }
306
+ ],
307
+ "name": "woCoeff",
308
+ "outputs": [{ "internalType": "uint64", "name": "", "type": "uint64" }],
309
+ "stateMutability": "view",
310
+ "type": "function"
311
+ },
312
+ {
313
+ "inputs": [
314
+ { "internalType": "address", "name": "base", "type": "address" }
315
+ ],
316
+ "name": "woPrice",
317
+ "outputs": [
318
+ { "internalType": "uint128", "name": "priceOut", "type": "uint128" },
319
+ {
320
+ "internalType": "uint256",
321
+ "name": "priceTimestampOut",
322
+ "type": "uint256"
323
+ }
324
+ ],
325
+ "stateMutability": "view",
326
+ "type": "function"
327
+ },
328
+ {
329
+ "inputs": [
330
+ { "internalType": "address", "name": "base", "type": "address" }
331
+ ],
332
+ "name": "woSpread",
333
+ "outputs": [{ "internalType": "uint64", "name": "", "type": "uint64" }],
334
+ "stateMutability": "view",
335
+ "type": "function"
336
+ },
337
+ {
338
+ "inputs": [
339
+ { "internalType": "address", "name": "base", "type": "address" }
340
+ ],
341
+ "name": "woState",
342
+ "outputs": [
343
+ {
344
+ "components": [
345
+ { "internalType": "uint128", "name": "price", "type": "uint128" },
346
+ { "internalType": "uint64", "name": "spread", "type": "uint64" },
347
+ { "internalType": "uint64", "name": "coeff", "type": "uint64" },
348
+ { "internalType": "bool", "name": "woFeasible", "type": "bool" }
349
+ ],
350
+ "internalType": "struct IWooracleV2.State",
351
+ "name": "",
352
+ "type": "tuple"
353
+ }
354
+ ],
355
+ "stateMutability": "view",
356
+ "type": "function"
259
357
  }
260
358
  ]