@pendle/core-v2 1.0.0-mainnet → 1.0.2-mainnet

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 (216) hide show
  1. package/README.md +28 -0
  2. package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/PendleMsgReceiveEndpointUpg.sol/PendleMsgReceiveEndpointUpg.dbg.json +1 -1
  3. package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/PendleMsgReceiveEndpointUpg.sol/PendleMsgReceiveEndpointUpg.json +2 -2
  4. package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/PendleMsgReceiverAppUpg.sol/PendleMsgReceiverAppUpg.dbg.json +1 -1
  5. package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/PendleMsgSendEndpointUpg.sol/PendleMsgSendEndpointUpg.dbg.json +1 -1
  6. package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/PendleMsgSendEndpointUpg.sol/PendleMsgSendEndpointUpg.json +2 -2
  7. package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/PendleMsgSenderAppUpg.sol/PendleMsgSenderAppUpg.dbg.json +1 -1
  8. package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/libraries/ExcessivelySafeCall.sol/ExcessivelySafeCall.dbg.json +1 -1
  9. package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/libraries/LayerZeroHelper.sol/LayerZeroHelper.dbg.json +1 -1
  10. package/build/artifacts/contracts/LiquidityMining/FeeDistributor/EpochResultManager.sol/EpochResultManager.dbg.json +1 -1
  11. package/build/artifacts/contracts/LiquidityMining/FeeDistributor/PendleFeeDistributor.sol/PendleFeeDistributor.dbg.json +1 -1
  12. package/build/artifacts/contracts/LiquidityMining/FeeDistributor/PendleFeeDistributor.sol/PendleFeeDistributor.json +2 -2
  13. package/build/artifacts/contracts/LiquidityMining/FeeDistributor/PendleFeeDistributorFactory.sol/PendleFeeDistributorFactory.dbg.json +1 -1
  14. package/build/artifacts/contracts/LiquidityMining/FeeDistributor/PendleFeeDistributorFactory.sol/PendleFeeDistributorFactory.json +2 -2
  15. package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerBaseUpg.sol/PendleGaugeControllerBaseUpg.dbg.json +1 -1
  16. package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerMainchainUpg.sol/PendleGaugeControllerMainchainUpg.dbg.json +1 -1
  17. package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerMainchainUpg.sol/PendleGaugeControllerMainchainUpg.json +2 -2
  18. package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerSidechainUpg.sol/PendleGaugeControllerSidechainUpg.dbg.json +1 -1
  19. package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerSidechainUpg.sol/PendleGaugeControllerSidechainUpg.json +2 -2
  20. package/build/artifacts/contracts/LiquidityMining/VotingController/PendleVotingControllerUpg.sol/PendleVotingControllerUpg.dbg.json +1 -1
  21. package/build/artifacts/contracts/LiquidityMining/VotingController/PendleVotingControllerUpg.sol/PendleVotingControllerUpg.json +2 -2
  22. package/build/artifacts/contracts/LiquidityMining/VotingController/VotingControllerStorageUpg.sol/VotingControllerStorageUpg.dbg.json +1 -1
  23. package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol/VotingEscrowPendleMainchain.dbg.json +1 -1
  24. package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol/VotingEscrowPendleMainchain.json +2 -2
  25. package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowPendleSidechain.sol/VotingEscrowPendleSidechain.dbg.json +1 -1
  26. package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowPendleSidechain.sol/VotingEscrowPendleSidechain.json +2 -2
  27. package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowTokenBase.sol/VotingEscrowTokenBase.dbg.json +1 -1
  28. package/build/artifacts/contracts/LiquidityMining/libraries/VeBalanceLib.sol/VeBalanceLib.dbg.json +1 -1
  29. package/build/artifacts/contracts/LiquidityMining/libraries/VeBalanceLib.sol/VeBalanceLib.json +2 -2
  30. package/build/artifacts/contracts/LiquidityMining/libraries/VeHistoryLib.sol/CheckpointHelper.dbg.json +1 -1
  31. package/build/artifacts/contracts/LiquidityMining/libraries/VeHistoryLib.sol/CheckpointHelper.json +2 -2
  32. package/build/artifacts/contracts/LiquidityMining/libraries/VeHistoryLib.sol/Checkpoints.dbg.json +1 -1
  33. package/build/artifacts/contracts/LiquidityMining/libraries/VeHistoryLib.sol/Checkpoints.json +2 -2
  34. package/build/artifacts/contracts/core/BulkSeller/BulkSeller.sol/BulkSeller.dbg.json +1 -1
  35. package/build/artifacts/contracts/core/BulkSeller/BulkSeller.sol/BulkSeller.json +2 -2
  36. package/build/artifacts/contracts/core/BulkSeller/BulkSellerFactory.sol/BulkSellerFactory.dbg.json +1 -1
  37. package/build/artifacts/contracts/core/BulkSeller/BulkSellerFactory.sol/BulkSellerFactory.json +2 -2
  38. package/build/artifacts/contracts/core/BulkSeller/BulkSellerMathCore.sol/BulkSellerMathCore.dbg.json +1 -1
  39. package/build/artifacts/contracts/core/BulkSeller/BulkSellerMathCore.sol/BulkSellerMathCore.json +2 -2
  40. package/build/artifacts/contracts/core/Market/MarketMathCore.sol/MarketMathCore.dbg.json +1 -1
  41. package/build/artifacts/contracts/core/Market/MarketMathCore.sol/MarketMathCore.json +2 -2
  42. package/build/artifacts/contracts/core/Market/OracleLib.sol/OracleLib.dbg.json +1 -1
  43. package/build/artifacts/contracts/core/Market/OracleLib.sol/OracleLib.json +2 -2
  44. package/build/artifacts/contracts/core/Market/PendleGauge.sol/PendleGauge.dbg.json +1 -1
  45. package/build/artifacts/contracts/core/Market/PendleMarket.sol/PendleMarket.dbg.json +1 -1
  46. package/build/artifacts/contracts/core/Market/PendleMarket.sol/PendleMarket.json +2 -2
  47. package/build/artifacts/contracts/core/Market/PendleMarketFactory.sol/PendleMarketFactory.dbg.json +1 -1
  48. package/build/artifacts/contracts/core/Market/PendleMarketFactory.sol/PendleMarketFactory.json +2 -2
  49. package/build/artifacts/contracts/core/RewardManager/RewardManager.sol/RewardManager.dbg.json +1 -1
  50. package/build/artifacts/contracts/core/RewardManager/RewardManagerAbstract.sol/RewardManagerAbstract.dbg.json +1 -1
  51. package/build/artifacts/contracts/core/StandardizedYield/SYBase.sol/SYBase.dbg.json +1 -1
  52. package/build/artifacts/contracts/core/StandardizedYield/SYBase.sol/SYBase.json +0 -141
  53. package/build/artifacts/contracts/core/StandardizedYield/SYBaseWithRewards.sol/SYBaseWithRewards.dbg.json +1 -1
  54. package/build/artifacts/contracts/core/StandardizedYield/SYBaseWithRewards.sol/SYBaseWithRewards.json +0 -141
  55. package/build/artifacts/contracts/core/StandardizedYield/implementations/Ape/sAPE.sol/sAPE.dbg.json +4 -0
  56. package/build/artifacts/contracts/core/StandardizedYield/implementations/Ape/sAPE.sol/sAPE.json +934 -0
  57. package/build/artifacts/contracts/core/StandardizedYield/implementations/BenQi/PendleQiTokenHelper.sol/PendleQiTokenHelper.dbg.json +1 -1
  58. package/build/artifacts/contracts/core/StandardizedYield/implementations/BenQi/PendleQiTokenHelper.sol/PendleQiTokenHelper.json +2 -2
  59. package/build/artifacts/contracts/core/StandardizedYield/implementations/BenQi/PendleQiTokenSY.sol/PendleQiTokenSY.dbg.json +1 -1
  60. package/build/artifacts/contracts/core/StandardizedYield/implementations/BenQi/PendleQiTokenSY.sol/PendleQiTokenSY.json +2 -143
  61. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/PendleCurveFraxUsdcSY.sol/PendleCurveFraxUsdcSY.dbg.json +1 -1
  62. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/PendleCurveFraxUsdcSY.sol/PendleCurveFraxUsdcSY.json +2 -143
  63. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/PendleCurveUsdd3CrvSY.sol/PendleCurveUsdd3CrvSY.dbg.json +1 -1
  64. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/PendleCurveUsdd3CrvSY.sol/PendleCurveUsdd3CrvSY.json +2 -143
  65. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/Curve3CrvPoolHelper.sol/Curve3CrvPoolHelper.dbg.json +1 -1
  66. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/CurveFraxUsdcPoolHelper.sol/CurveFraxUsdcPoolHelper.dbg.json +1 -1
  67. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/CurveUsdd3CrvPoolHelper.sol/CurveUsdd3CrvPoolHelper.dbg.json +1 -1
  68. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/PendleConvexLPSY.sol/PendleConvexLPSY.dbg.json +1 -1
  69. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/PendleConvexLPSY.sol/PendleConvexLPSY.json +0 -141
  70. package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleLooksStakingSY.sol/PendleLooksStakingSY.dbg.json +1 -1
  71. package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleLooksStakingSY.sol/PendleLooksStakingSY.json +2 -143
  72. package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleWstEthSY.sol/PendleWstEthSY.dbg.json +1 -1
  73. package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleWstEthSY.sol/PendleWstEthSY.json +2 -143
  74. package/build/artifacts/contracts/core/YieldContracts/InterestManagerYT.sol/InterestManagerYT.dbg.json +1 -1
  75. package/build/artifacts/contracts/core/YieldContracts/PendlePrincipalToken.sol/PendlePrincipalToken.dbg.json +1 -1
  76. package/build/artifacts/contracts/core/YieldContracts/PendlePrincipalToken.sol/PendlePrincipalToken.json +2 -2
  77. package/build/artifacts/contracts/core/YieldContracts/PendleYieldContractFactory.sol/PendleYieldContractFactory.dbg.json +1 -1
  78. package/build/artifacts/contracts/core/YieldContracts/PendleYieldContractFactory.sol/PendleYieldContractFactory.json +2 -2
  79. package/build/artifacts/contracts/core/YieldContracts/PendleYieldToken.sol/PendleYieldToken.dbg.json +1 -1
  80. package/build/artifacts/contracts/core/YieldContracts/PendleYieldToken.sol/PendleYieldToken.json +2 -2
  81. package/build/artifacts/contracts/core/erc20/PendleERC20.sol/PendleERC20.dbg.json +1 -1
  82. package/build/artifacts/contracts/core/erc20/PendleERC20Permit.sol/PendleERC20Permit.dbg.json +1 -1
  83. package/build/artifacts/contracts/core/libraries/ArrayLib.sol/ArrayLib.dbg.json +1 -1
  84. package/build/artifacts/contracts/core/libraries/BoringOwnableUpgradeable.sol/BoringOwnableUpgradeable.dbg.json +1 -1
  85. package/build/artifacts/contracts/core/libraries/BoringOwnableUpgradeable.sol/BoringOwnableUpgradeableData.dbg.json +1 -1
  86. package/build/artifacts/contracts/core/libraries/Errors.sol/Errors.dbg.json +1 -1
  87. package/build/artifacts/contracts/core/libraries/Errors.sol/Errors.json +13 -2
  88. package/build/artifacts/contracts/core/libraries/MiniHelpers.sol/MiniHelpers.dbg.json +1 -1
  89. package/build/artifacts/contracts/core/libraries/TokenHelper.sol/TokenHelper.dbg.json +1 -1
  90. package/build/artifacts/contracts/interfaces/Curve/ICrvPool.sol/ICrvPool.dbg.json +1 -1
  91. package/build/artifacts/contracts/interfaces/Curve/ITriCrvPool.sol/ITriCrvPool.dbg.json +1 -1
  92. package/build/artifacts/contracts/interfaces/IApeStaking.sol/IApeStaking.dbg.json +4 -0
  93. package/build/artifacts/contracts/interfaces/IApeStaking.sol/IApeStaking.json +149 -0
  94. package/build/artifacts/contracts/interfaces/IBoringOwnableUpgradeable.sol/IBoringOwnableUpgradeable.dbg.json +1 -1
  95. package/build/artifacts/contracts/interfaces/ILayerZeroEndpoint.sol/ILayerZeroEndpoint.dbg.json +1 -1
  96. package/build/artifacts/contracts/interfaces/ILayerZeroReceiver.sol/ILayerZeroReceiver.dbg.json +1 -1
  97. package/build/artifacts/contracts/interfaces/IPActionAddRemoveLiq.sol/IPActionAddRemoveLiq.dbg.json +1 -1
  98. package/build/artifacts/contracts/interfaces/IPActionMintRedeem.sol/IPActionMintRedeem.dbg.json +1 -1
  99. package/build/artifacts/contracts/interfaces/IPActionSwapPT.sol/IPActionSwapPT.dbg.json +1 -1
  100. package/build/artifacts/contracts/interfaces/IPActionSwapPTYT.sol/IPActionSwapPTYT.dbg.json +1 -1
  101. package/build/artifacts/contracts/interfaces/IPActionSwapYT.sol/IPActionSwapYT.dbg.json +1 -1
  102. package/build/artifacts/contracts/interfaces/IPAllAction.sol/IPAllAction.dbg.json +1 -1
  103. package/build/artifacts/contracts/interfaces/IPBulkSeller.sol/IPBulkSeller.dbg.json +1 -1
  104. package/build/artifacts/contracts/interfaces/IPBulkSellerFactory.sol/IPBulkSellerFactory.dbg.json +1 -1
  105. package/build/artifacts/contracts/interfaces/IPMarket.sol/IPMarket.dbg.json +1 -1
  106. package/build/artifacts/contracts/interfaces/IPMsgReceiverApp.sol/IPMsgReceiverApp.dbg.json +1 -1
  107. package/build/artifacts/contracts/interfaces/IPMsgSendEndpoint.sol/IPMsgSendEndpoint.dbg.json +1 -1
  108. package/build/artifacts/contracts/interfaces/IPVeToken.sol/IPVeToken.dbg.json +1 -1
  109. package/build/artifacts/contracts/interfaces/IPVotingController.sol/IPVotingController.dbg.json +1 -1
  110. package/build/artifacts/contracts/interfaces/IPVotingEscrowMainchain.sol/IPVotingEscrowMainchain.dbg.json +1 -1
  111. package/build/artifacts/contracts/interfaces/IREDACTEDStaking.sol/IREDACTEDStaking.dbg.json +1 -1
  112. package/build/artifacts/contracts/interfaces/IStETH.sol/IStETH.dbg.json +1 -1
  113. package/build/artifacts/contracts/interfaces/IStargateLPStaking.sol/IStargateLPStaking.dbg.json +1 -1
  114. package/build/artifacts/contracts/interfaces/IStargatePool.sol/IStargatePool.dbg.json +1 -1
  115. package/build/artifacts/contracts/interfaces/IStargateRouter.sol/IStargateRouter.dbg.json +1 -1
  116. package/build/artifacts/contracts/interfaces/IWXBTRFLY.sol/IWXBTRFLY.dbg.json +1 -1
  117. package/build/artifacts/contracts/offchain-helpers/BaseSplitCodeFactoryContract.sol/BaseSplitCodeFactoryContract.dbg.json +1 -1
  118. package/build/artifacts/contracts/offchain-helpers/BulkSellerOffchain.sol/BulkSellerOffchain.dbg.json +1 -1
  119. package/build/artifacts/contracts/offchain-helpers/BulkSellerOffchain.sol/BulkSellerOffchain.json +2 -2
  120. package/build/artifacts/contracts/offchain-helpers/MarketMathStatic.sol/MarketMathStatic.dbg.json +1 -1
  121. package/build/artifacts/contracts/offchain-helpers/MarketMathStatic.sol/MarketMathStatic.json +42 -2
  122. package/build/artifacts/contracts/offchain-helpers/RouterStatic.sol/RouterStatic.dbg.json +1 -1
  123. package/build/artifacts/contracts/offchain-helpers/RouterStatic.sol/RouterStatic.json +171 -98
  124. package/build/artifacts/contracts/router/ActionAddRemoveLiq.sol/ActionAddRemoveLiq.dbg.json +1 -1
  125. package/build/artifacts/contracts/router/ActionAddRemoveLiq.sol/ActionAddRemoveLiq.json +2 -2
  126. package/build/artifacts/contracts/router/ActionCallback.sol/ActionCallback.dbg.json +1 -1
  127. package/build/artifacts/contracts/router/ActionCallback.sol/ActionCallback.json +2 -2
  128. package/build/artifacts/contracts/router/ActionMintRedeem.sol/ActionMintRedeem.dbg.json +1 -1
  129. package/build/artifacts/contracts/router/ActionMintRedeem.sol/ActionMintRedeem.json +2 -2
  130. package/build/artifacts/contracts/router/ActionMisc.sol/ActionMisc.dbg.json +1 -1
  131. package/build/artifacts/contracts/router/ActionMisc.sol/ActionMisc.json +2 -2
  132. package/build/artifacts/contracts/router/ActionSwapPT.sol/ActionSwapPT.dbg.json +1 -1
  133. package/build/artifacts/contracts/router/ActionSwapPT.sol/ActionSwapPT.json +2 -2
  134. package/build/artifacts/contracts/router/ActionSwapPTYT.sol/ActionSwapPTYT.dbg.json +1 -1
  135. package/build/artifacts/contracts/router/ActionSwapPTYT.sol/ActionSwapPTYT.json +2 -2
  136. package/build/artifacts/contracts/router/ActionSwapYT.sol/ActionSwapYT.dbg.json +1 -1
  137. package/build/artifacts/contracts/router/ActionSwapYT.sol/ActionSwapYT.json +2 -2
  138. package/build/artifacts/contracts/router/PendleRouter.sol/PendleRouter.dbg.json +1 -1
  139. package/build/artifacts/contracts/router/PendleRouter.sol/PendleRouter.json +2 -2
  140. package/build/artifacts/contracts/router/base/ActionBaseMintRedeem.sol/ActionBaseMintRedeem.dbg.json +1 -1
  141. package/build/artifacts/contracts/router/base/MarketApproxLib.sol/MarketApproxPtInLib.dbg.json +1 -1
  142. package/build/artifacts/contracts/router/base/MarketApproxLib.sol/MarketApproxPtInLib.json +2 -2
  143. package/build/artifacts/contracts/router/base/MarketApproxLib.sol/MarketApproxPtOutLib.dbg.json +1 -1
  144. package/build/artifacts/contracts/router/base/MarketApproxLib.sol/MarketApproxPtOutLib.json +2 -2
  145. package/build/artifacts/contracts/router/kyberswap/AggregationRouterHelper.sol/AggregationRouterHelper.dbg.json +1 -1
  146. package/build/artifacts/contracts/router/kyberswap/IAggregatorRouterHelper.sol/IAggregationRouterHelper.dbg.json +1 -1
  147. package/build/artifacts/contracts/router/kyberswap/IMultihopRouter.sol/IMultihopRouter.dbg.json +1 -1
  148. package/build/artifacts/contracts/router/kyberswap/KyberSwapHelper.sol/KyberSwapHelper.dbg.json +1 -1
  149. package/contracts/core/StandardizedYield/SYBase.sol +5 -23
  150. package/contracts/core/StandardizedYield/SYBaseWithRewards.sol +1 -3
  151. package/contracts/core/StandardizedYield/implementations/Ape/sAPE.sol +197 -0
  152. package/contracts/core/libraries/Errors.sol +2 -0
  153. package/contracts/interfaces/IApeStaking.sol +30 -0
  154. package/contracts/offchain-helpers/MarketMathStatic.sol +181 -88
  155. package/contracts/offchain-helpers/RouterStatic.sol +72 -72
  156. package/deployments/1-core.json +1 -1
  157. package/deployments/1-markets/APE-JUNE-29.json +7 -0
  158. package/package.json +1 -1
  159. package/typechain-types/IApeStaking.ts +305 -0
  160. package/typechain-types/MarketMathStatic.ts +49 -0
  161. package/typechain-types/PendleApeStakingSY.ts +1135 -0
  162. package/typechain-types/PendleConvexLPSY.ts +0 -204
  163. package/typechain-types/PendleCurveFraxUsdcSY.ts +0 -204
  164. package/typechain-types/PendleCurveUsdd3CrvSY.ts +0 -204
  165. package/typechain-types/PendleLooksStakingSY.ts +0 -204
  166. package/typechain-types/PendleQiTokenSY.ts +0 -204
  167. package/typechain-types/PendleWstEthSY.ts +0 -204
  168. package/typechain-types/RouterStatic.ts +40 -69
  169. package/typechain-types/SAPE.ts +1191 -0
  170. package/typechain-types/SYBase.ts +0 -204
  171. package/typechain-types/SYBaseAutoCompound.ts +1203 -0
  172. package/typechain-types/SYBaseWithRewards.ts +0 -204
  173. package/typechain-types/factories/ActionAddRemoveLiq__factory.ts +1 -1
  174. package/typechain-types/factories/ActionCallback__factory.ts +1 -1
  175. package/typechain-types/factories/ActionMintRedeem__factory.ts +1 -1
  176. package/typechain-types/factories/ActionMisc__factory.ts +1 -1
  177. package/typechain-types/factories/ActionSwapPTYT__factory.ts +1 -1
  178. package/typechain-types/factories/ActionSwapPT__factory.ts +1 -1
  179. package/typechain-types/factories/ActionSwapYT__factory.ts +1 -1
  180. package/typechain-types/factories/BulkSellerFactory__factory.ts +1 -1
  181. package/typechain-types/factories/BulkSellerOffchain__factory.ts +1 -1
  182. package/typechain-types/factories/BulkSeller__factory.ts +1 -1
  183. package/typechain-types/factories/Errors__factory.ts +12 -1
  184. package/typechain-types/factories/IApeStaking__factory.ts +161 -0
  185. package/typechain-types/factories/MarketMathStatic__factory.ts +41 -1
  186. package/typechain-types/factories/OracleLib__factory.ts +1 -1
  187. package/typechain-types/factories/PendleApeStakingSY__factory.ts +981 -0
  188. package/typechain-types/factories/PendleConvexLPSY__factory.ts +0 -141
  189. package/typechain-types/factories/PendleCurveFraxUsdcSY__factory.ts +1 -142
  190. package/typechain-types/factories/PendleCurveUsdd3CrvSY__factory.ts +1 -142
  191. package/typechain-types/factories/PendleFeeDistributorFactory__factory.ts +1 -1
  192. package/typechain-types/factories/PendleFeeDistributor__factory.ts +1 -1
  193. package/typechain-types/factories/PendleGaugeControllerMainchainUpg__factory.ts +1 -1
  194. package/typechain-types/factories/PendleGaugeControllerSidechainUpg__factory.ts +1 -1
  195. package/typechain-types/factories/PendleLooksStakingSY__factory.ts +1 -142
  196. package/typechain-types/factories/PendleMarketFactory__factory.ts +1 -1
  197. package/typechain-types/factories/PendleMarket__factory.ts +1 -1
  198. package/typechain-types/factories/PendleMsgReceiveEndpointUpg__factory.ts +1 -1
  199. package/typechain-types/factories/PendleMsgSendEndpointUpg__factory.ts +1 -1
  200. package/typechain-types/factories/PendlePrincipalToken__factory.ts +1 -1
  201. package/typechain-types/factories/PendleQiTokenHelper__factory.ts +1 -1
  202. package/typechain-types/factories/PendleQiTokenSY__factory.ts +1 -142
  203. package/typechain-types/factories/PendleRouter__factory.ts +1 -1
  204. package/typechain-types/factories/PendleVotingControllerUpg__factory.ts +1 -1
  205. package/typechain-types/factories/PendleWstEthSY__factory.ts +1 -142
  206. package/typechain-types/factories/PendleYieldContractFactory__factory.ts +1 -1
  207. package/typechain-types/factories/PendleYieldToken__factory.ts +1 -1
  208. package/typechain-types/factories/RouterStatic__factory.ts +118 -41
  209. package/typechain-types/factories/SAPE__factory.ts +1001 -0
  210. package/typechain-types/factories/SYBaseAutoCompound__factory.ts +942 -0
  211. package/typechain-types/factories/SYBaseWithRewards__factory.ts +0 -141
  212. package/typechain-types/factories/SYBase__factory.ts +0 -141
  213. package/typechain-types/factories/VotingEscrowPendleMainchain__factory.ts +1 -1
  214. package/typechain-types/factories/VotingEscrowPendleSidechain__factory.ts +1 -1
  215. package/typechain-types/hardhat.d.ts +18 -0
  216. package/typechain-types/index.ts +4 -0
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../../build-info/6706703c8fe8ac4d4c9afd1b462beca5.json"
3
+ "buildInfo": "../../../../build-info/a621fb3f7b594e543562ee2e030c795c.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../../build-info/6706703c8fe8ac4d4c9afd1b462beca5.json"
3
+ "buildInfo": "../../../../build-info/a621fb3f7b594e543562ee2e030c795c.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../../build-info/6706703c8fe8ac4d4c9afd1b462beca5.json"
3
+ "buildInfo": "../../../../build-info/e2e9cb6acc17b5b86624f99f6400a1c9.json"
4
4
  }
@@ -1,22 +1,13 @@
1
1
  // SPDX-License-Identifier: GPL-3.0-or-later
2
2
  pragma solidity 0.8.17;
3
- import "../../interfaces/IStandardizedYield.sol";
4
3
 
4
+ import "../../interfaces/IStandardizedYield.sol";
5
5
  import "../erc20/PendleERC20Permit.sol";
6
-
7
6
  import "../libraries/math/Math.sol";
8
7
  import "../libraries/TokenHelper.sol";
9
8
  import "../libraries/Errors.sol";
10
- import "../libraries/BoringOwnableUpgradeable.sol";
11
- import "@openzeppelin/contracts/security/Pausable.sol";
12
-
13
- abstract contract SYBase is
14
- IStandardizedYield,
15
- PendleERC20Permit,
16
- TokenHelper,
17
- BoringOwnableUpgradeable,
18
- Pausable
19
- {
9
+
10
+ abstract contract SYBase is IStandardizedYield, PendleERC20Permit, TokenHelper {
20
11
  using Math for uint256;
21
12
 
22
13
  address public immutable yieldToken;
@@ -25,9 +16,8 @@ abstract contract SYBase is
25
16
  string memory _name,
26
17
  string memory _symbol,
27
18
  address _yieldToken
28
- ) PendleERC20Permit(_name, _symbol, IERC20Metadata(_yieldToken).decimals()) initializer {
19
+ ) PendleERC20Permit(_name, _symbol, IERC20Metadata(_yieldToken).decimals()) {
29
20
  yieldToken = _yieldToken;
30
- __BoringOwnable_init();
31
21
  }
32
22
 
33
23
  // solhint-disable no-empty-blocks
@@ -189,19 +179,11 @@ abstract contract SYBase is
189
179
  return _previewRedeem(tokenOut, amountSharesToRedeem);
190
180
  }
191
181
 
192
- function pause() external onlyOwner {
193
- _pause();
194
- }
195
-
196
- function unpause() external onlyOwner {
197
- _unpause();
198
- }
199
-
200
182
  function _beforeTokenTransfer(
201
183
  address,
202
184
  address,
203
185
  uint256
204
- ) internal virtual override whenNotPaused {}
186
+ ) internal virtual override {}
205
187
 
206
188
  function _previewDeposit(address tokenIn, uint256 amountTokenToDeposit)
207
189
  internal
@@ -29,7 +29,6 @@ abstract contract SYBaseWithRewards is SYBase, RewardManager {
29
29
  virtual
30
30
  override
31
31
  nonReentrant
32
- whenNotPaused
33
32
  returns (uint256[] memory rewardAmounts)
34
33
  {
35
34
  _updateAndDistributeRewards(user);
@@ -74,7 +73,6 @@ abstract contract SYBaseWithRewards is SYBase, RewardManager {
74
73
  function rewardIndexesCurrent()
75
74
  external
76
75
  override
77
- whenNotPaused
78
76
  nonReentrant
79
77
  returns (uint256[] memory indexes)
80
78
  {
@@ -122,7 +120,7 @@ abstract contract SYBaseWithRewards is SYBase, RewardManager {
122
120
  address from,
123
121
  address to,
124
122
  uint256
125
- ) internal virtual override whenNotPaused {
123
+ ) internal virtual override {
126
124
  _updateAndDistributeRewardsForTwo(from, to);
127
125
  }
128
126
  }
@@ -0,0 +1,197 @@
1
+ // SPDX-License-Identifier: GPL-3.0-or-later
2
+ pragma solidity 0.8.17;
3
+
4
+ import "../../SYBase.sol";
5
+ import "../../../../interfaces/IApeStaking.sol";
6
+
7
+ contract sAPE is SYBase {
8
+ using Math for uint256;
9
+
10
+ uint256 public constant APE_COIN_POOL_ID = 0;
11
+ uint256 public constant MIN_APE_DEPOSIT = 10**18;
12
+ uint256 public constant EPOCH_LENGTH = 1 hours;
13
+ uint256 private constant MINIMUM_LIQUIDITY = 1e9;
14
+
15
+ address public immutable apeStaking;
16
+ address public immutable apeCoin;
17
+
18
+ uint256 private lastRewardClaimedEpoch;
19
+
20
+ constructor(
21
+ string memory _name,
22
+ string memory _symbol,
23
+ address _apeCoin,
24
+ address _apeStaking
25
+ ) SYBase(_name, _symbol, _apeCoin) {
26
+ apeStaking = _apeStaking;
27
+ apeCoin = _apeCoin;
28
+ lastRewardClaimedEpoch = _getCurrentEpochId();
29
+ _safeApproveInf(apeCoin, apeStaking);
30
+ }
31
+
32
+ function wrap(uint256 amountTokenIn) external {
33
+ _transferIn(apeCoin, msg.sender, amountTokenIn);
34
+ uint256 amountSharesOut = _deposit(apeCoin, amountTokenIn);
35
+ _mint(msg.sender, amountSharesOut);
36
+ emit Deposit(msg.sender, msg.sender, apeCoin, amountTokenIn, amountSharesOut);
37
+ }
38
+
39
+ function unwrap(uint256 amountShares) external {
40
+ _burn(msg.sender, amountShares);
41
+ uint256 amountTokenOut = _redeem(msg.sender, apeCoin, amountShares);
42
+ emit Redeem(msg.sender, msg.sender, apeCoin, amountShares, amountTokenOut);
43
+ }
44
+
45
+ function _deposit(address, uint256 amountDeposited)
46
+ internal
47
+ virtual
48
+ override
49
+ returns (uint256 amountSharesOut)
50
+ {
51
+ // Respecting APE's deposit invariant
52
+ if (amountDeposited < MIN_APE_DEPOSIT) {
53
+ revert Errors.SYApeDepositAmountTooSmall(amountDeposited);
54
+ }
55
+
56
+ _harvestAndCompound();
57
+
58
+ // As SY Base is pulling the tokenIn first, the totalAsset should exclude user's deposit
59
+ if (totalSupply() == 0) {
60
+ amountSharesOut = amountDeposited - MINIMUM_LIQUIDITY;
61
+ _mint(address(1), MINIMUM_LIQUIDITY);
62
+ } else {
63
+ uint256 priorTotalAssetOwned = getTotalAssetOwned() - amountDeposited;
64
+ amountSharesOut = (amountDeposited * totalSupply()) / priorTotalAssetOwned;
65
+ }
66
+ }
67
+
68
+ function _redeem(
69
+ address receiver,
70
+ address,
71
+ uint256 amountSharesToRedeem
72
+ ) internal virtual override returns (uint256 amountTokenOut) {
73
+ _harvest();
74
+
75
+ // As SY is burned before calling _redeem(), we should account for priorSupply
76
+ uint256 priorTotalSupply = totalSupply() + amountSharesToRedeem;
77
+
78
+ if (amountSharesToRedeem == priorTotalSupply) {
79
+ amountTokenOut = getTotalAssetOwned();
80
+ } else {
81
+ amountTokenOut = (amountSharesToRedeem * getTotalAssetOwned()) / priorTotalSupply;
82
+ }
83
+
84
+ // There might be case when the contract is holding < 1 APE reward and user is withdrawing everything out of it
85
+ if (amountTokenOut > _selfBalance(apeCoin)) {
86
+ IApeStaking(apeStaking).withdrawApeCoin(
87
+ amountTokenOut - _selfBalance(apeCoin),
88
+ address(this)
89
+ );
90
+ }
91
+ _transferOut(apeCoin, receiver, amountTokenOut);
92
+ _compound();
93
+ }
94
+
95
+ function exchangeRate() public view virtual override returns (uint256) {
96
+ // This function is intentionally left reverted when totalSupply() = 0
97
+ return getTotalAssetOwned().divDown(totalSupply());
98
+ }
99
+
100
+ /*///////////////////////////////////////////////////////////////
101
+ AUTOCOMPOUND FEATURE
102
+ //////////////////////////////////////////////////////////////*/
103
+
104
+ function getTotalAssetOwned() public view returns (uint256 totalAssetOwned) {
105
+ (uint256 stakedAmount, ) = IApeStaking(apeStaking).addressPosition(address(this));
106
+ uint256 unclaimedAmount = IApeStaking(apeStaking).pendingRewards(
107
+ APE_COIN_POOL_ID,
108
+ address(this),
109
+ 0
110
+ );
111
+ uint256 floatingAmount = _selfBalance(apeCoin);
112
+ totalAssetOwned = stakedAmount + unclaimedAmount + floatingAmount;
113
+ }
114
+
115
+ function harvestAndCompound() external {
116
+ _harvestAndCompound();
117
+ }
118
+
119
+ function _harvestAndCompound() internal {
120
+ _harvest();
121
+ _compound();
122
+ }
123
+
124
+ function _compound() internal {
125
+ uint256 amountAssetToCompound = _selfBalance(apeCoin);
126
+ if (amountAssetToCompound >= MIN_APE_DEPOSIT) {
127
+ IApeStaking(apeStaking).depositSelfApeCoin(amountAssetToCompound);
128
+ }
129
+ }
130
+
131
+ function _harvest() internal {
132
+ uint256 currentEpochId = _getCurrentEpochId();
133
+ if (currentEpochId == lastRewardClaimedEpoch) {
134
+ return;
135
+ }
136
+ IApeStaking(apeStaking).claimSelfApeCoin();
137
+ lastRewardClaimedEpoch = currentEpochId;
138
+ }
139
+
140
+ /*///////////////////////////////////////////////////////////////
141
+ MISC FUNCTIONS FOR METADATA
142
+ //////////////////////////////////////////////////////////////*/
143
+
144
+ function _previewDeposit(address, uint256 amountTokenToDeposit)
145
+ internal
146
+ view
147
+ override
148
+ returns (uint256 amountSharesOut)
149
+ {
150
+ // This function is intentionally left reverted when totalSupply() = 0
151
+ amountSharesOut = (amountTokenToDeposit * totalSupply()) / getTotalAssetOwned();
152
+ }
153
+
154
+ function _previewRedeem(address, uint256 amountSharesToRedeem)
155
+ internal
156
+ view
157
+ override
158
+ returns (uint256 amountTokenOut)
159
+ {
160
+ // This function is intentionally left reverted when totalSupply() = 0
161
+ amountTokenOut = (amountSharesToRedeem * getTotalAssetOwned()) / totalSupply();
162
+ }
163
+
164
+ function _getCurrentEpochId() private view returns (uint256) {
165
+ return block.timestamp / EPOCH_LENGTH;
166
+ }
167
+
168
+ function getTokensIn() public view virtual override returns (address[] memory res) {
169
+ res = new address[](1);
170
+ res[0] = apeCoin;
171
+ }
172
+
173
+ function getTokensOut() public view virtual override returns (address[] memory res) {
174
+ res = new address[](1);
175
+ res[0] = apeCoin;
176
+ }
177
+
178
+ function isValidTokenIn(address token) public view virtual override returns (bool) {
179
+ return token == apeCoin;
180
+ }
181
+
182
+ function isValidTokenOut(address token) public view virtual override returns (bool) {
183
+ return token == apeCoin;
184
+ }
185
+
186
+ function assetInfo()
187
+ external
188
+ view
189
+ returns (
190
+ AssetType assetType,
191
+ address assetAddress,
192
+ uint8 assetDecimals
193
+ )
194
+ {
195
+ return (AssetType.TOKEN, apeCoin, IERC20Metadata(apeCoin).decimals());
196
+ }
197
+ }
@@ -111,6 +111,8 @@ library Errors {
111
111
  error SYCurveInvalidPid();
112
112
  error SYCurve3crvPoolNotFound();
113
113
 
114
+ error SYApeDepositAmountTooSmall(uint256 amountDeposited);
115
+
114
116
  // Liquidity Mining
115
117
  error VCInactivePool(address pool);
116
118
  error VCPoolAlreadyActive(address pool);
@@ -0,0 +1,30 @@
1
+ // SPDX-License-Identifier: GPL-3.0-or-later
2
+
3
+ pragma solidity 0.8.17;
4
+
5
+ interface IApeStaking {
6
+ function apeCoin() external view returns (address);
7
+
8
+ function depositSelfApeCoin(uint256 _amount) external;
9
+
10
+ function withdrawApeCoin(uint256 _amount, address _recipient) external;
11
+
12
+ function claimSelfApeCoin() external;
13
+
14
+ /**
15
+ * @notice when poolId is set to 0, tokenId's value does not matter
16
+ */
17
+ function pendingRewards(
18
+ uint256 _poolId,
19
+ address _address,
20
+ uint256 _tokenId
21
+ ) external view returns (uint256);
22
+
23
+ function addressPosition(address addr)
24
+ external
25
+ view
26
+ returns (uint256 stakedAmount, int256 rewardsDebt);
27
+
28
+ // for SDK
29
+ function pools(uint256 id) external view returns (uint48, uint16, uint96 totalStaked, uint96);
30
+ }