@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,559 @@
1
+ export const SavingsGatewayABI = [
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
+ internalType: 'address',
16
+ name: 'gateway_',
17
+ type: 'address',
18
+ },
19
+ ],
20
+ stateMutability: 'nonpayable',
21
+ type: 'constructor',
22
+ },
23
+ {
24
+ inputs: [],
25
+ name: 'ChangeNotReady',
26
+ type: 'error',
27
+ },
28
+ {
29
+ inputs: [],
30
+ name: 'ModuleDisabled',
31
+ type: 'error',
32
+ },
33
+ {
34
+ inputs: [],
35
+ name: 'NoPendingChange',
36
+ type: 'error',
37
+ },
38
+ {
39
+ anonymous: false,
40
+ inputs: [
41
+ {
42
+ indexed: true,
43
+ internalType: 'address',
44
+ name: 'account',
45
+ type: 'address',
46
+ },
47
+ {
48
+ indexed: false,
49
+ internalType: 'uint256',
50
+ name: 'interest',
51
+ type: 'uint256',
52
+ },
53
+ ],
54
+ name: 'InterestCollected',
55
+ type: 'event',
56
+ },
57
+ {
58
+ anonymous: false,
59
+ inputs: [
60
+ {
61
+ indexed: false,
62
+ internalType: 'uint24',
63
+ name: 'newRate',
64
+ type: 'uint24',
65
+ },
66
+ ],
67
+ name: 'RateChanged',
68
+ type: 'event',
69
+ },
70
+ {
71
+ anonymous: false,
72
+ inputs: [
73
+ {
74
+ indexed: false,
75
+ internalType: 'address',
76
+ name: 'who',
77
+ type: 'address',
78
+ },
79
+ {
80
+ indexed: false,
81
+ internalType: 'uint24',
82
+ name: 'nextRate',
83
+ type: 'uint24',
84
+ },
85
+ {
86
+ indexed: false,
87
+ internalType: 'uint40',
88
+ name: 'nextChange',
89
+ type: 'uint40',
90
+ },
91
+ ],
92
+ name: 'RateProposed',
93
+ type: 'event',
94
+ },
95
+ {
96
+ anonymous: false,
97
+ inputs: [
98
+ {
99
+ indexed: true,
100
+ internalType: 'address',
101
+ name: 'account',
102
+ type: 'address',
103
+ },
104
+ {
105
+ indexed: false,
106
+ internalType: 'uint192',
107
+ name: 'amount',
108
+ type: 'uint192',
109
+ },
110
+ ],
111
+ name: 'Saved',
112
+ type: 'event',
113
+ },
114
+ {
115
+ anonymous: false,
116
+ inputs: [
117
+ {
118
+ indexed: true,
119
+ internalType: 'address',
120
+ name: 'account',
121
+ type: 'address',
122
+ },
123
+ {
124
+ indexed: false,
125
+ internalType: 'uint192',
126
+ name: 'amount',
127
+ type: 'uint192',
128
+ },
129
+ ],
130
+ name: 'Withdrawn',
131
+ type: 'event',
132
+ },
133
+ {
134
+ inputs: [],
135
+ name: 'GATEWAY',
136
+ outputs: [
137
+ {
138
+ internalType: 'contract IFrontendGateway',
139
+ name: '',
140
+ type: 'address',
141
+ },
142
+ ],
143
+ stateMutability: 'view',
144
+ type: 'function',
145
+ },
146
+ {
147
+ inputs: [
148
+ {
149
+ internalType: 'address',
150
+ name: 'accountOwner',
151
+ type: 'address',
152
+ },
153
+ ],
154
+ name: 'accruedInterest',
155
+ outputs: [
156
+ {
157
+ internalType: 'uint192',
158
+ name: '',
159
+ type: 'uint192',
160
+ },
161
+ ],
162
+ stateMutability: 'view',
163
+ type: 'function',
164
+ },
165
+ {
166
+ inputs: [
167
+ {
168
+ internalType: 'address',
169
+ name: 'accountOwner',
170
+ type: 'address',
171
+ },
172
+ {
173
+ internalType: 'uint256',
174
+ name: 'timestamp',
175
+ type: 'uint256',
176
+ },
177
+ ],
178
+ name: 'accruedInterest',
179
+ outputs: [
180
+ {
181
+ internalType: 'uint192',
182
+ name: '',
183
+ type: 'uint192',
184
+ },
185
+ ],
186
+ stateMutability: 'view',
187
+ type: 'function',
188
+ },
189
+ {
190
+ inputs: [
191
+ {
192
+ internalType: 'uint192',
193
+ name: 'targetAmount',
194
+ type: 'uint192',
195
+ },
196
+ {
197
+ internalType: 'bytes32',
198
+ name: 'frontendCode',
199
+ type: 'bytes32',
200
+ },
201
+ ],
202
+ name: 'adjust',
203
+ outputs: [],
204
+ stateMutability: 'nonpayable',
205
+ type: 'function',
206
+ },
207
+ {
208
+ inputs: [
209
+ {
210
+ internalType: 'uint192',
211
+ name: 'targetAmount',
212
+ type: 'uint192',
213
+ },
214
+ ],
215
+ name: 'adjust',
216
+ outputs: [],
217
+ stateMutability: 'nonpayable',
218
+ type: 'function',
219
+ },
220
+ {
221
+ inputs: [],
222
+ name: 'applyChange',
223
+ outputs: [],
224
+ stateMutability: 'nonpayable',
225
+ type: 'function',
226
+ },
227
+ {
228
+ inputs: [
229
+ {
230
+ components: [
231
+ {
232
+ internalType: 'uint192',
233
+ name: 'saved',
234
+ type: 'uint192',
235
+ },
236
+ {
237
+ internalType: 'uint64',
238
+ name: 'ticks',
239
+ type: 'uint64',
240
+ },
241
+ ],
242
+ internalType: 'struct Savings.Account',
243
+ name: 'account',
244
+ type: 'tuple',
245
+ },
246
+ {
247
+ internalType: 'uint64',
248
+ name: 'ticks',
249
+ type: 'uint64',
250
+ },
251
+ ],
252
+ name: 'calculateInterest',
253
+ outputs: [
254
+ {
255
+ internalType: 'uint192',
256
+ name: '',
257
+ type: 'uint192',
258
+ },
259
+ ],
260
+ stateMutability: 'view',
261
+ type: 'function',
262
+ },
263
+ {
264
+ inputs: [],
265
+ name: 'currentRatePPM',
266
+ outputs: [
267
+ {
268
+ internalType: 'uint24',
269
+ name: '',
270
+ type: 'uint24',
271
+ },
272
+ ],
273
+ stateMutability: 'view',
274
+ type: 'function',
275
+ },
276
+ {
277
+ inputs: [],
278
+ name: 'currentTicks',
279
+ outputs: [
280
+ {
281
+ internalType: 'uint64',
282
+ name: '',
283
+ type: 'uint64',
284
+ },
285
+ ],
286
+ stateMutability: 'view',
287
+ type: 'function',
288
+ },
289
+ {
290
+ inputs: [],
291
+ name: 'equity',
292
+ outputs: [
293
+ {
294
+ internalType: 'contract IReserve',
295
+ name: '',
296
+ type: 'address',
297
+ },
298
+ ],
299
+ stateMutability: 'view',
300
+ type: 'function',
301
+ },
302
+ {
303
+ inputs: [],
304
+ name: 'jusd',
305
+ outputs: [
306
+ {
307
+ internalType: 'contract IERC20',
308
+ name: '',
309
+ type: 'address',
310
+ },
311
+ ],
312
+ stateMutability: 'view',
313
+ type: 'function',
314
+ },
315
+ {
316
+ inputs: [],
317
+ name: 'nextChange',
318
+ outputs: [
319
+ {
320
+ internalType: 'uint40',
321
+ name: '',
322
+ type: 'uint40',
323
+ },
324
+ ],
325
+ stateMutability: 'view',
326
+ type: 'function',
327
+ },
328
+ {
329
+ inputs: [],
330
+ name: 'nextRatePPM',
331
+ outputs: [
332
+ {
333
+ internalType: 'uint24',
334
+ name: '',
335
+ type: 'uint24',
336
+ },
337
+ ],
338
+ stateMutability: 'view',
339
+ type: 'function',
340
+ },
341
+ {
342
+ inputs: [
343
+ {
344
+ internalType: 'uint24',
345
+ name: 'newRatePPM_',
346
+ type: 'uint24',
347
+ },
348
+ {
349
+ internalType: 'address[]',
350
+ name: 'helpers',
351
+ type: 'address[]',
352
+ },
353
+ ],
354
+ name: 'proposeChange',
355
+ outputs: [],
356
+ stateMutability: 'nonpayable',
357
+ type: 'function',
358
+ },
359
+ {
360
+ inputs: [
361
+ {
362
+ internalType: 'address',
363
+ name: 'owner',
364
+ type: 'address',
365
+ },
366
+ ],
367
+ name: 'refreshBalance',
368
+ outputs: [
369
+ {
370
+ internalType: 'uint192',
371
+ name: '',
372
+ type: 'uint192',
373
+ },
374
+ ],
375
+ stateMutability: 'nonpayable',
376
+ type: 'function',
377
+ },
378
+ {
379
+ inputs: [],
380
+ name: 'refreshMyBalance',
381
+ outputs: [
382
+ {
383
+ internalType: 'uint192',
384
+ name: '',
385
+ type: 'uint192',
386
+ },
387
+ ],
388
+ stateMutability: 'nonpayable',
389
+ type: 'function',
390
+ },
391
+ {
392
+ inputs: [
393
+ {
394
+ internalType: 'uint192',
395
+ name: 'amount',
396
+ type: 'uint192',
397
+ },
398
+ {
399
+ internalType: 'bytes32',
400
+ name: 'frontendCode',
401
+ type: 'bytes32',
402
+ },
403
+ ],
404
+ name: 'save',
405
+ outputs: [],
406
+ stateMutability: 'nonpayable',
407
+ type: 'function',
408
+ },
409
+ {
410
+ inputs: [
411
+ {
412
+ internalType: 'address',
413
+ name: 'owner',
414
+ type: 'address',
415
+ },
416
+ {
417
+ internalType: 'uint192',
418
+ name: 'amount',
419
+ type: 'uint192',
420
+ },
421
+ ],
422
+ name: 'save',
423
+ outputs: [],
424
+ stateMutability: 'nonpayable',
425
+ type: 'function',
426
+ },
427
+ {
428
+ inputs: [
429
+ {
430
+ internalType: 'address',
431
+ name: 'owner',
432
+ type: 'address',
433
+ },
434
+ {
435
+ internalType: 'uint192',
436
+ name: 'amount',
437
+ type: 'uint192',
438
+ },
439
+ {
440
+ internalType: 'bytes32',
441
+ name: 'frontendCode',
442
+ type: 'bytes32',
443
+ },
444
+ ],
445
+ name: 'save',
446
+ outputs: [],
447
+ stateMutability: 'nonpayable',
448
+ type: 'function',
449
+ },
450
+ {
451
+ inputs: [
452
+ {
453
+ internalType: 'uint192',
454
+ name: 'amount',
455
+ type: 'uint192',
456
+ },
457
+ ],
458
+ name: 'save',
459
+ outputs: [],
460
+ stateMutability: 'nonpayable',
461
+ type: 'function',
462
+ },
463
+ {
464
+ inputs: [
465
+ {
466
+ internalType: 'address',
467
+ name: '',
468
+ type: 'address',
469
+ },
470
+ ],
471
+ name: 'savings',
472
+ outputs: [
473
+ {
474
+ internalType: 'uint192',
475
+ name: 'saved',
476
+ type: 'uint192',
477
+ },
478
+ {
479
+ internalType: 'uint64',
480
+ name: 'ticks',
481
+ type: 'uint64',
482
+ },
483
+ ],
484
+ stateMutability: 'view',
485
+ type: 'function',
486
+ },
487
+ {
488
+ inputs: [
489
+ {
490
+ internalType: 'uint256',
491
+ name: 'timestamp',
492
+ type: 'uint256',
493
+ },
494
+ ],
495
+ name: 'ticks',
496
+ outputs: [
497
+ {
498
+ internalType: 'uint64',
499
+ name: '',
500
+ type: 'uint64',
501
+ },
502
+ ],
503
+ stateMutability: 'view',
504
+ type: 'function',
505
+ },
506
+ {
507
+ inputs: [
508
+ {
509
+ internalType: 'address',
510
+ name: 'target',
511
+ type: 'address',
512
+ },
513
+ {
514
+ internalType: 'uint192',
515
+ name: 'amount',
516
+ type: 'uint192',
517
+ },
518
+ ],
519
+ name: 'withdraw',
520
+ outputs: [
521
+ {
522
+ internalType: 'uint256',
523
+ name: '',
524
+ type: 'uint256',
525
+ },
526
+ ],
527
+ stateMutability: 'nonpayable',
528
+ type: 'function',
529
+ },
530
+ {
531
+ inputs: [
532
+ {
533
+ internalType: 'address',
534
+ name: 'target',
535
+ type: 'address',
536
+ },
537
+ {
538
+ internalType: 'uint192',
539
+ name: 'amount',
540
+ type: 'uint192',
541
+ },
542
+ {
543
+ internalType: 'bytes32',
544
+ name: 'frontendCode',
545
+ type: 'bytes32',
546
+ },
547
+ ],
548
+ name: 'withdraw',
549
+ outputs: [
550
+ {
551
+ internalType: 'uint256',
552
+ name: '',
553
+ type: 'uint256',
554
+ },
555
+ ],
556
+ stateMutability: 'nonpayable',
557
+ type: 'function',
558
+ },
559
+ ] as const;