@pendle/core-v2 0.2.3 → 0.4.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 (87) hide show
  1. package/contracts/SuperComposableYield/ISuperComposableYield.sol +15 -5
  2. package/contracts/SuperComposableYield/implementations/RewardManager.sol +2 -2
  3. package/contracts/SuperComposableYield/implementations/SCYBase.sol +23 -3
  4. package/contracts/SuperComposableYield/implementations/SCYBaseWithRewards.sol +4 -7
  5. package/contracts/core/PendleMarket.sol +24 -22
  6. package/contracts/core/PendleMarketFactory.sol +7 -6
  7. package/contracts/core/PendleSCYImpl/PendleBenQiErc20SCY.sol +1 -1
  8. package/contracts/core/PendleSCYImpl/PendleBtrflySCY.sol +2 -7
  9. package/contracts/core/PendleSCYImpl/PendleYearnVaultSCY.sol +2 -7
  10. package/contracts/core/PendleYieldContractFactory.sol +12 -7
  11. package/contracts/core/PendleYieldToken.sol +93 -55
  12. package/contracts/core/router/PendleRouterCoreUpg.sol +35 -21
  13. package/contracts/core/router/PendleRouterProxy.sol +12 -6
  14. package/contracts/core/router/PendleRouterStaticUpg.sol +43 -18
  15. package/contracts/core/router/PendleRouterYTUpg.sol +47 -13
  16. package/contracts/core/router/base/PendleRouterOTBaseUpg.sol +22 -32
  17. package/contracts/core/router/base/PendleRouterSCYAndForgeBaseUpg.sol +4 -4
  18. package/contracts/core/router/base/PendleRouterYTBaseUpg.sol +62 -43
  19. package/contracts/interfaces/IPMarket.sol +4 -2
  20. package/contracts/interfaces/{IPPermissionsV2.sol → IPPermissionsV2Upg.sol} +1 -1
  21. package/contracts/interfaces/IPRouterCore.sol +24 -21
  22. package/contracts/interfaces/IPRouterStatic.sol +10 -1
  23. package/contracts/interfaces/IPRouterYT.sol +16 -4
  24. package/contracts/interfaces/IPYieldContractFactory.sol +4 -0
  25. package/contracts/interfaces/IPYieldToken.sol +2 -4
  26. package/contracts/libraries/SCYIndex.sol +3 -3
  27. package/contracts/libraries/math/LogExpMath.sol +1 -90
  28. package/contracts/libraries/math/MarketApproxLib.sol +336 -94
  29. package/contracts/libraries/math/MarketMathAux.sol +101 -0
  30. package/contracts/libraries/math/MarketMathCore.sol +423 -0
  31. package/contracts/libraries/math/Math.sol +144 -0
  32. package/contracts/{core/misc → periphery}/PendleJoeSwapHelperUpg.sol +2 -2
  33. package/contracts/periphery/{PermissionsV2.sol → PermissionsV2Upg.sol} +2 -2
  34. package/package.json +1 -1
  35. package/typechain-types/IPMarket.ts +22 -11
  36. package/typechain-types/IPRouterCore.ts +68 -58
  37. package/typechain-types/IPRouterStatic.ts +52 -0
  38. package/typechain-types/IPRouterYT.ts +96 -12
  39. package/typechain-types/IPYieldContractFactory.ts +32 -0
  40. package/typechain-types/IPYieldToken.ts +14 -48
  41. package/typechain-types/IPermissionsV2Upg.ts +87 -0
  42. package/typechain-types/ISuperComposableYield.ts +98 -11
  43. package/typechain-types/OwnableUpgradeable.ts +165 -0
  44. package/typechain-types/PendleAaveV3SCY.ts +98 -11
  45. package/typechain-types/PendleBenQiErc20SCY.ts +98 -11
  46. package/typechain-types/PendleBtrflyScy.ts +98 -11
  47. package/typechain-types/PendleMarket.ts +22 -11
  48. package/typechain-types/PendleRouterCoreUpg.ts +66 -48
  49. package/typechain-types/PendleRouterProxy.ts +15 -118
  50. package/typechain-types/PendleRouterStaticUpg.ts +92 -0
  51. package/typechain-types/PendleRouterYTUpg.ts +96 -12
  52. package/typechain-types/PendleYearnVaultScy.ts +98 -11
  53. package/typechain-types/PendleYieldContractFactory.ts +40 -113
  54. package/typechain-types/PendleYieldToken.ts +106 -7
  55. package/typechain-types/PermissionsV2Upg.ts +87 -0
  56. package/typechain-types/SCYBase.ts +98 -11
  57. package/typechain-types/SCYBaseWithRewards.ts +98 -11
  58. package/typechain-types/factories/IPMarket__factory.ts +8 -2
  59. package/typechain-types/factories/IPRouterCore__factory.ts +38 -23
  60. package/typechain-types/factories/IPRouterStatic__factory.ts +29 -0
  61. package/typechain-types/factories/IPRouterYT__factory.ts +65 -6
  62. package/typechain-types/factories/IPYieldContractFactory__factory.ts +38 -0
  63. package/typechain-types/factories/IPYieldToken__factory.ts +1 -20
  64. package/typechain-types/factories/IPermissionsV2Upg__factory.ts +39 -0
  65. package/typechain-types/factories/ISuperComposableYield__factory.ts +65 -2
  66. package/typechain-types/factories/OwnableUpgradeable__factory.ts +78 -0
  67. package/typechain-types/factories/PendleAaveV3SCY__factory.ts +66 -3
  68. package/typechain-types/factories/PendleBenQiErc20SCY__factory.ts +66 -3
  69. package/typechain-types/factories/PendleBtrflyScy__factory.ts +66 -3
  70. package/typechain-types/factories/PendleMarketFactory__factory.ts +1 -1
  71. package/typechain-types/factories/PendleMarket__factory.ts +9 -3
  72. package/typechain-types/factories/PendleRouterCoreUpg__factory.ts +26 -11
  73. package/typechain-types/factories/PendleRouterProxy__factory.ts +14 -67
  74. package/typechain-types/factories/PendleRouterStaticUpg__factory.ts +63 -17
  75. package/typechain-types/factories/PendleRouterYTUpg__factory.ts +66 -7
  76. package/typechain-types/factories/PendleYearnVaultScy__factory.ts +66 -3
  77. package/typechain-types/factories/PendleYieldContractFactory__factory.ts +39 -54
  78. package/typechain-types/factories/PendleYieldToken__factory.ts +53 -2
  79. package/typechain-types/factories/PermissionsV2Upg__factory.ts +39 -0
  80. package/typechain-types/factories/SCYBaseWithRewards__factory.ts +65 -2
  81. package/typechain-types/factories/SCYBase__factory.ts +65 -2
  82. package/typechain-types/hardhat.d.ts +26 -53
  83. package/typechain-types/index.ts +8 -14
  84. package/contracts/core/misc/BoringOwnable.sol +0 -62
  85. package/contracts/core/misc/BoringOwnableUpg.sol +0 -64
  86. package/contracts/libraries/math/FixedPoint.sol +0 -205
  87. package/contracts/libraries/math/MarketMathLib.sol +0 -614
@@ -39,17 +39,17 @@ const _abi = [
39
39
  outputs: [
40
40
  {
41
41
  internalType: "uint256",
42
- name: "netLpOut",
42
+ name: "",
43
43
  type: "uint256",
44
44
  },
45
45
  {
46
46
  internalType: "uint256",
47
- name: "scyUsed",
47
+ name: "",
48
48
  type: "uint256",
49
49
  },
50
50
  {
51
51
  internalType: "uint256",
52
- name: "otUsed",
52
+ name: "",
53
53
  type: "uint256",
54
54
  },
55
55
  ],
@@ -88,7 +88,7 @@ const _abi = [
88
88
  outputs: [
89
89
  {
90
90
  internalType: "uint256",
91
- name: "netScyOut",
91
+ name: "",
92
92
  type: "uint256",
93
93
  },
94
94
  ],
@@ -127,7 +127,7 @@ const _abi = [
127
127
  outputs: [
128
128
  {
129
129
  internalType: "uint256",
130
- name: "netYoOut",
130
+ name: "",
131
131
  type: "uint256",
132
132
  },
133
133
  ],
@@ -166,7 +166,7 @@ const _abi = [
166
166
  outputs: [
167
167
  {
168
168
  internalType: "uint256",
169
- name: "netRawTokenOut",
169
+ name: "",
170
170
  type: "uint256",
171
171
  },
172
172
  ],
@@ -205,7 +205,7 @@ const _abi = [
205
205
  outputs: [
206
206
  {
207
207
  internalType: "uint256",
208
- name: "netRawTokenOut",
208
+ name: "",
209
209
  type: "uint256",
210
210
  },
211
211
  ],
@@ -244,12 +244,12 @@ const _abi = [
244
244
  outputs: [
245
245
  {
246
246
  internalType: "uint256",
247
- name: "netScyOut",
247
+ name: "",
248
248
  type: "uint256",
249
249
  },
250
250
  {
251
251
  internalType: "uint256",
252
- name: "netOtOut",
252
+ name: "",
253
253
  type: "uint256",
254
254
  },
255
255
  ],
@@ -322,7 +322,7 @@ const _abi = [
322
322
  outputs: [
323
323
  {
324
324
  internalType: "uint256",
325
- name: "netScyOut",
325
+ name: "",
326
326
  type: "uint256",
327
327
  },
328
328
  ],
@@ -353,17 +353,22 @@ const _abi = [
353
353
  },
354
354
  {
355
355
  internalType: "uint256",
356
- name: "minOtOut",
356
+ name: "otOutguessMin",
357
+ type: "uint256",
358
+ },
359
+ {
360
+ internalType: "uint256",
361
+ name: "otOutguessMax",
357
362
  type: "uint256",
358
363
  },
359
364
  {
360
365
  internalType: "uint256",
361
- name: "netOtOutGuessMin",
366
+ name: "maxIteration",
362
367
  type: "uint256",
363
368
  },
364
369
  {
365
370
  internalType: "uint256",
366
- name: "netOtOutGuessMax",
371
+ name: "eps",
367
372
  type: "uint256",
368
373
  },
369
374
  ],
@@ -397,17 +402,22 @@ const _abi = [
397
402
  },
398
403
  {
399
404
  internalType: "uint256",
400
- name: "minOtOut",
405
+ name: "otOutguessMin",
401
406
  type: "uint256",
402
407
  },
403
408
  {
404
409
  internalType: "uint256",
405
- name: "netOtOutGuessMin",
410
+ name: "otOutguessMax",
406
411
  type: "uint256",
407
412
  },
408
413
  {
409
414
  internalType: "uint256",
410
- name: "netOtOutGuessMax",
415
+ name: "maxIteration",
416
+ type: "uint256",
417
+ },
418
+ {
419
+ internalType: "uint256",
420
+ name: "eps",
411
421
  type: "uint256",
412
422
  },
413
423
  ],
@@ -415,7 +425,7 @@ const _abi = [
415
425
  outputs: [
416
426
  {
417
427
  internalType: "uint256",
418
- name: "netOtOut",
428
+ name: "",
419
429
  type: "uint256",
420
430
  },
421
431
  ],
@@ -436,22 +446,27 @@ const _abi = [
436
446
  },
437
447
  {
438
448
  internalType: "uint256",
439
- name: "maxOtIn",
449
+ name: "exactScyOut",
440
450
  type: "uint256",
441
451
  },
442
452
  {
443
453
  internalType: "uint256",
444
- name: "exactScyOut",
454
+ name: "otInGuessMin",
445
455
  type: "uint256",
446
456
  },
447
457
  {
448
458
  internalType: "uint256",
449
- name: "netOtInGuessMin",
459
+ name: "otInGuessMax",
450
460
  type: "uint256",
451
461
  },
452
462
  {
453
463
  internalType: "uint256",
454
- name: "netOtInGuessMax",
464
+ name: "maxIteration",
465
+ type: "uint256",
466
+ },
467
+ {
468
+ internalType: "uint256",
469
+ name: "eps",
455
470
  type: "uint256",
456
471
  },
457
472
  ],
@@ -459,7 +474,7 @@ const _abi = [
459
474
  outputs: [
460
475
  {
461
476
  internalType: "uint256",
462
- name: "netOtIn",
477
+ name: "",
463
478
  type: "uint256",
464
479
  },
465
480
  ],
@@ -493,7 +508,7 @@ const _abi = [
493
508
  outputs: [
494
509
  {
495
510
  internalType: "uint256",
496
- name: "netScyIn",
511
+ name: "",
497
512
  type: "uint256",
498
513
  },
499
514
  ],
@@ -68,6 +68,35 @@ const _abi = [
68
68
  stateMutability: "view",
69
69
  type: "function",
70
70
  },
71
+ {
72
+ inputs: [
73
+ {
74
+ internalType: "address",
75
+ name: "token",
76
+ type: "address",
77
+ },
78
+ ],
79
+ name: "getPendleTokenType",
80
+ outputs: [
81
+ {
82
+ internalType: "bool",
83
+ name: "isOT",
84
+ type: "bool",
85
+ },
86
+ {
87
+ internalType: "bool",
88
+ name: "isYT",
89
+ type: "bool",
90
+ },
91
+ {
92
+ internalType: "bool",
93
+ name: "isMarket",
94
+ type: "bool",
95
+ },
96
+ ],
97
+ stateMutability: "view",
98
+ type: "function",
99
+ },
71
100
  {
72
101
  inputs: [
73
102
  {
@@ -54,17 +54,22 @@ const _abi = [
54
54
  },
55
55
  {
56
56
  internalType: "uint256",
57
- name: "minYtOut",
57
+ name: "netYtOutGuessMin",
58
58
  type: "uint256",
59
59
  },
60
60
  {
61
61
  internalType: "uint256",
62
- name: "netYtOutGuessMin",
62
+ name: "netYtOutGuessMax",
63
63
  type: "uint256",
64
64
  },
65
65
  {
66
66
  internalType: "uint256",
67
- name: "netYtOutGuessMax",
67
+ name: "maxIteration",
68
+ type: "uint256",
69
+ },
70
+ {
71
+ internalType: "uint256",
72
+ name: "eps",
68
73
  type: "uint256",
69
74
  },
70
75
  ],
@@ -98,17 +103,22 @@ const _abi = [
98
103
  },
99
104
  {
100
105
  internalType: "uint256",
101
- name: "minYtOut",
106
+ name: "netYtOutGuessMin",
102
107
  type: "uint256",
103
108
  },
104
109
  {
105
110
  internalType: "uint256",
106
- name: "netYtOutGuessMin",
111
+ name: "netYtOutGuessMax",
107
112
  type: "uint256",
108
113
  },
109
114
  {
110
115
  internalType: "uint256",
111
- name: "netYtOutGuessMax",
116
+ name: "maxIteration",
117
+ type: "uint256",
118
+ },
119
+ {
120
+ internalType: "uint256",
121
+ name: "eps",
112
122
  type: "uint256",
113
123
  },
114
124
  ],
@@ -230,6 +240,55 @@ const _abi = [
230
240
  stateMutability: "nonpayable",
231
241
  type: "function",
232
242
  },
243
+ {
244
+ inputs: [
245
+ {
246
+ internalType: "address",
247
+ name: "receiver",
248
+ type: "address",
249
+ },
250
+ {
251
+ internalType: "address",
252
+ name: "market",
253
+ type: "address",
254
+ },
255
+ {
256
+ internalType: "uint256",
257
+ name: "exactScyOut",
258
+ type: "uint256",
259
+ },
260
+ {
261
+ internalType: "uint256",
262
+ name: "netYtInGuessMin",
263
+ type: "uint256",
264
+ },
265
+ {
266
+ internalType: "uint256",
267
+ name: "netYtInGuessMax",
268
+ type: "uint256",
269
+ },
270
+ {
271
+ internalType: "uint256",
272
+ name: "maxIteration",
273
+ type: "uint256",
274
+ },
275
+ {
276
+ internalType: "uint256",
277
+ name: "eps",
278
+ type: "uint256",
279
+ },
280
+ ],
281
+ name: "swapYtForExactScy",
282
+ outputs: [
283
+ {
284
+ internalType: "uint256",
285
+ name: "netYtIn",
286
+ type: "uint256",
287
+ },
288
+ ],
289
+ stateMutability: "nonpayable",
290
+ type: "function",
291
+ },
233
292
  ];
234
293
 
235
294
  export class IPRouterYT__factory {
@@ -84,6 +84,44 @@ const _abi = [
84
84
  stateMutability: "view",
85
85
  type: "function",
86
86
  },
87
+ {
88
+ inputs: [
89
+ {
90
+ internalType: "address",
91
+ name: "",
92
+ type: "address",
93
+ },
94
+ ],
95
+ name: "isOT",
96
+ outputs: [
97
+ {
98
+ internalType: "bool",
99
+ name: "",
100
+ type: "bool",
101
+ },
102
+ ],
103
+ stateMutability: "view",
104
+ type: "function",
105
+ },
106
+ {
107
+ inputs: [
108
+ {
109
+ internalType: "address",
110
+ name: "",
111
+ type: "address",
112
+ },
113
+ ],
114
+ name: "isYT",
115
+ outputs: [
116
+ {
117
+ internalType: "bool",
118
+ name: "",
119
+ type: "bool",
120
+ },
121
+ ],
122
+ stateMutability: "view",
123
+ type: "function",
124
+ },
87
125
  {
88
126
  inputs: [],
89
127
  name: "treasury",
@@ -234,32 +234,13 @@ const _abi = [
234
234
  type: "address",
235
235
  },
236
236
  ],
237
- name: "redeemDueInterest",
237
+ name: "redeemDueInterestAndRewards",
238
238
  outputs: [
239
239
  {
240
240
  internalType: "uint256",
241
241
  name: "interestOut",
242
242
  type: "uint256",
243
243
  },
244
- ],
245
- stateMutability: "nonpayable",
246
- type: "function",
247
- },
248
- {
249
- inputs: [
250
- {
251
- internalType: "address",
252
- name: "user",
253
- type: "address",
254
- },
255
- {
256
- internalType: "address",
257
- name: "receiver",
258
- type: "address",
259
- },
260
- ],
261
- name: "redeemDueRewards",
262
- outputs: [
263
244
  {
264
245
  internalType: "uint256[]",
265
246
  name: "rewardsOut",
@@ -0,0 +1,39 @@
1
+ /* Autogenerated file. Do not edit manually. */
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+
5
+ import { Contract, Signer, utils } from "ethers";
6
+ import { Provider } from "@ethersproject/providers";
7
+ import type {
8
+ IPermissionsV2Upg,
9
+ IPermissionsV2UpgInterface,
10
+ } from "../IPermissionsV2Upg";
11
+
12
+ const _abi = [
13
+ {
14
+ inputs: [],
15
+ name: "governanceManager",
16
+ outputs: [
17
+ {
18
+ internalType: "address",
19
+ name: "",
20
+ type: "address",
21
+ },
22
+ ],
23
+ stateMutability: "view",
24
+ type: "function",
25
+ },
26
+ ];
27
+
28
+ export class IPermissionsV2Upg__factory {
29
+ static readonly abi = _abi;
30
+ static createInterface(): IPermissionsV2UpgInterface {
31
+ return new utils.Interface(_abi) as IPermissionsV2UpgInterface;
32
+ }
33
+ static connect(
34
+ address: string,
35
+ signerOrProvider: Signer | Provider
36
+ ): IPermissionsV2Upg {
37
+ return new Contract(address, _abi, signerOrProvider) as IPermissionsV2Upg;
38
+ }
39
+ }
@@ -210,6 +210,11 @@ const _abi = [
210
210
  name: "baseTokenIn",
211
211
  type: "address",
212
212
  },
213
+ {
214
+ internalType: "uint256",
215
+ name: "amountBaseToPull",
216
+ type: "uint256",
217
+ },
213
218
  {
214
219
  internalType: "uint256",
215
220
  name: "minAmountScyOut",
@@ -227,6 +232,35 @@ const _abi = [
227
232
  stateMutability: "nonpayable",
228
233
  type: "function",
229
234
  },
235
+ {
236
+ inputs: [
237
+ {
238
+ internalType: "address",
239
+ name: "receiver",
240
+ type: "address",
241
+ },
242
+ {
243
+ internalType: "address",
244
+ name: "baseTokenIn",
245
+ type: "address",
246
+ },
247
+ {
248
+ internalType: "uint256",
249
+ name: "minAmountScyOut",
250
+ type: "uint256",
251
+ },
252
+ ],
253
+ name: "mintNoPull",
254
+ outputs: [
255
+ {
256
+ internalType: "uint256",
257
+ name: "amountScyOut",
258
+ type: "uint256",
259
+ },
260
+ ],
261
+ stateMutability: "nonpayable",
262
+ type: "function",
263
+ },
230
264
  {
231
265
  inputs: [],
232
266
  name: "name",
@@ -252,6 +286,11 @@ const _abi = [
252
286
  name: "baseTokenOut",
253
287
  type: "address",
254
288
  },
289
+ {
290
+ internalType: "uint256",
291
+ name: "amountScyToPull",
292
+ type: "uint256",
293
+ },
255
294
  {
256
295
  internalType: "uint256",
257
296
  name: "minAmountBaseOut",
@@ -273,12 +312,36 @@ const _abi = [
273
312
  inputs: [
274
313
  {
275
314
  internalType: "address",
276
- name: "user",
315
+ name: "receiver",
277
316
  type: "address",
278
317
  },
279
318
  {
280
319
  internalType: "address",
281
- name: "receiver",
320
+ name: "baseTokenOut",
321
+ type: "address",
322
+ },
323
+ {
324
+ internalType: "uint256",
325
+ name: "minAmountBaseOut",
326
+ type: "uint256",
327
+ },
328
+ ],
329
+ name: "redeemNoPull",
330
+ outputs: [
331
+ {
332
+ internalType: "uint256",
333
+ name: "amountBaseOut",
334
+ type: "uint256",
335
+ },
336
+ ],
337
+ stateMutability: "nonpayable",
338
+ type: "function",
339
+ },
340
+ {
341
+ inputs: [
342
+ {
343
+ internalType: "address",
344
+ name: "user",
282
345
  type: "address",
283
346
  },
284
347
  ],
@@ -0,0 +1,78 @@
1
+ /* Autogenerated file. Do not edit manually. */
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+
5
+ import { Contract, Signer, utils } from "ethers";
6
+ import { Provider } from "@ethersproject/providers";
7
+ import type {
8
+ OwnableUpgradeable,
9
+ OwnableUpgradeableInterface,
10
+ } from "../OwnableUpgradeable";
11
+
12
+ const _abi = [
13
+ {
14
+ anonymous: false,
15
+ inputs: [
16
+ {
17
+ indexed: true,
18
+ internalType: "address",
19
+ name: "previousOwner",
20
+ type: "address",
21
+ },
22
+ {
23
+ indexed: true,
24
+ internalType: "address",
25
+ name: "newOwner",
26
+ type: "address",
27
+ },
28
+ ],
29
+ name: "OwnershipTransferred",
30
+ type: "event",
31
+ },
32
+ {
33
+ inputs: [],
34
+ name: "owner",
35
+ outputs: [
36
+ {
37
+ internalType: "address",
38
+ name: "",
39
+ type: "address",
40
+ },
41
+ ],
42
+ stateMutability: "view",
43
+ type: "function",
44
+ },
45
+ {
46
+ inputs: [],
47
+ name: "renounceOwnership",
48
+ outputs: [],
49
+ stateMutability: "nonpayable",
50
+ type: "function",
51
+ },
52
+ {
53
+ inputs: [
54
+ {
55
+ internalType: "address",
56
+ name: "newOwner",
57
+ type: "address",
58
+ },
59
+ ],
60
+ name: "transferOwnership",
61
+ outputs: [],
62
+ stateMutability: "nonpayable",
63
+ type: "function",
64
+ },
65
+ ];
66
+
67
+ export class OwnableUpgradeable__factory {
68
+ static readonly abi = _abi;
69
+ static createInterface(): OwnableUpgradeableInterface {
70
+ return new utils.Interface(_abi) as OwnableUpgradeableInterface;
71
+ }
72
+ static connect(
73
+ address: string,
74
+ signerOrProvider: Signer | Provider
75
+ ): OwnableUpgradeable {
76
+ return new Contract(address, _abi, signerOrProvider) as OwnableUpgradeable;
77
+ }
78
+ }