@pendle/core-v2 0.16.5-testnet → 0.17.0-daily

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 (349) 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/LiquidityMining/libraries/WeekMath.sol/WeekMath.dbg.json +1 -1
  33. package/build/artifacts/contracts/LiquidityMining/libraries/WeekMath.sol/WeekMath.json +2 -2
  34. package/build/artifacts/contracts/core/BulkSeller/BulkSeller.sol/BulkSeller.dbg.json +1 -1
  35. package/build/artifacts/contracts/core/BulkSeller/BulkSeller.sol/BulkSeller.json +7 -54
  36. package/build/artifacts/contracts/core/BulkSeller/BulkSellerFactory.sol/BulkSellerFactory.dbg.json +1 -1
  37. package/build/artifacts/contracts/core/BulkSeller/BulkSellerFactory.sol/BulkSellerFactory.json +27 -2
  38. package/build/artifacts/contracts/core/BulkSeller/BulkSellerMathCore.sol/BulkSellerMathCore.dbg.json +1 -1
  39. package/build/artifacts/contracts/core/BulkSeller/BulkSellerMathCore.sol/BulkSellerMathCore.json +2 -2
  40. package/build/artifacts/contracts/core/Market/MarketMathCore.sol/MarketMathCore.dbg.json +1 -1
  41. package/build/artifacts/contracts/core/Market/MarketMathCore.sol/MarketMathCore.json +2 -2
  42. package/build/artifacts/contracts/core/Market/OracleLib.sol/OracleLib.dbg.json +1 -1
  43. package/build/artifacts/contracts/core/Market/OracleLib.sol/OracleLib.json +2 -2
  44. package/build/artifacts/contracts/core/Market/PendleGauge.sol/PendleGauge.dbg.json +1 -1
  45. package/build/artifacts/contracts/core/Market/PendleMarket.sol/PendleMarket.dbg.json +1 -1
  46. package/build/artifacts/contracts/core/Market/PendleMarket.sol/PendleMarket.json +25 -13
  47. package/build/artifacts/contracts/core/Market/PendleMarketFactory.sol/PendleMarketFactory.dbg.json +1 -1
  48. package/build/artifacts/contracts/core/Market/PendleMarketFactory.sol/PendleMarketFactory.json +221 -50
  49. package/build/artifacts/contracts/core/StandardizedYield/PYIndex.sol/PYIndexLib.dbg.json +1 -1
  50. package/build/artifacts/contracts/core/StandardizedYield/PYIndex.sol/PYIndexLib.json +2 -2
  51. package/build/artifacts/contracts/core/StandardizedYield/SYBase.sol/SYBase.dbg.json +1 -1
  52. package/build/artifacts/contracts/core/StandardizedYield/SYBase.sol/SYBase.json +141 -0
  53. package/build/artifacts/contracts/core/StandardizedYield/SYBaseWithRewards.sol/SYBaseWithRewards.dbg.json +1 -1
  54. package/build/artifacts/contracts/core/StandardizedYield/SYBaseWithRewards.sol/SYBaseWithRewards.json +141 -0
  55. package/build/artifacts/contracts/core/StandardizedYield/implementations/BenQi/PendleQiTokenHelper.sol/PendleQiTokenHelper.dbg.json +1 -1
  56. package/build/artifacts/contracts/core/StandardizedYield/implementations/BenQi/PendleQiTokenHelper.sol/PendleQiTokenHelper.json +2 -2
  57. package/build/artifacts/contracts/core/StandardizedYield/implementations/BenQi/PendleQiTokenSY.sol/PendleQiTokenSY.dbg.json +1 -1
  58. package/build/artifacts/contracts/core/StandardizedYield/implementations/BenQi/PendleQiTokenSY.sol/PendleQiTokenSY.json +143 -2
  59. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/PendleCurveFraxUsdcSY.sol/PendleCurveFraxUsdcSY.dbg.json +4 -0
  60. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/PendleCurveFraxUsdcSY.sol/PendleCurveFraxUsdcSY.json +1144 -0
  61. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/PendleCurveUsdd3CrvSY.sol/PendleCurveUsdd3CrvSY.dbg.json +4 -0
  62. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/PendleCurveUsdd3CrvSY.sol/PendleCurveUsdd3CrvSY.json +1209 -0
  63. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/Curve3CrvPoolHelper.sol/Curve3CrvPoolHelper.dbg.json +4 -0
  64. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/Curve3CrvPoolHelper.sol/Curve3CrvPoolHelper.json +10 -0
  65. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/CurveFraxUsdcPoolHelper.sol/CurveFraxUsdcPoolHelper.dbg.json +1 -1
  66. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/CurveFraxUsdcPoolHelper.sol/CurveFraxUsdcPoolHelper.json +3 -82
  67. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/CurveUsdd3CrvPoolHelper.sol/CurveUsdd3CrvPoolHelper.dbg.json +4 -0
  68. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/CurveUsdd3CrvPoolHelper.sol/CurveUsdd3CrvPoolHelper.json +10 -0
  69. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/PendleConvexLPSY.sol/PendleConvexLPSY.dbg.json +4 -0
  70. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/{ConvexCurveLP → base}/PendleConvexLPSY.sol/PendleConvexLPSY.json +142 -1
  71. package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleLooksStakingSY.sol/PendleLooksStakingSY.dbg.json +4 -0
  72. package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleLooksStakingSY.sol/PendleLooksStakingSY.json +997 -0
  73. package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleWstEthSY.sol/PendleWstEthSY.dbg.json +1 -1
  74. package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleWstEthSY.sol/PendleWstEthSY.json +143 -2
  75. package/build/artifacts/contracts/core/YieldContracts/InterestManagerYT.sol/InterestManagerYT.dbg.json +1 -1
  76. package/build/artifacts/contracts/core/YieldContracts/PendlePrincipalToken.sol/PendlePrincipalToken.dbg.json +1 -1
  77. package/build/artifacts/contracts/core/YieldContracts/PendlePrincipalToken.sol/PendlePrincipalToken.json +2 -2
  78. package/build/artifacts/contracts/core/YieldContracts/PendleYieldContractFactory.sol/PendleYieldContractFactory.dbg.json +1 -1
  79. package/build/artifacts/contracts/core/YieldContracts/PendleYieldContractFactory.sol/PendleYieldContractFactory.json +83 -10
  80. package/build/artifacts/contracts/core/YieldContracts/PendleYieldToken.sol/PendleYieldToken.dbg.json +1 -1
  81. package/build/artifacts/contracts/core/YieldContracts/PendleYieldToken.sol/PendleYieldToken.json +35 -4
  82. package/build/artifacts/contracts/core/erc20/PendleERC20.sol/PendleERC20.dbg.json +1 -1
  83. package/build/artifacts/contracts/core/erc20/PendleERC20.sol/PendleERC20.json +2 -2
  84. package/build/artifacts/contracts/core/erc20/PendleERC20Permit.sol/PendleERC20Permit.dbg.json +1 -1
  85. package/build/artifacts/contracts/core/erc20/PendleERC20Permit.sol/PendleERC20Permit.json +2 -2
  86. package/build/artifacts/contracts/core/libraries/BaseSplitCodeFactory.sol/BaseSplitCodeFactory.dbg.json +1 -1
  87. package/build/artifacts/contracts/core/libraries/BaseSplitCodeFactory.sol/BaseSplitCodeFactory.json +3 -38
  88. package/build/artifacts/contracts/core/libraries/BaseSplitCodeFactory.sol/CodeDeployer.dbg.json +1 -1
  89. package/build/artifacts/contracts/core/libraries/BaseSplitCodeFactory.sol/CodeDeployer.json +2 -2
  90. package/build/artifacts/contracts/core/libraries/BoringOwnableUpgradeable.sol/BoringOwnableUpgradeable.dbg.json +1 -1
  91. package/build/artifacts/contracts/core/libraries/BoringOwnableUpgradeable.sol/BoringOwnableUpgradeableData.dbg.json +1 -1
  92. package/build/artifacts/contracts/core/libraries/BoringOwnableUpgradeable.sol/BoringOwnableUpgradeableData.json +2 -2
  93. package/build/artifacts/contracts/core/libraries/Errors.sol/Errors.dbg.json +1 -1
  94. package/build/artifacts/contracts/core/libraries/Errors.sol/Errors.json +131 -31
  95. package/build/artifacts/contracts/interfaces/ConvexCurve/IBooster.sol/IBooster.dbg.json +1 -1
  96. package/build/artifacts/contracts/interfaces/ConvexCurve/IBooster.sol/IBooster.json +1 -1
  97. package/build/artifacts/contracts/interfaces/Curve/ICrvPool.sol/ICrvPool.dbg.json +1 -1
  98. package/build/artifacts/contracts/interfaces/Curve/ICrvPool.sol/ICrvPool.json +14 -7
  99. package/build/artifacts/contracts/interfaces/Curve/ITriCrvPool.sol/ITriCrvPool.dbg.json +4 -0
  100. package/build/artifacts/contracts/interfaces/Curve/ITriCrvPool.sol/ITriCrvPool.json +213 -0
  101. package/build/artifacts/contracts/interfaces/IERC4626.sol/IERC4626.dbg.json +1 -1
  102. package/build/artifacts/contracts/interfaces/IERC4626.sol/IERC4626.json +1 -1
  103. package/build/artifacts/contracts/interfaces/ILooksFeeSharing.sol/ILooksFeeSharing.dbg.json +4 -0
  104. package/build/artifacts/contracts/interfaces/ILooksFeeSharing.sol/ILooksFeeSharing.json +30 -0
  105. package/build/artifacts/contracts/interfaces/ILooksStaking.sol/ILooksStaking.dbg.json +4 -0
  106. package/build/artifacts/contracts/interfaces/ILooksStaking.sol/ILooksStaking.json +76 -0
  107. package/build/artifacts/contracts/interfaces/IPActionAddRemoveLiq.sol/IPActionAddRemoveLiq.dbg.json +1 -1
  108. package/build/artifacts/contracts/interfaces/IPActionAddRemoveLiq.sol/IPActionAddRemoveLiq.json +8 -8
  109. package/build/artifacts/contracts/interfaces/IPActionMintRedeem.sol/IPActionMintRedeem.dbg.json +1 -1
  110. package/build/artifacts/contracts/interfaces/IPActionMintRedeem.sol/IPActionMintRedeem.json +18 -18
  111. package/build/artifacts/contracts/interfaces/IPActionSwapPT.sol/IPActionSwapPT.dbg.json +1 -1
  112. package/build/artifacts/contracts/interfaces/IPActionSwapPTYT.sol/IPActionSwapPTYT.dbg.json +1 -1
  113. package/build/artifacts/contracts/interfaces/IPActionSwapYT.sol/IPActionSwapYT.dbg.json +1 -1
  114. package/build/artifacts/contracts/interfaces/IPActionSwapYT.sol/IPActionSwapYT.json +2 -2
  115. package/build/artifacts/contracts/interfaces/IPAllAction.sol/IPAllAction.dbg.json +1 -1
  116. package/build/artifacts/contracts/interfaces/IPAllAction.sol/IPAllAction.json +28 -28
  117. package/build/artifacts/contracts/interfaces/IPBulkSeller.sol/IPBulkSeller.dbg.json +1 -1
  118. package/build/artifacts/contracts/interfaces/IPBulkSeller.sol/IPBulkSeller.json +0 -38
  119. package/build/artifacts/contracts/interfaces/IPBulkSellerFactory.sol/IPBulkSellerFactory.dbg.json +1 -1
  120. package/build/artifacts/contracts/interfaces/IPBulkSellerFactory.sol/IPBulkSellerFactory.json +25 -0
  121. package/build/artifacts/contracts/interfaces/IPMarket.sol/IPMarket.dbg.json +1 -1
  122. package/build/artifacts/contracts/interfaces/IPMarket.sol/IPMarket.json +17 -5
  123. package/build/artifacts/contracts/interfaces/IPMarketFactory.sol/IPMarketFactory.dbg.json +1 -1
  124. package/build/artifacts/contracts/interfaces/IPMarketFactory.sol/IPMarketFactory.json +50 -19
  125. package/build/artifacts/contracts/interfaces/IPMsgSendEndpoint.sol/IPMsgSendEndpoint.dbg.json +1 -1
  126. package/build/artifacts/contracts/interfaces/IPMsgSendEndpoint.sol/IPMsgSendEndpoint.json +1 -1
  127. package/build/artifacts/contracts/interfaces/IPVotingController.sol/IPVotingController.dbg.json +1 -1
  128. package/build/artifacts/contracts/interfaces/IPVotingEscrowMainchain.sol/IPVotingEscrowMainchain.dbg.json +1 -1
  129. package/build/artifacts/contracts/interfaces/IPYieldContractFactory.sol/IPYieldContractFactory.dbg.json +1 -1
  130. package/build/artifacts/contracts/interfaces/IPYieldContractFactory.sol/IPYieldContractFactory.json +7 -7
  131. package/build/artifacts/contracts/interfaces/IPYieldToken.sol/IPYieldToken.dbg.json +1 -1
  132. package/build/artifacts/contracts/interfaces/IPYieldToken.sol/IPYieldToken.json +13 -0
  133. package/build/artifacts/contracts/interfaces/IStandardizedYield.sol/IStandardizedYield.dbg.json +1 -1
  134. package/build/artifacts/contracts/offchain-helpers/BaseSplitCodeFactoryContract.sol/BaseSplitCodeFactoryContract.dbg.json +1 -1
  135. package/build/artifacts/contracts/offchain-helpers/BaseSplitCodeFactoryContract.sol/BaseSplitCodeFactoryContract.json +2 -2
  136. package/build/artifacts/contracts/offchain-helpers/BulkSellerOffchain.sol/BulkSellerOffchain.dbg.json +1 -1
  137. package/build/artifacts/contracts/offchain-helpers/BulkSellerOffchain.sol/BulkSellerOffchain.json +71 -13
  138. package/build/artifacts/contracts/offchain-helpers/MarketMathStatic.sol/MarketMathStatic.dbg.json +1 -1
  139. package/build/artifacts/contracts/offchain-helpers/MarketMathStatic.sol/MarketMathStatic.json +28 -46
  140. package/build/artifacts/contracts/offchain-helpers/RouterStatic.sol/RouterStatic.dbg.json +1 -1
  141. package/build/artifacts/contracts/offchain-helpers/RouterStatic.sol/RouterStatic.json +138 -62
  142. package/build/artifacts/contracts/router/ActionAddRemoveLiq.sol/ActionAddRemoveLiq.dbg.json +1 -1
  143. package/build/artifacts/contracts/router/ActionAddRemoveLiq.sol/ActionAddRemoveLiq.json +37 -11
  144. package/build/artifacts/contracts/router/ActionCallback.sol/ActionCallback.dbg.json +1 -1
  145. package/build/artifacts/contracts/router/ActionCallback.sol/ActionCallback.json +2 -2
  146. package/build/artifacts/contracts/router/ActionMintRedeem.sol/ActionMintRedeem.dbg.json +1 -1
  147. package/build/artifacts/contracts/router/ActionMintRedeem.sol/ActionMintRedeem.json +20 -20
  148. package/build/artifacts/contracts/router/ActionMisc.sol/ActionMisc.dbg.json +1 -1
  149. package/build/artifacts/contracts/router/ActionMisc.sol/ActionMisc.json +2 -2
  150. package/build/artifacts/contracts/router/ActionSwapPT.sol/ActionSwapPT.dbg.json +1 -1
  151. package/build/artifacts/contracts/router/ActionSwapPT.sol/ActionSwapPT.json +28 -2
  152. package/build/artifacts/contracts/router/ActionSwapPTYT.sol/ActionSwapPTYT.dbg.json +1 -1
  153. package/build/artifacts/contracts/router/ActionSwapPTYT.sol/ActionSwapPTYT.json +29 -3
  154. package/build/artifacts/contracts/router/ActionSwapYT.sol/ActionSwapYT.dbg.json +1 -1
  155. package/build/artifacts/contracts/router/ActionSwapYT.sol/ActionSwapYT.json +30 -4
  156. package/build/artifacts/contracts/router/PendleRouter.sol/PendleRouter.dbg.json +1 -1
  157. package/build/artifacts/contracts/router/PendleRouter.sol/PendleRouter.json +2 -186
  158. package/build/artifacts/contracts/router/base/ActionBaseMintRedeem.sol/ActionBaseMintRedeem.dbg.json +1 -1
  159. package/build/artifacts/contracts/router/base/MarketApproxLib.sol/MarketApproxPtInLib.dbg.json +1 -1
  160. package/build/artifacts/contracts/router/base/MarketApproxLib.sol/MarketApproxPtInLib.json +2 -2
  161. package/build/artifacts/contracts/router/base/MarketApproxLib.sol/MarketApproxPtOutLib.dbg.json +1 -1
  162. package/build/artifacts/contracts/router/base/MarketApproxLib.sol/MarketApproxPtOutLib.json +2 -2
  163. package/build/artifacts/contracts/router/kyberswap/AggregationRouterHelper.sol/AggregationRouterHelper.dbg.json +1 -1
  164. package/build/artifacts/contracts/router/kyberswap/AggregationRouterHelper.sol/AggregationRouterHelper.json +2 -2
  165. package/build/artifacts/contracts/router/kyberswap/KyberSwapHelper.sol/KyberSwapHelper.dbg.json +1 -1
  166. package/contracts/LiquidityMining/CrossChainMsg/PendleMsgSenderAppUpg.sol +1 -1
  167. package/contracts/LiquidityMining/GaugeController/PendleGaugeControllerBaseUpg.sol +1 -1
  168. package/contracts/LiquidityMining/VotingController/PendleVotingControllerUpg.sol +3 -6
  169. package/contracts/LiquidityMining/VotingController/VotingControllerStorageUpg.sol +1 -1
  170. package/contracts/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol +7 -4
  171. package/contracts/LiquidityMining/VotingEscrow/VotingEscrowPendleSidechain.sol +10 -5
  172. package/contracts/LiquidityMining/VotingEscrow/VotingEscrowTokenBase.sol +3 -6
  173. package/contracts/LiquidityMining/libraries/VeHistoryLib.sol +0 -5
  174. package/contracts/LiquidityMining/libraries/WeekMath.sol +1 -1
  175. package/contracts/core/BulkSeller/BulkSeller.sol +0 -15
  176. package/contracts/core/BulkSeller/BulkSellerFactory.sol +7 -6
  177. package/contracts/core/Market/MarketMathCore.sol +52 -11
  178. package/contracts/core/Market/PendleMarket.sol +35 -22
  179. package/contracts/core/Market/PendleMarketFactory.sol +67 -35
  180. package/contracts/core/StandardizedYield/SYBase.sol +26 -3
  181. package/contracts/core/StandardizedYield/SYBaseWithRewards.sol +3 -1
  182. package/contracts/core/StandardizedYield/implementations/Convex/PendleCurveFraxUsdcSY.sol +102 -0
  183. package/contracts/core/StandardizedYield/implementations/Convex/PendleCurveUsdd3CrvSY.sol +160 -0
  184. package/contracts/core/StandardizedYield/implementations/Convex/README.md +29 -0
  185. package/contracts/core/StandardizedYield/implementations/Convex/base/Curve3CrvPoolHelper.sol +215 -0
  186. package/contracts/core/StandardizedYield/implementations/Convex/base/CurveFraxUsdcPoolHelper.sol +46 -26
  187. package/contracts/core/StandardizedYield/implementations/Convex/base/CurveUsdd3CrvPoolHelper.sol +152 -0
  188. package/contracts/core/StandardizedYield/implementations/Convex/{ConvexCurveLP → base}/PendleConvexLPSY.sol +0 -0
  189. package/contracts/core/StandardizedYield/implementations/PendleLooksStakingSY.sol +128 -0
  190. package/contracts/core/YieldContracts/PendlePrincipalToken.sol +3 -3
  191. package/contracts/core/YieldContracts/PendleYieldContractFactory.sol +30 -12
  192. package/contracts/core/YieldContracts/PendleYieldToken.sol +79 -22
  193. package/contracts/core/erc20/PendleERC20.sol +4 -7
  194. package/contracts/core/libraries/BaseSplitCodeFactory.sol +1 -1
  195. package/contracts/core/libraries/BoringOwnableUpgradeable.sol +1 -1
  196. package/contracts/core/libraries/Errors.sol +18 -2
  197. package/contracts/interfaces/ConvexCurve/IBooster.sol +1 -1
  198. package/contracts/interfaces/Curve/ICrvPool.sol +3 -4
  199. package/contracts/interfaces/Curve/ITriCrvPool.sol +41 -0
  200. package/contracts/interfaces/IERC4626.sol +1 -1
  201. package/contracts/interfaces/ILooksFeeSharing.sol +5 -0
  202. package/contracts/interfaces/ILooksStaking.sol +13 -0
  203. package/contracts/interfaces/IPActionAddRemoveLiq.sol +4 -4
  204. package/contracts/interfaces/IPActionMintRedeem.sol +8 -8
  205. package/contracts/interfaces/IPActionSwapYT.sol +2 -2
  206. package/contracts/interfaces/IPBulkSeller.sol +0 -4
  207. package/contracts/interfaces/IPMarket.sol +20 -4
  208. package/contracts/interfaces/IPMarketFactory.sol +15 -5
  209. package/contracts/interfaces/IPMsgSendEndpoint.sol +1 -1
  210. package/contracts/interfaces/IPYieldContractFactory.sol +2 -2
  211. package/contracts/interfaces/IPYieldToken.sol +2 -0
  212. package/contracts/interfaces/IStandardizedYield.sol +15 -10
  213. package/contracts/offchain-helpers/BulkSellerOffchain.sol +17 -8
  214. package/contracts/offchain-helpers/MarketMathStatic.sol +35 -96
  215. package/contracts/offchain-helpers/RouterStatic.sol +49 -9
  216. package/contracts/router/ActionAddRemoveLiq.sol +102 -10
  217. package/contracts/router/ActionMintRedeem.sol +44 -4
  218. package/contracts/router/ActionSwapPT.sol +41 -11
  219. package/contracts/router/ActionSwapPTYT.sol +32 -7
  220. package/contracts/router/ActionSwapYT.sol +49 -33
  221. package/contracts/router/PendleRouter.sol +3 -11
  222. package/contracts/router/base/MarketApproxLib.sol +65 -22
  223. package/deployments/43113-core.json +19 -14
  224. package/deployments/43113-markets/WETH-FEB-2ND.json +10 -0
  225. package/package.json +7 -7
  226. package/typechain-types/AccessControlUpgradeable.ts +369 -0
  227. package/typechain-types/ActionAddRemoveLiq.ts +18 -18
  228. package/typechain-types/ActionMintRedeem.ts +30 -30
  229. package/typechain-types/ActionSwapPTYT.ts +5 -5
  230. package/typechain-types/ActionSwapYT.ts +5 -5
  231. package/typechain-types/BulkSeller.ts +5 -91
  232. package/typechain-types/BulkSellerFactory.ts +21 -0
  233. package/typechain-types/BulkSellerOffchain.ts +134 -0
  234. package/typechain-types/ContextUpgradeable.ts +68 -0
  235. package/typechain-types/ERC165Upgradeable.ts +113 -0
  236. package/typechain-types/IAccessControlUpgradeable.ts +305 -0
  237. package/typechain-types/IBooster.ts +9 -3
  238. package/typechain-types/ICrvPool.ts +4 -9
  239. package/typechain-types/IERC165Upgradeable.ts +102 -0
  240. package/typechain-types/IERC4626.ts +5 -5
  241. package/typechain-types/ILooksStaking.ts +27 -0
  242. package/typechain-types/IPActionAddRemoveLiq.ts +13 -13
  243. package/typechain-types/IPActionMintRedeem.ts +30 -30
  244. package/typechain-types/IPActionSwapYT.ts +5 -5
  245. package/typechain-types/IPAllAction.ts +48 -48
  246. package/typechain-types/IPBulkSeller.ts +0 -68
  247. package/typechain-types/IPBulkSellerFactory.ts +21 -0
  248. package/typechain-types/IPMarket.ts +26 -16
  249. package/typechain-types/IPMarketFactory.ts +70 -37
  250. package/typechain-types/IPMsgSendEndpoint.ts +1 -1
  251. package/typechain-types/IPYieldContractFactory.ts +11 -11
  252. package/typechain-types/IPYieldToken.ts +21 -0
  253. package/typechain-types/MarketMathStatic.ts +0 -67
  254. package/typechain-types/Pausable.ts +101 -0
  255. package/typechain-types/PendleConvexLPSY.ts +204 -0
  256. package/typechain-types/PendleCurveFraxUsdcSY.ts +204 -0
  257. package/typechain-types/PendleCurveUsdd3CrvSY.ts +204 -0
  258. package/typechain-types/PendleLooksStakingSY.ts +1256 -0
  259. package/typechain-types/PendleMarket.ts +26 -16
  260. package/typechain-types/PendleMarketFactory.ts +316 -92
  261. package/typechain-types/PendleQiTokenSY.ts +204 -0
  262. package/typechain-types/PendleRouter.ts +3 -287
  263. package/typechain-types/PendleWstEthSY.ts +204 -0
  264. package/typechain-types/PendleYieldContractFactory.ts +63 -18
  265. package/typechain-types/PendleYieldToken.ts +42 -0
  266. package/typechain-types/RouterStatic.ts +65 -7
  267. package/typechain-types/SYBase.ts +204 -0
  268. package/typechain-types/SYBaseWithRewards.ts +204 -0
  269. package/typechain-types/VotingEscrowPendleSidechain.ts +8 -8
  270. package/typechain-types/VotingEscrowTokenBase.ts +0 -21
  271. package/typechain-types/factories/AccessControlUpgradeable__factory.ts +247 -0
  272. package/typechain-types/factories/ActionAddRemoveLiq__factory.ts +36 -10
  273. package/typechain-types/factories/ActionCallback__factory.ts +1 -1
  274. package/typechain-types/factories/ActionMintRedeem__factory.ts +19 -19
  275. package/typechain-types/factories/ActionMisc__factory.ts +1 -1
  276. package/typechain-types/factories/ActionSwapPTYT__factory.ts +28 -2
  277. package/typechain-types/factories/ActionSwapPT__factory.ts +27 -1
  278. package/typechain-types/factories/ActionSwapYT__factory.ts +29 -3
  279. package/typechain-types/factories/AggregationRouterHelper__factory.ts +1 -1
  280. package/typechain-types/factories/BaseSplitCodeFactoryContract__factory.ts +1 -1
  281. package/typechain-types/factories/BoringOwnableUpgradeableData__factory.ts +1 -1
  282. package/typechain-types/factories/BulkSellerFactory__factory.ts +26 -1
  283. package/typechain-types/factories/BulkSellerOffchain__factory.ts +70 -12
  284. package/typechain-types/factories/BulkSeller__factory.ts +6 -53
  285. package/typechain-types/factories/ContextUpgradeable__factory.ts +39 -0
  286. package/typechain-types/factories/ERC165Upgradeable__factory.ts +58 -0
  287. package/typechain-types/factories/Errors__factory.ts +130 -30
  288. package/typechain-types/factories/IAccessControlUpgradeable__factory.ts +202 -0
  289. package/typechain-types/factories/IBooster__factory.ts +1 -1
  290. package/typechain-types/factories/ICrvPool__factory.ts +14 -7
  291. package/typechain-types/factories/IERC165Upgradeable__factory.ts +45 -0
  292. package/typechain-types/factories/IERC4626__factory.ts +1 -1
  293. package/typechain-types/factories/ILooksStaking__factory.ts +7 -0
  294. package/typechain-types/factories/IPActionAddRemoveLiq__factory.ts +8 -8
  295. package/typechain-types/factories/IPActionMintRedeem__factory.ts +18 -18
  296. package/typechain-types/factories/IPActionSwapYT__factory.ts +2 -2
  297. package/typechain-types/factories/IPAllAction__factory.ts +28 -28
  298. package/typechain-types/factories/IPBulkSellerFactory__factory.ts +25 -0
  299. package/typechain-types/factories/IPBulkSeller__factory.ts +0 -38
  300. package/typechain-types/factories/IPMarketFactory__factory.ts +50 -19
  301. package/typechain-types/factories/IPMarket__factory.ts +17 -5
  302. package/typechain-types/factories/IPMsgSendEndpoint__factory.ts +1 -1
  303. package/typechain-types/factories/IPYieldContractFactory__factory.ts +7 -7
  304. package/typechain-types/factories/IPYieldToken__factory.ts +13 -0
  305. package/typechain-types/factories/ImplicitSwapfeeContract__factory.ts +1 -1
  306. package/typechain-types/factories/MarketMathStatic__factory.ts +27 -45
  307. package/typechain-types/factories/OracleLib__factory.ts +1 -1
  308. package/typechain-types/factories/Pausable__factory.ts +62 -0
  309. package/typechain-types/factories/PendleConvexLPSY__factory.ts +141 -0
  310. package/typechain-types/factories/PendleCurveFraxUsdcSY__factory.ts +142 -1
  311. package/typechain-types/factories/PendleCurveUsdd3CrvSY__factory.ts +145 -39
  312. package/typechain-types/factories/PendleERC20Permit__factory.ts +1 -1
  313. package/typechain-types/factories/PendleERC20__factory.ts +1 -1
  314. package/typechain-types/factories/PendleFeeDistributorFactory__factory.ts +1 -1
  315. package/typechain-types/factories/PendleFeeDistributor__factory.ts +1 -1
  316. package/typechain-types/factories/PendleGaugeControllerMainchainUpg__factory.ts +1 -1
  317. package/typechain-types/factories/PendleGaugeControllerSidechainUpg__factory.ts +1 -1
  318. package/typechain-types/factories/PendleLooksStakingSY__factory.ts +1078 -0
  319. package/typechain-types/factories/PendleMarketFactory__factory.ts +220 -49
  320. package/typechain-types/factories/PendleMarket__factory.ts +18 -6
  321. package/typechain-types/factories/PendleMsgReceiveEndpointUpg__factory.ts +1 -1
  322. package/typechain-types/factories/PendleMsgSendEndpointUpg__factory.ts +1 -1
  323. package/typechain-types/factories/PendlePrincipalToken__factory.ts +1 -1
  324. package/typechain-types/factories/PendleQiTokenHelper__factory.ts +1 -1
  325. package/typechain-types/factories/PendleQiTokenSY__factory.ts +142 -1
  326. package/typechain-types/factories/PendleRouter__factory.ts +1 -185
  327. package/typechain-types/factories/PendleVotingControllerUpg__factory.ts +1 -1
  328. package/typechain-types/factories/PendleWstEthSY__factory.ts +142 -1
  329. package/typechain-types/factories/PendleYieldContractFactory__factory.ts +82 -9
  330. package/typechain-types/factories/PendleYieldToken__factory.ts +38 -3
  331. package/typechain-types/factories/RouterStatic__factory.ts +79 -3
  332. package/typechain-types/factories/SYBaseWithRewards__factory.ts +141 -0
  333. package/typechain-types/factories/SYBase__factory.ts +141 -0
  334. package/typechain-types/factories/VotingEscrowPendleMainchain__factory.ts +1 -1
  335. package/typechain-types/factories/VotingEscrowPendleSidechain__factory.ts +15 -4
  336. package/typechain-types/factories/VotingEscrowTokenBase__factory.ts +0 -13
  337. package/typechain-types/hardhat.d.ts +107 -26
  338. package/typechain-types/index.ts +24 -6
  339. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/ConvexCurveLP/PendleConvexLPSY.sol/PendleConvexLPSY.dbg.json +0 -4
  340. package/build/artifacts/contracts/offchain-helpers/ImplicitSwapfeeContract.sol/ImplicitSwapfeeContract.dbg.json +0 -4
  341. package/build/artifacts/contracts/offchain-helpers/ImplicitSwapfeeContract.sol/ImplicitSwapfeeContract.json +0 -182
  342. package/contracts/offchain-helpers/ImplicitSwapfeeContract.sol +0 -30
  343. package/deployments/43113-markets/benqi-market-QI-AVAX-FEB-2ND.json +0 -9
  344. package/deployments/43113-markets/benqi-market-QI-USDC-FEB-2ND.json +0 -8
  345. package/deployments/43113-markets/benqi-market-QI-WETH-DEC-1ST.json +0 -9
  346. package/deployments/80001-core.json +0 -16
  347. package/deployments/80001-markets/benqi-market-QI-USDC-FEB-2ND.json +0 -8
  348. package/deployments/80001-markets/benqi-market-QI-WETH-DEC-1ST.json +0 -8
  349. package/deployments/80001-testenv.json +0 -22
@@ -0,0 +1,128 @@
1
+ // SPDX-License-Identifier: GPL-3.0-or-later
2
+ pragma solidity 0.8.17;
3
+
4
+ import "../SYBase.sol";
5
+ import "../../../interfaces/ILooksFeeSharing.sol";
6
+ import "../../../interfaces/ILooksStaking.sol";
7
+
8
+ contract PendleLooksStakingSY is SYBase {
9
+ using Math for uint256;
10
+
11
+ address public immutable looks;
12
+ address public immutable stakingContract;
13
+ address public immutable feeSharingContract;
14
+
15
+ constructor(
16
+ string memory _name,
17
+ string memory _symbol,
18
+ address _looks,
19
+ address _stakingContract,
20
+ address _feeSharingContract
21
+ ) SYBase(_name, _symbol, _looks) {
22
+ looks = _looks;
23
+ stakingContract = _stakingContract;
24
+ feeSharingContract = _feeSharingContract;
25
+
26
+ _safeApproveInf(_looks, _stakingContract);
27
+ }
28
+
29
+ /*///////////////////////////////////////////////////////////////
30
+ DEPOSIT/REDEEM USING BASE TOKENS
31
+ //////////////////////////////////////////////////////////////*/
32
+
33
+ function _deposit(address, uint256 amountDeposited)
34
+ internal
35
+ virtual
36
+ override
37
+ returns (uint256 amountSharesOut)
38
+ {
39
+ uint256 previousShare = ILooksStaking(stakingContract).userInfo(address(this));
40
+ ILooksStaking(stakingContract).deposit(amountDeposited);
41
+ amountSharesOut = ILooksStaking(stakingContract).userInfo(address(this)) - previousShare;
42
+ }
43
+
44
+ function _redeem(
45
+ address receiver,
46
+ address,
47
+ uint256 amountSharesToRedeem
48
+ ) internal virtual override returns (uint256 amountTokenOut) {
49
+ uint256 previousBalance = _selfBalance(looks);
50
+ ILooksStaking(stakingContract).withdraw(amountSharesToRedeem);
51
+ amountTokenOut = _selfBalance(looks) - previousBalance;
52
+ _transferOut(looks, receiver, amountTokenOut);
53
+ }
54
+
55
+ /*///////////////////////////////////////////////////////////////
56
+ EXCHANGE-RATE
57
+ //////////////////////////////////////////////////////////////*/
58
+
59
+ function exchangeRate() public view virtual override returns (uint256) {
60
+ (uint256 totalShares, uint256 totalLooks) = _getLooksStakingParams();
61
+ return totalLooks.divDown(totalShares);
62
+ }
63
+
64
+ /*///////////////////////////////////////////////////////////////
65
+ MISC FUNCTIONS FOR METADATA
66
+ //////////////////////////////////////////////////////////////*/
67
+
68
+ function _previewDeposit(address, uint256 amountTokenToDeposit)
69
+ internal
70
+ view
71
+ override
72
+ returns (uint256 amountSharesOut)
73
+ {
74
+ (uint256 totalShares, uint256 totalLooks) = _getLooksStakingParams();
75
+ amountSharesOut = (amountTokenToDeposit * totalShares) / totalLooks;
76
+ }
77
+
78
+ function _previewRedeem(address, uint256 amountSharesToRedeem)
79
+ internal
80
+ view
81
+ override
82
+ returns (uint256 amountTokenOut)
83
+ {
84
+ (uint256 totalShares, uint256 totalLooks) = _getLooksStakingParams();
85
+ amountTokenOut = (amountSharesToRedeem * totalLooks) / totalShares;
86
+ }
87
+
88
+ function _getLooksStakingParams()
89
+ private
90
+ view
91
+ returns (uint256 totalShares, uint256 totalLooks)
92
+ {
93
+ totalShares = ILooksStaking(stakingContract).totalShares();
94
+ totalLooks = ILooksFeeSharing(feeSharingContract).calculateSharesValueInLOOKS(
95
+ stakingContract
96
+ );
97
+ }
98
+
99
+ function getTokensIn() public view virtual override returns (address[] memory res) {
100
+ res = new address[](1);
101
+ res[0] = looks;
102
+ }
103
+
104
+ function getTokensOut() public view virtual override returns (address[] memory res) {
105
+ res = new address[](1);
106
+ res[0] = looks;
107
+ }
108
+
109
+ function isValidTokenIn(address token) public view virtual override returns (bool) {
110
+ return token == looks;
111
+ }
112
+
113
+ function isValidTokenOut(address token) public view virtual override returns (bool) {
114
+ return token == looks;
115
+ }
116
+
117
+ function assetInfo()
118
+ external
119
+ view
120
+ returns (
121
+ AssetType assetType,
122
+ address assetAddress,
123
+ uint8 assetDecimals
124
+ )
125
+ {
126
+ return (AssetType.TOKEN, looks, IERC20Metadata(looks).decimals());
127
+ }
128
+ }
@@ -9,7 +9,7 @@ import "../libraries/Errors.sol";
9
9
 
10
10
  import "../erc20/PendleERC20Permit.sol";
11
11
 
12
- import "@openzeppelin/contracts/proxy/utils/Initializable.sol";
12
+ import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
13
13
 
14
14
  contract PendlePrincipalToken is PendleERC20Permit, Initializable, IPPrincipalToken {
15
15
  address public immutable SY;
@@ -22,7 +22,7 @@ contract PendlePrincipalToken is PendleERC20Permit, Initializable, IPPrincipalTo
22
22
  _;
23
23
  }
24
24
 
25
- modifier onlYieldFactory() {
25
+ modifier onlyYieldFactory() {
26
26
  if (msg.sender != factory) revert Errors.OnlyYCFactory();
27
27
  _;
28
28
  }
@@ -39,7 +39,7 @@ contract PendlePrincipalToken is PendleERC20Permit, Initializable, IPPrincipalTo
39
39
  factory = msg.sender;
40
40
  }
41
41
 
42
- function initialize(address _YT) external initializer onlYieldFactory {
42
+ function initialize(address _YT) external initializer onlyYieldFactory {
43
43
  YT = _YT;
44
44
  }
45
45
 
@@ -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;
@@ -21,6 +21,12 @@ library Errors {
21
21
  // APPROX
22
22
  error ApproxFail();
23
23
  error ApproxParamsInvalid(uint256 guessMin, uint256 guessMax, uint256 eps);
24
+ error ApproxBinarySearchInputInvalid(
25
+ uint256 approxGuessMin,
26
+ uint256 approxGuessMax,
27
+ uint256 minGuessMin,
28
+ uint256 maxGuessMax
29
+ );
24
30
 
25
31
  // MARKET + MARKET MATH CORE
26
32
  error MarketExpired();
@@ -45,8 +51,13 @@ library Errors {
45
51
  error MarketFactoryInvalidPt();
46
52
  error MarketFactoryMarketExists();
47
53
 
48
- error MFactoryLnFeeRateRootTooHigh(uint88 lnFeeRateRoot, uint256 maxLnFeeRateRoot);
49
- 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);
50
61
 
51
62
  // ROUTER
52
63
  error RouterInsufficientLpOut(uint256 actualLpOut, uint256 requiredLpOut);
@@ -79,6 +90,10 @@ library Errors {
79
90
  // YieldFactory
80
91
  error YCFactoryInvalidExpiry();
81
92
  error YCFactoryYieldContractExisted();
93
+ error YCFactoryZeroExpiryDivisor();
94
+ error YCFactoryZeroTreasury();
95
+ error YCFactoryInterestFeeRateTooHigh(uint256 interestFeeRate, uint256 maxInterestFeeRate);
96
+ error YCFactoryRewardFeeRateTooHigh(uint256 newRewardFeeRate, uint256 maxRewardFeeRate);
82
97
 
83
98
  // SY
84
99
  error SYInvalidTokenIn(address token);
@@ -113,6 +128,7 @@ library Errors {
113
128
  error VEPositionNotExpired();
114
129
  error VEZeroPosition();
115
130
  error VEZeroSlope(uint128 bias, uint128 slope);
131
+ error VEReceiveOldSupply(uint256 msgTime);
116
132
 
117
133
  error GCNotPendleMarket(address caller);
118
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
+ }