@pendle/core-v2 0.16.6-testnet → 0.17.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 (321) hide show
  1. package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/PendleMsgReceiveEndpointUpg.sol/PendleMsgReceiveEndpointUpg.dbg.json +1 -1
  2. package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/PendleMsgReceiveEndpointUpg.sol/PendleMsgReceiveEndpointUpg.json +2 -2
  3. package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/PendleMsgReceiverAppUpg.sol/PendleMsgReceiverAppUpg.dbg.json +1 -1
  4. package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/PendleMsgSendEndpointUpg.sol/PendleMsgSendEndpointUpg.dbg.json +1 -1
  5. package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/PendleMsgSendEndpointUpg.sol/PendleMsgSendEndpointUpg.json +2 -2
  6. package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/PendleMsgSenderAppUpg.sol/PendleMsgSenderAppUpg.dbg.json +1 -1
  7. package/build/artifacts/contracts/LiquidityMining/FeeDistributor/EpochResultManager.sol/EpochResultManager.dbg.json +1 -1
  8. package/build/artifacts/contracts/LiquidityMining/FeeDistributor/PendleFeeDistributor.sol/PendleFeeDistributor.dbg.json +1 -1
  9. package/build/artifacts/contracts/LiquidityMining/FeeDistributor/PendleFeeDistributor.sol/PendleFeeDistributor.json +2 -2
  10. package/build/artifacts/contracts/LiquidityMining/FeeDistributor/PendleFeeDistributorFactory.sol/PendleFeeDistributorFactory.dbg.json +1 -1
  11. package/build/artifacts/contracts/LiquidityMining/FeeDistributor/PendleFeeDistributorFactory.sol/PendleFeeDistributorFactory.json +2 -2
  12. package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerBaseUpg.sol/PendleGaugeControllerBaseUpg.dbg.json +1 -1
  13. package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerMainchainUpg.sol/PendleGaugeControllerMainchainUpg.dbg.json +1 -1
  14. package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerMainchainUpg.sol/PendleGaugeControllerMainchainUpg.json +2 -2
  15. package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerSidechainUpg.sol/PendleGaugeControllerSidechainUpg.dbg.json +1 -1
  16. package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerSidechainUpg.sol/PendleGaugeControllerSidechainUpg.json +2 -2
  17. package/build/artifacts/contracts/LiquidityMining/VotingController/PendleVotingControllerUpg.sol/PendleVotingControllerUpg.dbg.json +1 -1
  18. package/build/artifacts/contracts/LiquidityMining/VotingController/PendleVotingControllerUpg.sol/PendleVotingControllerUpg.json +2 -2
  19. package/build/artifacts/contracts/LiquidityMining/VotingController/VotingControllerStorageUpg.sol/VotingControllerStorageUpg.dbg.json +1 -1
  20. package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol/VotingEscrowPendleMainchain.dbg.json +1 -1
  21. package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol/VotingEscrowPendleMainchain.json +2 -2
  22. package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowPendleSidechain.sol/VotingEscrowPendleSidechain.dbg.json +1 -1
  23. package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowPendleSidechain.sol/VotingEscrowPendleSidechain.json +16 -5
  24. package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowTokenBase.sol/VotingEscrowTokenBase.dbg.json +1 -1
  25. package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowTokenBase.sol/VotingEscrowTokenBase.json +0 -13
  26. package/build/artifacts/contracts/LiquidityMining/libraries/VeBalanceLib.sol/VeBalanceLib.dbg.json +1 -1
  27. package/build/artifacts/contracts/LiquidityMining/libraries/VeBalanceLib.sol/VeBalanceLib.json +2 -2
  28. package/build/artifacts/contracts/LiquidityMining/libraries/VeHistoryLib.sol/CheckpointHelper.dbg.json +1 -1
  29. package/build/artifacts/contracts/LiquidityMining/libraries/VeHistoryLib.sol/CheckpointHelper.json +2 -2
  30. package/build/artifacts/contracts/LiquidityMining/libraries/VeHistoryLib.sol/Checkpoints.dbg.json +1 -1
  31. package/build/artifacts/contracts/LiquidityMining/libraries/VeHistoryLib.sol/Checkpoints.json +2 -2
  32. package/build/artifacts/contracts/core/BulkSeller/BulkSeller.sol/BulkSeller.dbg.json +1 -1
  33. package/build/artifacts/contracts/core/BulkSeller/BulkSeller.sol/BulkSeller.json +2 -15
  34. package/build/artifacts/contracts/core/BulkSeller/BulkSellerFactory.sol/BulkSellerFactory.dbg.json +1 -1
  35. package/build/artifacts/contracts/core/BulkSeller/BulkSellerFactory.sol/BulkSellerFactory.json +2 -2
  36. package/build/artifacts/contracts/core/BulkSeller/BulkSellerMathCore.sol/BulkSellerMathCore.dbg.json +1 -1
  37. package/build/artifacts/contracts/core/BulkSeller/BulkSellerMathCore.sol/BulkSellerMathCore.json +2 -2
  38. package/build/artifacts/contracts/core/Market/MarketMathCore.sol/MarketMathCore.dbg.json +1 -1
  39. package/build/artifacts/contracts/core/Market/MarketMathCore.sol/MarketMathCore.json +2 -2
  40. package/build/artifacts/contracts/core/Market/OracleLib.sol/OracleLib.dbg.json +1 -1
  41. package/build/artifacts/contracts/core/Market/OracleLib.sol/OracleLib.json +2 -2
  42. package/build/artifacts/contracts/core/Market/PendleGauge.sol/PendleGauge.dbg.json +1 -1
  43. package/build/artifacts/contracts/core/Market/PendleMarket.sol/PendleMarket.dbg.json +1 -1
  44. package/build/artifacts/contracts/core/Market/PendleMarket.sol/PendleMarket.json +25 -13
  45. package/build/artifacts/contracts/core/Market/PendleMarketFactory.sol/PendleMarketFactory.dbg.json +1 -1
  46. package/build/artifacts/contracts/core/Market/PendleMarketFactory.sol/PendleMarketFactory.json +221 -50
  47. package/build/artifacts/contracts/core/StandardizedYield/PYIndex.sol/PYIndexLib.dbg.json +1 -1
  48. package/build/artifacts/contracts/core/StandardizedYield/PYIndex.sol/PYIndexLib.json +2 -2
  49. package/build/artifacts/contracts/core/StandardizedYield/SYBase.sol/SYBase.dbg.json +1 -1
  50. package/build/artifacts/contracts/core/StandardizedYield/SYBase.sol/SYBase.json +141 -0
  51. package/build/artifacts/contracts/core/StandardizedYield/SYBaseWithRewards.sol/SYBaseWithRewards.dbg.json +1 -1
  52. package/build/artifacts/contracts/core/StandardizedYield/SYBaseWithRewards.sol/SYBaseWithRewards.json +141 -0
  53. package/build/artifacts/contracts/core/StandardizedYield/implementations/BenQi/PendleQiTokenHelper.sol/PendleQiTokenHelper.dbg.json +1 -1
  54. package/build/artifacts/contracts/core/StandardizedYield/implementations/BenQi/PendleQiTokenHelper.sol/PendleQiTokenHelper.json +2 -2
  55. package/build/artifacts/contracts/core/StandardizedYield/implementations/BenQi/PendleQiTokenSY.sol/PendleQiTokenSY.dbg.json +1 -1
  56. package/build/artifacts/contracts/core/StandardizedYield/implementations/BenQi/PendleQiTokenSY.sol/PendleQiTokenSY.json +143 -2
  57. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/PendleCurveFraxUsdcSY.sol/PendleCurveFraxUsdcSY.dbg.json +4 -0
  58. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/PendleCurveFraxUsdcSY.sol/PendleCurveFraxUsdcSY.json +1144 -0
  59. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/PendleCurveUsdd3CrvSY.sol/PendleCurveUsdd3CrvSY.dbg.json +4 -0
  60. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/PendleCurveUsdd3CrvSY.sol/PendleCurveUsdd3CrvSY.json +1209 -0
  61. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/Curve3CrvPoolHelper.sol/Curve3CrvPoolHelper.dbg.json +4 -0
  62. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/Curve3CrvPoolHelper.sol/Curve3CrvPoolHelper.json +10 -0
  63. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/CurveFraxUsdcPoolHelper.sol/CurveFraxUsdcPoolHelper.dbg.json +1 -1
  64. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/CurveFraxUsdcPoolHelper.sol/CurveFraxUsdcPoolHelper.json +3 -82
  65. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/CurveUsdd3CrvPoolHelper.sol/CurveUsdd3CrvPoolHelper.dbg.json +4 -0
  66. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/CurveUsdd3CrvPoolHelper.sol/CurveUsdd3CrvPoolHelper.json +10 -0
  67. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/PendleConvexLPSY.sol/PendleConvexLPSY.dbg.json +4 -0
  68. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/{ConvexCurveLP → base}/PendleConvexLPSY.sol/PendleConvexLPSY.json +142 -1
  69. package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleLooksStakingSY.sol/PendleLooksStakingSY.dbg.json +4 -0
  70. package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleLooksStakingSY.sol/PendleLooksStakingSY.json +997 -0
  71. package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleWstEthSY.sol/PendleWstEthSY.dbg.json +1 -1
  72. package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleWstEthSY.sol/PendleWstEthSY.json +143 -2
  73. package/build/artifacts/contracts/core/YieldContracts/InterestManagerYT.sol/InterestManagerYT.dbg.json +1 -1
  74. package/build/artifacts/contracts/core/YieldContracts/PendlePrincipalToken.sol/PendlePrincipalToken.dbg.json +1 -1
  75. package/build/artifacts/contracts/core/YieldContracts/PendlePrincipalToken.sol/PendlePrincipalToken.json +2 -2
  76. package/build/artifacts/contracts/core/YieldContracts/PendleYieldContractFactory.sol/PendleYieldContractFactory.dbg.json +1 -1
  77. package/build/artifacts/contracts/core/YieldContracts/PendleYieldContractFactory.sol/PendleYieldContractFactory.json +83 -10
  78. package/build/artifacts/contracts/core/YieldContracts/PendleYieldToken.sol/PendleYieldToken.dbg.json +1 -1
  79. package/build/artifacts/contracts/core/YieldContracts/PendleYieldToken.sol/PendleYieldToken.json +35 -4
  80. package/build/artifacts/contracts/core/erc20/PendleERC20.sol/PendleERC20.dbg.json +1 -1
  81. package/build/artifacts/contracts/core/erc20/PendleERC20.sol/PendleERC20.json +2 -2
  82. package/build/artifacts/contracts/core/erc20/PendleERC20Permit.sol/PendleERC20Permit.dbg.json +1 -1
  83. package/build/artifacts/contracts/core/erc20/PendleERC20Permit.sol/PendleERC20Permit.json +2 -2
  84. package/build/artifacts/contracts/core/libraries/BaseSplitCodeFactory.sol/BaseSplitCodeFactory.dbg.json +1 -1
  85. package/build/artifacts/contracts/core/libraries/BaseSplitCodeFactory.sol/BaseSplitCodeFactory.json +3 -38
  86. package/build/artifacts/contracts/core/libraries/BaseSplitCodeFactory.sol/CodeDeployer.dbg.json +1 -1
  87. package/build/artifacts/contracts/core/libraries/BaseSplitCodeFactory.sol/CodeDeployer.json +2 -2
  88. package/build/artifacts/contracts/core/libraries/BoringOwnableUpgradeable.sol/BoringOwnableUpgradeable.dbg.json +1 -1
  89. package/build/artifacts/contracts/core/libraries/BoringOwnableUpgradeable.sol/BoringOwnableUpgradeableData.dbg.json +1 -1
  90. package/build/artifacts/contracts/core/libraries/BoringOwnableUpgradeable.sol/BoringOwnableUpgradeableData.json +2 -2
  91. package/build/artifacts/contracts/core/libraries/Errors.sol/Errors.dbg.json +1 -1
  92. package/build/artifacts/contracts/core/libraries/Errors.sol/Errors.json +105 -31
  93. package/build/artifacts/contracts/interfaces/ConvexCurve/IBooster.sol/IBooster.dbg.json +1 -1
  94. package/build/artifacts/contracts/interfaces/ConvexCurve/IBooster.sol/IBooster.json +1 -1
  95. package/build/artifacts/contracts/interfaces/Curve/ICrvPool.sol/ICrvPool.dbg.json +1 -1
  96. package/build/artifacts/contracts/interfaces/Curve/ICrvPool.sol/ICrvPool.json +14 -7
  97. package/build/artifacts/contracts/interfaces/Curve/ITriCrvPool.sol/ITriCrvPool.dbg.json +4 -0
  98. package/build/artifacts/contracts/interfaces/Curve/ITriCrvPool.sol/ITriCrvPool.json +213 -0
  99. package/build/artifacts/contracts/interfaces/IERC4626.sol/IERC4626.dbg.json +1 -1
  100. package/build/artifacts/contracts/interfaces/IERC4626.sol/IERC4626.json +1 -1
  101. package/build/artifacts/contracts/interfaces/ILooksFeeSharing.sol/ILooksFeeSharing.dbg.json +4 -0
  102. package/build/artifacts/contracts/interfaces/ILooksFeeSharing.sol/ILooksFeeSharing.json +30 -0
  103. package/build/artifacts/contracts/interfaces/ILooksStaking.sol/ILooksStaking.dbg.json +4 -0
  104. package/build/artifacts/contracts/interfaces/ILooksStaking.sol/ILooksStaking.json +76 -0
  105. package/build/artifacts/contracts/interfaces/IPActionAddRemoveLiq.sol/IPActionAddRemoveLiq.dbg.json +1 -1
  106. package/build/artifacts/contracts/interfaces/IPActionAddRemoveLiq.sol/IPActionAddRemoveLiq.json +8 -8
  107. package/build/artifacts/contracts/interfaces/IPActionMintRedeem.sol/IPActionMintRedeem.dbg.json +1 -1
  108. package/build/artifacts/contracts/interfaces/IPActionMintRedeem.sol/IPActionMintRedeem.json +18 -18
  109. package/build/artifacts/contracts/interfaces/IPActionSwapPT.sol/IPActionSwapPT.dbg.json +1 -1
  110. package/build/artifacts/contracts/interfaces/IPActionSwapPTYT.sol/IPActionSwapPTYT.dbg.json +1 -1
  111. package/build/artifacts/contracts/interfaces/IPActionSwapYT.sol/IPActionSwapYT.dbg.json +1 -1
  112. package/build/artifacts/contracts/interfaces/IPActionSwapYT.sol/IPActionSwapYT.json +2 -2
  113. package/build/artifacts/contracts/interfaces/IPAllAction.sol/IPAllAction.dbg.json +1 -1
  114. package/build/artifacts/contracts/interfaces/IPAllAction.sol/IPAllAction.json +28 -28
  115. package/build/artifacts/contracts/interfaces/IPBulkSeller.sol/IPBulkSeller.dbg.json +1 -1
  116. package/build/artifacts/contracts/interfaces/IPBulkSellerFactory.sol/IPBulkSellerFactory.dbg.json +1 -1
  117. package/build/artifacts/contracts/interfaces/IPMarket.sol/IPMarket.dbg.json +1 -1
  118. package/build/artifacts/contracts/interfaces/IPMarket.sol/IPMarket.json +17 -5
  119. package/build/artifacts/contracts/interfaces/IPMarketFactory.sol/IPMarketFactory.dbg.json +1 -1
  120. package/build/artifacts/contracts/interfaces/IPMarketFactory.sol/IPMarketFactory.json +50 -19
  121. package/build/artifacts/contracts/interfaces/IPMsgSendEndpoint.sol/IPMsgSendEndpoint.dbg.json +1 -1
  122. package/build/artifacts/contracts/interfaces/IPMsgSendEndpoint.sol/IPMsgSendEndpoint.json +1 -1
  123. package/build/artifacts/contracts/interfaces/IPVotingController.sol/IPVotingController.dbg.json +1 -1
  124. package/build/artifacts/contracts/interfaces/IPVotingEscrowMainchain.sol/IPVotingEscrowMainchain.dbg.json +1 -1
  125. package/build/artifacts/contracts/interfaces/IPYieldContractFactory.sol/IPYieldContractFactory.dbg.json +1 -1
  126. package/build/artifacts/contracts/interfaces/IPYieldContractFactory.sol/IPYieldContractFactory.json +7 -7
  127. package/build/artifacts/contracts/interfaces/IPYieldToken.sol/IPYieldToken.dbg.json +1 -1
  128. package/build/artifacts/contracts/interfaces/IPYieldToken.sol/IPYieldToken.json +13 -0
  129. package/build/artifacts/contracts/interfaces/IStandardizedYield.sol/IStandardizedYield.dbg.json +1 -1
  130. package/build/artifacts/contracts/offchain-helpers/BaseSplitCodeFactoryContract.sol/BaseSplitCodeFactoryContract.dbg.json +1 -1
  131. package/build/artifacts/contracts/offchain-helpers/BaseSplitCodeFactoryContract.sol/BaseSplitCodeFactoryContract.json +2 -2
  132. package/build/artifacts/contracts/offchain-helpers/BulkSellerOffchain.sol/BulkSellerOffchain.dbg.json +1 -1
  133. package/build/artifacts/contracts/offchain-helpers/BulkSellerOffchain.sol/BulkSellerOffchain.json +58 -2
  134. package/build/artifacts/contracts/offchain-helpers/MarketMathStatic.sol/MarketMathStatic.dbg.json +1 -1
  135. package/build/artifacts/contracts/offchain-helpers/MarketMathStatic.sol/MarketMathStatic.json +2 -46
  136. package/build/artifacts/contracts/offchain-helpers/RouterStatic.sol/RouterStatic.dbg.json +1 -1
  137. package/build/artifacts/contracts/offchain-helpers/RouterStatic.sol/RouterStatic.json +62 -62
  138. package/build/artifacts/contracts/router/ActionAddRemoveLiq.sol/ActionAddRemoveLiq.dbg.json +1 -1
  139. package/build/artifacts/contracts/router/ActionAddRemoveLiq.sol/ActionAddRemoveLiq.json +11 -11
  140. package/build/artifacts/contracts/router/ActionCallback.sol/ActionCallback.dbg.json +1 -1
  141. package/build/artifacts/contracts/router/ActionCallback.sol/ActionCallback.json +2 -2
  142. package/build/artifacts/contracts/router/ActionMintRedeem.sol/ActionMintRedeem.dbg.json +1 -1
  143. package/build/artifacts/contracts/router/ActionMintRedeem.sol/ActionMintRedeem.json +20 -20
  144. package/build/artifacts/contracts/router/ActionMisc.sol/ActionMisc.dbg.json +1 -1
  145. package/build/artifacts/contracts/router/ActionMisc.sol/ActionMisc.json +2 -2
  146. package/build/artifacts/contracts/router/ActionSwapPT.sol/ActionSwapPT.dbg.json +1 -1
  147. package/build/artifacts/contracts/router/ActionSwapPT.sol/ActionSwapPT.json +2 -2
  148. package/build/artifacts/contracts/router/ActionSwapPTYT.sol/ActionSwapPTYT.dbg.json +1 -1
  149. package/build/artifacts/contracts/router/ActionSwapPTYT.sol/ActionSwapPTYT.json +3 -3
  150. package/build/artifacts/contracts/router/ActionSwapYT.sol/ActionSwapYT.dbg.json +1 -1
  151. package/build/artifacts/contracts/router/ActionSwapYT.sol/ActionSwapYT.json +4 -4
  152. package/build/artifacts/contracts/router/PendleRouter.sol/PendleRouter.dbg.json +1 -1
  153. package/build/artifacts/contracts/router/PendleRouter.sol/PendleRouter.json +2 -186
  154. package/build/artifacts/contracts/router/base/ActionBaseMintRedeem.sol/ActionBaseMintRedeem.dbg.json +1 -1
  155. package/build/artifacts/contracts/router/base/MarketApproxLib.sol/MarketApproxPtInLib.dbg.json +1 -1
  156. package/build/artifacts/contracts/router/base/MarketApproxLib.sol/MarketApproxPtInLib.json +2 -2
  157. package/build/artifacts/contracts/router/base/MarketApproxLib.sol/MarketApproxPtOutLib.dbg.json +1 -1
  158. package/build/artifacts/contracts/router/base/MarketApproxLib.sol/MarketApproxPtOutLib.json +2 -2
  159. package/build/artifacts/contracts/router/kyberswap/AggregationRouterHelper.sol/AggregationRouterHelper.dbg.json +1 -1
  160. package/build/artifacts/contracts/router/kyberswap/AggregationRouterHelper.sol/AggregationRouterHelper.json +2 -2
  161. package/build/artifacts/contracts/router/kyberswap/KyberSwapHelper.sol/KyberSwapHelper.dbg.json +1 -1
  162. package/contracts/LiquidityMining/CrossChainMsg/PendleMsgSenderAppUpg.sol +1 -1
  163. package/contracts/LiquidityMining/VotingController/PendleVotingControllerUpg.sol +3 -6
  164. package/contracts/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol +7 -4
  165. package/contracts/LiquidityMining/VotingEscrow/VotingEscrowPendleSidechain.sol +10 -5
  166. package/contracts/LiquidityMining/VotingEscrow/VotingEscrowTokenBase.sol +1 -4
  167. package/contracts/LiquidityMining/libraries/VeHistoryLib.sol +0 -5
  168. package/contracts/core/BulkSeller/BulkSeller.sol +0 -5
  169. package/contracts/core/BulkSeller/BulkSellerFactory.sol +7 -6
  170. package/contracts/core/Market/MarketMathCore.sol +52 -11
  171. package/contracts/core/Market/PendleMarket.sol +35 -22
  172. package/contracts/core/Market/PendleMarketFactory.sol +67 -35
  173. package/contracts/core/StandardizedYield/SYBase.sol +26 -3
  174. package/contracts/core/StandardizedYield/SYBaseWithRewards.sol +3 -1
  175. package/contracts/core/StandardizedYield/implementations/Convex/PendleCurveFraxUsdcSY.sol +102 -0
  176. package/contracts/core/StandardizedYield/implementations/Convex/PendleCurveUsdd3CrvSY.sol +160 -0
  177. package/contracts/core/StandardizedYield/implementations/Convex/README.md +29 -0
  178. package/contracts/core/StandardizedYield/implementations/Convex/base/Curve3CrvPoolHelper.sol +215 -0
  179. package/contracts/core/StandardizedYield/implementations/Convex/base/CurveFraxUsdcPoolHelper.sol +46 -26
  180. package/contracts/core/StandardizedYield/implementations/Convex/base/CurveUsdd3CrvPoolHelper.sol +152 -0
  181. package/contracts/core/StandardizedYield/implementations/Convex/{ConvexCurveLP → base}/PendleConvexLPSY.sol +0 -0
  182. package/contracts/core/StandardizedYield/implementations/PendleLooksStakingSY.sol +128 -0
  183. package/contracts/core/YieldContracts/PendlePrincipalToken.sol +3 -3
  184. package/contracts/core/YieldContracts/PendleYieldContractFactory.sol +30 -12
  185. package/contracts/core/YieldContracts/PendleYieldToken.sol +79 -22
  186. package/contracts/core/erc20/PendleERC20.sol +4 -7
  187. package/contracts/core/libraries/BaseSplitCodeFactory.sol +1 -1
  188. package/contracts/core/libraries/BoringOwnableUpgradeable.sol +1 -1
  189. package/contracts/core/libraries/Errors.sol +12 -2
  190. package/contracts/interfaces/ConvexCurve/IBooster.sol +1 -1
  191. package/contracts/interfaces/Curve/ICrvPool.sol +3 -4
  192. package/contracts/interfaces/Curve/ITriCrvPool.sol +41 -0
  193. package/contracts/interfaces/IERC4626.sol +1 -1
  194. package/contracts/interfaces/ILooksFeeSharing.sol +5 -0
  195. package/contracts/interfaces/ILooksStaking.sol +13 -0
  196. package/contracts/interfaces/IPActionAddRemoveLiq.sol +4 -4
  197. package/contracts/interfaces/IPActionMintRedeem.sol +8 -8
  198. package/contracts/interfaces/IPActionSwapYT.sol +2 -2
  199. package/contracts/interfaces/IPMarket.sol +20 -4
  200. package/contracts/interfaces/IPMarketFactory.sol +15 -5
  201. package/contracts/interfaces/IPMsgSendEndpoint.sol +1 -1
  202. package/contracts/interfaces/IPYieldContractFactory.sol +2 -2
  203. package/contracts/interfaces/IPYieldToken.sol +2 -0
  204. package/contracts/interfaces/IStandardizedYield.sol +15 -10
  205. package/contracts/offchain-helpers/BulkSellerOffchain.sol +17 -8
  206. package/contracts/offchain-helpers/MarketMathStatic.sol +35 -96
  207. package/contracts/offchain-helpers/RouterStatic.sol +8 -6
  208. package/contracts/router/ActionAddRemoveLiq.sol +102 -10
  209. package/contracts/router/ActionMintRedeem.sol +44 -4
  210. package/contracts/router/ActionSwapPT.sol +41 -11
  211. package/contracts/router/ActionSwapPTYT.sol +32 -7
  212. package/contracts/router/ActionSwapYT.sol +49 -33
  213. package/contracts/router/PendleRouter.sol +3 -11
  214. package/contracts/router/base/MarketApproxLib.sol +52 -18
  215. package/deployments/43113-core.json +18 -14
  216. package/deployments/43113-markets/USDC-FEB-2ND.json +10 -0
  217. package/deployments/43113-markets/WETH-FEB-2ND.json +10 -0
  218. package/deployments/43113-testenv.json +1 -2
  219. package/package.json +5 -5
  220. package/typechain-types/ActionAddRemoveLiq.ts +18 -18
  221. package/typechain-types/ActionMintRedeem.ts +30 -30
  222. package/typechain-types/ActionSwapPTYT.ts +5 -5
  223. package/typechain-types/ActionSwapYT.ts +5 -5
  224. package/typechain-types/BulkSeller.ts +0 -19
  225. package/typechain-types/BulkSellerOffchain.ts +74 -0
  226. package/typechain-types/IBooster.ts +9 -3
  227. package/typechain-types/ICrvPool.ts +4 -9
  228. package/typechain-types/IERC4626.ts +5 -5
  229. package/typechain-types/IPActionAddRemoveLiq.ts +13 -13
  230. package/typechain-types/IPActionMintRedeem.ts +30 -30
  231. package/typechain-types/IPActionSwapYT.ts +5 -5
  232. package/typechain-types/IPAllAction.ts +48 -48
  233. package/typechain-types/IPMarket.ts +26 -16
  234. package/typechain-types/IPMarketFactory.ts +70 -37
  235. package/typechain-types/IPMsgSendEndpoint.ts +1 -1
  236. package/typechain-types/IPYieldContractFactory.ts +11 -11
  237. package/typechain-types/IPYieldToken.ts +21 -0
  238. package/typechain-types/MarketMathStatic.ts +0 -67
  239. package/typechain-types/PendleConvexLPSY.ts +204 -0
  240. package/typechain-types/PendleMarket.ts +26 -16
  241. package/typechain-types/PendleMarketFactory.ts +316 -92
  242. package/typechain-types/PendleQiTokenSY.ts +204 -0
  243. package/typechain-types/PendleRouter.ts +3 -287
  244. package/typechain-types/PendleWstEthSY.ts +204 -0
  245. package/typechain-types/PendleYieldContractFactory.ts +63 -18
  246. package/typechain-types/PendleYieldToken.ts +42 -0
  247. package/typechain-types/RouterStatic.ts +2 -2
  248. package/typechain-types/SYBase.ts +204 -0
  249. package/typechain-types/SYBaseWithRewards.ts +204 -0
  250. package/typechain-types/VotingEscrowPendleSidechain.ts +8 -8
  251. package/typechain-types/VotingEscrowTokenBase.ts +0 -21
  252. package/typechain-types/factories/ActionAddRemoveLiq__factory.ts +10 -10
  253. package/typechain-types/factories/ActionCallback__factory.ts +1 -1
  254. package/typechain-types/factories/ActionMintRedeem__factory.ts +19 -19
  255. package/typechain-types/factories/ActionMisc__factory.ts +1 -1
  256. package/typechain-types/factories/ActionSwapPTYT__factory.ts +2 -2
  257. package/typechain-types/factories/ActionSwapPT__factory.ts +1 -1
  258. package/typechain-types/factories/ActionSwapYT__factory.ts +3 -3
  259. package/typechain-types/factories/AggregationRouterHelper__factory.ts +1 -1
  260. package/typechain-types/factories/BaseSplitCodeFactoryContract__factory.ts +1 -1
  261. package/typechain-types/factories/BoringOwnableUpgradeableData__factory.ts +1 -1
  262. package/typechain-types/factories/BulkSellerFactory__factory.ts +1 -1
  263. package/typechain-types/factories/BulkSellerOffchain__factory.ts +57 -1
  264. package/typechain-types/factories/BulkSeller__factory.ts +1 -14
  265. package/typechain-types/factories/Errors__factory.ts +104 -30
  266. package/typechain-types/factories/IBooster__factory.ts +1 -1
  267. package/typechain-types/factories/ICrvPool__factory.ts +14 -7
  268. package/typechain-types/factories/IERC4626__factory.ts +1 -1
  269. package/typechain-types/factories/IPActionAddRemoveLiq__factory.ts +8 -8
  270. package/typechain-types/factories/IPActionMintRedeem__factory.ts +18 -18
  271. package/typechain-types/factories/IPActionSwapYT__factory.ts +2 -2
  272. package/typechain-types/factories/IPAllAction__factory.ts +28 -28
  273. package/typechain-types/factories/IPMarketFactory__factory.ts +50 -19
  274. package/typechain-types/factories/IPMarket__factory.ts +17 -5
  275. package/typechain-types/factories/IPMsgSendEndpoint__factory.ts +1 -1
  276. package/typechain-types/factories/IPYieldContractFactory__factory.ts +7 -7
  277. package/typechain-types/factories/IPYieldToken__factory.ts +13 -0
  278. package/typechain-types/factories/MarketMathStatic__factory.ts +1 -45
  279. package/typechain-types/factories/OracleLib__factory.ts +1 -1
  280. package/typechain-types/factories/PendleConvexLPSY__factory.ts +141 -0
  281. package/typechain-types/factories/PendleCurveFraxUsdcSY__factory.ts +1 -1
  282. package/typechain-types/factories/PendleCurveUsdd3CrvSY__factory.ts +1 -1
  283. package/typechain-types/factories/PendleERC20Permit__factory.ts +1 -1
  284. package/typechain-types/factories/PendleERC20__factory.ts +1 -1
  285. package/typechain-types/factories/PendleFeeDistributorFactory__factory.ts +1 -1
  286. package/typechain-types/factories/PendleFeeDistributor__factory.ts +1 -1
  287. package/typechain-types/factories/PendleGaugeControllerMainchainUpg__factory.ts +1 -1
  288. package/typechain-types/factories/PendleGaugeControllerSidechainUpg__factory.ts +1 -1
  289. package/typechain-types/factories/PendleLooksStakingSY__factory.ts +1 -1
  290. package/typechain-types/factories/PendleMarketFactory__factory.ts +220 -49
  291. package/typechain-types/factories/PendleMarket__factory.ts +18 -6
  292. package/typechain-types/factories/PendleMsgReceiveEndpointUpg__factory.ts +1 -1
  293. package/typechain-types/factories/PendleMsgSendEndpointUpg__factory.ts +1 -1
  294. package/typechain-types/factories/PendlePrincipalToken__factory.ts +1 -1
  295. package/typechain-types/factories/PendleQiTokenHelper__factory.ts +1 -1
  296. package/typechain-types/factories/PendleQiTokenSY__factory.ts +142 -1
  297. package/typechain-types/factories/PendleRouter__factory.ts +1 -185
  298. package/typechain-types/factories/PendleVotingControllerUpg__factory.ts +1 -1
  299. package/typechain-types/factories/PendleWstEthSY__factory.ts +142 -1
  300. package/typechain-types/factories/PendleYieldContractFactory__factory.ts +82 -9
  301. package/typechain-types/factories/PendleYieldToken__factory.ts +38 -3
  302. package/typechain-types/factories/RouterStatic__factory.ts +3 -3
  303. package/typechain-types/factories/SYBaseWithRewards__factory.ts +141 -0
  304. package/typechain-types/factories/SYBase__factory.ts +141 -0
  305. package/typechain-types/factories/VotingEscrowPendleMainchain__factory.ts +1 -1
  306. package/typechain-types/factories/VotingEscrowPendleSidechain__factory.ts +15 -4
  307. package/typechain-types/factories/VotingEscrowTokenBase__factory.ts +0 -13
  308. package/typechain-types/hardhat.d.ts +0 -36
  309. package/typechain-types/index.ts +0 -6
  310. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/ConvexCurveLP/PendleConvexLPSY.sol/PendleConvexLPSY.dbg.json +0 -4
  311. package/build/artifacts/contracts/offchain-helpers/ImplicitSwapfeeContract.sol/ImplicitSwapfeeContract.dbg.json +0 -4
  312. package/build/artifacts/contracts/offchain-helpers/ImplicitSwapfeeContract.sol/ImplicitSwapfeeContract.json +0 -182
  313. package/contracts/offchain-helpers/ImplicitSwapfeeContract.sol +0 -30
  314. package/deployments/43113-markets/QIWBTC-3RD-FEB.json +0 -11
  315. package/deployments/43113-markets/benqi-market-QI-AVAX-FEB-2ND.json +0 -9
  316. package/deployments/43113-markets/benqi-market-QI-USDC-FEB-2ND.json +0 -8
  317. package/deployments/43113-markets/benqi-market-QI-WETH-DEC-1ST.json +0 -9
  318. package/deployments/80001-core.json +0 -16
  319. package/deployments/80001-markets/benqi-market-QI-USDC-FEB-2ND.json +0 -8
  320. package/deployments/80001-markets/benqi-market-QI-WETH-DEC-1ST.json +0 -8
  321. package/deployments/80001-testenv.json +0 -22
@@ -8,7 +8,7 @@ interface IPMsgSendEndpoint {
8
8
  uint256 dstChainId,
9
9
  bytes memory payload,
10
10
  uint256 estimatedGasAmount
11
- ) external view returns (uint256);
11
+ ) external view returns (uint256 fee);
12
12
 
13
13
  function sendMessage(
14
14
  address dstAddress,
@@ -24,13 +24,13 @@
24
24
  pragma solidity 0.8.17;
25
25
 
26
26
  interface IPYieldContractFactory {
27
- event CreateYieldContract(address indexed SY, address PT, address YT, uint256 expiry);
27
+ event CreateYieldContract(address indexed SY, uint256 indexed expiry, address PT, address YT);
28
28
 
29
29
  event SetExpiryDivisor(uint256 newExpiryDivisor);
30
30
 
31
31
  event SetInterestFeeRate(uint256 newInterestFeeRate);
32
32
 
33
- event SetRewardFeeRate(uint256 newInterestFeeRate);
33
+ event SetRewardFeeRate(uint256 newRewardFeeRate);
34
34
 
35
35
  event SetTreasury(address indexed treasury);
36
36
 
@@ -59,4 +59,6 @@ interface IPYieldToken is IERC20Metadata, IRewardManager, IPInterestManagerYT {
59
59
  function expiry() external view returns (uint256);
60
60
 
61
61
  function isExpired() external view returns (bool);
62
+
63
+ function doCacheIndexSameBlock() external view returns (bool);
62
64
  }
@@ -43,7 +43,7 @@ interface IStandardizedYield is IERC20Metadata {
43
43
  uint256 amountTokenOut
44
44
  );
45
45
 
46
- /// @dev check assetInfo for more information
46
+ /// @dev check `assetInfo()` for more information
47
47
  enum AssetType {
48
48
  TOKEN,
49
49
  LIQUIDITY
@@ -74,9 +74,10 @@ interface IStandardizedYield is IERC20Metadata {
74
74
  /**
75
75
  * @notice redeems an amount of base tokens by burning some shares
76
76
  * @param receiver recipient address
77
- * @param amountSharesToRedeem amount of shares to be burned from (`msg.sender`)
77
+ * @param amountSharesToRedeem amount of shares to be burned
78
78
  * @param tokenOut address of the base token to be redeemed
79
79
  * @param minTokenOut reverts if amount of base token redeemed is lower than this
80
+ * @param burnFromInternalBalance if true, burns from balance of `address(this)`, otherwise burns from `msg.sender`
80
81
  * @return amountTokenOut amount of base tokens redeemed
81
82
  * @dev Emits a {Redeem} event
82
83
  *
@@ -105,7 +106,7 @@ interface IStandardizedYield is IERC20Metadata {
105
106
  * @param user the user receiving their rewards
106
107
  * @return rewardAmounts an array of reward amounts in the same order as `getRewardTokens`
107
108
  * @dev
108
- * Emits a `ClaimRewardss` event
109
+ * Emits a `ClaimRewards` event
109
110
  * See {getRewardTokens} for list of reward tokens
110
111
  */
111
112
  function claimRewards(address user) external returns (uint256[] memory rewardAmounts);
@@ -131,8 +132,14 @@ interface IStandardizedYield is IERC20Metadata {
131
132
  */
132
133
  function yieldToken() external view returns (address);
133
134
 
135
+ /**
136
+ * @notice returns all tokens that can mint this SY
137
+ */
134
138
  function getTokensIn() external view returns (address[] memory res);
135
139
 
140
+ /**
141
+ * @notice returns all tokens that can be redeemed by this SY
142
+ */
136
143
  function getTokensOut() external view returns (address[] memory res);
137
144
 
138
145
  function isValidTokenIn(address token) external view returns (bool);
@@ -150,13 +157,11 @@ interface IStandardizedYield is IERC20Metadata {
150
157
  returns (uint256 amountTokenOut);
151
158
 
152
159
  /**
153
- * @notice This function contains information to interpret what the asset is
154
- * @notice decimals is the decimals to format asset balances
155
- * @notice if asset is an ERC20 token, assetType = 0, assetAddress is the address of the token
156
- * @notice if asset is liquidity of an AMM (like sqrt(k) in UniswapV2 forks), assetType = 1,
157
- assetAddress is the address of the LP token
158
- * @notice assetDecimals is the decimals of the asset
159
- */
160
+ * @notice This function contains information to interpret what the asset is
161
+ * @return assetType the type of the asset (0 for ERC20 tokens, 1 for AMM liquidity tokens)
162
+ * @return assetAddress the address of the asset
163
+ * @return assetDecimals the decimals of the asset
164
+ */
160
165
  function assetInfo()
161
166
  external
162
167
  view
@@ -5,12 +5,10 @@ import "../core/BulkSeller/BulkSellerMathCore.sol";
5
5
  import "../core/BulkSeller/BulkSeller.sol";
6
6
  import "hardhat/console.sol";
7
7
 
8
- // upgradable bla bla
9
8
  contract BulkSellerOffchain {
10
9
  using BulkSellerMathCore for BulkSellerState;
11
10
  using Math for uint256;
12
11
 
13
- // rmb to add fee here
14
12
  function calcCurrentRates(IPBulkSeller bulk)
15
13
  external
16
14
  view
@@ -34,6 +32,23 @@ contract BulkSellerOffchain {
34
32
  }
35
33
  }
36
34
 
35
+ function getCurrentState(IPBulkSeller bulk)
36
+ external
37
+ view
38
+ returns (
39
+ BulkSellerState memory state,
40
+ uint256 tokenProp,
41
+ uint256 hypoTokenBal
42
+ )
43
+ {
44
+ state = bulk.readState();
45
+
46
+ tokenProp = state.getTokenProp();
47
+ hypoTokenBal =
48
+ state.totalToken +
49
+ IStandardizedYield(bulk.SY()).previewRedeem(bulk.token(), state.totalSy);
50
+ }
51
+
37
52
  function calcCurrentRatesWithAmount(
38
53
  IPBulkSeller bulk,
39
54
  uint256 hypoTotalToken,
@@ -52,10 +67,4 @@ contract BulkSellerOffchain {
52
67
  rateSyToToken = netTokenFromSy.divDown(hypoTotalSy);
53
68
  }
54
69
  }
55
-
56
- // TODO: pause contract when rate is bad compared to market
57
- // TODO: Sound alarm if updates fail
58
- // TODO: audit even the typescript code
59
- // TODO: add a max with currentRate to guarantee no loss?
60
- // TODO: pause immediately if lost enough money
61
70
  }
@@ -27,7 +27,7 @@ library MarketMathStatic {
27
27
  uint256 netPtUsed
28
28
  )
29
29
  {
30
- MarketState memory state = IPMarket(market).readState();
30
+ MarketState memory state = IPMarket(market).readState(address(this));
31
31
  (, netLpOut, netSyUsed, netPtUsed) = state.addLiquidity(
32
32
  netSyDesired,
33
33
  netPtDesired,
@@ -35,35 +35,6 @@ library MarketMathStatic {
35
35
  );
36
36
  }
37
37
 
38
- function addLiquidityDualTokenAndPtStatic(
39
- address market,
40
- address tokenIn,
41
- uint256 netTokenDesired,
42
- uint256 netPtDesired
43
- )
44
- external
45
- view
46
- returns (
47
- uint256 netLpOut,
48
- uint256 netTokenUsed,
49
- uint256 netPtUsed
50
- )
51
- {
52
- (IStandardizedYield SY, , ) = IPMarket(market).readTokens();
53
-
54
- uint256 syDesired = SY.previewDeposit(tokenIn, netTokenDesired);
55
- uint256 syUsed;
56
-
57
- MarketState memory state = IPMarket(market).readState();
58
- (, netLpOut, syUsed, netPtUsed) = state.addLiquidity(
59
- syDesired,
60
- netPtDesired,
61
- block.timestamp
62
- );
63
-
64
- netTokenUsed = getAmountTokenToMintSy(address(SY), tokenIn, syUsed);
65
- }
66
-
67
38
  /// @dev netPtToSwap is the parameter to approx
68
39
  function addLiquiditySinglePtStatic(
69
40
  address market,
@@ -78,7 +49,7 @@ library MarketMathStatic {
78
49
  uint256 priceImpact
79
50
  )
80
51
  {
81
- MarketState memory state = IPMarket(market).readState();
52
+ MarketState memory state = IPMarket(market).readState(address(this));
82
53
 
83
54
  (netPtToSwap, , ) = state.approxSwapPtToAddLiquidity(
84
55
  pyIndex(market),
@@ -87,10 +58,10 @@ library MarketMathStatic {
87
58
  approxParams
88
59
  );
89
60
 
90
- state = IPMarket(market).readState(); // re-read
61
+ state = IPMarket(market).readState(address(this)); // re-read
91
62
 
92
63
  uint256 netSyReceived;
93
- (netSyReceived, netSyFee) = state.swapExactPtForSy(
64
+ (netSyReceived, netSyFee, ) = state.swapExactPtForSy(
94
65
  pyIndex(market),
95
66
  netPtToSwap,
96
67
  block.timestamp
@@ -118,7 +89,7 @@ library MarketMathStatic {
118
89
  uint256 priceImpact
119
90
  )
120
91
  {
121
- MarketState memory state = IPMarket(market).readState();
92
+ MarketState memory state = IPMarket(market).readState(address(this));
122
93
 
123
94
  (netPtFromSwap, , ) = state.approxSwapSyToAddLiquidity(
124
95
  pyIndex(market),
@@ -127,10 +98,10 @@ library MarketMathStatic {
127
98
  approxParams
128
99
  );
129
100
 
130
- state = IPMarket(market).readState(); // re-read
101
+ state = IPMarket(market).readState(address(this)); // re-read
131
102
 
132
103
  uint256 netSySwap;
133
- (netSySwap, netSyFee) = state.swapSyForExactPt(
104
+ (netSySwap, netSyFee, ) = state.swapSyForExactPt(
134
105
  pyIndex(market),
135
106
  netPtFromSwap,
136
107
  block.timestamp
@@ -145,7 +116,7 @@ library MarketMathStatic {
145
116
  view
146
117
  returns (uint256 netSyOut, uint256 netPtOut)
147
118
  {
148
- MarketState memory state = IPMarket(market).readState();
119
+ MarketState memory state = IPMarket(market).readState(address(this));
149
120
  (netSyOut, netPtOut) = state.removeLiquidity(netLpToRemove);
150
121
  }
151
122
 
@@ -163,7 +134,7 @@ library MarketMathStatic {
163
134
  uint256 priceImpact
164
135
  )
165
136
  {
166
- MarketState memory state = IPMarket(market).readState();
137
+ MarketState memory state = IPMarket(market).readState(address(this));
167
138
 
168
139
  (uint256 syFromBurn, uint256 ptFromBurn) = state.removeLiquidity(netLpToRemove);
169
140
  (netPtFromSwap, netSyFee) = state.approxSwapExactSyForPt(
@@ -185,7 +156,7 @@ library MarketMathStatic {
185
156
  uint256 priceImpact
186
157
  )
187
158
  {
188
- MarketState memory state = IPMarket(market).readState();
159
+ MarketState memory state = IPMarket(market).readState(address(this));
189
160
 
190
161
  (uint256 syFromBurn, uint256 ptFromBurn) = state.removeLiquidity(netLpToRemove);
191
162
 
@@ -193,7 +164,7 @@ library MarketMathStatic {
193
164
  netSyOut = syFromBurn + pyIndex(market).assetToSy(ptFromBurn);
194
165
  } else {
195
166
  uint256 syFromSwap;
196
- (syFromSwap, netSyFee) = state.swapExactPtForSy(
167
+ (syFromSwap, netSyFee, ) = state.swapExactPtForSy(
197
168
  pyIndex(market),
198
169
  ptFromBurn,
199
170
  block.timestamp
@@ -212,8 +183,12 @@ library MarketMathStatic {
212
183
  uint256 priceImpact
213
184
  )
214
185
  {
215
- MarketState memory state = IPMarket(market).readState();
216
- (netSyOut, netSyFee) = state.swapExactPtForSy(pyIndex(market), exactPtIn, block.timestamp);
186
+ MarketState memory state = IPMarket(market).readState(address(this));
187
+ (netSyOut, netSyFee, ) = state.swapExactPtForSy(
188
+ pyIndex(market),
189
+ exactPtIn,
190
+ block.timestamp
191
+ );
217
192
  priceImpact = calcPriceImpact(market, exactPtIn.neg());
218
193
  }
219
194
 
@@ -225,8 +200,12 @@ library MarketMathStatic {
225
200
  uint256 priceImpact
226
201
  )
227
202
  {
228
- MarketState memory state = IPMarket(market).readState();
229
- (netSyIn, netSyFee) = state.swapSyForExactPt(pyIndex(market), exactPtOut, block.timestamp);
203
+ MarketState memory state = IPMarket(market).readState(address(this));
204
+ (netSyIn, netSyFee, ) = state.swapSyForExactPt(
205
+ pyIndex(market),
206
+ exactPtOut,
207
+ block.timestamp
208
+ );
230
209
  priceImpact = calcPriceImpact(market, exactPtOut.Int());
231
210
  }
232
211
 
@@ -243,7 +222,7 @@ library MarketMathStatic {
243
222
  uint256 priceImpact
244
223
  )
245
224
  {
246
- MarketState memory state = IPMarket(market).readState();
225
+ MarketState memory state = IPMarket(market).readState(address(this));
247
226
  (netPtOut, netSyFee) = state.approxSwapExactSyForPt(
248
227
  pyIndex(market),
249
228
  exactSyIn,
@@ -266,7 +245,7 @@ library MarketMathStatic {
266
245
  uint256 priceImpact
267
246
  )
268
247
  {
269
- MarketState memory state = IPMarket(market).readState();
248
+ MarketState memory state = IPMarket(market).readState(address(this));
270
249
 
271
250
  (netPtIn, , netSyFee) = state.approxSwapPtForExactSy(
272
251
  pyIndex(market),
@@ -285,12 +264,12 @@ library MarketMathStatic {
285
264
  uint256 priceImpact
286
265
  )
287
266
  {
288
- MarketState memory state = IPMarket(market).readState();
267
+ MarketState memory state = IPMarket(market).readState(address(this));
289
268
 
290
269
  PYIndex index = pyIndex(market);
291
270
 
292
271
  uint256 syReceived;
293
- (syReceived, netSyFee) = state.swapExactPtForSy(
272
+ (syReceived, netSyFee, ) = state.swapExactPtForSy(
294
273
  pyIndex(market),
295
274
  exactYtOut,
296
275
  block.timestamp
@@ -315,7 +294,7 @@ library MarketMathStatic {
315
294
  uint256 priceImpact
316
295
  )
317
296
  {
318
- MarketState memory state = IPMarket(market).readState();
297
+ MarketState memory state = IPMarket(market).readState(address(this));
319
298
  PYIndex index = pyIndex(market);
320
299
 
321
300
  (netYtOut, netSyFee) = state.approxSwapExactSyForYt(
@@ -336,12 +315,12 @@ library MarketMathStatic {
336
315
  uint256 priceImpact
337
316
  )
338
317
  {
339
- MarketState memory state = IPMarket(market).readState();
318
+ MarketState memory state = IPMarket(market).readState(address(this));
340
319
 
341
320
  PYIndex index = pyIndex(market);
342
321
 
343
322
  uint256 syOwed;
344
- (syOwed, netSyFee) = state.swapSyForExactPt(index, exactYtIn, block.timestamp);
323
+ (syOwed, netSyFee, ) = state.swapSyForExactPt(index, exactYtIn, block.timestamp);
345
324
 
346
325
  uint256 amountPYToRepaySyOwed = index.syToAssetUp(syOwed);
347
326
  uint256 amountPYToRedeemSyOut = exactYtIn - amountPYToRepaySyOwed;
@@ -363,7 +342,7 @@ library MarketMathStatic {
363
342
  uint256 priceImpact
364
343
  )
365
344
  {
366
- MarketState memory state = IPMarket(market).readState();
345
+ MarketState memory state = IPMarket(market).readState(address(this));
367
346
 
368
347
  PYIndex index = pyIndex(market);
369
348
 
@@ -390,7 +369,7 @@ library MarketMathStatic {
390
369
  uint256 priceImpact
391
370
  )
392
371
  {
393
- MarketState memory state = IPMarket(market).readState();
372
+ MarketState memory state = IPMarket(market).readState(address(this));
394
373
  PYIndex index = pyIndex(market);
395
374
 
396
375
  (netYtOut, totalPtToSwap, netSyFee) = state.approxSwapExactPtForYt(
@@ -416,7 +395,7 @@ library MarketMathStatic {
416
395
  uint256 priceImpact
417
396
  )
418
397
  {
419
- MarketState memory state = IPMarket(market).readState();
398
+ MarketState memory state = IPMarket(market).readState(address(this));
420
399
  PYIndex index = pyIndex(market);
421
400
 
422
401
  (netPtOut, totalPtSwapped, netSyFee) = state.approxSwapExactYtForPt(
@@ -445,7 +424,7 @@ library MarketMathStatic {
445
424
  {
446
425
  if (IPMarket(market).isExpired()) return Math.ONE;
447
426
  int256 netPtToAccount = netPtOut;
448
- MarketState memory state = IPMarket(market).readState();
427
+ MarketState memory state = IPMarket(market).readState(address(this));
449
428
  MarketPreCompute memory comp = state.getMarketPreCompute(pyIndex(market), block.timestamp);
450
429
 
451
430
  int256 preFeeExchangeRate = MarketMathCore._getExchangeRate(
@@ -477,49 +456,9 @@ library MarketMathStatic {
477
456
  }
478
457
 
479
458
  function getPtImpliedYield(address market) public view returns (int256) {
480
- MarketState memory state = IPMarket(market).readState();
459
+ MarketState memory state = IPMarket(market).readState(address(this));
481
460
 
482
461
  int256 lnImpliedRate = (state.lastLnImpliedRate).Int();
483
462
  return lnImpliedRate.exp();
484
463
  }
485
-
486
- function getAmountTokenToMintSy(
487
- address SY,
488
- address tokenIn,
489
- uint256 netSyOut
490
- ) internal view returns (uint256 netTokenIn) {
491
- uint256 pivotAmount = netSyOut;
492
-
493
- uint256 low = pivotAmount;
494
- {
495
- while (true) {
496
- uint256 lowSyOut = IStandardizedYield(SY).previewDeposit(tokenIn, low);
497
- if (lowSyOut >= netSyOut) low /= 10;
498
- else break;
499
- }
500
- }
501
-
502
- uint256 high = pivotAmount;
503
- {
504
- while (true) {
505
- uint256 highSyOut = IStandardizedYield(SY).previewDeposit(tokenIn, high);
506
- if (highSyOut < netSyOut) high *= 10;
507
- else break;
508
- }
509
- }
510
-
511
- while(low <= high) {
512
- uint256 mid = (low + high) / 2;
513
- uint256 syOut = IStandardizedYield(SY).previewDeposit(tokenIn, mid);
514
-
515
- if (syOut >= netSyOut) {
516
- netTokenIn = mid;
517
- high = mid - 1;
518
- } else {
519
- low = mid + 1;
520
- }
521
- }
522
-
523
- assert(netTokenIn > 0);
524
- }
525
464
  }
@@ -12,7 +12,7 @@ import "./MarketMathStatic.sol";
12
12
  import "../core/libraries/BoringOwnableUpgradeable.sol";
13
13
  import "../LiquidityMining/libraries/VeBalanceLib.sol";
14
14
 
15
- import "@openzeppelin/contracts/proxy/utils/Initializable.sol";
15
+ import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
16
16
  import "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol";
17
17
 
18
18
  /// EXCLUDED FROM ALL AUDITS, TO BE CALLED ONLY BY PENDLE's SDK
@@ -85,7 +85,7 @@ contract RouterStatic is Initializable, BoringOwnableUpgradeable, UUPSUpgradeabl
85
85
  guessMax: type(uint256).max,
86
86
  guessOffchain: 0,
87
87
  maxIteration: 256,
88
- eps: 1e15
88
+ eps: 1e14
89
89
  });
90
90
  }
91
91
 
@@ -155,7 +155,7 @@ contract RouterStatic is Initializable, BoringOwnableUpgradeable, UUPSUpgradeabl
155
155
 
156
156
  pt = address(PT);
157
157
  sy = address(SY);
158
- state = _market.readState();
158
+ state = _market.readState(address(this));
159
159
  impliedYield = getPtImpliedYield(market);
160
160
  exchangeRate = MarketMathStatic.getExchangeRate(market);
161
161
  }
@@ -244,7 +244,7 @@ contract RouterStatic is Initializable, BoringOwnableUpgradeable, UUPSUpgradeabl
244
244
  (userMarketInfo.assetBalance.assetType, userMarketInfo.assetBalance.assetAddress, ) = SY
245
245
  .assetInfo();
246
246
 
247
- MarketState memory state = _market.readState();
247
+ MarketState memory state = _market.readState(address(this));
248
248
  uint256 totalLp = uint256(state.totalLp);
249
249
 
250
250
  if (totalLp == 0) {
@@ -852,8 +852,10 @@ contract RouterStatic is Initializable, BoringOwnableUpgradeable, UUPSUpgradeabl
852
852
  bulk = IPBulkSellerFactory(bulkFactory).get(token, SY);
853
853
  if (bulk != address(0)) {
854
854
  BulkSellerState memory state = IPBulkSeller(bulk).readState();
855
- totalToken = state.totalToken;
856
- totalSy = state.totalSy;
855
+ if (state.rateTokenToSy != 0 || state.rateSyToToken != 0) {
856
+ totalToken = state.totalToken;
857
+ totalSy = state.totalSy;
858
+ }
857
859
  }
858
860
  }
859
861
  }