@pendle/core-v2 0.11.10-testnet → 0.12.0-testnet

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 (381) hide show
  1. package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiTokenHelper.sol/PendleQiTokenHelper.dbg.json +1 -1
  2. package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiTokenHelper.sol/PendleQiTokenHelper.json +2 -2
  3. package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiTokenSCY.sol/PendleQiTokenSCY.dbg.json +1 -1
  4. package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiTokenSCY.sol/PendleQiTokenSCY.json +199 -30
  5. package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/Convex/ConvexCurveLP/Pendle3CrvAndTokenSCY.sol/Pendle3CrvAndTokenSCY.dbg.json +4 -0
  6. package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/Convex/ConvexCurveLP/Pendle3CrvAndTokenSCY.sol/Pendle3CrvAndTokenSCY.json +1030 -0
  7. package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/Convex/ConvexCurveLP/PendleConvexCurveLP2PoolSCY.sol/PendleConvexCurveLP2PoolSCY.dbg.json +4 -0
  8. package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/Convex/ConvexCurveLP/PendleConvexCurveLP2PoolSCY.sol/PendleConvexCurveLP2PoolSCY.json +1025 -0
  9. package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/Convex/ConvexCurveLP/PendleConvexCurveLPSCY.sol/PendleConvexCurveLPSCY.dbg.json +4 -0
  10. package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/Convex/ConvexCurveLP/PendleConvexCurveLPSCY.sol/PendleConvexCurveLPSCY.json +948 -0
  11. package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/Convex/Pendle3CrvHelper.sol/Pendle3CrvHelper.dbg.json +4 -0
  12. package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/Convex/Pendle3CrvHelper.sol/Pendle3CrvHelper.json +76 -0
  13. package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleWstEthSCY.sol/PendleWstEthSCY.dbg.json +1 -1
  14. package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleWstEthSCY.sol/PendleWstEthSCY.json +140 -25
  15. package/build/artifacts/contracts/SuperComposableYield/base-implementations/SCYBase.sol/SCYBase.dbg.json +1 -1
  16. package/build/artifacts/contracts/SuperComposableYield/base-implementations/SCYBase.sol/SCYBase.json +138 -23
  17. package/build/artifacts/contracts/SuperComposableYield/base-implementations/SCYBaseWithRewards.sol/SCYBaseWithRewards.dbg.json +1 -1
  18. package/build/artifacts/contracts/SuperComposableYield/base-implementations/SCYBaseWithRewards.sol/SCYBaseWithRewards.json +138 -23
  19. package/build/artifacts/contracts/core/LiquidityMining/CrossChainMsg/PendleMsgReceiveEndpointUpg.sol/PendleMsgReceiveEndpointUpg.dbg.json +4 -0
  20. package/build/artifacts/contracts/core/LiquidityMining/CrossChainMsg/PendleMsgReceiveEndpointUpg.sol/PendleMsgReceiveEndpointUpg.json +310 -0
  21. package/build/artifacts/contracts/core/LiquidityMining/CrossChainMsg/PendleMsgReceiverAppUpg.sol/PendleMsgReceiverAppUpg.dbg.json +4 -0
  22. package/build/artifacts/contracts/core/LiquidityMining/{CelerAbstracts/CelerReceiverUpg.sol/CelerReceiverUpg.json → CrossChainMsg/PendleMsgReceiverAppUpg.sol/PendleMsgReceiverAppUpg.json} +18 -85
  23. package/build/artifacts/contracts/core/LiquidityMining/CrossChainMsg/PendleMsgSendEndpointUpg.sol/PendleMsgSendEndpointUpg.dbg.json +4 -0
  24. package/build/artifacts/contracts/core/LiquidityMining/CrossChainMsg/PendleMsgSendEndpointUpg.sol/PendleMsgSendEndpointUpg.json +336 -0
  25. package/build/artifacts/contracts/core/LiquidityMining/CrossChainMsg/PendleMsgSenderAppUpg.sol/PendleMsgSenderAppUpg.dbg.json +4 -0
  26. package/build/artifacts/contracts/core/LiquidityMining/{CelerAbstracts/CelerSenderUpg.sol/CelerSenderUpg.json → CrossChainMsg/PendleMsgSenderAppUpg.sol/PendleMsgSenderAppUpg.json} +8 -21
  27. package/build/artifacts/contracts/core/LiquidityMining/FeeDistributor/EpochResultManager.sol/EpochResultManager.dbg.json +4 -0
  28. package/build/artifacts/contracts/core/LiquidityMining/FeeDistributor/EpochResultManager.sol/EpochResultManager.json +131 -0
  29. package/build/artifacts/contracts/core/LiquidityMining/FeeDistributor/PendleFeeDistributor.sol/PendleFeeDistributor.dbg.json +4 -0
  30. package/build/artifacts/contracts/core/LiquidityMining/FeeDistributor/PendleFeeDistributor.sol/PendleFeeDistributor.json +297 -0
  31. package/build/artifacts/contracts/core/LiquidityMining/FeeDistributor/PendleFeeDistributorFactory.sol/PendleFeeDistributorFactory.dbg.json +4 -0
  32. package/build/artifacts/contracts/core/LiquidityMining/FeeDistributor/PendleFeeDistributorFactory.sol/PendleFeeDistributorFactory.json +376 -0
  33. package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerBaseUpg.sol/PendleGaugeControllerBaseUpg.dbg.json +1 -1
  34. package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerBaseUpg.sol/PendleGaugeControllerBaseUpg.json +11 -0
  35. package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerMainchainUpg.sol/PendleGaugeControllerMainchainUpg.dbg.json +1 -1
  36. package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerMainchainUpg.sol/PendleGaugeControllerMainchainUpg.json +29 -2
  37. package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerSidechainUpg.sol/PendleGaugeControllerSidechainUpg.dbg.json +1 -1
  38. package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerSidechainUpg.sol/PendleGaugeControllerSidechainUpg.json +40 -86
  39. package/build/artifacts/contracts/core/LiquidityMining/PendleGauge.sol/PendleGauge.dbg.json +1 -1
  40. package/build/artifacts/contracts/core/LiquidityMining/VotingController/PendleVotingControllerUpg.sol/PendleVotingControllerUpg.dbg.json +1 -1
  41. package/build/artifacts/contracts/core/LiquidityMining/VotingController/PendleVotingControllerUpg.sol/PendleVotingControllerUpg.json +228 -40
  42. package/build/artifacts/contracts/core/LiquidityMining/VotingController/VotingControllerStorageUpg.sol/VotingControllerStorageUpg.dbg.json +1 -1
  43. package/build/artifacts/contracts/core/LiquidityMining/VotingController/VotingControllerStorageUpg.sol/VotingControllerStorageUpg.json +232 -12
  44. package/build/artifacts/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol/VotingEscrowPendleMainchain.dbg.json +1 -1
  45. package/build/artifacts/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol/VotingEscrowPendleMainchain.json +164 -47
  46. package/build/artifacts/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleSidechain.sol/VotingEscrowPendleSidechain.dbg.json +1 -1
  47. package/build/artifacts/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleSidechain.sol/VotingEscrowPendleSidechain.json +25 -93
  48. package/build/artifacts/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowTokenBase.sol/VotingEscrowTokenBase.dbg.json +1 -1
  49. package/build/artifacts/contracts/core/Market/PendleMarket.sol/PendleMarket.dbg.json +1 -1
  50. package/build/artifacts/contracts/core/Market/PendleMarket.sol/PendleMarket.json +222 -9
  51. package/build/artifacts/contracts/core/Market/PendleMarketFactory.sol/PendleMarketFactory.dbg.json +1 -1
  52. package/build/artifacts/contracts/core/Market/PendleMarketFactory.sol/PendleMarketFactory.json +106 -5
  53. package/build/artifacts/contracts/core/PendleERC20Permit.sol/PendleERC20Permit.dbg.json +4 -0
  54. package/build/artifacts/contracts/core/PendleERC20Permit.sol/PendleERC20Permit.json +329 -0
  55. package/build/artifacts/contracts/core/PendleRouter.sol/PendleRouter.dbg.json +1 -1
  56. package/build/artifacts/contracts/core/PendleRouter.sol/PendleRouter.json +13 -2
  57. package/build/artifacts/contracts/core/YieldContracts/InterestManagerYT.sol/InterestManagerYT.dbg.json +1 -1
  58. package/build/artifacts/contracts/core/YieldContracts/PendlePrincipalToken.sol/PendlePrincipalToken.dbg.json +1 -1
  59. package/build/artifacts/contracts/core/YieldContracts/PendlePrincipalToken.sol/PendlePrincipalToken.json +87 -2
  60. package/build/artifacts/contracts/core/YieldContracts/PendleYieldContractFactory.sol/PendleYieldContractFactory.dbg.json +1 -1
  61. package/build/artifacts/contracts/core/YieldContracts/PendleYieldContractFactory.sol/PendleYieldContractFactory.json +80 -16
  62. package/build/artifacts/contracts/core/YieldContracts/PendleYieldToken.sol/PendleYieldToken.dbg.json +1 -1
  63. package/build/artifacts/contracts/core/YieldContracts/PendleYieldToken.sol/PendleYieldToken.json +164 -2
  64. package/build/artifacts/contracts/core/actions/ActionAddRemoveLiq.sol/ActionAddRemoveLiq.dbg.json +1 -1
  65. package/build/artifacts/contracts/core/actions/ActionAddRemoveLiq.sol/ActionAddRemoveLiq.json +172 -4
  66. package/build/artifacts/contracts/core/actions/ActionCallback.sol/ActionCallback.dbg.json +1 -1
  67. package/build/artifacts/contracts/core/actions/ActionCallback.sol/ActionCallback.json +109 -2
  68. package/build/artifacts/contracts/core/actions/ActionMintRedeem.sol/ActionMintRedeem.dbg.json +1 -1
  69. package/build/artifacts/contracts/core/actions/ActionMintRedeem.sol/ActionMintRedeem.json +62 -4
  70. package/build/artifacts/contracts/core/actions/ActionMisc.sol/ActionMisc.dbg.json +1 -1
  71. package/build/artifacts/contracts/core/actions/ActionMisc.sol/ActionMisc.json +7 -2
  72. package/build/artifacts/contracts/core/actions/ActionSwapPT.sol/ActionSwapPT.dbg.json +1 -1
  73. package/build/artifacts/contracts/core/actions/ActionSwapPT.sol/ActionSwapPT.json +199 -4
  74. package/build/artifacts/contracts/core/actions/ActionSwapPTYT.sol/ActionSwapPTYT.dbg.json +1 -1
  75. package/build/artifacts/contracts/core/actions/ActionSwapPTYT.sol/ActionSwapPTYT.json +108 -2
  76. package/build/artifacts/contracts/core/actions/ActionSwapYT.sol/ActionSwapYT.dbg.json +1 -1
  77. package/build/artifacts/contracts/core/actions/ActionSwapYT.sol/ActionSwapYT.json +146 -4
  78. package/build/artifacts/contracts/core/actions/base/ActionBaseMintRedeem.sol/ActionBaseMintRedeem.dbg.json +1 -1
  79. package/build/artifacts/contracts/core/actions/base/CallbackHelper.sol/CallbackHelper.dbg.json +1 -1
  80. package/build/artifacts/contracts/interfaces/ConvexCurve/IBooster.sol/IBooster.dbg.json +4 -0
  81. package/build/artifacts/contracts/interfaces/ConvexCurve/IBooster.sol/IBooster.json +177 -0
  82. package/build/artifacts/contracts/interfaces/ConvexCurve/ICrvDepositor.sol/ICrvDepositor.dbg.json +4 -0
  83. package/build/artifacts/contracts/interfaces/ConvexCurve/ICrvDepositor.sol/ICrvDepositor.json +78 -0
  84. package/build/artifacts/contracts/interfaces/ConvexCurve/ICvxCrv.sol/ICvxCrv.dbg.json +4 -0
  85. package/build/artifacts/contracts/interfaces/ConvexCurve/ICvxCrv.sol/ICvxCrv.json +24 -0
  86. package/build/artifacts/contracts/interfaces/ConvexCurve/IRewards.sol/IRewards.dbg.json +4 -0
  87. package/build/artifacts/contracts/interfaces/ConvexCurve/IRewards.sol/IRewards.json +264 -0
  88. package/build/artifacts/contracts/interfaces/Curve/ICrvPool.sol/ICrvPool.dbg.json +4 -0
  89. package/build/artifacts/contracts/interfaces/Curve/ICrvPool.sol/ICrvPool.json +305 -0
  90. package/build/artifacts/contracts/interfaces/IBoringOwnableUpgradeable.sol/IBoringOwnableUpgradeable.dbg.json +4 -0
  91. package/build/artifacts/contracts/interfaces/IBoringOwnableUpgradeable.sol/IBoringOwnableUpgradeable.json +34 -0
  92. package/build/artifacts/contracts/interfaces/IPActionAddRemoveLiq.sol/IPActionAddRemoveLiq.dbg.json +1 -1
  93. package/build/artifacts/contracts/interfaces/IPActionAddRemoveLiq.sol/IPActionAddRemoveLiq.json +31 -1
  94. package/build/artifacts/contracts/interfaces/IPActionMintRedeem.sol/IPActionMintRedeem.dbg.json +1 -1
  95. package/build/artifacts/contracts/interfaces/IPActionMintRedeem.sol/IPActionMintRedeem.json +5 -0
  96. package/build/artifacts/contracts/interfaces/IPActionSwapPT.sol/IPActionSwapPT.dbg.json +1 -1
  97. package/build/artifacts/contracts/interfaces/IPActionSwapPT.sol/IPActionSwapPT.json +30 -0
  98. package/build/artifacts/contracts/interfaces/IPActionSwapPTYT.sol/IPActionSwapPTYT.dbg.json +1 -1
  99. package/build/artifacts/contracts/interfaces/IPActionSwapPTYT.sol/IPActionSwapPTYT.json +10 -0
  100. package/build/artifacts/contracts/interfaces/IPActionSwapYT.sol/IPActionSwapYT.dbg.json +1 -1
  101. package/build/artifacts/contracts/interfaces/IPActionSwapYT.sol/IPActionSwapYT.json +30 -0
  102. package/build/artifacts/contracts/interfaces/IPAllAction.sol/IPAllAction.dbg.json +1 -1
  103. package/build/artifacts/contracts/interfaces/IPAllAction.sol/IPAllAction.json +106 -1
  104. package/build/artifacts/contracts/interfaces/IPFeeDistributor.sol/IPFeeDistributor.dbg.json +4 -0
  105. package/build/artifacts/contracts/interfaces/IPFeeDistributor.sol/IPFeeDistributor.json +112 -0
  106. package/build/artifacts/contracts/interfaces/IPFeeDistributorFactory.sol/IPFeeDistributorFactory.dbg.json +4 -0
  107. package/build/artifacts/contracts/interfaces/IPFeeDistributorFactory.sol/IPFeeDistributorFactory.json +76 -0
  108. package/build/artifacts/contracts/interfaces/IPMarket.sol/IPMarket.dbg.json +1 -1
  109. package/build/artifacts/contracts/interfaces/IPMarket.sol/IPMarket.json +13 -0
  110. package/build/artifacts/contracts/interfaces/IPMsgReceiverApp.sol/IPMsgReceiverApp.dbg.json +4 -0
  111. package/build/artifacts/contracts/interfaces/IPMsgReceiverApp.sol/IPMsgReceiverApp.json +24 -0
  112. package/build/artifacts/contracts/interfaces/IPMsgSendEndpoint.sol/IPMsgSendEndpoint.dbg.json +4 -0
  113. package/build/artifacts/contracts/interfaces/IPMsgSendEndpoint.sol/IPMsgSendEndpoint.json +63 -0
  114. package/build/artifacts/contracts/interfaces/IPVotingController.sol/IPVotingController.dbg.json +1 -1
  115. package/build/artifacts/contracts/interfaces/IPVotingController.sol/IPVotingController.json +148 -0
  116. package/build/artifacts/contracts/interfaces/IPVotingEscrowMainchain.sol/IPVotingEscrowMainchain.dbg.json +4 -0
  117. package/build/artifacts/contracts/interfaces/{IPVotingEscrow.sol/IPVotingEscrow.json → IPVotingEscrowMainchain.sol/IPVotingEscrowMainchain.json} +88 -2
  118. package/build/artifacts/contracts/interfaces/ISuperComposableYield.sol/ISuperComposableYield.dbg.json +1 -1
  119. package/build/artifacts/contracts/interfaces/ISuperComposableYield.sol/ISuperComposableYield.json +4 -28
  120. package/build/artifacts/contracts/libraries/Errors.sol/Errors.dbg.json +4 -0
  121. package/build/artifacts/contracts/libraries/Errors.sol/Errors.json +886 -0
  122. package/build/artifacts/contracts/libraries/OracleLib.sol/OracleLib.dbg.json +1 -1
  123. package/build/artifacts/contracts/libraries/OracleLib.sol/OracleLib.json +28 -2
  124. package/build/artifacts/contracts/libraries/RewardManager.sol/RewardManager.dbg.json +1 -1
  125. package/build/artifacts/contracts/libraries/RewardManagerAbstract.sol/RewardManagerAbstract.dbg.json +1 -1
  126. package/build/artifacts/contracts/libraries/VeBalanceLib.sol/VeBalanceLib.dbg.json +1 -1
  127. package/build/artifacts/contracts/libraries/VeBalanceLib.sol/VeBalanceLib.json +2 -2
  128. package/build/artifacts/contracts/libraries/VeHistoryLib.sol/CheckpointHelper.dbg.json +4 -0
  129. package/build/artifacts/contracts/libraries/{solmate/SSTORE2.sol/SSTORE2.json → VeHistoryLib.sol/CheckpointHelper.json} +4 -4
  130. package/build/artifacts/contracts/libraries/VeHistoryLib.sol/Checkpoints.dbg.json +1 -1
  131. package/build/artifacts/contracts/libraries/VeHistoryLib.sol/Checkpoints.json +2 -2
  132. package/build/artifacts/contracts/libraries/helpers/ArrayLib.sol/ArrayLib.dbg.json +1 -1
  133. package/build/artifacts/contracts/libraries/helpers/ArrayLib.sol/ArrayLib.json +2 -2
  134. package/build/artifacts/contracts/libraries/helpers/BaseSplitCodeFactory.sol/BaseSplitCodeFactory.dbg.json +4 -0
  135. package/build/artifacts/contracts/libraries/helpers/BaseSplitCodeFactory.sol/BaseSplitCodeFactory.json +45 -0
  136. package/build/artifacts/contracts/libraries/helpers/BaseSplitCodeFactory.sol/CodeDeployer.dbg.json +4 -0
  137. package/build/artifacts/contracts/libraries/helpers/{SSTORE2Deployer.sol/SSTORE2Deployer.json → BaseSplitCodeFactory.sol/CodeDeployer.json} +4 -4
  138. package/build/artifacts/contracts/libraries/helpers/PYIndex.sol/PYIndexLib.dbg.json +1 -1
  139. package/build/artifacts/contracts/libraries/helpers/PYIndex.sol/PYIndexLib.json +2 -2
  140. package/build/artifacts/contracts/libraries/helpers/TokenHelper.sol/TokenHelper.dbg.json +1 -1
  141. package/build/artifacts/contracts/libraries/kyberswap/AggregationRouterHelper.sol/AggregationRouterHelper.dbg.json +1 -1
  142. package/build/artifacts/contracts/libraries/kyberswap/AggregationRouterHelper.sol/AggregationRouterHelper.json +2 -2
  143. package/build/artifacts/contracts/libraries/kyberswap/KyberSwapHelper.sol/KyberSwapHelper.dbg.json +1 -1
  144. package/build/artifacts/contracts/libraries/math/MarketApproxLib.sol/MarketApproxPtInLib.dbg.json +1 -1
  145. package/build/artifacts/contracts/libraries/math/MarketApproxLib.sol/MarketApproxPtInLib.json +2 -2
  146. package/build/artifacts/contracts/libraries/math/MarketApproxLib.sol/MarketApproxPtOutLib.dbg.json +1 -1
  147. package/build/artifacts/contracts/libraries/math/MarketApproxLib.sol/MarketApproxPtOutLib.json +2 -2
  148. package/build/artifacts/contracts/libraries/math/MarketMathCore.sol/MarketMathCore.dbg.json +1 -1
  149. package/build/artifacts/contracts/libraries/math/MarketMathCore.sol/MarketMathCore.json +2 -2
  150. package/build/artifacts/contracts/libraries/math/Math.sol/Math.dbg.json +1 -1
  151. package/build/artifacts/contracts/libraries/math/Math.sol/Math.json +2 -2
  152. package/build/artifacts/contracts/libraries/math/WeekMath.sol/WeekMath.dbg.json +1 -1
  153. package/build/artifacts/contracts/libraries/math/WeekMath.sol/WeekMath.json +2 -2
  154. package/build/artifacts/contracts/offchain-helpers/BaseSplitCodeFactoryContract.sol/BaseSplitCodeFactoryContract.dbg.json +4 -0
  155. package/build/artifacts/contracts/offchain-helpers/BaseSplitCodeFactoryContract.sol/BaseSplitCodeFactoryContract.json +167 -0
  156. package/build/artifacts/contracts/offchain-helpers/MarketMathStatic.sol/MarketMathStatic.dbg.json +1 -1
  157. package/build/artifacts/contracts/offchain-helpers/MarketMathStatic.sol/MarketMathStatic.json +182 -4
  158. package/build/artifacts/contracts/offchain-helpers/RouterStatic.sol/RouterStatic.dbg.json +1 -1
  159. package/build/artifacts/contracts/offchain-helpers/RouterStatic.sol/RouterStatic.json +126 -79
  160. package/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiTokenHelper.sol +3 -1
  161. package/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiTokenSCY.sol +19 -16
  162. package/contracts/SuperComposableYield/SCY-implementations/Convex/ConvexCurveLP/Pendle3CrvAndTokenSCY.sol +135 -0
  163. package/contracts/SuperComposableYield/SCY-implementations/Convex/ConvexCurveLP/PendleConvexCurveLP2PoolSCY.sol +96 -0
  164. package/contracts/SuperComposableYield/SCY-implementations/Convex/ConvexCurveLP/PendleConvexCurveLPSCY.sol +215 -0
  165. package/contracts/SuperComposableYield/SCY-implementations/Convex/Pendle3CrvHelper.sol +83 -0
  166. package/contracts/SuperComposableYield/SCY-implementations/PendleWstEthSCY.sol +10 -15
  167. package/contracts/SuperComposableYield/base-implementations/SCYBase.sol +30 -43
  168. package/contracts/core/LiquidityMining/CrossChainMsg/PendleMsgReceiveEndpointUpg.sol +74 -0
  169. package/contracts/core/LiquidityMining/CrossChainMsg/PendleMsgReceiverAppUpg.sol +38 -0
  170. package/contracts/core/LiquidityMining/CrossChainMsg/PendleMsgSendEndpointUpg.sol +83 -0
  171. package/contracts/core/LiquidityMining/{CelerAbstracts/CelerSenderUpg.sol → CrossChainMsg/PendleMsgSenderAppUpg.sol} +12 -13
  172. package/contracts/core/LiquidityMining/FeeDistributor/EpochResultManager.sol +159 -0
  173. package/contracts/core/LiquidityMining/FeeDistributor/PendleFeeDistributor.sol +96 -0
  174. package/contracts/core/LiquidityMining/FeeDistributor/PendleFeeDistributorFactory.sol +68 -0
  175. package/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerBaseUpg.sol +4 -3
  176. package/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerMainchainUpg.sol +6 -2
  177. package/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerSidechainUpg.sol +12 -4
  178. package/contracts/core/LiquidityMining/VotingController/PendleVotingControllerUpg.sol +29 -19
  179. package/contracts/core/LiquidityMining/VotingController/VotingControllerStorageUpg.sol +27 -19
  180. package/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol +63 -27
  181. package/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleSidechain.sol +6 -5
  182. package/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowTokenBase.sol +2 -2
  183. package/contracts/core/Market/PendleMarket.sol +26 -24
  184. package/contracts/core/Market/PendleMarketFactory.sol +41 -20
  185. package/contracts/core/PendleERC20Permit.sol +84 -0
  186. package/contracts/core/PendleRouter.sol +2 -1
  187. package/contracts/core/YieldContracts/PendlePrincipalToken.sol +8 -7
  188. package/contracts/core/YieldContracts/PendleYieldContractFactory.sol +37 -22
  189. package/contracts/core/YieldContracts/PendleYieldToken.sol +106 -35
  190. package/contracts/core/actions/ActionAddRemoveLiq.sol +58 -41
  191. package/contracts/core/actions/ActionCallback.sol +24 -14
  192. package/contracts/core/actions/ActionMintRedeem.sol +14 -4
  193. package/contracts/core/actions/ActionMisc.sol +2 -1
  194. package/contracts/core/actions/ActionSwapPT.sol +38 -19
  195. package/contracts/core/actions/ActionSwapPTYT.sol +7 -6
  196. package/contracts/core/actions/ActionSwapYT.sol +36 -19
  197. package/contracts/core/actions/base/ActionBaseMintRedeem.sol +15 -8
  198. package/contracts/interfaces/ConvexCurve/IBooster.sol +32 -0
  199. package/contracts/interfaces/ConvexCurve/ICrvDepositor.sol +20 -0
  200. package/contracts/interfaces/ConvexCurve/ICvxCrv.sol +6 -0
  201. package/contracts/interfaces/ConvexCurve/IRewards.sol +38 -0
  202. package/contracts/interfaces/Curve/ICrvPool.sol +69 -0
  203. package/contracts/interfaces/IBoringOwnableUpgradeable.sol +10 -0
  204. package/contracts/interfaces/IPActionAddRemoveLiq.sol +7 -7
  205. package/contracts/interfaces/IPActionMintRedeem.sol +1 -0
  206. package/contracts/interfaces/IPActionSwapPT.sol +6 -6
  207. package/contracts/interfaces/IPActionSwapPTYT.sol +2 -2
  208. package/contracts/interfaces/IPActionSwapYT.sol +13 -13
  209. package/contracts/interfaces/IPFeeDistributor.sol +19 -0
  210. package/contracts/interfaces/IPFeeDistributorFactory.sol +14 -0
  211. package/contracts/interfaces/IPMarket.sol +2 -0
  212. package/contracts/interfaces/IPMsgReceiverApp.sol +7 -0
  213. package/contracts/interfaces/IPMsgSendEndpoint.sol +17 -0
  214. package/contracts/interfaces/IPVotingController.sol +22 -0
  215. package/contracts/interfaces/{IPVotingEscrow.sol → IPVotingEscrowMainchain.sol} +11 -1
  216. package/contracts/interfaces/ISuperComposableYield.sol +2 -7
  217. package/contracts/libraries/Errors.sol +121 -0
  218. package/contracts/libraries/OracleLib.sol +6 -3
  219. package/contracts/libraries/VeBalanceLib.sol +5 -1
  220. package/contracts/libraries/VeHistoryLib.sol +20 -31
  221. package/contracts/libraries/helpers/ArrayLib.sol +0 -17
  222. package/contracts/libraries/helpers/BaseSplitCodeFactory.sol +288 -0
  223. package/contracts/libraries/helpers/TokenHelper.sol +4 -0
  224. package/contracts/libraries/kyberswap/AggregationRouterHelper.sol +0 -7
  225. package/contracts/libraries/math/MarketMathCore.sol +29 -25
  226. package/contracts/libraries/math/Math.sol +6 -2
  227. package/contracts/libraries/math/WeekMath.sol +2 -2
  228. package/contracts/offchain-helpers/BaseSplitCodeFactoryContract.sol +43 -0
  229. package/contracts/offchain-helpers/MarketMathStatic.sol +36 -36
  230. package/contracts/offchain-helpers/RouterStatic.sol +45 -37
  231. package/deployments/43113-core.json +11 -10
  232. package/deployments/43113-markets/benqi-market-QI-USDC-FEB-2ND.json +8 -0
  233. package/deployments/43113-markets/benqi-market-QI-WETH-DEC-1ST.json +8 -0
  234. package/deployments/43113-testenv.json +9 -9
  235. package/deployments/80001-core.json +10 -9
  236. package/deployments/80001-markets/benqi-market-QI-USDC-FEB-2ND.json +8 -0
  237. package/deployments/80001-markets/benqi-market-QI-WETH-DEC-1ST.json +8 -0
  238. package/deployments/80001-testenv.json +16 -16
  239. package/package.json +1 -1
  240. package/typechain-types/ActionAddRemoveLiq.ts +18 -6
  241. package/typechain-types/ActionMintRedeem.ts +9 -2
  242. package/typechain-types/ActionSwapPT.ts +18 -6
  243. package/typechain-types/ActionSwapPTYT.ts +6 -2
  244. package/typechain-types/ActionSwapYT.ts +18 -6
  245. package/typechain-types/Errors.ts +57 -0
  246. package/typechain-types/ICrvPool.ts +137 -22
  247. package/typechain-types/IPActionAddRemoveLiq.ts +19 -7
  248. package/typechain-types/IPActionMintRedeem.ts +9 -2
  249. package/typechain-types/IPActionSwapPT.ts +18 -6
  250. package/typechain-types/IPActionSwapPTYT.ts +6 -2
  251. package/typechain-types/IPActionSwapYT.ts +18 -6
  252. package/typechain-types/IPAllAction.ts +70 -23
  253. package/typechain-types/IPBatchSeller.ts +252 -0
  254. package/typechain-types/IPMarket.ts +13 -0
  255. package/typechain-types/IPVotingController.ts +244 -7
  256. package/typechain-types/IPVotingEscrowMainchain.ts +461 -0
  257. package/typechain-types/IRewards.ts +25 -10
  258. package/typechain-types/ISuperComposableYield.ts +7 -46
  259. package/typechain-types/MarketMathStatic.ts +139 -10
  260. package/typechain-types/Pendle3CrvAndTokenSCY.ts +1215 -0
  261. package/typechain-types/Pendle3CrvTokenSCY.ts +85 -185
  262. package/typechain-types/PendleBatchSeller.ts +626 -0
  263. package/typechain-types/PendleConvexCurveLP2PoolSCY.ts +185 -220
  264. package/typechain-types/PendleConvexCurveLPSCY.ts +159 -182
  265. package/typechain-types/PendleCvxCRVSCY.ts +0 -34
  266. package/typechain-types/PendleGaugeControllerSidechainUpg.ts +28 -149
  267. package/typechain-types/PendleMarket.ts +104 -0
  268. package/typechain-types/PendleMarketFactory.ts +76 -13
  269. package/typechain-types/PendlePrincipalToken.ts +104 -0
  270. package/typechain-types/PendleQiTokenSCY.ts +111 -46
  271. package/typechain-types/PendleVotingControllerUpg.ts +133 -77
  272. package/typechain-types/PendleWstEthSCY.ts +111 -46
  273. package/typechain-types/PendleYieldContractFactory.ts +84 -21
  274. package/typechain-types/PendleYieldToken.ts +175 -0
  275. package/typechain-types/PtAMMArb.ts +587 -0
  276. package/typechain-types/RouterStatic.ts +99 -75
  277. package/typechain-types/SCYBase.ts +111 -46
  278. package/typechain-types/SCYBaseWithRewards.ts +111 -46
  279. package/typechain-types/VotingControllerStorageUpg.ts +246 -27
  280. package/typechain-types/VotingEscrowPendleMainchain.ts +81 -93
  281. package/typechain-types/VotingEscrowPendleSidechain.ts +26 -171
  282. package/typechain-types/factories/ActionAddRemoveLiq__factory.ts +169 -1
  283. package/typechain-types/factories/ActionCallback__factory.ts +108 -1
  284. package/typechain-types/factories/ActionMintRedeem__factory.ts +59 -1
  285. package/typechain-types/factories/ActionMisc__factory.ts +6 -1
  286. package/typechain-types/factories/ActionSwapPTYT__factory.ts +107 -1
  287. package/typechain-types/factories/ActionSwapPT__factory.ts +196 -1
  288. package/typechain-types/factories/ActionSwapYT__factory.ts +143 -1
  289. package/typechain-types/factories/AggregationRouterHelper__factory.ts +1 -1
  290. package/typechain-types/factories/Errors__factory.ts +933 -0
  291. package/typechain-types/factories/ICrvPool__factory.ts +85 -12
  292. package/typechain-types/factories/IPActionAddRemoveLiq__factory.ts +31 -1
  293. package/typechain-types/factories/IPActionMintRedeem__factory.ts +5 -0
  294. package/typechain-types/factories/IPActionSwapPTYT__factory.ts +10 -0
  295. package/typechain-types/factories/IPActionSwapPT__factory.ts +30 -0
  296. package/typechain-types/factories/IPActionSwapYT__factory.ts +30 -0
  297. package/typechain-types/factories/IPAllAction__factory.ts +106 -1
  298. package/typechain-types/factories/IPBatchSeller__factory.ts +138 -0
  299. package/typechain-types/factories/IPMarket__factory.ts +13 -0
  300. package/typechain-types/factories/IPVotingController__factory.ts +148 -0
  301. package/typechain-types/factories/IPVotingEscrowMainchain__factory.ts +340 -0
  302. package/typechain-types/factories/IRewards__factory.ts +14 -1
  303. package/typechain-types/factories/ISuperComposableYield__factory.ts +4 -28
  304. package/typechain-types/factories/MarketMathStatic__factory.ts +181 -3
  305. package/typechain-types/factories/OracleLib__factory.ts +27 -1
  306. package/typechain-types/factories/Pendle3CrvAndTokenSCY__factory.ts +1130 -0
  307. package/typechain-types/factories/Pendle3CrvHelper__factory.ts +1 -1
  308. package/typechain-types/factories/Pendle3CrvTokenSCY__factory.ts +74 -128
  309. package/typechain-types/factories/PendleBatchSeller__factory.ts +558 -0
  310. package/typechain-types/factories/PendleConvexCurveLP2PoolSCY__factory.ts +207 -136
  311. package/typechain-types/factories/PendleConvexCurveLPSCY__factory.ts +170 -95
  312. package/typechain-types/factories/PendleCvxCRVSCY__factory.ts +1 -29
  313. package/typechain-types/factories/PendleERC20Permit__factory.ts +1 -1
  314. package/typechain-types/factories/PendleFeeDistributorFactory__factory.ts +17 -1
  315. package/typechain-types/factories/PendleFeeDistributor__factory.ts +6 -1
  316. package/typechain-types/factories/PendleGaugeControllerBaseUpg__factory.ts +11 -0
  317. package/typechain-types/factories/PendleGaugeControllerMainchainUpg__factory.ts +28 -1
  318. package/typechain-types/factories/PendleGaugeControllerSidechainUpg__factory.ts +48 -86
  319. package/typechain-types/factories/PendleMarketFactory__factory.ts +129 -9
  320. package/typechain-types/factories/PendleMarket__factory.ts +214 -1
  321. package/typechain-types/factories/PendleMsgReceiveEndpointUpg__factory.ts +17 -1
  322. package/typechain-types/factories/PendleMsgReceiverAppUpg__factory.ts +11 -0
  323. package/typechain-types/factories/PendleMsgSendEndpointUpg__factory.ts +6 -1
  324. package/typechain-types/factories/PendlePrincipalToken__factory.ts +86 -1
  325. package/typechain-types/factories/PendleQiTokenHelper__factory.ts +1 -1
  326. package/typechain-types/factories/PendleQiTokenSCY__factory.ts +198 -29
  327. package/typechain-types/factories/PendleRouter__factory.ts +12 -1
  328. package/typechain-types/factories/PendleVotingControllerUpg__factory.ts +235 -40
  329. package/typechain-types/factories/PendleWstEthSCY__factory.ts +137 -22
  330. package/typechain-types/factories/PendleYieldContractFactory__factory.ts +103 -20
  331. package/typechain-types/factories/PendleYieldToken__factory.ts +163 -1
  332. package/typechain-types/factories/PtAMMArb__factory.ts +525 -0
  333. package/typechain-types/factories/RouterStatic__factory.ts +67 -20
  334. package/typechain-types/factories/SCYBaseWithRewards__factory.ts +136 -21
  335. package/typechain-types/factories/SCYBase__factory.ts +136 -21
  336. package/typechain-types/factories/VotingControllerStorageUpg__factory.ts +232 -12
  337. package/typechain-types/factories/VotingEscrowPendleMainchain__factory.ts +171 -47
  338. package/typechain-types/factories/VotingEscrowPendleSidechain__factory.ts +31 -93
  339. package/typechain-types/hardhat.d.ts +99 -0
  340. package/typechain-types/index.ts +22 -0
  341. package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/AaveV3/PendleAaveV3SCY.sol/PendleAaveV3SCY.dbg.json +0 -4
  342. package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/AaveV3/PendleAaveV3SCY.sol/PendleAaveV3SCY.json +0 -810
  343. package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/AaveV3/WadRayMath.sol/WadRayMath.dbg.json +0 -4
  344. package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/AaveV3/WadRayMath.sol/WadRayMath.json +0 -10
  345. package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiSAvaxSCY.sol/PendleQiSAvaxSCY.dbg.json +0 -4
  346. package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiSAvaxSCY.sol/PendleQiSAvaxSCY.json +0 -833
  347. package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleSAvaxSCY.sol/PendleSAvaxSCY.dbg.json +0 -4
  348. package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleSAvaxSCY.sol/PendleSAvaxSCY.json +0 -723
  349. package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/Euler/PendleEulerSCY.sol/PendleEulerSCY.dbg.json +0 -4
  350. package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/Euler/PendleEulerSCY.sol/PendleEulerSCY.json +0 -728
  351. package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleERC4626SCY.sol/PendleERC4626SCY.dbg.json +0 -4
  352. package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleERC4626SCY.sol/PendleERC4626SCY.json +0 -705
  353. package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleStargateSCY.sol/PendleStargateSCY.dbg.json +0 -4
  354. package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleStargateSCY.sol/PendleStargateSCY.json +0 -864
  355. package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleYearnVaultSCY.sol/PendleYearnVaultSCY.dbg.json +0 -4
  356. package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleYearnVaultSCY.sol/PendleYearnVaultSCY.json +0 -718
  357. package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/TraderJoe/PendleSJoeSCY.sol/PendleSJoeSCY.dbg.json +0 -4
  358. package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/TraderJoe/PendleSJoeSCY.sol/PendleSJoeSCY.json +0 -784
  359. package/build/artifacts/contracts/core/LiquidityMining/CelerAbstracts/CelerReceiverUpg.sol/CelerReceiverUpg.dbg.json +0 -4
  360. package/build/artifacts/contracts/core/LiquidityMining/CelerAbstracts/CelerSenderUpg.sol/CelerSenderUpg.dbg.json +0 -4
  361. package/build/artifacts/contracts/interfaces/IPVotingEscrow.sol/IPVotingEscrow.dbg.json +0 -4
  362. package/build/artifacts/contracts/libraries/helpers/SSTORE2Deployer.sol/SSTORE2Deployer.dbg.json +0 -4
  363. package/build/artifacts/contracts/libraries/solmate/SSTORE2.sol/SSTORE2.dbg.json +0 -4
  364. package/build/artifacts/contracts/offchain-helpers/SSTORE2DeployerContract.sol/SSTORE2DeployerContract.dbg.json +0 -4
  365. package/build/artifacts/contracts/offchain-helpers/SSTORE2DeployerContract.sol/SSTORE2DeployerContract.json +0 -134
  366. package/contracts/SuperComposableYield/SCY-implementations/AaveV3/PendleAaveV3SCY.sol +0 -161
  367. package/contracts/SuperComposableYield/SCY-implementations/AaveV3/WadRayMath.sol +0 -126
  368. package/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiSAvaxSCY.sol +0 -242
  369. package/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleSAvaxSCY.sol +0 -146
  370. package/contracts/SuperComposableYield/SCY-implementations/Euler/PendleEulerSCY.sol +0 -176
  371. package/contracts/SuperComposableYield/SCY-implementations/PendleERC4626SCY.sol +0 -129
  372. package/contracts/SuperComposableYield/SCY-implementations/PendleStargateSCY.sol +0 -193
  373. package/contracts/SuperComposableYield/SCY-implementations/PendleYearnVaultSCY.sol +0 -155
  374. package/contracts/SuperComposableYield/SCY-implementations/TraderJoe/PendleSJoeSCY.sol +0 -182
  375. package/contracts/core/LiquidityMining/CelerAbstracts/CelerReceiverUpg.sol +0 -53
  376. package/contracts/libraries/helpers/SSTORE2Deployer.sol +0 -30
  377. package/contracts/libraries/solmate/SSTORE2.sol +0 -99
  378. package/contracts/offchain-helpers/SSTORE2DeployerContract.sol +0 -21
  379. package/deployments/43113-markets/benqi-market-10D931.json +0 -8
  380. package/deployments/43113-markets/benqi-market-9fbD64.json +0 -8
  381. package/deployments/43113-markets/benqi-market-A12361.json +0 -8
@@ -2,6 +2,7 @@
2
2
  pragma solidity 0.8.15;
3
3
 
4
4
  import "../../../interfaces/IQiToken.sol";
5
+ import "../../../libraries/Errors.sol";
5
6
 
6
7
  contract PendleQiTokenHelper {
7
8
  IQiToken private immutable qiToken;
@@ -33,7 +34,8 @@ contract PendleQiTokenHelper {
33
34
  reservesPrior
34
35
  );
35
36
 
36
- require(borrowRateMantissa <= borrowRateMaxMantissa, "borrow rate is absurdly high");
37
+ if (borrowRateMantissa > borrowRateMaxMantissa)
38
+ revert Errors.SCYQiTokenBorrowRateTooHigh(borrowRateMantissa, borrowRateMaxMantissa);
37
39
 
38
40
  uint256 timestampDelta = currentBlockTimestamp - accrualBlockTimestampPrior;
39
41
 
@@ -27,8 +27,6 @@ contract PendleQiTokenSCY is SCYBaseWithRewards, PendleQiTokenHelper {
27
27
  SCYBaseWithRewards(_name, _symbol, _qiToken)
28
28
  PendleQiTokenHelper(_qiToken, _initialExchangeRateMantissa)
29
29
  {
30
- require(_WAVAX != address(0), "zero address");
31
-
32
30
  qiToken = _qiToken;
33
31
 
34
32
  underlying = isUnderlyingNative ? NATIVE : IQiErc20(qiToken).underlying();
@@ -69,7 +67,7 @@ contract PendleQiTokenSCY is SCYBaseWithRewards, PendleQiTokenHelper {
69
67
  IQiAvax(qiToken).mint{ value: amount }();
70
68
  } else {
71
69
  uint256 errCode = IQiErc20(qiToken).mint(amount);
72
- require(errCode == 0, "mint failed");
70
+ if (errCode != 0) revert Errors.SCYQiTokenMintFailed(errCode);
73
71
  }
74
72
 
75
73
  amountSharesOut = _selfBalance(qiToken) - preBalanceQiToken;
@@ -82,11 +80,11 @@ contract PendleQiTokenSCY is SCYBaseWithRewards, PendleQiTokenHelper {
82
80
  * The shares are redeemed into the same amount of qiTokens. If `tokenOut` is the underlying asset,
83
81
  * the function also redeems said asset from the corresponding amount of qiToken.
84
82
  */
85
- function _redeem(address tokenOut, uint256 amountSharesToRedeem)
86
- internal
87
- override
88
- returns (uint256 amountTokenOut)
89
- {
83
+ function _redeem(
84
+ address receiver,
85
+ address tokenOut,
86
+ uint256 amountSharesToRedeem
87
+ ) internal override returns (uint256 amountTokenOut) {
90
88
  if (tokenOut == qiToken) {
91
89
  amountTokenOut = amountSharesToRedeem;
92
90
  } else {
@@ -94,15 +92,16 @@ contract PendleQiTokenSCY is SCYBaseWithRewards, PendleQiTokenHelper {
94
92
 
95
93
  if (underlying == NATIVE) {
96
94
  uint256 errCode = IQiAvax(qiToken).redeem(amountSharesToRedeem);
97
- require(errCode == 0, "redeem failed");
95
+ if (errCode != 0) revert Errors.SCYQiTokenRedeemFailed(errCode);
98
96
  } else {
99
97
  uint256 errCode = IQiErc20(qiToken).redeem(amountSharesToRedeem);
100
- require(errCode == 0, "redeem failed");
98
+ if (errCode != 0) revert Errors.SCYQiTokenRedeemFailed(errCode);
101
99
  }
102
100
 
103
101
  // underlying is potentially also rewardToken, hence we need to manually track the balance here
104
102
  amountTokenOut = _selfBalance(underlying) - preBalanceUnderlying;
105
103
  }
104
+ _transferOut(tokenOut, receiver, amountTokenOut);
106
105
  }
107
106
 
108
107
  /*///////////////////////////////////////////////////////////////
@@ -139,14 +138,18 @@ contract PendleQiTokenSCY is SCYBaseWithRewards, PendleQiTokenHelper {
139
138
  IBenQiComptroller(comptroller).claimReward(0, holders, qiTokens, false, true);
140
139
  IBenQiComptroller(comptroller).claimReward(1, holders, qiTokens, false, true);
141
140
 
142
- require(
143
- Math.max(
144
- IBenQiComptroller(comptroller).rewardAccrued(0, address(this)),
145
- IBenQiComptroller(comptroller).rewardAccrued(1, address(this))
146
- ) == 0,
147
- "BENQI: redeem reward failed"
141
+ uint256 rewardAccruedType0 = IBenQiComptroller(comptroller).rewardAccrued(
142
+ 0,
143
+ address(this)
144
+ );
145
+ uint256 rewardAccruedType1 = IBenQiComptroller(comptroller).rewardAccrued(
146
+ 1,
147
+ address(this)
148
148
  );
149
149
 
150
+ if (rewardAccruedType0 > 0 || rewardAccruedType1 > 0)
151
+ revert Errors.SCYQiTokenRedeemRewardsFailed(rewardAccruedType0, rewardAccruedType1);
152
+
150
153
  if (address(this).balance != 0) IWETH(WAVAX).deposit{ value: address(this).balance }();
151
154
  }
152
155
 
@@ -0,0 +1,135 @@
1
+ // SPDX-License-Identifier: GPL-3.0-or-later
2
+ pragma solidity 0.8.15;
3
+
4
+ import "./PendleConvexCurveLP2PoolSCY.sol";
5
+ import "../Pendle3CrvHelper.sol";
6
+ import "../../../../libraries/helpers/ArrayLib.sol";
7
+
8
+ contract Pendle3CrvAndTokenSCY is PendleConvexCurveLP2PoolSCY {
9
+ using ArrayLib for address[];
10
+
11
+ constructor(
12
+ string memory _name,
13
+ string memory _symbol,
14
+ uint256 _pid,
15
+ address _convexBooster,
16
+ address _crvLpToken,
17
+ address _cvx,
18
+ address _baseCrvPool,
19
+ address[] memory _basePoolTokens
20
+ )
21
+ PendleConvexCurveLP2PoolSCY(
22
+ _name,
23
+ _symbol,
24
+ _pid,
25
+ _convexBooster,
26
+ _crvLpToken,
27
+ _cvx,
28
+ _baseCrvPool,
29
+ _basePoolTokens
30
+ )
31
+ {
32
+ if (!_basePoolTokens.contains(Pendle3CrvHelper.TOKEN))
33
+ revert Errors.SCYCurve3crvPoolNotFound();
34
+
35
+ _safeApproveInf(Pendle3CrvHelper.DAI, Pendle3CrvHelper.POOL);
36
+ _safeApproveInf(Pendle3CrvHelper.USDC, Pendle3CrvHelper.POOL);
37
+ _safeApproveInf(Pendle3CrvHelper.USDT, Pendle3CrvHelper.POOL);
38
+ }
39
+
40
+ function _deposit(address tokenIn, uint256 amount)
41
+ internal
42
+ virtual
43
+ override
44
+ returns (uint256 amountSharesOut)
45
+ {
46
+ if (Pendle3CrvHelper.is3CrvToken(tokenIn)) {
47
+ uint256 amountLp = Pendle3CrvHelper.deposit3Crv(tokenIn, amount);
48
+ return super._deposit(Pendle3CrvHelper.TOKEN, amountLp);
49
+ } else {
50
+ return super._deposit(tokenIn, amount);
51
+ }
52
+ }
53
+
54
+ function _redeem(
55
+ address receiver,
56
+ address tokenOut,
57
+ uint256 amountSharesToRedeem
58
+ ) internal virtual override returns (uint256 amountTokenOut) {
59
+ if (Pendle3CrvHelper.is3CrvToken(tokenOut)) {
60
+ uint256 amountLp = super._redeem(
61
+ address(this),
62
+ Pendle3CrvHelper.TOKEN,
63
+ amountSharesToRedeem
64
+ );
65
+ amountTokenOut = Pendle3CrvHelper.redeem3Crv(tokenOut, amountLp);
66
+ _transferOut(tokenOut, receiver, amountTokenOut);
67
+ } else {
68
+ return super._redeem(receiver, tokenOut, amountSharesToRedeem);
69
+ }
70
+ }
71
+
72
+ function _previewDeposit(address tokenIn, uint256 amountTokenToDeposit)
73
+ internal
74
+ view
75
+ virtual
76
+ override
77
+ returns (uint256)
78
+ {
79
+ if (Pendle3CrvHelper.is3CrvToken(tokenIn)) {
80
+ uint256 amountLp = Pendle3CrvHelper.preview3CrvDeposit(tokenIn, amountTokenToDeposit);
81
+ return super._previewDeposit(Pendle3CrvHelper.TOKEN, amountLp);
82
+ } else {
83
+ return super._previewDeposit(tokenIn, amountTokenToDeposit);
84
+ }
85
+ }
86
+
87
+ function _previewRedeem(address tokenOut, uint256 amountSharesToRedeem)
88
+ internal
89
+ view
90
+ virtual
91
+ override
92
+ returns (uint256)
93
+ {
94
+ if (Pendle3CrvHelper.is3CrvToken(tokenOut)) {
95
+ uint256 amountLp = super._previewRedeem(Pendle3CrvHelper.TOKEN, amountSharesToRedeem);
96
+ return Pendle3CrvHelper.preview3CrvRedeem(tokenOut, amountLp);
97
+ } else {
98
+ return super._previewRedeem(tokenOut, amountSharesToRedeem);
99
+ }
100
+ }
101
+
102
+ function getTokensIn() public view virtual override returns (address[] memory res) {
103
+ res = new address[](6);
104
+ res[0] = LP;
105
+ res[1] = token1;
106
+ res[2] = token2;
107
+ res[3] = Pendle3CrvHelper.DAI;
108
+ res[4] = Pendle3CrvHelper.USDC;
109
+ res[5] = Pendle3CrvHelper.USDT;
110
+ }
111
+
112
+ function getTokensOut() public view virtual override returns (address[] memory res) {
113
+ res = new address[](6);
114
+ res[0] = LP;
115
+ res[1] = token1;
116
+ res[2] = token2;
117
+ res[3] = Pendle3CrvHelper.DAI;
118
+ res[4] = Pendle3CrvHelper.USDC;
119
+ res[5] = Pendle3CrvHelper.USDT;
120
+ }
121
+
122
+ function isValidTokenIn(address token) public view virtual override returns (bool res) {
123
+ res = (token == LP ||
124
+ token == token1 ||
125
+ token == token2 ||
126
+ Pendle3CrvHelper.is3CrvToken(token));
127
+ }
128
+
129
+ function isValidTokenOut(address token) public view override returns (bool res) {
130
+ res = (token == LP ||
131
+ token == token1 ||
132
+ token == token2 ||
133
+ Pendle3CrvHelper.is3CrvToken(token));
134
+ }
135
+ }
@@ -0,0 +1,96 @@
1
+ // SPDX-License-Identifier: GPL-3.0-or-later
2
+ pragma solidity 0.8.15;
3
+
4
+ import "./PendleConvexCurveLPSCY.sol";
5
+
6
+ contract PendleConvexCurveLP2PoolSCY is PendleConvexCurveLPSCY {
7
+ address public immutable token1;
8
+ address public immutable token2;
9
+
10
+ constructor(
11
+ string memory _name,
12
+ string memory _symbol,
13
+ uint256 _pid,
14
+ address _convexBooster,
15
+ address _crvLpToken,
16
+ address _cvx,
17
+ address _baseCrvPool,
18
+ address[] memory _basePoolTokens
19
+ )
20
+ PendleConvexCurveLPSCY(
21
+ _name,
22
+ _symbol,
23
+ _pid,
24
+ _convexBooster,
25
+ _crvLpToken,
26
+ _cvx,
27
+ _baseCrvPool
28
+ )
29
+ {
30
+ if (_basePoolTokens.length != 2) revert Errors.ArrayLengthMismatch();
31
+
32
+ token1 = _basePoolTokens[0];
33
+ token2 = _basePoolTokens[1];
34
+
35
+ _safeApprove(token1, crvPool, type(uint256).max);
36
+ _safeApprove(token2, crvPool, type(uint256).max);
37
+ }
38
+
39
+ function getTokensIn() public view virtual override returns (address[] memory res) {
40
+ res = new address[](3);
41
+ res[0] = LP;
42
+ res[1] = token1;
43
+ res[2] = token2;
44
+ }
45
+
46
+ function getTokensOut() public view virtual override returns (address[] memory res) {
47
+ res = new address[](3);
48
+ res[0] = LP;
49
+ res[1] = token1;
50
+ res[2] = token2;
51
+ }
52
+
53
+ function isValidTokenIn(address token) public view virtual override returns (bool res) {
54
+ res = (token == LP || token == token1 || token == token2);
55
+ }
56
+
57
+ function isValidTokenOut(address token) public view virtual override returns (bool res) {
58
+ res = (token == LP || token == token1 || token == token2);
59
+ }
60
+
61
+ function _getBaseTokenIndex(address crvBaseToken)
62
+ internal
63
+ view
64
+ virtual
65
+ override
66
+ returns (uint256 index)
67
+ {
68
+ if (crvBaseToken == token1) {
69
+ index = 0;
70
+ } else {
71
+ index = 1;
72
+ }
73
+ }
74
+
75
+ function _isBaseToken(address token) internal view virtual override returns (bool res) {
76
+ return (token == token1 || token == token2);
77
+ }
78
+
79
+ function _depositToCurve(address token, uint256 amount) internal virtual override {
80
+ uint256[2] memory amounts;
81
+ amounts[_getBaseTokenIndex(token)] = amount;
82
+ ICrvPool(crvPool).add_liquidity(amounts, 0);
83
+ }
84
+
85
+ function _previewDepositToCurve(address token, uint256 amount)
86
+ internal
87
+ view
88
+ virtual
89
+ override
90
+ returns (uint256)
91
+ {
92
+ uint256[2] memory amounts;
93
+ amounts[_getBaseTokenIndex(token)] = amount;
94
+ return ICrvPool(crvPool).calc_token_amount(amounts, true);
95
+ }
96
+ }
@@ -0,0 +1,215 @@
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/ConvexCurve/IBooster.sol";
6
+ import "../../../../interfaces/ConvexCurve/IRewards.sol";
7
+ import "../../../../interfaces/Curve/ICrvPool.sol";
8
+
9
+ abstract contract PendleConvexCurveLPSCY is SCYBaseWithRewards {
10
+ using SafeERC20 for IERC20;
11
+
12
+ uint256 public immutable pid;
13
+ address public immutable booster;
14
+ address public immutable baseRewards;
15
+ address public immutable crvPool;
16
+
17
+ address public immutable CRV;
18
+ address public immutable CVX;
19
+ address public immutable LP;
20
+
21
+ constructor(
22
+ string memory _name,
23
+ string memory _symbol,
24
+ uint256 _pid,
25
+ address _convexBooster,
26
+ address _crvLpToken,
27
+ address _cvx,
28
+ address _baseCrvPool
29
+ ) SCYBaseWithRewards(_name, _symbol, _crvLpToken) {
30
+ pid = _pid;
31
+ CVX = _cvx;
32
+ crvPool = _baseCrvPool;
33
+
34
+ booster = _convexBooster;
35
+
36
+ (LP, baseRewards, CRV) = _getPoolInfo(pid);
37
+ if (LP != _crvLpToken) revert Errors.SCYCurveInvalidPid();
38
+
39
+ _safeApprove(LP, booster, type(uint256).max);
40
+ }
41
+
42
+ function _getPoolInfo(uint256 _pid)
43
+ internal
44
+ view
45
+ returns (
46
+ address lptoken,
47
+ address crvRewards,
48
+ address crv
49
+ )
50
+ {
51
+ if (_pid > IBooster(booster).poolLength()) revert Errors.SCYCurveInvalidPid();
52
+
53
+ (lptoken, , , crvRewards, , ) = IBooster(booster).poolInfo(_pid);
54
+ crv = IBooster(booster).crv();
55
+ }
56
+
57
+ /*///////////////////////////////////////////////////////////////
58
+ DEPOSIT/REDEEM USING BASE TOKENS
59
+ //////////////////////////////////////////////////////////////*/
60
+
61
+ /**
62
+ * If any of the base pool tokens are deposited, it will first add liquidity to the curve pool and mint LP,
63
+ * which will then be deposited into convex
64
+ */
65
+ function _deposit(address tokenIn, uint256 amount)
66
+ internal
67
+ virtual
68
+ override
69
+ returns (uint256 amountSharesOut)
70
+ {
71
+ if (tokenIn == LP) {
72
+ IBooster(booster).deposit(pid, amount, true);
73
+ amountSharesOut = amount;
74
+ } else {
75
+ uint256 prevLpBalance = _selfBalance(LP);
76
+ _depositToCurve(tokenIn, amount);
77
+ amountSharesOut = _selfBalance(LP) - prevLpBalance;
78
+
79
+ // Deposit LP Token received into Convex Booster
80
+ IBooster(booster).deposit(pid, amountSharesOut, true);
81
+ }
82
+ }
83
+
84
+ /**
85
+ * If any of the base curve pool tokens is specified as 'tokenOut',
86
+ * it will redeem the corresponding liquidity the LP token represents via the prevailing exchange rate.
87
+ */
88
+ function _redeem(
89
+ address receiver,
90
+ address tokenOut,
91
+ uint256 amountSharesToRedeem
92
+ ) internal virtual override returns (uint256 amountTokenOut) {
93
+ IRewards(baseRewards).withdrawAndUnwrap(amountSharesToRedeem, false);
94
+
95
+ if (_isBaseToken(tokenOut)) {
96
+ uint256 prevBal = _selfBalance(tokenOut);
97
+ ICrvPool(crvPool).remove_liquidity_one_coin(
98
+ amountSharesToRedeem,
99
+ Math.Int128(_getBaseTokenIndex(tokenOut)),
100
+ 0
101
+ );
102
+ amountTokenOut = _selfBalance(tokenOut) - prevBal;
103
+ } else {
104
+ // 'tokenOut' is LP
105
+ amountTokenOut = amountSharesToRedeem;
106
+ }
107
+ if (receiver != address(this)) _transferOut(tokenOut, receiver, amountTokenOut);
108
+ }
109
+
110
+ /*///////////////////////////////////////////////////////////////
111
+ EXCHANGE-RATE
112
+ //////////////////////////////////////////////////////////////*/
113
+
114
+ /**
115
+ * The current price of the pool LP token relative to the underlying pool assets. Given as an integer with 1e18 precision.
116
+ */
117
+ function exchangeRate() public view virtual override returns (uint256) {
118
+ return ICrvPool(crvPool).get_virtual_price();
119
+ }
120
+
121
+ /*///////////////////////////////////////////////////////////////
122
+ REWARDS-RELATED
123
+ //////////////////////////////////////////////////////////////*/
124
+
125
+ /**
126
+ * Refer to currentExtraRewards array of reward tokens specific to the curve pool.
127
+ * @dev We are aware that Convex might add or remove reward tokens, but also agreed that it was
128
+ * not worth the complexity
129
+ **/
130
+ function _getRewardTokens() internal view virtual override returns (address[] memory res) {
131
+ res = new address[](2);
132
+ res[0] = CRV;
133
+ res[1] = CVX;
134
+ }
135
+
136
+ function _redeemExternalReward() internal virtual override {
137
+ // Redeem all extra rewards from the curve pool
138
+ IRewards(baseRewards).getReward();
139
+ }
140
+
141
+ /*///////////////////////////////////////////////////////////////
142
+ MISC FUNCTIONS FOR METADATA
143
+ //////////////////////////////////////////////////////////////*/
144
+
145
+ function _previewDeposit(address tokenIn, uint256 amountTokenToDeposit)
146
+ internal
147
+ view
148
+ virtual
149
+ override
150
+ returns (uint256 amountSharesOut)
151
+ {
152
+ if (tokenIn == LP) {
153
+ amountSharesOut = amountTokenToDeposit;
154
+ } else {
155
+ // Calculate expected amount of LpToken to receive
156
+ amountSharesOut = _previewDepositToCurve(tokenIn, amountTokenToDeposit);
157
+ }
158
+ }
159
+
160
+ function _previewRedeem(address tokenOut, uint256 amountSharesToRedeem)
161
+ internal
162
+ view
163
+ virtual
164
+ override
165
+ returns (uint256 amountTokenOut)
166
+ {
167
+ uint256 amountLpTokenToReceive = (amountSharesToRedeem * exchangeRate()) / 1e18;
168
+
169
+ if (tokenOut == LP) {
170
+ amountTokenOut = amountLpTokenToReceive;
171
+ } else {
172
+ // If 'tokenOut' is a CrvBaseToken, withdraw liquidity from curvePool to return the base token back to user.
173
+ amountTokenOut = ICrvPool(crvPool).calc_withdraw_one_coin(
174
+ amountLpTokenToReceive,
175
+ Math.Int128(_getBaseTokenIndex(tokenOut))
176
+ );
177
+ }
178
+ }
179
+
180
+ function getTokensIn() public view virtual override returns (address[] memory res);
181
+
182
+ function getTokensOut() public view virtual override returns (address[] memory res);
183
+
184
+ function isValidTokenIn(address token) public view virtual override returns (bool);
185
+
186
+ function isValidTokenOut(address token) public view virtual override returns (bool);
187
+
188
+ function _depositToCurve(address token, uint256 amount) internal virtual;
189
+
190
+ function _previewDepositToCurve(address token, uint256 amount)
191
+ internal
192
+ view
193
+ virtual
194
+ returns (uint256 amountLpOut);
195
+
196
+ function _getBaseTokenIndex(address crvBaseToken)
197
+ internal
198
+ view
199
+ virtual
200
+ returns (uint256 index);
201
+
202
+ function _isBaseToken(address token) internal view virtual returns (bool res);
203
+
204
+ function assetInfo()
205
+ external
206
+ view
207
+ returns (
208
+ AssetType assetType,
209
+ address assetAddress,
210
+ uint8 assetDecimals
211
+ )
212
+ {
213
+ return (AssetType.LIQUIDITY, LP, IERC20Metadata(LP).decimals());
214
+ }
215
+ }
@@ -0,0 +1,83 @@
1
+ // SPDX-License-Identifier: GPL-3.0-or-later
2
+ pragma solidity 0.8.15;
3
+
4
+ import "../../../interfaces/Curve/ICrvPool.sol";
5
+ import "../../../libraries/math/Math.sol";
6
+ import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
7
+
8
+ library Pendle3CrvHelper {
9
+ using Math for uint256;
10
+
11
+ address public constant TOKEN = address(0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490);
12
+ address public constant POOL = address(0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7);
13
+ address public constant DAI = address(0x6B175474E89094C44Da98b954EedeAC495271d0F);
14
+ address public constant USDC = address(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);
15
+ address public constant USDT = address(0xdAC17F958D2ee523a2206206994597C13D831ec7);
16
+
17
+ function preview3CrvDeposit(address tokenIn, uint256 amountTokenToDeposit)
18
+ internal
19
+ view
20
+ returns (uint256)
21
+ {
22
+ return
23
+ ICrvPool(POOL).calc_token_amount(
24
+ _getTokenAmounts(tokenIn, amountTokenToDeposit),
25
+ true
26
+ );
27
+ }
28
+
29
+ function preview3CrvRedeem(address tokenOut, uint256 amountSharesToRedeem)
30
+ internal
31
+ view
32
+ returns (uint256)
33
+ {
34
+ return
35
+ ICrvPool(POOL).calc_withdraw_one_coin(
36
+ amountSharesToRedeem,
37
+ _get3CrvTokenIndex(tokenOut).Int128()
38
+ );
39
+ }
40
+
41
+ function deposit3Crv(address tokenIn, uint256 amountTokenToDeposit)
42
+ internal
43
+ returns (uint256)
44
+ {
45
+ uint256 balBefore = IERC20(TOKEN).balanceOf(address(this));
46
+ ICrvPool(POOL).add_liquidity(_getTokenAmounts(tokenIn, amountTokenToDeposit), 0);
47
+ uint256 balAfter = IERC20(TOKEN).balanceOf(address(this));
48
+ return balAfter - balBefore;
49
+ }
50
+
51
+ function redeem3Crv(address tokenOut, uint256 amountSharesToRedeem)
52
+ internal
53
+ returns (uint256)
54
+ {
55
+ uint256 balBefore = IERC20(tokenOut).balanceOf(address(this));
56
+ ICrvPool(POOL).remove_liquidity_one_coin(
57
+ amountSharesToRedeem,
58
+ _get3CrvTokenIndex(tokenOut).Int128(),
59
+ 0
60
+ );
61
+ uint256 balAfter = IERC20(tokenOut).balanceOf(address(this));
62
+ return balAfter - balBefore;
63
+ }
64
+
65
+ function _getTokenAmounts(address token, uint256 amount)
66
+ internal
67
+ pure
68
+ returns (uint256[3] memory res)
69
+ {
70
+ res[_get3CrvTokenIndex(token)] = amount;
71
+ }
72
+
73
+ function _get3CrvTokenIndex(address token) internal pure returns (uint256) {
74
+ if (token == DAI) return 0;
75
+ if (token == USDC) return 1;
76
+ if (token == USDT) return 2;
77
+ revert("Pendle3CrvHelper: not valid token");
78
+ }
79
+
80
+ function is3CrvToken(address token) internal pure returns (bool) {
81
+ return (token == DAI || token == USDC || token == USDT);
82
+ }
83
+ }
@@ -47,12 +47,8 @@ contract PendleWstEthSCY is SCYBase {
47
47
  if (tokenIn == stETH) {
48
48
  amountStETH = amountDeposited;
49
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;
50
+ if (tokenIn == wETH) IWETH(wETH).withdraw(amountDeposited);
51
+ amountStETH = IStETH(stETH).submit{ value: amountDeposited }(address(0));
56
52
  }
57
53
  amountSharesOut = IWstETH(wstETH).wrap(amountStETH);
58
54
  }
@@ -64,17 +60,17 @@ contract PendleWstEthSCY is SCYBase {
64
60
  * The shares are redeemed into the same amount of wstETH. If `tokenOut` is stETH, the function also
65
61
  * unwraps said amount of wstETH into stETH for redemption.
66
62
  */
67
- function _redeem(address tokenOut, uint256 amountSharesToRedeem)
68
- internal
69
- virtual
70
- override
71
- returns (uint256 amountTokenOut)
72
- {
63
+ function _redeem(
64
+ address receiver,
65
+ address tokenOut,
66
+ uint256 amountSharesToRedeem
67
+ ) internal virtual override returns (uint256 amountTokenOut) {
73
68
  if (tokenOut == wstETH) {
74
69
  amountTokenOut = amountSharesToRedeem;
75
70
  } else {
76
71
  amountTokenOut = IWstETH(wstETH).unwrap(amountSharesToRedeem);
77
72
  }
73
+ _transferOut(tokenOut, receiver, amountTokenOut);
78
74
  }
79
75
 
80
76
  /*///////////////////////////////////////////////////////////////
@@ -103,7 +99,7 @@ contract PendleWstEthSCY is SCYBase {
103
99
  else {
104
100
  uint256 amountStETH;
105
101
  if (tokenIn == stETH) {
106
- amountStETH = amountTokenToDeposit;
102
+ amountStETH = amountTokenToDeposit;
107
103
  } else {
108
104
  amountStETH = IStETH(stETH).getSharesByPooledEth(amountTokenToDeposit);
109
105
  }
@@ -124,10 +120,9 @@ contract PendleWstEthSCY is SCYBase {
124
120
  function getTokensIn() public view virtual override returns (address[] memory res) {
125
121
  res = new address[](4);
126
122
  res[0] = NATIVE;
127
- res[1] = wETH;
123
+ res[1] = wETH;
128
124
  res[2] = stETH;
129
125
  res[3] = wstETH;
130
-
131
126
  }
132
127
 
133
128
  function getTokensOut() public view virtual override returns (address[] memory res) {