@pendle/core-v2 0.8.1-beta → 0.8.1-gamma

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 (259) hide show
  1. package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/AaveV3/PendleAaveV3SCY.sol/PendleAaveV3SCY.dbg.json +1 -1
  2. package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/AaveV3/WadRayMath.sol/WadRayMath.dbg.json +1 -1
  3. package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiSAvaxSCY.sol/PendleQiSAvaxSCY.dbg.json +4 -0
  4. package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiSAvaxSCY.sol/PendleQiSAvaxSCY.json +833 -0
  5. package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiTokenHelper.sol/PendleQiTokenHelper.dbg.json +1 -1
  6. package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiTokenSCY.sol/PendleQiTokenSCY.dbg.json +1 -1
  7. package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiTokenSCY.sol/PendleQiTokenSCY.json +2 -2
  8. package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleSAvaxSCY.sol/PendleSAvaxSCY.dbg.json +4 -0
  9. package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleSAvaxSCY.sol/PendleSAvaxSCY.json +723 -0
  10. package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/Euler/PendleEulerSCY.sol/PendleEulerSCY.dbg.json +4 -0
  11. package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/Euler/PendleEulerSCY.sol/PendleEulerSCY.json +723 -0
  12. package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleERC4626SCY.sol/PendleERC4626SCY.dbg.json +1 -1
  13. package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleStargateSCY.sol/PendleStargateSCY.dbg.json +1 -1
  14. package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleWstEthSCY.sol/PendleWstEthSCY.dbg.json +1 -1
  15. package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleWstEthSCY.sol/PendleWstEthSCY.json +20 -2
  16. package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleYearnVaultScy.sol/PendleYearnVaultSCY.dbg.json +1 -1
  17. package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/TraderJoe/PendleSJoeSCY.sol/PendleSJoeSCY.dbg.json +4 -0
  18. package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/TraderJoe/PendleSJoeSCY.sol/PendleSJoeSCY.json +784 -0
  19. package/build/artifacts/contracts/SuperComposableYield/base-implementations/SCYBase.sol/SCYBase.dbg.json +1 -1
  20. package/build/artifacts/contracts/SuperComposableYield/base-implementations/SCYBaseWithRewards.sol/SCYBaseWithRewards.dbg.json +1 -1
  21. package/build/artifacts/contracts/core/LiquidityMining/CelerAbstracts/CelerReceiverUpg.sol/CelerReceiverUpg.dbg.json +1 -1
  22. package/build/artifacts/contracts/core/LiquidityMining/CelerAbstracts/CelerSenderUpg.sol/CelerSenderUpg.dbg.json +1 -1
  23. package/build/artifacts/contracts/core/LiquidityMining/CelerAbstracts/CelerSenderUpg.sol/CelerSenderUpg.json +2 -2
  24. package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerBaseUpg.sol/PendleGaugeControllerBaseUpg.dbg.json +1 -1
  25. package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerMainchainUpg.sol/PendleGaugeControllerMainchainUpg.dbg.json +1 -1
  26. package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerMainchainUpg.sol/PendleGaugeControllerMainchainUpg.json +2 -2
  27. package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerSidechainUpg.sol/PendleGaugeControllerSidechainUpg.dbg.json +1 -1
  28. package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerSidechainUpg.sol/PendleGaugeControllerSidechainUpg.json +2 -2
  29. package/build/artifacts/contracts/core/LiquidityMining/PendleGauge.sol/PendleGauge.dbg.json +1 -1
  30. package/build/artifacts/contracts/core/LiquidityMining/VotingController/PendleVotingControllerUpg.sol/PendleVotingControllerUpg.dbg.json +1 -1
  31. package/build/artifacts/contracts/core/LiquidityMining/VotingController/PendleVotingControllerUpg.sol/PendleVotingControllerUpg.json +47 -28
  32. package/build/artifacts/contracts/core/LiquidityMining/VotingController/VotingControllerStorageUpg.sol/VotingControllerStorageUpg.dbg.json +1 -1
  33. package/build/artifacts/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol/VotingEscrowPendleMainchain.dbg.json +1 -1
  34. package/build/artifacts/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol/VotingEscrowPendleMainchain.json +66 -4
  35. package/build/artifacts/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleSidechain.sol/VotingEscrowPendleSidechain.dbg.json +1 -1
  36. package/build/artifacts/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleSidechain.sol/VotingEscrowPendleSidechain.json +26 -2
  37. package/build/artifacts/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowTokenBase.sol/VotingEscrowTokenBase.dbg.json +1 -1
  38. package/build/artifacts/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowTokenBase.sol/VotingEscrowTokenBase.json +24 -0
  39. package/build/artifacts/contracts/core/Market/PendleMarket.sol/PendleMarket.dbg.json +1 -1
  40. package/build/artifacts/contracts/core/Market/PendleMarket.sol/PendleMarket.json +2 -2
  41. package/build/artifacts/contracts/core/Market/PendleMarketFactory.sol/PendleMarketFactory.dbg.json +1 -1
  42. package/build/artifacts/contracts/core/Market/PendleMarketFactory.sol/PendleMarketFactory.json +2 -2
  43. package/build/artifacts/contracts/core/PendleERC20.sol/PendleERC20.dbg.json +1 -1
  44. package/build/artifacts/contracts/core/PendleRouter.sol/PendleRouter.dbg.json +1 -1
  45. package/build/artifacts/contracts/core/PendleRouter.sol/PendleRouter.json +2 -2
  46. package/build/artifacts/contracts/core/YieldContracts/InterestManagerYT.sol/InterestManagerYT.dbg.json +1 -1
  47. package/build/artifacts/contracts/core/YieldContracts/PendlePrincipalToken.sol/PendlePrincipalToken.dbg.json +1 -1
  48. package/build/artifacts/contracts/core/YieldContracts/PendlePrincipalToken.sol/PendlePrincipalToken.json +2 -77
  49. package/build/artifacts/contracts/core/YieldContracts/PendleYieldContractFactory.sol/PendleYieldContractFactory.dbg.json +1 -1
  50. package/build/artifacts/contracts/core/YieldContracts/PendleYieldContractFactory.sol/PendleYieldContractFactory.json +2 -2
  51. package/build/artifacts/contracts/core/YieldContracts/PendleYieldToken.sol/PendleYieldToken.dbg.json +1 -1
  52. package/build/artifacts/contracts/core/YieldContracts/PendleYieldToken.sol/PendleYieldToken.json +21 -96
  53. package/build/artifacts/contracts/core/actions/ActionCallback.sol/ActionCallback.dbg.json +1 -1
  54. package/build/artifacts/contracts/core/actions/ActionCallback.sol/ActionCallback.json +2 -2
  55. package/build/artifacts/contracts/core/actions/ActionCore.sol/ActionCore.dbg.json +1 -1
  56. package/build/artifacts/contracts/core/actions/ActionCore.sol/ActionCore.json +2 -2
  57. package/build/artifacts/contracts/core/actions/ActionYT.sol/ActionYT.dbg.json +1 -1
  58. package/build/artifacts/contracts/core/actions/ActionYT.sol/ActionYT.json +2 -2
  59. package/build/artifacts/contracts/core/actions/base/ActionSCYAndPTBase.sol/ActionSCYAndPTBase.dbg.json +1 -1
  60. package/build/artifacts/contracts/core/actions/base/ActionSCYAndPYBase.sol/ActionSCYAndPYBase.dbg.json +1 -1
  61. package/build/artifacts/contracts/core/actions/base/ActionSCYAndYTBase.sol/ActionSCYAndYTBase.dbg.json +1 -1
  62. package/build/artifacts/contracts/core/actions/base/CallbackHelper.sol/CallbackHelper.dbg.json +1 -1
  63. package/build/artifacts/contracts/interfaces/IAToken.sol/IAToken.dbg.json +1 -1
  64. package/build/artifacts/contracts/interfaces/IAavePool.sol/IAavePool.dbg.json +1 -1
  65. package/build/artifacts/contracts/interfaces/IAaveRewardsController.sol/IAaveRewardsController.dbg.json +1 -1
  66. package/build/artifacts/contracts/interfaces/IBenQiComptroller.sol/IBenQiComptroller.dbg.json +1 -1
  67. package/build/artifacts/contracts/interfaces/IBenQiInterestRateModel.sol/IBenQiInterestRateModel.dbg.json +1 -1
  68. package/build/artifacts/contracts/interfaces/ICelerMessageBus.sol/ICelerMessageBus.dbg.json +1 -1
  69. package/build/artifacts/contracts/interfaces/ICelerMessageReceiverApp.sol/ICelerMessageReceiverApp.dbg.json +1 -1
  70. package/build/artifacts/contracts/interfaces/IERC4626.sol/IERC4626.dbg.json +1 -1
  71. package/build/artifacts/contracts/interfaces/IEulerEToken.sol/IEulerEToken.dbg.json +4 -0
  72. package/build/artifacts/contracts/interfaces/IEulerEToken.sol/IEulerEToken.json +162 -0
  73. package/build/artifacts/contracts/interfaces/IEulerMarkets.sol/IEulerMarkets.dbg.json +4 -0
  74. package/build/artifacts/contracts/interfaces/IEulerMarkets.sol/IEulerMarkets.json +87 -0
  75. package/build/artifacts/contracts/interfaces/IJoePair.sol/IJoePair.dbg.json +1 -1
  76. package/build/artifacts/contracts/interfaces/IJoeRouter01.sol/IJoeRouter01.dbg.json +1 -1
  77. package/build/artifacts/contracts/interfaces/IJoeRouter02.sol/IJoeRouter02.dbg.json +1 -1
  78. package/build/artifacts/contracts/interfaces/IPActionCore.sol/IPActionCore.dbg.json +1 -1
  79. package/build/artifacts/contracts/interfaces/IPActionYT.sol/IPActionYT.dbg.json +1 -1
  80. package/build/artifacts/contracts/interfaces/IPAllAction.sol/IPAllAction.dbg.json +1 -1
  81. package/build/artifacts/contracts/interfaces/IPGaugeController.sol/IPGaugeController.dbg.json +1 -1
  82. package/build/artifacts/contracts/interfaces/IPGaugeControllerMainchain.sol/IPGaugeControllerMainchain.dbg.json +1 -1
  83. package/build/artifacts/contracts/interfaces/IPGovernanceManager.sol/IPGovernanceManager.dbg.json +1 -1
  84. package/build/artifacts/contracts/interfaces/IPInterestManagerYT.sol/IPInterestManagerYT.dbg.json +1 -1
  85. package/build/artifacts/contracts/interfaces/IPInterestManagerYT.sol/IPInterestManagerYT.json +1 -1
  86. package/build/artifacts/contracts/interfaces/IPMarket.sol/IPMarket.dbg.json +1 -1
  87. package/build/artifacts/contracts/interfaces/IPMarketFactory.sol/IPMarketFactory.dbg.json +1 -1
  88. package/build/artifacts/contracts/interfaces/IPMarketSwapCallback.sol/IPMarketSwapCallback.dbg.json +1 -1
  89. package/build/artifacts/contracts/interfaces/IPPermissionsV2Upg.sol/IPermissionsV2Upg.dbg.json +1 -1
  90. package/build/artifacts/contracts/interfaces/IPPrincipalToken.sol/IPPrincipalToken.dbg.json +1 -1
  91. package/build/artifacts/contracts/interfaces/IPRouterStatic.sol/IPRouterStatic.dbg.json +1 -1
  92. package/build/artifacts/contracts/interfaces/IPRouterStatic.sol/IPRouterStatic.json +23 -23
  93. package/build/artifacts/contracts/interfaces/IPVeToken.sol/IPVeToken.dbg.json +1 -1
  94. package/build/artifacts/contracts/interfaces/IPVeToken.sol/IPVeToken.json +24 -0
  95. package/build/artifacts/contracts/interfaces/IPVotingController.sol/IPVotingController.dbg.json +1 -1
  96. package/build/artifacts/contracts/interfaces/IPVotingEscrow.sol/IPVotingEscrow.dbg.json +1 -1
  97. package/build/artifacts/contracts/interfaces/IPYieldContractFactory.sol/IPYieldContractFactory.dbg.json +1 -1
  98. package/build/artifacts/contracts/interfaces/IPYieldToken.sol/IPYieldToken.dbg.json +1 -1
  99. package/build/artifacts/contracts/interfaces/IPYieldToken.sol/IPYieldToken.json +27 -27
  100. package/build/artifacts/contracts/interfaces/IQiAvax.sol/IQiAvax.dbg.json +1 -1
  101. package/build/artifacts/contracts/interfaces/IQiErc20.sol/IQiErc20.dbg.json +1 -1
  102. package/build/artifacts/contracts/interfaces/IQiToken.sol/IQiToken.dbg.json +1 -1
  103. package/build/artifacts/contracts/interfaces/IRewardManager.sol/IRewardManager.dbg.json +1 -1
  104. package/build/artifacts/contracts/interfaces/ISAvax.sol/ISAvax.dbg.json +4 -0
  105. package/build/artifacts/contracts/interfaces/ISAvax.sol/ISAvax.json +199 -0
  106. package/build/artifacts/contracts/interfaces/ISJoe.sol/ISJoe.dbg.json +4 -0
  107. package/build/artifacts/contracts/interfaces/ISJoe.sol/ISJoe.json +168 -0
  108. package/build/artifacts/contracts/interfaces/IStETH.sol/IStETH.dbg.json +4 -0
  109. package/build/artifacts/contracts/interfaces/IStETH.sol/IStETH.json +92 -0
  110. package/build/artifacts/contracts/interfaces/IStargateLPStaking.sol/IStargateLPStaking.dbg.json +1 -1
  111. package/build/artifacts/contracts/interfaces/IStargatePool.sol/IStargatePool.dbg.json +1 -1
  112. package/build/artifacts/contracts/interfaces/IStargateRouter.sol/IStargateRouter.dbg.json +1 -1
  113. package/build/artifacts/contracts/interfaces/ISuperComposableYield.sol/ISuperComposableYield.dbg.json +1 -1
  114. package/build/artifacts/contracts/interfaces/IWAvax.sol/IWAvax.dbg.json +4 -0
  115. package/build/artifacts/contracts/interfaces/IWAvax.sol/IWAvax.json +252 -0
  116. package/build/artifacts/contracts/interfaces/IWETH.sol/IWETH.dbg.json +1 -1
  117. package/build/artifacts/contracts/interfaces/IWstETH.sol/IWstETH.dbg.json +1 -1
  118. package/build/artifacts/contracts/interfaces/IYearnVault.sol/IYearnVault.dbg.json +1 -1
  119. package/build/artifacts/contracts/libraries/RewardManager.sol/RewardManager.dbg.json +1 -1
  120. package/build/artifacts/contracts/libraries/RewardManagerAbstract.sol/RewardManagerAbstract.dbg.json +1 -1
  121. package/build/artifacts/contracts/libraries/SCY/SCYUtils.sol/SCYUtils.dbg.json +1 -1
  122. package/build/artifacts/contracts/libraries/VeBalanceLib.sol/VeBalanceLib.dbg.json +1 -1
  123. package/build/artifacts/contracts/libraries/VeHistoryLib.sol/Checkpoints.dbg.json +1 -1
  124. package/build/artifacts/contracts/libraries/helpers/ArrayLib.sol/ArrayLib.dbg.json +1 -1
  125. package/build/artifacts/contracts/libraries/helpers/ExpiryUtilsLib.sol/ExpiryUtils.dbg.json +1 -1
  126. package/build/artifacts/contracts/libraries/helpers/MiniHelpers.sol/MiniHelpers.dbg.json +1 -1
  127. package/build/artifacts/contracts/libraries/helpers/PYIndex.sol/PYIndexLib.dbg.json +4 -0
  128. package/build/artifacts/contracts/libraries/{SCY/SCYIndex.sol/SCYIndexLib.json → helpers/PYIndex.sol/PYIndexLib.json} +4 -4
  129. package/build/artifacts/contracts/libraries/helpers/SSTORE2Deployer.sol/SSTORE2Deployer.dbg.json +1 -1
  130. package/build/artifacts/contracts/libraries/helpers/TokenHelper.sol/TokenHelper.dbg.json +1 -1
  131. package/build/artifacts/contracts/libraries/math/LogExpMath.sol/LogExpMath.dbg.json +1 -1
  132. package/build/artifacts/contracts/libraries/math/MarketApproxLib.sol/MarketApproxLib.dbg.json +1 -1
  133. package/build/artifacts/contracts/libraries/math/MarketApproxLib.sol/MarketApproxLib.json +2 -2
  134. package/build/artifacts/contracts/libraries/math/MarketMathCore.sol/MarketMathCore.dbg.json +1 -1
  135. package/build/artifacts/contracts/libraries/math/MarketMathCore.sol/MarketMathCore.json +2 -2
  136. package/build/artifacts/contracts/libraries/math/Math.sol/Math.dbg.json +1 -1
  137. package/build/artifacts/contracts/libraries/math/WeekMath.sol/WeekMath.dbg.json +1 -1
  138. package/build/artifacts/contracts/libraries/solmate/SSTORE2.sol/SSTORE2.dbg.json +1 -1
  139. package/build/artifacts/contracts/libraries/traderjoe/JoeLibrary.sol/JoeLibrary.dbg.json +1 -1
  140. package/build/artifacts/contracts/libraries/traderjoe/PendleJoeSwapHelperUpg.sol/PendleJoeSwapHelperUpg.dbg.json +1 -1
  141. package/build/artifacts/contracts/offchain-helpers/RouterStatic.sol/RouterStatic.dbg.json +1 -1
  142. package/build/artifacts/contracts/offchain-helpers/RouterStatic.sol/RouterStatic.json +39 -39
  143. package/build/artifacts/contracts/periphery/PermissionsV2Upg.sol/PermissionsV2Upg.dbg.json +1 -1
  144. package/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiSAvaxSCY.sol +242 -0
  145. package/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiTokenSCY.sol +1 -1
  146. package/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleSAvaxSCY.sol +146 -0
  147. package/contracts/SuperComposableYield/SCY-implementations/Euler/PendleEulerSCY.sol +170 -0
  148. package/contracts/SuperComposableYield/SCY-implementations/PendleWstEthSCY.sol +33 -6
  149. package/contracts/SuperComposableYield/SCY-implementations/TraderJoe/PendleSJoeSCY.sol +184 -0
  150. package/contracts/core/LiquidityMining/CelerAbstracts/CelerSenderUpg.sol +19 -10
  151. package/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerBaseUpg.sol +3 -1
  152. package/contracts/core/LiquidityMining/PendleGauge.sol +3 -2
  153. package/contracts/core/LiquidityMining/VotingController/PendleVotingControllerUpg.sol +25 -7
  154. package/contracts/core/LiquidityMining/VotingController/VotingControllerStorageUpg.sol +0 -4
  155. package/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol +30 -13
  156. package/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleSidechain.sol +2 -4
  157. package/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowTokenBase.sol +5 -1
  158. package/contracts/core/Market/PendleMarket.sol +4 -5
  159. package/contracts/core/Market/PendleMarketFactory.sol +1 -1
  160. package/contracts/core/YieldContracts/InterestManagerYT.sol +0 -2
  161. package/contracts/core/YieldContracts/PendlePrincipalToken.sol +3 -3
  162. package/contracts/core/YieldContracts/PendleYieldContractFactory.sol +2 -2
  163. package/contracts/core/YieldContracts/PendleYieldToken.sol +24 -25
  164. package/contracts/core/actions/ActionCallback.sol +7 -7
  165. package/contracts/core/actions/base/ActionSCYAndPTBase.sol +10 -9
  166. package/contracts/core/actions/base/ActionSCYAndYTBase.sol +4 -4
  167. package/contracts/interfaces/IEulerEToken.sol +60 -0
  168. package/contracts/interfaces/IEulerMarkets.sol +46 -0
  169. package/contracts/interfaces/IPInterestManagerYT.sol +1 -1
  170. package/contracts/interfaces/IPMarket.sol +1 -0
  171. package/contracts/interfaces/IPRouterStatic.sol +2 -7
  172. package/contracts/interfaces/IPVeToken.sol +2 -0
  173. package/contracts/interfaces/IPYieldToken.sol +2 -2
  174. package/contracts/interfaces/ISAvax.sol +61 -0
  175. package/contracts/interfaces/ISJoe.sol +60 -0
  176. package/contracts/interfaces/IStETH.sol +14 -0
  177. package/contracts/interfaces/IWAvax.sol +34 -0
  178. package/contracts/libraries/helpers/PYIndex.sol +69 -0
  179. package/contracts/libraries/math/MarketApproxLib.sol +5 -5
  180. package/contracts/libraries/math/MarketMathCore.sol +10 -10
  181. package/contracts/offchain-helpers/RouterStatic.sol +21 -39
  182. package/deployments/43113-benqi.json +2 -2
  183. package/deployments/43113-core.json +7 -7
  184. package/deployments/43113-markets/benqi-market-599408.json +7 -0
  185. package/deployments/43113-markets/benqi-market-93bbf0.json +7 -0
  186. package/deployments/80001-benqi.json +2 -2
  187. package/deployments/80001-core.json +6 -6
  188. package/deployments/80001-markets/benqi-market-007811.json +7 -0
  189. package/deployments/80001-markets/benqi-market-3fe528.json +7 -0
  190. package/package.json +1 -1
  191. package/typechain-types/CelerSenderUpg.ts +16 -16
  192. package/typechain-types/IERC20Upgradeable.ts +300 -0
  193. package/typechain-types/IEulerEToken.ts +320 -0
  194. package/typechain-types/IEulerMarkets.ts +204 -0
  195. package/typechain-types/IPInterestManagerYT.ts +3 -3
  196. package/typechain-types/IPRouterStatic.ts +60 -118
  197. package/typechain-types/IPVeToken.ts +34 -0
  198. package/typechain-types/IPYieldToken.ts +47 -47
  199. package/typechain-types/ISAvax.ts +430 -0
  200. package/typechain-types/ISJoe.ts +340 -0
  201. package/typechain-types/IStETH.ts +201 -0
  202. package/typechain-types/IWAvax.ts +380 -0
  203. package/typechain-types/PendleEulerSCY.ts +965 -0
  204. package/typechain-types/PendlePrincipalToken.ts +0 -104
  205. package/typechain-types/PendleQiSAvaxSCY.ts +1098 -0
  206. package/typechain-types/PendleSAvaxSCY.ts +962 -0
  207. package/typechain-types/PendleSJoeSCY.ts +1053 -0
  208. package/typechain-types/PendleVotingControllerUpg.ts +89 -55
  209. package/typechain-types/PendleWstEthSCY.ts +13 -0
  210. package/typechain-types/PendleYieldToken.ts +44 -148
  211. package/typechain-types/RouterStatic.ts +133 -299
  212. package/typechain-types/VotingEscrowPendleMainchain.ts +118 -16
  213. package/typechain-types/VotingEscrowPendleSidechain.ts +34 -0
  214. package/typechain-types/VotingEscrowTokenBase.ts +34 -0
  215. package/typechain-types/factories/ActionCallback__factory.ts +1 -1
  216. package/typechain-types/factories/ActionCore__factory.ts +1 -1
  217. package/typechain-types/factories/ActionYT__factory.ts +1 -1
  218. package/typechain-types/factories/CelerSenderUpg__factory.ts +2 -2
  219. package/typechain-types/factories/IERC20Upgradeable__factory.ts +209 -0
  220. package/typechain-types/factories/IEulerEToken__factory.ts +174 -0
  221. package/typechain-types/factories/IEulerMarkets__factory.ts +99 -0
  222. package/typechain-types/factories/IPInterestManagerYT__factory.ts +1 -1
  223. package/typechain-types/factories/IPRouterStatic__factory.ts +23 -23
  224. package/typechain-types/factories/IPVeToken__factory.ts +24 -0
  225. package/typechain-types/factories/IPYieldToken__factory.ts +27 -27
  226. package/typechain-types/factories/ISAvax__factory.ts +208 -0
  227. package/typechain-types/factories/ISJoe__factory.ts +177 -0
  228. package/typechain-types/factories/IStETH__factory.ts +101 -0
  229. package/typechain-types/factories/IWAvax__factory.ts +261 -0
  230. package/typechain-types/factories/PendleEulerSCY__factory.ts +796 -0
  231. package/typechain-types/factories/PendleGaugeControllerMainchainUpg__factory.ts +1 -1
  232. package/typechain-types/factories/PendleGaugeControllerSidechainUpg__factory.ts +1 -1
  233. package/typechain-types/factories/PendleMarketFactory__factory.ts +1 -1
  234. package/typechain-types/factories/PendleMarket__factory.ts +1 -1
  235. package/typechain-types/factories/PendlePrincipalToken__factory.ts +1 -76
  236. package/typechain-types/factories/PendleQiSAvaxSCY__factory.ts +917 -0
  237. package/typechain-types/factories/PendleQiTokenSCY__factory.ts +1 -1
  238. package/typechain-types/factories/PendleRouter__factory.ts +1 -1
  239. package/typechain-types/factories/PendleSAvaxSCY__factory.ts +796 -0
  240. package/typechain-types/factories/PendleSJoeSCY__factory.ts +845 -0
  241. package/typechain-types/factories/PendleVotingControllerUpg__factory.ts +45 -26
  242. package/typechain-types/factories/PendleWstEthSCY__factory.ts +29 -2
  243. package/typechain-types/factories/PendleYieldContractFactory__factory.ts +1 -1
  244. package/typechain-types/factories/PendleYieldToken__factory.ts +19 -94
  245. package/typechain-types/factories/RouterStatic__factory.ts +38 -38
  246. package/typechain-types/factories/VotingEscrowPendleMainchain__factory.ts +65 -3
  247. package/typechain-types/factories/VotingEscrowPendleSidechain__factory.ts +25 -1
  248. package/typechain-types/factories/VotingEscrowTokenBase__factory.ts +24 -0
  249. package/typechain-types/hardhat.d.ts +98 -17
  250. package/typechain-types/index.ts +22 -4
  251. package/build/artifacts/contracts/core/PendleERC20Permit.sol/PendleERC20Permit.dbg.json +0 -4
  252. package/build/artifacts/contracts/core/PendleERC20Permit.sol/PendleERC20Permit.json +0 -329
  253. package/build/artifacts/contracts/libraries/SCY/SCYIndex.sol/SCYIndexLib.dbg.json +0 -4
  254. package/contracts/core/PendleERC20Permit.sol +0 -84
  255. package/contracts/libraries/SCY/SCYIndex.sol +0 -72
  256. package/deployments/43113-markets/benqi-market-4Ccb97.json +0 -7
  257. package/deployments/43113-markets/benqi-market-534471.json +0 -7
  258. package/deployments/80001-markets/benqi-market-109acB.json +0 -7
  259. package/deployments/80001-markets/benqi-market-4e470E.json +0 -7
@@ -0,0 +1,242 @@
1
+ // SPDX-License-Identifier: GPL-3.0-or-later
2
+ pragma solidity 0.8.15;
3
+
4
+ import "../../base-implementations/SCYBaseWithRewards.sol";
5
+ import "../../../interfaces/IQiErc20.sol";
6
+ import "../../../interfaces/IQiAvax.sol";
7
+ import "../../../interfaces/IBenQiComptroller.sol";
8
+ import "../../../interfaces/IWAvax.sol";
9
+ import "../../../interfaces/ISAvax.sol";
10
+
11
+ import "./PendleQiTokenHelper.sol";
12
+
13
+ contract PendleQiSAvaxSCY is SCYBaseWithRewards, PendleQiTokenHelper {
14
+ address public immutable QI;
15
+ address public immutable WAVAX;
16
+ address public immutable comptroller;
17
+
18
+ address public immutable SAVAX;
19
+ address public immutable QI_SAVAX;
20
+
21
+ constructor(
22
+ string memory _name,
23
+ string memory _symbol,
24
+ address _qiSAvax,
25
+ address _WAVAX,
26
+ uint256 _initialExchangeRateMantissa
27
+ )
28
+ SCYBaseWithRewards(_name, _symbol, _qiSAvax)
29
+ PendleQiTokenHelper(_qiSAvax, _initialExchangeRateMantissa)
30
+ {
31
+ require(_qiSAvax != address(0), "zero address");
32
+ require(_WAVAX != address(0), "zero address");
33
+
34
+ QI_SAVAX = _qiSAvax;
35
+ WAVAX = _WAVAX;
36
+
37
+ SAVAX = IQiErc20(QI_SAVAX).underlying();
38
+ comptroller = IQiToken(_qiSAvax).comptroller();
39
+
40
+ QI = IBenQiComptroller(comptroller).qiAddress();
41
+
42
+ _safeApprove(SAVAX, QI_SAVAX, type(uint256).max);
43
+ }
44
+
45
+ /*///////////////////////////////////////////////////////////////
46
+ DEPOSIT/REDEEM USING BASE TOKENS
47
+ //////////////////////////////////////////////////////////////*/
48
+
49
+ /**
50
+ * @dev See {SCYBase-_deposit}
51
+ *
52
+ * The underlying yield token is qiToken (qiSAvax). Tokens allowed for deposit are sAvax, qiSAvax, AVAX, WAVAX.
53
+ *
54
+ *If the base token deposited is underlying asset, the function first convert those deposited SAvax into qiSAvax. Then the corresponding amount of shares is returned.
55
+ *
56
+ * If the base token is AVAX, it will swap to SAvax which will then be deposited to QiSAvax.
57
+ *
58
+ * If the base token is WAVAX, it will unwrap to AVAX, then swap to SAvax which will be deposited to mint QiSAvax.
59
+ *
60
+ * The exchange rate of qiToken (qiSAvax) to shares is 1:1
61
+ */
62
+ function _deposit(address tokenIn, uint256 amountDeposited)
63
+ internal
64
+ override
65
+ returns (uint256 amountSharesOut)
66
+ {
67
+ if (tokenIn == QI_SAVAX) {
68
+ amountSharesOut = amountDeposited;
69
+ } else if (tokenIn == WAVAX || tokenIn == NATIVE) {
70
+ // If 'tokenIn' is WAVAX or NATIVE
71
+ if (tokenIn == WAVAX) {
72
+ // Unwrap WAVAX into Native Avax token first
73
+ IWAvax(WAVAX).withdraw(amountDeposited);
74
+ }
75
+
76
+ // Swap AVAX for SAVAX (regardless from AVAX directly or unwrapped from WAVAX), note since exchange rate of AVAX to SAVAX is NOT 1:1, retrieve amount of SAvax received after depositing NATIVE.
77
+ uint256 sAvaxToMintQiSAvaxAmount = ISAvax(tokenIn).submit{ value: amountDeposited }();
78
+
79
+ // Deposit (WAVAX or NATIVE) converted sAvax into BenQi.
80
+ amountSharesOut = _depositUnderlyingIntoBenQi(sAvaxToMintQiSAvaxAmount);
81
+ } else {
82
+ // If token deposited is sAvax, it will directly mint qiSAvax from BenQi using amountDeposited
83
+ amountSharesOut = _depositUnderlyingIntoBenQi(amountDeposited);
84
+ }
85
+ }
86
+
87
+ /**
88
+ * @dev Deposits underlying token (sAvax) into BenQi and returns the amount of qiSAvax or shares (since qiSAvax : shares == 1:1).
89
+ */
90
+ function _depositUnderlyingIntoBenQi(uint256 amountDeposited)
91
+ internal
92
+ returns (uint256 amountSharesDeposited)
93
+ {
94
+ IQiErc20 QiSAvax = IQiErc20(QI_SAVAX);
95
+
96
+ uint256 preBalanceQiSAvax = QiSAvax.balanceOf(address(this));
97
+
98
+ uint256 errCode = QiSAvax.mint(amountDeposited);
99
+ require(errCode == 0, "mint failed");
100
+
101
+ amountSharesDeposited = QiSAvax.balanceOf(address(this)) - preBalanceQiSAvax;
102
+ }
103
+
104
+ /**
105
+ * @dev See {SCYBase-_redeem}
106
+ *
107
+ * The shares are redeemed into the same amount of qiTokens (qiSAvax). If `tokenOut` is the underlying asset sAvax.
108
+ *
109
+ * Only SAvax or QiSAvax can be withdrawn.
110
+ *
111
+ * the function also redeems said asset from the corresponding amount of qiToken (qiSAvax).
112
+ */
113
+ function _redeem(address tokenOut, uint256 amountSharesToRedeem)
114
+ internal
115
+ override
116
+ returns (uint256 amountTokenOut)
117
+ {
118
+ if (tokenOut == QI_SAVAX) {
119
+ amountTokenOut = amountSharesToRedeem;
120
+ } else {
121
+ uint256 preBalanceUnderlying = _selfBalance(SAVAX);
122
+
123
+ uint256 errCode = IQiErc20(QI_SAVAX).redeem(amountSharesToRedeem);
124
+ require(errCode == 0, "redeem failed");
125
+
126
+ // Even though underlying is not rewardToken, we still manually check balance for accounting purposes.
127
+ amountTokenOut = _selfBalance(SAVAX) - preBalanceUnderlying;
128
+ }
129
+ }
130
+
131
+ /*///////////////////////////////////////////////////////////////
132
+ EXCHANGE-RATE
133
+ //////////////////////////////////////////////////////////////*/
134
+
135
+ /**
136
+ * @notice Calculates and updates the exchange rate of shares to underlying asset token
137
+ * @dev It is the exchange rate of qiSAvax to native Avax token, this is calculated from sAvax to QiSAvax Exchange rate and then followed by converting that exchange rate relative to native Avax exchange rate.
138
+ */
139
+ function exchangeRate() public view override returns (uint256) {
140
+ uint256 qiSAvaxToSAvaxExchangeRate = _exchangeRateCurrentView();
141
+ return ISAvax(SAVAX).getPooledAvaxByShares(qiSAvaxToSAvaxExchangeRate);
142
+ }
143
+
144
+ /*///////////////////////////////////////////////////////////////
145
+ REWARDS-RELATED
146
+ //////////////////////////////////////////////////////////////*/
147
+
148
+ /**
149
+ * @dev See {ISuperComposableYield-getRewardTokens}
150
+ */
151
+ function _getRewardTokens() internal view override returns (address[] memory res) {
152
+ res = new address[](2);
153
+ res[0] = QI;
154
+ res[1] = WAVAX;
155
+ }
156
+
157
+ function _redeemExternalReward() internal override {
158
+ address[] memory holders = new address[](1);
159
+ address[] memory qiTokens = new address[](1);
160
+ holders[0] = address(this);
161
+ qiTokens[0] = QI_SAVAX;
162
+
163
+ IBenQiComptroller(comptroller).claimReward(0, holders, qiTokens, false, true);
164
+ IBenQiComptroller(comptroller).claimReward(1, holders, qiTokens, false, true);
165
+
166
+ if (address(this).balance != 0) IWAvax(WAVAX).deposit{ value: address(this).balance };
167
+ }
168
+
169
+ /*///////////////////////////////////////////////////////////////
170
+ MISC FUNCTIONS FOR METADATA
171
+ //////////////////////////////////////////////////////////////*/
172
+
173
+ /*
174
+ * @dev 'tokenIn' accepted for deposit are NATIVE, WAVAX, SAVAX and QiSAVAX.
175
+ */
176
+ function _previewDeposit(address tokenIn, uint256 amountTokenToDeposit)
177
+ internal
178
+ view
179
+ override
180
+ returns (uint256 amountSharesOut)
181
+ {
182
+ if (tokenIn == QI_SAVAX) {
183
+ amountSharesOut = amountTokenToDeposit;
184
+ } else if (tokenIn == SAVAX) {
185
+ amountSharesOut = (amountTokenToDeposit * 1e18) / _exchangeRateCurrentView();
186
+ } else {
187
+ // NATIVE or WAVAX - use exchange rate from qiSAvax to underlying asset.
188
+ amountSharesOut = (amountTokenToDeposit * 1e18) / exchangeRate();
189
+ }
190
+ }
191
+
192
+ /*
193
+ * @dev 'tokenOut' accepted for deposit are SAVAX and QiSAVAX.
194
+ */
195
+ function _previewRedeem(address tokenOut, uint256 amountSharesToRedeem)
196
+ internal
197
+ view
198
+ override
199
+ returns (uint256 amountTokenOut)
200
+ {
201
+ if (tokenOut == QI_SAVAX) {
202
+ amountTokenOut = amountSharesToRedeem;
203
+ } else {
204
+ // if 'tokenOut' == SAVAX
205
+ amountTokenOut = (amountSharesToRedeem * _exchangeRateCurrentView()) / 1e18;
206
+ }
207
+ }
208
+
209
+ function getTokensIn() public view virtual override returns (address[] memory res) {
210
+ res = new address[](2);
211
+ res[0] = QI_SAVAX;
212
+ res[1] = SAVAX;
213
+ res[2] = WAVAX;
214
+ res[4] = NATIVE;
215
+ }
216
+
217
+ function getTokensOut() public view virtual override returns (address[] memory res) {
218
+ res = new address[](2);
219
+ res[0] = QI_SAVAX;
220
+ res[1] = SAVAX;
221
+ }
222
+
223
+ function isValidTokenIn(address token) public view virtual override returns (bool) {
224
+ return token == QI_SAVAX || token == SAVAX || token == WAVAX || token == NATIVE;
225
+ }
226
+
227
+ function isValidTokenOut(address token) public view virtual override returns (bool) {
228
+ return token == QI_SAVAX || token == SAVAX;
229
+ }
230
+
231
+ function assetInfo()
232
+ external
233
+ pure
234
+ returns (
235
+ AssetType assetType,
236
+ address assetAddress,
237
+ uint8 assetDecimals
238
+ )
239
+ {
240
+ return (AssetType.TOKEN, NATIVE, 18);
241
+ }
242
+ }
@@ -139,7 +139,7 @@ contract PendleQiTokenSCY is SCYBaseWithRewards, PendleQiTokenHelper {
139
139
  IBenQiComptroller(comptroller).claimReward(0, holders, qiTokens, false, true);
140
140
  IBenQiComptroller(comptroller).claimReward(1, holders, qiTokens, false, true);
141
141
 
142
- if (address(this).balance != 0) IWETH(WAVAX).deposit{ value: address(this).balance };
142
+ if (address(this).balance != 0) IWETH(WAVAX).deposit{ value: address(this).balance }();
143
143
  }
144
144
 
145
145
  /*///////////////////////////////////////////////////////////////
@@ -0,0 +1,146 @@
1
+ // SPDX-License-Identifier: GPL-3.0-or-later
2
+ pragma solidity 0.8.15;
3
+
4
+ import "../../base-implementations/SCYBase.sol";
5
+ import "../../../interfaces/ISAvax.sol";
6
+ import "../../../interfaces/IWAvax.sol";
7
+
8
+ // BENQI Stake AVAX (sAVAX) -> 0x2b2C81e08f1Af8835a78Bb2A90AE924ACE0eA4bE
9
+
10
+ // Exchange rate of sAVAX -> AVAX increases over time, no additional rewards but has a 15day lock-up period with 2 day redemption period.
11
+ // Yield Token -> sAVAX (Interest Bearing)
12
+
13
+ contract PendleSAvaxSCY is SCYBase {
14
+ address public immutable SAVAX;
15
+ address public immutable WAVAX;
16
+
17
+ uint256 private constant BASE = 1e18;
18
+
19
+ constructor(
20
+ string memory _name,
21
+ string memory _symbol,
22
+ address _sAvax,
23
+ address _wAvax
24
+ ) SCYBase(_name, _symbol, _sAvax) {
25
+ require(_sAvax != address(0), "zero address");
26
+ require(_wAvax != address(0), "zero address");
27
+ SAVAX = _sAvax;
28
+ WAVAX = _wAvax;
29
+ }
30
+
31
+ /*///////////////////////////////////////////////////////////////
32
+ DEPOSIT/REDEEM USING BASE TOKENS
33
+ //////////////////////////////////////////////////////////////*/
34
+
35
+ /**
36
+ * @dev See {SCYBase-_deposit}
37
+ *
38
+ * The underlying yield token is sAvax. Tokens accepted for deposit are NATIVE, WVAX, and sAVAX.
39
+ *
40
+ *If the base token deposited is native AVAX, the function converts it into sAVAX first. Then the corresponding amount of shares is returned.
41
+ *
42
+ * If WAVAX is deposited, it will first unwrap to native AVAX and then convert into sAVAX.
43
+ *
44
+ * The exchange rate of sAVAX to shares is 1:1
45
+ */
46
+ function _deposit(address tokenIn, uint256 amountDeposited)
47
+ internal
48
+ virtual
49
+ override
50
+ returns (uint256 amountSharesOut)
51
+ {
52
+ // Comments: No check for address token IN (need to be implemented in higher level function)
53
+ if (tokenIn == SAVAX) {
54
+ amountSharesOut = amountDeposited;
55
+ } else {
56
+ // Handle WAVAX or NATIVE Avax - If WAVAX need to unwrap to NATIVE Avax first then deposit.
57
+ if (tokenIn == WAVAX) {
58
+ IWAvax(WAVAX).withdraw(amountDeposited);
59
+ }
60
+
61
+ amountSharesOut = ISAvax(tokenIn).submit{ value: amountDeposited }();
62
+ }
63
+ }
64
+
65
+ /**
66
+ * @dev See {SCYBase-_redeem}
67
+ *
68
+ * The shares are redeemed into the same amount of sAVAX. `tokenOut` will only be in sAVAX where exchange rate will be 1:1 to SCY.
69
+ */
70
+ function _redeem(address, uint256 amountSharesToRedeem)
71
+ internal
72
+ virtual
73
+ override
74
+ returns (uint256 amountTokenOut)
75
+ {
76
+ amountTokenOut = amountSharesToRedeem;
77
+ }
78
+
79
+ /*///////////////////////////////////////////////////////////////
80
+ EXCHANGE-RATE
81
+ //////////////////////////////////////////////////////////////*/
82
+
83
+ /**
84
+ * @notice Calculates and updates the exchange rate of shares to underlying asset token
85
+ * @dev It is the exchange rate of sAVAX to AVAX.
86
+ */
87
+ function exchangeRate() public view virtual override returns (uint256 currentRate) {
88
+ return ISAvax(SAVAX).getPooledAvaxByShares(BASE);
89
+ }
90
+
91
+ /*///////////////////////////////////////////////////////////////
92
+ MISC FUNCTIONS FOR METADATA
93
+ //////////////////////////////////////////////////////////////*/
94
+
95
+ function _previewDeposit(address tokenIn, uint256 amountTokenToDeposit)
96
+ internal
97
+ view
98
+ override
99
+ returns (uint256 amountSharesOut)
100
+ {
101
+ if (tokenIn == SAVAX) amountSharesOut = amountTokenToDeposit;
102
+ else amountSharesOut = (amountTokenToDeposit * 1e18) / exchangeRate();
103
+ }
104
+
105
+ function _previewRedeem(address, uint256 amountSharesToRedeem)
106
+ internal
107
+ view
108
+ override
109
+ returns (uint256 amountTokenOut)
110
+ {
111
+ // Since only SAvax can be redeemed
112
+ amountTokenOut = amountSharesToRedeem;
113
+ }
114
+
115
+ function getTokensIn() public view virtual override returns (address[] memory res) {
116
+ res = new address[](3);
117
+ res[0] = NATIVE;
118
+ res[1] = SAVAX;
119
+ res[2] = WAVAX;
120
+ }
121
+
122
+ function getTokensOut() public view virtual override returns (address[] memory res) {
123
+ res = new address[](1);
124
+ res[0] = SAVAX;
125
+ }
126
+
127
+ function isValidTokenIn(address token) public view virtual override returns (bool) {
128
+ return (token == NATIVE || token == SAVAX || token == WAVAX);
129
+ }
130
+
131
+ function isValidTokenOut(address token) public view virtual override returns (bool) {
132
+ return token == SAVAX;
133
+ }
134
+
135
+ function assetInfo()
136
+ external
137
+ pure
138
+ returns (
139
+ AssetType assetType,
140
+ address assetAddress,
141
+ uint8 assetDecimals
142
+ )
143
+ {
144
+ return (AssetType.TOKEN, NATIVE, 18);
145
+ }
146
+ }
@@ -0,0 +1,170 @@
1
+ // SPDX-License-Identifier: GPL-3.0-or-later
2
+ pragma solidity 0.8.15;
3
+ import "../../base-implementations/SCYBase.sol";
4
+ import "../../../interfaces/IEulerEToken.sol";
5
+ import "../../../interfaces/IEulerMarkets.sol";
6
+
7
+ /*
8
+ Euler Finance (Money Markets) - Permissionless Lending/Borrowing Protocol for any ERC20 tokens (Built on top of Uniswap v3 oracle protocol which faciliates people to active their own markets and manage their own lending and borrowing facilities)
9
+
10
+ External Rewards (EUL distribution) are only applicable for borrowers, hence no external rewards for SCY to deal with since only only lending feature is used.
11
+ */
12
+
13
+ contract PendleEulerSCY is SCYBase {
14
+ address public immutable underlying;
15
+ address public immutable eToken;
16
+
17
+ constructor(
18
+ string memory _name,
19
+ string memory _symbol,
20
+ address _eToken,
21
+ address _eulerMarkets // pass eulerMarkets to double check both eToken & underlying
22
+ ) SCYBase(_name, _symbol, _eToken) {
23
+ require(_eToken != address(0), "zero address");
24
+ require(_eulerMarkets != address(0), "zero address");
25
+
26
+ eToken = _eToken;
27
+
28
+ underlying = IEulerMarkets(_eulerMarkets).eTokenToUnderlying(eToken);
29
+
30
+ _safeApprove(underlying, eToken, type(uint256).max);
31
+ }
32
+
33
+ /*///////////////////////////////////////////////////////////////
34
+ DEPOSIT/REDEEM USING BASE TOKENS
35
+ //////////////////////////////////////////////////////////////*/
36
+
37
+ /**
38
+ * @dev See {SCYBase-_deposit}
39
+ *
40
+ * The underlying yield token is underlying ETokens. Tokens accepted are EToken or the underlying base token.
41
+ *
42
+ *If underlying ETokens are deposited directly, they are swapped to shares 1:1
43
+ *
44
+ * If underlying base tokens are deposited, SCY contract will deposit into the lending pool and swap shares based on amount of eTokens minted.
45
+ *
46
+ * The exchange rate of EToken to shares is 1:1
47
+ */
48
+ function _deposit(address tokenIn, uint256 amountDeposited)
49
+ internal
50
+ virtual
51
+ override
52
+ returns (uint256 amountSharesOut)
53
+ {
54
+ if (tokenIn == eToken) {
55
+ amountSharesOut = amountDeposited;
56
+ } else {
57
+ uint256 preBalanceEToken = _selfBalance(eToken);
58
+
59
+ // Deposit underlying tokens to convert into eTokens
60
+ IEulerEToken(eToken).deposit(0, amountDeposited);
61
+
62
+ // Since 'deposit' function doesn't return the amount of eTokens minted, calculate change in EToken balance to find the amount of shares out
63
+ amountSharesOut = _selfBalance(eToken) - preBalanceEToken;
64
+ }
65
+ }
66
+
67
+ /**
68
+ * @dev See {SCYBase-_redeem}
69
+ *
70
+ * The shares are redeemed into the same amount of underlying eTokens.
71
+ *
72
+ If `tokenOut` is underlying base Token, the function also swaps back eTokens to underlying base tokens from the lending Pool based on the prevailing exchange rate.
73
+ *
74
+ * The exchange rate of shares to EToken is 1:1
75
+ */
76
+ function _redeem(address tokenOut, uint256 amountSharesToRedeem)
77
+ internal
78
+ virtual
79
+ override
80
+ returns (uint256 amountTokenOut)
81
+ {
82
+ if (tokenOut == eToken) {
83
+ amountTokenOut = amountSharesToRedeem;
84
+ } else {
85
+ // 'tokenOut' is underlying base token
86
+ uint256 preBalanceUnderlying = _selfBalance(underlying);
87
+
88
+ // Swap EToken for underlying base tokens
89
+ IEulerEToken(eToken).withdraw(0, amountSharesToRedeem);
90
+
91
+ // Since 'withdraw' function doesn't return the amount of underlying tokens swapped from eTokens, calculate change in underlying balance to find the amount of shares out
92
+ amountTokenOut = _selfBalance(underlying) - preBalanceUnderlying;
93
+ }
94
+ }
95
+
96
+ /*///////////////////////////////////////////////////////////////
97
+ EXCHANGE-RATE
98
+ //////////////////////////////////////////////////////////////*/
99
+
100
+ /**
101
+ * @notice Calculates and updates the exchange rate of shares to underlying base token
102
+ * @dev It is the exchange rate of underlying EToken (since EToken to shares is 1:1) to underlying Base Token.
103
+ */
104
+ function exchangeRate() public view virtual override returns (uint256 currentRate) {
105
+ return IEulerEToken(eToken).convertBalanceToUnderlying(1e18);
106
+ }
107
+
108
+ /*///////////////////////////////////////////////////////////////
109
+ MISC FUNCTIONS FOR METADATA
110
+ //////////////////////////////////////////////////////////////*/
111
+
112
+ function _previewDeposit(address tokenIn, uint256 amountTokenToDeposit)
113
+ internal
114
+ view
115
+ override
116
+ returns (uint256 amountSharesOut)
117
+ {
118
+ if (tokenIn == eToken) {
119
+ amountSharesOut = amountTokenToDeposit;
120
+ } else {
121
+ amountSharesOut = (amountTokenToDeposit * 1e18) / exchangeRate();
122
+ }
123
+ }
124
+
125
+ function _previewRedeem(address tokenOut, uint256 amountSharesToRedeem)
126
+ internal
127
+ view
128
+ override
129
+ returns (uint256 amountTokenOut)
130
+ {
131
+ if (tokenOut == eToken) {
132
+ amountTokenOut = amountSharesToRedeem;
133
+ } else {
134
+ amountTokenOut = (amountSharesToRedeem * exchangeRate()) / 1e18;
135
+ }
136
+ }
137
+
138
+ function getTokensIn() public view virtual override returns (address[] memory res) {
139
+ res = new address[](2);
140
+ res[0] = underlying;
141
+ res[1] = eToken;
142
+ }
143
+
144
+ function getTokensOut() public view virtual override returns (address[] memory res) {
145
+ res = new address[](2);
146
+ res[0] = underlying;
147
+ res[1] = eToken;
148
+ }
149
+
150
+ function isValidTokenIn(address token) public view virtual override returns (bool) {
151
+ return token == underlying || token == eToken;
152
+ }
153
+
154
+ function isValidTokenOut(address token) public view virtual override returns (bool) {
155
+ return token == underlying || token == eToken;
156
+ }
157
+
158
+ function assetInfo()
159
+ external
160
+ view
161
+ returns (
162
+ AssetType assetType,
163
+ address assetAddress,
164
+ uint8 assetDecimals
165
+ )
166
+ {
167
+ // All underlying asset tokens are of ERC20 standard
168
+ return (AssetType.TOKEN, underlying, IERC20Metadata(underlying).decimals());
169
+ }
170
+ }
@@ -2,16 +2,21 @@
2
2
  pragma solidity 0.8.15;
3
3
  import "../base-implementations/SCYBase.sol";
4
4
  import "../../interfaces/IWstETH.sol";
5
+ import "../../interfaces/IWETH.sol";
6
+ import "../../interfaces/IStETH.sol";
5
7
 
6
8
  contract PendleWstEthSCY is SCYBase {
9
+ address public immutable wETH;
7
10
  address public immutable stETH;
8
11
  address public immutable wstETH;
9
12
 
10
13
  constructor(
11
14
  string memory _name,
12
15
  string memory _symbol,
16
+ address _wETH,
13
17
  address _wstETH
14
18
  ) SCYBase(_name, _symbol, _wstETH) {
19
+ wETH = _wETH;
15
20
  wstETH = _wstETH;
16
21
  stETH = IWstETH(wstETH).stETH();
17
22
  _safeApprove(stETH, wstETH, type(uint256).max);
@@ -38,7 +43,18 @@ contract PendleWstEthSCY is SCYBase {
38
43
  if (tokenIn == wstETH) {
39
44
  amountSharesOut = amountDeposited;
40
45
  } else {
41
- amountSharesOut = IWstETH(wstETH).wrap(amountDeposited); // .wrap returns amount of wstETH out
46
+ uint256 amountStETH;
47
+ if (tokenIn == stETH) {
48
+ amountStETH = amountDeposited;
49
+ } else {
50
+ uint256 stETHBalanceBefore = _selfBalance(stETH);
51
+ if (tokenIn == wETH) {
52
+ IWETH(wETH).withdraw(amountDeposited);
53
+ }
54
+ IStETH(stETH).submit{ value: amountDeposited }(address(0));
55
+ amountStETH = _selfBalance(stETH) - stETHBalanceBefore;
56
+ }
57
+ amountSharesOut = IWstETH(wstETH).wrap(amountStETH);
42
58
  }
43
59
  }
44
60
 
@@ -84,7 +100,15 @@ contract PendleWstEthSCY is SCYBase {
84
100
  returns (uint256 amountSharesOut)
85
101
  {
86
102
  if (tokenIn == wstETH) amountSharesOut = amountTokenToDeposit;
87
- else amountSharesOut = (amountTokenToDeposit * 1e18) / exchangeRate();
103
+ else {
104
+ uint256 amountStETH;
105
+ if (tokenIn == stETH) {
106
+ amountStETH = amountTokenToDeposit;
107
+ } else {
108
+ amountStETH = IStETH(stETH).getSharesByPooledEth(amountTokenToDeposit);
109
+ }
110
+ amountSharesOut = (amountTokenToDeposit * 1e18) / exchangeRate();
111
+ }
88
112
  }
89
113
 
90
114
  function _previewRedeem(address tokenOut, uint256 amountSharesToRedeem)
@@ -98,9 +122,12 @@ contract PendleWstEthSCY is SCYBase {
98
122
  }
99
123
 
100
124
  function getTokensIn() public view virtual override returns (address[] memory res) {
101
- res = new address[](2);
102
- res[0] = stETH;
103
- res[1] = wstETH;
125
+ res = new address[](4);
126
+ res[0] = NATIVE;
127
+ res[1] = wETH;
128
+ res[2] = stETH;
129
+ res[3] = wstETH;
130
+
104
131
  }
105
132
 
106
133
  function getTokensOut() public view virtual override returns (address[] memory res) {
@@ -110,7 +137,7 @@ contract PendleWstEthSCY is SCYBase {
110
137
  }
111
138
 
112
139
  function isValidTokenIn(address token) public view virtual override returns (bool) {
113
- return token == stETH || token == wstETH;
140
+ return token == stETH || token == wstETH || token == NATIVE || token == wETH;
114
141
  }
115
142
 
116
143
  function isValidTokenOut(address token) public view virtual override returns (bool) {