@pendle/core-v2 0.17.5-testnet → 0.17.6-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 (266) 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/ExcessivelySafeCall.sol/ExcessivelySafeCall.json +2 -2
  10. package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/libraries/LayerZeroHelper.sol/LayerZeroHelper.dbg.json +1 -1
  11. package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/libraries/LayerZeroHelper.sol/LayerZeroHelper.json +2 -2
  12. package/build/artifacts/contracts/LiquidityMining/FeeDistributor/EpochResultManager.sol/EpochResultManager.dbg.json +1 -1
  13. package/build/artifacts/contracts/LiquidityMining/FeeDistributor/PendleFeeDistributor.sol/PendleFeeDistributor.dbg.json +1 -1
  14. package/build/artifacts/contracts/LiquidityMining/FeeDistributor/PendleFeeDistributor.sol/PendleFeeDistributor.json +2 -2
  15. package/build/artifacts/contracts/LiquidityMining/FeeDistributor/PendleFeeDistributorFactory.sol/PendleFeeDistributorFactory.dbg.json +1 -1
  16. package/build/artifacts/contracts/LiquidityMining/FeeDistributor/PendleFeeDistributorFactory.sol/PendleFeeDistributorFactory.json +2 -2
  17. package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerBaseUpg.sol/PendleGaugeControllerBaseUpg.dbg.json +1 -1
  18. package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerMainchainUpg.sol/PendleGaugeControllerMainchainUpg.dbg.json +1 -1
  19. package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerMainchainUpg.sol/PendleGaugeControllerMainchainUpg.json +2 -2
  20. package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerSidechainUpg.sol/PendleGaugeControllerSidechainUpg.dbg.json +1 -1
  21. package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerSidechainUpg.sol/PendleGaugeControllerSidechainUpg.json +2 -2
  22. package/build/artifacts/contracts/LiquidityMining/VotingController/PendleVotingControllerUpg.sol/PendleVotingControllerUpg.dbg.json +1 -1
  23. package/build/artifacts/contracts/LiquidityMining/VotingController/PendleVotingControllerUpg.sol/PendleVotingControllerUpg.json +2 -2
  24. package/build/artifacts/contracts/LiquidityMining/VotingController/VotingControllerStorageUpg.sol/VotingControllerStorageUpg.dbg.json +1 -1
  25. package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol/VotingEscrowPendleMainchain.dbg.json +1 -1
  26. package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol/VotingEscrowPendleMainchain.json +2 -2
  27. package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowPendleSidechain.sol/VotingEscrowPendleSidechain.dbg.json +1 -1
  28. package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowPendleSidechain.sol/VotingEscrowPendleSidechain.json +2 -2
  29. package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowTokenBase.sol/VotingEscrowTokenBase.dbg.json +1 -1
  30. package/build/artifacts/contracts/LiquidityMining/libraries/VeBalanceLib.sol/VeBalanceLib.dbg.json +1 -1
  31. package/build/artifacts/contracts/LiquidityMining/libraries/VeBalanceLib.sol/VeBalanceLib.json +2 -2
  32. package/build/artifacts/contracts/LiquidityMining/libraries/VeHistoryLib.sol/CheckpointHelper.dbg.json +1 -1
  33. package/build/artifacts/contracts/LiquidityMining/libraries/VeHistoryLib.sol/CheckpointHelper.json +2 -2
  34. package/build/artifacts/contracts/LiquidityMining/libraries/VeHistoryLib.sol/Checkpoints.dbg.json +1 -1
  35. package/build/artifacts/contracts/LiquidityMining/libraries/VeHistoryLib.sol/Checkpoints.json +2 -2
  36. package/build/artifacts/contracts/core/BulkSeller/BulkSeller.sol/BulkSeller.dbg.json +1 -1
  37. package/build/artifacts/contracts/core/BulkSeller/BulkSeller.sol/BulkSeller.json +22 -28
  38. package/build/artifacts/contracts/core/BulkSeller/BulkSellerFactory.sol/BulkSellerFactory.dbg.json +1 -1
  39. package/build/artifacts/contracts/core/BulkSeller/BulkSellerFactory.sol/BulkSellerFactory.json +3 -22
  40. package/build/artifacts/contracts/core/BulkSeller/BulkSellerMathCore.sol/BulkSellerMathCore.dbg.json +1 -1
  41. package/build/artifacts/contracts/core/BulkSeller/BulkSellerMathCore.sol/BulkSellerMathCore.json +2 -2
  42. package/build/artifacts/contracts/core/Market/MarketMathCore.sol/MarketMathCore.dbg.json +1 -1
  43. package/build/artifacts/contracts/core/Market/MarketMathCore.sol/MarketMathCore.json +2 -2
  44. package/build/artifacts/contracts/core/Market/OracleLib.sol/OracleLib.dbg.json +1 -1
  45. package/build/artifacts/contracts/core/Market/OracleLib.sol/OracleLib.json +2 -2
  46. package/build/artifacts/contracts/core/Market/PendleGauge.sol/PendleGauge.dbg.json +1 -1
  47. package/build/artifacts/contracts/core/Market/PendleMarket.sol/PendleMarket.dbg.json +1 -1
  48. package/build/artifacts/contracts/core/Market/PendleMarket.sol/PendleMarket.json +2 -2
  49. package/build/artifacts/contracts/core/Market/PendleMarketFactory.sol/PendleMarketFactory.dbg.json +1 -1
  50. package/build/artifacts/contracts/core/Market/PendleMarketFactory.sol/PendleMarketFactory.json +2 -2
  51. package/build/artifacts/contracts/core/RewardManager/RewardManager.sol/RewardManager.dbg.json +1 -1
  52. package/build/artifacts/contracts/core/RewardManager/RewardManagerAbstract.sol/RewardManagerAbstract.dbg.json +1 -1
  53. package/build/artifacts/contracts/core/StandardizedYield/SYBase.sol/SYBase.dbg.json +1 -1
  54. package/build/artifacts/contracts/core/StandardizedYield/SYBaseWithRewards.sol/SYBaseWithRewards.dbg.json +1 -1
  55. package/build/artifacts/contracts/core/StandardizedYield/implementations/BenQi/PendleQiTokenHelper.sol/PendleQiTokenHelper.dbg.json +1 -1
  56. package/build/artifacts/contracts/core/StandardizedYield/implementations/BenQi/PendleQiTokenHelper.sol/PendleQiTokenHelper.json +2 -2
  57. package/build/artifacts/contracts/core/StandardizedYield/implementations/BenQi/PendleQiTokenSY.sol/PendleQiTokenSY.dbg.json +1 -1
  58. package/build/artifacts/contracts/core/StandardizedYield/implementations/BenQi/PendleQiTokenSY.sol/PendleQiTokenSY.json +2 -2
  59. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/PendleCurveFraxUsdcSY.sol/PendleCurveFraxUsdcSY.dbg.json +1 -1
  60. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/PendleCurveFraxUsdcSY.sol/PendleCurveFraxUsdcSY.json +2 -2
  61. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/PendleCurveUsdd3CrvSY.sol/PendleCurveUsdd3CrvSY.dbg.json +1 -1
  62. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/PendleCurveUsdd3CrvSY.sol/PendleCurveUsdd3CrvSY.json +2 -2
  63. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/Curve3CrvPoolHelper.sol/Curve3CrvPoolHelper.dbg.json +1 -1
  64. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/Curve3CrvPoolHelper.sol/Curve3CrvPoolHelper.json +2 -2
  65. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/CurveFraxUsdcPoolHelper.sol/CurveFraxUsdcPoolHelper.dbg.json +1 -1
  66. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/CurveFraxUsdcPoolHelper.sol/CurveFraxUsdcPoolHelper.json +2 -2
  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/CurveUsdd3CrvPoolHelper.sol/CurveUsdd3CrvPoolHelper.json +2 -2
  69. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/PendleConvexLPSY.sol/PendleConvexLPSY.dbg.json +1 -1
  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 -2
  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 -2
  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/PendleERC20.sol/PendleERC20.json +2 -2
  83. package/build/artifacts/contracts/core/erc20/PendleERC20Permit.sol/PendleERC20Permit.dbg.json +1 -1
  84. package/build/artifacts/contracts/core/erc20/PendleERC20Permit.sol/PendleERC20Permit.json +2 -2
  85. package/build/artifacts/contracts/core/libraries/ArrayLib.sol/ArrayLib.dbg.json +1 -1
  86. package/build/artifacts/contracts/core/libraries/ArrayLib.sol/ArrayLib.json +2 -2
  87. package/build/artifacts/contracts/core/libraries/BoringOwnableUpgradeable.sol/BoringOwnableUpgradeable.dbg.json +1 -1
  88. package/build/artifacts/contracts/core/libraries/BoringOwnableUpgradeable.sol/BoringOwnableUpgradeableData.dbg.json +1 -1
  89. package/build/artifacts/contracts/core/libraries/BoringOwnableUpgradeable.sol/BoringOwnableUpgradeableData.json +2 -2
  90. package/build/artifacts/contracts/core/libraries/Errors.sol/Errors.dbg.json +1 -1
  91. package/build/artifacts/contracts/core/libraries/Errors.sol/Errors.json +2 -18
  92. package/build/artifacts/contracts/core/libraries/MiniHelpers.sol/MiniHelpers.dbg.json +1 -1
  93. package/build/artifacts/contracts/core/libraries/MiniHelpers.sol/MiniHelpers.json +2 -2
  94. package/build/artifacts/contracts/core/libraries/TokenHelper.sol/TokenHelper.dbg.json +1 -1
  95. package/build/artifacts/contracts/interfaces/Curve/ICrvPool.sol/ICrvPool.dbg.json +1 -1
  96. package/build/artifacts/contracts/interfaces/Curve/ITriCrvPool.sol/ITriCrvPool.dbg.json +1 -1
  97. package/build/artifacts/contracts/interfaces/IBoringOwnableUpgradeable.sol/IBoringOwnableUpgradeable.dbg.json +1 -1
  98. package/build/artifacts/contracts/interfaces/ILayerZeroEndpoint.sol/ILayerZeroEndpoint.dbg.json +1 -1
  99. package/build/artifacts/contracts/interfaces/ILayerZeroReceiver.sol/ILayerZeroReceiver.dbg.json +1 -1
  100. package/build/artifacts/contracts/interfaces/IPActionAddRemoveLiq.sol/IPActionAddRemoveLiq.dbg.json +1 -1
  101. package/build/artifacts/contracts/interfaces/IPActionMintRedeem.sol/IPActionMintRedeem.dbg.json +1 -1
  102. package/build/artifacts/contracts/interfaces/IPActionSwapPT.sol/IPActionSwapPT.dbg.json +1 -1
  103. package/build/artifacts/contracts/interfaces/IPActionSwapPTYT.sol/IPActionSwapPTYT.dbg.json +1 -1
  104. package/build/artifacts/contracts/interfaces/IPActionSwapYT.sol/IPActionSwapYT.dbg.json +1 -1
  105. package/build/artifacts/contracts/interfaces/IPAllAction.sol/IPAllAction.dbg.json +1 -1
  106. package/build/artifacts/contracts/interfaces/IPBulkSeller.sol/IPBulkSeller.dbg.json +1 -1
  107. package/build/artifacts/contracts/interfaces/IPBulkSeller.sol/IPBulkSeller.json +187 -1
  108. package/build/artifacts/contracts/interfaces/IPBulkSellerFactory.sol/IPBulkSellerFactory.dbg.json +1 -1
  109. package/build/artifacts/contracts/interfaces/IPBulkSellerFactory.sol/IPBulkSellerFactory.json +0 -19
  110. package/build/artifacts/contracts/interfaces/IPMarket.sol/IPMarket.dbg.json +1 -1
  111. package/build/artifacts/contracts/interfaces/IPMsgReceiverApp.sol/IPMsgReceiverApp.dbg.json +1 -1
  112. package/build/artifacts/contracts/interfaces/IPMsgSendEndpoint.sol/IPMsgSendEndpoint.dbg.json +1 -1
  113. package/build/artifacts/contracts/interfaces/IPVeToken.sol/IPVeToken.dbg.json +1 -1
  114. package/build/artifacts/contracts/interfaces/IPVotingController.sol/IPVotingController.dbg.json +1 -1
  115. package/build/artifacts/contracts/interfaces/IPVotingEscrowMainchain.sol/IPVotingEscrowMainchain.dbg.json +1 -1
  116. package/build/artifacts/contracts/interfaces/IREDACTEDStaking.sol/IREDACTEDStaking.dbg.json +1 -1
  117. package/build/artifacts/contracts/interfaces/IStETH.sol/IStETH.dbg.json +1 -1
  118. package/build/artifacts/contracts/interfaces/IStargateLPStaking.sol/IStargateLPStaking.dbg.json +1 -1
  119. package/build/artifacts/contracts/interfaces/IStargatePool.sol/IStargatePool.dbg.json +1 -1
  120. package/build/artifacts/contracts/interfaces/IStargateRouter.sol/IStargateRouter.dbg.json +1 -1
  121. package/build/artifacts/contracts/interfaces/IWXBTRFLY.sol/IWXBTRFLY.dbg.json +1 -1
  122. package/build/artifacts/contracts/offchain-helpers/BaseSplitCodeFactoryContract.sol/BaseSplitCodeFactoryContract.dbg.json +1 -1
  123. package/build/artifacts/contracts/offchain-helpers/BaseSplitCodeFactoryContract.sol/BaseSplitCodeFactoryContract.json +2 -2
  124. package/build/artifacts/contracts/offchain-helpers/BulkSellerOffchain.sol/BulkSellerOffchain.dbg.json +1 -1
  125. package/build/artifacts/contracts/offchain-helpers/BulkSellerOffchain.sol/BulkSellerOffchain.json +2 -2
  126. package/build/artifacts/contracts/offchain-helpers/MarketMathStatic.sol/MarketMathStatic.dbg.json +1 -1
  127. package/build/artifacts/contracts/offchain-helpers/MarketMathStatic.sol/MarketMathStatic.json +2 -2
  128. package/build/artifacts/contracts/offchain-helpers/RouterStatic.sol/RouterStatic.dbg.json +1 -1
  129. package/build/artifacts/contracts/offchain-helpers/RouterStatic.sol/RouterStatic.json +160 -60
  130. package/build/artifacts/contracts/router/ActionAddRemoveLiq.sol/ActionAddRemoveLiq.dbg.json +1 -1
  131. package/build/artifacts/contracts/router/ActionAddRemoveLiq.sol/ActionAddRemoveLiq.json +2 -2
  132. package/build/artifacts/contracts/router/ActionCallback.sol/ActionCallback.dbg.json +1 -1
  133. package/build/artifacts/contracts/router/ActionCallback.sol/ActionCallback.json +2 -2
  134. package/build/artifacts/contracts/router/ActionMintRedeem.sol/ActionMintRedeem.dbg.json +1 -1
  135. package/build/artifacts/contracts/router/ActionMintRedeem.sol/ActionMintRedeem.json +2 -2
  136. package/build/artifacts/contracts/router/ActionMisc.sol/ActionMisc.dbg.json +1 -1
  137. package/build/artifacts/contracts/router/ActionMisc.sol/ActionMisc.json +2 -2
  138. package/build/artifacts/contracts/router/ActionSwapPT.sol/ActionSwapPT.dbg.json +1 -1
  139. package/build/artifacts/contracts/router/ActionSwapPT.sol/ActionSwapPT.json +2 -2
  140. package/build/artifacts/contracts/router/ActionSwapPTYT.sol/ActionSwapPTYT.dbg.json +1 -1
  141. package/build/artifacts/contracts/router/ActionSwapPTYT.sol/ActionSwapPTYT.json +2 -2
  142. package/build/artifacts/contracts/router/ActionSwapYT.sol/ActionSwapYT.dbg.json +1 -1
  143. package/build/artifacts/contracts/router/ActionSwapYT.sol/ActionSwapYT.json +2 -2
  144. package/build/artifacts/contracts/router/PendleRouter.sol/PendleRouter.dbg.json +1 -1
  145. package/build/artifacts/contracts/router/PendleRouter.sol/PendleRouter.json +2 -2
  146. package/build/artifacts/contracts/router/base/ActionBaseMintRedeem.sol/ActionBaseMintRedeem.dbg.json +1 -1
  147. package/build/artifacts/contracts/router/base/MarketApproxLib.sol/MarketApproxPtInLib.dbg.json +1 -1
  148. package/build/artifacts/contracts/router/base/MarketApproxLib.sol/MarketApproxPtInLib.json +2 -2
  149. package/build/artifacts/contracts/router/base/MarketApproxLib.sol/MarketApproxPtOutLib.dbg.json +1 -1
  150. package/build/artifacts/contracts/router/base/MarketApproxLib.sol/MarketApproxPtOutLib.json +2 -2
  151. package/build/artifacts/contracts/router/kyberswap/AggregationRouterHelper.sol/AggregationRouterHelper.dbg.json +1 -1
  152. package/build/artifacts/contracts/router/kyberswap/AggregationRouterHelper.sol/AggregationRouterHelper.json +2 -2
  153. package/build/artifacts/contracts/router/kyberswap/IAggregatorRouterHelper.sol/IAggregationRouterHelper.dbg.json +1 -1
  154. package/build/artifacts/contracts/router/kyberswap/IMultihopRouter.sol/IMultihopRouter.dbg.json +1 -1
  155. package/build/artifacts/contracts/router/kyberswap/KyberSwapHelper.sol/KyberSwapHelper.dbg.json +1 -1
  156. package/contracts/LiquidityMining/CrossChainMsg/PendleMsgReceiverAppUpg.sol +1 -4
  157. package/contracts/LiquidityMining/CrossChainMsg/PendleMsgSendEndpointUpg.sol +6 -5
  158. package/contracts/LiquidityMining/CrossChainMsg/PendleMsgSenderAppUpg.sol +1 -4
  159. package/contracts/LiquidityMining/CrossChainMsg/libraries/ExcessivelySafeCall.sol +1 -1
  160. package/contracts/LiquidityMining/CrossChainMsg/libraries/LayerZeroHelper.sol +9 -6
  161. package/contracts/LiquidityMining/GaugeController/PendleGaugeControllerBaseUpg.sol +9 -21
  162. package/contracts/LiquidityMining/GaugeController/PendleGaugeControllerMainchainUpg.sol +0 -3
  163. package/contracts/LiquidityMining/GaugeController/PendleGaugeControllerSidechainUpg.sol +0 -3
  164. package/contracts/LiquidityMining/VotingController/PendleVotingControllerUpg.sol +34 -54
  165. package/contracts/LiquidityMining/VotingController/VotingControllerStorageUpg.sol +6 -25
  166. package/contracts/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol +20 -38
  167. package/contracts/LiquidityMining/libraries/VeHistoryLib.sol +1 -1
  168. package/contracts/core/BulkSeller/BulkSeller.sol +35 -42
  169. package/contracts/core/BulkSeller/BulkSellerFactory.sol +5 -9
  170. package/contracts/core/BulkSeller/BulkSellerMathCore.sol +6 -5
  171. package/contracts/core/StandardizedYield/implementations/BenQi/PendleQiTokenSY.sol +1 -3
  172. package/contracts/core/StandardizedYield/implementations/Convex/base/CurveUsdd3CrvPoolHelper.sol +1 -1
  173. package/contracts/core/StandardizedYield/implementations/Convex/base/PendleConvexLPSY.sol +1 -1
  174. package/contracts/core/StandardizedYield/implementations/PendleWstEthSY.sol +1 -1
  175. package/contracts/core/YieldContracts/PendleYieldToken.sol +6 -6
  176. package/contracts/core/erc20/PendleERC20.sol +2 -2
  177. package/contracts/core/erc20/PendleERC20Permit.sol +1 -1
  178. package/contracts/core/libraries/ArrayLib.sol +1 -1
  179. package/contracts/core/libraries/BoringOwnableUpgradeable.sol +1 -1
  180. package/contracts/core/libraries/Errors.sol +0 -1
  181. package/contracts/core/libraries/MiniHelpers.sol +1 -0
  182. package/contracts/core/libraries/TokenHelper.sol +4 -5
  183. package/contracts/interfaces/Curve/ICrvPool.sol +3 -4
  184. package/contracts/interfaces/Curve/ITriCrvPool.sol +1 -4
  185. package/contracts/interfaces/IBoringOwnableUpgradeable.sol +2 -2
  186. package/contracts/interfaces/ILayerZeroEndpoint.sol +1 -1
  187. package/contracts/interfaces/ILayerZeroReceiver.sol +8 -3
  188. package/contracts/interfaces/IPBulkSeller.sol +30 -6
  189. package/contracts/interfaces/IPBulkSellerFactory.sol +0 -2
  190. package/contracts/interfaces/IPMarket.sol +2 -12
  191. package/contracts/interfaces/IPMsgReceiverApp.sol +1 -1
  192. package/contracts/interfaces/IPMsgSendEndpoint.sol +1 -1
  193. package/contracts/interfaces/IPVeToken.sol +1 -1
  194. package/contracts/interfaces/IREDACTEDStaking.sol +1 -1
  195. package/contracts/interfaces/IStETH.sol +1 -1
  196. package/contracts/interfaces/IStargateLPStaking.sol +1 -1
  197. package/contracts/interfaces/IStargatePool.sol +1 -1
  198. package/contracts/interfaces/IStargateRouter.sol +1 -1
  199. package/contracts/interfaces/IWXBTRFLY.sol +1 -1
  200. package/contracts/offchain-helpers/MarketMathStatic.sol +140 -37
  201. package/contracts/offchain-helpers/RouterStatic.sol +48 -27
  202. package/contracts/router/ActionAddRemoveLiq.sol +2 -2
  203. package/contracts/router/ActionMintRedeem.sol +4 -4
  204. package/contracts/router/ActionSwapPT.sol +4 -4
  205. package/contracts/router/ActionSwapPTYT.sol +1 -1
  206. package/contracts/router/ActionSwapYT.sol +8 -8
  207. package/contracts/router/base/ActionBaseMintRedeem.sol +6 -7
  208. package/contracts/router/base/MarketApproxLib.sol +14 -8
  209. package/contracts/router/kyberswap/AggregationRouterHelper.sol +1 -1
  210. package/contracts/router/kyberswap/IAggregatorRouterHelper.sol +1 -1
  211. package/contracts/router/kyberswap/IMultihopRouter.sol +1 -1
  212. package/deployments/43113-core.json +1 -1
  213. package/package.json +1 -1
  214. package/typechain-types/BulkSeller.ts +59 -6
  215. package/typechain-types/BulkSellerFactory.ts +0 -16
  216. package/typechain-types/IApeStaking.ts +274 -0
  217. package/typechain-types/IPBulkSeller.ts +178 -9
  218. package/typechain-types/IPBulkSellerFactory.ts +0 -16
  219. package/typechain-types/PendleApeStakingSY.ts +1251 -0
  220. package/typechain-types/RouterStatic.ts +40 -20
  221. package/typechain-types/SYBaseAutoCompound.ts +1203 -0
  222. package/typechain-types/factories/ActionAddRemoveLiq__factory.ts +1 -1
  223. package/typechain-types/factories/ActionCallback__factory.ts +1 -1
  224. package/typechain-types/factories/ActionMintRedeem__factory.ts +1 -1
  225. package/typechain-types/factories/ActionMisc__factory.ts +1 -1
  226. package/typechain-types/factories/ActionSwapPTYT__factory.ts +1 -1
  227. package/typechain-types/factories/ActionSwapPT__factory.ts +1 -1
  228. package/typechain-types/factories/ActionSwapYT__factory.ts +1 -1
  229. package/typechain-types/factories/AggregationRouterHelper__factory.ts +1 -1
  230. package/typechain-types/factories/BaseSplitCodeFactoryContract__factory.ts +1 -1
  231. package/typechain-types/factories/BoringOwnableUpgradeableData__factory.ts +1 -1
  232. package/typechain-types/factories/BulkSellerFactory__factory.ts +2 -21
  233. package/typechain-types/factories/BulkSellerOffchain__factory.ts +1 -1
  234. package/typechain-types/factories/BulkSeller__factory.ts +21 -27
  235. package/typechain-types/factories/Errors__factory.ts +1 -17
  236. package/typechain-types/factories/IApeStaking__factory.ts +127 -0
  237. package/typechain-types/factories/IPBulkSellerFactory__factory.ts +0 -19
  238. package/typechain-types/factories/IPBulkSeller__factory.ts +187 -1
  239. package/typechain-types/factories/MarketMathStatic__factory.ts +1 -1
  240. package/typechain-types/factories/OracleLib__factory.ts +1 -1
  241. package/typechain-types/factories/PendleApeStakingSY__factory.ts +1065 -0
  242. package/typechain-types/factories/PendleCurveFraxUsdcSY__factory.ts +1 -1
  243. package/typechain-types/factories/PendleCurveUsdd3CrvSY__factory.ts +1 -1
  244. package/typechain-types/factories/PendleERC20Permit__factory.ts +1 -1
  245. package/typechain-types/factories/PendleERC20__factory.ts +1 -1
  246. package/typechain-types/factories/PendleFeeDistributorFactory__factory.ts +1 -1
  247. package/typechain-types/factories/PendleFeeDistributor__factory.ts +1 -1
  248. package/typechain-types/factories/PendleGaugeControllerMainchainUpg__factory.ts +1 -1
  249. package/typechain-types/factories/PendleGaugeControllerSidechainUpg__factory.ts +1 -1
  250. package/typechain-types/factories/PendleLooksStakingSY__factory.ts +1 -1
  251. package/typechain-types/factories/PendleMarketFactory__factory.ts +1 -1
  252. package/typechain-types/factories/PendleMarket__factory.ts +1 -1
  253. package/typechain-types/factories/PendleMsgReceiveEndpointUpg__factory.ts +1 -1
  254. package/typechain-types/factories/PendleMsgSendEndpointUpg__factory.ts +1 -1
  255. package/typechain-types/factories/PendlePrincipalToken__factory.ts +1 -1
  256. package/typechain-types/factories/PendleQiTokenHelper__factory.ts +1 -1
  257. package/typechain-types/factories/PendleQiTokenSY__factory.ts +1 -1
  258. package/typechain-types/factories/PendleRouter__factory.ts +1 -1
  259. package/typechain-types/factories/PendleVotingControllerUpg__factory.ts +1 -1
  260. package/typechain-types/factories/PendleWstEthSY__factory.ts +1 -1
  261. package/typechain-types/factories/PendleYieldContractFactory__factory.ts +1 -1
  262. package/typechain-types/factories/PendleYieldToken__factory.ts +1 -1
  263. package/typechain-types/factories/RouterStatic__factory.ts +101 -1
  264. package/typechain-types/factories/SYBaseAutoCompound__factory.ts +942 -0
  265. package/typechain-types/factories/VotingEscrowPendleMainchain__factory.ts +1 -1
  266. package/typechain-types/factories/VotingEscrowPendleSidechain__factory.ts +1 -1
@@ -158,7 +158,7 @@ contract RouterStatic is Initializable, BoringOwnableUpgradeable, UUPSUpgradeabl
158
158
  sy = address(SY);
159
159
  state = _market.readState(address(this));
160
160
  impliedYield = getPtImpliedYield(market);
161
- exchangeRate = MarketMathStatic.getExchangeRate(market);
161
+ exchangeRate = MarketMathStatic.getTradeExchangeRateExcludeFee(market);
162
162
  }
163
163
 
164
164
  // ============= USER INFO =============
@@ -325,7 +325,8 @@ contract RouterStatic is Initializable, BoringOwnableUpgradeable, UUPSUpgradeabl
325
325
  uint256 netLpOut,
326
326
  uint256 netPtToSwap,
327
327
  uint256 netSyFee,
328
- uint256 priceImpact
328
+ uint256 priceImpact,
329
+ uint256 exchangeRateAfter
329
330
  )
330
331
  {
331
332
  return
@@ -338,7 +339,8 @@ contract RouterStatic is Initializable, BoringOwnableUpgradeable, UUPSUpgradeabl
338
339
  uint256 netLpOut,
339
340
  uint256 netPtFromSwap,
340
341
  uint256 netSyFee,
341
- uint256 priceImpact
342
+ uint256 priceImpact,
343
+ uint256 exchangeRateAfter
342
344
  )
343
345
  {
344
346
  return
@@ -356,7 +358,8 @@ contract RouterStatic is Initializable, BoringOwnableUpgradeable, UUPSUpgradeabl
356
358
  uint256 netLpOut,
357
359
  uint256 netPtFromSwap,
358
360
  uint256 netSyFee,
359
- uint256 priceImpact
361
+ uint256 priceImpact,
362
+ uint256 exchangeRateAfter
360
363
  )
361
364
  {
362
365
  uint256 netSyIn = previewDepositStatic(
@@ -400,7 +403,8 @@ contract RouterStatic is Initializable, BoringOwnableUpgradeable, UUPSUpgradeabl
400
403
  uint256 netPtOut,
401
404
  uint256 netPtFromSwap,
402
405
  uint256 netSyFee,
403
- uint256 priceImpact
406
+ uint256 priceImpact,
407
+ uint256 exchangeRateAfter
404
408
  )
405
409
  {
406
410
  return
@@ -416,7 +420,8 @@ contract RouterStatic is Initializable, BoringOwnableUpgradeable, UUPSUpgradeabl
416
420
  returns (
417
421
  uint256 netSyOut,
418
422
  uint256 netSyFee,
419
- uint256 priceImpact
423
+ uint256 priceImpact,
424
+ uint256 exchangeRateAfter
420
425
  )
421
426
  {
422
427
  return MarketMathStatic.removeLiquiditySingleSyStatic(market, netLpToRemove);
@@ -432,12 +437,13 @@ contract RouterStatic is Initializable, BoringOwnableUpgradeable, UUPSUpgradeabl
432
437
  returns (
433
438
  uint256 netBaseTokenOut,
434
439
  uint256 netSyFee,
435
- uint256 priceImpact
440
+ uint256 priceImpact,
441
+ uint256 exchangeRateAfter
436
442
  )
437
443
  {
438
444
  uint256 netSyOut;
439
445
 
440
- (netSyOut, netSyFee, priceImpact) = MarketMathStatic.removeLiquiditySingleSyStatic(
446
+ (netSyOut, netSyFee, priceImpact, exchangeRateAfter) = MarketMathStatic.removeLiquiditySingleSyStatic(
441
447
  market,
442
448
  netLpToRemove
443
449
  );
@@ -450,7 +456,8 @@ contract RouterStatic is Initializable, BoringOwnableUpgradeable, UUPSUpgradeabl
450
456
  returns (
451
457
  uint256 netSyOut,
452
458
  uint256 netSyFee,
453
- uint256 priceImpact
459
+ uint256 priceImpact,
460
+ uint256 exchangeRateAfter
454
461
  )
455
462
  {
456
463
  return MarketMathStatic.swapExactPtForSyStatic(market, exactPtIn);
@@ -461,7 +468,8 @@ contract RouterStatic is Initializable, BoringOwnableUpgradeable, UUPSUpgradeabl
461
468
  returns (
462
469
  uint256 netSyIn,
463
470
  uint256 netSyFee,
464
- uint256 priceImpact
471
+ uint256 priceImpact,
472
+ uint256 exchangeRateAfter
465
473
  )
466
474
  {
467
475
  return MarketMathStatic.swapSyForExactPtStatic(market, exactPtOut);
@@ -472,7 +480,8 @@ contract RouterStatic is Initializable, BoringOwnableUpgradeable, UUPSUpgradeabl
472
480
  returns (
473
481
  uint256 netPtOut,
474
482
  uint256 netSyFee,
475
- uint256 priceImpact
483
+ uint256 priceImpact,
484
+ uint256 exchangeRateAfter
476
485
  )
477
486
  {
478
487
  return
@@ -484,7 +493,8 @@ contract RouterStatic is Initializable, BoringOwnableUpgradeable, UUPSUpgradeabl
484
493
  returns (
485
494
  uint256 netPtIn,
486
495
  uint256 netSyFee,
487
- uint256 priceImpact
496
+ uint256 priceImpact,
497
+ uint256 exchangeRateAfter
488
498
  )
489
499
  {
490
500
  return
@@ -501,7 +511,8 @@ contract RouterStatic is Initializable, BoringOwnableUpgradeable, UUPSUpgradeabl
501
511
  returns (
502
512
  uint256 netPtOut,
503
513
  uint256 netSyFee,
504
- uint256 priceImpact
514
+ uint256 priceImpact,
515
+ uint256 exchangeRateAfter
505
516
  )
506
517
  {
507
518
  uint256 netSyIn = previewDepositStatic(
@@ -523,11 +534,12 @@ contract RouterStatic is Initializable, BoringOwnableUpgradeable, UUPSUpgradeabl
523
534
  returns (
524
535
  uint256 netBaseTokenOut,
525
536
  uint256 netSyFee,
526
- uint256 priceImpact
537
+ uint256 priceImpact,
538
+ uint256 exchangeRateAfter
527
539
  )
528
540
  {
529
541
  uint256 netSyOut;
530
- (netSyOut, netSyFee, priceImpact) = MarketMathStatic.swapExactPtForSyStatic(
542
+ (netSyOut, netSyFee, priceImpact, exchangeRateAfter) = MarketMathStatic.swapExactPtForSyStatic(
531
543
  market,
532
544
  exactPtIn
533
545
  );
@@ -540,7 +552,8 @@ contract RouterStatic is Initializable, BoringOwnableUpgradeable, UUPSUpgradeabl
540
552
  returns (
541
553
  uint256 netSyIn,
542
554
  uint256 netSyFee,
543
- uint256 priceImpact
555
+ uint256 priceImpact,
556
+ uint256 exchangeRateAfter
544
557
  )
545
558
  {
546
559
  return MarketMathStatic.swapSyForExactYtStatic(market, exactYtOut);
@@ -551,7 +564,9 @@ contract RouterStatic is Initializable, BoringOwnableUpgradeable, UUPSUpgradeabl
551
564
  returns (
552
565
  uint256 netYtOut,
553
566
  uint256 netSyFee,
554
- uint256 priceImpact
567
+ uint256 priceImpact,
568
+ uint256 exchangeRateAfter
569
+
555
570
  )
556
571
  {
557
572
  return
@@ -563,7 +578,9 @@ contract RouterStatic is Initializable, BoringOwnableUpgradeable, UUPSUpgradeabl
563
578
  returns (
564
579
  uint256 netSyOut,
565
580
  uint256 netSyFee,
566
- uint256 priceImpact
581
+ uint256 priceImpact,
582
+ uint256 exchangeRateAfter
583
+
567
584
  )
568
585
  {
569
586
  return MarketMathStatic.swapExactYtForSyStatic(market, exactYtIn);
@@ -574,7 +591,8 @@ contract RouterStatic is Initializable, BoringOwnableUpgradeable, UUPSUpgradeabl
574
591
  returns (
575
592
  uint256 netYtIn,
576
593
  uint256 netSyFee,
577
- uint256 priceImpact
594
+ uint256 priceImpact,
595
+ uint256 exchangeRateAfter
578
596
  )
579
597
  {
580
598
  return
@@ -591,11 +609,12 @@ contract RouterStatic is Initializable, BoringOwnableUpgradeable, UUPSUpgradeabl
591
609
  returns (
592
610
  uint256 netBaseTokenOut,
593
611
  uint256 netSyFee,
594
- uint256 priceImpact
612
+ uint256 priceImpact,
613
+ uint256 exchangeRateAfter
595
614
  )
596
615
  {
597
616
  uint256 netSyOut;
598
- (netSyOut, netSyFee, priceImpact) = MarketMathStatic.swapExactYtForSyStatic(
617
+ (netSyOut, netSyFee, priceImpact, exchangeRateAfter) = MarketMathStatic.swapExactYtForSyStatic(
599
618
  market,
600
619
  exactYtIn
601
620
  );
@@ -613,7 +632,8 @@ contract RouterStatic is Initializable, BoringOwnableUpgradeable, UUPSUpgradeabl
613
632
  returns (
614
633
  uint256 netYtOut,
615
634
  uint256 netSyFee,
616
- uint256 priceImpact
635
+ uint256 priceImpact,
636
+ uint256 exchangeRateAfter
617
637
  )
618
638
  {
619
639
  uint256 netSyIn = previewDepositStatic(
@@ -632,7 +652,8 @@ contract RouterStatic is Initializable, BoringOwnableUpgradeable, UUPSUpgradeabl
632
652
  uint256 netYtOut,
633
653
  uint256 totalPtToSwap,
634
654
  uint256 netSyFee,
635
- uint256 priceImpact
655
+ uint256 priceImpact,
656
+ uint256 exchangeRateAfter
636
657
  )
637
658
  {
638
659
  return MarketMathStatic.swapExactPtForYt(market, exactPtIn, getDefaultApproxParams());
@@ -644,7 +665,8 @@ contract RouterStatic is Initializable, BoringOwnableUpgradeable, UUPSUpgradeabl
644
665
  uint256 netPtOut,
645
666
  uint256 totalPtSwapped,
646
667
  uint256 netSyFee,
647
- uint256 priceImpact
668
+ uint256 priceImpact,
669
+ uint256 exchangeRateAfter
648
670
  )
649
671
  {
650
672
  return MarketMathStatic.swapExactYtForPt(market, exactYtIn, getDefaultApproxParams());
@@ -778,7 +800,7 @@ contract RouterStatic is Initializable, BoringOwnableUpgradeable, UUPSUpgradeabl
778
800
  public
779
801
  returns (uint256 priceImpact)
780
802
  {
781
- return MarketMathStatic.calcPriceImpact(market, netPtOut);
803
+ return MarketMathStatic.calcPriceImpactPt(market, netPtOut);
782
804
  }
783
805
 
784
806
  // either but not both pyToken or market must be != 0
@@ -803,7 +825,7 @@ contract RouterStatic is Initializable, BoringOwnableUpgradeable, UUPSUpgradeabl
803
825
  address bulk,
804
826
  uint256 netSyOut
805
827
  ) public view returns (uint256 netTokenIn) {
806
- uint256 pivotAmount = netSyOut;
828
+ uint256 pivotAmount = 10 ** IERC20Metadata(tokenIn).decimals();
807
829
 
808
830
  uint256 low = pivotAmount;
809
831
  {
@@ -885,7 +907,6 @@ contract RouterStatic is Initializable, BoringOwnableUpgradeable, UUPSUpgradeabl
885
907
  return (address(0), 0, 0);
886
908
  }
887
909
 
888
-
889
910
  // Liquidity check
890
911
  uint256 postFeeRateTokenToSy = state.rateTokenToSy.mulDown(Math.ONE - state.feeRate);
891
912
  uint256 postFeeRateSyToToken = state.rateSyToToken.mulDown(Math.ONE - state.feeRate);
@@ -76,7 +76,7 @@ contract ActionAddRemoveLiq is IPActionAddRemoveLiq, ActionBaseMintRedeem {
76
76
 
77
77
  /**
78
78
  * @notice Adds liquidity to SY/PT market using PT + any token.
79
- * @dev Input token is first swapped to SY-mintable token using Kyber, then SY is minted from
79
+ * @dev Input token is first swapped to SY-mintable token using Kyber, then SY is minted from
80
80
  * such. Finally the SY/PT pair is added to the market
81
81
  * @param input data for input token, see {`./kyberswap/KyberSwapHelper.sol`}
82
82
  * @param netPtDesired maximum PT to be used
@@ -218,7 +218,7 @@ contract ActionAddRemoveLiq is IPActionAddRemoveLiq, ActionBaseMintRedeem {
218
218
  }
219
219
 
220
220
  /**
221
- * @notice Adds liquidity using a single token input. The input token is first swapped through
221
+ * @notice Adds liquidity using a single token input. The input token is first swapped through
222
222
  * Kyberswap to a SY-mintable token, the rest is the same as `addLiquiditySingleSy()`
223
223
  * @param guessPtReceivedFromSy approximate PT output for the SY-to-PT swap
224
224
  * @param input data for input token, see {`./kyberswap/KyberSwapHelper.sol`}
@@ -31,7 +31,7 @@ contract ActionMintRedeem is IPActionMintRedeem, ActionBaseMintRedeem {
31
31
  }
32
32
 
33
33
  /**
34
- * @notice redeems SY for SY-mintable tokens, then (if needed) swaps resulting tokens for
34
+ * @notice redeems SY for SY-mintable tokens, then (if needed) swaps resulting tokens for
35
35
  * desired output token through Kyberswap
36
36
  * @param output data for desired output token, see {`./kyberswap/KyberSwapHelper.sol`}
37
37
  */
@@ -47,7 +47,7 @@ contract ActionMintRedeem is IPActionMintRedeem, ActionBaseMintRedeem {
47
47
 
48
48
  /**
49
49
  * @notice mints PY from any input token
50
- * @dev swaps input token through Kyberswap to SY-mintable tokens first, then mints SY, finally
50
+ * @dev swaps input token through Kyberswap to SY-mintable tokens first, then mints SY, finally
51
51
  * mints PY from SY
52
52
  * @param input data for input token, see {`./kyberswap/KyberSwapHelper.sol`}
53
53
  * @dev reverts if PY is expired
@@ -68,7 +68,7 @@ contract ActionMintRedeem is IPActionMintRedeem, ActionBaseMintRedeem {
68
68
 
69
69
  /**
70
70
  * @notice redeems PY for token
71
- * @dev redeems PT(+YT) for SY first, then redeems SY, finally swaps resulting tokens to output
71
+ * @dev redeems PT(+YT) for SY first, then redeems SY, finally swaps resulting tokens to output
72
72
  * token through Kyberswap (if needed)
73
73
  * @param output data for desired output token, see {`./kyberswap/KyberSwapHelper.sol`}
74
74
  */
@@ -166,7 +166,7 @@ contract ActionMintRedeem is IPActionMintRedeem, ActionBaseMintRedeem {
166
166
  uint256[] amounts;
167
167
  }
168
168
 
169
- /**
169
+ /**
170
170
  * @notice A function to:
171
171
  - Redeem all of caller's due interest and rewards in SYs, YTs, and markets
172
172
  - Redeem SYs themselves
@@ -48,8 +48,8 @@ contract ActionSwapPT is IPActionSwapPT, ActionBaseMintRedeem {
48
48
  * @param exactSyOut will consume as little PT as possible for this much SY amount
49
49
  * @return netPtIn amount of PT used, will not be more than `maxPtIn`
50
50
  * @return netSyFee amount SY fee incurred
51
- * @dev the SY output might be slightly more than `exactSyOut` since an approximation is used.
52
- * It is guaranteed that exactSyOut <= actualSyOut <= exactSyOut*(100% + guessPtIn.eps)
51
+ * @dev the SY output might be slightly more than `exactSyOut` since an approximation is used.
52
+ * It is guaranteed that exactSyOut <= actualSyOut <= exactSyOut*(100% + guessPtIn.eps)
53
53
  */
54
54
  function swapPtForExactSy(
55
55
  address receiver,
@@ -140,7 +140,7 @@ contract ActionSwapPT is IPActionSwapPT, ActionBaseMintRedeem {
140
140
  }
141
141
 
142
142
  /**
143
- * @notice swap (through Kyberswap) from any input token for SY-mintable tokens, then mints SY
143
+ * @notice swap (through Kyberswap) from any input token for SY-mintable tokens, then mints SY
144
144
  * and swaps said SY for PT
145
145
  * @param input data for input token, see {`./kyberswap/KyberSwapHelper.sol`}
146
146
  * @dev is a combination of `_mintSyFromToken()` and `_swapExactSyForPt()`
@@ -178,7 +178,7 @@ contract ActionSwapPT is IPActionSwapPT, ActionBaseMintRedeem {
178
178
  }
179
179
 
180
180
  /**
181
- * @notice swap from exact amount of PT to SY, then redeem SY for assets, finally swaps
181
+ * @notice swap from exact amount of PT to SY, then redeem SY for assets, finally swaps
182
182
  * resulting assets through Kyberswap to get desired output token
183
183
  * @param exactPtIn will always consume this much PT for as much SY as possible
184
184
  * @param output data for desired output token, see {`./kyberswap/KyberSwapHelper.sol`}
@@ -69,7 +69,7 @@ contract ActionSwapPTYT is IPActionSwapPTYT, CallbackHelper, TokenHelper {
69
69
  - `exactYtIn` YT is transferred to yield contract
70
70
  - `market.swapSyForExactPt` is called, which will transfer PT directly to this contract & callback is invoked.
71
71
  Note that we now owe SY
72
- - in callback, a portion of PT + YT is used to redeem SY, which is then used to payback the loan. The rest of
72
+ - in callback, a portion of PT + YT is used to redeem SY, which is then used to payback the loan. The rest of
73
73
  of the PT is transferred to `receiver`
74
74
  * @param exactYtIn will always consume this amount of YT for as much PT as possible
75
75
  * @param guessTotalPtFromSwap approximation data for PT output of the SY-to-PT flashswap
@@ -25,9 +25,9 @@ contract ActionSwapYT is IPActionSwapYT, ActionBaseMintRedeem, CallbackHelper {
25
25
  * @notice swap exact SY to YT with the help of flashswaps & YT tokenization / redemption
26
26
  * @dev inner working of this function:
27
27
  - `exactSyIn` SY is transferred to YT contract
28
- - `market.swapExactPtForSy` is called, which will transfer more SY directly to YT contract &
28
+ - `market.swapExactPtForSy` is called, which will transfer more SY directly to YT contract &
29
29
  callback is invoked. Note that now we owe PT
30
- - in callback, all SY in YT contract is used to mint PT + YT, with all PT used to pay back the
30
+ - in callback, all SY in YT contract is used to mint PT + YT, with all PT used to pay back the
31
31
  loan, and all YT transferred to the receiver
32
32
  * @param exactSyIn will always consume this amount of SY for as much YT as possible
33
33
  * @param guessYtOut approximation data for total YT output
@@ -60,9 +60,9 @@ contract ActionSwapYT is IPActionSwapYT, ActionBaseMintRedeem, CallbackHelper {
60
60
  * @notice swap exact YT to SY with the help of flashswaps & YT tokenization / redemption
61
61
  * @dev inner working of this function:
62
62
  - `exactYtIn` YT is transferred to YT contract
63
- - `market.swapSyForExactPt` is called, which will transfer PT directly to YT contract &
63
+ - `market.swapSyForExactPt` is called, which will transfer PT directly to YT contract &
64
64
  callback is invoked. Note that now we owe SY.
65
- - In callback, all PT + YT in YT contract is used to redeem SY. A portion of SY is used to
65
+ - In callback, all PT + YT in YT contract is used to redeem SY. A portion of SY is used to
66
66
  payback the loan, the rest is transferred to the `receiver`
67
67
  * @param exactYtIn will consume exactly this much YT for as much SY as possible
68
68
  * @dev this function works in conjunction with ActionCallback
@@ -85,9 +85,9 @@ contract ActionSwapYT is IPActionSwapYT, ActionBaseMintRedeem, CallbackHelper {
85
85
  /**
86
86
  * @notice swap SY to exact YT with the help of flashswaps & YT tokenization / redemption
87
87
  * @dev inner working of this function:
88
- - `market.swapExactPtForSy` is called, which will transfer SY directly to YT contract &
88
+ - `market.swapExactPtForSy` is called, which will transfer SY directly to YT contract &
89
89
  callback is invoked. Note that now we owe PT
90
- - In callback, we will pull in more SY as needed from caller & mint all SY to PT + YT. PT is
90
+ - In callback, we will pull in more SY as needed from caller & mint all SY to PT + YT. PT is
91
91
  then used to payback the loan, while YT is transferred to `receiver`
92
92
  * @param exactYtOut will output exactly this amount of YT, no approximation is used
93
93
  * @dev this function works in conjunction with ActionCallback
@@ -118,9 +118,9 @@ contract ActionSwapYT is IPActionSwapYT, ActionBaseMintRedeem, CallbackHelper {
118
118
  * @dev inner working of this function:
119
119
  - Approximates `netYtIn` using the data from `guessYtIn`
120
120
  - Pulls `netYtIn` amount of YT from caller
121
- - `market.swapSyForExactPt` is called, which will transfer PT directly to YT contract &
121
+ - `market.swapSyForExactPt` is called, which will transfer PT directly to YT contract &
122
122
  callback is invoked. Note that now we owe SY
123
- - In callback, we will redeem all PT + YT to get SY. A portion of it is used to payback the
123
+ - In callback, we will redeem all PT + YT to get SY. A portion of it is used to payback the
124
124
  loan. The rest is transferred to `receiver`
125
125
  * @dev this function works in conjunction with ActionCallback
126
126
  */
@@ -34,19 +34,17 @@ abstract contract ActionBaseMintRedeem is TokenHelper, KyberSwapHelper {
34
34
  netTokenMintSy = input.netTokenIn;
35
35
  }
36
36
 
37
- if (input.bulk != address(0)) {
38
- _transferOut(input.tokenMintSy, input.bulk, netTokenMintSy);
37
+ uint256 netNative = input.tokenMintSy == NATIVE ? netTokenMintSy : 0;
39
38
 
40
- netSyOut = IPBulkSeller(input.bulk).swapExactTokenForSy(
39
+ if (input.bulk != address(0)) {
40
+ _safeApproveInf(input.tokenMintSy, input.bulk);
41
+ netSyOut = IPBulkSeller(input.bulk).swapExactTokenForSy{ value: netNative }(
41
42
  receiver,
42
43
  netTokenMintSy,
43
44
  minSyOut
44
45
  );
45
46
  } else {
46
- uint256 netNative = input.tokenMintSy == NATIVE ? netTokenMintSy : 0;
47
-
48
47
  _safeApproveInf(input.tokenMintSy, SY);
49
-
50
48
  netSyOut = IStandardizedYield(SY).deposit{ value: netNative }(
51
49
  receiver,
52
50
  input.tokenMintSy,
@@ -75,7 +73,8 @@ abstract contract ActionBaseMintRedeem is TokenHelper, KyberSwapHelper {
75
73
  netTokenRedeemed = IPBulkSeller(output.bulk).swapExactSyForToken(
76
74
  receiverRedeemSy,
77
75
  netSyIn,
78
- 0
76
+ 0,
77
+ true
79
78
  );
80
79
  } else {
81
80
  netTokenRedeemed = IStandardizedYield(SY).redeem(
@@ -113,7 +113,7 @@ library MarketApproxPtInLib {
113
113
  - Flashswap the corresponding amount of SY out
114
114
  - Pair those amount with exactSyIn SY to tokenize into PT & YT
115
115
  - PT to repay the flashswap, YT transferred to user
116
- - Stop when PT to repay the flashswap greater approx the amount of PT owed
116
+ - Stop when the amount of SY to be pulled to tokenize PT to repay loan approx the exactSyIn
117
117
  - guess & approx is for netYtOut (also netPtIn)
118
118
  */
119
119
  function approxSwapExactSyForYt(
@@ -149,11 +149,14 @@ library MarketApproxPtInLib {
149
149
 
150
150
  (uint256 netSyOut, uint256 netSyFee, ) = calcSyOut(a.market, comp, a.index, guess);
151
151
 
152
- uint256 maxPtPayable = a.index.syToAsset(netSyOut + a.exactSyIn);
152
+ uint256 netSyToTokenizePt = a.index.assetToSyUp(guess);
153
153
 
154
- if (guess <= maxPtPayable) {
154
+ // for sure netSyToTokenizePt >= netSyOut since we are swapping PT to SY
155
+ uint256 netSyToPull = netSyToTokenizePt - netSyOut;
156
+
157
+ if (netSyToPull <= a.exactSyIn) {
155
158
  p.guessMin = guess;
156
- bool isAnswerAccepted = Math.isASmallerApproxB(guess, maxPtPayable, p.eps);
159
+ bool isAnswerAccepted = Math.isASmallerApproxB(netSyToPull, a.exactSyIn, p.eps);
157
160
  if (isAnswerAccepted) return (guess, netSyFee);
158
161
  } else {
159
162
  p.guessMax = guess - 1;
@@ -262,7 +265,7 @@ library MarketApproxPtInLib {
262
265
  - Flashswap the corresponding amount of SY out
263
266
  - Tokenize all the SY into PT + YT
264
267
  - PT to repay the flashswap, YT transferred to user
265
- - Stop when the amount of PT owed is smaller approx the amount of PT to repay the flashswap
268
+ - Stop when the additional amount of PT to pull to repay the loan approx the exactPtIn
266
269
  - guess & approx is for totalPtToSwap
267
270
  */
268
271
  function approxSwapExactPtForYt(
@@ -301,10 +304,12 @@ library MarketApproxPtInLib {
301
304
 
302
305
  uint256 netAssetOut = a.index.syToAsset(netSyOut);
303
306
 
304
- uint256 maxPtPayable = netAssetOut + a.exactPtIn;
305
- if (guess <= maxPtPayable) {
307
+ // guess >= netAssetOut since we are swapping PT to SY
308
+ uint256 netPtToPull = guess - netAssetOut;
309
+
310
+ if (netPtToPull <= a.exactPtIn) {
306
311
  p.guessMin = guess;
307
- if (Math.isASmallerApproxB(guess, maxPtPayable, p.eps)) {
312
+ if (Math.isASmallerApproxB(netPtToPull, a.exactPtIn, p.eps)) {
308
313
  return (netAssetOut, guess, netSyFee);
309
314
  }
310
315
  } else {
@@ -676,6 +681,7 @@ library MarketApproxPtOutLib {
676
681
 
677
682
  if (netSyOwed <= a.maxSyPayable) {
678
683
  p.guessMin = guess;
684
+
679
685
  if (Math.isASmallerApproxB(netSyOwed, a.maxSyPayable, p.eps)) {
680
686
  return (guess - a.exactYtIn, guess, netSyFee);
681
687
  }
@@ -1,4 +1,4 @@
1
- // SPDX-License-Identifier: MIT
1
+ // SPDX-License-Identifier: GPL-3.0-or-later
2
2
 
3
3
  pragma solidity 0.8.17;
4
4
  import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
@@ -1,4 +1,4 @@
1
- // SPDX-License-Identifier: MIT
1
+ // SPDX-License-Identifier: GPL-3.0-or-later
2
2
 
3
3
  pragma solidity 0.8.17;
4
4
 
@@ -1,4 +1,4 @@
1
- // SPDX-License-Identifier: MIT
1
+ // SPDX-License-Identifier: GPL-3.0-or-later
2
2
 
3
3
  pragma solidity >=0.7.6;
4
4
 
@@ -15,7 +15,7 @@
15
15
  "bulkSellerFactory": "0x137404E334a80fa741AD03d8965ee4b5b8A20259",
16
16
  "bulkSellerOffchain": "0x85C369B1aD9A981DCf4Fd8F00F74cB783cacec34",
17
17
  "router": "0x17ae363f142517b593d9A71282BAb8CA6bb4eA51",
18
- "routerStatic": "0x2F308CaE3A9e6018A571958656cC4Fd0B954144F",
18
+ "routerStatic": "0xBf98D54D05907f3F576602e8Be7fEaF8891c787F",
19
19
  "vePendle": "0xB20E3c268C993BC3c9Bc1C1cc5D7491F2268cD91",
20
20
  "senderEndpoint": "0x86bD575c36e236386284C035ffeBE66CB6ecd2DD",
21
21
  "votingController": "0x40ea97a7E9A4A0520229d1bbdf4D82E36b1a5475",
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@pendle/core-v2",
3
3
  "description": "Core smart contracts of Pendle Protocol.",
4
4
  "license": "BUSL-1.1",
5
- "version": "0.17.5-testnet",
5
+ "version": "0.17.6-testnet",
6
6
  "homepage": "https://pendle.finance",
7
7
  "keywords": [
8
8
  "pendle",