@pendle/core-v2 4.0.5 → 4.1.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 (161) hide show
  1. package/build/artifacts/contracts/core/StandardizedYield/implementations/AaveV3/PendleAaveV3SY.sol/PendleAaveV3SY.dbg.json +1 -1
  2. package/build/artifacts/contracts/core/StandardizedYield/implementations/AaveV3/PendleAaveV3SY.sol/PendleAaveV3SY.json +2 -2
  3. package/build/artifacts/contracts/core/StandardizedYield/implementations/EtherFi/PendleWEEthSY.sol/PendleWEEthSY.dbg.json +1 -1
  4. package/build/artifacts/contracts/core/StandardizedYield/implementations/EtherFi/PendleWEEthSY.sol/PendleWEEthSY.json +2 -2
  5. package/build/artifacts/contracts/core/StandardizedYield/implementations/KelpDAO/PendleRsETHSY.sol/PendleRsETHSY.dbg.json +1 -1
  6. package/build/artifacts/contracts/core/StandardizedYield/implementations/KelpDAO/PendleRsETHSY.sol/PendleRsETHSY.json +20 -2
  7. package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleL2LRTSY.sol/PendleL2LRTSY.dbg.json +4 -0
  8. package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleL2LRTSY.sol/PendleL2LRTSY.json +1054 -0
  9. package/build/artifacts/contracts/core/StandardizedYield/implementations/Renzo/PendleEzETHSY.sol/PendleEzETHSY.dbg.json +4 -0
  10. package/build/artifacts/contracts/core/StandardizedYield/implementations/Renzo/PendleEzETHSY.sol/PendleEzETHSY.json +1141 -0
  11. package/build/artifacts/contracts/core/StandardizedYield/implementations/Swell/PendleRswETHSY.sol/PendleRswETHSY.dbg.json +4 -0
  12. package/build/artifacts/contracts/core/StandardizedYield/implementations/Swell/PendleRswETHSY.sol/PendleRswETHSY.json +1044 -0
  13. package/build/artifacts/contracts/core/StandardizedYield/implementations/Swell/PendleSwETH.sol/SwETHSY.dbg.json +1 -1
  14. package/build/artifacts/contracts/core/StandardizedYield/implementations/Swell/PendleSwETH.sol/SwETHSY.json +2 -2
  15. package/build/artifacts/contracts/interfaces/IPActionMarketCoreStatic.sol/IPActionMarketCoreStatic.dbg.json +1 -1
  16. package/build/artifacts/contracts/interfaces/IPActionMarketCoreStatic.sol/IPActionMarketCoreStatic.json +0 -45
  17. package/build/artifacts/contracts/interfaces/IPActionMintRedeemStatic.sol/IPActionMintRedeemStatic.dbg.json +1 -1
  18. package/build/artifacts/contracts/interfaces/IPActionMintRedeemStatic.sol/IPActionMintRedeemStatic.json +0 -69
  19. package/build/artifacts/contracts/interfaces/IPActionStorageStatic.sol/IPActionStorageStatic.dbg.json +1 -1
  20. package/build/artifacts/contracts/interfaces/IPActionStorageStatic.sol/IPActionStorageStatic.json +0 -26
  21. package/build/artifacts/contracts/interfaces/IPRouterStatic.sol/IPRouterStatic.dbg.json +1 -1
  22. package/build/artifacts/contracts/interfaces/IPRouterStatic.sol/IPRouterStatic.json +0 -140
  23. package/build/artifacts/contracts/interfaces/Renzo/IRenzoOracle.sol/IRenzoOracle.dbg.json +4 -0
  24. package/build/artifacts/contracts/interfaces/Renzo/IRenzoOracle.sol/IRenzoOracle.json +64 -0
  25. package/build/artifacts/contracts/interfaces/Renzo/IRenzoRestakeManager.sol/IRenzoRestakeManager.dbg.json +4 -0
  26. package/build/artifacts/contracts/interfaces/Renzo/IRenzoRestakeManager.sol/IRenzoRestakeManager.json +102 -0
  27. package/build/artifacts/contracts/interfaces/Swell/IRswETH.sol/IRswETH.dbg.json +4 -0
  28. package/build/artifacts/contracts/interfaces/Swell/IRswETH.sol/IRswETH.json +44 -0
  29. package/build/artifacts/contracts/interfaces/Swell/ISwETH.sol/ISwETH.dbg.json +4 -0
  30. package/build/artifacts/contracts/interfaces/{ISwETH.sol → Swell/ISwETH.sol}/ISwETH.json +8 -8
  31. package/build/artifacts/contracts/offchain-helpers/router-static/PendleRouterStatic.sol/PendleRouterStatic.dbg.json +4 -0
  32. package/build/artifacts/contracts/offchain-helpers/router-static/PendleRouterStatic.sol/PendleRouterStatic.json +30 -0
  33. package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionInfoStatic.sol/ActionInfoStatic.dbg.json +4 -0
  34. package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionInfoStatic.sol/ActionInfoStatic.json +307 -0
  35. package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionMarketAuxStatic.sol/ActionMarketAuxStatic.dbg.json +4 -0
  36. package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionMarketAuxStatic.sol/ActionMarketAuxStatic.json +409 -0
  37. package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionMarketCoreStatic.sol/ActionMarketCoreStatic.dbg.json +4 -0
  38. package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionMarketCoreStatic.sol/ActionMarketCoreStatic.json +1352 -0
  39. package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionMintRedeemStatic.sol/ActionMintRedeemStatic.dbg.json +4 -0
  40. package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionMintRedeemStatic.sol/ActionMintRedeemStatic.json +247 -0
  41. package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionStorageStatic.sol/ActionStorageStatic.dbg.json +4 -0
  42. package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionStorageStatic.sol/ActionStorageStatic.json +202 -0
  43. package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionVePendleStatic.sol/ActionVePendleStatic.dbg.json +4 -0
  44. package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionVePendleStatic.sol/ActionVePendleStatic.json +93 -0
  45. package/build/artifacts/contracts/offchain-helpers/router-static/base/StorageLayout.sol/StorageLayout.dbg.json +4 -0
  46. package/build/artifacts/contracts/offchain-helpers/router-static/base/StorageLayout.sol/StorageLayout.json +10 -0
  47. package/build/artifacts/contracts/oracles/PendleRedStoneRateOracle.sol/PendleRedStoneRateOracle.dbg.json +4 -0
  48. package/build/artifacts/contracts/oracles/PendleRedStoneRateOracle.sol/PendleRedStoneRateOracle.json +66 -0
  49. package/build/artifacts/contracts/router/swap-aggregator/PendleSwap.sol/PendleSwapBase.dbg.json +1 -1
  50. package/build/artifacts/contracts/router/swap-aggregator/PendleSwap.sol/PendleSwapL1.dbg.json +1 -1
  51. package/build/artifacts/contracts/router/swap-aggregator/PendleSwap.sol/PendleSwapL1.json +2 -2
  52. package/build/artifacts/contracts/router/swap-aggregator/PendleSwap.sol/PendleSwapL2.dbg.json +1 -1
  53. package/build/artifacts/contracts/router/swap-aggregator/PendleSwap.sol/PendleSwapL2.json +2 -2
  54. package/build/artifacts/contracts/router/swap-aggregator/kyberswap/interfaces/IExecutorHelper.sol/IExecutorHelper.dbg.json +1 -1
  55. package/build/artifacts/contracts/router/swap-aggregator/kyberswap/interfaces/IExecutorHelper.sol/IExecutorHelper.json +168 -0
  56. package/build/artifacts/contracts/router/swap-aggregator/kyberswap/interfaces/IExecutorHelperL2.sol/IExecutorHelperL2.dbg.json +1 -1
  57. package/build/artifacts/contracts/router/swap-aggregator/kyberswap/interfaces/IExecutorHelperL2.sol/IExecutorHelperL2.json +378 -0
  58. package/build/artifacts/contracts/router/swap-aggregator/kyberswap/l1-contracts/InputScalingHelper.sol/InputScalingHelper.dbg.json +1 -1
  59. package/build/artifacts/contracts/router/swap-aggregator/kyberswap/l1-contracts/InputScalingHelper.sol/InputScalingHelper.json +2 -2
  60. package/build/artifacts/contracts/router/swap-aggregator/kyberswap/l1-contracts/ScalingDataLib.sol/ScalingDataLib.dbg.json +1 -1
  61. package/build/artifacts/contracts/router/swap-aggregator/kyberswap/l1-contracts/ScalingDataLib.sol/ScalingDataLib.json +2 -2
  62. package/build/artifacts/contracts/router/swap-aggregator/kyberswap/l2-contracts/CalldataReader.sol/CalldataReader.dbg.json +1 -1
  63. package/build/artifacts/contracts/router/swap-aggregator/kyberswap/l2-contracts/CalldataReader.sol/CalldataReader.json +2 -2
  64. package/build/artifacts/contracts/router/swap-aggregator/kyberswap/l2-contracts/CalldataWriter.sol/CalldataWriter.dbg.json +1 -1
  65. package/build/artifacts/contracts/router/swap-aggregator/kyberswap/l2-contracts/CalldataWriter.sol/CalldataWriter.json +2 -2
  66. package/build/artifacts/contracts/router/swap-aggregator/kyberswap/l2-contracts/Common.sol/Common.dbg.json +1 -1
  67. package/build/artifacts/contracts/router/swap-aggregator/kyberswap/l2-contracts/Common.sol/Common.json +2 -2
  68. package/build/artifacts/contracts/router/swap-aggregator/kyberswap/l2-contracts/DexScaler.sol/DexScaler.dbg.json +1 -1
  69. package/build/artifacts/contracts/router/swap-aggregator/kyberswap/l2-contracts/DexScaler.sol/DexScaler.json +2 -2
  70. package/build/artifacts/contracts/router/swap-aggregator/kyberswap/l2-contracts/ExecutorReader.sol/ExecutorReader.dbg.json +1 -1
  71. package/build/artifacts/contracts/router/swap-aggregator/kyberswap/l2-contracts/ExecutorReader.sol/ExecutorReader.json +2 -2
  72. package/build/artifacts/contracts/router/swap-aggregator/kyberswap/l2-contracts/InputScalingHelperL2.sol/InputScalingHelperL2.dbg.json +1 -1
  73. package/build/artifacts/contracts/router/swap-aggregator/kyberswap/l2-contracts/InputScalingHelperL2.sol/InputScalingHelperL2.json +2 -2
  74. package/build/artifacts/contracts/router/swap-aggregator/kyberswap/l2-contracts/ScalingDataL2Lib.sol/ScalingDataL2Lib.dbg.json +1 -1
  75. package/build/artifacts/contracts/router/swap-aggregator/kyberswap/l2-contracts/ScalingDataL2Lib.sol/ScalingDataL2Lib.json +2 -2
  76. package/contracts/core/StandardizedYield/implementations/AaveV3/PendleAaveV3SY.sol +1 -1
  77. package/contracts/core/StandardizedYield/implementations/EtherFi/PendleWEEthSY.sol +1 -1
  78. package/contracts/core/StandardizedYield/implementations/KelpDAO/PendleRsETHSY.sol +18 -9
  79. package/contracts/core/StandardizedYield/implementations/PendleL2LRTSY.sol +93 -0
  80. package/contracts/core/StandardizedYield/implementations/Renzo/PendleEzETHSY.sol +139 -0
  81. package/contracts/core/StandardizedYield/implementations/Swell/PendleRswETHSY.sol +101 -0
  82. package/contracts/core/StandardizedYield/implementations/Swell/PendleSwETH.sol +1 -1
  83. package/contracts/interfaces/IPActionMarketCoreStatic.sol +8 -17
  84. package/contracts/interfaces/IPActionMintRedeemStatic.sol +4 -16
  85. package/contracts/interfaces/IPActionStorageStatic.sol +0 -4
  86. package/contracts/interfaces/Renzo/IRenzoOracle.sol +8 -0
  87. package/contracts/interfaces/Renzo/IRenzoRestakeManager.sol +14 -0
  88. package/contracts/interfaces/Swell/IRswETH.sol +10 -0
  89. package/contracts/interfaces/{ISwETH.sol → Swell/ISwETH.sol} +2 -2
  90. package/contracts/offchain-helpers/router-static/PendleRouterStatic.sol +19 -0
  91. package/contracts/offchain-helpers/router-static/base/ActionInfoStatic.sol +109 -0
  92. package/contracts/offchain-helpers/router-static/base/ActionMarketAuxStatic.sol +182 -0
  93. package/contracts/offchain-helpers/router-static/base/ActionMarketCoreStatic.sol +672 -0
  94. package/contracts/offchain-helpers/router-static/base/ActionMintRedeemStatic.sol +116 -0
  95. package/contracts/offchain-helpers/router-static/base/ActionStorageStatic.sol +64 -0
  96. package/contracts/offchain-helpers/router-static/base/ActionVePendleStatic.sol +55 -0
  97. package/contracts/offchain-helpers/router-static/base/StorageLayout.sol +20 -0
  98. package/contracts/oracles/PendleRedStoneRateOracle.sol +23 -0
  99. package/contracts/router/swap-aggregator/kyberswap/interfaces/IExecutorHelper.sol +58 -1
  100. package/contracts/router/swap-aggregator/kyberswap/interfaces/IExecutorHelperL2.sol +107 -1
  101. package/contracts/router/swap-aggregator/kyberswap/l1-contracts/InputScalingHelper.sol +14 -0
  102. package/contracts/router/swap-aggregator/kyberswap/l1-contracts/ScalingDataLib.sol +32 -0
  103. package/contracts/router/swap-aggregator/kyberswap/l2-contracts/CalldataReader.sol +6 -0
  104. package/contracts/router/swap-aggregator/kyberswap/l2-contracts/DexScaler.sol +59 -2
  105. package/contracts/router/swap-aggregator/kyberswap/l2-contracts/InputScalingHelperL2.sol +22 -1
  106. package/contracts/router/swap-aggregator/kyberswap/l2-contracts/ScalingDataL2Lib.sol +24 -0
  107. package/deployments/1-core.json +1 -1
  108. package/deployments/1-markets/EZETH-JUNE2024.json +11 -0
  109. package/deployments/1-markets/RSETH-KELP-JUNE2024.json +11 -0
  110. package/deployments/10-core.json +1 -1
  111. package/deployments/42161-core.json +1 -1
  112. package/deployments/42161-markets/RSETH-APR2024-ARBITRUM.json +11 -0
  113. package/deployments/42161-markets/WEETH-APR2024.json +11 -0
  114. package/deployments/56-core.json +1 -1
  115. package/deployments/merkle-distribution/2024-01-25.json +9615 -0
  116. package/package.json +1 -1
  117. package/typechain-types/IExecutorHelper.ts +273 -0
  118. package/typechain-types/IExecutorHelperL2.ts +455 -0
  119. package/typechain-types/IPActionMarketCoreStatic.ts +18 -63
  120. package/typechain-types/IPActionMintRedeemStatic.ts +10 -102
  121. package/typechain-types/IPActionStorageStatic.ts +0 -55
  122. package/typechain-types/IPRouterStatic.ts +28 -220
  123. package/typechain-types/IRenzoOracle.ts +152 -0
  124. package/typechain-types/IRenzoRestakeManager.ts +219 -0
  125. package/typechain-types/IRswETH.ts +138 -0
  126. package/typechain-types/ISwETH.ts +24 -9
  127. package/typechain-types/PendleEzETHSY.ts +1471 -0
  128. package/typechain-types/PendleL2LRTSY.ts +1323 -0
  129. package/typechain-types/PendleRedStoneRateOracle.ts +113 -0
  130. package/typechain-types/PendleRsETHSY.ts +21 -0
  131. package/typechain-types/PendleRswETHSY.ts +1294 -0
  132. package/typechain-types/factories/ActionInfoStatic__factory.ts +1 -1
  133. package/typechain-types/factories/ActionMarketAuxStatic__factory.ts +1 -1
  134. package/typechain-types/factories/ActionMarketCoreStatic__factory.ts +1 -1
  135. package/typechain-types/factories/ActionMintRedeemStatic__factory.ts +1 -1
  136. package/typechain-types/factories/ActionStorageStatic__factory.ts +1 -1
  137. package/typechain-types/factories/ActionVePendleStatic__factory.ts +1 -1
  138. package/typechain-types/factories/IExecutorHelperL2__factory.ts +378 -0
  139. package/typechain-types/factories/IExecutorHelper__factory.ts +168 -0
  140. package/typechain-types/factories/IPActionMarketCoreStatic__factory.ts +0 -45
  141. package/typechain-types/factories/IPActionMintRedeemStatic__factory.ts +0 -69
  142. package/typechain-types/factories/IPActionStorageStatic__factory.ts +0 -26
  143. package/typechain-types/factories/IPRouterStatic__factory.ts +0 -140
  144. package/typechain-types/factories/IRenzoOracle__factory.ts +76 -0
  145. package/typechain-types/factories/IRenzoRestakeManager__factory.ts +121 -0
  146. package/typechain-types/factories/IRswETH__factory.ts +56 -0
  147. package/typechain-types/factories/ISwETH__factory.ts +7 -7
  148. package/typechain-types/factories/PendleAaveV3SY__factory.ts +1 -1
  149. package/typechain-types/factories/PendleEzETHSY__factory.ts +1218 -0
  150. package/typechain-types/factories/PendleL2LRTSY__factory.ts +1139 -0
  151. package/typechain-types/factories/PendleRedStoneRateOracle__factory.ts +142 -0
  152. package/typechain-types/factories/PendleRouterStatic__factory.ts +1 -1
  153. package/typechain-types/factories/PendleRsETHSY__factory.ts +23 -1
  154. package/typechain-types/factories/PendleRswETHSY__factory.ts +1117 -0
  155. package/typechain-types/factories/PendleSwapL1__factory.ts +1 -1
  156. package/typechain-types/factories/PendleSwapL2__factory.ts +1 -1
  157. package/typechain-types/factories/PendleWEEthSY__factory.ts +1 -1
  158. package/typechain-types/factories/SwETHSY__factory.ts +1 -1
  159. package/typechain-types/hardhat.d.ts +135 -0
  160. package/typechain-types/index.ts +28 -0
  161. package/build/artifacts/contracts/interfaces/ISwETH.sol/ISwETH.dbg.json +0 -4
@@ -5,13 +5,14 @@ import "../../SYBase.sol";
5
5
  import "../../../../interfaces/IPExchangeRateOracle.sol";
6
6
  import "../../../../interfaces/KelpDAO/IKelpDepositPool.sol";
7
7
  import "../../../../interfaces/KelpDAO/IKelpLRTConfig.sol";
8
- import "../../../../interfaces/IStETH.sol";
8
+ import "../../../../interfaces/Stader/IStaderStakeManager.sol";
9
9
 
10
10
  contract PendleRsETHSY is SYBase {
11
11
  using ArrayLib for address[];
12
12
 
13
13
  address public immutable rsETH;
14
14
  address public immutable depositPool;
15
+ address public immutable staderStakeManager;
15
16
  address public lrtConfig;
16
17
 
17
18
  address public exchangeRateOracle;
@@ -24,12 +25,14 @@ contract PendleRsETHSY is SYBase {
24
25
  constructor(
25
26
  address _rsETH,
26
27
  address _depositPool,
28
+ address _staderStakeManager,
27
29
  address _exchangeRateOracle,
28
30
  address _ETHx,
29
31
  address _stETH
30
32
  ) SYBase("SY Kelp rsETH", "SY-rsETH", _rsETH) {
31
33
  rsETH = _rsETH;
32
34
  depositPool = _depositPool;
35
+ staderStakeManager = _staderStakeManager;
33
36
  exchangeRateOracle = _exchangeRateOracle;
34
37
  ETHx = _ETHx;
35
38
  stETH = _stETH;
@@ -64,10 +67,18 @@ contract PendleRsETHSY is SYBase {
64
67
  amountSharesOut = amountDeposited;
65
68
  } else {
66
69
  if (tokenIn == NATIVE) {
67
- (tokenIn, amountDeposited) = (stETH, _depositStETH(amountDeposited));
70
+ (tokenIn, amountDeposited) = (
71
+ ETHx,
72
+ IStaderStakeManager(staderStakeManager).deposit{value: amountDeposited}(address(this))
73
+ );
68
74
  }
69
75
  uint256 preBalance = _selfBalance(rsETH);
70
- IKelpDepositPool(depositPool).depositAsset(tokenIn, amountDeposited, 0, "pendle"); // TODO: hardcode referral to save gas
76
+ IKelpDepositPool(depositPool).depositAsset(
77
+ tokenIn,
78
+ amountDeposited,
79
+ 0,
80
+ "c05f6902ec7c7434ceb666010c16a63a2e3995aad11f1280855b26402194346b"
81
+ ); // TODO: hardcode referral to save gas
71
82
  amountSharesOut = _selfBalance(rsETH) - preBalance;
72
83
  }
73
84
  }
@@ -81,11 +92,6 @@ contract PendleRsETHSY is SYBase {
81
92
  return amountSharesToRedeem;
82
93
  }
83
94
 
84
- function _depositStETH(uint256 amountETH) internal returns (uint256 amountStETH) {
85
- uint256 amountStEthSharesOut = IStETH(stETH).submit{value: amountETH}(address(0));
86
- amountStETH = IStETH(stETH).getPooledEthByShares(amountStEthSharesOut);
87
- }
88
-
89
95
  /*///////////////////////////////////////////////////////////////
90
96
  EXCHANGE-RATE
91
97
  //////////////////////////////////////////////////////////////*/
@@ -111,7 +117,10 @@ contract PendleRsETHSY is SYBase {
111
117
  return amountTokenToDeposit;
112
118
  }
113
119
  if (tokenIn == NATIVE) {
114
- tokenIn = stETH;
120
+ (tokenIn, amountTokenToDeposit) = (
121
+ ETHx,
122
+ IStaderStakeManager(staderStakeManager).previewDeposit(amountTokenToDeposit)
123
+ );
115
124
  }
116
125
  return IKelpDepositPool(depositPool).getRsETHAmountToMint(tokenIn, amountTokenToDeposit);
117
126
  }
@@ -0,0 +1,93 @@
1
+ // SPDX-License-Identifier: GPL-3.0-or-later
2
+ pragma solidity ^0.8.17;
3
+
4
+ import "../SYBase.sol";
5
+ import "../../../interfaces/IPExchangeRateOracle.sol";
6
+
7
+ contract PendleL2LRTSY is SYBase {
8
+ using PMath for int256;
9
+
10
+ address public exchangeRateOracle;
11
+ address internal immutable underlyingAssetOnEthAddr;
12
+ uint8 internal immutable underlyingAssetOnEthDecimals;
13
+
14
+ constructor(
15
+ string memory _name,
16
+ string memory _symbol,
17
+ address _token,
18
+ address _exchangeRateOracle,
19
+ address _underlyingAssetOnEthAddr,
20
+ uint8 _underlyingAssetOnEthDecimals
21
+ ) SYBase(_name, _symbol, _token) {
22
+ exchangeRateOracle = _exchangeRateOracle;
23
+ underlyingAssetOnEthAddr = _underlyingAssetOnEthAddr;
24
+ underlyingAssetOnEthDecimals = _underlyingAssetOnEthDecimals;
25
+ }
26
+
27
+ function setExchangeRateOracle(address newOracle) external onlyOwner {
28
+ exchangeRateOracle = newOracle;
29
+ }
30
+
31
+ /*///////////////////////////////////////////////////////////////
32
+ DEPOSIT/REDEEM USING BASE TOKENS
33
+ //////////////////////////////////////////////////////////////*/
34
+
35
+ function _deposit(address, uint256 amountDeposited) internal pure override returns (uint256 /*amountSharesOut*/) {
36
+ return amountDeposited;
37
+ }
38
+
39
+ function _redeem(
40
+ address receiver,
41
+ address tokenOut,
42
+ uint256 amountSharesToRedeem
43
+ ) internal override returns (uint256 /*amountTokenOut*/) {
44
+ _transferOut(tokenOut, receiver, amountSharesToRedeem);
45
+ return amountSharesToRedeem;
46
+ }
47
+
48
+ /*///////////////////////////////////////////////////////////////
49
+ EXCHANGE-RATE
50
+ //////////////////////////////////////////////////////////////*/
51
+
52
+ function exchangeRate() public view override returns (uint256) {
53
+ return IPExchangeRateOracle(exchangeRateOracle).getExchangeRate();
54
+ }
55
+
56
+ /*///////////////////////////////////////////////////////////////
57
+ MISC FUNCTIONS FOR METADATA
58
+ //////////////////////////////////////////////////////////////*/
59
+
60
+ function _previewDeposit(
61
+ address,
62
+ uint256 amountTokenToDeposit
63
+ ) internal pure override returns (uint256 /*amountSharesOut*/) {
64
+ return amountTokenToDeposit;
65
+ }
66
+
67
+ function _previewRedeem(
68
+ address,
69
+ uint256 amountSharesToRedeem
70
+ ) internal pure override returns (uint256 /*amountTokenOut*/) {
71
+ return amountSharesToRedeem;
72
+ }
73
+
74
+ function getTokensIn() public view override returns (address[] memory res) {
75
+ return ArrayLib.create(yieldToken);
76
+ }
77
+
78
+ function getTokensOut() public view override returns (address[] memory res) {
79
+ return ArrayLib.create(yieldToken);
80
+ }
81
+
82
+ function isValidTokenIn(address token) public view override returns (bool) {
83
+ return token == yieldToken;
84
+ }
85
+
86
+ function isValidTokenOut(address token) public view override returns (bool) {
87
+ return token == yieldToken;
88
+ }
89
+
90
+ function assetInfo() external view returns (AssetType assetType, address assetAddress, uint8 assetDecimals) {
91
+ return (AssetType.TOKEN, underlyingAssetOnEthAddr, underlyingAssetOnEthDecimals);
92
+ }
93
+ }
@@ -0,0 +1,139 @@
1
+ // SPDX-License-Identifier: MIT
2
+ pragma solidity ^0.8.17;
3
+
4
+ import "../../SYBase.sol";
5
+ import "../../../../interfaces/IPExchangeRateOracle.sol";
6
+ import "../../../../interfaces/Renzo/IRenzoRestakeManager.sol";
7
+ import "../../../../interfaces/Renzo/IRenzoOracle.sol";
8
+
9
+ contract PendleEzETHSY is SYBase {
10
+ using ArrayLib for address[];
11
+
12
+ address public immutable ezETH;
13
+ address public immutable restakeManager;
14
+ address public immutable renzoOracle;
15
+ uint256 public immutable referralId;
16
+
17
+ address public exchangeRateOracle;
18
+ address[] public supportedCollateralTokens;
19
+
20
+ event SetNewExchangeRateOracle(address oracle);
21
+
22
+ constructor(
23
+ address _ezETH,
24
+ address _stakeManager,
25
+ address _exchangeRateOracle,
26
+ uint256 _referralId
27
+ ) SYBase("SY Renzo ezETH", "SY-ezETH", _ezETH) {
28
+ ezETH = _ezETH;
29
+ restakeManager = _stakeManager;
30
+ exchangeRateOracle = _exchangeRateOracle;
31
+ renzoOracle = IRenzoRestakeManager(restakeManager).renzoOracle();
32
+ referralId = _referralId;
33
+ }
34
+
35
+ // this way we dont have to check if length is accurate
36
+ function refetchCollateralTokens(uint256 length) external onlyOwner {
37
+ address[] memory newCollateralTokens = new address[](length);
38
+ for (uint256 i = 0; i < length; ++i) {
39
+ newCollateralTokens[i] = IRenzoRestakeManager(restakeManager).collateralTokens(i);
40
+
41
+ // just a safety check, preventing human mistake from underlying protocol
42
+ require(newCollateralTokens[i] != ezETH, "refetchCollateralTokens: should not approve ezETH");
43
+ _safeApproveInf(newCollateralTokens[i], restakeManager);
44
+ }
45
+ supportedCollateralTokens = newCollateralTokens;
46
+ }
47
+
48
+ /*///////////////////////////////////////////////////////////////
49
+ DEPOSIT/REDEEM USING BASE TOKENS
50
+ //////////////////////////////////////////////////////////////*/
51
+
52
+ function _deposit(address tokenIn, uint256 amountDeposited) internal virtual override returns (uint256) {
53
+ if (tokenIn == ezETH) {
54
+ return amountDeposited;
55
+ }
56
+
57
+ uint256 preBalance = _selfBalance(ezETH);
58
+ if (tokenIn == NATIVE) {
59
+ IRenzoRestakeManager(restakeManager).depositETH{value: amountDeposited}(referralId);
60
+ } else {
61
+ IRenzoRestakeManager(restakeManager).deposit(tokenIn, amountDeposited, referralId);
62
+ }
63
+ return _selfBalance(ezETH) - preBalance;
64
+ }
65
+
66
+ function _redeem(
67
+ address receiver,
68
+ address /*tokenOut*/,
69
+ uint256 amountSharesToRedeem
70
+ ) internal virtual override returns (uint256) {
71
+ _transferOut(ezETH, receiver, amountSharesToRedeem);
72
+ return amountSharesToRedeem;
73
+ }
74
+
75
+ /*///////////////////////////////////////////////////////////////
76
+ EXCHANGE-RATE
77
+ //////////////////////////////////////////////////////////////*/
78
+
79
+ function exchangeRate() public view virtual override returns (uint256) {
80
+ return IPExchangeRateOracle(exchangeRateOracle).getExchangeRate();
81
+ }
82
+
83
+ function setExchangeRateOracle(address newOracle) external onlyOwner {
84
+ exchangeRateOracle = newOracle;
85
+ emit SetNewExchangeRateOracle(newOracle);
86
+ }
87
+
88
+ /*///////////////////////////////////////////////////////////////
89
+ MISC FUNCTIONS FOR METADATA
90
+ //////////////////////////////////////////////////////////////*/
91
+
92
+ function _previewDeposit(
93
+ address tokenIn,
94
+ uint256 amountTokenToDeposit
95
+ ) internal view override returns (uint256 amountSharesOut) {
96
+ if (tokenIn == ezETH) {
97
+ return amountTokenToDeposit;
98
+ }
99
+
100
+ uint256 supply = IERC20(ezETH).totalSupply();
101
+ (, , uint256 tvl) = IRenzoRestakeManager(restakeManager).calculateTVLs();
102
+
103
+ uint256 value;
104
+ if (tokenIn == NATIVE) {
105
+ value = amountTokenToDeposit;
106
+ } else {
107
+ value = IRenzoOracle(renzoOracle).lookupTokenValue(tokenIn, amountTokenToDeposit);
108
+ }
109
+
110
+ return IRenzoOracle(renzoOracle).calculateMintAmount(tvl, value, supply);
111
+ }
112
+
113
+ function _previewRedeem(
114
+ address /*tokenOut*/,
115
+ uint256 amountSharesToRedeem
116
+ ) internal pure override returns (uint256 amountTokenOut) {
117
+ return amountSharesToRedeem;
118
+ }
119
+
120
+ function getTokensIn() public view virtual override returns (address[] memory) {
121
+ return ArrayLib.create(ezETH, NATIVE).merge(supportedCollateralTokens);
122
+ }
123
+
124
+ function getTokensOut() public view virtual override returns (address[] memory) {
125
+ return ArrayLib.create(ezETH);
126
+ }
127
+
128
+ function isValidTokenIn(address token) public view virtual override returns (bool) {
129
+ return token == NATIVE || token == ezETH || supportedCollateralTokens.contains(token);
130
+ }
131
+
132
+ function isValidTokenOut(address token) public view virtual override returns (bool) {
133
+ return token == ezETH;
134
+ }
135
+
136
+ function assetInfo() external pure returns (AssetType assetType, address assetAddress, uint8 assetDecimals) {
137
+ return (AssetType.TOKEN, NATIVE, 18);
138
+ }
139
+ }
@@ -0,0 +1,101 @@
1
+ // SPDX-License-Identifier: GPL-3.0-or-later
2
+ pragma solidity ^0.8.17;
3
+ import "../../SYBase.sol";
4
+ import "../../../../interfaces/Swell/IRswETH.sol";
5
+
6
+ contract PendleRswETHSY is SYBase {
7
+ using PMath for uint256;
8
+
9
+ address public immutable rswETH;
10
+ address public immutable referral;
11
+
12
+ constructor(
13
+ string memory _name,
14
+ string memory _symbol,
15
+ address _rswETH,
16
+ address _referral
17
+ ) SYBase(_name, _symbol, _rswETH) {
18
+ rswETH = _rswETH;
19
+ referral = _referral;
20
+ }
21
+
22
+ /*///////////////////////////////////////////////////////////////
23
+ DEPOSIT/REDEEM USING BASE TOKENS
24
+ //////////////////////////////////////////////////////////////*/
25
+
26
+ function _deposit(
27
+ address tokenIn,
28
+ uint256 amountDeposited
29
+ ) internal virtual override returns (uint256 /*amountSharesOut*/) {
30
+ if (tokenIn == NATIVE) {
31
+ uint256 preBalance = _selfBalance(rswETH);
32
+ IRswETH(rswETH).depositWithReferral{value: amountDeposited}(referral);
33
+ return _selfBalance(rswETH) - preBalance;
34
+ } else {
35
+ // sweth
36
+ return amountDeposited;
37
+ }
38
+ }
39
+
40
+ function _redeem(
41
+ address receiver,
42
+ address /*tokenOut*/,
43
+ uint256 amountSharesToRedeem
44
+ ) internal virtual override returns (uint256 /*amountTokenOut*/) {
45
+ _transferOut(rswETH, receiver, amountSharesToRedeem);
46
+ return amountSharesToRedeem;
47
+ }
48
+
49
+ /*///////////////////////////////////////////////////////////////
50
+ EXCHANGE-RATE
51
+ //////////////////////////////////////////////////////////////*/
52
+
53
+ function exchangeRate() public view virtual override returns (uint256) {
54
+ return IRswETH(rswETH).getRate();
55
+ }
56
+
57
+ /*///////////////////////////////////////////////////////////////
58
+ MISC FUNCTIONS FOR METADATA
59
+ //////////////////////////////////////////////////////////////*/
60
+
61
+ function _previewDeposit(
62
+ address tokenIn,
63
+ uint256 amountTokenToDeposit
64
+ ) internal view override returns (uint256 /*amountSharesOut*/) {
65
+ if (tokenIn == NATIVE) {
66
+ return amountTokenToDeposit.divDown(IRswETH(rswETH).getRate());
67
+ } else {
68
+ return amountTokenToDeposit;
69
+ }
70
+ }
71
+
72
+ function _previewRedeem(
73
+ address /*tokenOut*/,
74
+ uint256 amountSharesToRedeem
75
+ ) internal pure override returns (uint256 /*amountTokenOut*/) {
76
+ return amountSharesToRedeem;
77
+ }
78
+
79
+ function getTokensIn() public view virtual override returns (address[] memory res) {
80
+ res = new address[](2);
81
+ res[0] = rswETH;
82
+ res[1] = NATIVE;
83
+ }
84
+
85
+ function getTokensOut() public view virtual override returns (address[] memory res) {
86
+ res = new address[](1);
87
+ res[0] = rswETH;
88
+ }
89
+
90
+ function isValidTokenIn(address token) public view virtual override returns (bool) {
91
+ return token == NATIVE || token == rswETH;
92
+ }
93
+
94
+ function isValidTokenOut(address token) public view virtual override returns (bool) {
95
+ return token == rswETH;
96
+ }
97
+
98
+ function assetInfo() external pure returns (AssetType assetType, address assetAddress, uint8 assetDecimals) {
99
+ return (AssetType.TOKEN, NATIVE, 18);
100
+ }
101
+ }
@@ -1,7 +1,7 @@
1
1
  // SPDX-License-Identifier: GPL-3.0-or-later
2
2
  pragma solidity ^0.8.17;
3
3
  import "../../SYBase.sol";
4
- import "../../../../interfaces/ISwETH.sol";
4
+ import "../../../../interfaces/Swell/ISwETH.sol";
5
5
 
6
6
  contract SwETHSY is SYBase {
7
7
  using PMath for uint256;
@@ -12,7 +12,6 @@ interface IPActionMarketCoreStatic {
12
12
  address market,
13
13
  address tokenIn,
14
14
  uint256 netTokenDesired,
15
- address bulk,
16
15
  uint256 netPtDesired
17
16
  )
18
17
  external
@@ -57,15 +56,13 @@ interface IPActionMarketCoreStatic {
57
56
  function addLiquiditySingleTokenKeepYtStatic(
58
57
  address market,
59
58
  address tokenIn,
60
- uint256 netTokenIn,
61
- address bulk
59
+ uint256 netTokenIn
62
60
  ) external view returns (uint256 netLpOut, uint256 netYtOut, uint256 netSyMinted, uint256 netSyToPY);
63
61
 
64
62
  function addLiquiditySingleTokenStatic(
65
63
  address market,
66
64
  address tokenIn,
67
- uint256 netTokenIn,
68
- address bulk
65
+ uint256 netTokenIn
69
66
  )
70
67
  external
71
68
  view
@@ -87,8 +84,7 @@ interface IPActionMarketCoreStatic {
87
84
  function removeLiquidityDualTokenAndPtStatic(
88
85
  address market,
89
86
  uint256 netLpToRemove,
90
- address tokenOut,
91
- address bulk
87
+ address tokenOut
92
88
  ) external view returns (uint256 netTokenOut, uint256 netPtOut, uint256 netSyToRedeem);
93
89
 
94
90
  function removeLiquiditySinglePtStatic(
@@ -126,8 +122,7 @@ interface IPActionMarketCoreStatic {
126
122
  function removeLiquiditySingleTokenStatic(
127
123
  address market,
128
124
  uint256 netLpToRemove,
129
- address tokenOut,
130
- address bulk
125
+ address tokenOut
131
126
  )
132
127
  external
133
128
  view
@@ -150,8 +145,7 @@ interface IPActionMarketCoreStatic {
150
145
  function swapExactPtForTokenStatic(
151
146
  address market,
152
147
  uint256 exactPtIn,
153
- address tokenOut,
154
- address bulk
148
+ address tokenOut
155
149
  )
156
150
  external
157
151
  view
@@ -190,8 +184,7 @@ interface IPActionMarketCoreStatic {
190
184
  function swapExactTokenForPtStatic(
191
185
  address market,
192
186
  address tokenIn,
193
- uint256 amountTokenIn,
194
- address bulk
187
+ uint256 amountTokenIn
195
188
  )
196
189
  external
197
190
  view
@@ -206,8 +199,7 @@ interface IPActionMarketCoreStatic {
206
199
  function swapExactTokenForYtStatic(
207
200
  address market,
208
201
  address tokenIn,
209
- uint256 amountTokenIn,
210
- address bulk
202
+ uint256 amountTokenIn
211
203
  )
212
204
  external
213
205
  view
@@ -252,8 +244,7 @@ interface IPActionMarketCoreStatic {
252
244
  function swapExactYtForTokenStatic(
253
245
  address market,
254
246
  uint256 exactYtIn,
255
- address tokenOut,
256
- address bulk
247
+ address tokenOut
257
248
  )
258
249
  external
259
250
  view
@@ -5,31 +5,21 @@ interface IPActionMintRedeemStatic {
5
5
  function getAmountTokenToMintSy(
6
6
  address SY,
7
7
  address tokenIn,
8
- address bulk,
9
8
  uint256 netSyOut
10
9
  ) external view returns (uint256 netTokenIn);
11
10
 
12
- function getBulkSellerInfo(
13
- address token,
14
- address SY,
15
- uint256 netTokenIn,
16
- uint256 netSyIn
17
- ) external view returns (address bulk, uint256 totalToken, uint256 totalSy);
18
-
19
11
  function mintPyFromSyStatic(address YT, uint256 netSyToMint) external view returns (uint256 netPYOut);
20
12
 
21
13
  function mintPyFromTokenStatic(
22
14
  address YT,
23
15
  address tokenIn,
24
- uint256 netTokenIn,
25
- address bulk
16
+ uint256 netTokenIn
26
17
  ) external view returns (uint256 netPyOut);
27
18
 
28
19
  function mintSyFromTokenStatic(
29
20
  address SY,
30
21
  address tokenIn,
31
- uint256 netTokenIn,
32
- address bulk
22
+ uint256 netTokenIn
33
23
  ) external view returns (uint256 netSyOut);
34
24
 
35
25
  function redeemPyToSyStatic(address YT, uint256 netPYToRedeem) external view returns (uint256 netSyOut);
@@ -37,15 +27,13 @@ interface IPActionMintRedeemStatic {
37
27
  function redeemPyToTokenStatic(
38
28
  address YT,
39
29
  uint256 netPYToRedeem,
40
- address tokenOut,
41
- address bulk
30
+ address tokenOut
42
31
  ) external view returns (uint256 netTokenOut);
43
32
 
44
33
  function redeemSyToTokenStatic(
45
34
  address SY,
46
35
  address tokenOut,
47
- uint256 netSyIn,
48
- address bulk
36
+ uint256 netSyIn
49
37
  ) external view returns (uint256 netTokenOut);
50
38
 
51
39
  function pyIndexCurrentViewMarket(address market) external view returns (uint256);
@@ -9,10 +9,6 @@ interface IPActionStorageStatic {
9
9
 
10
10
  function getDefaultApproxParams() external view returns (ApproxParams memory);
11
11
 
12
- function setBulkSellerFactory(address _bulkSellerFactory) external;
13
-
14
- function getBulkSellerFactory() external view returns (address);
15
-
16
12
  function getOwnerAndPendingOwner() external view returns (address _owner, address _pendingOwner);
17
13
 
18
14
  function transferOwnership(address newOwner, bool direct, bool renounce) external;
@@ -0,0 +1,8 @@
1
+ // SPDX-License-Identifier: GPL-3.0-or-later
2
+ pragma solidity ^0.8.0;
3
+
4
+ interface IRenzoOracle {
5
+ function lookupTokenValue(address token, uint256 amount) external view returns (uint256);
6
+
7
+ function calculateMintAmount(uint256 tvl, uint256 value, uint256 supply) external view returns (uint256);
8
+ }
@@ -0,0 +1,14 @@
1
+ // SPDX-License-Identifier: GPL-3.0-or-later
2
+ pragma solidity ^0.8.0;
3
+
4
+ interface IRenzoRestakeManager {
5
+ function depositETH(uint256 _referralId) external payable;
6
+
7
+ function deposit(address _collateralToken, uint256 _amount, uint256 _referralId) external;
8
+
9
+ function collateralTokens(uint256 i) external view returns (address);
10
+
11
+ function calculateTVLs() external view returns (uint256[][] memory, uint256[] memory, uint256);
12
+
13
+ function renzoOracle() external view returns (address);
14
+ }
@@ -0,0 +1,10 @@
1
+ // SPDX-License-Identifier: GPL-3.0-or-later
2
+ pragma solidity ^0.8.0;
3
+
4
+ interface IRswETH {
5
+ function deposit() external payable;
6
+
7
+ function depositWithReferral(address referral) external payable;
8
+
9
+ function getRate() external view returns (uint256);
10
+ }
@@ -4,7 +4,7 @@ pragma solidity ^0.8.0;
4
4
  interface ISwETH {
5
5
  function deposit() external payable;
6
6
 
7
- function getRate() external view returns (uint256);
7
+ function depositWithReferral(address referral) external payable;
8
8
 
9
- function ethToSwETHRate() external view returns (uint256);
9
+ function getRate() external view returns (uint256);
10
10
  }
@@ -0,0 +1,19 @@
1
+ // SPDX-License-Identifier: GPL-3.0-or-later
2
+ pragma solidity ^0.8.17;
3
+
4
+ import "@openzeppelin/contracts/proxy/Proxy.sol";
5
+ import "../../interfaces/IPRouterStatic.sol";
6
+ import "./base/StorageLayout.sol";
7
+
8
+ // solhint-disable no-empty-blocks
9
+ contract PendleRouterStatic is Proxy, StorageLayout {
10
+ constructor(address actionStorage) {
11
+ owner = msg.sender;
12
+ selectorToFacet[IPMiniDiamond.setFacetForSelectors.selector] = actionStorage;
13
+ }
14
+
15
+ function _implementation() internal view override returns (address res) {
16
+ res = selectorToFacet[msg.sig];
17
+ require(res != address(0), "selector not found");
18
+ }
19
+ }