@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,599 @@
1
+ export const CurveAdapterV1_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
+ "stateMutability": "nonpayable",
21
+ "type": "constructor"
22
+ },
23
+ {
24
+ "inputs": [],
25
+ "name": "AlreadyPending",
26
+ "type": "error"
27
+ },
28
+ {
29
+ "inputs": [
30
+ {
31
+ "internalType": "uint256[]",
32
+ "name": "balances",
33
+ "type": "uint256[]"
34
+ }
35
+ ],
36
+ "name": "ImbalancedVariant",
37
+ "type": "error"
38
+ },
39
+ {
40
+ "inputs": [],
41
+ "name": "NoPendingValue",
42
+ "type": "error"
43
+ },
44
+ {
45
+ "inputs": [],
46
+ "name": "NotProfitable",
47
+ "type": "error"
48
+ },
49
+ {
50
+ "inputs": [
51
+ {
52
+ "internalType": "address",
53
+ "name": "token",
54
+ "type": "address"
55
+ }
56
+ ],
57
+ "name": "SafeERC20FailedOperation",
58
+ "type": "error"
59
+ },
60
+ {
61
+ "inputs": [],
62
+ "name": "TimelockNotElapsed",
63
+ "type": "error"
64
+ },
65
+ {
66
+ "anonymous": false,
67
+ "inputs": [
68
+ {
69
+ "indexed": true,
70
+ "internalType": "address",
71
+ "name": "sender",
72
+ "type": "address"
73
+ },
74
+ {
75
+ "indexed": false,
76
+ "internalType": "uint256",
77
+ "name": "minted",
78
+ "type": "uint256"
79
+ },
80
+ {
81
+ "indexed": false,
82
+ "internalType": "uint256",
83
+ "name": "totalMinted",
84
+ "type": "uint256"
85
+ },
86
+ {
87
+ "indexed": false,
88
+ "internalType": "uint256",
89
+ "name": "sharesMinted",
90
+ "type": "uint256"
91
+ },
92
+ {
93
+ "indexed": false,
94
+ "internalType": "uint256",
95
+ "name": "totalShares",
96
+ "type": "uint256"
97
+ }
98
+ ],
99
+ "name": "AddLiquidity",
100
+ "type": "event"
101
+ },
102
+ {
103
+ "anonymous": false,
104
+ "inputs": [
105
+ {
106
+ "indexed": true,
107
+ "internalType": "address",
108
+ "name": "receiver",
109
+ "type": "address"
110
+ },
111
+ {
112
+ "indexed": false,
113
+ "internalType": "uint256",
114
+ "name": "amount",
115
+ "type": "uint256"
116
+ },
117
+ {
118
+ "indexed": false,
119
+ "internalType": "uint256",
120
+ "name": "ratio",
121
+ "type": "uint256"
122
+ }
123
+ ],
124
+ "name": "Distribution",
125
+ "type": "event"
126
+ },
127
+ {
128
+ "anonymous": false,
129
+ "inputs": [
130
+ {
131
+ "indexed": true,
132
+ "internalType": "address",
133
+ "name": "sender",
134
+ "type": "address"
135
+ },
136
+ {
137
+ "indexed": false,
138
+ "internalType": "uint256",
139
+ "name": "burned",
140
+ "type": "uint256"
141
+ },
142
+ {
143
+ "indexed": false,
144
+ "internalType": "uint256",
145
+ "name": "totalMinted",
146
+ "type": "uint256"
147
+ },
148
+ {
149
+ "indexed": false,
150
+ "internalType": "uint256",
151
+ "name": "sharesBurned",
152
+ "type": "uint256"
153
+ },
154
+ {
155
+ "indexed": false,
156
+ "internalType": "uint256",
157
+ "name": "totalShares",
158
+ "type": "uint256"
159
+ }
160
+ ],
161
+ "name": "RemoveLiquidity",
162
+ "type": "event"
163
+ },
164
+ {
165
+ "anonymous": false,
166
+ "inputs": [
167
+ {
168
+ "indexed": false,
169
+ "internalType": "uint256",
170
+ "name": "amount",
171
+ "type": "uint256"
172
+ },
173
+ {
174
+ "indexed": false,
175
+ "internalType": "uint256",
176
+ "name": "totalRevenue",
177
+ "type": "uint256"
178
+ },
179
+ {
180
+ "indexed": false,
181
+ "internalType": "uint256",
182
+ "name": "totalMinted",
183
+ "type": "uint256"
184
+ }
185
+ ],
186
+ "name": "Revenue",
187
+ "type": "event"
188
+ },
189
+ {
190
+ "anonymous": false,
191
+ "inputs": [
192
+ {
193
+ "indexed": true,
194
+ "internalType": "address",
195
+ "name": "caller",
196
+ "type": "address"
197
+ }
198
+ ],
199
+ "name": "RevokeDistribution",
200
+ "type": "event"
201
+ },
202
+ {
203
+ "anonymous": false,
204
+ "inputs": [
205
+ {
206
+ "indexed": true,
207
+ "internalType": "address",
208
+ "name": "caller",
209
+ "type": "address"
210
+ }
211
+ ],
212
+ "name": "SetDistribution",
213
+ "type": "event"
214
+ },
215
+ {
216
+ "anonymous": false,
217
+ "inputs": [
218
+ {
219
+ "indexed": true,
220
+ "internalType": "address",
221
+ "name": "caller",
222
+ "type": "address"
223
+ },
224
+ {
225
+ "indexed": false,
226
+ "internalType": "address[5]",
227
+ "name": "receivers",
228
+ "type": "address[5]"
229
+ },
230
+ {
231
+ "indexed": false,
232
+ "internalType": "uint32[5]",
233
+ "name": "weights",
234
+ "type": "uint32[5]"
235
+ },
236
+ {
237
+ "indexed": false,
238
+ "internalType": "uint256",
239
+ "name": "timelock",
240
+ "type": "uint256"
241
+ }
242
+ ],
243
+ "name": "SubmitDistribution",
244
+ "type": "event"
245
+ },
246
+ {
247
+ "inputs": [
248
+ {
249
+ "internalType": "uint256",
250
+ "name": "amount",
251
+ "type": "uint256"
252
+ },
253
+ {
254
+ "internalType": "uint256",
255
+ "name": "minShares",
256
+ "type": "uint256"
257
+ }
258
+ ],
259
+ "name": "addLiquidity",
260
+ "outputs": [
261
+ {
262
+ "internalType": "uint256",
263
+ "name": "",
264
+ "type": "uint256"
265
+ }
266
+ ],
267
+ "stateMutability": "nonpayable",
268
+ "type": "function"
269
+ },
270
+ {
271
+ "inputs": [],
272
+ "name": "applyDistribution",
273
+ "outputs": [],
274
+ "stateMutability": "nonpayable",
275
+ "type": "function"
276
+ },
277
+ {
278
+ "inputs": [
279
+ {
280
+ "internalType": "uint256",
281
+ "name": "beforeLP",
282
+ "type": "uint256"
283
+ },
284
+ {
285
+ "internalType": "uint256",
286
+ "name": "afterLP",
287
+ "type": "uint256"
288
+ },
289
+ {
290
+ "internalType": "uint256",
291
+ "name": "split",
292
+ "type": "uint256"
293
+ }
294
+ ],
295
+ "name": "calcProfitability",
296
+ "outputs": [
297
+ {
298
+ "internalType": "uint256",
299
+ "name": "",
300
+ "type": "uint256"
301
+ }
302
+ ],
303
+ "stateMutability": "view",
304
+ "type": "function"
305
+ },
306
+ {
307
+ "inputs": [],
308
+ "name": "checkImbalance",
309
+ "outputs": [
310
+ {
311
+ "internalType": "bool",
312
+ "name": "",
313
+ "type": "bool"
314
+ }
315
+ ],
316
+ "stateMutability": "view",
317
+ "type": "function"
318
+ },
319
+ {
320
+ "inputs": [],
321
+ "name": "coin",
322
+ "outputs": [
323
+ {
324
+ "internalType": "contract IERC20Metadata",
325
+ "name": "",
326
+ "type": "address"
327
+ }
328
+ ],
329
+ "stateMutability": "view",
330
+ "type": "function"
331
+ },
332
+ {
333
+ "inputs": [],
334
+ "name": "idxC",
335
+ "outputs": [
336
+ {
337
+ "internalType": "uint256",
338
+ "name": "",
339
+ "type": "uint256"
340
+ }
341
+ ],
342
+ "stateMutability": "view",
343
+ "type": "function"
344
+ },
345
+ {
346
+ "inputs": [],
347
+ "name": "idxS",
348
+ "outputs": [
349
+ {
350
+ "internalType": "uint256",
351
+ "name": "",
352
+ "type": "uint256"
353
+ }
354
+ ],
355
+ "stateMutability": "view",
356
+ "type": "function"
357
+ },
358
+ {
359
+ "inputs": [],
360
+ "name": "payOffDebt",
361
+ "outputs": [],
362
+ "stateMutability": "nonpayable",
363
+ "type": "function"
364
+ },
365
+ {
366
+ "inputs": [
367
+ {
368
+ "internalType": "uint256",
369
+ "name": "",
370
+ "type": "uint256"
371
+ }
372
+ ],
373
+ "name": "pendingReceivers",
374
+ "outputs": [
375
+ {
376
+ "internalType": "address",
377
+ "name": "",
378
+ "type": "address"
379
+ }
380
+ ],
381
+ "stateMutability": "view",
382
+ "type": "function"
383
+ },
384
+ {
385
+ "inputs": [],
386
+ "name": "pendingValidAt",
387
+ "outputs": [
388
+ {
389
+ "internalType": "uint256",
390
+ "name": "",
391
+ "type": "uint256"
392
+ }
393
+ ],
394
+ "stateMutability": "view",
395
+ "type": "function"
396
+ },
397
+ {
398
+ "inputs": [
399
+ {
400
+ "internalType": "uint256",
401
+ "name": "",
402
+ "type": "uint256"
403
+ }
404
+ ],
405
+ "name": "pendingWeights",
406
+ "outputs": [
407
+ {
408
+ "internalType": "uint32",
409
+ "name": "",
410
+ "type": "uint32"
411
+ }
412
+ ],
413
+ "stateMutability": "view",
414
+ "type": "function"
415
+ },
416
+ {
417
+ "inputs": [],
418
+ "name": "pool",
419
+ "outputs": [
420
+ {
421
+ "internalType": "contract ICurveStableSwapNG",
422
+ "name": "",
423
+ "type": "address"
424
+ }
425
+ ],
426
+ "stateMutability": "view",
427
+ "type": "function"
428
+ },
429
+ {
430
+ "inputs": [
431
+ {
432
+ "internalType": "uint256",
433
+ "name": "",
434
+ "type": "uint256"
435
+ }
436
+ ],
437
+ "name": "receivers",
438
+ "outputs": [
439
+ {
440
+ "internalType": "address",
441
+ "name": "",
442
+ "type": "address"
443
+ }
444
+ ],
445
+ "stateMutability": "view",
446
+ "type": "function"
447
+ },
448
+ {
449
+ "inputs": [
450
+ {
451
+ "internalType": "uint256",
452
+ "name": "shares",
453
+ "type": "uint256"
454
+ },
455
+ {
456
+ "internalType": "uint256",
457
+ "name": "minAmount",
458
+ "type": "uint256"
459
+ }
460
+ ],
461
+ "name": "redeem",
462
+ "outputs": [],
463
+ "stateMutability": "nonpayable",
464
+ "type": "function"
465
+ },
466
+ {
467
+ "inputs": [
468
+ {
469
+ "internalType": "uint256",
470
+ "name": "shares",
471
+ "type": "uint256"
472
+ },
473
+ {
474
+ "internalType": "uint256",
475
+ "name": "minAmount",
476
+ "type": "uint256"
477
+ }
478
+ ],
479
+ "name": "removeLiquidity",
480
+ "outputs": [
481
+ {
482
+ "internalType": "uint256",
483
+ "name": "",
484
+ "type": "uint256"
485
+ }
486
+ ],
487
+ "stateMutability": "nonpayable",
488
+ "type": "function"
489
+ },
490
+ {
491
+ "inputs": [],
492
+ "name": "revokePendingDistribution",
493
+ "outputs": [],
494
+ "stateMutability": "nonpayable",
495
+ "type": "function"
496
+ },
497
+ {
498
+ "inputs": [
499
+ {
500
+ "internalType": "address[5]",
501
+ "name": "_receivers",
502
+ "type": "address[5]"
503
+ },
504
+ {
505
+ "internalType": "uint32[5]",
506
+ "name": "_weights",
507
+ "type": "uint32[5]"
508
+ }
509
+ ],
510
+ "name": "setDistribution",
511
+ "outputs": [],
512
+ "stateMutability": "nonpayable",
513
+ "type": "function"
514
+ },
515
+ {
516
+ "inputs": [],
517
+ "name": "stable",
518
+ "outputs": [
519
+ {
520
+ "internalType": "contract Stablecoin",
521
+ "name": "",
522
+ "type": "address"
523
+ }
524
+ ],
525
+ "stateMutability": "view",
526
+ "type": "function"
527
+ },
528
+ {
529
+ "inputs": [],
530
+ "name": "totalMinted",
531
+ "outputs": [
532
+ {
533
+ "internalType": "uint256",
534
+ "name": "",
535
+ "type": "uint256"
536
+ }
537
+ ],
538
+ "stateMutability": "view",
539
+ "type": "function"
540
+ },
541
+ {
542
+ "inputs": [],
543
+ "name": "totalRevenue",
544
+ "outputs": [
545
+ {
546
+ "internalType": "uint256",
547
+ "name": "",
548
+ "type": "uint256"
549
+ }
550
+ ],
551
+ "stateMutability": "view",
552
+ "type": "function"
553
+ },
554
+ {
555
+ "inputs": [],
556
+ "name": "totalWeights",
557
+ "outputs": [
558
+ {
559
+ "internalType": "uint256",
560
+ "name": "",
561
+ "type": "uint256"
562
+ }
563
+ ],
564
+ "stateMutability": "view",
565
+ "type": "function"
566
+ },
567
+ {
568
+ "inputs": [
569
+ {
570
+ "internalType": "bool",
571
+ "name": "state",
572
+ "type": "bool"
573
+ }
574
+ ],
575
+ "name": "verifyImbalance",
576
+ "outputs": [],
577
+ "stateMutability": "view",
578
+ "type": "function"
579
+ },
580
+ {
581
+ "inputs": [
582
+ {
583
+ "internalType": "uint256",
584
+ "name": "",
585
+ "type": "uint256"
586
+ }
587
+ ],
588
+ "name": "weights",
589
+ "outputs": [
590
+ {
591
+ "internalType": "uint32",
592
+ "name": "",
593
+ "type": "uint32"
594
+ }
595
+ ],
596
+ "stateMutability": "view",
597
+ "type": "function"
598
+ }
599
+ ] as const