@paraswap/dex-lib 3.8.36-usual → 3.8.36-usual.3

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.
@@ -0,0 +1,720 @@
1
+ [
2
+ {
3
+ "inputs": [
4
+ { "internalType": "address", "name": "usdsJoin_", "type": "address" },
5
+ { "internalType": "address", "name": "vow_", "type": "address" }
6
+ ],
7
+ "stateMutability": "nonpayable",
8
+ "type": "constructor"
9
+ },
10
+ {
11
+ "inputs": [
12
+ { "internalType": "address", "name": "target", "type": "address" }
13
+ ],
14
+ "name": "AddressEmptyCode",
15
+ "type": "error"
16
+ },
17
+ {
18
+ "inputs": [
19
+ { "internalType": "address", "name": "implementation", "type": "address" }
20
+ ],
21
+ "name": "ERC1967InvalidImplementation",
22
+ "type": "error"
23
+ },
24
+ { "inputs": [], "name": "ERC1967NonPayable", "type": "error" },
25
+ { "inputs": [], "name": "FailedInnerCall", "type": "error" },
26
+ { "inputs": [], "name": "InvalidInitialization", "type": "error" },
27
+ { "inputs": [], "name": "NotInitializing", "type": "error" },
28
+ { "inputs": [], "name": "UUPSUnauthorizedCallContext", "type": "error" },
29
+ {
30
+ "inputs": [
31
+ { "internalType": "bytes32", "name": "slot", "type": "bytes32" }
32
+ ],
33
+ "name": "UUPSUnsupportedProxiableUUID",
34
+ "type": "error"
35
+ },
36
+ {
37
+ "anonymous": false,
38
+ "inputs": [
39
+ {
40
+ "indexed": true,
41
+ "internalType": "address",
42
+ "name": "owner",
43
+ "type": "address"
44
+ },
45
+ {
46
+ "indexed": true,
47
+ "internalType": "address",
48
+ "name": "spender",
49
+ "type": "address"
50
+ },
51
+ {
52
+ "indexed": false,
53
+ "internalType": "uint256",
54
+ "name": "value",
55
+ "type": "uint256"
56
+ }
57
+ ],
58
+ "name": "Approval",
59
+ "type": "event"
60
+ },
61
+ {
62
+ "anonymous": false,
63
+ "inputs": [
64
+ {
65
+ "indexed": true,
66
+ "internalType": "address",
67
+ "name": "usr",
68
+ "type": "address"
69
+ }
70
+ ],
71
+ "name": "Deny",
72
+ "type": "event"
73
+ },
74
+ {
75
+ "anonymous": false,
76
+ "inputs": [
77
+ {
78
+ "indexed": true,
79
+ "internalType": "address",
80
+ "name": "sender",
81
+ "type": "address"
82
+ },
83
+ {
84
+ "indexed": true,
85
+ "internalType": "address",
86
+ "name": "owner",
87
+ "type": "address"
88
+ },
89
+ {
90
+ "indexed": false,
91
+ "internalType": "uint256",
92
+ "name": "assets",
93
+ "type": "uint256"
94
+ },
95
+ {
96
+ "indexed": false,
97
+ "internalType": "uint256",
98
+ "name": "shares",
99
+ "type": "uint256"
100
+ }
101
+ ],
102
+ "name": "Deposit",
103
+ "type": "event"
104
+ },
105
+ {
106
+ "anonymous": false,
107
+ "inputs": [
108
+ {
109
+ "indexed": false,
110
+ "internalType": "uint256",
111
+ "name": "chi",
112
+ "type": "uint256"
113
+ },
114
+ {
115
+ "indexed": false,
116
+ "internalType": "uint256",
117
+ "name": "diff",
118
+ "type": "uint256"
119
+ }
120
+ ],
121
+ "name": "Drip",
122
+ "type": "event"
123
+ },
124
+ {
125
+ "anonymous": false,
126
+ "inputs": [
127
+ {
128
+ "indexed": true,
129
+ "internalType": "bytes32",
130
+ "name": "what",
131
+ "type": "bytes32"
132
+ },
133
+ {
134
+ "indexed": false,
135
+ "internalType": "uint256",
136
+ "name": "data",
137
+ "type": "uint256"
138
+ }
139
+ ],
140
+ "name": "File",
141
+ "type": "event"
142
+ },
143
+ {
144
+ "anonymous": false,
145
+ "inputs": [
146
+ {
147
+ "indexed": false,
148
+ "internalType": "uint64",
149
+ "name": "version",
150
+ "type": "uint64"
151
+ }
152
+ ],
153
+ "name": "Initialized",
154
+ "type": "event"
155
+ },
156
+ {
157
+ "anonymous": false,
158
+ "inputs": [
159
+ {
160
+ "indexed": true,
161
+ "internalType": "uint16",
162
+ "name": "referral",
163
+ "type": "uint16"
164
+ },
165
+ {
166
+ "indexed": true,
167
+ "internalType": "address",
168
+ "name": "owner",
169
+ "type": "address"
170
+ },
171
+ {
172
+ "indexed": false,
173
+ "internalType": "uint256",
174
+ "name": "assets",
175
+ "type": "uint256"
176
+ },
177
+ {
178
+ "indexed": false,
179
+ "internalType": "uint256",
180
+ "name": "shares",
181
+ "type": "uint256"
182
+ }
183
+ ],
184
+ "name": "Referral",
185
+ "type": "event"
186
+ },
187
+ {
188
+ "anonymous": false,
189
+ "inputs": [
190
+ {
191
+ "indexed": true,
192
+ "internalType": "address",
193
+ "name": "usr",
194
+ "type": "address"
195
+ }
196
+ ],
197
+ "name": "Rely",
198
+ "type": "event"
199
+ },
200
+ {
201
+ "anonymous": false,
202
+ "inputs": [
203
+ {
204
+ "indexed": true,
205
+ "internalType": "address",
206
+ "name": "from",
207
+ "type": "address"
208
+ },
209
+ {
210
+ "indexed": true,
211
+ "internalType": "address",
212
+ "name": "to",
213
+ "type": "address"
214
+ },
215
+ {
216
+ "indexed": false,
217
+ "internalType": "uint256",
218
+ "name": "value",
219
+ "type": "uint256"
220
+ }
221
+ ],
222
+ "name": "Transfer",
223
+ "type": "event"
224
+ },
225
+ {
226
+ "anonymous": false,
227
+ "inputs": [
228
+ {
229
+ "indexed": true,
230
+ "internalType": "address",
231
+ "name": "implementation",
232
+ "type": "address"
233
+ }
234
+ ],
235
+ "name": "Upgraded",
236
+ "type": "event"
237
+ },
238
+ {
239
+ "anonymous": false,
240
+ "inputs": [
241
+ {
242
+ "indexed": true,
243
+ "internalType": "address",
244
+ "name": "sender",
245
+ "type": "address"
246
+ },
247
+ {
248
+ "indexed": true,
249
+ "internalType": "address",
250
+ "name": "receiver",
251
+ "type": "address"
252
+ },
253
+ {
254
+ "indexed": true,
255
+ "internalType": "address",
256
+ "name": "owner",
257
+ "type": "address"
258
+ },
259
+ {
260
+ "indexed": false,
261
+ "internalType": "uint256",
262
+ "name": "assets",
263
+ "type": "uint256"
264
+ },
265
+ {
266
+ "indexed": false,
267
+ "internalType": "uint256",
268
+ "name": "shares",
269
+ "type": "uint256"
270
+ }
271
+ ],
272
+ "name": "Withdraw",
273
+ "type": "event"
274
+ },
275
+ {
276
+ "inputs": [],
277
+ "name": "DOMAIN_SEPARATOR",
278
+ "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }],
279
+ "stateMutability": "view",
280
+ "type": "function"
281
+ },
282
+ {
283
+ "inputs": [],
284
+ "name": "PERMIT_TYPEHASH",
285
+ "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }],
286
+ "stateMutability": "view",
287
+ "type": "function"
288
+ },
289
+ {
290
+ "inputs": [],
291
+ "name": "UPGRADE_INTERFACE_VERSION",
292
+ "outputs": [{ "internalType": "string", "name": "", "type": "string" }],
293
+ "stateMutability": "view",
294
+ "type": "function"
295
+ },
296
+ {
297
+ "inputs": [
298
+ { "internalType": "address", "name": "", "type": "address" },
299
+ { "internalType": "address", "name": "", "type": "address" }
300
+ ],
301
+ "name": "allowance",
302
+ "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
303
+ "stateMutability": "view",
304
+ "type": "function"
305
+ },
306
+ {
307
+ "inputs": [
308
+ { "internalType": "address", "name": "spender", "type": "address" },
309
+ { "internalType": "uint256", "name": "value", "type": "uint256" }
310
+ ],
311
+ "name": "approve",
312
+ "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
313
+ "stateMutability": "nonpayable",
314
+ "type": "function"
315
+ },
316
+ {
317
+ "inputs": [],
318
+ "name": "asset",
319
+ "outputs": [{ "internalType": "address", "name": "", "type": "address" }],
320
+ "stateMutability": "view",
321
+ "type": "function"
322
+ },
323
+ {
324
+ "inputs": [{ "internalType": "address", "name": "", "type": "address" }],
325
+ "name": "balanceOf",
326
+ "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
327
+ "stateMutability": "view",
328
+ "type": "function"
329
+ },
330
+ {
331
+ "inputs": [],
332
+ "name": "chi",
333
+ "outputs": [{ "internalType": "uint192", "name": "", "type": "uint192" }],
334
+ "stateMutability": "view",
335
+ "type": "function"
336
+ },
337
+ {
338
+ "inputs": [
339
+ { "internalType": "uint256", "name": "shares", "type": "uint256" }
340
+ ],
341
+ "name": "convertToAssets",
342
+ "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
343
+ "stateMutability": "view",
344
+ "type": "function"
345
+ },
346
+ {
347
+ "inputs": [
348
+ { "internalType": "uint256", "name": "assets", "type": "uint256" }
349
+ ],
350
+ "name": "convertToShares",
351
+ "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
352
+ "stateMutability": "view",
353
+ "type": "function"
354
+ },
355
+ {
356
+ "inputs": [],
357
+ "name": "decimals",
358
+ "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }],
359
+ "stateMutability": "view",
360
+ "type": "function"
361
+ },
362
+ {
363
+ "inputs": [{ "internalType": "address", "name": "usr", "type": "address" }],
364
+ "name": "deny",
365
+ "outputs": [],
366
+ "stateMutability": "nonpayable",
367
+ "type": "function"
368
+ },
369
+ {
370
+ "inputs": [
371
+ { "internalType": "uint256", "name": "assets", "type": "uint256" },
372
+ { "internalType": "address", "name": "receiver", "type": "address" }
373
+ ],
374
+ "name": "deposit",
375
+ "outputs": [
376
+ { "internalType": "uint256", "name": "shares", "type": "uint256" }
377
+ ],
378
+ "stateMutability": "nonpayable",
379
+ "type": "function"
380
+ },
381
+ {
382
+ "inputs": [
383
+ { "internalType": "uint256", "name": "assets", "type": "uint256" },
384
+ { "internalType": "address", "name": "receiver", "type": "address" },
385
+ { "internalType": "uint16", "name": "referral", "type": "uint16" }
386
+ ],
387
+ "name": "deposit",
388
+ "outputs": [
389
+ { "internalType": "uint256", "name": "shares", "type": "uint256" }
390
+ ],
391
+ "stateMutability": "nonpayable",
392
+ "type": "function"
393
+ },
394
+ {
395
+ "inputs": [],
396
+ "name": "drip",
397
+ "outputs": [
398
+ { "internalType": "uint256", "name": "nChi", "type": "uint256" }
399
+ ],
400
+ "stateMutability": "nonpayable",
401
+ "type": "function"
402
+ },
403
+ {
404
+ "inputs": [
405
+ { "internalType": "bytes32", "name": "what", "type": "bytes32" },
406
+ { "internalType": "uint256", "name": "data", "type": "uint256" }
407
+ ],
408
+ "name": "file",
409
+ "outputs": [],
410
+ "stateMutability": "nonpayable",
411
+ "type": "function"
412
+ },
413
+ {
414
+ "inputs": [],
415
+ "name": "getImplementation",
416
+ "outputs": [{ "internalType": "address", "name": "", "type": "address" }],
417
+ "stateMutability": "view",
418
+ "type": "function"
419
+ },
420
+ {
421
+ "inputs": [],
422
+ "name": "initialize",
423
+ "outputs": [],
424
+ "stateMutability": "nonpayable",
425
+ "type": "function"
426
+ },
427
+ {
428
+ "inputs": [{ "internalType": "address", "name": "", "type": "address" }],
429
+ "name": "maxDeposit",
430
+ "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
431
+ "stateMutability": "pure",
432
+ "type": "function"
433
+ },
434
+ {
435
+ "inputs": [{ "internalType": "address", "name": "", "type": "address" }],
436
+ "name": "maxMint",
437
+ "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
438
+ "stateMutability": "pure",
439
+ "type": "function"
440
+ },
441
+ {
442
+ "inputs": [
443
+ { "internalType": "address", "name": "owner", "type": "address" }
444
+ ],
445
+ "name": "maxRedeem",
446
+ "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
447
+ "stateMutability": "view",
448
+ "type": "function"
449
+ },
450
+ {
451
+ "inputs": [
452
+ { "internalType": "address", "name": "owner", "type": "address" }
453
+ ],
454
+ "name": "maxWithdraw",
455
+ "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
456
+ "stateMutability": "view",
457
+ "type": "function"
458
+ },
459
+ {
460
+ "inputs": [
461
+ { "internalType": "uint256", "name": "shares", "type": "uint256" },
462
+ { "internalType": "address", "name": "receiver", "type": "address" },
463
+ { "internalType": "uint16", "name": "referral", "type": "uint16" }
464
+ ],
465
+ "name": "mint",
466
+ "outputs": [
467
+ { "internalType": "uint256", "name": "assets", "type": "uint256" }
468
+ ],
469
+ "stateMutability": "nonpayable",
470
+ "type": "function"
471
+ },
472
+ {
473
+ "inputs": [
474
+ { "internalType": "uint256", "name": "shares", "type": "uint256" },
475
+ { "internalType": "address", "name": "receiver", "type": "address" }
476
+ ],
477
+ "name": "mint",
478
+ "outputs": [
479
+ { "internalType": "uint256", "name": "assets", "type": "uint256" }
480
+ ],
481
+ "stateMutability": "nonpayable",
482
+ "type": "function"
483
+ },
484
+ {
485
+ "inputs": [],
486
+ "name": "name",
487
+ "outputs": [{ "internalType": "string", "name": "", "type": "string" }],
488
+ "stateMutability": "view",
489
+ "type": "function"
490
+ },
491
+ {
492
+ "inputs": [{ "internalType": "address", "name": "", "type": "address" }],
493
+ "name": "nonces",
494
+ "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
495
+ "stateMutability": "view",
496
+ "type": "function"
497
+ },
498
+ {
499
+ "inputs": [
500
+ { "internalType": "address", "name": "owner", "type": "address" },
501
+ { "internalType": "address", "name": "spender", "type": "address" },
502
+ { "internalType": "uint256", "name": "value", "type": "uint256" },
503
+ { "internalType": "uint256", "name": "deadline", "type": "uint256" },
504
+ { "internalType": "bytes", "name": "signature", "type": "bytes" }
505
+ ],
506
+ "name": "permit",
507
+ "outputs": [],
508
+ "stateMutability": "nonpayable",
509
+ "type": "function"
510
+ },
511
+ {
512
+ "inputs": [
513
+ { "internalType": "address", "name": "owner", "type": "address" },
514
+ { "internalType": "address", "name": "spender", "type": "address" },
515
+ { "internalType": "uint256", "name": "value", "type": "uint256" },
516
+ { "internalType": "uint256", "name": "deadline", "type": "uint256" },
517
+ { "internalType": "uint8", "name": "v", "type": "uint8" },
518
+ { "internalType": "bytes32", "name": "r", "type": "bytes32" },
519
+ { "internalType": "bytes32", "name": "s", "type": "bytes32" }
520
+ ],
521
+ "name": "permit",
522
+ "outputs": [],
523
+ "stateMutability": "nonpayable",
524
+ "type": "function"
525
+ },
526
+ {
527
+ "inputs": [
528
+ { "internalType": "uint256", "name": "assets", "type": "uint256" }
529
+ ],
530
+ "name": "previewDeposit",
531
+ "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
532
+ "stateMutability": "view",
533
+ "type": "function"
534
+ },
535
+ {
536
+ "inputs": [
537
+ { "internalType": "uint256", "name": "shares", "type": "uint256" }
538
+ ],
539
+ "name": "previewMint",
540
+ "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
541
+ "stateMutability": "view",
542
+ "type": "function"
543
+ },
544
+ {
545
+ "inputs": [
546
+ { "internalType": "uint256", "name": "shares", "type": "uint256" }
547
+ ],
548
+ "name": "previewRedeem",
549
+ "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
550
+ "stateMutability": "view",
551
+ "type": "function"
552
+ },
553
+ {
554
+ "inputs": [
555
+ { "internalType": "uint256", "name": "assets", "type": "uint256" }
556
+ ],
557
+ "name": "previewWithdraw",
558
+ "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
559
+ "stateMutability": "view",
560
+ "type": "function"
561
+ },
562
+ {
563
+ "inputs": [],
564
+ "name": "proxiableUUID",
565
+ "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }],
566
+ "stateMutability": "view",
567
+ "type": "function"
568
+ },
569
+ {
570
+ "inputs": [
571
+ { "internalType": "uint256", "name": "shares", "type": "uint256" },
572
+ { "internalType": "address", "name": "receiver", "type": "address" },
573
+ { "internalType": "address", "name": "owner", "type": "address" }
574
+ ],
575
+ "name": "redeem",
576
+ "outputs": [
577
+ { "internalType": "uint256", "name": "assets", "type": "uint256" }
578
+ ],
579
+ "stateMutability": "nonpayable",
580
+ "type": "function"
581
+ },
582
+ {
583
+ "inputs": [{ "internalType": "address", "name": "usr", "type": "address" }],
584
+ "name": "rely",
585
+ "outputs": [],
586
+ "stateMutability": "nonpayable",
587
+ "type": "function"
588
+ },
589
+ {
590
+ "inputs": [],
591
+ "name": "rho",
592
+ "outputs": [{ "internalType": "uint64", "name": "", "type": "uint64" }],
593
+ "stateMutability": "view",
594
+ "type": "function"
595
+ },
596
+ {
597
+ "inputs": [],
598
+ "name": "ssr",
599
+ "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
600
+ "stateMutability": "view",
601
+ "type": "function"
602
+ },
603
+ {
604
+ "inputs": [],
605
+ "name": "symbol",
606
+ "outputs": [{ "internalType": "string", "name": "", "type": "string" }],
607
+ "stateMutability": "view",
608
+ "type": "function"
609
+ },
610
+ {
611
+ "inputs": [],
612
+ "name": "totalAssets",
613
+ "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
614
+ "stateMutability": "view",
615
+ "type": "function"
616
+ },
617
+ {
618
+ "inputs": [],
619
+ "name": "totalSupply",
620
+ "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
621
+ "stateMutability": "view",
622
+ "type": "function"
623
+ },
624
+ {
625
+ "inputs": [
626
+ { "internalType": "address", "name": "to", "type": "address" },
627
+ { "internalType": "uint256", "name": "value", "type": "uint256" }
628
+ ],
629
+ "name": "transfer",
630
+ "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
631
+ "stateMutability": "nonpayable",
632
+ "type": "function"
633
+ },
634
+ {
635
+ "inputs": [
636
+ { "internalType": "address", "name": "from", "type": "address" },
637
+ { "internalType": "address", "name": "to", "type": "address" },
638
+ { "internalType": "uint256", "name": "value", "type": "uint256" }
639
+ ],
640
+ "name": "transferFrom",
641
+ "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
642
+ "stateMutability": "nonpayable",
643
+ "type": "function"
644
+ },
645
+ {
646
+ "inputs": [
647
+ {
648
+ "internalType": "address",
649
+ "name": "newImplementation",
650
+ "type": "address"
651
+ },
652
+ { "internalType": "bytes", "name": "data", "type": "bytes" }
653
+ ],
654
+ "name": "upgradeToAndCall",
655
+ "outputs": [],
656
+ "stateMutability": "payable",
657
+ "type": "function"
658
+ },
659
+ {
660
+ "inputs": [],
661
+ "name": "usds",
662
+ "outputs": [
663
+ { "internalType": "contract UsdsLike", "name": "", "type": "address" }
664
+ ],
665
+ "stateMutability": "view",
666
+ "type": "function"
667
+ },
668
+ {
669
+ "inputs": [],
670
+ "name": "usdsJoin",
671
+ "outputs": [
672
+ { "internalType": "contract UsdsJoinLike", "name": "", "type": "address" }
673
+ ],
674
+ "stateMutability": "view",
675
+ "type": "function"
676
+ },
677
+ {
678
+ "inputs": [],
679
+ "name": "vat",
680
+ "outputs": [
681
+ { "internalType": "contract VatLike", "name": "", "type": "address" }
682
+ ],
683
+ "stateMutability": "view",
684
+ "type": "function"
685
+ },
686
+ {
687
+ "inputs": [],
688
+ "name": "version",
689
+ "outputs": [{ "internalType": "string", "name": "", "type": "string" }],
690
+ "stateMutability": "view",
691
+ "type": "function"
692
+ },
693
+ {
694
+ "inputs": [],
695
+ "name": "vow",
696
+ "outputs": [{ "internalType": "address", "name": "", "type": "address" }],
697
+ "stateMutability": "view",
698
+ "type": "function"
699
+ },
700
+ {
701
+ "inputs": [{ "internalType": "address", "name": "", "type": "address" }],
702
+ "name": "wards",
703
+ "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
704
+ "stateMutability": "view",
705
+ "type": "function"
706
+ },
707
+ {
708
+ "inputs": [
709
+ { "internalType": "uint256", "name": "assets", "type": "uint256" },
710
+ { "internalType": "address", "name": "receiver", "type": "address" },
711
+ { "internalType": "address", "name": "owner", "type": "address" }
712
+ ],
713
+ "name": "withdraw",
714
+ "outputs": [
715
+ { "internalType": "uint256", "name": "shares", "type": "uint256" }
716
+ ],
717
+ "stateMutability": "nonpayable",
718
+ "type": "function"
719
+ }
720
+ ]
@@ -27,6 +27,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
29
  exports.UsualBond = void 0;
30
+ const constants_1 = require("../../constants");
30
31
  const CALLDATA_GAS_COST = __importStar(require("../../calldata-gas-cost"));
31
32
  const utils_1 = require("../../utils");
32
33
  const simple_exchange_1 = require("../simple-exchange");
@@ -86,6 +87,9 @@ class UsualBond extends simple_exchange_1.SimpleExchange {
86
87
  return [];
87
88
  }
88
89
  async getPricesVolume(srcToken, destToken, amounts, side, blockNumber, limitPools) {
90
+ if (side === constants_1.SwapSide.BUY) {
91
+ return null;
92
+ }
89
93
  const isUSD0SwapToken = this.is_usd0_swap_token(srcToken.address, destToken.address);
90
94
  if (!isUSD0SwapToken) {
91
95
  return null;
@@ -131,7 +135,8 @@ class UsualBond extends simple_exchange_1.SimpleExchange {
131
135
  throw new Error('LOGIC ERROR');
132
136
  }
133
137
  async getTopPoolsForToken(tokenAddress, limit) {
134
- if (!this.is_usd0(tokenAddress))
138
+ const isUsd0 = this.is_usd0(tokenAddress);
139
+ if (!isUsd0 && !this.is_usd0pp(tokenAddress))
135
140
  return [];
136
141
  return [
137
142
  {
@@ -140,7 +145,9 @@ class UsualBond extends simple_exchange_1.SimpleExchange {
140
145
  connectorTokens: [
141
146
  {
142
147
  decimals: 18,
143
- address: this.config.usd0ppAddress,
148
+ address: isUsd0
149
+ ? this.config.usd0ppAddress
150
+ : this.config.usd0Address,
144
151
  },
145
152
  ],
146
153
  liquidityUSD: 1000000000, // Just returning a big number so this DEX will be preferred
@@ -1 +1 @@
1
- {"version":3,"file":"usual-bond.js","sourceRoot":"","sources":["../../../src/dex/usual-bond/usual-bond.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYA,2EAA6D;AAC7D,uCAAoD;AAIpD,wDAAoD;AACpD,qCAA2C;AAC3C,4CAA6D;AAC7D,2FAA8D;AAC9D,6DAAiD;AAEjD,MAAa,SAAU,SAAQ,gCAAc;IAa3C,YACW,OAAgB,EAChB,MAAc,EACd,SAAqB;QAE9B,KAAK,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;QAJhB,YAAO,GAAP,OAAO,CAAS;QAChB,WAAM,GAAN,MAAM,CAAQ;QACd,cAAS,GAAT,SAAS,CAAY;QAbvB,iCAA4B,GAAG,IAAI,CAAC;QACpC,mBAAc,GAAG,KAAK,CA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C1B,YAAY;gBACZ,cAAc,EAAE,IAAI,CAAC,MAAM,CAAC,aAAa;gBACzC,eAAe,EAAE,SAAS;aAC3B,CAAC;SACH;QACD,MAAM,IAAI,KAAK,CAAC,aAAa,CAAC,CAAC;IACjC,CAAC;IAED,KAAK,CAAC,mBAAmB,CACvB,YAAqB,EACrB,KAAa;QAEb,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;QAC1C,IAAI,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC;YAAE,OAAO,EAAE,CAAC;QAExD,OAAO;YACL;gBACE,QAAQ,EAAE,IAAI,CAAC,MAAM;gBACrB,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,aAAa;gBAClC,eAAe,EAAE;oBACf;wBACE,QAAQ,EAAE,EAAE;wBACZ,OAAO,EAAE,MAAM;4BACb,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,aAAa;4BAC3B,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW;qBAC5B;iBACF;gBACD,YAAY,EAAE,UAAU,EAAE,4DAA4D;aACvF;SACF,CAAC;IACJ,CAAC;;AAvLH,8BAwLC;AAjLe,4BAAkB,GAC9B,IAAA,6BAAqB,EAAC,wBAAe,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paraswap/dex-lib",
3
- "version": "3.8.36-usual",
3
+ "version": "3.8.36-usual.3",
4
4
  "main": "build/index.js",
5
5
  "types": "build/index.d.ts",
6
6
  "repository": "https://github.com/paraswap/paraswap-dex-lib",
@@ -29,7 +29,6 @@ function testForNetwork(
29
29
 
30
30
  const sideToContractMethods = new Map([
31
31
  [SwapSide.SELL, [ContractMethod.swapExactAmountIn]],
32
- [SwapSide.BUY, [ContractMethod.swapExactAmountOut]],
33
32
  ]);
34
33
 
35
34
  describe(`${network}`, () => {
@@ -7,7 +7,11 @@ import { DummyDexHelper } from '../../dex-helper/index';
7
7
  import { Network, SwapSide } from '../../constants';
8
8
  import { BI_POWS } from '../../bigint-constants';
9
9
  import { UsualBond } from './usual-bond';
10
- import { checkPoolPrices, checkConstantPoolPrices } from '../../../tests/utils';
10
+ import {
11
+ checkPoolPrices,
12
+ checkConstantPoolPrices,
13
+ checkPoolsLiquidity,
14
+ } from '../../../tests/utils';
11
15
  import { Tokens } from '../../../tests/constants-e2e';
12
16
 
13
17
  async function testPricingOnNetwork(
@@ -102,5 +106,39 @@ describe('UsualBond', function () {
102
106
  '',
103
107
  );
104
108
  });
109
+
110
+ it('getTopPoolsForToken: USD0', async function () {
111
+ const tokenA = Tokens[network]['USD0'];
112
+ const dexHelper = new DummyDexHelper(network);
113
+ const usualBond = new UsualBond(network, dexKey, dexHelper);
114
+
115
+ const poolLiquidity = await usualBond.getTopPoolsForToken(
116
+ tokenA.address,
117
+ 10,
118
+ );
119
+ console.log(
120
+ `${tokenA.symbol} Top Pools:`,
121
+ JSON.stringify(poolLiquidity, null, 2),
122
+ );
123
+
124
+ checkPoolsLiquidity(poolLiquidity, tokenA.address, dexKey);
125
+ });
126
+
127
+ it('getTopPoolsForToken: USD0++', async function () {
128
+ const tokenA = Tokens[network]['USD0++'];
129
+ const dexHelper = new DummyDexHelper(network);
130
+ const usualBond = new UsualBond(network, dexKey, dexHelper);
131
+
132
+ const poolLiquidity = await usualBond.getTopPoolsForToken(
133
+ tokenA.address,
134
+ 10,
135
+ );
136
+ console.log(
137
+ `${tokenA.symbol} Top Pools:`,
138
+ JSON.stringify(poolLiquidity, null, 2),
139
+ );
140
+
141
+ checkPoolsLiquidity(poolLiquidity, tokenA.address, dexKey);
142
+ });
105
143
  });
106
144
  });
@@ -107,6 +107,10 @@ export class UsualBond extends SimpleExchange implements IDex<UsualBondData> {
107
107
  blockNumber: number,
108
108
  limitPools?: string[],
109
109
  ): Promise<null | ExchangePrices<UsualBondData>> {
110
+ if (side === SwapSide.BUY) {
111
+ return null;
112
+ }
113
+
110
114
  const isUSD0SwapToken = this.is_usd0_swap_token(
111
115
  srcToken.address,
112
116
  destToken.address,
@@ -182,7 +186,8 @@ export class UsualBond extends SimpleExchange implements IDex<UsualBondData> {
182
186
  tokenAddress: Address,
183
187
  limit: number,
184
188
  ): Promise<PoolLiquidity[]> {
185
- if (!this.is_usd0(tokenAddress)) return [];
189
+ const isUsd0 = this.is_usd0(tokenAddress);
190
+ if (!isUsd0 && !this.is_usd0pp(tokenAddress)) return [];
186
191
 
187
192
  return [
188
193
  {
@@ -191,7 +196,9 @@ export class UsualBond extends SimpleExchange implements IDex<UsualBondData> {
191
196
  connectorTokens: [
192
197
  {
193
198
  decimals: 18,
194
- address: this.config.usd0ppAddress,
199
+ address: isUsd0
200
+ ? this.config.usd0ppAddress
201
+ : this.config.usd0Address,
195
202
  },
196
203
  ],
197
204
  liquidityUSD: 1000000000, // Just returning a big number so this DEX will be preferred