@orbs-network/twap 1.4.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.
Files changed (45) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +174 -0
  3. package/dist/artifacts/contracts/TWAP.sol/TWAP.json +849 -0
  4. package/dist/artifacts/contracts/periphery/Lens.sol/Lens.json +488 -0
  5. package/dist/src/configs.d.ts +20 -0
  6. package/dist/src/configs.js +64 -0
  7. package/dist/src/index.d.ts +3 -0
  8. package/dist/src/index.js +19 -0
  9. package/dist/src/lib.d.ts +130 -0
  10. package/dist/src/lib.js +194 -0
  11. package/dist/src/paraswap.d.ts +33 -0
  12. package/dist/src/paraswap.js +73 -0
  13. package/dist/typechain-hardhat/contracts/IExchange.d.ts +23 -0
  14. package/dist/typechain-hardhat/contracts/IExchange.js +5 -0
  15. package/dist/typechain-hardhat/contracts/TWAP.d.ts +204 -0
  16. package/dist/typechain-hardhat/contracts/TWAP.js +5 -0
  17. package/dist/typechain-hardhat/contracts/exchange/IParaswap.d.ts +20 -0
  18. package/dist/typechain-hardhat/contracts/exchange/IParaswap.js +5 -0
  19. package/dist/typechain-hardhat/contracts/exchange/IUniswapV2.d.ts +24 -0
  20. package/dist/typechain-hardhat/contracts/exchange/IUniswapV2.js +5 -0
  21. package/dist/typechain-hardhat/contracts/exchange/ParaswapExchange.d.ts +24 -0
  22. package/dist/typechain-hardhat/contracts/exchange/ParaswapExchange.js +5 -0
  23. package/dist/typechain-hardhat/contracts/exchange/UniswapV2Exchange.d.ts +24 -0
  24. package/dist/typechain-hardhat/contracts/exchange/UniswapV2Exchange.js +5 -0
  25. package/dist/typechain-hardhat/contracts/exchange/index.d.ts +4 -0
  26. package/dist/typechain-hardhat/contracts/exchange/index.js +2 -0
  27. package/dist/typechain-hardhat/contracts/index.d.ts +8 -0
  28. package/dist/typechain-hardhat/contracts/index.js +2 -0
  29. package/dist/typechain-hardhat/contracts/periphery/IWETH.d.ts +22 -0
  30. package/dist/typechain-hardhat/contracts/periphery/IWETH.js +5 -0
  31. package/dist/typechain-hardhat/contracts/periphery/Lens.d.ts +104 -0
  32. package/dist/typechain-hardhat/contracts/periphery/Lens.js +5 -0
  33. package/dist/typechain-hardhat/contracts/periphery/Taker.d.ts +39 -0
  34. package/dist/typechain-hardhat/contracts/periphery/Taker.js +5 -0
  35. package/dist/typechain-hardhat/contracts/periphery/index.d.ts +3 -0
  36. package/dist/typechain-hardhat/contracts/periphery/index.js +2 -0
  37. package/dist/typechain-hardhat/contracts/test/MockDeflationaryToken.d.ts +56 -0
  38. package/dist/typechain-hardhat/contracts/test/MockDeflationaryToken.js +5 -0
  39. package/dist/typechain-hardhat/contracts/test/MockExchange.d.ts +25 -0
  40. package/dist/typechain-hardhat/contracts/test/MockExchange.js +5 -0
  41. package/dist/typechain-hardhat/contracts/test/index.d.ts +2 -0
  42. package/dist/typechain-hardhat/contracts/test/index.js +2 -0
  43. package/dist/typechain-hardhat/types.d.ts +55 -0
  44. package/dist/typechain-hardhat/types.js +5 -0
  45. package/package.json +33 -0
@@ -0,0 +1,488 @@
1
+ {
2
+ "_format": "hh-sol-artifact-1",
3
+ "contractName": "Lens",
4
+ "sourceName": "contracts/periphery/Lens.sol",
5
+ "abi": [
6
+ {
7
+ "inputs": [
8
+ {
9
+ "internalType": "address",
10
+ "name": "_twap",
11
+ "type": "address"
12
+ }
13
+ ],
14
+ "stateMutability": "nonpayable",
15
+ "type": "constructor"
16
+ },
17
+ {
18
+ "inputs": [],
19
+ "name": "length",
20
+ "outputs": [
21
+ {
22
+ "internalType": "uint64",
23
+ "name": "",
24
+ "type": "uint64"
25
+ }
26
+ ],
27
+ "stateMutability": "view",
28
+ "type": "function"
29
+ },
30
+ {
31
+ "inputs": [
32
+ {
33
+ "internalType": "address",
34
+ "name": "maker",
35
+ "type": "address"
36
+ }
37
+ ],
38
+ "name": "makerOrders",
39
+ "outputs": [
40
+ {
41
+ "components": [
42
+ {
43
+ "internalType": "uint64",
44
+ "name": "id",
45
+ "type": "uint64"
46
+ },
47
+ {
48
+ "internalType": "uint32",
49
+ "name": "status",
50
+ "type": "uint32"
51
+ },
52
+ {
53
+ "internalType": "uint32",
54
+ "name": "filledTime",
55
+ "type": "uint32"
56
+ },
57
+ {
58
+ "internalType": "uint256",
59
+ "name": "srcFilledAmount",
60
+ "type": "uint256"
61
+ },
62
+ {
63
+ "components": [
64
+ {
65
+ "internalType": "uint32",
66
+ "name": "time",
67
+ "type": "uint32"
68
+ },
69
+ {
70
+ "internalType": "uint32",
71
+ "name": "deadline",
72
+ "type": "uint32"
73
+ },
74
+ {
75
+ "internalType": "uint32",
76
+ "name": "bidDelay",
77
+ "type": "uint32"
78
+ },
79
+ {
80
+ "internalType": "uint32",
81
+ "name": "fillDelay",
82
+ "type": "uint32"
83
+ },
84
+ {
85
+ "internalType": "address",
86
+ "name": "maker",
87
+ "type": "address"
88
+ },
89
+ {
90
+ "internalType": "address",
91
+ "name": "exchange",
92
+ "type": "address"
93
+ },
94
+ {
95
+ "internalType": "address",
96
+ "name": "srcToken",
97
+ "type": "address"
98
+ },
99
+ {
100
+ "internalType": "address",
101
+ "name": "dstToken",
102
+ "type": "address"
103
+ },
104
+ {
105
+ "internalType": "uint256",
106
+ "name": "srcAmount",
107
+ "type": "uint256"
108
+ },
109
+ {
110
+ "internalType": "uint256",
111
+ "name": "srcBidAmount",
112
+ "type": "uint256"
113
+ },
114
+ {
115
+ "internalType": "uint256",
116
+ "name": "dstMinAmount",
117
+ "type": "uint256"
118
+ }
119
+ ],
120
+ "internalType": "struct OrderLib.Ask",
121
+ "name": "ask",
122
+ "type": "tuple"
123
+ },
124
+ {
125
+ "components": [
126
+ {
127
+ "internalType": "uint32",
128
+ "name": "time",
129
+ "type": "uint32"
130
+ },
131
+ {
132
+ "internalType": "address",
133
+ "name": "taker",
134
+ "type": "address"
135
+ },
136
+ {
137
+ "internalType": "address",
138
+ "name": "exchange",
139
+ "type": "address"
140
+ },
141
+ {
142
+ "internalType": "uint256",
143
+ "name": "dstAmount",
144
+ "type": "uint256"
145
+ },
146
+ {
147
+ "internalType": "uint256",
148
+ "name": "dstFee",
149
+ "type": "uint256"
150
+ },
151
+ {
152
+ "internalType": "bytes",
153
+ "name": "data",
154
+ "type": "bytes"
155
+ }
156
+ ],
157
+ "internalType": "struct OrderLib.Bid",
158
+ "name": "bid",
159
+ "type": "tuple"
160
+ }
161
+ ],
162
+ "internalType": "struct OrderLib.Order[]",
163
+ "name": "result",
164
+ "type": "tuple[]"
165
+ }
166
+ ],
167
+ "stateMutability": "view",
168
+ "type": "function"
169
+ },
170
+ {
171
+ "inputs": [
172
+ {
173
+ "internalType": "address",
174
+ "name": "taker",
175
+ "type": "address"
176
+ },
177
+ {
178
+ "internalType": "uint64",
179
+ "name": "lastIndex",
180
+ "type": "uint64"
181
+ },
182
+ {
183
+ "internalType": "uint64",
184
+ "name": "pageSize",
185
+ "type": "uint64"
186
+ }
187
+ ],
188
+ "name": "takerBiddableOrders",
189
+ "outputs": [
190
+ {
191
+ "components": [
192
+ {
193
+ "internalType": "uint64",
194
+ "name": "id",
195
+ "type": "uint64"
196
+ },
197
+ {
198
+ "internalType": "uint32",
199
+ "name": "status",
200
+ "type": "uint32"
201
+ },
202
+ {
203
+ "internalType": "uint32",
204
+ "name": "filledTime",
205
+ "type": "uint32"
206
+ },
207
+ {
208
+ "internalType": "uint256",
209
+ "name": "srcFilledAmount",
210
+ "type": "uint256"
211
+ },
212
+ {
213
+ "components": [
214
+ {
215
+ "internalType": "uint32",
216
+ "name": "time",
217
+ "type": "uint32"
218
+ },
219
+ {
220
+ "internalType": "uint32",
221
+ "name": "deadline",
222
+ "type": "uint32"
223
+ },
224
+ {
225
+ "internalType": "uint32",
226
+ "name": "bidDelay",
227
+ "type": "uint32"
228
+ },
229
+ {
230
+ "internalType": "uint32",
231
+ "name": "fillDelay",
232
+ "type": "uint32"
233
+ },
234
+ {
235
+ "internalType": "address",
236
+ "name": "maker",
237
+ "type": "address"
238
+ },
239
+ {
240
+ "internalType": "address",
241
+ "name": "exchange",
242
+ "type": "address"
243
+ },
244
+ {
245
+ "internalType": "address",
246
+ "name": "srcToken",
247
+ "type": "address"
248
+ },
249
+ {
250
+ "internalType": "address",
251
+ "name": "dstToken",
252
+ "type": "address"
253
+ },
254
+ {
255
+ "internalType": "uint256",
256
+ "name": "srcAmount",
257
+ "type": "uint256"
258
+ },
259
+ {
260
+ "internalType": "uint256",
261
+ "name": "srcBidAmount",
262
+ "type": "uint256"
263
+ },
264
+ {
265
+ "internalType": "uint256",
266
+ "name": "dstMinAmount",
267
+ "type": "uint256"
268
+ }
269
+ ],
270
+ "internalType": "struct OrderLib.Ask",
271
+ "name": "ask",
272
+ "type": "tuple"
273
+ },
274
+ {
275
+ "components": [
276
+ {
277
+ "internalType": "uint32",
278
+ "name": "time",
279
+ "type": "uint32"
280
+ },
281
+ {
282
+ "internalType": "address",
283
+ "name": "taker",
284
+ "type": "address"
285
+ },
286
+ {
287
+ "internalType": "address",
288
+ "name": "exchange",
289
+ "type": "address"
290
+ },
291
+ {
292
+ "internalType": "uint256",
293
+ "name": "dstAmount",
294
+ "type": "uint256"
295
+ },
296
+ {
297
+ "internalType": "uint256",
298
+ "name": "dstFee",
299
+ "type": "uint256"
300
+ },
301
+ {
302
+ "internalType": "bytes",
303
+ "name": "data",
304
+ "type": "bytes"
305
+ }
306
+ ],
307
+ "internalType": "struct OrderLib.Bid",
308
+ "name": "bid",
309
+ "type": "tuple"
310
+ }
311
+ ],
312
+ "internalType": "struct OrderLib.Order[]",
313
+ "name": "result",
314
+ "type": "tuple[]"
315
+ }
316
+ ],
317
+ "stateMutability": "view",
318
+ "type": "function"
319
+ },
320
+ {
321
+ "inputs": [
322
+ {
323
+ "internalType": "address",
324
+ "name": "taker",
325
+ "type": "address"
326
+ },
327
+ {
328
+ "internalType": "uint64",
329
+ "name": "lastIndex",
330
+ "type": "uint64"
331
+ },
332
+ {
333
+ "internalType": "uint64",
334
+ "name": "pageSize",
335
+ "type": "uint64"
336
+ }
337
+ ],
338
+ "name": "takerFillableOrders",
339
+ "outputs": [
340
+ {
341
+ "components": [
342
+ {
343
+ "internalType": "uint64",
344
+ "name": "id",
345
+ "type": "uint64"
346
+ },
347
+ {
348
+ "internalType": "uint32",
349
+ "name": "status",
350
+ "type": "uint32"
351
+ },
352
+ {
353
+ "internalType": "uint32",
354
+ "name": "filledTime",
355
+ "type": "uint32"
356
+ },
357
+ {
358
+ "internalType": "uint256",
359
+ "name": "srcFilledAmount",
360
+ "type": "uint256"
361
+ },
362
+ {
363
+ "components": [
364
+ {
365
+ "internalType": "uint32",
366
+ "name": "time",
367
+ "type": "uint32"
368
+ },
369
+ {
370
+ "internalType": "uint32",
371
+ "name": "deadline",
372
+ "type": "uint32"
373
+ },
374
+ {
375
+ "internalType": "uint32",
376
+ "name": "bidDelay",
377
+ "type": "uint32"
378
+ },
379
+ {
380
+ "internalType": "uint32",
381
+ "name": "fillDelay",
382
+ "type": "uint32"
383
+ },
384
+ {
385
+ "internalType": "address",
386
+ "name": "maker",
387
+ "type": "address"
388
+ },
389
+ {
390
+ "internalType": "address",
391
+ "name": "exchange",
392
+ "type": "address"
393
+ },
394
+ {
395
+ "internalType": "address",
396
+ "name": "srcToken",
397
+ "type": "address"
398
+ },
399
+ {
400
+ "internalType": "address",
401
+ "name": "dstToken",
402
+ "type": "address"
403
+ },
404
+ {
405
+ "internalType": "uint256",
406
+ "name": "srcAmount",
407
+ "type": "uint256"
408
+ },
409
+ {
410
+ "internalType": "uint256",
411
+ "name": "srcBidAmount",
412
+ "type": "uint256"
413
+ },
414
+ {
415
+ "internalType": "uint256",
416
+ "name": "dstMinAmount",
417
+ "type": "uint256"
418
+ }
419
+ ],
420
+ "internalType": "struct OrderLib.Ask",
421
+ "name": "ask",
422
+ "type": "tuple"
423
+ },
424
+ {
425
+ "components": [
426
+ {
427
+ "internalType": "uint32",
428
+ "name": "time",
429
+ "type": "uint32"
430
+ },
431
+ {
432
+ "internalType": "address",
433
+ "name": "taker",
434
+ "type": "address"
435
+ },
436
+ {
437
+ "internalType": "address",
438
+ "name": "exchange",
439
+ "type": "address"
440
+ },
441
+ {
442
+ "internalType": "uint256",
443
+ "name": "dstAmount",
444
+ "type": "uint256"
445
+ },
446
+ {
447
+ "internalType": "uint256",
448
+ "name": "dstFee",
449
+ "type": "uint256"
450
+ },
451
+ {
452
+ "internalType": "bytes",
453
+ "name": "data",
454
+ "type": "bytes"
455
+ }
456
+ ],
457
+ "internalType": "struct OrderLib.Bid",
458
+ "name": "bid",
459
+ "type": "tuple"
460
+ }
461
+ ],
462
+ "internalType": "struct OrderLib.Order[]",
463
+ "name": "result",
464
+ "type": "tuple[]"
465
+ }
466
+ ],
467
+ "stateMutability": "view",
468
+ "type": "function"
469
+ },
470
+ {
471
+ "inputs": [],
472
+ "name": "twap",
473
+ "outputs": [
474
+ {
475
+ "internalType": "contract TWAP",
476
+ "name": "",
477
+ "type": "address"
478
+ }
479
+ ],
480
+ "stateMutability": "view",
481
+ "type": "function"
482
+ }
483
+ ],
484
+ "bytecode": "0x60a060405234801561001057600080fd5b5060405161175c38038061175c83398101604081905261002f91610040565b6001600160a01b0316608052610070565b60006020828403121561005257600080fd5b81516001600160a01b038116811461006957600080fd5b9392505050565b60805161168c6100d06000396000818160610152818161011b015281816101df01528181610280015281816103ae015281816105e50152818161068f015281816107bb015281816108be0152818161095f0152610a5b015261168c6000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c80631208aa181461005c57806319f37aea146100a05780631f7b6d32146100c057806334b819fc146100e05780635371c9eb146100f3575b600080fd5b6100837f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b6100b36100ae366004610eab565b610106565b6040516100979190610f96565b6100c86105e1565b6040516001600160401b039091168152602001610097565b6100b36100ee366004611124565b61066a565b6100b3610101366004610eab565b61086b565b606060006101148484610c8d565b90506000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663454b15806040518163ffffffff1660e01b8152600401602060405180830381865afa158015610177573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061019b919061115a565b905060005b8351816001600160401b031610156104ff5760006101be828961118b565b6040516342d21ef760e01b81526001600160401b03821660048201529091507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906342d21ef790602401602060405180830381865afa15801561022e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610252919061115a565b63ffffffff164210156104ec5760405163a0b94e0b60e01b81526001600160401b03821660048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063a0b94e0b90602401600060405180830381865afa1580156102cf573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526102f79190810190611337565b9050806080015160600151816040015161031191906114b7565b63ffffffff16421180156103715750896001600160a01b03168160a00151602001516001600160a01b031614158061037157508381608001516040015161035891906114d4565b60a08201515161036891906114b7565b63ffffffff1642115b8015610424575061038181610d67565b60808281015160c0810151910151604051636eb1769f60e11b81526001600160a01b0391821660048201527f00000000000000000000000000000000000000000000000000000000000000008216602482015291169063dd62ed3e90604401602060405180830381865afa1580156103fd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104219190611500565b10155b80156104af575061043481610d67565b60808281015160c08101519101516040516370a0823160e01b81526001600160a01b0391821660048201529116906370a0823190602401602060405180830381865afa158015610488573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104ac9190611500565b10155b156104ea578086866001600160401b0316815181106104d0576104d0611519565b602002602001018190525084806104e69061152f565b9550505b505b50806104f78161152f565b9150506101a0565b50816001600160401b03166001600160401b03811115610521576105216111b2565b60405190808252806020026020018201604052801561055a57816020015b610547610da7565b81526020019060019003908161053f5790505b50935060005b826001600160401b0316816001600160401b031610156105d65783816001600160401b03168151811061059557610595611519565b602002602001015185826001600160401b0316815181106105b8576105b8611519565b602002602001018190525080806105ce9061152f565b915050610560565b505050509392505050565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316631f7b6d326040518163ffffffff1660e01b8152600401602060405180830381865afa158015610641573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106659190611555565b905090565b6040516301c961a560e11b81526001600160a01b0382811660048301526060916000917f00000000000000000000000000000000000000000000000000000000000000001690630392c34a90602401600060405180830381865afa1580156106d6573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526106fe9190810190611572565b905080516001600160401b03811115610719576107196111b2565b60405190808252806020026020018201604052801561075257816020015b61073f610da7565b8152602001906001900390816107375790505b50915060005b8251816001600160401b0316101561086457600082826001600160401b03168151811061078757610787611519565b602090810291909101015160405163a0b94e0b60e01b81526001600160401b03821660048201529091506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063a0b94e0b90602401600060405180830381865afa158015610802573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261082a9190810190611337565b84836001600160401b03168151811061084557610845611519565b602002602001018190525050808061085c9061152f565b915050610758565b5050919050565b606060006108798484610c8d565b90506000805b8251816001600160401b03161015610bac57600061089d828861118b565b6040516342d21ef760e01b81526001600160401b03821660048201529091507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906342d21ef790602401602060405180830381865afa15801561090d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610931919061115a565b63ffffffff16421015610b995760405163a0b94e0b60e01b81526001600160401b03821660048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063a0b94e0b90602401600060405180830381865afa1580156109ae573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526109d69190810190611337565b9050886001600160a01b03168160a00151602001516001600160a01b0316148015610a1e575060808101516040015160a082015151610a1591906114b7565b63ffffffff1642115b8015610ad15750610a2e81610d67565b60808281015160c0810151910151604051636eb1769f60e11b81526001600160a01b0391821660048201527f00000000000000000000000000000000000000000000000000000000000000008216602482015291169063dd62ed3e90604401602060405180830381865afa158015610aaa573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ace9190611500565b10155b8015610b5c5750610ae181610d67565b60808281015160c08101519101516040516370a0823160e01b81526001600160a01b0391821660048201529116906370a0823190602401602060405180830381865afa158015610b35573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b599190611500565b10155b15610b97578085856001600160401b031681518110610b7d57610b7d611519565b60200260200101819052508380610b939061152f565b9450505b505b5080610ba48161152f565b91505061087f565b50806001600160401b03166001600160401b03811115610bce57610bce6111b2565b604051908082528060200260200182016040528015610c0757816020015b610bf4610da7565b815260200190600190039081610bec5790505b50925060005b816001600160401b0316816001600160401b03161015610c835782816001600160401b031681518110610c4257610c42611519565b602002602001015184826001600160401b031681518110610c6557610c65611519565b60200260200101819052508080610c7b9061152f565b915050610c0d565b5050509392505050565b6060610c976105e1565b6001600160401b0316836001600160401b031610610ce75760405162461bcd60e51b81526020600482015260096024820152680d8c2e6e892dcc8caf60bb1b604482015260640160405180910390fd5b610d0d610cf5846001611623565b6001600160401b0316836001600160401b0316610d8f565b6001600160401b03811115610d2457610d246111b2565b604051908082528060200260200182016040528015610d5d57816020015b610d4a610da7565b815260200190600190039081610d425790505b5090505b92915050565b6000610d6182608001516101200151836060015184608001516101000151610d8f9190611643565b6000818310610d9e5781610da0565b825b9392505050565b6040805160c08082018352600080835260208084018290528385018290526060808501839052855161016081018752838152918201839052948101829052938401819052608084810182905260a0850182905291840181905260e08401819052610100840181905261012084018190526101408401529091908201908152602001610e796040518060c00160405280600063ffffffff16815260200160006001600160a01b0316815260200160006001600160a01b031681526020016000815260200160008152602001606081525090565b905290565b6001600160a01b0381168114610e9357600080fd5b50565b6001600160401b0381168114610e9357600080fd5b600080600060608486031215610ec057600080fd5b8335610ecb81610e7e565b92506020840135610edb81610e96565b91506040840135610eeb81610e96565b809150509250925092565b60005b83811015610f11578181015183820152602001610ef9565b50506000910152565b63ffffffff81511682526000602082015160018060a01b0380821660208601528060408501511660408601525050606082015160608401526080820151608084015260a082015160c060a085015280518060c0860152610f818160e0870160208501610ef6565b601f01601f19169390930160e0019392505050565b60006020808301818452808551808352604092508286019150828160051b87010184880160005b8381101561111657888303603f19018552815180516001600160401b031684528781015163ffffffff908116898601528782015181168886015260608083015181870152608080840151805190931681880152610200928b81015160a061102b818b018363ffffffff169052565b8c830151915060c0611044818c018463ffffffff169052565b948301519460e0925061105e8b84018763ffffffff169052565b9383015194506101009361107c8b8601876001600160a01b03169052565b818401519550610120611099818d01886001600160a01b03169052565b908401519550610140906110b78c8301886001600160a01b03169052565b928401516001600160a01b03166101608c0152938301516101808b0152908201516101a08a01529101516101c088015292909201516101e08601829052915061110281860183610f1a565b968901969450505090860190600101610fbd565b509098975050505050505050565b60006020828403121561113657600080fd5b8135610da081610e7e565b805163ffffffff8116811461115557600080fd5b919050565b60006020828403121561116c57600080fd5b610da082611141565b634e487b7160e01b600052601160045260246000fd5b6001600160401b038281168282160390808211156111ab576111ab611175565b5092915050565b634e487b7160e01b600052604160045260246000fd5b60405160c081016001600160401b03811182821017156111ea576111ea6111b2565b60405290565b60405161016081016001600160401b03811182821017156111ea576111ea6111b2565b604051601f8201601f191681016001600160401b038111828210171561123b5761123b6111b2565b604052919050565b805161115581610e7e565b600060c0828403121561126057600080fd5b6112686111c8565b905061127382611141565b815260208083015161128481610e7e565b82820152604083015161129681610e7e565b80604084015250606083015160608301526080830151608083015260a08301516001600160401b03808211156112cb57600080fd5b818501915085601f8301126112df57600080fd5b8151818111156112f1576112f16111b2565b611303601f8201601f19168501611213565b9150808252868482850101111561131957600080fd5b61132881858401868601610ef6565b5060a084015250909392505050565b60006020828403121561134957600080fd5b81516001600160401b038082111561136057600080fd5b9083019081850361020081121561137657600080fd5b61137e6111c8565b835161138981610e96565b815261139760208501611141565b60208201526113a860408501611141565b60408201526060840151606082015261016080607f19840112156113cb57600080fd5b6113d36111f0565b92506113e160808601611141565b83526113ef60a08601611141565b602084015261140060c08601611141565b604084015261141160e08601611141565b6060840152610100611424818701611243565b6080850152610120611437818801611243565b60a086015261014061144a818901611243565b60c087015261145a848901611243565b60e0870152610180880151838701526101a0880151828701526101c088015181870152505050508160808201526101e084015191508282111561149c57600080fd5b6114a88783860161124e565b60a08201529695505050505050565b63ffffffff8181168382160190808211156111ab576111ab611175565b600063ffffffff808316818516818304811182151516156114f7576114f7611175565b02949350505050565b60006020828403121561151257600080fd5b5051919050565b634e487b7160e01b600052603260045260246000fd5b60006001600160401b0380831681810361154b5761154b611175565b6001019392505050565b60006020828403121561156757600080fd5b8151610da081610e96565b6000602080838503121561158557600080fd5b82516001600160401b038082111561159c57600080fd5b818501915085601f8301126115b057600080fd5b8151818111156115c2576115c26111b2565b8060051b91506115d3848301611213565b81815291830184019184810190888411156115ed57600080fd5b938501935b83851015611617578451925061160783610e96565b82825293850193908501906115f2565b98975050505050505050565b6001600160401b038181168382160190808211156111ab576111ab611175565b81810381811115610d6157610d6161117556fea26469706673582212205b09393dee412506876b136d30f1c44249af099919327eee8813fb4a7c39043964736f6c63430008100033",
485
+ "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100575760003560e01c80631208aa181461005c57806319f37aea146100a05780631f7b6d32146100c057806334b819fc146100e05780635371c9eb146100f3575b600080fd5b6100837f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b6100b36100ae366004610eab565b610106565b6040516100979190610f96565b6100c86105e1565b6040516001600160401b039091168152602001610097565b6100b36100ee366004611124565b61066a565b6100b3610101366004610eab565b61086b565b606060006101148484610c8d565b90506000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663454b15806040518163ffffffff1660e01b8152600401602060405180830381865afa158015610177573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061019b919061115a565b905060005b8351816001600160401b031610156104ff5760006101be828961118b565b6040516342d21ef760e01b81526001600160401b03821660048201529091507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906342d21ef790602401602060405180830381865afa15801561022e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610252919061115a565b63ffffffff164210156104ec5760405163a0b94e0b60e01b81526001600160401b03821660048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063a0b94e0b90602401600060405180830381865afa1580156102cf573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526102f79190810190611337565b9050806080015160600151816040015161031191906114b7565b63ffffffff16421180156103715750896001600160a01b03168160a00151602001516001600160a01b031614158061037157508381608001516040015161035891906114d4565b60a08201515161036891906114b7565b63ffffffff1642115b8015610424575061038181610d67565b60808281015160c0810151910151604051636eb1769f60e11b81526001600160a01b0391821660048201527f00000000000000000000000000000000000000000000000000000000000000008216602482015291169063dd62ed3e90604401602060405180830381865afa1580156103fd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104219190611500565b10155b80156104af575061043481610d67565b60808281015160c08101519101516040516370a0823160e01b81526001600160a01b0391821660048201529116906370a0823190602401602060405180830381865afa158015610488573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104ac9190611500565b10155b156104ea578086866001600160401b0316815181106104d0576104d0611519565b602002602001018190525084806104e69061152f565b9550505b505b50806104f78161152f565b9150506101a0565b50816001600160401b03166001600160401b03811115610521576105216111b2565b60405190808252806020026020018201604052801561055a57816020015b610547610da7565b81526020019060019003908161053f5790505b50935060005b826001600160401b0316816001600160401b031610156105d65783816001600160401b03168151811061059557610595611519565b602002602001015185826001600160401b0316815181106105b8576105b8611519565b602002602001018190525080806105ce9061152f565b915050610560565b505050509392505050565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316631f7b6d326040518163ffffffff1660e01b8152600401602060405180830381865afa158015610641573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106659190611555565b905090565b6040516301c961a560e11b81526001600160a01b0382811660048301526060916000917f00000000000000000000000000000000000000000000000000000000000000001690630392c34a90602401600060405180830381865afa1580156106d6573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526106fe9190810190611572565b905080516001600160401b03811115610719576107196111b2565b60405190808252806020026020018201604052801561075257816020015b61073f610da7565b8152602001906001900390816107375790505b50915060005b8251816001600160401b0316101561086457600082826001600160401b03168151811061078757610787611519565b602090810291909101015160405163a0b94e0b60e01b81526001600160401b03821660048201529091506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063a0b94e0b90602401600060405180830381865afa158015610802573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261082a9190810190611337565b84836001600160401b03168151811061084557610845611519565b602002602001018190525050808061085c9061152f565b915050610758565b5050919050565b606060006108798484610c8d565b90506000805b8251816001600160401b03161015610bac57600061089d828861118b565b6040516342d21ef760e01b81526001600160401b03821660048201529091507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906342d21ef790602401602060405180830381865afa15801561090d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610931919061115a565b63ffffffff16421015610b995760405163a0b94e0b60e01b81526001600160401b03821660048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063a0b94e0b90602401600060405180830381865afa1580156109ae573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526109d69190810190611337565b9050886001600160a01b03168160a00151602001516001600160a01b0316148015610a1e575060808101516040015160a082015151610a1591906114b7565b63ffffffff1642115b8015610ad15750610a2e81610d67565b60808281015160c0810151910151604051636eb1769f60e11b81526001600160a01b0391821660048201527f00000000000000000000000000000000000000000000000000000000000000008216602482015291169063dd62ed3e90604401602060405180830381865afa158015610aaa573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ace9190611500565b10155b8015610b5c5750610ae181610d67565b60808281015160c08101519101516040516370a0823160e01b81526001600160a01b0391821660048201529116906370a0823190602401602060405180830381865afa158015610b35573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b599190611500565b10155b15610b97578085856001600160401b031681518110610b7d57610b7d611519565b60200260200101819052508380610b939061152f565b9450505b505b5080610ba48161152f565b91505061087f565b50806001600160401b03166001600160401b03811115610bce57610bce6111b2565b604051908082528060200260200182016040528015610c0757816020015b610bf4610da7565b815260200190600190039081610bec5790505b50925060005b816001600160401b0316816001600160401b03161015610c835782816001600160401b031681518110610c4257610c42611519565b602002602001015184826001600160401b031681518110610c6557610c65611519565b60200260200101819052508080610c7b9061152f565b915050610c0d565b5050509392505050565b6060610c976105e1565b6001600160401b0316836001600160401b031610610ce75760405162461bcd60e51b81526020600482015260096024820152680d8c2e6e892dcc8caf60bb1b604482015260640160405180910390fd5b610d0d610cf5846001611623565b6001600160401b0316836001600160401b0316610d8f565b6001600160401b03811115610d2457610d246111b2565b604051908082528060200260200182016040528015610d5d57816020015b610d4a610da7565b815260200190600190039081610d425790505b5090505b92915050565b6000610d6182608001516101200151836060015184608001516101000151610d8f9190611643565b6000818310610d9e5781610da0565b825b9392505050565b6040805160c08082018352600080835260208084018290528385018290526060808501839052855161016081018752838152918201839052948101829052938401819052608084810182905260a0850182905291840181905260e08401819052610100840181905261012084018190526101408401529091908201908152602001610e796040518060c00160405280600063ffffffff16815260200160006001600160a01b0316815260200160006001600160a01b031681526020016000815260200160008152602001606081525090565b905290565b6001600160a01b0381168114610e9357600080fd5b50565b6001600160401b0381168114610e9357600080fd5b600080600060608486031215610ec057600080fd5b8335610ecb81610e7e565b92506020840135610edb81610e96565b91506040840135610eeb81610e96565b809150509250925092565b60005b83811015610f11578181015183820152602001610ef9565b50506000910152565b63ffffffff81511682526000602082015160018060a01b0380821660208601528060408501511660408601525050606082015160608401526080820151608084015260a082015160c060a085015280518060c0860152610f818160e0870160208501610ef6565b601f01601f19169390930160e0019392505050565b60006020808301818452808551808352604092508286019150828160051b87010184880160005b8381101561111657888303603f19018552815180516001600160401b031684528781015163ffffffff908116898601528782015181168886015260608083015181870152608080840151805190931681880152610200928b81015160a061102b818b018363ffffffff169052565b8c830151915060c0611044818c018463ffffffff169052565b948301519460e0925061105e8b84018763ffffffff169052565b9383015194506101009361107c8b8601876001600160a01b03169052565b818401519550610120611099818d01886001600160a01b03169052565b908401519550610140906110b78c8301886001600160a01b03169052565b928401516001600160a01b03166101608c0152938301516101808b0152908201516101a08a01529101516101c088015292909201516101e08601829052915061110281860183610f1a565b968901969450505090860190600101610fbd565b509098975050505050505050565b60006020828403121561113657600080fd5b8135610da081610e7e565b805163ffffffff8116811461115557600080fd5b919050565b60006020828403121561116c57600080fd5b610da082611141565b634e487b7160e01b600052601160045260246000fd5b6001600160401b038281168282160390808211156111ab576111ab611175565b5092915050565b634e487b7160e01b600052604160045260246000fd5b60405160c081016001600160401b03811182821017156111ea576111ea6111b2565b60405290565b60405161016081016001600160401b03811182821017156111ea576111ea6111b2565b604051601f8201601f191681016001600160401b038111828210171561123b5761123b6111b2565b604052919050565b805161115581610e7e565b600060c0828403121561126057600080fd5b6112686111c8565b905061127382611141565b815260208083015161128481610e7e565b82820152604083015161129681610e7e565b80604084015250606083015160608301526080830151608083015260a08301516001600160401b03808211156112cb57600080fd5b818501915085601f8301126112df57600080fd5b8151818111156112f1576112f16111b2565b611303601f8201601f19168501611213565b9150808252868482850101111561131957600080fd5b61132881858401868601610ef6565b5060a084015250909392505050565b60006020828403121561134957600080fd5b81516001600160401b038082111561136057600080fd5b9083019081850361020081121561137657600080fd5b61137e6111c8565b835161138981610e96565b815261139760208501611141565b60208201526113a860408501611141565b60408201526060840151606082015261016080607f19840112156113cb57600080fd5b6113d36111f0565b92506113e160808601611141565b83526113ef60a08601611141565b602084015261140060c08601611141565b604084015261141160e08601611141565b6060840152610100611424818701611243565b6080850152610120611437818801611243565b60a086015261014061144a818901611243565b60c087015261145a848901611243565b60e0870152610180880151838701526101a0880151828701526101c088015181870152505050508160808201526101e084015191508282111561149c57600080fd5b6114a88783860161124e565b60a08201529695505050505050565b63ffffffff8181168382160190808211156111ab576111ab611175565b600063ffffffff808316818516818304811182151516156114f7576114f7611175565b02949350505050565b60006020828403121561151257600080fd5b5051919050565b634e487b7160e01b600052603260045260246000fd5b60006001600160401b0380831681810361154b5761154b611175565b6001019392505050565b60006020828403121561156757600080fd5b8151610da081610e96565b6000602080838503121561158557600080fd5b82516001600160401b038082111561159c57600080fd5b818501915085601f8301126115b057600080fd5b8151818111156115c2576115c26111b2565b8060051b91506115d3848301611213565b81815291830184019184810190888411156115ed57600080fd5b938501935b83851015611617578451925061160783610e96565b82825293850193908501906115f2565b98975050505050505050565b6001600160401b038181168382160190808211156111ab576111ab611175565b81810381811115610d6157610d6161117556fea26469706673582212205b09393dee412506876b136d30f1c44249af099919327eee8813fb4a7c39043964736f6c63430008100033",
486
+ "linkReferences": {},
487
+ "deployedLinkReferences": {}
488
+ }
@@ -0,0 +1,20 @@
1
+ export interface TokenData {
2
+ address: string;
3
+ decimals: number;
4
+ symbol: string;
5
+ logoUrl?: string;
6
+ }
7
+ export interface Config {
8
+ partner: string;
9
+ chainId: number;
10
+ twapAddress: string;
11
+ lensAddress: string;
12
+ exchangeAddress: string;
13
+ bidDelaySeconds: number;
14
+ minChunkSizeUsd: number;
15
+ wToken: TokenData;
16
+ }
17
+ export declare const QuickSwapConfig: Config;
18
+ export declare const SpiritSwapConfig: Config;
19
+ export declare const SpookySwapConfig: Config;
20
+ export declare const nativeTokenAddresses: string[];
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.nativeTokenAddresses = exports.SpookySwapConfig = exports.SpiritSwapConfig = exports.QuickSwapConfig = void 0;
4
+ const web3_candies_1 = require("@defi.org/web3-candies");
5
+ const ChainConfigs = {
6
+ // eth: {
7
+ // chainId: 1,
8
+ // twapAddress: "0x85253417E9BF576980318E7882147618C4980969",
9
+ // lensAddress: "0x1c4b5371dfDF424a162974C2361a6405b1F772cf",
10
+ // bidDelaySeconds: 60,
11
+ // minChunkSizeUsd: 100,
12
+ // wToken: {
13
+ // address: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
14
+ // decimals: 18,
15
+ // symbol: "WETH",
16
+ // logoUrl: "https://tokens.1inch.io/0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee.png",
17
+ // },
18
+ // },
19
+ ftm: {
20
+ chainId: 250,
21
+ twapAddress: "0xBeDf3660c6524eFe533b4058E0c726535ac251a2",
22
+ lensAddress: "0x715181517a576eA382E4351F10EAE693Cfe4471a",
23
+ bidDelaySeconds: 60,
24
+ minChunkSizeUsd: 10,
25
+ wToken: {
26
+ address: "0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83",
27
+ decimals: 18,
28
+ symbol: "WFTM",
29
+ logoUrl: "https://tokens.1inch.io/0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83.png",
30
+ },
31
+ },
32
+ poly: {
33
+ chainId: 137,
34
+ twapAddress: "0x48423e62acbfEF7779b5b4a5E7d6Fbd39E623d78",
35
+ lensAddress: "0xe84CaEc86eCF3f0AB4267dC6130D9a5510e73DFb",
36
+ bidDelaySeconds: 60,
37
+ minChunkSizeUsd: 10,
38
+ wToken: {
39
+ address: "0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270",
40
+ decimals: 18,
41
+ symbol: "WMATIC",
42
+ logoUrl: "https://tokens.1inch.io/0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0.png",
43
+ },
44
+ },
45
+ };
46
+ // export const UniswapV2Config: Config = {
47
+ // ...ChainConfigs.eth,
48
+ // partner: "UniswapV2",
49
+ // exchangeAddress: "0xE83df5BfA9F14a84e550c38c4ec505cB22C6A0d7",
50
+ // };
51
+ //
52
+ // export const SushiSwapConfig: Config = {
53
+ // ...ChainConfigs.eth,
54
+ // partner: "SushiSwap",
55
+ // exchangeAddress: "0x72a18A408e329E7052d08aA0746243Dc30Ad2530",
56
+ // };
57
+ exports.QuickSwapConfig = Object.assign(Object.assign({}, ChainConfigs.poly), { partner: "QuickSwap", exchangeAddress: "0xeFE1B6096838949156e5130604434A2a13c68C68" });
58
+ exports.SpiritSwapConfig = Object.assign(Object.assign({}, ChainConfigs.ftm), { partner: "SpiritSwap", exchangeAddress: "0xAd19179201be5A51D1cBd3bB2fC651BB05822404" });
59
+ exports.SpookySwapConfig = Object.assign(Object.assign({}, ChainConfigs.ftm), { partner: "SpookySwap", exchangeAddress: "0x37F427DA0D12Fe2C80aCa09EE08e7e92A1B2B114" });
60
+ exports.nativeTokenAddresses = [
61
+ web3_candies_1.zeroAddress,
62
+ "0x0000000000000000000000000000000000001010",
63
+ "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
64
+ ];
@@ -0,0 +1,3 @@
1
+ export * from "./lib";
2
+ export * from "./configs";
3
+ export * from "./paraswap";
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./lib"), exports);
18
+ __exportStar(require("./configs"), exports);
19
+ __exportStar(require("./paraswap"), exports);