@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,520 @@
1
+ export const ERC20PermitLightABI = [
2
+ {
3
+ inputs: [],
4
+ name: 'ECDSAInvalidSignature',
5
+ type: 'error',
6
+ },
7
+ {
8
+ inputs: [
9
+ {
10
+ internalType: 'uint256',
11
+ name: 'length',
12
+ type: 'uint256',
13
+ },
14
+ ],
15
+ name: 'ECDSAInvalidSignatureLength',
16
+ type: 'error',
17
+ },
18
+ {
19
+ inputs: [
20
+ {
21
+ internalType: 'bytes32',
22
+ name: 's',
23
+ type: 'bytes32',
24
+ },
25
+ ],
26
+ name: 'ECDSAInvalidSignatureS',
27
+ type: 'error',
28
+ },
29
+ {
30
+ inputs: [
31
+ {
32
+ internalType: 'address',
33
+ name: 'spender',
34
+ type: 'address',
35
+ },
36
+ {
37
+ internalType: 'uint256',
38
+ name: 'allowance',
39
+ type: 'uint256',
40
+ },
41
+ {
42
+ internalType: 'uint256',
43
+ name: 'needed',
44
+ type: 'uint256',
45
+ },
46
+ ],
47
+ name: 'ERC20InsufficientAllowance',
48
+ type: 'error',
49
+ },
50
+ {
51
+ inputs: [
52
+ {
53
+ internalType: 'address',
54
+ name: 'sender',
55
+ type: 'address',
56
+ },
57
+ {
58
+ internalType: 'uint256',
59
+ name: 'balance',
60
+ type: 'uint256',
61
+ },
62
+ {
63
+ internalType: 'uint256',
64
+ name: 'needed',
65
+ type: 'uint256',
66
+ },
67
+ ],
68
+ name: 'ERC20InsufficientBalance',
69
+ type: 'error',
70
+ },
71
+ {
72
+ inputs: [
73
+ {
74
+ internalType: 'address',
75
+ name: 'approver',
76
+ type: 'address',
77
+ },
78
+ ],
79
+ name: 'ERC20InvalidApprover',
80
+ type: 'error',
81
+ },
82
+ {
83
+ inputs: [
84
+ {
85
+ internalType: 'address',
86
+ name: 'receiver',
87
+ type: 'address',
88
+ },
89
+ ],
90
+ name: 'ERC20InvalidReceiver',
91
+ type: 'error',
92
+ },
93
+ {
94
+ inputs: [
95
+ {
96
+ internalType: 'address',
97
+ name: 'sender',
98
+ type: 'address',
99
+ },
100
+ ],
101
+ name: 'ERC20InvalidSender',
102
+ type: 'error',
103
+ },
104
+ {
105
+ inputs: [
106
+ {
107
+ internalType: 'address',
108
+ name: 'spender',
109
+ type: 'address',
110
+ },
111
+ ],
112
+ name: 'ERC20InvalidSpender',
113
+ type: 'error',
114
+ },
115
+ {
116
+ inputs: [
117
+ {
118
+ internalType: 'uint256',
119
+ name: 'deadline',
120
+ type: 'uint256',
121
+ },
122
+ ],
123
+ name: 'ERC2612ExpiredSignature',
124
+ type: 'error',
125
+ },
126
+ {
127
+ inputs: [
128
+ {
129
+ internalType: 'address',
130
+ name: 'signer',
131
+ type: 'address',
132
+ },
133
+ {
134
+ internalType: 'address',
135
+ name: 'owner',
136
+ type: 'address',
137
+ },
138
+ ],
139
+ name: 'ERC2612InvalidSigner',
140
+ type: 'error',
141
+ },
142
+ {
143
+ inputs: [
144
+ {
145
+ internalType: 'address',
146
+ name: 'account',
147
+ type: 'address',
148
+ },
149
+ {
150
+ internalType: 'uint256',
151
+ name: 'currentNonce',
152
+ type: 'uint256',
153
+ },
154
+ ],
155
+ name: 'InvalidAccountNonce',
156
+ type: 'error',
157
+ },
158
+ {
159
+ inputs: [],
160
+ name: 'InvalidShortString',
161
+ type: 'error',
162
+ },
163
+ {
164
+ inputs: [
165
+ {
166
+ internalType: 'string',
167
+ name: 'str',
168
+ type: 'string',
169
+ },
170
+ ],
171
+ name: 'StringTooLong',
172
+ type: 'error',
173
+ },
174
+ {
175
+ anonymous: false,
176
+ inputs: [
177
+ {
178
+ indexed: true,
179
+ internalType: 'address',
180
+ name: 'owner',
181
+ type: 'address',
182
+ },
183
+ {
184
+ indexed: true,
185
+ internalType: 'address',
186
+ name: 'spender',
187
+ type: 'address',
188
+ },
189
+ {
190
+ indexed: false,
191
+ internalType: 'uint256',
192
+ name: 'value',
193
+ type: 'uint256',
194
+ },
195
+ ],
196
+ name: 'Approval',
197
+ type: 'event',
198
+ },
199
+ {
200
+ anonymous: false,
201
+ inputs: [],
202
+ name: 'EIP712DomainChanged',
203
+ type: 'event',
204
+ },
205
+ {
206
+ anonymous: false,
207
+ inputs: [
208
+ {
209
+ indexed: true,
210
+ internalType: 'address',
211
+ name: 'from',
212
+ type: 'address',
213
+ },
214
+ {
215
+ indexed: true,
216
+ internalType: 'address',
217
+ name: 'to',
218
+ type: 'address',
219
+ },
220
+ {
221
+ indexed: false,
222
+ internalType: 'uint256',
223
+ name: 'value',
224
+ type: 'uint256',
225
+ },
226
+ ],
227
+ name: 'Transfer',
228
+ type: 'event',
229
+ },
230
+ {
231
+ inputs: [],
232
+ name: 'DOMAIN_SEPARATOR',
233
+ outputs: [
234
+ {
235
+ internalType: 'bytes32',
236
+ name: '',
237
+ type: 'bytes32',
238
+ },
239
+ ],
240
+ stateMutability: 'view',
241
+ type: 'function',
242
+ },
243
+ {
244
+ inputs: [
245
+ {
246
+ internalType: 'address',
247
+ name: 'owner',
248
+ type: 'address',
249
+ },
250
+ {
251
+ internalType: 'address',
252
+ name: 'spender',
253
+ type: 'address',
254
+ },
255
+ ],
256
+ name: 'allowance',
257
+ outputs: [
258
+ {
259
+ internalType: 'uint256',
260
+ name: '',
261
+ type: 'uint256',
262
+ },
263
+ ],
264
+ stateMutability: 'view',
265
+ type: 'function',
266
+ },
267
+ {
268
+ inputs: [
269
+ {
270
+ internalType: 'address',
271
+ name: 'spender',
272
+ type: 'address',
273
+ },
274
+ {
275
+ internalType: 'uint256',
276
+ name: 'value',
277
+ type: 'uint256',
278
+ },
279
+ ],
280
+ name: 'approve',
281
+ outputs: [
282
+ {
283
+ internalType: 'bool',
284
+ name: '',
285
+ type: 'bool',
286
+ },
287
+ ],
288
+ stateMutability: 'nonpayable',
289
+ type: 'function',
290
+ },
291
+ {
292
+ inputs: [
293
+ {
294
+ internalType: 'address',
295
+ name: 'account',
296
+ type: 'address',
297
+ },
298
+ ],
299
+ name: 'balanceOf',
300
+ outputs: [
301
+ {
302
+ internalType: 'uint256',
303
+ name: '',
304
+ type: 'uint256',
305
+ },
306
+ ],
307
+ stateMutability: 'view',
308
+ type: 'function',
309
+ },
310
+ {
311
+ inputs: [],
312
+ name: 'decimals',
313
+ outputs: [
314
+ {
315
+ internalType: 'uint8',
316
+ name: '',
317
+ type: 'uint8',
318
+ },
319
+ ],
320
+ stateMutability: 'view',
321
+ type: 'function',
322
+ },
323
+ {
324
+ inputs: [],
325
+ name: 'eip712Domain',
326
+ outputs: [
327
+ {
328
+ internalType: 'bytes1',
329
+ name: 'fields',
330
+ type: 'bytes1',
331
+ },
332
+ {
333
+ internalType: 'string',
334
+ name: 'name',
335
+ type: 'string',
336
+ },
337
+ {
338
+ internalType: 'string',
339
+ name: 'version',
340
+ type: 'string',
341
+ },
342
+ {
343
+ internalType: 'uint256',
344
+ name: 'chainId',
345
+ type: 'uint256',
346
+ },
347
+ {
348
+ internalType: 'address',
349
+ name: 'verifyingContract',
350
+ type: 'address',
351
+ },
352
+ {
353
+ internalType: 'bytes32',
354
+ name: 'salt',
355
+ type: 'bytes32',
356
+ },
357
+ {
358
+ internalType: 'uint256[]',
359
+ name: 'extensions',
360
+ type: 'uint256[]',
361
+ },
362
+ ],
363
+ stateMutability: 'view',
364
+ type: 'function',
365
+ },
366
+ {
367
+ inputs: [],
368
+ name: 'name',
369
+ outputs: [
370
+ {
371
+ internalType: 'string',
372
+ name: '',
373
+ type: 'string',
374
+ },
375
+ ],
376
+ stateMutability: 'view',
377
+ type: 'function',
378
+ },
379
+ {
380
+ inputs: [
381
+ {
382
+ internalType: 'address',
383
+ name: 'owner',
384
+ type: 'address',
385
+ },
386
+ ],
387
+ name: 'nonces',
388
+ outputs: [
389
+ {
390
+ internalType: 'uint256',
391
+ name: '',
392
+ type: 'uint256',
393
+ },
394
+ ],
395
+ stateMutability: 'view',
396
+ type: 'function',
397
+ },
398
+ {
399
+ inputs: [
400
+ {
401
+ internalType: 'address',
402
+ name: 'owner',
403
+ type: 'address',
404
+ },
405
+ {
406
+ internalType: 'address',
407
+ name: 'spender',
408
+ type: 'address',
409
+ },
410
+ {
411
+ internalType: 'uint256',
412
+ name: 'value',
413
+ type: 'uint256',
414
+ },
415
+ {
416
+ internalType: 'uint256',
417
+ name: 'deadline',
418
+ type: 'uint256',
419
+ },
420
+ {
421
+ internalType: 'uint8',
422
+ name: 'v',
423
+ type: 'uint8',
424
+ },
425
+ {
426
+ internalType: 'bytes32',
427
+ name: 'r',
428
+ type: 'bytes32',
429
+ },
430
+ {
431
+ internalType: 'bytes32',
432
+ name: 's',
433
+ type: 'bytes32',
434
+ },
435
+ ],
436
+ name: 'permit',
437
+ outputs: [],
438
+ stateMutability: 'nonpayable',
439
+ type: 'function',
440
+ },
441
+ {
442
+ inputs: [],
443
+ name: 'symbol',
444
+ outputs: [
445
+ {
446
+ internalType: 'string',
447
+ name: '',
448
+ type: 'string',
449
+ },
450
+ ],
451
+ stateMutability: 'view',
452
+ type: 'function',
453
+ },
454
+ {
455
+ inputs: [],
456
+ name: 'totalSupply',
457
+ outputs: [
458
+ {
459
+ internalType: 'uint256',
460
+ name: '',
461
+ type: 'uint256',
462
+ },
463
+ ],
464
+ stateMutability: 'view',
465
+ type: 'function',
466
+ },
467
+ {
468
+ inputs: [
469
+ {
470
+ internalType: 'address',
471
+ name: 'to',
472
+ type: 'address',
473
+ },
474
+ {
475
+ internalType: 'uint256',
476
+ name: 'value',
477
+ type: 'uint256',
478
+ },
479
+ ],
480
+ name: 'transfer',
481
+ outputs: [
482
+ {
483
+ internalType: 'bool',
484
+ name: '',
485
+ type: 'bool',
486
+ },
487
+ ],
488
+ stateMutability: 'nonpayable',
489
+ type: 'function',
490
+ },
491
+ {
492
+ inputs: [
493
+ {
494
+ internalType: 'address',
495
+ name: 'from',
496
+ type: 'address',
497
+ },
498
+ {
499
+ internalType: 'address',
500
+ name: 'to',
501
+ type: 'address',
502
+ },
503
+ {
504
+ internalType: 'uint256',
505
+ name: 'value',
506
+ type: 'uint256',
507
+ },
508
+ ],
509
+ name: 'transferFrom',
510
+ outputs: [
511
+ {
512
+ internalType: 'bool',
513
+ name: '',
514
+ type: 'bool',
515
+ },
516
+ ],
517
+ stateMutability: 'nonpayable',
518
+ type: 'function',
519
+ },
520
+ ] as const;
@@ -0,0 +1,175 @@
1
+ export const LeadrateABI = [
2
+ {
3
+ inputs: [
4
+ {
5
+ internalType: 'contract IReserve',
6
+ name: 'equity_',
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: 'NoPendingChange',
26
+ type: 'error',
27
+ },
28
+ {
29
+ anonymous: false,
30
+ inputs: [
31
+ {
32
+ indexed: false,
33
+ internalType: 'uint24',
34
+ name: 'newRate',
35
+ type: 'uint24',
36
+ },
37
+ ],
38
+ name: 'RateChanged',
39
+ type: 'event',
40
+ },
41
+ {
42
+ anonymous: false,
43
+ inputs: [
44
+ {
45
+ indexed: false,
46
+ internalType: 'address',
47
+ name: 'who',
48
+ type: 'address',
49
+ },
50
+ {
51
+ indexed: false,
52
+ internalType: 'uint24',
53
+ name: 'nextRate',
54
+ type: 'uint24',
55
+ },
56
+ {
57
+ indexed: false,
58
+ internalType: 'uint40',
59
+ name: 'nextChange',
60
+ type: 'uint40',
61
+ },
62
+ ],
63
+ name: 'RateProposed',
64
+ type: 'event',
65
+ },
66
+ {
67
+ inputs: [],
68
+ name: 'applyChange',
69
+ outputs: [],
70
+ stateMutability: 'nonpayable',
71
+ type: 'function',
72
+ },
73
+ {
74
+ inputs: [],
75
+ name: 'currentRatePPM',
76
+ outputs: [
77
+ {
78
+ internalType: 'uint24',
79
+ name: '',
80
+ type: 'uint24',
81
+ },
82
+ ],
83
+ stateMutability: 'view',
84
+ type: 'function',
85
+ },
86
+ {
87
+ inputs: [],
88
+ name: 'currentTicks',
89
+ outputs: [
90
+ {
91
+ internalType: 'uint64',
92
+ name: '',
93
+ type: 'uint64',
94
+ },
95
+ ],
96
+ stateMutability: 'view',
97
+ type: 'function',
98
+ },
99
+ {
100
+ inputs: [],
101
+ name: 'equity',
102
+ outputs: [
103
+ {
104
+ internalType: 'contract IReserve',
105
+ name: '',
106
+ type: 'address',
107
+ },
108
+ ],
109
+ stateMutability: 'view',
110
+ type: 'function',
111
+ },
112
+ {
113
+ inputs: [],
114
+ name: 'nextChange',
115
+ outputs: [
116
+ {
117
+ internalType: 'uint40',
118
+ name: '',
119
+ type: 'uint40',
120
+ },
121
+ ],
122
+ stateMutability: 'view',
123
+ type: 'function',
124
+ },
125
+ {
126
+ inputs: [],
127
+ name: 'nextRatePPM',
128
+ outputs: [
129
+ {
130
+ internalType: 'uint24',
131
+ name: '',
132
+ type: 'uint24',
133
+ },
134
+ ],
135
+ stateMutability: 'view',
136
+ type: 'function',
137
+ },
138
+ {
139
+ inputs: [
140
+ {
141
+ internalType: 'uint24',
142
+ name: 'newRatePPM_',
143
+ type: 'uint24',
144
+ },
145
+ {
146
+ internalType: 'address[]',
147
+ name: 'helpers',
148
+ type: 'address[]',
149
+ },
150
+ ],
151
+ name: 'proposeChange',
152
+ outputs: [],
153
+ stateMutability: 'nonpayable',
154
+ type: 'function',
155
+ },
156
+ {
157
+ inputs: [
158
+ {
159
+ internalType: 'uint256',
160
+ name: 'timestamp',
161
+ type: 'uint256',
162
+ },
163
+ ],
164
+ name: 'ticks',
165
+ outputs: [
166
+ {
167
+ internalType: 'uint64',
168
+ name: '',
169
+ type: 'uint64',
170
+ },
171
+ ],
172
+ stateMutability: 'view',
173
+ type: 'function',
174
+ },
175
+ ] as const;