@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
@@ -46,7 +46,8 @@ contract PendleYieldContractFactory is BoringOwnableUpgradeable, IPYieldContract
46
46
 
47
47
  string private constant PT_PREFIX = "PT";
48
48
  string private constant YT_PREFIX = "YT";
49
- string private constant SY_PREF = "SY-";
49
+ string private constant SY_SYMBOL_PREF = "SY-";
50
+ string private constant SY_NAME_PREF = "SY ";
50
51
 
51
52
  address public immutable ytCreationCodeContractA;
52
53
  uint256 public immutable ytCreationCodeSizeA;
@@ -62,11 +63,15 @@ contract PendleYieldContractFactory is BoringOwnableUpgradeable, IPYieldContract
62
63
  uint96 public expiryDivisor;
63
64
 
64
65
  // SY => expiry => address
66
+ // returns address(0) if not created
65
67
  mapping(address => mapping(uint256 => address)) public getPT;
66
68
  mapping(address => mapping(uint256 => address)) public getYT;
67
69
  mapping(address => bool) public isPT;
68
70
  mapping(address => bool) public isYT;
69
71
 
72
+ uint256 public constant maxInterestFeeRate = 2e17; // 20%
73
+ uint256 public constant maxRewardFeeRate = 2e17; // 20%
74
+
70
75
  constructor(
71
76
  address _ytCreationCodeContractA,
72
77
  uint256 _ytCreationCodeSizeA,
@@ -96,10 +101,11 @@ contract PendleYieldContractFactory is BoringOwnableUpgradeable, IPYieldContract
96
101
  * @notice Create a pair of (PT, YT) from any SY and valid expiry. Anyone can create a yield contract
97
102
  * @dev It's intentional to make expiry an uint32 to guard against fat fingers. uint32.max is year 2106
98
103
  */
99
- function createYieldContract(address SY, uint32 expiry)
100
- external
101
- returns (address PT, address YT)
102
- {
104
+ function createYieldContract(
105
+ address SY,
106
+ uint32 expiry,
107
+ bool doCacheIndexSameBlock
108
+ ) external returns (address PT, address YT) {
103
109
  if (MiniHelpers.isTimeInThePast(expiry) || expiry % expiryDivisor != 0)
104
110
  revert Errors.YCFactoryInvalidExpiry();
105
111
 
@@ -136,7 +142,8 @@ contract PendleYieldContractFactory is BoringOwnableUpgradeable, IPYieldContract
136
142
  YT_PREFIX.concat(syCoreName, expiry, " "),
137
143
  YT_PREFIX.concat(syCoreSymbol, expiry, "-"),
138
144
  assetDecimals,
139
- expiry
145
+ expiry,
146
+ doCacheIndexSameBlock
140
147
  ),
141
148
  ytCreationCodeContractA,
142
149
  ytCreationCodeSizeA,
@@ -151,32 +158,43 @@ contract PendleYieldContractFactory is BoringOwnableUpgradeable, IPYieldContract
151
158
  isPT[PT] = true;
152
159
  isYT[YT] = true;
153
160
 
154
- emit CreateYieldContract(SY, PT, YT, expiry);
161
+ emit CreateYieldContract(SY, expiry, PT, YT);
155
162
  }
156
163
 
157
164
  function setExpiryDivisor(uint96 newExpiryDivisor) public onlyOwner {
165
+ if (newExpiryDivisor == 0) revert Errors.YCFactoryZeroExpiryDivisor();
166
+
158
167
  expiryDivisor = newExpiryDivisor;
159
168
  emit SetExpiryDivisor(newExpiryDivisor);
160
169
  }
161
170
 
162
171
  function setInterestFeeRate(uint128 newInterestFeeRate) public onlyOwner {
172
+ if (newInterestFeeRate > maxInterestFeeRate)
173
+ revert Errors.YCFactoryInterestFeeRateTooHigh(newInterestFeeRate, maxInterestFeeRate);
174
+
163
175
  interestFeeRate = newInterestFeeRate;
164
176
  emit SetInterestFeeRate(newInterestFeeRate);
165
177
  }
166
178
 
167
- function setRewardFeeRate(uint128 newInterestFeeRate) public onlyOwner {
168
- rewardFeeRate = newInterestFeeRate;
169
- emit SetInterestFeeRate(newInterestFeeRate);
179
+ function setRewardFeeRate(uint128 newRewardFeeRate) public onlyOwner {
180
+ if (newRewardFeeRate > maxRewardFeeRate)
181
+ revert Errors.YCFactoryRewardFeeRateTooHigh(newRewardFeeRate, maxRewardFeeRate);
182
+
183
+ rewardFeeRate = newRewardFeeRate;
184
+ emit SetRewardFeeRate(newRewardFeeRate);
170
185
  }
171
186
 
172
187
  function setTreasury(address newTreasury) public onlyOwner {
188
+ if (newTreasury == address(0)) revert Errors.YCFactoryZeroTreasury();
189
+
173
190
  treasury = newTreasury;
174
191
  emit SetTreasury(newTreasury);
175
192
  }
176
193
 
177
194
  function _stripSYPrefix(string memory _str) internal pure returns (string memory) {
178
195
  StringLib.slice memory str = _str.toSlice();
179
- StringLib.slice memory delim = SY_PREF.toSlice();
180
- return str.beyond(delim).toString();
196
+ StringLib.slice memory delim_name = SY_NAME_PREF.toSlice();
197
+ StringLib.slice memory delim_symbol = SY_SYMBOL_PREF.toSlice();
198
+ return str.beyond(delim_name).beyond(delim_symbol).toString();
181
199
  }
182
200
  }
@@ -45,7 +45,11 @@ contract PendleYieldToken is
45
45
  address public immutable factory;
46
46
  uint256 public immutable expiry;
47
47
 
48
- uint128 public syReserve;
48
+ bool public immutable doCacheIndexSameBlock;
49
+
50
+ uint256 public syReserve;
51
+
52
+ uint128 public pyIndexLastUpdatedBlock;
49
53
  uint128 internal _pyIndexStored;
50
54
 
51
55
  PostExpiryData public postExpiry;
@@ -61,21 +65,31 @@ contract PendleYieldToken is
61
65
  _;
62
66
  }
63
67
 
68
+ /**
69
+ * @param _doCacheIndexSameBlock if true, the PY index is cached for each block, and thus is
70
+ * constant for all txs within the same block. Otherwise, the PY index is recalculated for
71
+ * every tx.
72
+ */
64
73
  constructor(
65
74
  address _SY,
66
75
  address _PT,
67
76
  string memory _name,
68
77
  string memory _symbol,
69
78
  uint8 __decimals,
70
- uint256 _expiry
79
+ uint256 _expiry,
80
+ bool _doCacheIndexSameBlock
71
81
  ) PendleERC20Permit(_name, _symbol, __decimals) {
72
82
  SY = _SY;
73
83
  PT = _PT;
74
84
  expiry = _expiry;
75
85
  factory = msg.sender;
86
+ doCacheIndexSameBlock = _doCacheIndexSameBlock;
76
87
  }
77
88
 
78
- /// @notice Tokenize SY into PT + YT of equal qty. Every unit of underlying of SY will create 1 PT + 1 YT
89
+ /**
90
+ * @notice Tokenize SY into PT + YT of equal qty. Every unit of asset of SY will create 1 PT + 1 YT
91
+ * @dev SY must be transferred to this contract prior to calling
92
+ */
79
93
  function mintPY(address receiverPT, address receiverYT)
80
94
  external
81
95
  nonReentrant
@@ -97,7 +111,7 @@ contract PendleYieldToken is
97
111
  amountPYOut = amountPYOuts[0];
98
112
  }
99
113
 
100
- /// @notice Tokenize SY into PT + YT of equal qty. Every unit of underlying of SY will create 1 PT + 1 YT
114
+ /// @notice Tokenize SY into PT + YT for multiple receivers. See `mintPY()` for more details
101
115
  function mintPYMulti(
102
116
  address[] calldata receiverPTs,
103
117
  address[] calldata receiverYTs,
@@ -116,7 +130,11 @@ contract PendleYieldToken is
116
130
  amountPYOuts = _mintPY(receiverPTs, receiverYTs, amountSyToMints);
117
131
  }
118
132
 
119
- /// @dev this function converts PY tokens into sy, but interests & rewards are not redeemed at the same time
133
+ /**
134
+ * @notice converts PT(+YT) tokens into SY, but interests & rewards are not redeemed at the
135
+ * same time
136
+ * @dev PT/YT must be transferred to this contract prior to calling
137
+ */
120
138
  function redeemPY(address receiver)
121
139
  external
122
140
  nonReentrant
@@ -133,9 +151,11 @@ contract PendleYieldToken is
133
151
  amountSyOut = amountSyOuts[0];
134
152
  }
135
153
 
136
- /// @dev this function limit how much each receiver will receive. For example, if the totalOut is 100,
137
- /// and the max are 50 30 INF, the first receiver will receive 50, the second will receive 30, and the third will receive 20.
138
- /// @dev intended to mostly be used by Pendle router
154
+ /**
155
+ * @notice redeems PT(+YT) for multiple users. See `redeemPY()`
156
+ * @dev PT/YT must be transferred to this contract prior to calling
157
+ * @dev fails if unable to redeem the total PY amount in `amountPYToRedeems`
158
+ */
139
159
  function redeemPYMulti(address[] calldata receivers, uint256[] calldata amountPYToRedeems)
140
160
  external
141
161
  nonReentrant
@@ -148,12 +168,15 @@ contract PendleYieldToken is
148
168
  }
149
169
 
150
170
  /**
151
- * @dev With YT yielding interest in the form of SY, which is redeemable by users, the reward
152
- distribution should be based on the amount of SYs that their YT currently represent, plus their
153
- dueInterest. It has been proven and tested that _rewardSharesUser will not change over time,
154
- unless users redeem their dueInterest or redeemPY. Due to this, it is required to update users'
155
- accruedReward STRICTLY BEFORE transferring out their interest.
156
- */
171
+ * @notice Redeems interests and rewards for `user`
172
+ * @param redeemInterest will only transfer out interest for user if true
173
+ * @param redeemRewards will only transfer out rewards for user if true
174
+ * @dev With YT yielding interest in the form of SY, which is redeemable by users, the reward
175
+ * distribution should be based on the amount of SYs that their YT currently represent, plus
176
+ * their dueInterest. It has been proven and tested that _rewardSharesUser will not change over
177
+ * time, unless users redeem their dueInterest or redeemPY. Due to this, it is required to
178
+ * update users' accruedReward STRICTLY BEFORE transferring out their interest.
179
+ */
157
180
  function redeemDueInterestAndRewards(
158
181
  address user,
159
182
  bool redeemInterest,
@@ -182,6 +205,10 @@ contract PendleYieldToken is
182
205
  }
183
206
  }
184
207
 
208
+ /**
209
+ * @dev All rewards and interests accrued post-expiry goes to the treasury.
210
+ * Reverts if called pre-expiry.
211
+ */
185
212
  function redeemInterestAndRewardsPostExpiryForTreasury()
186
213
  external
187
214
  nonReentrant
@@ -208,21 +235,46 @@ contract PendleYieldToken is
208
235
  _transferOut(SY, treasury, interestOut);
209
236
  }
210
237
 
238
+ /// @notice updates and returns the reward indexes
211
239
  function rewardIndexesCurrent() external override nonReentrant returns (uint256[] memory) {
212
240
  return IStandardizedYield(SY).rewardIndexesCurrent();
213
241
  }
214
242
 
215
- /// @dev maximize the current rate with the previous rate to guarantee non-decreasing rate
243
+ /**
244
+ * @notice updates and returns the current PY index
245
+ * @dev this function maximizes the current PY index with the previous index, guaranteeing
246
+ * non-decreasing PY index
247
+ * @dev if `doCacheIndexSameBlock` is true, PY index only updates at most once per block,
248
+ * and has no state changes on the second call onwards (within the same block).
249
+ * @dev see `pyIndexStored()` for view function for cached value.
250
+ */
216
251
  function pyIndexCurrent() public nonReentrant returns (uint256 currentIndex) {
217
252
  currentIndex = _pyIndexCurrent();
218
253
  }
219
254
 
255
+ /// @notice returns the last-updated PY index
256
+ function pyIndexStored() public view returns (uint256) {
257
+ return _pyIndexStored;
258
+ }
259
+
260
+ /**
261
+ * @notice do a final rewards redeeming, and sets post-expiry data
262
+ * @dev has no effect if called pre-expiry
263
+ */
220
264
  function setPostExpiryData() external nonReentrant {
221
265
  if (isExpired()) {
222
266
  _setPostExpiryData();
223
267
  }
224
268
  }
225
269
 
270
+ /**
271
+ * @notice returns the current data post-expiry, if exists
272
+ * @dev reverts if post-expiry data not set (see `setPostExpiryData()`)
273
+ * @return firstPYIndex the earliest PY index post-expiry
274
+ * @return totalSyInterestForTreasury current amount of SY interests post-expiry for treasury
275
+ * @return firstRewardIndexes the earliest reward indices post-expiry, for each reward token
276
+ * @return userRewardOwed amount of unclaimed user rewards, for each reward token
277
+ */
226
278
  function getPostExpiryData()
227
279
  external
228
280
  view
@@ -273,10 +325,6 @@ contract PendleYieldToken is
273
325
  }
274
326
  }
275
327
 
276
- function pyIndexStored() public view returns (uint256) {
277
- return _pyIndexStored;
278
- }
279
-
280
328
  function isExpired() public view returns (bool) {
281
329
  return MiniHelpers.isCurrentlyExpired(expiry);
282
330
  }
@@ -336,7 +384,7 @@ contract PendleYieldToken is
336
384
  }
337
385
 
338
386
  function _updateSyReserve() internal virtual {
339
- syReserve = _selfBalance(SY).Uint128();
387
+ syReserve = _selfBalance(SY);
340
388
  }
341
389
 
342
390
  function _getFloatingSyAmount() internal view returns (uint256 amount) {
@@ -369,8 +417,17 @@ contract PendleYieldToken is
369
417
  }
370
418
 
371
419
  function _pyIndexCurrent() internal returns (uint256 currentIndex) {
372
- currentIndex = Math.max(IStandardizedYield(SY).exchangeRate(), _pyIndexStored);
373
- _pyIndexStored = currentIndex.Uint128();
420
+ if (doCacheIndexSameBlock && pyIndexLastUpdatedBlock == block.number)
421
+ return _pyIndexStored;
422
+
423
+ uint128 index128 = Math
424
+ .max(IStandardizedYield(SY).exchangeRate(), _pyIndexStored)
425
+ .Uint128();
426
+
427
+ currentIndex = index128;
428
+ _pyIndexStored = index128;
429
+ pyIndexLastUpdatedBlock = uint128(block.number);
430
+
374
431
  emit NewInterestIndex(currentIndex);
375
432
  }
376
433
 
@@ -13,7 +13,7 @@ import "@openzeppelin/contracts/utils/Context.sol";
13
13
  * - comes with built-in reentrancy protection, storage-packed with totalSupply variable
14
14
  * - delete increaseAllowance / decreaseAllowance
15
15
  * - add nonReentrancy protection to transfer / transferFrom functions
16
- * - allow decimals to by passed in
16
+ * - allow decimals to be passed in
17
17
  * - block self-transfer by default
18
18
  */
19
19
  // solhint-disable
@@ -26,7 +26,7 @@ contract PendleERC20 is Context, IERC20, IERC20Metadata {
26
26
  mapping(address => mapping(address => uint256)) private _allowances;
27
27
 
28
28
  uint248 private _totalSupply;
29
- uint8 private _status;
29
+ uint8 private _status;
30
30
 
31
31
  string private _name;
32
32
  string private _symbol;
@@ -54,12 +54,9 @@ contract PendleERC20 is Context, IERC20, IERC20Metadata {
54
54
  }
55
55
 
56
56
  /**
57
- * @dev Sets the values for {name} and {symbol}.
57
+ * @dev Sets the values for {name}, {symbol} and {decimals}.
58
58
  *
59
- * The default value of {decimals} is 18. To select a different value for
60
- * {decimals} you should overload it.
61
- *
62
- * All two of these values are immutable: they can only be set once during
59
+ * All three of these values are immutable: they can only be set once during
63
60
  * construction.
64
61
  */
65
62
  constructor(
@@ -164,7 +164,7 @@ library BaseSplitCodeFactory {
164
164
  uint256 creationCodeSizeA,
165
165
  address creationCodeContractB,
166
166
  uint256 creationCodeSizeB
167
- ) public view returns (bytes memory) {
167
+ ) internal view returns (bytes memory) {
168
168
  return
169
169
  _getCreationCodeWithArgs(
170
170
  "",
@@ -1,7 +1,7 @@
1
1
  // SPDX-License-Identifier: MIT
2
2
  pragma solidity 0.8.17;
3
3
 
4
- import "@openzeppelin/contracts/proxy/utils/Initializable.sol";
4
+ import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
5
5
 
6
6
  contract BoringOwnableUpgradeableData {
7
7
  address public owner;
@@ -51,8 +51,13 @@ library Errors {
51
51
  error MarketFactoryInvalidPt();
52
52
  error MarketFactoryMarketExists();
53
53
 
54
- error MFactoryLnFeeRateRootTooHigh(uint88 lnFeeRateRoot, uint256 maxLnFeeRateRoot);
55
- error MFactoryReserveFeePercentTooHigh(uint8 reserveFeePercent, uint8 maxReserveFeePercent);
54
+ error MarketFactoryLnFeeRateRootTooHigh(uint80 lnFeeRateRoot, uint256 maxLnFeeRateRoot);
55
+ error MarketFactoryReserveFeePercentTooHigh(
56
+ uint8 reserveFeePercent,
57
+ uint8 maxReserveFeePercent
58
+ );
59
+ error MarketFactoryZeroTreasury();
60
+ error MarketFactoryInitialAnchorTooLow(int256 initialAnchor, int256 minInitialAnchor);
56
61
 
57
62
  // ROUTER
58
63
  error RouterInsufficientLpOut(uint256 actualLpOut, uint256 requiredLpOut);
@@ -85,6 +90,10 @@ library Errors {
85
90
  // YieldFactory
86
91
  error YCFactoryInvalidExpiry();
87
92
  error YCFactoryYieldContractExisted();
93
+ error YCFactoryZeroExpiryDivisor();
94
+ error YCFactoryZeroTreasury();
95
+ error YCFactoryInterestFeeRateTooHigh(uint256 interestFeeRate, uint256 maxInterestFeeRate);
96
+ error YCFactoryRewardFeeRateTooHigh(uint256 newRewardFeeRate, uint256 maxRewardFeeRate);
88
97
 
89
98
  // SY
90
99
  error SYInvalidTokenIn(address token);
@@ -119,6 +128,7 @@ library Errors {
119
128
  error VEPositionNotExpired();
120
129
  error VEZeroPosition();
121
130
  error VEZeroSlope(uint128 bias, uint128 slope);
131
+ error VEReceiveOldSupply(uint256 msgTime);
122
132
 
123
133
  error GCNotPendleMarket(address caller);
124
134
  error GCNotVotingController(address caller);
@@ -10,7 +10,7 @@ interface IBooster {
10
10
  external
11
11
  view
12
12
  returns (
13
- address,
13
+ address lpToken,
14
14
  address,
15
15
  address,
16
16
  address,
@@ -22,20 +22,19 @@ interface ICrvPool {
22
22
  int128 i,
23
23
  int128 j,
24
24
  uint256 dx,
25
- uint256 min_dy, // The amount of i being exchanged.
26
- address _receiver
25
+ uint256 min_dy // The amount of i being exchanged.
27
26
  ) external returns (uint256);
28
27
 
29
28
  function add_liquidity(
30
29
  uint256[2] memory _deposit_amount,
31
30
  uint256 _min_amount
32
- ) external;
31
+ ) external returns (uint256 lpOut);
33
32
 
34
33
  function remove_liquidity_one_coin(
35
34
  uint256 _burn_amount,
36
35
  int128 i,
37
36
  uint256 _min_amount
38
- ) external;
37
+ ) external returns (uint256 tokenOut);
39
38
 
40
39
  function calc_token_amount(uint256[2] memory _amounts, bool _is_deposit)
41
40
  external
@@ -0,0 +1,41 @@
1
+ // SPDX-License-Identifier: GPL-3.0-or-later
2
+ pragma solidity 0.8.17;
3
+
4
+ interface ITriCrvPool {
5
+ function coins(uint256 i) external view returns (address);
6
+
7
+ function get_virtual_price() external view returns (uint256);
8
+
9
+ function lp_token() external view returns (address);
10
+
11
+ function fee() external view returns (uint256);
12
+
13
+ function admin_fee() external view returns (uint256);
14
+
15
+ function exchange(
16
+ int128 i,
17
+ int128 j,
18
+ uint256 dx,
19
+ uint256 min_dy // The amount of i being exchanged.
20
+ ) external returns (uint256);
21
+
22
+ function add_liquidity(
23
+ uint256[3] memory _deposit_amount,
24
+ uint256 _min_amount
25
+ ) external;
26
+
27
+ function remove_liquidity_one_coin(
28
+ uint256 _burn_amount,
29
+ int128 i,
30
+ uint256 _min_amount
31
+ ) external;
32
+
33
+ function calc_withdraw_one_coin(uint256 _burn_amount, int128 i)
34
+ external
35
+ view
36
+ returns (uint256);
37
+
38
+ function balances(uint256 i) external view returns (uint256);
39
+
40
+ function A() external view returns (uint256);
41
+ }
@@ -30,7 +30,7 @@ interface IERC4626 is IERC20Metadata {
30
30
  function deposit(uint256 assets, address receiver) external returns (uint256);
31
31
 
32
32
  function redeem(
33
- uint256 assets,
33
+ uint256 shares,
34
34
  address receiver,
35
35
  address owner
36
36
  ) external returns (uint256);
@@ -0,0 +1,5 @@
1
+ pragma solidity 0.8.17;
2
+
3
+ interface ILooksFeeSharing {
4
+ function calculateSharesValueInLOOKS(address user) external view returns (uint256);
5
+ }
@@ -0,0 +1,13 @@
1
+ pragma solidity 0.8.17;
2
+
3
+ interface ILooksStaking {
4
+ function totalShares() external view returns (uint256);
5
+
6
+ function deposit(uint256 amount) external;
7
+
8
+ function userInfo(address user) external view returns (uint256);
9
+
10
+ function withdraw(uint256 shares) external;
11
+
12
+ function harvestAndSellAndCompound() external;
13
+ }
@@ -17,8 +17,8 @@ interface IPActionAddRemoveLiq {
17
17
  event AddLiquidityDualTokenAndPt(
18
18
  address indexed caller,
19
19
  address indexed market,
20
- address indexed receiver,
21
- address tokenIn,
20
+ address indexed tokenIn,
21
+ address receiver,
22
22
  uint256 netTokenUsed,
23
23
  uint256 netPtUsed,
24
24
  uint256 netLpOut
@@ -61,10 +61,10 @@ interface IPActionAddRemoveLiq {
61
61
  event RemoveLiquidityDualTokenAndPt(
62
62
  address indexed caller,
63
63
  address indexed market,
64
- address indexed receiver,
64
+ address indexed tokenOut,
65
+ address receiver,
65
66
  uint256 netLpToRemove,
66
67
  uint256 netPtOut,
67
- address tokenOut,
68
68
  uint256 netTokenOut
69
69
  );
70
70
 
@@ -7,19 +7,19 @@ import "../router/kyberswap/KyberSwapHelper.sol";
7
7
  interface IPActionMintRedeem {
8
8
  event MintSyFromToken(
9
9
  address indexed caller,
10
- address indexed receiver,
10
+ address indexed tokenIn,
11
11
  address indexed SY,
12
- address tokenIn,
12
+ address receiver,
13
13
  uint256 netTokenIn,
14
14
  uint256 netSyOut
15
15
  );
16
16
 
17
17
  event RedeemSyToToken(
18
18
  address indexed caller,
19
- address indexed receiver,
19
+ address indexed tokenOut,
20
20
  address indexed SY,
21
+ address receiver,
21
22
  uint256 netSyIn,
22
- address tokenOut,
23
23
  uint256 netTokenOut
24
24
  );
25
25
 
@@ -41,19 +41,19 @@ interface IPActionMintRedeem {
41
41
 
42
42
  event MintPyFromToken(
43
43
  address indexed caller,
44
- address indexed receiver,
44
+ address indexed tokenIn,
45
45
  address indexed YT,
46
- address tokenIn,
46
+ address receiver,
47
47
  uint256 netTokenIn,
48
48
  uint256 netPyOut
49
49
  );
50
50
 
51
51
  event RedeemPyToToken(
52
52
  address indexed caller,
53
- address indexed receiver,
53
+ address indexed tokenOut,
54
54
  address indexed YT,
55
+ address receiver,
55
56
  uint256 netPyIn,
56
- address tokenOut,
57
57
  uint256 netTokenOut
58
58
  );
59
59
 
@@ -16,8 +16,8 @@ interface IPActionSwapYT {
16
16
  event SwapYtAndToken(
17
17
  address indexed caller,
18
18
  address indexed market,
19
- address indexed receiver,
20
- address token,
19
+ address indexed token,
20
+ address receiver,
21
21
  int256 netYtToAccount,
22
22
  int256 netTokenToAccount
23
23
  );
@@ -24,7 +24,13 @@ interface IPMarket is IERC20Metadata, IPGauge {
24
24
  uint256 netPtOut
25
25
  );
26
26
 
27
- event Swap(address indexed receiver, int256 netPtOut, int256 netSyOut, uint256 netSyToReserve);
27
+ event Swap(
28
+ address indexed receiver,
29
+ int256 netPtOut,
30
+ int256 netSyOut,
31
+ uint256 netSyFee,
32
+ uint256 netSyToReserve
33
+ );
28
34
 
29
35
  event UpdateImpliedRate(uint256 indexed timestamp, uint256 lnLastImpliedRate);
30
36
 
@@ -55,17 +61,27 @@ interface IPMarket is IERC20Metadata, IPGauge {
55
61
  address receiver,
56
62
  uint256 exactPtIn,
57
63
  bytes calldata data
58
- ) external returns (uint256 netSyOut, uint256 netSyToReserve);
64
+ )
65
+ external
66
+ returns (
67
+ uint256 netSyOut,
68
+ uint256 netSyFee
69
+ );
59
70
 
60
71
  function swapSyForExactPt(
61
72
  address receiver,
62
73
  uint256 exactPtOut,
63
74
  bytes calldata data
64
- ) external returns (uint256 netSyIn, uint256 netSyToReserve);
75
+ )
76
+ external
77
+ returns (
78
+ uint256 netSyIn,
79
+ uint256 netSyFee
80
+ );
65
81
 
66
82
  function redeemRewards(address user) external returns (uint256[] memory);
67
83
 
68
- function readState() external view returns (MarketState memory market);
84
+ function readState(address router) external view returns (MarketState memory market);
69
85
 
70
86
  function observe(uint32[] memory secondsAgos)
71
87
  external
@@ -2,7 +2,19 @@
2
2
  pragma solidity 0.8.17;
3
3
 
4
4
  interface IPMarketFactory {
5
- event NewMarketConfig(address indexed treasury, uint96 lnFeeRateRoot, uint8 reserveFeePercent);
5
+ struct FeeConfig {
6
+ uint80 lnFeeRateRoot;
7
+ uint8 reserveFeePercent;
8
+ bool active;
9
+ }
10
+
11
+ event NewMarketConfig(
12
+ address indexed treasury,
13
+ uint80 defaultLnFeeRateRoot,
14
+ uint8 reserveFeePercent
15
+ );
16
+ event SetOverriddenFee(address indexed router, uint80 lnFeeRateRoot, uint8 reserveFeePercent);
17
+ event UnsetOverriddenFee(address indexed router);
6
18
 
7
19
  event CreateNewMarket(
8
20
  address indexed market,
@@ -13,15 +25,13 @@ interface IPMarketFactory {
13
25
 
14
26
  function isValidMarket(address market) external view returns (bool);
15
27
 
16
- function treasury() external view returns (address);
17
-
18
28
  // If this is changed, change the readState function in market as well
19
- function marketConfig()
29
+ function getMarketConfig(address router)
20
30
  external
21
31
  view
22
32
  returns (
23
33
  address treasury,
24
- uint88 lnFeeRateRoot,
34
+ uint80 lnFeeRateRoot,
25
35
  uint8 reserveFeePercent
26
36
  );
27
37
  }