@usdu-core/usdu-core 0.0.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 (107) hide show
  1. package/.claude/settings.local.json +12 -0
  2. package/.env.example +6 -0
  3. package/.prettierrc.json +7 -0
  4. package/LICENSE +674 -0
  5. package/README.md +244 -0
  6. package/contracts/curve/CurveAdapterV1.sol +310 -0
  7. package/contracts/curve/CurveAdapterV1_1.sol +198 -0
  8. package/contracts/curve/helpers/ICurveStableSwapNG.json +566 -0
  9. package/contracts/curve/helpers/ICurveStableSwapNG.sol +177 -0
  10. package/contracts/deploy/VaultDeployer.sol +110 -0
  11. package/contracts/morpho/MorphoAdapterV1.sol +255 -0
  12. package/contracts/morpho/MorphoAdapterV1_1.sol +137 -0
  13. package/contracts/morpho/MorphoAdapterV1_2.sol +126 -0
  14. package/contracts/morpho/helpers/AggregatorV3Interface.sol +24 -0
  15. package/contracts/morpho/helpers/ChainlinkDataFeedLib.sol +36 -0
  16. package/contracts/morpho/helpers/ConstantsLib.sol +20 -0
  17. package/contracts/morpho/helpers/ErrorsLib.sol +17 -0
  18. package/contracts/morpho/helpers/IERC4626.sol +6 -0
  19. package/contracts/morpho/helpers/IMetaMorphoV1_1.sol +229 -0
  20. package/contracts/morpho/helpers/IMetaMorphoV1_1Factory.sol +32 -0
  21. package/contracts/morpho/helpers/IMorpho.sol +361 -0
  22. package/contracts/morpho/helpers/IMorphoCallbacks.sol +52 -0
  23. package/contracts/morpho/helpers/IMorphoChainlinkOracleV2.sol +39 -0
  24. package/contracts/morpho/helpers/IMorphoChainlinkOracleV2Factory.sol +56 -0
  25. package/contracts/morpho/helpers/IOracle.sol +15 -0
  26. package/contracts/morpho/helpers/MarketParamsLib.sol +21 -0
  27. package/contracts/morpho/helpers/MathLib.sol +45 -0
  28. package/contracts/morpho/helpers/Morpho.sol.bak +517 -0
  29. package/contracts/morpho/helpers/MorphoChainlinkOracleV2.sol +157 -0
  30. package/contracts/morpho/helpers/PendingLib.sol +47 -0
  31. package/contracts/morpho/helpers/SharesMathLib.sol +45 -0
  32. package/contracts/morpho/helpers/VaultLib.sol +18 -0
  33. package/contracts/reward/RewardDistributionV1.sol +110 -0
  34. package/contracts/reward/RewardRouterV0.sol +63 -0
  35. package/contracts/reward/Rewards.example.json +72 -0
  36. package/contracts/stablecoin/IStablecoin.sol +211 -0
  37. package/contracts/stablecoin/IStablecoinMetadata.sol +27 -0
  38. package/contracts/stablecoin/IStablecoinModifier.sol +52 -0
  39. package/contracts/stablecoin/Stablecoin.sol +376 -0
  40. package/contracts/stablecoin/libraries/ConstantsLib.sol +13 -0
  41. package/contracts/stablecoin/libraries/ErrorsLib.sol +45 -0
  42. package/contracts/stablecoin/libraries/EventsLib.sol +74 -0
  43. package/contracts/stablecoin/libraries/PendingLib.sol +38 -0
  44. package/contracts/vault/VaultAdapterRecoverV1.sol +29 -0
  45. package/contracts/vault/VaultAdapterV1.sol +126 -0
  46. package/dist/index.d.mts +16154 -0
  47. package/dist/index.d.ts +16154 -0
  48. package/dist/index.js +21134 -0
  49. package/dist/index.mjs +21061 -0
  50. package/docs/CoreVault: Integration of new Markets.md +197 -0
  51. package/docs/CoreVault: SupplyQueue.md +11 -0
  52. package/docs/Markets USDC Vault.md +35 -0
  53. package/docs/Markets USDU Vault.md +89 -0
  54. package/docs/Markets WETH Vault.md +35 -0
  55. package/docs/Overview.drawio +117 -0
  56. package/exports/abis/curve/CurveAdapterV1.ts +599 -0
  57. package/exports/abis/curve/CurveAdapterV1_1.ts +609 -0
  58. package/exports/abis/curve/CurveAdapterV1_2.ts +721 -0
  59. package/exports/abis/curve/helper/ICurveStableSwapNG.ts +1589 -0
  60. package/exports/abis/morpho/MorphoAdapterV1.ts +516 -0
  61. package/exports/abis/morpho/MorphoAdapterV1_1.ts +489 -0
  62. package/exports/abis/morpho/MorphoAdapterV1_2.ts +459 -0
  63. package/exports/abis/morpho/helper/AggregatorV3Interface.ts +113 -0
  64. package/exports/abis/morpho/helper/IMetaMorphoV1_1.ts +1483 -0
  65. package/exports/abis/morpho/helper/IMetaMorphoV1_1Base.ts +607 -0
  66. package/exports/abis/morpho/helper/IMetaMorphoV1_1StaticTyping.ts +696 -0
  67. package/exports/abis/morpho/helper/IMorpho.ts +1024 -0
  68. package/exports/abis/morpho/helper/IMorphoBase.ts +886 -0
  69. package/exports/abis/morpho/helper/IMorphoChainlinkOracleV2.ts +132 -0
  70. package/exports/abis/morpho/helper/IMorphoChainlinkOracleV2Factory.ts +109 -0
  71. package/exports/abis/morpho/helper/IMorphoFlashLoanCallback.ts +20 -0
  72. package/exports/abis/morpho/helper/IMorphoLiquidateCallback.ts +20 -0
  73. package/exports/abis/morpho/helper/IMorphoRepayCallback.ts +20 -0
  74. package/exports/abis/morpho/helper/IMorphoStaticTyping.ts +1003 -0
  75. package/exports/abis/morpho/helper/IMorphoSupplyCallback.ts +20 -0
  76. package/exports/abis/morpho/helper/IMorphoSupplyCollateralCallback.ts +20 -0
  77. package/exports/abis/morpho/helper/IMulticall.ts +21 -0
  78. package/exports/abis/morpho/helper/IOracle.ts +15 -0
  79. package/exports/abis/morpho/helper/IOwnable.ts +55 -0
  80. package/exports/abis/morpho/helper/MorphoChainlinkOracleV2.ts +188 -0
  81. package/exports/abis/openzeppelin/ERC20.ts +310 -0
  82. package/exports/abis/openzeppelin/ERC20Permit.ts +520 -0
  83. package/exports/abis/openzeppelin/IERC20.ts +185 -0
  84. package/exports/abis/openzeppelin/IERC20Metadata.ts +224 -0
  85. package/exports/abis/openzeppelin/IERC20Permit.ts +77 -0
  86. package/exports/abis/openzeppelin/IERC4626.ts +614 -0
  87. package/exports/abis/reward/RewardDistributionV1.ts +246 -0
  88. package/exports/abis/stablecoin/ErrorsLib.ts +114 -0
  89. package/exports/abis/stablecoin/EventsLib.ts +372 -0
  90. package/exports/abis/stablecoin/IStablecoin.ts +642 -0
  91. package/exports/abis/stablecoin/IStablecoinMetadata.ts +856 -0
  92. package/exports/abis/stablecoin/IStablecoinModifier.ts +15 -0
  93. package/exports/abis/stablecoin/Stablecoin.ts +1922 -0
  94. package/exports/abis/termmax/ITermMaxVault.ts +2335 -0
  95. package/exports/abis/vault/VaultAdapterRecoverV1.ts +490 -0
  96. package/exports/abis/vault/VaultAdapterV1.ts +459 -0
  97. package/exports/address.config.ts +113 -0
  98. package/exports/address.types.ts +130 -0
  99. package/exports/index.ts +61 -0
  100. package/hardhat.config.ts +231 -0
  101. package/helper/store.args.ts +17 -0
  102. package/helper/wallet.info.ts +3 -0
  103. package/helper/wallet.ts +41 -0
  104. package/install-macos.sh +46 -0
  105. package/package.json +73 -0
  106. package/tsconfig.json +15 -0
  107. package/tsup.config.ts +10 -0
@@ -0,0 +1,609 @@
1
+ export const CurveAdapterV1_1_ABI = [
2
+ {
3
+ inputs: [
4
+ {
5
+ internalType: 'contract ICurveStableSwapNG',
6
+ name: '_pool',
7
+ type: 'address',
8
+ },
9
+ {
10
+ internalType: 'uint256',
11
+ name: '_idxS',
12
+ type: 'uint256',
13
+ },
14
+ {
15
+ internalType: 'uint256',
16
+ name: '_idxC',
17
+ type: 'uint256',
18
+ },
19
+ {
20
+ internalType: 'address[5]',
21
+ name: '_receivers',
22
+ type: 'address[5]',
23
+ },
24
+ {
25
+ internalType: 'uint32[5]',
26
+ name: '_weights',
27
+ type: 'uint32[5]',
28
+ },
29
+ ],
30
+ stateMutability: 'nonpayable',
31
+ type: 'constructor',
32
+ },
33
+ {
34
+ inputs: [],
35
+ name: 'AlreadyPending',
36
+ type: 'error',
37
+ },
38
+ {
39
+ inputs: [
40
+ {
41
+ internalType: 'uint256[]',
42
+ name: 'balances',
43
+ type: 'uint256[]',
44
+ },
45
+ ],
46
+ name: 'ImbalancedVariant',
47
+ type: 'error',
48
+ },
49
+ {
50
+ inputs: [],
51
+ name: 'NoPendingValue',
52
+ type: 'error',
53
+ },
54
+ {
55
+ inputs: [],
56
+ name: 'NotProfitable',
57
+ type: 'error',
58
+ },
59
+ {
60
+ inputs: [
61
+ {
62
+ internalType: 'address',
63
+ name: 'token',
64
+ type: 'address',
65
+ },
66
+ ],
67
+ name: 'SafeERC20FailedOperation',
68
+ type: 'error',
69
+ },
70
+ {
71
+ inputs: [],
72
+ name: 'TimelockNotElapsed',
73
+ type: 'error',
74
+ },
75
+ {
76
+ anonymous: false,
77
+ inputs: [
78
+ {
79
+ indexed: true,
80
+ internalType: 'address',
81
+ name: 'sender',
82
+ type: 'address',
83
+ },
84
+ {
85
+ indexed: false,
86
+ internalType: 'uint256',
87
+ name: 'minted',
88
+ type: 'uint256',
89
+ },
90
+ {
91
+ indexed: false,
92
+ internalType: 'uint256',
93
+ name: 'totalMinted',
94
+ type: 'uint256',
95
+ },
96
+ {
97
+ indexed: false,
98
+ internalType: 'uint256',
99
+ name: 'sharesMinted',
100
+ type: 'uint256',
101
+ },
102
+ {
103
+ indexed: false,
104
+ internalType: 'uint256',
105
+ name: 'totalShares',
106
+ type: 'uint256',
107
+ },
108
+ ],
109
+ name: 'AddLiquidity',
110
+ type: 'event',
111
+ },
112
+ {
113
+ anonymous: false,
114
+ inputs: [
115
+ {
116
+ indexed: true,
117
+ internalType: 'address',
118
+ name: 'receiver',
119
+ type: 'address',
120
+ },
121
+ {
122
+ indexed: false,
123
+ internalType: 'uint256',
124
+ name: 'amount',
125
+ type: 'uint256',
126
+ },
127
+ {
128
+ indexed: false,
129
+ internalType: 'uint256',
130
+ name: 'ratio',
131
+ type: 'uint256',
132
+ },
133
+ ],
134
+ name: 'Distribution',
135
+ type: 'event',
136
+ },
137
+ {
138
+ anonymous: false,
139
+ inputs: [
140
+ {
141
+ indexed: true,
142
+ internalType: 'address',
143
+ name: 'sender',
144
+ type: 'address',
145
+ },
146
+ {
147
+ indexed: false,
148
+ internalType: 'uint256',
149
+ name: 'burned',
150
+ type: 'uint256',
151
+ },
152
+ {
153
+ indexed: false,
154
+ internalType: 'uint256',
155
+ name: 'totalMinted',
156
+ type: 'uint256',
157
+ },
158
+ {
159
+ indexed: false,
160
+ internalType: 'uint256',
161
+ name: 'sharesBurned',
162
+ type: 'uint256',
163
+ },
164
+ {
165
+ indexed: false,
166
+ internalType: 'uint256',
167
+ name: 'totalShares',
168
+ type: 'uint256',
169
+ },
170
+ ],
171
+ name: 'RemoveLiquidity',
172
+ type: 'event',
173
+ },
174
+ {
175
+ anonymous: false,
176
+ inputs: [
177
+ {
178
+ indexed: false,
179
+ internalType: 'uint256',
180
+ name: 'amount',
181
+ type: 'uint256',
182
+ },
183
+ {
184
+ indexed: false,
185
+ internalType: 'uint256',
186
+ name: 'totalRevenue',
187
+ type: 'uint256',
188
+ },
189
+ {
190
+ indexed: false,
191
+ internalType: 'uint256',
192
+ name: 'totalMinted',
193
+ type: 'uint256',
194
+ },
195
+ ],
196
+ name: 'Revenue',
197
+ type: 'event',
198
+ },
199
+ {
200
+ anonymous: false,
201
+ inputs: [
202
+ {
203
+ indexed: true,
204
+ internalType: 'address',
205
+ name: 'caller',
206
+ type: 'address',
207
+ },
208
+ ],
209
+ name: 'RevokeDistribution',
210
+ type: 'event',
211
+ },
212
+ {
213
+ anonymous: false,
214
+ inputs: [
215
+ {
216
+ indexed: true,
217
+ internalType: 'address',
218
+ name: 'caller',
219
+ type: 'address',
220
+ },
221
+ ],
222
+ name: 'SetDistribution',
223
+ type: 'event',
224
+ },
225
+ {
226
+ anonymous: false,
227
+ inputs: [
228
+ {
229
+ indexed: true,
230
+ internalType: 'address',
231
+ name: 'caller',
232
+ type: 'address',
233
+ },
234
+ {
235
+ indexed: false,
236
+ internalType: 'address[5]',
237
+ name: 'receivers',
238
+ type: 'address[5]',
239
+ },
240
+ {
241
+ indexed: false,
242
+ internalType: 'uint32[5]',
243
+ name: 'weights',
244
+ type: 'uint32[5]',
245
+ },
246
+ {
247
+ indexed: false,
248
+ internalType: 'uint256',
249
+ name: 'timelock',
250
+ type: 'uint256',
251
+ },
252
+ ],
253
+ name: 'SubmitDistribution',
254
+ type: 'event',
255
+ },
256
+ {
257
+ inputs: [
258
+ {
259
+ internalType: 'uint256',
260
+ name: 'amount',
261
+ type: 'uint256',
262
+ },
263
+ {
264
+ internalType: 'uint256',
265
+ name: 'minShares',
266
+ type: 'uint256',
267
+ },
268
+ ],
269
+ name: 'addLiquidity',
270
+ outputs: [
271
+ {
272
+ internalType: 'uint256',
273
+ name: '',
274
+ type: 'uint256',
275
+ },
276
+ ],
277
+ stateMutability: 'nonpayable',
278
+ type: 'function',
279
+ },
280
+ {
281
+ inputs: [],
282
+ name: 'applyDistribution',
283
+ outputs: [],
284
+ stateMutability: 'nonpayable',
285
+ type: 'function',
286
+ },
287
+ {
288
+ inputs: [
289
+ {
290
+ internalType: 'uint256',
291
+ name: 'beforeLP',
292
+ type: 'uint256',
293
+ },
294
+ {
295
+ internalType: 'uint256',
296
+ name: 'afterLP',
297
+ type: 'uint256',
298
+ },
299
+ {
300
+ internalType: 'uint256',
301
+ name: 'split',
302
+ type: 'uint256',
303
+ },
304
+ ],
305
+ name: 'calcProfitability',
306
+ outputs: [
307
+ {
308
+ internalType: 'uint256',
309
+ name: '',
310
+ type: 'uint256',
311
+ },
312
+ ],
313
+ stateMutability: 'view',
314
+ type: 'function',
315
+ },
316
+ {
317
+ inputs: [],
318
+ name: 'checkImbalance',
319
+ outputs: [
320
+ {
321
+ internalType: 'bool',
322
+ name: '',
323
+ type: 'bool',
324
+ },
325
+ ],
326
+ stateMutability: 'view',
327
+ type: 'function',
328
+ },
329
+ {
330
+ inputs: [],
331
+ name: 'coin',
332
+ outputs: [
333
+ {
334
+ internalType: 'contract IERC20Metadata',
335
+ name: '',
336
+ type: 'address',
337
+ },
338
+ ],
339
+ stateMutability: 'view',
340
+ type: 'function',
341
+ },
342
+ {
343
+ inputs: [],
344
+ name: 'idxC',
345
+ outputs: [
346
+ {
347
+ internalType: 'uint256',
348
+ name: '',
349
+ type: 'uint256',
350
+ },
351
+ ],
352
+ stateMutability: 'view',
353
+ type: 'function',
354
+ },
355
+ {
356
+ inputs: [],
357
+ name: 'idxS',
358
+ outputs: [
359
+ {
360
+ internalType: 'uint256',
361
+ name: '',
362
+ type: 'uint256',
363
+ },
364
+ ],
365
+ stateMutability: 'view',
366
+ type: 'function',
367
+ },
368
+ {
369
+ inputs: [],
370
+ name: 'payOffDebt',
371
+ outputs: [],
372
+ stateMutability: 'nonpayable',
373
+ type: 'function',
374
+ },
375
+ {
376
+ inputs: [
377
+ {
378
+ internalType: 'uint256',
379
+ name: '',
380
+ type: 'uint256',
381
+ },
382
+ ],
383
+ name: 'pendingReceivers',
384
+ outputs: [
385
+ {
386
+ internalType: 'address',
387
+ name: '',
388
+ type: 'address',
389
+ },
390
+ ],
391
+ stateMutability: 'view',
392
+ type: 'function',
393
+ },
394
+ {
395
+ inputs: [],
396
+ name: 'pendingValidAt',
397
+ outputs: [
398
+ {
399
+ internalType: 'uint256',
400
+ name: '',
401
+ type: 'uint256',
402
+ },
403
+ ],
404
+ stateMutability: 'view',
405
+ type: 'function',
406
+ },
407
+ {
408
+ inputs: [
409
+ {
410
+ internalType: 'uint256',
411
+ name: '',
412
+ type: 'uint256',
413
+ },
414
+ ],
415
+ name: 'pendingWeights',
416
+ outputs: [
417
+ {
418
+ internalType: 'uint32',
419
+ name: '',
420
+ type: 'uint32',
421
+ },
422
+ ],
423
+ stateMutability: 'view',
424
+ type: 'function',
425
+ },
426
+ {
427
+ inputs: [],
428
+ name: 'pool',
429
+ outputs: [
430
+ {
431
+ internalType: 'contract ICurveStableSwapNG',
432
+ name: '',
433
+ type: 'address',
434
+ },
435
+ ],
436
+ stateMutability: 'view',
437
+ type: 'function',
438
+ },
439
+ {
440
+ inputs: [
441
+ {
442
+ internalType: 'uint256',
443
+ name: '',
444
+ type: 'uint256',
445
+ },
446
+ ],
447
+ name: 'receivers',
448
+ outputs: [
449
+ {
450
+ internalType: 'address',
451
+ name: '',
452
+ type: 'address',
453
+ },
454
+ ],
455
+ stateMutability: 'view',
456
+ type: 'function',
457
+ },
458
+ {
459
+ inputs: [
460
+ {
461
+ internalType: 'uint256',
462
+ name: 'shares',
463
+ type: 'uint256',
464
+ },
465
+ {
466
+ internalType: 'uint256',
467
+ name: 'minAmount',
468
+ type: 'uint256',
469
+ },
470
+ ],
471
+ name: 'redeem',
472
+ outputs: [],
473
+ stateMutability: 'nonpayable',
474
+ type: 'function',
475
+ },
476
+ {
477
+ inputs: [
478
+ {
479
+ internalType: 'uint256',
480
+ name: 'shares',
481
+ type: 'uint256',
482
+ },
483
+ {
484
+ internalType: 'uint256',
485
+ name: 'minAmount',
486
+ type: 'uint256',
487
+ },
488
+ ],
489
+ name: 'removeLiquidity',
490
+ outputs: [
491
+ {
492
+ internalType: 'uint256',
493
+ name: '',
494
+ type: 'uint256',
495
+ },
496
+ ],
497
+ stateMutability: 'nonpayable',
498
+ type: 'function',
499
+ },
500
+ {
501
+ inputs: [],
502
+ name: 'revokePendingDistribution',
503
+ outputs: [],
504
+ stateMutability: 'nonpayable',
505
+ type: 'function',
506
+ },
507
+ {
508
+ inputs: [
509
+ {
510
+ internalType: 'address[5]',
511
+ name: '_receivers',
512
+ type: 'address[5]',
513
+ },
514
+ {
515
+ internalType: 'uint32[5]',
516
+ name: '_weights',
517
+ type: 'uint32[5]',
518
+ },
519
+ ],
520
+ name: 'setDistribution',
521
+ outputs: [],
522
+ stateMutability: 'nonpayable',
523
+ type: 'function',
524
+ },
525
+ {
526
+ inputs: [],
527
+ name: 'stable',
528
+ outputs: [
529
+ {
530
+ internalType: 'contract Stablecoin',
531
+ name: '',
532
+ type: 'address',
533
+ },
534
+ ],
535
+ stateMutability: 'view',
536
+ type: 'function',
537
+ },
538
+ {
539
+ inputs: [],
540
+ name: 'totalMinted',
541
+ outputs: [
542
+ {
543
+ internalType: 'uint256',
544
+ name: '',
545
+ type: 'uint256',
546
+ },
547
+ ],
548
+ stateMutability: 'view',
549
+ type: 'function',
550
+ },
551
+ {
552
+ inputs: [],
553
+ name: 'totalRevenue',
554
+ outputs: [
555
+ {
556
+ internalType: 'uint256',
557
+ name: '',
558
+ type: 'uint256',
559
+ },
560
+ ],
561
+ stateMutability: 'view',
562
+ type: 'function',
563
+ },
564
+ {
565
+ inputs: [],
566
+ name: 'totalWeights',
567
+ outputs: [
568
+ {
569
+ internalType: 'uint256',
570
+ name: '',
571
+ type: 'uint256',
572
+ },
573
+ ],
574
+ stateMutability: 'view',
575
+ type: 'function',
576
+ },
577
+ {
578
+ inputs: [
579
+ {
580
+ internalType: 'bool',
581
+ name: 'state',
582
+ type: 'bool',
583
+ },
584
+ ],
585
+ name: 'verifyImbalance',
586
+ outputs: [],
587
+ stateMutability: 'view',
588
+ type: 'function',
589
+ },
590
+ {
591
+ inputs: [
592
+ {
593
+ internalType: 'uint256',
594
+ name: '',
595
+ type: 'uint256',
596
+ },
597
+ ],
598
+ name: 'weights',
599
+ outputs: [
600
+ {
601
+ internalType: 'uint32',
602
+ name: '',
603
+ type: 'uint32',
604
+ },
605
+ ],
606
+ stateMutability: 'view',
607
+ type: 'function',
608
+ },
609
+ ] as const;