@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,20 @@
1
+ export const IMorphoSupplyCallback_ABI = [
2
+ {
3
+ inputs: [
4
+ {
5
+ internalType: 'uint256',
6
+ name: 'assets',
7
+ type: 'uint256',
8
+ },
9
+ {
10
+ internalType: 'bytes',
11
+ name: 'data',
12
+ type: 'bytes',
13
+ },
14
+ ],
15
+ name: 'onMorphoSupply',
16
+ outputs: [],
17
+ stateMutability: 'nonpayable',
18
+ type: 'function',
19
+ },
20
+ ] as const;
@@ -0,0 +1,20 @@
1
+ export const IMorphoSupplyCollateralCallback_ABI = [
2
+ {
3
+ inputs: [
4
+ {
5
+ internalType: 'uint256',
6
+ name: 'assets',
7
+ type: 'uint256',
8
+ },
9
+ {
10
+ internalType: 'bytes',
11
+ name: 'data',
12
+ type: 'bytes',
13
+ },
14
+ ],
15
+ name: 'onMorphoSupplyCollateral',
16
+ outputs: [],
17
+ stateMutability: 'nonpayable',
18
+ type: 'function',
19
+ },
20
+ ] as const;
@@ -0,0 +1,21 @@
1
+ export const IMulticall_ABI = [
2
+ {
3
+ inputs: [
4
+ {
5
+ internalType: 'bytes[]',
6
+ name: '',
7
+ type: 'bytes[]',
8
+ },
9
+ ],
10
+ name: 'multicall',
11
+ outputs: [
12
+ {
13
+ internalType: 'bytes[]',
14
+ name: '',
15
+ type: 'bytes[]',
16
+ },
17
+ ],
18
+ stateMutability: 'nonpayable',
19
+ type: 'function',
20
+ },
21
+ ] as const;
@@ -0,0 +1,15 @@
1
+ export const IOracle_ABI = [
2
+ {
3
+ inputs: [],
4
+ name: 'price',
5
+ outputs: [
6
+ {
7
+ internalType: 'uint256',
8
+ name: '',
9
+ type: 'uint256',
10
+ },
11
+ ],
12
+ stateMutability: 'view',
13
+ type: 'function',
14
+ },
15
+ ] as const;
@@ -0,0 +1,55 @@
1
+ export const IOwnable_ABI = [
2
+ {
3
+ inputs: [],
4
+ name: 'acceptOwnership',
5
+ outputs: [],
6
+ stateMutability: 'nonpayable',
7
+ type: 'function',
8
+ },
9
+ {
10
+ inputs: [],
11
+ name: 'owner',
12
+ outputs: [
13
+ {
14
+ internalType: 'address',
15
+ name: '',
16
+ type: 'address',
17
+ },
18
+ ],
19
+ stateMutability: 'view',
20
+ type: 'function',
21
+ },
22
+ {
23
+ inputs: [],
24
+ name: 'pendingOwner',
25
+ outputs: [
26
+ {
27
+ internalType: 'address',
28
+ name: '',
29
+ type: 'address',
30
+ },
31
+ ],
32
+ stateMutability: 'view',
33
+ type: 'function',
34
+ },
35
+ {
36
+ inputs: [],
37
+ name: 'renounceOwnership',
38
+ outputs: [],
39
+ stateMutability: 'nonpayable',
40
+ type: 'function',
41
+ },
42
+ {
43
+ inputs: [
44
+ {
45
+ internalType: 'address',
46
+ name: '',
47
+ type: 'address',
48
+ },
49
+ ],
50
+ name: 'transferOwnership',
51
+ outputs: [],
52
+ stateMutability: 'nonpayable',
53
+ type: 'function',
54
+ },
55
+ ] as const;
@@ -0,0 +1,188 @@
1
+ export const MorphoChainlinkOracleV2_ABI = [
2
+ {
3
+ inputs: [
4
+ {
5
+ internalType: 'contract IERC4626',
6
+ name: 'baseVault',
7
+ type: 'address',
8
+ },
9
+ {
10
+ internalType: 'uint256',
11
+ name: 'baseVaultConversionSample',
12
+ type: 'uint256',
13
+ },
14
+ {
15
+ internalType: 'contract AggregatorV3Interface',
16
+ name: 'baseFeed1',
17
+ type: 'address',
18
+ },
19
+ {
20
+ internalType: 'contract AggregatorV3Interface',
21
+ name: 'baseFeed2',
22
+ type: 'address',
23
+ },
24
+ {
25
+ internalType: 'uint256',
26
+ name: 'baseTokenDecimals',
27
+ type: 'uint256',
28
+ },
29
+ {
30
+ internalType: 'contract IERC4626',
31
+ name: 'quoteVault',
32
+ type: 'address',
33
+ },
34
+ {
35
+ internalType: 'uint256',
36
+ name: 'quoteVaultConversionSample',
37
+ type: 'uint256',
38
+ },
39
+ {
40
+ internalType: 'contract AggregatorV3Interface',
41
+ name: 'quoteFeed1',
42
+ type: 'address',
43
+ },
44
+ {
45
+ internalType: 'contract AggregatorV3Interface',
46
+ name: 'quoteFeed2',
47
+ type: 'address',
48
+ },
49
+ {
50
+ internalType: 'uint256',
51
+ name: 'quoteTokenDecimals',
52
+ type: 'uint256',
53
+ },
54
+ ],
55
+ stateMutability: 'nonpayable',
56
+ type: 'constructor',
57
+ },
58
+ {
59
+ inputs: [],
60
+ name: 'BASE_FEED_1',
61
+ outputs: [
62
+ {
63
+ internalType: 'contract AggregatorV3Interface',
64
+ name: '',
65
+ type: 'address',
66
+ },
67
+ ],
68
+ stateMutability: 'view',
69
+ type: 'function',
70
+ },
71
+ {
72
+ inputs: [],
73
+ name: 'BASE_FEED_2',
74
+ outputs: [
75
+ {
76
+ internalType: 'contract AggregatorV3Interface',
77
+ name: '',
78
+ type: 'address',
79
+ },
80
+ ],
81
+ stateMutability: 'view',
82
+ type: 'function',
83
+ },
84
+ {
85
+ inputs: [],
86
+ name: 'BASE_VAULT',
87
+ outputs: [
88
+ {
89
+ internalType: 'contract IERC4626',
90
+ name: '',
91
+ type: 'address',
92
+ },
93
+ ],
94
+ stateMutability: 'view',
95
+ type: 'function',
96
+ },
97
+ {
98
+ inputs: [],
99
+ name: 'BASE_VAULT_CONVERSION_SAMPLE',
100
+ outputs: [
101
+ {
102
+ internalType: 'uint256',
103
+ name: '',
104
+ type: 'uint256',
105
+ },
106
+ ],
107
+ stateMutability: 'view',
108
+ type: 'function',
109
+ },
110
+ {
111
+ inputs: [],
112
+ name: 'QUOTE_FEED_1',
113
+ outputs: [
114
+ {
115
+ internalType: 'contract AggregatorV3Interface',
116
+ name: '',
117
+ type: 'address',
118
+ },
119
+ ],
120
+ stateMutability: 'view',
121
+ type: 'function',
122
+ },
123
+ {
124
+ inputs: [],
125
+ name: 'QUOTE_FEED_2',
126
+ outputs: [
127
+ {
128
+ internalType: 'contract AggregatorV3Interface',
129
+ name: '',
130
+ type: 'address',
131
+ },
132
+ ],
133
+ stateMutability: 'view',
134
+ type: 'function',
135
+ },
136
+ {
137
+ inputs: [],
138
+ name: 'QUOTE_VAULT',
139
+ outputs: [
140
+ {
141
+ internalType: 'contract IERC4626',
142
+ name: '',
143
+ type: 'address',
144
+ },
145
+ ],
146
+ stateMutability: 'view',
147
+ type: 'function',
148
+ },
149
+ {
150
+ inputs: [],
151
+ name: 'QUOTE_VAULT_CONVERSION_SAMPLE',
152
+ outputs: [
153
+ {
154
+ internalType: 'uint256',
155
+ name: '',
156
+ type: 'uint256',
157
+ },
158
+ ],
159
+ stateMutability: 'view',
160
+ type: 'function',
161
+ },
162
+ {
163
+ inputs: [],
164
+ name: 'SCALE_FACTOR',
165
+ outputs: [
166
+ {
167
+ internalType: 'uint256',
168
+ name: '',
169
+ type: 'uint256',
170
+ },
171
+ ],
172
+ stateMutability: 'view',
173
+ type: 'function',
174
+ },
175
+ {
176
+ inputs: [],
177
+ name: 'price',
178
+ outputs: [
179
+ {
180
+ internalType: 'uint256',
181
+ name: '',
182
+ type: 'uint256',
183
+ },
184
+ ],
185
+ stateMutability: 'view',
186
+ type: 'function',
187
+ },
188
+ ] as const;
@@ -0,0 +1,310 @@
1
+ export const ERC20_ABI = [
2
+ {
3
+ inputs: [
4
+ {
5
+ internalType: 'address',
6
+ name: 'spender',
7
+ type: 'address',
8
+ },
9
+ {
10
+ internalType: 'uint256',
11
+ name: 'allowance',
12
+ type: 'uint256',
13
+ },
14
+ {
15
+ internalType: 'uint256',
16
+ name: 'needed',
17
+ type: 'uint256',
18
+ },
19
+ ],
20
+ name: 'ERC20InsufficientAllowance',
21
+ type: 'error',
22
+ },
23
+ {
24
+ inputs: [
25
+ {
26
+ internalType: 'address',
27
+ name: 'sender',
28
+ type: 'address',
29
+ },
30
+ {
31
+ internalType: 'uint256',
32
+ name: 'balance',
33
+ type: 'uint256',
34
+ },
35
+ {
36
+ internalType: 'uint256',
37
+ name: 'needed',
38
+ type: 'uint256',
39
+ },
40
+ ],
41
+ name: 'ERC20InsufficientBalance',
42
+ type: 'error',
43
+ },
44
+ {
45
+ inputs: [
46
+ {
47
+ internalType: 'address',
48
+ name: 'approver',
49
+ type: 'address',
50
+ },
51
+ ],
52
+ name: 'ERC20InvalidApprover',
53
+ type: 'error',
54
+ },
55
+ {
56
+ inputs: [
57
+ {
58
+ internalType: 'address',
59
+ name: 'receiver',
60
+ type: 'address',
61
+ },
62
+ ],
63
+ name: 'ERC20InvalidReceiver',
64
+ type: 'error',
65
+ },
66
+ {
67
+ inputs: [
68
+ {
69
+ internalType: 'address',
70
+ name: 'sender',
71
+ type: 'address',
72
+ },
73
+ ],
74
+ name: 'ERC20InvalidSender',
75
+ type: 'error',
76
+ },
77
+ {
78
+ inputs: [
79
+ {
80
+ internalType: 'address',
81
+ name: 'spender',
82
+ type: 'address',
83
+ },
84
+ ],
85
+ name: 'ERC20InvalidSpender',
86
+ type: 'error',
87
+ },
88
+ {
89
+ anonymous: false,
90
+ inputs: [
91
+ {
92
+ indexed: true,
93
+ internalType: 'address',
94
+ name: 'owner',
95
+ type: 'address',
96
+ },
97
+ {
98
+ indexed: true,
99
+ internalType: 'address',
100
+ name: 'spender',
101
+ type: 'address',
102
+ },
103
+ {
104
+ indexed: false,
105
+ internalType: 'uint256',
106
+ name: 'value',
107
+ type: 'uint256',
108
+ },
109
+ ],
110
+ name: 'Approval',
111
+ type: 'event',
112
+ },
113
+ {
114
+ anonymous: false,
115
+ inputs: [
116
+ {
117
+ indexed: true,
118
+ internalType: 'address',
119
+ name: 'from',
120
+ type: 'address',
121
+ },
122
+ {
123
+ indexed: true,
124
+ internalType: 'address',
125
+ name: 'to',
126
+ type: 'address',
127
+ },
128
+ {
129
+ indexed: false,
130
+ internalType: 'uint256',
131
+ name: 'value',
132
+ type: 'uint256',
133
+ },
134
+ ],
135
+ name: 'Transfer',
136
+ type: 'event',
137
+ },
138
+ {
139
+ inputs: [
140
+ {
141
+ internalType: 'address',
142
+ name: 'owner',
143
+ type: 'address',
144
+ },
145
+ {
146
+ internalType: 'address',
147
+ name: 'spender',
148
+ type: 'address',
149
+ },
150
+ ],
151
+ name: 'allowance',
152
+ outputs: [
153
+ {
154
+ internalType: 'uint256',
155
+ name: '',
156
+ type: 'uint256',
157
+ },
158
+ ],
159
+ stateMutability: 'view',
160
+ type: 'function',
161
+ },
162
+ {
163
+ inputs: [
164
+ {
165
+ internalType: 'address',
166
+ name: 'spender',
167
+ type: 'address',
168
+ },
169
+ {
170
+ internalType: 'uint256',
171
+ name: 'value',
172
+ type: 'uint256',
173
+ },
174
+ ],
175
+ name: 'approve',
176
+ outputs: [
177
+ {
178
+ internalType: 'bool',
179
+ name: '',
180
+ type: 'bool',
181
+ },
182
+ ],
183
+ stateMutability: 'nonpayable',
184
+ type: 'function',
185
+ },
186
+ {
187
+ inputs: [
188
+ {
189
+ internalType: 'address',
190
+ name: 'account',
191
+ type: 'address',
192
+ },
193
+ ],
194
+ name: 'balanceOf',
195
+ outputs: [
196
+ {
197
+ internalType: 'uint256',
198
+ name: '',
199
+ type: 'uint256',
200
+ },
201
+ ],
202
+ stateMutability: 'view',
203
+ type: 'function',
204
+ },
205
+ {
206
+ inputs: [],
207
+ name: 'decimals',
208
+ outputs: [
209
+ {
210
+ internalType: 'uint8',
211
+ name: '',
212
+ type: 'uint8',
213
+ },
214
+ ],
215
+ stateMutability: 'view',
216
+ type: 'function',
217
+ },
218
+ {
219
+ inputs: [],
220
+ name: 'name',
221
+ outputs: [
222
+ {
223
+ internalType: 'string',
224
+ name: '',
225
+ type: 'string',
226
+ },
227
+ ],
228
+ stateMutability: 'view',
229
+ type: 'function',
230
+ },
231
+ {
232
+ inputs: [],
233
+ name: 'symbol',
234
+ outputs: [
235
+ {
236
+ internalType: 'string',
237
+ name: '',
238
+ type: 'string',
239
+ },
240
+ ],
241
+ stateMutability: 'view',
242
+ type: 'function',
243
+ },
244
+ {
245
+ inputs: [],
246
+ name: 'totalSupply',
247
+ outputs: [
248
+ {
249
+ internalType: 'uint256',
250
+ name: '',
251
+ type: 'uint256',
252
+ },
253
+ ],
254
+ stateMutability: 'view',
255
+ type: 'function',
256
+ },
257
+ {
258
+ inputs: [
259
+ {
260
+ internalType: 'address',
261
+ name: 'to',
262
+ type: 'address',
263
+ },
264
+ {
265
+ internalType: 'uint256',
266
+ name: 'value',
267
+ type: 'uint256',
268
+ },
269
+ ],
270
+ name: 'transfer',
271
+ outputs: [
272
+ {
273
+ internalType: 'bool',
274
+ name: '',
275
+ type: 'bool',
276
+ },
277
+ ],
278
+ stateMutability: 'nonpayable',
279
+ type: 'function',
280
+ },
281
+ {
282
+ inputs: [
283
+ {
284
+ internalType: 'address',
285
+ name: 'from',
286
+ type: 'address',
287
+ },
288
+ {
289
+ internalType: 'address',
290
+ name: 'to',
291
+ type: 'address',
292
+ },
293
+ {
294
+ internalType: 'uint256',
295
+ name: 'value',
296
+ type: 'uint256',
297
+ },
298
+ ],
299
+ name: 'transferFrom',
300
+ outputs: [
301
+ {
302
+ internalType: 'bool',
303
+ name: '',
304
+ type: 'bool',
305
+ },
306
+ ],
307
+ stateMutability: 'nonpayable',
308
+ type: 'function',
309
+ },
310
+ ] as const;