@pendle/core-v2 2.22.3 → 2.23.1-mantle

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 (436) 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/CrossChainMsg/libraries/LayerZeroHelper.sol/LayerZeroHelper.dbg.json +1 -1
  8. package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/libraries/LayerZeroHelper.sol/LayerZeroHelper.json +2 -2
  9. package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerBaseUpg.sol/PendleGaugeControllerBaseUpg.dbg.json +1 -1
  10. package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerMainchainUpg.sol/PendleGaugeControllerMainchainUpg.dbg.json +1 -1
  11. package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerMainchainUpg.sol/PendleGaugeControllerMainchainUpg.json +2 -2
  12. package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerSidechainUpg.sol/PendleGaugeControllerSidechainUpg.dbg.json +1 -1
  13. package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerSidechainUpg.sol/PendleGaugeControllerSidechainUpg.json +2 -2
  14. package/build/artifacts/contracts/LiquidityMining/VeDistributor/PendleFeeDistributor.sol/PendleFeeDistributor.dbg.json +1 -1
  15. package/build/artifacts/contracts/LiquidityMining/VeDistributor/PendleFeeDistributor.sol/PendleFeeDistributor.json +2 -2
  16. package/build/artifacts/contracts/LiquidityMining/VeDistributor/PendleFeeDistributorV2.sol/PendleFeeDistributorV2.dbg.json +1 -1
  17. package/build/artifacts/contracts/LiquidityMining/VeDistributor/PendleFeeDistributorV2.sol/PendleFeeDistributorV2.json +2 -2
  18. package/build/artifacts/contracts/LiquidityMining/VotingController/PendleVotingControllerUpg.sol/PendleVotingControllerUpg.dbg.json +1 -1
  19. package/build/artifacts/contracts/LiquidityMining/VotingController/PendleVotingControllerUpg.sol/PendleVotingControllerUpg.json +2 -2
  20. package/build/artifacts/contracts/LiquidityMining/VotingController/VotingControllerStorageUpg.sol/VotingControllerStorageUpg.dbg.json +1 -1
  21. package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol/VotingEscrowPendleMainchain.dbg.json +1 -1
  22. package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol/VotingEscrowPendleMainchain.json +2 -2
  23. package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowPendleSidechain.sol/VotingEscrowPendleSidechain.dbg.json +1 -1
  24. package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowPendleSidechain.sol/VotingEscrowPendleSidechain.json +2 -2
  25. package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowTokenBase.sol/VotingEscrowTokenBase.dbg.json +1 -1
  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 -2
  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/PendleGauge.sol/PendleGauge.json +19 -0
  44. package/build/artifacts/contracts/core/Market/PendleMarket.sol/PendleMarket.dbg.json +1 -1
  45. package/build/artifacts/contracts/core/Market/PendleMarket.sol/PendleMarket.json +21 -2
  46. package/build/artifacts/contracts/core/Market/PendleMarketFactory.sol/PendleMarketFactory.dbg.json +1 -1
  47. package/build/artifacts/contracts/core/Market/PendleMarketFactory.sol/PendleMarketFactory.json +2 -2
  48. package/build/artifacts/contracts/core/RewardManager/RewardManager.sol/RewardManager.dbg.json +1 -1
  49. package/build/artifacts/contracts/core/RewardManager/RewardManagerAbstract.sol/RewardManagerAbstract.dbg.json +1 -1
  50. package/build/artifacts/contracts/core/StandardizedYield/PYIndex.sol/PYIndexLib.dbg.json +1 -1
  51. package/build/artifacts/contracts/core/StandardizedYield/PYIndex.sol/PYIndexLib.json +2 -2
  52. package/build/artifacts/contracts/core/StandardizedYield/SYBase.sol/SYBase.dbg.json +1 -1
  53. package/build/artifacts/contracts/core/StandardizedYield/SYBaseWithRewards.sol/SYBaseWithRewards.dbg.json +1 -1
  54. package/build/artifacts/contracts/core/StandardizedYield/implementations/Ankr/PendleAnkrBNBSY.sol/PendleAnkrBNBSY.dbg.json +4 -0
  55. package/build/artifacts/contracts/core/StandardizedYield/implementations/Ankr/PendleAnkrBNBSY.sol/PendleAnkrBNBSY.json +1027 -0
  56. package/build/artifacts/contracts/core/StandardizedYield/implementations/Ape/sAPE.sol/sAPE.dbg.json +1 -1
  57. package/build/artifacts/contracts/core/StandardizedYield/implementations/Ape/sAPE.sol/sAPE.json +2 -2
  58. package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/AuraEthxBbAWethSY.sol/AuraEthxBbAWethSY.dbg.json +4 -0
  59. package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/AuraEthxBbAWethSY.sol/AuraEthxBbAWethSY.json +1179 -0
  60. package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraBbAWethSwethSY.sol/PendleAuraBbAWethSwethSY.dbg.json +1 -1
  61. package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraBbAWethSwethSY.sol/PendleAuraBbAWethSwethSY.json +6 -6
  62. package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWethAnkrethSYV2.sol/PendleAuraWethAnkrethSYV2.dbg.json +1 -1
  63. package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWethAnkrethSYV2.sol/PendleAuraWethAnkrethSYV2.json +2 -2
  64. package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWethRocketEthSYV2.sol/PendleAuraWethRocketEthSYV2.dbg.json +1 -1
  65. package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWethRocketEthSYV2.sol/PendleAuraWethRocketEthSYV2.json +2 -2
  66. package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWethStafiEthSY.sol/PendleAuraWethStafiEthSY.dbg.json +1 -1
  67. package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWethStafiEthSY.sol/PendleAuraWethStafiEthSY.json +2 -2
  68. package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWethVethSY.sol/PendleAuraWethVethSY.dbg.json +4 -0
  69. package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWethVethSY.sol/PendleAuraWethVethSY.json +1166 -0
  70. package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWethWstethSYV2.sol/PendleAuraWethWstethSYV2.dbg.json +1 -1
  71. package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWethWstethSYV2.sol/PendleAuraWethWstethSYV2.json +2 -2
  72. package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWstethAnkreth.sol/PendleAuraWstethAnkreth.dbg.json +4 -0
  73. package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWstethAnkreth.sol/PendleAuraWstethAnkreth.json +1171 -0
  74. package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/Linear/BbAPoolHelper.sol/BbAPoolHelper.dbg.json +1 -1
  75. package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/Linear/BbAPoolHelper.sol/BbAWethHelper.dbg.json +1 -1
  76. package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/PendleAuraBalancerStableLPSYV2.sol/PendleAuraBalancerStableLPSYV2.dbg.json +1 -1
  77. package/build/artifacts/contracts/core/StandardizedYield/implementations/BenQi/PendleQiTokenHelper.sol/PendleQiTokenHelper.dbg.json +1 -1
  78. package/build/artifacts/contracts/core/StandardizedYield/implementations/BenQi/PendleQiTokenHelper.sol/PendleQiTokenHelper.json +2 -2
  79. package/build/artifacts/contracts/core/StandardizedYield/implementations/BenQi/PendleQiTokenSY.sol/PendleQiTokenSY.dbg.json +1 -1
  80. package/build/artifacts/contracts/core/StandardizedYield/implementations/BenQi/PendleQiTokenSY.sol/PendleQiTokenSY.json +2 -2
  81. package/build/artifacts/contracts/core/StandardizedYield/implementations/CamelotV1Volatile/CamelotRewardHelper.sol/CamelotRewardHelper.dbg.json +1 -1
  82. package/build/artifacts/contracts/core/StandardizedYield/implementations/CamelotV1Volatile/CamelotRewardHelper.sol/CamelotRewardHelper.json +2 -2
  83. package/build/artifacts/contracts/core/StandardizedYield/implementations/CamelotV1Volatile/CamelotV1VolatileCommon.sol/CamelotV1VolatileCommon.dbg.json +1 -1
  84. package/build/artifacts/contracts/core/StandardizedYield/implementations/CamelotV1Volatile/CamelotV1VolatileCommon.sol/CamelotV1VolatileCommon.json +2 -2
  85. package/build/artifacts/contracts/core/StandardizedYield/implementations/CamelotV1Volatile/CamelotV1VolatileLpHelper.sol/CamelotV1VolatileLpHelper.dbg.json +1 -1
  86. package/build/artifacts/contracts/core/StandardizedYield/implementations/CamelotV1Volatile/CamelotV1VolatilePreview.sol/CamelotV1VolatilePreview.dbg.json +1 -1
  87. package/build/artifacts/contracts/core/StandardizedYield/implementations/CamelotV1Volatile/CamelotV1VolatilePreview.sol/CamelotV1VolatilePreview.json +2 -2
  88. package/build/artifacts/contracts/core/StandardizedYield/implementations/CamelotV1Volatile/PendleCamelotV1VolatileSY.sol/PendleCamelotV1VolatileSY.dbg.json +1 -1
  89. package/build/artifacts/contracts/core/StandardizedYield/implementations/CamelotV1Volatile/PendleCamelotV1VolatileSY.sol/PendleCamelotV1VolatileSY.json +2 -2
  90. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/PendleCurveFraxUsdcSY.sol/PendleCurveFraxUsdcSY.dbg.json +1 -1
  91. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/PendleCurveFraxUsdcSY.sol/PendleCurveFraxUsdcSY.json +2 -2
  92. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/PendleCurveUsdd3CrvSY.sol/PendleCurveUsdd3CrvSY.dbg.json +1 -1
  93. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/PendleCurveUsdd3CrvSY.sol/PendleCurveUsdd3CrvSY.json +2 -2
  94. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/Curve3CrvPoolHelper.sol/Curve3CrvPoolHelper.dbg.json +1 -1
  95. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/Curve3CrvPoolHelper.sol/Curve3CrvPoolHelper.json +2 -2
  96. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/CurveFraxUsdcPoolHelper.sol/CurveFraxUsdcPoolHelper.dbg.json +1 -1
  97. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/CurveFraxUsdcPoolHelper.sol/CurveFraxUsdcPoolHelper.json +2 -2
  98. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/CurveUsdd3CrvPoolHelper.sol/CurveUsdd3CrvPoolHelper.dbg.json +1 -1
  99. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/CurveUsdd3CrvPoolHelper.sol/CurveUsdd3CrvPoolHelper.json +2 -2
  100. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/PendleConvexLPSY.sol/PendleConvexLPSY.dbg.json +1 -1
  101. package/build/artifacts/contracts/core/StandardizedYield/implementations/GLP/PendleGlpSY.sol/PendleGlpSY.dbg.json +1 -1
  102. package/build/artifacts/contracts/core/StandardizedYield/implementations/GLP/PendleGlpSY.sol/PendleGlpSY.json +2 -2
  103. package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleArbitrumStakedEthSY.sol/PendleArbitrumStakedEthSY.dbg.json +4 -0
  104. package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleArbitrumStakedEthSY.sol/PendleArbitrumStakedEthSY.json +976 -0
  105. package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleGdaiSY.sol/PendleGDaiSY.dbg.json +1 -1
  106. package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleGdaiSY.sol/PendleGDaiSY.json +2 -2
  107. package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleLooksStakingSY.sol/PendleLooksStakingSY.dbg.json +1 -1
  108. package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleLooksStakingSY.sol/PendleLooksStakingSY.json +2 -2
  109. package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleSfrxEthSY.sol/PendleSfrxEthSY.dbg.json +1 -1
  110. package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleSfrxEthSY.sol/PendleSfrxEthSY.json +2 -2
  111. package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleStargateLPSY.sol/PendleStargateLPSY.dbg.json +1 -1
  112. package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleStargateLPSY.sol/PendleStargateLPSY.json +2 -2
  113. package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleWbEthSY.sol/PendleWbEthSY.dbg.json +4 -0
  114. package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleWbEthSY.sol/PendleWbEthSY.json +979 -0
  115. package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleWstEthSY.sol/PendleWstEthSY.dbg.json +1 -1
  116. package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleWstEthSY.sol/PendleWstEthSY.json +2 -2
  117. package/build/artifacts/contracts/core/StandardizedYield/implementations/Swell/PendleSwETH.sol/SwETHSY.dbg.json +4 -0
  118. package/build/artifacts/contracts/core/StandardizedYield/implementations/Swell/PendleSwETH.sol/SwETHSY.json +961 -0
  119. package/build/artifacts/contracts/core/StandardizedYield/implementations/Thena/PendleThenaSY.sol/PendleThenaSY.dbg.json +4 -0
  120. package/build/artifacts/contracts/core/StandardizedYield/implementations/Thena/PendleThenaSY.sol/PendleThenaSY.json +1266 -0
  121. package/build/artifacts/contracts/core/StandardizedYield/implementations/Thena/ThenaLpHelper.sol/ThenaLpHelper.dbg.json +4 -0
  122. package/build/artifacts/contracts/core/StandardizedYield/implementations/Thena/ThenaLpHelper.sol/ThenaLpHelper.json +128 -0
  123. package/build/artifacts/contracts/core/StandardizedYield/implementations/Thena/ThenaMath.sol/ThenaMath.dbg.json +4 -0
  124. package/build/artifacts/contracts/core/StandardizedYield/implementations/Thena/ThenaMath.sol/ThenaMath.json +24 -0
  125. package/build/artifacts/contracts/core/StandardizedYield/implementations/Thena/ThenaPreview.sol/IThenaSY.dbg.json +4 -0
  126. package/build/artifacts/contracts/core/StandardizedYield/implementations/Thena/ThenaPreview.sol/IThenaSY.json +24 -0
  127. package/build/artifacts/contracts/core/StandardizedYield/implementations/Thena/ThenaPreview.sol/ThenaPreview.dbg.json +4 -0
  128. package/build/artifacts/contracts/core/StandardizedYield/implementations/Thena/ThenaPreview.sol/ThenaPreview.json +267 -0
  129. package/build/artifacts/contracts/core/YieldContracts/InterestManagerYT.sol/InterestManagerYT.dbg.json +1 -1
  130. package/build/artifacts/contracts/core/YieldContracts/PendlePrincipalToken.sol/PendlePrincipalToken.dbg.json +1 -1
  131. package/build/artifacts/contracts/core/YieldContracts/PendlePrincipalToken.sol/PendlePrincipalToken.json +2 -2
  132. package/build/artifacts/contracts/core/YieldContracts/PendleYieldContractFactory.sol/PendleYieldContractFactory.dbg.json +1 -1
  133. package/build/artifacts/contracts/core/YieldContracts/PendleYieldContractFactory.sol/PendleYieldContractFactory.json +2 -2
  134. package/build/artifacts/contracts/core/YieldContracts/PendleYieldToken.sol/PendleYieldToken.dbg.json +1 -1
  135. package/build/artifacts/contracts/core/YieldContracts/PendleYieldToken.sol/PendleYieldToken.json +2 -2
  136. package/build/artifacts/contracts/core/YieldContractsV2/InterestManagerYTV2.sol/InterestManagerYTV2.dbg.json +1 -1
  137. package/build/artifacts/contracts/core/YieldContractsV2/PendlePrincipalTokenV2.sol/PendlePrincipalTokenV2.dbg.json +1 -1
  138. package/build/artifacts/contracts/core/YieldContractsV2/PendlePrincipalTokenV2.sol/PendlePrincipalTokenV2.json +2 -2
  139. package/build/artifacts/contracts/core/YieldContractsV2/PendleYieldContractFactoryV2.sol/PendleYieldContractFactoryV2.dbg.json +1 -1
  140. package/build/artifacts/contracts/core/YieldContractsV2/PendleYieldContractFactoryV2.sol/PendleYieldContractFactoryV2.json +2 -2
  141. package/build/artifacts/contracts/core/YieldContractsV2/PendleYieldTokenV2.sol/PendleYieldTokenV2.dbg.json +1 -1
  142. package/build/artifacts/contracts/core/YieldContractsV2/PendleYieldTokenV2.sol/PendleYieldTokenV2.json +2 -2
  143. package/build/artifacts/contracts/core/libraries/ArrayLib.sol/ArrayLib.dbg.json +1 -1
  144. package/build/artifacts/contracts/core/libraries/Errors.sol/Errors.dbg.json +1 -1
  145. package/build/artifacts/contracts/core/libraries/Errors.sol/Errors.json +2 -151
  146. package/build/artifacts/contracts/core/libraries/math/Math.sol/Math.dbg.json +1 -1
  147. package/build/artifacts/contracts/core/libraries/math/Math.sol/Math.json +2 -2
  148. package/build/artifacts/contracts/interfaces/Ankr/IAnkrBNB.sol/IAnkrBNB.dbg.json +4 -0
  149. package/build/artifacts/contracts/interfaces/Ankr/IAnkrBNB.sol/IAnkrBNB.json +62 -0
  150. package/build/artifacts/contracts/interfaces/Ankr/IAnkrLiquidStaking.sol/IAnkrLiquidStaking.dbg.json +4 -0
  151. package/build/artifacts/contracts/interfaces/Ankr/IAnkrLiquidStaking.sol/IAnkrLiquidStaking.json +108 -0
  152. package/build/artifacts/contracts/interfaces/BinanceEth/IWBETH.sol/IWBETH.dbg.json +4 -0
  153. package/build/artifacts/contracts/interfaces/BinanceEth/IWBETH.sol/IWBETH.json +42 -0
  154. package/build/artifacts/contracts/interfaces/Camelot/ICamelotNFTPool.sol/ICamelotNFTPool.dbg.json +1 -1
  155. package/build/artifacts/contracts/interfaces/Camelot/ICamelotNFTPool.sol/ICamelotNFTPool.json +13 -0
  156. package/build/artifacts/contracts/interfaces/Camelot/ICamelotNitroPool.sol/ICamelotNitroPool.dbg.json +1 -1
  157. package/build/artifacts/contracts/interfaces/Camelot/ICamelotNitroPool.sol/ICamelotNitroPool.json +13 -0
  158. package/build/artifacts/contracts/interfaces/Camelot/ICamelotPair.sol/ICamelotPair.dbg.json +1 -1
  159. package/build/artifacts/contracts/interfaces/Camelot/ICamelotPair.sol/ICamelotPair.json +26 -0
  160. package/build/artifacts/contracts/interfaces/IPActionAddRemoveLiq.sol/IPActionAddRemoveLiq.dbg.json +1 -1
  161. package/build/artifacts/contracts/interfaces/IPActionInfoStatic.sol/IPActionInfoStatic.dbg.json +1 -1
  162. package/build/artifacts/contracts/interfaces/IPActionMarketAuxStatic.sol/IPActionMarketAuxStatic.dbg.json +1 -1
  163. package/build/artifacts/contracts/interfaces/IPActionMarketAuxStatic.sol/IPActionMarketAuxStatic.json +82 -6
  164. package/build/artifacts/contracts/interfaces/IPActionMarketCoreStatic.sol/IPActionMarketCoreStatic.dbg.json +1 -1
  165. package/build/artifacts/contracts/interfaces/IPActionMarketCoreStatic.sol/IPActionMarketCoreStatic.json +22 -22
  166. package/build/artifacts/contracts/interfaces/IPActionMintRedeem.sol/IPActionMintRedeem.dbg.json +1 -1
  167. package/build/artifacts/contracts/interfaces/IPActionMintRedeemStatic.sol/IPActionMintRedeemStatic.dbg.json +1 -1
  168. package/build/artifacts/contracts/interfaces/IPActionMintRedeemStatic.sol/IPActionMintRedeemStatic.json +42 -4
  169. package/build/artifacts/contracts/interfaces/IPActionStorageStatic.sol/IPActionStorageStatic.dbg.json +1 -1
  170. package/build/artifacts/contracts/interfaces/IPActionSwapPT.sol/IPActionSwapPT.dbg.json +1 -1
  171. package/build/artifacts/contracts/interfaces/IPActionSwapYT.sol/IPActionSwapYT.dbg.json +1 -1
  172. package/build/artifacts/contracts/interfaces/IPAllAction.sol/IPAllAction.dbg.json +1 -1
  173. package/build/artifacts/contracts/interfaces/IPBulkSeller.sol/IPBulkSeller.dbg.json +1 -1
  174. package/build/artifacts/contracts/interfaces/IPGauge.sol/IPGauge.dbg.json +1 -1
  175. package/build/artifacts/contracts/interfaces/IPGauge.sol/IPGauge.json +19 -0
  176. package/build/artifacts/contracts/interfaces/IPMarket.sol/IPMarket.dbg.json +1 -1
  177. package/build/artifacts/contracts/interfaces/IPMarket.sol/IPMarket.json +19 -0
  178. package/build/artifacts/contracts/interfaces/IPRouterHelper.sol/IPRouterHelper.dbg.json +1 -1
  179. package/build/artifacts/contracts/interfaces/IPRouterStatic.sol/IPRouterStatic.dbg.json +1 -1
  180. package/build/artifacts/contracts/interfaces/IPRouterStatic.sol/IPRouterStatic.json +146 -32
  181. package/build/artifacts/contracts/interfaces/IPVotingController.sol/IPVotingController.dbg.json +1 -1
  182. package/build/artifacts/contracts/interfaces/IPVotingEscrowMainchain.sol/IPVotingEscrowMainchain.dbg.json +1 -1
  183. package/build/artifacts/contracts/interfaces/IPendlePreviewHelper.sol/IPendlePreviewHelper.dbg.json +4 -0
  184. package/build/artifacts/contracts/interfaces/IPendlePreviewHelper.sol/IPendlePreviewHelper.json +59 -0
  185. package/build/artifacts/contracts/interfaces/IStandardizedYield.sol/IStandardizedYield.dbg.json +1 -1
  186. package/build/artifacts/contracts/interfaces/ISwETH.sol/ISwETH.dbg.json +4 -0
  187. package/build/artifacts/contracts/interfaces/ISwETH.sol/ISwETH.json +44 -0
  188. package/build/artifacts/contracts/interfaces/Thena/IThenaFactory.sol/IThenaFactory.dbg.json +4 -0
  189. package/build/artifacts/contracts/interfaces/Thena/IThenaFactory.sol/IThenaFactory.json +152 -0
  190. package/build/artifacts/contracts/interfaces/Thena/IThenaGaugeV2.sol/IThenaGaugeV2.dbg.json +4 -0
  191. package/build/artifacts/contracts/interfaces/Thena/IThenaGaugeV2.sol/IThenaGaugeV2.json +71 -0
  192. package/build/artifacts/contracts/interfaces/Thena/IThenaPair.sol/IThenaPair.dbg.json +4 -0
  193. package/build/artifacts/contracts/interfaces/Thena/IThenaPair.sol/IThenaPair.json +409 -0
  194. package/build/artifacts/contracts/interfaces/Thena/IThenaRouter.sol/IThenaRouter.dbg.json +4 -0
  195. package/build/artifacts/contracts/interfaces/Thena/IThenaRouter.sol/IThenaRouter.json +188 -0
  196. package/build/artifacts/contracts/offchain-helpers/BoringLpSeller.sol/BoringLpSeller.dbg.json +1 -1
  197. package/build/artifacts/contracts/offchain-helpers/BoringPtSeller.sol/BoringPtSeller.dbg.json +1 -1
  198. package/build/artifacts/contracts/offchain-helpers/Broadcaster.sol/Broadcaster.dbg.json +1 -1
  199. package/build/artifacts/contracts/offchain-helpers/Broadcaster.sol/Broadcaster.json +2 -2
  200. package/build/artifacts/contracts/offchain-helpers/BulkSellerOffchain.sol/BulkSellerOffchain.dbg.json +1 -1
  201. package/build/artifacts/contracts/offchain-helpers/BulkSellerOffchain.sol/BulkSellerOffchain.json +2 -2
  202. package/build/artifacts/contracts/offchain-helpers/LegacyNFTHelper.sol/LegacyNFTHelper.dbg.json +4 -0
  203. package/build/artifacts/contracts/offchain-helpers/LegacyNFTHelper.sol/LegacyNFTHelper.json +30 -0
  204. package/build/artifacts/contracts/offchain-helpers/LegacyNFTHelper.sol/StarNFTV1.dbg.json +4 -0
  205. package/build/artifacts/contracts/offchain-helpers/LegacyNFTHelper.sol/StarNFTV1.json +572 -0
  206. package/build/artifacts/contracts/offchain-helpers/MarketExchangeRateLib.sol/MarketExchangeRateLib.dbg.json +1 -1
  207. package/build/artifacts/contracts/offchain-helpers/MarketExchangeRateLib.sol/MarketExchangeRateLib.json +2 -2
  208. package/build/artifacts/contracts/offchain-helpers/PtAndLpToAsset.sol/PtAndLpToAsset.dbg.json +4 -0
  209. package/build/artifacts/contracts/offchain-helpers/PtAndLpToAsset.sol/PtAndLpToAsset.json +97 -0
  210. package/build/artifacts/contracts/offchain-helpers/router-static/PendleRouterStatic.sol/PendleRouterStatic.dbg.json +1 -1
  211. package/build/artifacts/contracts/offchain-helpers/router-static/PendleRouterStatic.sol/PendleRouterStatic.json +2 -2
  212. package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionInfoStatic.sol/ActionInfoStatic.dbg.json +1 -1
  213. package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionInfoStatic.sol/ActionInfoStatic.json +2 -2
  214. package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionMarketAuxStatic.sol/ActionMarketAuxStatic.dbg.json +1 -1
  215. package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionMarketAuxStatic.sol/ActionMarketAuxStatic.json +84 -8
  216. package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionMarketCoreStatic.sol/ActionMarketCoreStatic.dbg.json +1 -1
  217. package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionMarketCoreStatic.sol/ActionMarketCoreStatic.json +24 -24
  218. package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionMintRedeemStatic.sol/ActionMintRedeemStatic.dbg.json +1 -1
  219. package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionMintRedeemStatic.sol/ActionMintRedeemStatic.json +44 -6
  220. package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionStorageStatic.sol/ActionStorageStatic.dbg.json +1 -1
  221. package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionStorageStatic.sol/ActionStorageStatic.json +2 -2
  222. package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionVePendleStatic.sol/ActionVePendleStatic.dbg.json +1 -1
  223. package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionVePendleStatic.sol/ActionVePendleStatic.json +2 -2
  224. package/build/artifacts/contracts/offchain-helpers/router-static/base/StorageLayout.sol/StorageLayout.dbg.json +1 -1
  225. package/build/artifacts/contracts/oracles/PendleLpOracleLib.sol/PendleLpOracleLib.dbg.json +1 -1
  226. package/build/artifacts/contracts/oracles/PendleLpOracleLib.sol/PendleLpOracleLib.json +2 -2
  227. package/build/artifacts/contracts/oracles/PendlePtOracle.sol/PendlePtOracle.dbg.json +1 -1
  228. package/build/artifacts/contracts/oracles/PendlePtOracle.sol/PendlePtOracle.json +2 -2
  229. package/build/artifacts/contracts/oracles/PendlePtOracleLib.sol/PendlePtOracleLib.dbg.json +1 -1
  230. package/build/artifacts/contracts/oracles/PendlePtOracleLib.sol/PendlePtOracleLib.json +2 -2
  231. package/build/artifacts/contracts/oracles/samples/PendleLpGlpOracle.sol/PendleLpGlpOracle.dbg.json +1 -1
  232. package/build/artifacts/contracts/oracles/samples/PendleLpGlpOracle.sol/PendleLpGlpOracle.json +2 -2
  233. package/build/artifacts/contracts/oracles/samples/PendlePtGlpOracle.sol/PendlePtGlpOracle.dbg.json +1 -1
  234. package/build/artifacts/contracts/oracles/samples/PendlePtGlpOracle.sol/PendlePtGlpOracle.json +2 -2
  235. package/build/artifacts/contracts/oracles/samples/PendlePtUsdChainlinkOracle.sol/PendlePtUsdChainlinkOracle.dbg.json +1 -1
  236. package/build/artifacts/contracts/oracles/samples/PendlePtUsdChainlinkOracle.sol/PendlePtUsdChainlinkOracle.json +2 -2
  237. package/build/artifacts/contracts/router/ActionAddRemoveLiq.sol/ActionAddRemoveLiq.dbg.json +1 -1
  238. package/build/artifacts/contracts/router/ActionAddRemoveLiq.sol/ActionAddRemoveLiq.json +2 -2
  239. package/build/artifacts/contracts/router/ActionMintRedeem.sol/ActionMintRedeem.dbg.json +1 -1
  240. package/build/artifacts/contracts/router/ActionMintRedeem.sol/ActionMintRedeem.json +2 -2
  241. package/build/artifacts/contracts/router/ActionSwapPT.sol/ActionSwapPT.dbg.json +1 -1
  242. package/build/artifacts/contracts/router/ActionSwapPT.sol/ActionSwapPT.json +2 -2
  243. package/build/artifacts/contracts/router/ActionSwapYT.sol/ActionSwapYT.dbg.json +1 -1
  244. package/build/artifacts/contracts/router/ActionSwapYT.sol/ActionSwapYT.json +2 -2
  245. package/build/artifacts/contracts/router/PendleRouter.sol/PendleRouter.dbg.json +1 -1
  246. package/build/artifacts/contracts/router/PendleRouter.sol/PendleRouter.json +2 -2
  247. package/build/artifacts/contracts/router/PendleRouterHelper.sol/PendleRouterHelper.dbg.json +1 -1
  248. package/build/artifacts/contracts/router/PendleRouterHelper.sol/PendleRouterHelper.json +2 -2
  249. package/build/artifacts/contracts/router/base/ActionBaseCallback.sol/ActionBaseCallback.dbg.json +1 -1
  250. package/build/artifacts/contracts/router/base/ActionBaseMintRedeem.sol/ActionBaseMintRedeem.dbg.json +1 -1
  251. package/build/artifacts/contracts/router/base/CallbackHelper.sol/CallbackHelper.dbg.json +1 -1
  252. package/build/artifacts/contracts/router/base/MarketApproxLib.sol/MarketApproxPtInLib.dbg.json +1 -1
  253. package/build/artifacts/contracts/router/base/MarketApproxLib.sol/MarketApproxPtInLib.json +2 -2
  254. package/build/artifacts/contracts/router/base/MarketApproxLib.sol/MarketApproxPtOutLib.dbg.json +1 -1
  255. package/build/artifacts/contracts/router/base/MarketApproxLib.sol/MarketApproxPtOutLib.json +2 -2
  256. package/build/artifacts/contracts/router/swap-aggregator/1inch/I1inchAggregationRouterV5.sol/I1inchAggregationRouterV5.dbg.json +4 -0
  257. package/build/artifacts/contracts/router/swap-aggregator/1inch/I1inchAggregationRouterV5.sol/I1inchAggregationRouterV5.json +160 -0
  258. package/build/artifacts/contracts/router/swap-aggregator/1inch/OneInchAggregationRouterHelper.sol/OneInchAggregationRouterHelper.dbg.json +4 -0
  259. package/build/artifacts/contracts/router/swap-aggregator/1inch/OneInchAggregationRouterHelper.sol/OneInchAggregationRouterHelper.json +10 -0
  260. package/build/artifacts/contracts/router/swap-aggregator/PendleSwap.sol/PendleSwap.dbg.json +1 -1
  261. package/build/artifacts/contracts/router/swap-aggregator/PendleSwap.sol/PendleSwap.json +18 -2
  262. package/build/artifacts/contracts/router/swap-aggregator/kyberswap/IExecutorHelper.sol/IExecutorHelper.dbg.json +1 -1
  263. package/build/artifacts/contracts/router/swap-aggregator/kyberswap/IExecutorHelper.sol/IExecutorHelper.json +76 -118
  264. package/build/artifacts/contracts/router/swap-aggregator/kyberswap/KyberInputScalingHelper.sol/KyberInputScalingHelper.dbg.json +1 -1
  265. package/build/artifacts/contracts/router/swap-aggregator/kyberswap/ScalingDataLib.sol/ScalingDataLib.dbg.json +1 -1
  266. package/build/artifacts/contracts/router/swap-aggregator/kyberswap/ScalingDataLib.sol/ScalingDataLib.json +2 -2
  267. package/contracts/LiquidityMining/CrossChainMsg/libraries/LayerZeroHelper.sol +4 -0
  268. package/contracts/core/Market/PendleExternalRewardDistributor.sol +126 -0
  269. package/contracts/core/Market/v2/PendleGaugeV2.sol +137 -0
  270. package/contracts/core/Market/v2/PendleMarketFactoryV2.sol +170 -0
  271. package/contracts/core/Market/v2/PendleMarketV2.sol +373 -0
  272. package/contracts/core/StandardizedYield/implementations/BalancerStable/base/ComposableStable/ComposableStablePreview.sol +1 -607
  273. package/contracts/core/StandardizedYield/implementations/BalancerStable/base/ComposableStable/ComposableStablePreviewProxy.sol +53 -0
  274. package/contracts/core/StandardizedYield/implementations/BalancerStable/base/ComposableStable/ComposableStablePreviewV4.sol +600 -0
  275. package/contracts/core/StandardizedYield/implementations/BalancerStable/base/ComposableStable/ComposableStablePreviewV5.sol +621 -0
  276. package/contracts/core/StandardizedYield/implementations/BalancerStable/base/FixedPoint.sol +8 -0
  277. package/contracts/core/StandardizedYield/implementations/ChainlinkRelayer/PendleChainlinkReceiver.sol +46 -0
  278. package/contracts/core/StandardizedYield/implementations/ChainlinkRelayer/PendleChainlinkRelayer.sol +43 -0
  279. package/contracts/core/StandardizedYield/implementations/MantleStakedEth/PendleMantleStakedEthSY.sol +120 -0
  280. package/contracts/core/StandardizedYield/implementations/MantleStakedEth/PendleOracleForSyProxy.sol +23 -0
  281. package/contracts/core/libraries/ArrayLib.sol +30 -0
  282. package/contracts/core/libraries/Errors.sol +2 -0
  283. package/contracts/interfaces/Balancer/IPComposableStablePreview.sol +23 -0
  284. package/contracts/interfaces/Balancer/IVersion.sol +13 -0
  285. package/contracts/interfaces/IPExternalRewardDistributor.sol +19 -0
  286. package/contracts/interfaces/IPMarketFactoryV2.sol +8 -0
  287. package/contracts/interfaces/IPOracleForSy.sol +7 -0
  288. package/contracts/offchain-helpers/LegacyNFTHelper.sol +100 -0
  289. package/contracts/router/swap-aggregator/PendleSwap.sol +1 -1
  290. package/deployments/1-markets/BALANCER-LP-AURA-ETHX-BBAWETH-SEP-26-2024.json +12 -0
  291. package/deployments/5000-core.json +30 -0
  292. package/deployments/5000-markets/WSTETH-MANTLE-MARCH2024.json +10 -0
  293. package/deployments/merkle-distribution/2023-07-27.json +5525 -0
  294. package/package.json +7 -7
  295. package/typechain-types/ActionMarketAuxStatic.ts +191 -38
  296. package/typechain-types/ActionMarketCoreStatic.ts +600 -134
  297. package/typechain-types/ActionMintRedeemStatic.ts +92 -26
  298. package/typechain-types/ICamelotNFTPool.ts +19 -0
  299. package/typechain-types/ICamelotNitroPool.ts +19 -0
  300. package/typechain-types/ICamelotPair.ts +42 -0
  301. package/typechain-types/IExecutorHelper.ts +310 -331
  302. package/typechain-types/IPActionMarketAuxStatic.ts +191 -38
  303. package/typechain-types/IPActionMarketCoreStatic.ts +600 -134
  304. package/typechain-types/IPActionMintRedeemStatic.ts +92 -26
  305. package/typechain-types/IPExternalRewardDistributor.ts +38 -32
  306. package/typechain-types/IPGauge.ts +23 -3
  307. package/typechain-types/IPMarket.ts +18 -0
  308. package/typechain-types/IPRouterStatic.ts +888 -197
  309. package/typechain-types/LegacyNFTHelper.ts +87 -0
  310. package/typechain-types/PendleExternalRewardDistributor.ts +87 -86
  311. package/typechain-types/PendleGauge.ts +23 -3
  312. package/typechain-types/PendleMarket.ts +18 -0
  313. package/typechain-types/StarNFTV1.ts +880 -0
  314. package/typechain-types/factories/ActionAddRemoveLiq__factory.ts +1 -1
  315. package/typechain-types/factories/ActionInfoStatic__factory.ts +1 -1
  316. package/typechain-types/factories/ActionMarketAuxStatic__factory.ts +83 -7
  317. package/typechain-types/factories/ActionMarketCoreStatic__factory.ts +23 -23
  318. package/typechain-types/factories/ActionMintRedeemStatic__factory.ts +43 -5
  319. package/typechain-types/factories/ActionMintRedeem__factory.ts +1 -1
  320. package/typechain-types/factories/ActionStorageStatic__factory.ts +1 -1
  321. package/typechain-types/factories/ActionSwapPT__factory.ts +1 -1
  322. package/typechain-types/factories/ActionSwapYT__factory.ts +1 -1
  323. package/typechain-types/factories/ActionVePendleStatic__factory.ts +1 -1
  324. package/typechain-types/factories/AuraEthxBbAWethSY__factory.ts +1 -1
  325. package/typechain-types/factories/Broadcaster__factory.ts +1 -1
  326. package/typechain-types/factories/BulkSellerFactory__factory.ts +1 -1
  327. package/typechain-types/factories/BulkSellerOffchain__factory.ts +1 -1
  328. package/typechain-types/factories/BulkSeller__factory.ts +1 -1
  329. package/typechain-types/factories/CamelotRewardHelper__factory.ts +1 -1
  330. package/typechain-types/factories/CamelotV1VolatilePreview__factory.ts +1 -1
  331. package/typechain-types/factories/Errors__factory.ts +1 -150
  332. package/typechain-types/factories/ICamelotNFTPool__factory.ts +13 -0
  333. package/typechain-types/factories/ICamelotNitroPool__factory.ts +13 -0
  334. package/typechain-types/factories/ICamelotPair__factory.ts +26 -0
  335. package/typechain-types/factories/IExecutorHelper__factory.ts +74 -116
  336. package/typechain-types/factories/IPActionMarketAuxStatic__factory.ts +82 -6
  337. package/typechain-types/factories/IPActionMarketCoreStatic__factory.ts +22 -22
  338. package/typechain-types/factories/IPActionMintRedeemStatic__factory.ts +42 -4
  339. package/typechain-types/factories/IPExternalRewardDistributor__factory.ts +32 -32
  340. package/typechain-types/factories/IPGauge__factory.ts +19 -0
  341. package/typechain-types/factories/IPMarket__factory.ts +19 -0
  342. package/typechain-types/factories/IPRouterStatic__factory.ts +146 -32
  343. package/typechain-types/factories/LegacyNFTHelper__factory.ts +83 -0
  344. package/typechain-types/factories/OracleLib__factory.ts +1 -1
  345. package/typechain-types/factories/PendleAuraBbAWethSwethSY__factory.ts +5 -5
  346. package/typechain-types/factories/PendleAuraWethAnkrethSYV2__factory.ts +1 -1
  347. package/typechain-types/factories/PendleAuraWethRocketEthSYV2__factory.ts +1 -1
  348. package/typechain-types/factories/PendleAuraWethStafiEthSY__factory.ts +1 -1
  349. package/typechain-types/factories/PendleAuraWethWstethSYV2__factory.ts +1 -1
  350. package/typechain-types/factories/PendleCamelotV1VolatileSY__factory.ts +1 -1
  351. package/typechain-types/factories/PendleCurveFraxUsdcSY__factory.ts +1 -1
  352. package/typechain-types/factories/PendleCurveUsdd3CrvSY__factory.ts +1 -1
  353. package/typechain-types/factories/PendleExternalRewardDistributor__factory.ts +69 -74
  354. package/typechain-types/factories/PendleFeeDistributorV2__factory.ts +1 -1
  355. package/typechain-types/factories/PendleFeeDistributor__factory.ts +1 -1
  356. package/typechain-types/factories/PendleGDaiSY__factory.ts +1 -1
  357. package/typechain-types/factories/PendleGaugeControllerMainchainUpg__factory.ts +1 -1
  358. package/typechain-types/factories/PendleGaugeControllerSidechainUpg__factory.ts +1 -1
  359. package/typechain-types/factories/PendleGauge__factory.ts +19 -0
  360. package/typechain-types/factories/PendleGlpSY__factory.ts +1 -1
  361. package/typechain-types/factories/PendleLooksStakingSY__factory.ts +1 -1
  362. package/typechain-types/factories/PendleLpGlpOracle__factory.ts +1 -1
  363. package/typechain-types/factories/PendleMarketFactory__factory.ts +1 -1
  364. package/typechain-types/factories/PendleMarketV2__factory.ts +1 -1
  365. package/typechain-types/factories/PendleMarket__factory.ts +20 -1
  366. package/typechain-types/factories/PendleMsgReceiveEndpointUpg__factory.ts +1 -1
  367. package/typechain-types/factories/PendleMsgSendEndpointUpg__factory.ts +1 -1
  368. package/typechain-types/factories/PendlePrincipalTokenV2__factory.ts +1 -1
  369. package/typechain-types/factories/PendlePrincipalToken__factory.ts +1 -1
  370. package/typechain-types/factories/PendlePtGlpOracle__factory.ts +1 -1
  371. package/typechain-types/factories/PendlePtOracle__factory.ts +1 -1
  372. package/typechain-types/factories/PendlePtUsdChainlinkOracle__factory.ts +1 -1
  373. package/typechain-types/factories/PendleQiTokenHelper__factory.ts +1 -1
  374. package/typechain-types/factories/PendleQiTokenSY__factory.ts +1 -1
  375. package/typechain-types/factories/PendleRouterHelper__factory.ts +1 -1
  376. package/typechain-types/factories/PendleRouterStatic__factory.ts +1 -1
  377. package/typechain-types/factories/PendleRouter__factory.ts +1 -1
  378. package/typechain-types/factories/PendleSfrxEthSY__factory.ts +1 -1
  379. package/typechain-types/factories/PendleStargateLPSY__factory.ts +1 -1
  380. package/typechain-types/factories/PendleSwap__factory.ts +17 -1
  381. package/typechain-types/factories/PendleVotingControllerUpg__factory.ts +1 -1
  382. package/typechain-types/factories/PendleWstEthSY__factory.ts +1 -1
  383. package/typechain-types/factories/PendleYieldContractFactoryV2__factory.ts +1 -1
  384. package/typechain-types/factories/PendleYieldContractFactory__factory.ts +1 -1
  385. package/typechain-types/factories/PendleYieldTokenV2__factory.ts +1 -1
  386. package/typechain-types/factories/PendleYieldToken__factory.ts +1 -1
  387. package/typechain-types/factories/SAPE__factory.ts +1 -1
  388. package/typechain-types/factories/StarNFTV1__factory.ts +584 -0
  389. package/typechain-types/factories/VotingEscrowPendleMainchain__factory.ts +1 -1
  390. package/typechain-types/factories/VotingEscrowPendleSidechain__factory.ts +1 -1
  391. package/typechain-types/hardhat.d.ts +81 -144
  392. package/typechain-types/index.ts +18 -32
  393. package/build/artifacts/contracts/core/TradingBot/LongYield/LongYieldActionHelper.sol/LongYieldActionHelper.dbg.json +0 -4
  394. package/build/artifacts/contracts/core/TradingBot/LongYield/LongYieldActionHelper.sol/LongYieldActionHelper.json +0 -815
  395. package/build/artifacts/contracts/core/TradingBot/LongYield/LongYieldDecisionHelper.sol/LongYieldDecisionHelper.dbg.json +0 -4
  396. package/build/artifacts/contracts/core/TradingBot/LongYield/LongYieldDecisionHelper.sol/LongYieldDecisionHelper.json +0 -1215
  397. package/build/artifacts/contracts/core/TradingBot/LongYield/LongYieldTradingBot.sol/LongYieldTradingBot.dbg.json +0 -4
  398. package/build/artifacts/contracts/core/TradingBot/LongYield/LongYieldTradingBot.sol/LongYieldTradingBot.json +0 -1564
  399. package/build/artifacts/contracts/core/TradingBot/ShortYield/ShortYieldActionHelper.sol/ShortYieldActionHelper.dbg.json +0 -4
  400. package/build/artifacts/contracts/core/TradingBot/ShortYield/ShortYieldActionHelper.sol/ShortYieldActionHelper.json +0 -765
  401. package/build/artifacts/contracts/core/TradingBot/ShortYield/ShortYieldDecisionHelper.sol/ShortYieldDecisionHelper.dbg.json +0 -4
  402. package/build/artifacts/contracts/core/TradingBot/ShortYield/ShortYieldDecisionHelper.sol/ShortYieldDecisionHelper.json +0 -1215
  403. package/build/artifacts/contracts/core/TradingBot/ShortYield/ShortYieldTradingBot.sol/ShortYieldTradingBot.dbg.json +0 -4
  404. package/build/artifacts/contracts/core/TradingBot/ShortYield/ShortYieldTradingBot.sol/ShortYieldTradingBot.json +0 -1368
  405. package/build/artifacts/contracts/core/TradingBot/base/BotActionCallback.sol/BotActionCallback.dbg.json +0 -4
  406. package/build/artifacts/contracts/core/TradingBot/base/BotActionCallback.sol/BotActionCallback.json +0 -815
  407. package/build/artifacts/contracts/core/TradingBot/base/BotDecisionHelperBase.sol/BotDecisionHelperBase.dbg.json +0 -4
  408. package/build/artifacts/contracts/core/TradingBot/base/BotDecisionHelperBase.sol/BotDecisionHelperBase.json +0 -789
  409. package/build/artifacts/contracts/core/TradingBot/base/TradingBotBase.sol/TradingBotBase.dbg.json +0 -4
  410. package/build/artifacts/contracts/core/TradingBot/base/TradingBotBase.sol/TradingBotBase.json +0 -765
  411. package/build/artifacts/contracts/core/TradingBot/libraries/BotSimulationLib.sol/BotSimulationLib.dbg.json +0 -4
  412. package/build/artifacts/contracts/core/TradingBot/libraries/BotSimulationLib.sol/BotSimulationLib.json +0 -10
  413. package/build/artifacts/contracts/core/TradingBot/libraries/MarketExtLib.sol/MarketExtLib.dbg.json +0 -4
  414. package/build/artifacts/contracts/core/TradingBot/libraries/MarketExtLib.sol/MarketExtLib.json +0 -24
  415. package/build/artifacts/contracts/core/TradingBot/libraries/SpecSegmentLib.sol/SpecSegmentLib.dbg.json +0 -4
  416. package/build/artifacts/contracts/core/TradingBot/libraries/SpecSegmentLib.sol/SpecSegmentLib.json +0 -10
  417. package/build/artifacts/contracts/core/libraries/TokenAmountLib.sol/TokenAmountLib.dbg.json +0 -4
  418. package/build/artifacts/contracts/core/libraries/TokenAmountLib.sol/TokenAmountLib.json +0 -10
  419. package/build/artifacts/contracts/interfaces/TradingBot/IBotDecisionHelper.sol/IBotDecisionHelper.dbg.json +0 -4
  420. package/build/artifacts/contracts/interfaces/TradingBot/IBotDecisionHelper.sol/IBotDecisionHelper.json +0 -652
  421. package/build/artifacts/contracts/interfaces/TradingBot/ILongYieldDecisionHelper.sol/ILongYieldDecisionHelper.dbg.json +0 -4
  422. package/build/artifacts/contracts/interfaces/TradingBot/ILongYieldDecisionHelper.sol/ILongYieldDecisionHelper.json +0 -671
  423. package/build/artifacts/contracts/interfaces/TradingBot/ILongYieldTradingBot.sol/ILongYieldTradingBot.dbg.json +0 -4
  424. package/build/artifacts/contracts/interfaces/TradingBot/ILongYieldTradingBot.sol/ILongYieldTradingBot.json +0 -977
  425. package/build/artifacts/contracts/interfaces/TradingBot/IShortYieldDecisionHelper.sol/IShortYieldDecisionHelper.dbg.json +0 -4
  426. package/build/artifacts/contracts/interfaces/TradingBot/IShortYieldDecisionHelper.sol/IShortYieldDecisionHelper.json +0 -652
  427. package/build/artifacts/contracts/interfaces/TradingBot/IShortYieldTradingBot.sol/IShortYieldTradingBot.dbg.json +0 -4
  428. package/build/artifacts/contracts/interfaces/TradingBot/IShortYieldTradingBot.sol/IShortYieldTradingBot.json +0 -958
  429. package/build/artifacts/contracts/interfaces/TradingBot/ITradingBotBase.sol/ITradingBotBase.dbg.json +0 -4
  430. package/build/artifacts/contracts/interfaces/TradingBot/ITradingBotBase.sol/ITradingBotBase.json +0 -515
  431. package/build/artifacts/contracts/router/swap-aggregator/kyberswap/IHashflow.sol/IHashflow.dbg.json +0 -4
  432. package/build/artifacts/contracts/router/swap-aggregator/kyberswap/IHashflow.sol/IHashflow.json +0 -101
  433. /package/contracts/router/swap-aggregator/{1inch → oneinch}/I1inchAggregationRouterV5.sol +0 -0
  434. /package/contracts/router/swap-aggregator/{1inch → oneinch}/OneInchAggregationRouterHelper.sol +0 -0
  435. /package/deployments/1-markets/{BALANCER-LP-AURA-ANKRETH-WETH-SEP-26-2024.json → deprecated/BALANCER-LP-AURA-ANKRETH-WETH-SEP-26-2024.json} +0 -0
  436. /package/deployments/1-markets/{BALANCER-LP-AURA-RETH-WETH-DEC-26-2024.json → deprecated/BALANCER-LP-AURA-RETH-WETH-DEC-26-2024.json} +0 -0
@@ -0,0 +1,137 @@
1
+ // SPDX-License-Identifier: GPL-3.0-or-later
2
+ pragma solidity 0.8.17;
3
+
4
+ import "../../../interfaces/IPGauge.sol";
5
+ import "../../../interfaces/IPVeToken.sol";
6
+ import "../../../interfaces/IPGaugeController.sol";
7
+ import "../../../interfaces/IStandardizedYield.sol";
8
+ import "../../../interfaces/IPMarketFactoryV2.sol";
9
+ import "../../../interfaces/IPExternalRewardDistributor.sol";
10
+
11
+ import "../../RewardManager/RewardManager.sol";
12
+
13
+ /**
14
+ Invariants to maintain:
15
+ - before any changes to active balance, updateAndDistributeRewards() must be called
16
+ */
17
+ abstract contract PendleGaugeV2 is RewardManager, IPGauge {
18
+ using Math for uint256;
19
+ using SafeERC20 for IERC20;
20
+ using ArrayLib for address[];
21
+
22
+ address private immutable SY;
23
+
24
+ uint256 internal constant TOKENLESS_PRODUCTION = 40;
25
+
26
+ address internal immutable PENDLE;
27
+ IPVeToken internal immutable vePENDLE;
28
+ address internal immutable gaugeController;
29
+ address internal immutable externalRewardDistributor;
30
+
31
+ uint256 public totalActiveSupply;
32
+ mapping(address => uint256) public activeBalance;
33
+
34
+ constructor(address _SY, address _vePendle, address _gaugeController, address _factory) {
35
+ SY = _SY;
36
+ vePENDLE = IPVeToken(_vePendle);
37
+ gaugeController = _gaugeController;
38
+ PENDLE = IPGaugeController(gaugeController).pendle();
39
+ externalRewardDistributor = IPMarketFactoryV2(_factory).rewardDistributor();
40
+ }
41
+
42
+ /**
43
+ * @dev Since rewardShares is based on activeBalance, user's activeBalance must be updated AFTER
44
+ rewards is updated
45
+ * @dev It's intended to have user's activeBalance updated when rewards is redeemed
46
+ */
47
+ function _redeemRewards(address user) internal virtual returns (uint256[] memory rewardsOut) {
48
+ _updateAndDistributeRewards(user);
49
+ _updateUserActiveBalance(user);
50
+ rewardsOut = _doTransferOutRewards(user, user);
51
+ emit RedeemRewards(user, rewardsOut);
52
+ }
53
+
54
+ function _updateUserActiveBalance(address user) internal virtual {
55
+ _updateUserActiveBalanceForTwo(user, address(0));
56
+ }
57
+
58
+ function _updateUserActiveBalanceForTwo(address user1, address user2) internal virtual {
59
+ if (user1 != address(0) && user1 != address(this)) _updateUserActiveBalancePrivate(user1);
60
+ if (user2 != address(0) && user2 != address(this)) _updateUserActiveBalancePrivate(user2);
61
+ }
62
+
63
+ /**
64
+ * @dev should only be callable from `_updateUserActiveBalanceForTwo` to guarantee user != address(0) && user != address(this)
65
+ */
66
+ function _updateUserActiveBalancePrivate(address user) private {
67
+ assert(user != address(0) && user != address(this));
68
+
69
+ uint256 lpBalance = _stakedBalance(user);
70
+ uint256 veBoostedLpBalance = _calcVeBoostedLpBalance(user, lpBalance);
71
+
72
+ uint256 newActiveBalance = Math.min(veBoostedLpBalance, lpBalance);
73
+
74
+ totalActiveSupply = totalActiveSupply - activeBalance[user] + newActiveBalance;
75
+ activeBalance[user] = newActiveBalance;
76
+ }
77
+
78
+ function _calcVeBoostedLpBalance(
79
+ address user,
80
+ uint256 lpBalance
81
+ ) internal virtual returns (uint256) {
82
+ (uint256 vePendleSupply, uint256 vePendleBalance) = vePENDLE.totalSupplyAndBalanceCurrent(
83
+ user
84
+ );
85
+ // Inspired by Curve's Gauge
86
+ uint256 veBoostedLpBalance = (lpBalance * TOKENLESS_PRODUCTION) / 100;
87
+ if (vePendleSupply > 0) {
88
+ veBoostedLpBalance +=
89
+ (((_totalStaked() * vePendleBalance) / vePendleSupply) *
90
+ (100 - TOKENLESS_PRODUCTION)) /
91
+ 100;
92
+ }
93
+ return veBoostedLpBalance;
94
+ }
95
+
96
+ function _redeemExternalReward() internal virtual override {
97
+ IStandardizedYield(SY).claimRewards(address(this));
98
+ IPExternalRewardDistributor(externalRewardDistributor).redeemRewards();
99
+ IPGaugeController(gaugeController).redeemMarketReward();
100
+ }
101
+
102
+ function _stakedBalance(address user) internal view virtual returns (uint256);
103
+
104
+ function _totalStaked() internal view virtual returns (uint256);
105
+
106
+ function _rewardSharesTotal() internal view virtual override returns (uint256) {
107
+ return totalActiveSupply;
108
+ }
109
+
110
+ function _rewardSharesUser(address user) internal view virtual override returns (uint256) {
111
+ return activeBalance[user];
112
+ }
113
+
114
+ function _getRewardTokens()
115
+ internal
116
+ view
117
+ virtual
118
+ override
119
+ returns (address[] memory rewardTokens)
120
+ {
121
+ address[] memory SYRewards = IStandardizedYield(SY).getRewardTokens();
122
+ address[] memory externalRewards = IPExternalRewardDistributor(externalRewardDistributor)
123
+ .getRewardTokens(address(this));
124
+
125
+ rewardTokens = SYRewards.concat(externalRewards);
126
+ if (rewardTokens.contains(PENDLE)) return rewardTokens;
127
+ return rewardTokens.append(PENDLE);
128
+ }
129
+
130
+ function _beforeTokenTransfer(address from, address to, uint256) internal virtual {
131
+ _updateAndDistributeRewardsForTwo(from, to);
132
+ }
133
+
134
+ function _afterTokenTransfer(address from, address to, uint256) internal virtual {
135
+ _updateUserActiveBalanceForTwo(from, to);
136
+ }
137
+ }
@@ -0,0 +1,170 @@
1
+ // SPDX-License-Identifier: GPL-3.0-or-later
2
+ pragma solidity 0.8.17;
3
+ import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
4
+
5
+ import "../../../interfaces/IPMarket.sol";
6
+ import "../../../interfaces/IPYieldContractFactory.sol";
7
+ import "../../../interfaces/IPMarketFactory.sol";
8
+
9
+ import "../../libraries/BaseSplitCodeFactory.sol";
10
+ import "../../libraries/Errors.sol";
11
+ import "../../libraries/BoringOwnableUpgradeable.sol";
12
+
13
+ contract PendleMarketFactoryV2 is BoringOwnableUpgradeable, IPMarketFactory {
14
+ using EnumerableSet for EnumerableSet.AddressSet;
15
+
16
+ address public immutable marketCreationCodeContractA;
17
+ uint256 public immutable marketCreationCodeSizeA;
18
+ address public immutable marketCreationCodeContractB;
19
+ uint256 public immutable marketCreationCodeSizeB;
20
+
21
+ address public immutable yieldContractFactory;
22
+ uint256 public immutable maxLnFeeRateRoot;
23
+ uint8 public constant maxReserveFeePercent = 100;
24
+ int256 public constant minInitialAnchor = Math.IONE;
25
+
26
+ address public treasury;
27
+ address public rewardDistributor;
28
+ FeeConfig public defaultFee;
29
+ /// 1 SLOT
30
+
31
+ // router -> overriddenFee
32
+ mapping(address => FeeConfig) public overriddenFee;
33
+
34
+ // PT -> scalarRoot -> initialAnchor
35
+ mapping(address => mapping(int256 => mapping(int256 => address))) internal markets;
36
+ EnumerableSet.AddressSet internal allMarkets;
37
+ address public vePendle;
38
+ address public gaugeController;
39
+
40
+ constructor(
41
+ address _yieldContractFactory,
42
+ address _marketCreationCodeContractA,
43
+ uint256 _marketCreationCodeSizeA,
44
+ address _marketCreationCodeContractB,
45
+ uint256 _marketCreationCodeSizeB
46
+ ) {
47
+ yieldContractFactory = _yieldContractFactory;
48
+ maxLnFeeRateRoot = uint256(LogExpMath.ln(int256((105 * Math.IONE) / 100))); // ln(1.05)
49
+
50
+ marketCreationCodeContractA = _marketCreationCodeContractA;
51
+ marketCreationCodeSizeA = _marketCreationCodeSizeA;
52
+ marketCreationCodeContractB = _marketCreationCodeContractB;
53
+ marketCreationCodeSizeB = _marketCreationCodeSizeB;
54
+ }
55
+
56
+ function initialize(
57
+ address _treasury,
58
+ uint80 _defaultLnFeeRateRoot,
59
+ uint8 _defaultReserveFeePercent,
60
+ address newVePendle,
61
+ address newGaugeController,
62
+ address newRewardDistributor
63
+ ) external initializer {
64
+ __BoringOwnable_init();
65
+ setTreasury(_treasury);
66
+ setDefaultFee(_defaultLnFeeRateRoot, _defaultReserveFeePercent);
67
+
68
+ vePendle = newVePendle;
69
+ gaugeController = newGaugeController;
70
+ rewardDistributor = newRewardDistributor;
71
+ }
72
+
73
+ /**
74
+ * @notice Create a market between PT and its corresponding SY with scalar & anchor config.
75
+ * Anyone is allowed to create a market on their own.
76
+ */
77
+ function createNewMarket(
78
+ address PT,
79
+ int256 scalarRoot,
80
+ int256 initialAnchor
81
+ ) external returns (address market) {
82
+ if (!IPYieldContractFactory(yieldContractFactory).isPT(PT))
83
+ revert Errors.MarketFactoryInvalidPt();
84
+ if (IPPrincipalToken(PT).isExpired()) revert Errors.MarketFactoryExpiredPt();
85
+
86
+ if (markets[PT][scalarRoot][initialAnchor] != address(0))
87
+ revert Errors.MarketFactoryMarketExists();
88
+
89
+ if (initialAnchor < minInitialAnchor)
90
+ revert Errors.MarketFactoryInitialAnchorTooLow(initialAnchor, minInitialAnchor);
91
+
92
+ market = BaseSplitCodeFactory._create2(
93
+ 0,
94
+ bytes32(block.chainid),
95
+ abi.encode(PT, scalarRoot, initialAnchor, vePendle, gaugeController),
96
+ marketCreationCodeContractA,
97
+ marketCreationCodeSizeA,
98
+ marketCreationCodeContractB,
99
+ marketCreationCodeSizeB
100
+ );
101
+
102
+ markets[PT][scalarRoot][initialAnchor] = market;
103
+
104
+ if (!allMarkets.add(market)) assert(false);
105
+
106
+ emit CreateNewMarket(market, PT, scalarRoot, initialAnchor);
107
+ }
108
+
109
+ function getMarketConfig(
110
+ address router
111
+ ) external view returns (address _treasury, uint80 _lnFeeRateRoot, uint8 _reserveFeePercent) {
112
+ (_treasury, _lnFeeRateRoot, _reserveFeePercent) = (
113
+ treasury,
114
+ defaultFee.lnFeeRateRoot,
115
+ defaultFee.reserveFeePercent
116
+ );
117
+
118
+ FeeConfig memory over = overriddenFee[router];
119
+ if (over.active) {
120
+ (_lnFeeRateRoot, _reserveFeePercent) = (over.lnFeeRateRoot, over.reserveFeePercent);
121
+ }
122
+ }
123
+
124
+ /// @dev for gas-efficient verification of market
125
+ function isValidMarket(address market) external view returns (bool) {
126
+ return allMarkets.contains(market);
127
+ }
128
+
129
+ function setTreasury(address newTreasury) public onlyOwner {
130
+ if (newTreasury == address(0)) revert Errors.MarketFactoryZeroTreasury();
131
+
132
+ treasury = newTreasury;
133
+ _emitNewMarketConfigEvent();
134
+ }
135
+
136
+ function setDefaultFee(uint80 newLnFeeRateRoot, uint8 newReserveFeePercent) public onlyOwner {
137
+ _verifyFeeConfig(newLnFeeRateRoot, newReserveFeePercent);
138
+ defaultFee = FeeConfig(newLnFeeRateRoot, newReserveFeePercent, true);
139
+ _emitNewMarketConfigEvent();
140
+ }
141
+
142
+ function setOverriddenFee(
143
+ address router,
144
+ uint80 newLnFeeRateRoot,
145
+ uint8 newReserveFeePercent
146
+ ) public onlyOwner {
147
+ _verifyFeeConfig(newLnFeeRateRoot, newReserveFeePercent);
148
+ overriddenFee[router] = FeeConfig(newLnFeeRateRoot, newReserveFeePercent, true);
149
+ emit SetOverriddenFee(router, newLnFeeRateRoot, newReserveFeePercent);
150
+ }
151
+
152
+ function unsetOverriddenFee(address router) external onlyOwner {
153
+ delete overriddenFee[router];
154
+ emit UnsetOverriddenFee(router);
155
+ }
156
+
157
+ function _verifyFeeConfig(uint80 newLnFeeRateRoot, uint8 newReserveFeePercent) internal view {
158
+ if (newLnFeeRateRoot > maxLnFeeRateRoot)
159
+ revert Errors.MarketFactoryLnFeeRateRootTooHigh(newLnFeeRateRoot, maxLnFeeRateRoot);
160
+ if (newReserveFeePercent > maxReserveFeePercent)
161
+ revert Errors.MarketFactoryReserveFeePercentTooHigh(
162
+ newReserveFeePercent,
163
+ maxReserveFeePercent
164
+ );
165
+ }
166
+
167
+ function _emitNewMarketConfigEvent() internal {
168
+ emit NewMarketConfig(treasury, defaultFee.lnFeeRateRoot, defaultFee.reserveFeePercent);
169
+ }
170
+ }
@@ -0,0 +1,373 @@
1
+ // SPDX-License-Identifier: GPL-3.0-or-later
2
+ pragma solidity 0.8.17;
3
+
4
+ import "../../../interfaces/IPMarket.sol";
5
+ import "../../../interfaces/IPMarketFactory.sol";
6
+ import "../../../interfaces/IPMarketSwapCallback.sol";
7
+
8
+ import "../../erc20/PendleERC20Permit.sol";
9
+ import "./PendleGaugeV2.sol";
10
+ import "../OracleLib.sol";
11
+
12
+ /**
13
+ Invariance to maintain:
14
+ - Internal balances totalPt & totalSy not interfered by people transferring tokens in directly
15
+ - address(0) & address(this) should never have any rewards & activeBalance accounting done. This is
16
+ guaranteed by address(0) & address(this) check in each updateForTwo function
17
+ */
18
+ contract PendleMarketV2 is PendleERC20Permit, PendleGaugeV2, IPMarket {
19
+ using Math for uint256;
20
+ using Math for int256;
21
+ using MarketMathCore for MarketState;
22
+ using SafeERC20 for IERC20;
23
+ using PYIndexLib for IPYieldToken;
24
+ using OracleLib for OracleLib.Observation[65535];
25
+
26
+ struct MarketStorage {
27
+ int128 totalPt;
28
+ int128 totalSy;
29
+ // 1 SLOT = 256 bits
30
+ uint96 lastLnImpliedRate;
31
+ uint16 observationIndex;
32
+ uint16 observationCardinality;
33
+ uint16 observationCardinalityNext;
34
+ // 1 SLOT = 144 bits
35
+ }
36
+
37
+ string private constant NAME = "Pendle Market";
38
+ string private constant SYMBOL = "PENDLE-LPT";
39
+
40
+ IPPrincipalToken internal immutable PT;
41
+ IStandardizedYield internal immutable SY;
42
+ IPYieldToken internal immutable YT;
43
+
44
+ address public immutable factory;
45
+ uint256 public immutable expiry;
46
+ int256 public immutable scalarRoot;
47
+ int256 public immutable initialAnchor;
48
+
49
+ MarketStorage public _storage;
50
+
51
+ OracleLib.Observation[65535] public observations;
52
+
53
+ modifier notExpired() {
54
+ if (isExpired()) revert Errors.MarketExpired();
55
+ _;
56
+ }
57
+
58
+ constructor(
59
+ address _PT,
60
+ int256 _scalarRoot,
61
+ int256 _initialAnchor,
62
+ address _vePendle,
63
+ address _gaugeController
64
+ )
65
+ PendleERC20Permit(NAME, SYMBOL, 18)
66
+ PendleGaugeV2(IPPrincipalToken(_PT).SY(), _vePendle, _gaugeController, msg.sender)
67
+ {
68
+ PT = IPPrincipalToken(_PT);
69
+ SY = IStandardizedYield(PT.SY());
70
+ YT = IPYieldToken(PT.YT());
71
+
72
+ (_storage.observationCardinality, _storage.observationCardinalityNext) = observations
73
+ .initialize(uint32(block.timestamp));
74
+
75
+ if (_scalarRoot <= 0) revert Errors.MarketScalarRootBelowZero(_scalarRoot);
76
+
77
+ scalarRoot = _scalarRoot;
78
+ initialAnchor = _initialAnchor;
79
+ expiry = IPPrincipalToken(_PT).expiry();
80
+ factory = msg.sender;
81
+ }
82
+
83
+ /**
84
+ * @notice PendleMarket allows users to provide in PT & SY in exchange for LPs, which
85
+ * will grant LP holders more exchange fee over time
86
+ * @dev will mint as much LP as possible such that the corresponding SY and PT used do
87
+ * not exceed `netSyDesired` and `netPtDesired`, respectively
88
+ * @dev PT and SY should be transferred to this contract prior to calling
89
+ * @dev will revert if PT is expired
90
+ */
91
+ function mint(
92
+ address receiver,
93
+ uint256 netSyDesired,
94
+ uint256 netPtDesired
95
+ )
96
+ external
97
+ nonReentrant
98
+ notExpired
99
+ returns (uint256 netLpOut, uint256 netSyUsed, uint256 netPtUsed)
100
+ {
101
+ MarketState memory market = readState(msg.sender);
102
+ PYIndex index = YT.newIndex();
103
+
104
+ uint256 lpToReserve;
105
+
106
+ (lpToReserve, netLpOut, netSyUsed, netPtUsed) = market.addLiquidity(
107
+ netSyDesired,
108
+ netPtDesired,
109
+ block.timestamp
110
+ );
111
+
112
+ // initializing the market
113
+ if (lpToReserve != 0) {
114
+ market.setInitialLnImpliedRate(index, initialAnchor, block.timestamp);
115
+ _mint(address(1), lpToReserve);
116
+ }
117
+
118
+ _mint(receiver, netLpOut);
119
+
120
+ _writeState(market);
121
+
122
+ if (_selfBalance(SY) < market.totalSy.Uint())
123
+ revert Errors.MarketInsufficientSyReceived(_selfBalance(SY), market.totalSy.Uint());
124
+ if (_selfBalance(PT) < market.totalPt.Uint())
125
+ revert Errors.MarketInsufficientPtReceived(_selfBalance(PT), market.totalPt.Uint());
126
+
127
+ emit Mint(receiver, netLpOut, netSyUsed, netPtUsed);
128
+ }
129
+
130
+ /**
131
+ * @notice LP Holders can burn their LP to receive back SY & PT proportionally
132
+ * to their share of the market
133
+ */
134
+ function burn(
135
+ address receiverSy,
136
+ address receiverPt,
137
+ uint256 netLpToBurn
138
+ ) external nonReentrant returns (uint256 netSyOut, uint256 netPtOut) {
139
+ MarketState memory market = readState(msg.sender);
140
+
141
+ _burn(address(this), netLpToBurn);
142
+
143
+ (netSyOut, netPtOut) = market.removeLiquidity(netLpToBurn);
144
+
145
+ if (receiverSy != address(this)) IERC20(SY).safeTransfer(receiverSy, netSyOut);
146
+ if (receiverPt != address(this)) IERC20(PT).safeTransfer(receiverPt, netPtOut);
147
+
148
+ _writeState(market);
149
+
150
+ emit Burn(receiverSy, receiverPt, netLpToBurn, netSyOut, netPtOut);
151
+ }
152
+
153
+ /**
154
+ * @notice Pendle Market allows swaps between PT & SY it is holding. This function
155
+ * aims to swap an exact amount of PT to SY.
156
+ * @dev steps working of this contract
157
+ - The outcome amount of SY will be precomputed by MarketMathLib
158
+ - Release the calculated amount of SY to receiver
159
+ - Callback to msg.sender if data.length > 0
160
+ - Ensure exactPtIn amount of PT has been transferred to this address
161
+ * @dev will revert if PT is expired
162
+ * @param data bytes data to be sent in the callback (if any)
163
+ */
164
+ function swapExactPtForSy(
165
+ address receiver,
166
+ uint256 exactPtIn,
167
+ bytes calldata data
168
+ ) external nonReentrant notExpired returns (uint256 netSyOut, uint256 netSyFee) {
169
+ MarketState memory market = readState(msg.sender);
170
+
171
+ uint256 netSyToReserve;
172
+ (netSyOut, netSyFee, netSyToReserve) = market.swapExactPtForSy(
173
+ YT.newIndex(),
174
+ exactPtIn,
175
+ block.timestamp
176
+ );
177
+
178
+ if (receiver != address(this)) IERC20(SY).safeTransfer(receiver, netSyOut);
179
+ IERC20(SY).safeTransfer(market.treasury, netSyToReserve);
180
+
181
+ _writeState(market);
182
+
183
+ if (data.length > 0) {
184
+ IPMarketSwapCallback(msg.sender).swapCallback(exactPtIn.neg(), netSyOut.Int(), data);
185
+ }
186
+
187
+ if (_selfBalance(PT) < market.totalPt.Uint())
188
+ revert Errors.MarketInsufficientPtReceived(_selfBalance(PT), market.totalPt.Uint());
189
+
190
+ emit Swap(msg.sender, receiver, exactPtIn.neg(), netSyOut.Int(), netSyFee, netSyToReserve);
191
+ }
192
+
193
+ /**
194
+ * @notice Pendle Market allows swaps between PT & SY it is holding. This function
195
+ * aims to swap SY for an exact amount of PT.
196
+ * @dev steps working of this function
197
+ - The exact outcome amount of PT will be transferred to receiver
198
+ - Callback to msg.sender if data.length > 0
199
+ - Ensure the calculated required amount of SY is transferred to this address
200
+ * @dev will revert if PT is expired
201
+ * @param data bytes data to be sent in the callback (if any)
202
+ */
203
+ function swapSyForExactPt(
204
+ address receiver,
205
+ uint256 exactPtOut,
206
+ bytes calldata data
207
+ ) external nonReentrant notExpired returns (uint256 netSyIn, uint256 netSyFee) {
208
+ MarketState memory market = readState(msg.sender);
209
+
210
+ uint256 netSyToReserve;
211
+ (netSyIn, netSyFee, netSyToReserve) = market.swapSyForExactPt(
212
+ YT.newIndex(),
213
+ exactPtOut,
214
+ block.timestamp
215
+ );
216
+
217
+ if (receiver != address(this)) IERC20(PT).safeTransfer(receiver, exactPtOut);
218
+ IERC20(SY).safeTransfer(market.treasury, netSyToReserve);
219
+
220
+ _writeState(market);
221
+
222
+ if (data.length > 0) {
223
+ IPMarketSwapCallback(msg.sender).swapCallback(exactPtOut.Int(), netSyIn.neg(), data);
224
+ }
225
+
226
+ // have received enough SY
227
+ if (_selfBalance(SY) < market.totalSy.Uint())
228
+ revert Errors.MarketInsufficientSyReceived(_selfBalance(SY), market.totalSy.Uint());
229
+
230
+ emit Swap(msg.sender, receiver, exactPtOut.Int(), netSyIn.neg(), netSyFee, netSyToReserve);
231
+ }
232
+
233
+ /// @notice forces balances to match reserves
234
+ function skim() external nonReentrant {
235
+ MarketState memory market = readState(msg.sender);
236
+ uint256 excessPt = _selfBalance(PT) - market.totalPt.Uint();
237
+ uint256 excessSy = _selfBalance(SY) - market.totalSy.Uint();
238
+ if (excessPt != 0) IERC20(PT).safeTransfer(market.treasury, excessPt);
239
+ if (excessSy != 0) IERC20(SY).safeTransfer(market.treasury, excessSy);
240
+ }
241
+
242
+ /**
243
+ * @notice redeems the user's reward
244
+ * @return amount of reward token redeemed, in the same order as `getRewardTokens()`
245
+ */
246
+ function redeemRewards(address user) external nonReentrant returns (uint256[] memory) {
247
+ return _redeemRewards(user);
248
+ }
249
+
250
+ /// @notice returns the list of reward tokens
251
+ function getRewardTokens() external view returns (address[] memory) {
252
+ return _getRewardTokens();
253
+ }
254
+
255
+ /*///////////////////////////////////////////////////////////////
256
+ ORACLE
257
+ //////////////////////////////////////////////////////////////*/
258
+
259
+ function observe(
260
+ uint32[] memory secondsAgos
261
+ ) external view returns (uint216[] memory lnImpliedRateCumulative) {
262
+ return
263
+ observations.observe(
264
+ uint32(block.timestamp),
265
+ secondsAgos,
266
+ _storage.lastLnImpliedRate,
267
+ _storage.observationIndex,
268
+ _storage.observationCardinality
269
+ );
270
+ }
271
+
272
+ function increaseObservationsCardinalityNext(uint16 cardinalityNext) external nonReentrant {
273
+ uint16 cardinalityNextOld = _storage.observationCardinalityNext;
274
+ uint16 cardinalityNextNew = observations.grow(cardinalityNextOld, cardinalityNext);
275
+ if (cardinalityNextOld != cardinalityNextNew) {
276
+ _storage.observationCardinalityNext = cardinalityNextNew;
277
+ emit IncreaseObservationCardinalityNext(cardinalityNextOld, cardinalityNextNew);
278
+ }
279
+ }
280
+
281
+ /*///////////////////////////////////////////////////////////////
282
+ READ/WRITE STATES
283
+ //////////////////////////////////////////////////////////////*/
284
+
285
+ /**
286
+ * @notice read the state of the market from storage into memory for gas-efficient manipulation
287
+ */
288
+ function readState(address router) public view returns (MarketState memory market) {
289
+ market.totalPt = _storage.totalPt;
290
+ market.totalSy = _storage.totalSy;
291
+ market.totalLp = totalSupply().Int();
292
+
293
+ (market.treasury, market.lnFeeRateRoot, market.reserveFeePercent) = IPMarketFactory(
294
+ factory
295
+ ).getMarketConfig(router);
296
+
297
+ market.scalarRoot = scalarRoot;
298
+ market.expiry = expiry;
299
+
300
+ market.lastLnImpliedRate = _storage.lastLnImpliedRate;
301
+ }
302
+
303
+ /// @notice write back the state of the market from memory to storage
304
+ function _writeState(MarketState memory market) internal {
305
+ uint96 lastLnImpliedRate96 = market.lastLnImpliedRate.Uint96();
306
+ int128 totalPt128 = market.totalPt.Int128();
307
+ int128 totalSy128 = market.totalSy.Int128();
308
+
309
+ (uint16 observationIndex, uint16 observationCardinality) = observations.write(
310
+ _storage.observationIndex,
311
+ uint32(block.timestamp),
312
+ _storage.lastLnImpliedRate,
313
+ _storage.observationCardinality,
314
+ _storage.observationCardinalityNext
315
+ );
316
+
317
+ _storage.totalPt = totalPt128;
318
+ _storage.totalSy = totalSy128;
319
+ _storage.lastLnImpliedRate = lastLnImpliedRate96;
320
+ _storage.observationIndex = observationIndex;
321
+ _storage.observationCardinality = observationCardinality;
322
+
323
+ emit UpdateImpliedRate(block.timestamp, market.lastLnImpliedRate);
324
+ }
325
+
326
+ /*///////////////////////////////////////////////////////////////
327
+ TRIVIAL FUNCTIONS
328
+ //////////////////////////////////////////////////////////////*/
329
+
330
+ function readTokens()
331
+ external
332
+ view
333
+ returns (IStandardizedYield _SY, IPPrincipalToken _PT, IPYieldToken _YT)
334
+ {
335
+ _SY = SY;
336
+ _PT = PT;
337
+ _YT = YT;
338
+ }
339
+
340
+ function isExpired() public view returns (bool) {
341
+ return MiniHelpers.isCurrentlyExpired(expiry);
342
+ }
343
+
344
+ /*///////////////////////////////////////////////////////////////
345
+ PENDLE GAUGE - RELATED
346
+ //////////////////////////////////////////////////////////////*/
347
+
348
+ function _stakedBalance(address user) internal view override returns (uint256) {
349
+ return balanceOf(user);
350
+ }
351
+
352
+ function _totalStaked() internal view override returns (uint256) {
353
+ return totalSupply();
354
+ }
355
+
356
+ // solhint-disable-next-line ordering
357
+ function _beforeTokenTransfer(
358
+ address from,
359
+ address to,
360
+ uint256 amount
361
+ ) internal override(PendleERC20, PendleGaugeV2) {
362
+ PendleGaugeV2._beforeTokenTransfer(from, to, amount);
363
+ }
364
+
365
+ // solhint-disable-next-line ordering
366
+ function _afterTokenTransfer(
367
+ address from,
368
+ address to,
369
+ uint256 amount
370
+ ) internal override(PendleERC20, PendleGaugeV2) {
371
+ PendleGaugeV2._afterTokenTransfer(from, to, amount);
372
+ }
373
+ }