@juicedollar/jusd 1.0.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 (65) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +356 -0
  3. package/contracts/Equity.sol +457 -0
  4. package/contracts/JuiceDollar.sol +363 -0
  5. package/contracts/Leadrate.sol +79 -0
  6. package/contracts/MintingHubV2/MintingHub.sol +445 -0
  7. package/contracts/MintingHubV2/Position.sol +810 -0
  8. package/contracts/MintingHubV2/PositionFactory.sol +69 -0
  9. package/contracts/MintingHubV2/PositionRoller.sol +159 -0
  10. package/contracts/MintingHubV2/interface/IMintingHub.sol +26 -0
  11. package/contracts/MintingHubV2/interface/IPosition.sol +90 -0
  12. package/contracts/MintingHubV2/interface/IPositionFactory.sol +20 -0
  13. package/contracts/Savings.sol +141 -0
  14. package/contracts/SavingsVaultJUSD.sol +140 -0
  15. package/contracts/StablecoinBridge.sol +109 -0
  16. package/contracts/StartUSD.sol +16 -0
  17. package/contracts/gateway/CoinLendingGateway.sol +223 -0
  18. package/contracts/gateway/FrontendGateway.sol +224 -0
  19. package/contracts/gateway/MintingHubGateway.sol +87 -0
  20. package/contracts/gateway/SavingsGateway.sol +51 -0
  21. package/contracts/gateway/interface/ICoinLendingGateway.sol +73 -0
  22. package/contracts/gateway/interface/IFrontendGateway.sol +49 -0
  23. package/contracts/gateway/interface/IMintingHubGateway.sol +12 -0
  24. package/contracts/impl/ERC3009.sol +171 -0
  25. package/contracts/interface/IJuiceDollar.sol +54 -0
  26. package/contracts/interface/ILeadrate.sol +7 -0
  27. package/contracts/interface/IReserve.sol +9 -0
  28. package/contracts/interface/ISavingsJUSD.sol +49 -0
  29. package/contracts/test/FreakToken.sol +25 -0
  30. package/contracts/test/Math.sol +339 -0
  31. package/contracts/test/MockEquity.sol +15 -0
  32. package/contracts/test/PositionExpirationTest.sol +75 -0
  33. package/contracts/test/PositionRollingTest.sol +65 -0
  34. package/contracts/test/TestFlashLoan.sol +84 -0
  35. package/contracts/test/TestFlashLoanGateway.sol +49 -0
  36. package/contracts/test/TestMathUtil.sol +40 -0
  37. package/contracts/test/TestToken.sol +45 -0
  38. package/contracts/test/TestWcBTC.sol +35 -0
  39. package/contracts/utils/MathUtil.sol +61 -0
  40. package/dist/index.d.mts +8761 -0
  41. package/dist/index.d.ts +8761 -0
  42. package/dist/index.js +11119 -0
  43. package/dist/index.mjs +11073 -0
  44. package/exports/abis/MintingHubV2/PositionFactoryV2.ts +90 -0
  45. package/exports/abis/MintingHubV2/PositionRoller.ts +183 -0
  46. package/exports/abis/MintingHubV2/PositionV2.ts +999 -0
  47. package/exports/abis/core/CoinLendingGateway.ts +427 -0
  48. package/exports/abis/core/Equity.ts +1286 -0
  49. package/exports/abis/core/FrontendGateway.ts +906 -0
  50. package/exports/abis/core/JuiceDollar.ts +1366 -0
  51. package/exports/abis/core/MintingHubGateway.ts +865 -0
  52. package/exports/abis/core/SavingsGateway.ts +559 -0
  53. package/exports/abis/core/SavingsVaultJUSD.ts +920 -0
  54. package/exports/abis/utils/ERC20.ts +310 -0
  55. package/exports/abis/utils/ERC20PermitLight.ts +520 -0
  56. package/exports/abis/utils/Leadrate.ts +175 -0
  57. package/exports/abis/utils/MintingHubV2.ts +682 -0
  58. package/exports/abis/utils/Ownable.ts +76 -0
  59. package/exports/abis/utils/Savings.ts +453 -0
  60. package/exports/abis/utils/StablecoinBridge.ts +209 -0
  61. package/exports/abis/utils/StartUSD.ts +315 -0
  62. package/exports/abis/utils/UniswapV3Pool.ts +638 -0
  63. package/exports/address.config.ts +48 -0
  64. package/exports/index.ts +28 -0
  65. package/package.json +87 -0
@@ -0,0 +1,76 @@
1
+ export const OwnableABI = [
2
+ {
3
+ inputs: [
4
+ {
5
+ internalType: 'address',
6
+ name: 'owner',
7
+ type: 'address',
8
+ },
9
+ ],
10
+ name: 'OwnableInvalidOwner',
11
+ type: 'error',
12
+ },
13
+ {
14
+ inputs: [
15
+ {
16
+ internalType: 'address',
17
+ name: 'account',
18
+ type: 'address',
19
+ },
20
+ ],
21
+ name: 'OwnableUnauthorizedAccount',
22
+ type: 'error',
23
+ },
24
+ {
25
+ anonymous: false,
26
+ inputs: [
27
+ {
28
+ indexed: true,
29
+ internalType: 'address',
30
+ name: 'previousOwner',
31
+ type: 'address',
32
+ },
33
+ {
34
+ indexed: true,
35
+ internalType: 'address',
36
+ name: 'newOwner',
37
+ type: 'address',
38
+ },
39
+ ],
40
+ name: 'OwnershipTransferred',
41
+ type: 'event',
42
+ },
43
+ {
44
+ inputs: [],
45
+ name: 'owner',
46
+ outputs: [
47
+ {
48
+ internalType: 'address',
49
+ name: '',
50
+ type: 'address',
51
+ },
52
+ ],
53
+ stateMutability: 'view',
54
+ type: 'function',
55
+ },
56
+ {
57
+ inputs: [],
58
+ name: 'renounceOwnership',
59
+ outputs: [],
60
+ stateMutability: 'nonpayable',
61
+ type: 'function',
62
+ },
63
+ {
64
+ inputs: [
65
+ {
66
+ internalType: 'address',
67
+ name: 'newOwner',
68
+ type: 'address',
69
+ },
70
+ ],
71
+ name: 'transferOwnership',
72
+ outputs: [],
73
+ stateMutability: 'nonpayable',
74
+ type: 'function',
75
+ },
76
+ ] as const;
@@ -0,0 +1,453 @@
1
+ export const SavingsABI = [
2
+ {
3
+ inputs: [
4
+ {
5
+ internalType: 'contract IJuiceDollar',
6
+ name: 'jusd_',
7
+ type: 'address',
8
+ },
9
+ {
10
+ internalType: 'uint24',
11
+ name: 'initialRatePPM',
12
+ type: 'uint24',
13
+ },
14
+ ],
15
+ stateMutability: 'nonpayable',
16
+ type: 'constructor',
17
+ },
18
+ {
19
+ inputs: [],
20
+ name: 'ChangeNotReady',
21
+ type: 'error',
22
+ },
23
+ {
24
+ inputs: [],
25
+ name: 'ModuleDisabled',
26
+ type: 'error',
27
+ },
28
+ {
29
+ inputs: [],
30
+ name: 'NoPendingChange',
31
+ type: 'error',
32
+ },
33
+ {
34
+ anonymous: false,
35
+ inputs: [
36
+ {
37
+ indexed: true,
38
+ internalType: 'address',
39
+ name: 'account',
40
+ type: 'address',
41
+ },
42
+ {
43
+ indexed: false,
44
+ internalType: 'uint256',
45
+ name: 'interest',
46
+ type: 'uint256',
47
+ },
48
+ ],
49
+ name: 'InterestCollected',
50
+ type: 'event',
51
+ },
52
+ {
53
+ anonymous: false,
54
+ inputs: [
55
+ {
56
+ indexed: false,
57
+ internalType: 'uint24',
58
+ name: 'newRate',
59
+ type: 'uint24',
60
+ },
61
+ ],
62
+ name: 'RateChanged',
63
+ type: 'event',
64
+ },
65
+ {
66
+ anonymous: false,
67
+ inputs: [
68
+ {
69
+ indexed: false,
70
+ internalType: 'address',
71
+ name: 'who',
72
+ type: 'address',
73
+ },
74
+ {
75
+ indexed: false,
76
+ internalType: 'uint24',
77
+ name: 'nextRate',
78
+ type: 'uint24',
79
+ },
80
+ {
81
+ indexed: false,
82
+ internalType: 'uint40',
83
+ name: 'nextChange',
84
+ type: 'uint40',
85
+ },
86
+ ],
87
+ name: 'RateProposed',
88
+ type: 'event',
89
+ },
90
+ {
91
+ anonymous: false,
92
+ inputs: [
93
+ {
94
+ indexed: true,
95
+ internalType: 'address',
96
+ name: 'account',
97
+ type: 'address',
98
+ },
99
+ {
100
+ indexed: false,
101
+ internalType: 'uint192',
102
+ name: 'amount',
103
+ type: 'uint192',
104
+ },
105
+ ],
106
+ name: 'Saved',
107
+ type: 'event',
108
+ },
109
+ {
110
+ anonymous: false,
111
+ inputs: [
112
+ {
113
+ indexed: true,
114
+ internalType: 'address',
115
+ name: 'account',
116
+ type: 'address',
117
+ },
118
+ {
119
+ indexed: false,
120
+ internalType: 'uint192',
121
+ name: 'amount',
122
+ type: 'uint192',
123
+ },
124
+ ],
125
+ name: 'Withdrawn',
126
+ type: 'event',
127
+ },
128
+ {
129
+ inputs: [
130
+ {
131
+ internalType: 'address',
132
+ name: 'accountOwner',
133
+ type: 'address',
134
+ },
135
+ ],
136
+ name: 'accruedInterest',
137
+ outputs: [
138
+ {
139
+ internalType: 'uint192',
140
+ name: '',
141
+ type: 'uint192',
142
+ },
143
+ ],
144
+ stateMutability: 'view',
145
+ type: 'function',
146
+ },
147
+ {
148
+ inputs: [
149
+ {
150
+ internalType: 'address',
151
+ name: 'accountOwner',
152
+ type: 'address',
153
+ },
154
+ {
155
+ internalType: 'uint256',
156
+ name: 'timestamp',
157
+ type: 'uint256',
158
+ },
159
+ ],
160
+ name: 'accruedInterest',
161
+ outputs: [
162
+ {
163
+ internalType: 'uint192',
164
+ name: '',
165
+ type: 'uint192',
166
+ },
167
+ ],
168
+ stateMutability: 'view',
169
+ type: 'function',
170
+ },
171
+ {
172
+ inputs: [
173
+ {
174
+ internalType: 'uint192',
175
+ name: 'targetAmount',
176
+ type: 'uint192',
177
+ },
178
+ ],
179
+ name: 'adjust',
180
+ outputs: [],
181
+ stateMutability: 'nonpayable',
182
+ type: 'function',
183
+ },
184
+ {
185
+ inputs: [],
186
+ name: 'applyChange',
187
+ outputs: [],
188
+ stateMutability: 'nonpayable',
189
+ type: 'function',
190
+ },
191
+ {
192
+ inputs: [
193
+ {
194
+ components: [
195
+ {
196
+ internalType: 'uint192',
197
+ name: 'saved',
198
+ type: 'uint192',
199
+ },
200
+ {
201
+ internalType: 'uint64',
202
+ name: 'ticks',
203
+ type: 'uint64',
204
+ },
205
+ ],
206
+ internalType: 'struct Savings.Account',
207
+ name: 'account',
208
+ type: 'tuple',
209
+ },
210
+ {
211
+ internalType: 'uint64',
212
+ name: 'ticks',
213
+ type: 'uint64',
214
+ },
215
+ ],
216
+ name: 'calculateInterest',
217
+ outputs: [
218
+ {
219
+ internalType: 'uint192',
220
+ name: '',
221
+ type: 'uint192',
222
+ },
223
+ ],
224
+ stateMutability: 'view',
225
+ type: 'function',
226
+ },
227
+ {
228
+ inputs: [],
229
+ name: 'currentRatePPM',
230
+ outputs: [
231
+ {
232
+ internalType: 'uint24',
233
+ name: '',
234
+ type: 'uint24',
235
+ },
236
+ ],
237
+ stateMutability: 'view',
238
+ type: 'function',
239
+ },
240
+ {
241
+ inputs: [],
242
+ name: 'currentTicks',
243
+ outputs: [
244
+ {
245
+ internalType: 'uint64',
246
+ name: '',
247
+ type: 'uint64',
248
+ },
249
+ ],
250
+ stateMutability: 'view',
251
+ type: 'function',
252
+ },
253
+ {
254
+ inputs: [],
255
+ name: 'equity',
256
+ outputs: [
257
+ {
258
+ internalType: 'contract IReserve',
259
+ name: '',
260
+ type: 'address',
261
+ },
262
+ ],
263
+ stateMutability: 'view',
264
+ type: 'function',
265
+ },
266
+ {
267
+ inputs: [],
268
+ name: 'jusd',
269
+ outputs: [
270
+ {
271
+ internalType: 'contract IERC20',
272
+ name: '',
273
+ type: 'address',
274
+ },
275
+ ],
276
+ stateMutability: 'view',
277
+ type: 'function',
278
+ },
279
+ {
280
+ inputs: [],
281
+ name: 'nextChange',
282
+ outputs: [
283
+ {
284
+ internalType: 'uint40',
285
+ name: '',
286
+ type: 'uint40',
287
+ },
288
+ ],
289
+ stateMutability: 'view',
290
+ type: 'function',
291
+ },
292
+ {
293
+ inputs: [],
294
+ name: 'nextRatePPM',
295
+ outputs: [
296
+ {
297
+ internalType: 'uint24',
298
+ name: '',
299
+ type: 'uint24',
300
+ },
301
+ ],
302
+ stateMutability: 'view',
303
+ type: 'function',
304
+ },
305
+ {
306
+ inputs: [
307
+ {
308
+ internalType: 'uint24',
309
+ name: 'newRatePPM_',
310
+ type: 'uint24',
311
+ },
312
+ {
313
+ internalType: 'address[]',
314
+ name: 'helpers',
315
+ type: 'address[]',
316
+ },
317
+ ],
318
+ name: 'proposeChange',
319
+ outputs: [],
320
+ stateMutability: 'nonpayable',
321
+ type: 'function',
322
+ },
323
+ {
324
+ inputs: [
325
+ {
326
+ internalType: 'address',
327
+ name: 'owner',
328
+ type: 'address',
329
+ },
330
+ ],
331
+ name: 'refreshBalance',
332
+ outputs: [
333
+ {
334
+ internalType: 'uint192',
335
+ name: '',
336
+ type: 'uint192',
337
+ },
338
+ ],
339
+ stateMutability: 'nonpayable',
340
+ type: 'function',
341
+ },
342
+ {
343
+ inputs: [],
344
+ name: 'refreshMyBalance',
345
+ outputs: [
346
+ {
347
+ internalType: 'uint192',
348
+ name: '',
349
+ type: 'uint192',
350
+ },
351
+ ],
352
+ stateMutability: 'nonpayable',
353
+ type: 'function',
354
+ },
355
+ {
356
+ inputs: [
357
+ {
358
+ internalType: 'address',
359
+ name: 'owner',
360
+ type: 'address',
361
+ },
362
+ {
363
+ internalType: 'uint192',
364
+ name: 'amount',
365
+ type: 'uint192',
366
+ },
367
+ ],
368
+ name: 'save',
369
+ outputs: [],
370
+ stateMutability: 'nonpayable',
371
+ type: 'function',
372
+ },
373
+ {
374
+ inputs: [
375
+ {
376
+ internalType: 'uint192',
377
+ name: 'amount',
378
+ type: 'uint192',
379
+ },
380
+ ],
381
+ name: 'save',
382
+ outputs: [],
383
+ stateMutability: 'nonpayable',
384
+ type: 'function',
385
+ },
386
+ {
387
+ inputs: [
388
+ {
389
+ internalType: 'address',
390
+ name: '',
391
+ type: 'address',
392
+ },
393
+ ],
394
+ name: 'savings',
395
+ outputs: [
396
+ {
397
+ internalType: 'uint192',
398
+ name: 'saved',
399
+ type: 'uint192',
400
+ },
401
+ {
402
+ internalType: 'uint64',
403
+ name: 'ticks',
404
+ type: 'uint64',
405
+ },
406
+ ],
407
+ stateMutability: 'view',
408
+ type: 'function',
409
+ },
410
+ {
411
+ inputs: [
412
+ {
413
+ internalType: 'uint256',
414
+ name: 'timestamp',
415
+ type: 'uint256',
416
+ },
417
+ ],
418
+ name: 'ticks',
419
+ outputs: [
420
+ {
421
+ internalType: 'uint64',
422
+ name: '',
423
+ type: 'uint64',
424
+ },
425
+ ],
426
+ stateMutability: 'view',
427
+ type: 'function',
428
+ },
429
+ {
430
+ inputs: [
431
+ {
432
+ internalType: 'address',
433
+ name: 'target',
434
+ type: 'address',
435
+ },
436
+ {
437
+ internalType: 'uint192',
438
+ name: 'amount',
439
+ type: 'uint192',
440
+ },
441
+ ],
442
+ name: 'withdraw',
443
+ outputs: [
444
+ {
445
+ internalType: 'uint256',
446
+ name: '',
447
+ type: 'uint256',
448
+ },
449
+ ],
450
+ stateMutability: 'nonpayable',
451
+ type: 'function',
452
+ },
453
+ ] as const;
@@ -0,0 +1,209 @@
1
+ export const StablecoinBridgeABI = [
2
+ {
3
+ inputs: [
4
+ {
5
+ internalType: 'address',
6
+ name: 'other',
7
+ type: 'address',
8
+ },
9
+ {
10
+ internalType: 'address',
11
+ name: 'JUSDAddress',
12
+ type: 'address',
13
+ },
14
+ {
15
+ internalType: 'uint256',
16
+ name: 'limit_',
17
+ type: 'uint256',
18
+ },
19
+ {
20
+ internalType: 'uint256',
21
+ name: 'weeks_',
22
+ type: 'uint256',
23
+ },
24
+ ],
25
+ stateMutability: 'nonpayable',
26
+ type: 'constructor',
27
+ },
28
+ {
29
+ inputs: [
30
+ {
31
+ internalType: 'uint256',
32
+ name: 'time',
33
+ type: 'uint256',
34
+ },
35
+ {
36
+ internalType: 'uint256',
37
+ name: 'expiration',
38
+ type: 'uint256',
39
+ },
40
+ ],
41
+ name: 'Expired',
42
+ type: 'error',
43
+ },
44
+ {
45
+ inputs: [
46
+ {
47
+ internalType: 'uint256',
48
+ name: 'amount',
49
+ type: 'uint256',
50
+ },
51
+ {
52
+ internalType: 'uint256',
53
+ name: 'limit',
54
+ type: 'uint256',
55
+ },
56
+ ],
57
+ name: 'Limit',
58
+ type: 'error',
59
+ },
60
+ {
61
+ inputs: [
62
+ {
63
+ internalType: 'address',
64
+ name: 'token',
65
+ type: 'address',
66
+ },
67
+ ],
68
+ name: 'SafeERC20FailedOperation',
69
+ type: 'error',
70
+ },
71
+ {
72
+ inputs: [
73
+ {
74
+ internalType: 'address',
75
+ name: 'token',
76
+ type: 'address',
77
+ },
78
+ ],
79
+ name: 'UnsupportedToken',
80
+ type: 'error',
81
+ },
82
+ {
83
+ inputs: [],
84
+ name: 'JUSD',
85
+ outputs: [
86
+ {
87
+ internalType: 'contract IJuiceDollar',
88
+ name: '',
89
+ type: 'address',
90
+ },
91
+ ],
92
+ stateMutability: 'view',
93
+ type: 'function',
94
+ },
95
+ {
96
+ inputs: [
97
+ {
98
+ internalType: 'uint256',
99
+ name: 'amount',
100
+ type: 'uint256',
101
+ },
102
+ ],
103
+ name: 'burn',
104
+ outputs: [],
105
+ stateMutability: 'nonpayable',
106
+ type: 'function',
107
+ },
108
+ {
109
+ inputs: [
110
+ {
111
+ internalType: 'address',
112
+ name: 'target',
113
+ type: 'address',
114
+ },
115
+ {
116
+ internalType: 'uint256',
117
+ name: 'amount',
118
+ type: 'uint256',
119
+ },
120
+ ],
121
+ name: 'burnAndSend',
122
+ outputs: [],
123
+ stateMutability: 'nonpayable',
124
+ type: 'function',
125
+ },
126
+ {
127
+ inputs: [],
128
+ name: 'horizon',
129
+ outputs: [
130
+ {
131
+ internalType: 'uint256',
132
+ name: '',
133
+ type: 'uint256',
134
+ },
135
+ ],
136
+ stateMutability: 'view',
137
+ type: 'function',
138
+ },
139
+ {
140
+ inputs: [],
141
+ name: 'limit',
142
+ outputs: [
143
+ {
144
+ internalType: 'uint256',
145
+ name: '',
146
+ type: 'uint256',
147
+ },
148
+ ],
149
+ stateMutability: 'view',
150
+ type: 'function',
151
+ },
152
+ {
153
+ inputs: [
154
+ {
155
+ internalType: 'uint256',
156
+ name: 'amount',
157
+ type: 'uint256',
158
+ },
159
+ ],
160
+ name: 'mint',
161
+ outputs: [],
162
+ stateMutability: 'nonpayable',
163
+ type: 'function',
164
+ },
165
+ {
166
+ inputs: [
167
+ {
168
+ internalType: 'address',
169
+ name: 'target',
170
+ type: 'address',
171
+ },
172
+ {
173
+ internalType: 'uint256',
174
+ name: 'amount',
175
+ type: 'uint256',
176
+ },
177
+ ],
178
+ name: 'mintTo',
179
+ outputs: [],
180
+ stateMutability: 'nonpayable',
181
+ type: 'function',
182
+ },
183
+ {
184
+ inputs: [],
185
+ name: 'minted',
186
+ outputs: [
187
+ {
188
+ internalType: 'uint256',
189
+ name: '',
190
+ type: 'uint256',
191
+ },
192
+ ],
193
+ stateMutability: 'view',
194
+ type: 'function',
195
+ },
196
+ {
197
+ inputs: [],
198
+ name: 'usd',
199
+ outputs: [
200
+ {
201
+ internalType: 'contract IERC20',
202
+ name: '',
203
+ type: 'address',
204
+ },
205
+ ],
206
+ stateMutability: 'view',
207
+ type: 'function',
208
+ },
209
+ ] as const;