@pendle/core-v2 2.23.1 → 2.23.3-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.
- package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/PendleMsgReceiveEndpointUpg.sol/PendleMsgReceiveEndpointUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/PendleMsgReceiverAppUpg.sol/PendleMsgReceiverAppUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/PendleMsgSendEndpointUpg.sol/PendleMsgSendEndpointUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/PendleMsgSenderAppUpg.sol/PendleMsgSenderAppUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/libraries/LayerZeroHelper.sol/LayerZeroHelper.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerBaseUpg.sol/PendleGaugeControllerBaseUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerMainchainUpg.sol/PendleGaugeControllerMainchainUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerSidechainUpg.sol/PendleGaugeControllerSidechainUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/VeDistributor/PendleFeeDistributor.sol/PendleFeeDistributor.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/VeDistributor/PendleFeeDistributor.sol/PendleFeeDistributor.json +2 -2
- package/build/artifacts/contracts/LiquidityMining/VeDistributor/PendleFeeDistributorV2.sol/PendleFeeDistributorV2.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/VotingController/PendleVotingControllerUpg.sol/PendleVotingControllerUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/VotingController/VotingControllerStorageUpg.sol/VotingControllerStorageUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol/VotingEscrowPendleMainchain.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowPendleSidechain.sol/VotingEscrowPendleSidechain.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowTokenBase.sol/VotingEscrowTokenBase.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/libraries/VeBalanceLib.sol/VeBalanceLib.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/libraries/VeHistoryLib.sol/CheckpointHelper.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/libraries/VeHistoryLib.sol/Checkpoints.dbg.json +1 -1
- package/build/artifacts/contracts/core/BulkSeller/BulkSeller.sol/BulkSeller.dbg.json +1 -1
- package/build/artifacts/contracts/core/BulkSeller/BulkSellerFactory.sol/BulkSellerFactory.dbg.json +1 -1
- package/build/artifacts/contracts/core/BulkSeller/BulkSellerMathCore.sol/BulkSellerMathCore.dbg.json +1 -1
- package/build/artifacts/contracts/core/Market/MarketMathCore.sol/MarketMathCore.dbg.json +1 -1
- package/build/artifacts/contracts/core/Market/OracleLib.sol/OracleLib.dbg.json +1 -1
- package/build/artifacts/contracts/core/Market/PendleExternalRewardDistributor.sol/PendleExternalRewardDistributor.dbg.json +4 -0
- package/build/artifacts/contracts/core/Market/PendleExternalRewardDistributor.sol/PendleExternalRewardDistributor.json +373 -0
- package/build/artifacts/contracts/core/Market/PendleGauge.sol/PendleGauge.dbg.json +1 -1
- package/build/artifacts/contracts/core/Market/PendleMarket.sol/PendleMarket.dbg.json +1 -1
- package/build/artifacts/contracts/core/Market/PendleMarket.sol/PendleMarket.json +2 -2
- package/build/artifacts/contracts/core/Market/PendleMarketFactory.sol/PendleMarketFactory.dbg.json +1 -1
- package/build/artifacts/contracts/core/Market/v2/PendleGaugeV2.sol/PendleGaugeV2.dbg.json +4 -0
- package/build/artifacts/contracts/core/Market/v2/PendleGaugeV2.sol/PendleGaugeV2.json +128 -0
- package/build/artifacts/contracts/core/Market/v2/PendleMarketFactoryV2.sol/PendleMarketFactoryV2.dbg.json +4 -0
- package/build/artifacts/contracts/core/Market/v2/PendleMarketFactoryV2.sol/PendleMarketFactoryV2.json +682 -0
- package/build/artifacts/contracts/core/Market/v2/PendleMarketV2.sol/PendleMarketV2.dbg.json +4 -0
- package/build/artifacts/contracts/core/Market/v2/PendleMarketV2.sol/PendleMarketV2.json +1219 -0
- package/build/artifacts/contracts/core/RewardManager/RewardManager.sol/RewardManager.dbg.json +1 -1
- package/build/artifacts/contracts/core/RewardManager/RewardManagerAbstract.sol/RewardManagerAbstract.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/PYIndex.sol/PYIndexLib.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/SYBase.sol/SYBase.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/SYBaseWithRewards.sol/SYBaseWithRewards.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Ankr/PendleAnkrBNBSY.sol/PendleAnkrBNBSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Ape/sAPE.sol/sAPE.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/AuraEthxBbAWethSY.sol/AuraEthxBbAWethSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/AuraEthxBbAWethSY.sol/AuraEthxBbAWethSY.json +2 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraBbAWethSwethSY.sol/PendleAuraBbAWethSwethSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraBbAWethSwethSY.sol/PendleAuraBbAWethSwethSY.json +2 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWethAnkrethSYV2.sol/PendleAuraWethAnkrethSYV2.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWethAnkrethSYV2.sol/PendleAuraWethAnkrethSYV2.json +2 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWethRocketEthSYV2.sol/PendleAuraWethRocketEthSYV2.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWethRocketEthSYV2.sol/PendleAuraWethRocketEthSYV2.json +2 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWethStafiEthSY.sol/PendleAuraWethStafiEthSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWethStafiEthSY.sol/PendleAuraWethStafiEthSY.json +2 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWethVethSY.sol/PendleAuraWethVethSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWethVethSY.sol/PendleAuraWethVethSY.json +2 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWethWstethSYV2.sol/PendleAuraWethWstethSYV2.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWethWstethSYV2.sol/PendleAuraWethWstethSYV2.json +2 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWstethAnkreth.sol/PendleAuraWstethAnkreth.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWstethAnkreth.sol/PendleAuraWstethAnkreth.json +2 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/ComposableStable/ComposableStableMath.sol/ComposableStableMath.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/ComposableStable/ComposableStablePreview.sol/ComposableStablePreview.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/FixedPoint.sol/FixedPoint.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/Linear/BbAPoolHelper.sol/BbAPoolHelper.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/Linear/BbAPoolHelper.sol/BbAWethHelper.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/Linear/LinearMath.sol/LinearMath.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/Linear/LinearPreview.sol/LinearPreview.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/MetaStable/MetaStableMath.sol/MetaStableMath.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/MetaStable/MetaStablePreview.sol/MetaStablePreview.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/PendleAuraBalancerStableLPSYV2.sol/PendleAuraBalancerStableLPSYV2.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BenQi/PendleQiTokenHelper.sol/PendleQiTokenHelper.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BenQi/PendleQiTokenSY.sol/PendleQiTokenSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BenQi/PendleQiTokenSY.sol/PendleQiTokenSY.json +2 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/CamelotV1Volatile/CamelotRewardHelper.sol/CamelotRewardHelper.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/CamelotV1Volatile/CamelotV1VolatileCommon.sol/CamelotV1VolatileCommon.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/CamelotV1Volatile/CamelotV1VolatileLpHelper.sol/CamelotV1VolatileLpHelper.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/CamelotV1Volatile/CamelotV1VolatilePreview.sol/CamelotV1VolatilePreview.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/CamelotV1Volatile/PendleCamelotV1VolatileSY.sol/PendleCamelotV1VolatileSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/CamelotV1Volatile/PendleCamelotV1VolatileSY.sol/PendleCamelotV1VolatileSY.json +2 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/PendleCurveFraxUsdcSY.sol/PendleCurveFraxUsdcSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/PendleCurveFraxUsdcSY.sol/PendleCurveFraxUsdcSY.json +2 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/PendleCurveUsdd3CrvSY.sol/PendleCurveUsdd3CrvSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/PendleCurveUsdd3CrvSY.sol/PendleCurveUsdd3CrvSY.json +2 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/Curve3CrvPoolHelper.sol/Curve3CrvPoolHelper.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/CurveFraxUsdcPoolHelper.sol/CurveFraxUsdcPoolHelper.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/CurveUsdd3CrvPoolHelper.sol/CurveUsdd3CrvPoolHelper.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/PendleConvexLPSY.sol/PendleConvexLPSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/GLP/PendleGlpSY.sol/PendleGlpSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/GLP/PendleGlpSY.sol/PendleGlpSY.json +2 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleArbitrumStakedEthSY.sol/PendleArbitrumStakedEthSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleGdaiSY.sol/PendleGDaiSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleLooksStakingSY.sol/PendleLooksStakingSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleSfrxEthSY.sol/PendleSfrxEthSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleStargateLPSY.sol/PendleStargateLPSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleStargateLPSY.sol/PendleStargateLPSY.json +2 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleWbEthSY.sol/PendleWbEthSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleWstEthSY.sol/PendleWstEthSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Swell/PendleSwETH.sol/SwETHSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Thena/PendleThenaSY.sol/PendleThenaSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Thena/PendleThenaSY.sol/PendleThenaSY.json +2 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Thena/ThenaLpHelper.sol/ThenaLpHelper.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Thena/ThenaMath.sol/ThenaMath.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Thena/ThenaPreview.sol/IThenaSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Thena/ThenaPreview.sol/ThenaPreview.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContracts/InterestManagerYT.sol/InterestManagerYT.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContracts/PendlePrincipalToken.sol/PendlePrincipalToken.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldContractFactory.sol/PendleYieldContractFactory.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldContractFactory.sol/PendleYieldContractFactory.json +2 -2
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldToken.sol/PendleYieldToken.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldToken.sol/PendleYieldToken.json +2 -2
- package/build/artifacts/contracts/core/YieldContractsV2/InterestManagerYTV2.sol/InterestManagerYTV2.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContractsV2/PendlePrincipalTokenV2.sol/PendlePrincipalTokenV2.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContractsV2/PendleYieldContractFactoryV2.sol/PendleYieldContractFactoryV2.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContractsV2/PendleYieldContractFactoryV2.sol/PendleYieldContractFactoryV2.json +2 -2
- package/build/artifacts/contracts/core/YieldContractsV2/PendleYieldTokenV2.sol/PendleYieldTokenV2.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContractsV2/PendleYieldTokenV2.sol/PendleYieldTokenV2.json +2 -2
- package/build/artifacts/contracts/core/libraries/ArrayLib.sol/ArrayLib.dbg.json +1 -1
- package/build/artifacts/contracts/core/libraries/ArrayLib.sol/ArrayLib.json +2 -2
- package/build/artifacts/contracts/core/libraries/Errors.sol/Errors.dbg.json +1 -1
- package/build/artifacts/contracts/core/libraries/math/Math.sol/Math.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Ankr/IAnkrBNB.sol/IAnkrBNB.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Ankr/IAnkrLiquidStaking.sol/IAnkrLiquidStaking.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/BinanceEth/IWBETH.sol/IWBETH.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Camelot/ICamelotNFTPool.sol/ICamelotNFTPool.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Camelot/ICamelotNitroPool.sol/ICamelotNitroPool.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Camelot/ICamelotPair.sol/ICamelotPair.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionAddRemoveLiq.sol/IPActionAddRemoveLiq.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionInfoStatic.sol/IPActionInfoStatic.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionMarketAuxStatic.sol/IPActionMarketAuxStatic.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionMarketCoreStatic.sol/IPActionMarketCoreStatic.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionMintRedeem.sol/IPActionMintRedeem.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionMintRedeemStatic.sol/IPActionMintRedeemStatic.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionStorageStatic.sol/IPActionStorageStatic.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionSwapPT.sol/IPActionSwapPT.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionSwapYT.sol/IPActionSwapYT.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPAllAction.sol/IPAllAction.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPBulkSeller.sol/IPBulkSeller.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPExternalRewardDistributor.sol/IPExternalRewardDistributor.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/IPExternalRewardDistributor.sol/IPExternalRewardDistributor.json +109 -0
- package/build/artifacts/contracts/interfaces/IPGauge.sol/IPGauge.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPMarket.sol/IPMarket.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPMarketFactoryV2.sol/IPMarketFactoryV2.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/IPMarketFactoryV2.sol/IPMarketFactoryV2.json +166 -0
- package/build/artifacts/contracts/interfaces/IPRouterHelper.sol/IPRouterHelper.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPRouterStatic.sol/IPRouterStatic.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPVotingController.sol/IPVotingController.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPVotingEscrowMainchain.sol/IPVotingEscrowMainchain.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPendlePreviewHelper.sol/IPendlePreviewHelper.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IStandardizedYield.sol/IStandardizedYield.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/ISwETH.sol/ISwETH.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Thena/IThenaFactory.sol/IThenaFactory.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Thena/IThenaGaugeV2.sol/IThenaGaugeV2.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Thena/IThenaPair.sol/IThenaPair.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Thena/IThenaRouter.sol/IThenaRouter.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/BoringLpSeller.sol/BoringLpSeller.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/BoringPtSeller.sol/BoringPtSeller.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/Broadcaster.sol/Broadcaster.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/BulkSellerOffchain.sol/BulkSellerOffchain.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/LegacyNFTHelper.sol/LegacyNFTHelper.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/LegacyNFTHelper.sol/StarNFTV1.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/MarketExchangeRateLib.sol/MarketExchangeRateLib.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/PtAndLpToAsset.sol/PtAndLpToAsset.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/router-static/PendleRouterStatic.sol/PendleRouterStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionInfoStatic.sol/ActionInfoStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionMarketAuxStatic.sol/ActionMarketAuxStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionMarketCoreStatic.sol/ActionMarketCoreStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionMintRedeemStatic.sol/ActionMintRedeemStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionStorageStatic.sol/ActionStorageStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionVePendleStatic.sol/ActionVePendleStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/router-static/base/StorageLayout.sol/StorageLayout.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/PendleLpOracleLib.sol/PendleLpOracleLib.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/PendlePtOracle.sol/PendlePtOracle.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/PendlePtOracleLib.sol/PendlePtOracleLib.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/samples/PendleLpGlpOracle.sol/PendleLpGlpOracle.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/samples/PendlePtGlpOracle.sol/PendlePtGlpOracle.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/samples/PendlePtUsdChainlinkOracle.sol/PendlePtUsdChainlinkOracle.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionAddRemoveLiq.sol/ActionAddRemoveLiq.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionMintRedeem.sol/ActionMintRedeem.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionSwapPT.sol/ActionSwapPT.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionSwapYT.sol/ActionSwapYT.dbg.json +1 -1
- package/build/artifacts/contracts/router/PendleRouter.sol/PendleRouter.dbg.json +1 -1
- package/build/artifacts/contracts/router/PendleRouterHelper.sol/PendleRouterHelper.dbg.json +1 -1
- package/build/artifacts/contracts/router/base/ActionBaseCallback.sol/ActionBaseCallback.dbg.json +1 -1
- package/build/artifacts/contracts/router/base/ActionBaseMintRedeem.sol/ActionBaseMintRedeem.dbg.json +1 -1
- package/build/artifacts/contracts/router/base/CallbackHelper.sol/CallbackHelper.dbg.json +1 -1
- package/build/artifacts/contracts/router/base/MarketApproxLib.sol/MarketApproxPtInLib.dbg.json +1 -1
- package/build/artifacts/contracts/router/base/MarketApproxLib.sol/MarketApproxPtOutLib.dbg.json +1 -1
- package/build/artifacts/contracts/router/swap-aggregator/1inch/I1inchAggregationRouterV5.sol/I1inchAggregationRouterV5.dbg.json +1 -1
- package/build/artifacts/contracts/router/swap-aggregator/1inch/OneInchAggregationRouterHelper.sol/OneInchAggregationRouterHelper.dbg.json +1 -1
- package/build/artifacts/contracts/router/swap-aggregator/PendleSwap.sol/PendleSwap.dbg.json +1 -1
- package/build/artifacts/contracts/router/swap-aggregator/kyberswap/IExecutorHelper.sol/IExecutorHelper.dbg.json +1 -1
- package/build/artifacts/contracts/router/swap-aggregator/kyberswap/KyberInputScalingHelper.sol/KyberInputScalingHelper.dbg.json +1 -1
- package/build/artifacts/contracts/router/swap-aggregator/kyberswap/ScalingDataLib.sol/ScalingDataLib.dbg.json +1 -1
- package/contracts/LiquidityMining/CrossChainMsg/libraries/LayerZeroHelper.sol +4 -0
- package/contracts/core/Market/PendleExternalRewardDistributor.sol +135 -0
- package/contracts/core/Market/v2/PendleGaugeV2.sol +142 -0
- package/contracts/core/Market/v2/PendleMarketFactoryV2.sol +177 -0
- package/contracts/core/Market/v2/PendleMarketV2.sol +379 -0
- package/contracts/core/RewardManager/RewardManager.sol +0 -1
- package/contracts/core/RewardManager/RewardManagerAbstract.sol +3 -2
- package/contracts/core/StandardizedYield/implementations/BalancerStable/base/ComposableStable/ComposableStablePreview.sol +1 -607
- package/contracts/core/StandardizedYield/implementations/BalancerStable/base/ComposableStable/ComposableStablePreviewProxy.sol +53 -0
- package/contracts/core/StandardizedYield/implementations/BalancerStable/base/ComposableStable/ComposableStablePreviewV4.sol +600 -0
- package/contracts/core/StandardizedYield/implementations/BalancerStable/base/ComposableStable/ComposableStablePreviewV5.sol +621 -0
- package/contracts/core/StandardizedYield/implementations/BalancerStable/base/FixedPoint.sol +8 -0
- package/contracts/core/StandardizedYield/implementations/ChainlinkRelayer/PendleChainlinkReceiver.sol +46 -0
- package/contracts/core/StandardizedYield/implementations/ChainlinkRelayer/PendleChainlinkRelayer.sol +43 -0
- package/contracts/core/StandardizedYield/implementations/MantleStakedEth/PendleMantleStakedEthSY.sol +120 -0
- package/contracts/core/StandardizedYield/implementations/MantleStakedEth/PendleOracleForSyProxy.sol +23 -0
- package/contracts/core/libraries/ArrayLib.sol +32 -0
- package/contracts/core/libraries/Errors.sol +2 -0
- package/contracts/interfaces/Balancer/IPComposableStablePreview.sol +23 -0
- package/contracts/interfaces/Balancer/IVersion.sol +13 -0
- package/contracts/interfaces/IPExternalRewardDistributor.sol +19 -0
- package/contracts/interfaces/IPMarketFactoryV2.sol +8 -0
- package/contracts/interfaces/IPOracleForSy.sol +7 -0
- package/contracts/offchain-helpers/AutomateReady.sol +111 -0
- package/contracts/offchain-helpers/ChainlinkRelayerAutomation.sol +52 -0
- package/contracts/offchain-helpers/ChainlinkRelayerGelato.sol +36 -0
- package/contracts/offchain-helpers/errors/SDKErrorsDirectory.sol +149 -0
- package/contracts/router/swap-aggregator/PendleSwap.sol +7 -2
- package/deployments/5000-core.json +29 -0
- package/deployments/5000-markets/WSTETH-MANTLE-MARCH2024.json +10 -0
- package/package.json +7 -7
- package/typechain-types/AuraSwEthBbAWethSYV2.ts +1532 -0
- package/typechain-types/BotActionCallback.ts +1093 -0
- package/typechain-types/ComposableStablePreviewProxy.ts +352 -0
- package/typechain-types/ComposableStablePreviewV4.ts +217 -0
- package/typechain-types/ComposableStablePreviewV5.ts +217 -0
- package/typechain-types/IPComposableStablePreview.ts +217 -0
- package/typechain-types/IPOracleForSy.ts +87 -0
- package/typechain-types/IVersion.ts +81 -0
- package/typechain-types/LiquiditySeedingHelper.ts +128 -0
- package/typechain-types/LongYieldActionHelper.ts +1093 -0
- package/typechain-types/LongYieldTradingBot.ts +1093 -0
- package/typechain-types/PendleChainlinkReceiver.ts +239 -0
- package/typechain-types/PendleChainlinkRelayer.ts +158 -0
- package/typechain-types/PendleExternalRewardDistributor.ts +49 -0
- package/typechain-types/PendleMantleStakedEthSY.ts +1222 -0
- package/typechain-types/PendleMarketFactoryV2.ts +26 -24
- package/typechain-types/PendleOracleForSyProxy.ts +275 -0
- package/typechain-types/ShortYieldActionHelper.ts +1093 -0
- package/typechain-types/ShortYieldTradingBot.ts +1093 -0
- package/typechain-types/TradingBotBase.ts +1093 -0
- package/typechain-types/factories/AuraEthxBbAWethSY__factory.ts +1 -1
- package/typechain-types/factories/AuraSwEthBbAWethSYV2__factory.ts +1244 -0
- package/typechain-types/factories/BotActionCallback__factory.ts +899 -9
- package/typechain-types/factories/ComposableStablePreviewProxy__factory.ts +288 -0
- package/typechain-types/factories/ComposableStablePreviewV4__factory.ts +190 -0
- package/typechain-types/factories/ComposableStablePreviewV5__factory.ts +190 -0
- package/typechain-types/factories/IPComposableStablePreview__factory.ts +152 -0
- package/typechain-types/factories/IPOracleForSy__factory.ts +36 -0
- package/typechain-types/factories/IVersion__factory.ts +36 -0
- package/typechain-types/factories/LiquiditySeedingHelper__factory.ts +124 -0
- package/typechain-types/factories/LongYieldActionHelper__factory.ts +899 -9
- package/typechain-types/factories/LongYieldTradingBot__factory.ts +923 -33
- package/typechain-types/factories/PendleAuraBbAWethSwethSY__factory.ts +1 -1
- package/typechain-types/factories/PendleAuraWethAnkrethSYV2__factory.ts +1 -1
- package/typechain-types/factories/PendleAuraWethRocketEthSYV2__factory.ts +1 -1
- package/typechain-types/factories/PendleAuraWethStafiEthSY__factory.ts +1 -1
- package/typechain-types/factories/PendleAuraWethVethSY__factory.ts +1 -1
- package/typechain-types/factories/PendleAuraWethWstethSYV2__factory.ts +1 -1
- package/typechain-types/factories/PendleAuraWstethAnkreth__factory.ts +1 -1
- package/typechain-types/factories/PendleCamelotV1VolatileSY__factory.ts +1 -1
- package/typechain-types/factories/PendleChainlinkReceiver__factory.ts +216 -0
- package/typechain-types/factories/PendleChainlinkRelayer__factory.ts +180 -0
- package/typechain-types/factories/PendleCurveFraxUsdcSY__factory.ts +1 -1
- package/typechain-types/factories/PendleCurveUsdd3CrvSY__factory.ts +1 -1
- package/typechain-types/factories/PendleExternalRewardDistributor__factory.ts +29 -1
- package/typechain-types/factories/PendleFeeDistributor__factory.ts +1 -1
- package/typechain-types/factories/PendleGlpSY__factory.ts +1 -1
- package/typechain-types/factories/PendleMantleStakedEthSY__factory.ts +1068 -0
- package/typechain-types/factories/PendleMarketFactoryV2__factory.ts +15 -15
- package/typechain-types/factories/PendleMarketV2__factory.ts +10 -1
- package/typechain-types/factories/PendleMarket__factory.ts +1 -1
- package/typechain-types/factories/PendleOracleForSyProxy__factory.ts +211 -0
- package/typechain-types/factories/PendleQiTokenSY__factory.ts +1 -1
- package/typechain-types/factories/PendleStargateLPSY__factory.ts +1 -1
- package/typechain-types/factories/PendleThenaSY__factory.ts +1 -1
- package/typechain-types/factories/PendleYieldContractFactoryV2__factory.ts +1 -1
- package/typechain-types/factories/PendleYieldContractFactory__factory.ts +1 -1
- package/typechain-types/factories/PendleYieldTokenV2__factory.ts +1 -1
- package/typechain-types/factories/PendleYieldToken__factory.ts +1 -1
- package/typechain-types/factories/ShortYieldActionHelper__factory.ts +899 -9
- package/typechain-types/factories/ShortYieldTradingBot__factory.ts +939 -49
- package/typechain-types/factories/TradingBotBase__factory.ts +899 -9
- package/typechain-types/hardhat.d.ts +162 -9
- package/typechain-types/index.ts +34 -2
- /package/contracts/router/swap-aggregator/{1inch → oneinch}/I1inchAggregationRouterV5.sol +0 -0
- /package/contracts/router/swap-aggregator/{1inch → oneinch}/OneInchAggregationRouterHelper.sol +0 -0
|
@@ -0,0 +1,379 @@
|
|
|
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
|
+
address _externalRewardDistributor
|
|
65
|
+
)
|
|
66
|
+
PendleERC20Permit(NAME, SYMBOL, 18)
|
|
67
|
+
PendleGaugeV2(
|
|
68
|
+
IPPrincipalToken(_PT).SY(),
|
|
69
|
+
_vePendle,
|
|
70
|
+
_gaugeController,
|
|
71
|
+
_externalRewardDistributor
|
|
72
|
+
)
|
|
73
|
+
{
|
|
74
|
+
PT = IPPrincipalToken(_PT);
|
|
75
|
+
SY = IStandardizedYield(PT.SY());
|
|
76
|
+
YT = IPYieldToken(PT.YT());
|
|
77
|
+
|
|
78
|
+
(_storage.observationCardinality, _storage.observationCardinalityNext) = observations
|
|
79
|
+
.initialize(uint32(block.timestamp));
|
|
80
|
+
|
|
81
|
+
if (_scalarRoot <= 0) revert Errors.MarketScalarRootBelowZero(_scalarRoot);
|
|
82
|
+
|
|
83
|
+
scalarRoot = _scalarRoot;
|
|
84
|
+
initialAnchor = _initialAnchor;
|
|
85
|
+
expiry = IPPrincipalToken(_PT).expiry();
|
|
86
|
+
factory = msg.sender;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* @notice PendleMarket allows users to provide in PT & SY in exchange for LPs, which
|
|
91
|
+
* will grant LP holders more exchange fee over time
|
|
92
|
+
* @dev will mint as much LP as possible such that the corresponding SY and PT used do
|
|
93
|
+
* not exceed `netSyDesired` and `netPtDesired`, respectively
|
|
94
|
+
* @dev PT and SY should be transferred to this contract prior to calling
|
|
95
|
+
* @dev will revert if PT is expired
|
|
96
|
+
*/
|
|
97
|
+
function mint(
|
|
98
|
+
address receiver,
|
|
99
|
+
uint256 netSyDesired,
|
|
100
|
+
uint256 netPtDesired
|
|
101
|
+
)
|
|
102
|
+
external
|
|
103
|
+
nonReentrant
|
|
104
|
+
notExpired
|
|
105
|
+
returns (uint256 netLpOut, uint256 netSyUsed, uint256 netPtUsed)
|
|
106
|
+
{
|
|
107
|
+
MarketState memory market = readState(msg.sender);
|
|
108
|
+
PYIndex index = YT.newIndex();
|
|
109
|
+
|
|
110
|
+
uint256 lpToReserve;
|
|
111
|
+
|
|
112
|
+
(lpToReserve, netLpOut, netSyUsed, netPtUsed) = market.addLiquidity(
|
|
113
|
+
netSyDesired,
|
|
114
|
+
netPtDesired,
|
|
115
|
+
block.timestamp
|
|
116
|
+
);
|
|
117
|
+
|
|
118
|
+
// initializing the market
|
|
119
|
+
if (lpToReserve != 0) {
|
|
120
|
+
market.setInitialLnImpliedRate(index, initialAnchor, block.timestamp);
|
|
121
|
+
_mint(address(1), lpToReserve);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
_mint(receiver, netLpOut);
|
|
125
|
+
|
|
126
|
+
_writeState(market);
|
|
127
|
+
|
|
128
|
+
if (_selfBalance(SY) < market.totalSy.Uint())
|
|
129
|
+
revert Errors.MarketInsufficientSyReceived(_selfBalance(SY), market.totalSy.Uint());
|
|
130
|
+
if (_selfBalance(PT) < market.totalPt.Uint())
|
|
131
|
+
revert Errors.MarketInsufficientPtReceived(_selfBalance(PT), market.totalPt.Uint());
|
|
132
|
+
|
|
133
|
+
emit Mint(receiver, netLpOut, netSyUsed, netPtUsed);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* @notice LP Holders can burn their LP to receive back SY & PT proportionally
|
|
138
|
+
* to their share of the market
|
|
139
|
+
*/
|
|
140
|
+
function burn(
|
|
141
|
+
address receiverSy,
|
|
142
|
+
address receiverPt,
|
|
143
|
+
uint256 netLpToBurn
|
|
144
|
+
) external nonReentrant returns (uint256 netSyOut, uint256 netPtOut) {
|
|
145
|
+
MarketState memory market = readState(msg.sender);
|
|
146
|
+
|
|
147
|
+
_burn(address(this), netLpToBurn);
|
|
148
|
+
|
|
149
|
+
(netSyOut, netPtOut) = market.removeLiquidity(netLpToBurn);
|
|
150
|
+
|
|
151
|
+
if (receiverSy != address(this)) IERC20(SY).safeTransfer(receiverSy, netSyOut);
|
|
152
|
+
if (receiverPt != address(this)) IERC20(PT).safeTransfer(receiverPt, netPtOut);
|
|
153
|
+
|
|
154
|
+
_writeState(market);
|
|
155
|
+
|
|
156
|
+
emit Burn(receiverSy, receiverPt, netLpToBurn, netSyOut, netPtOut);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* @notice Pendle Market allows swaps between PT & SY it is holding. This function
|
|
161
|
+
* aims to swap an exact amount of PT to SY.
|
|
162
|
+
* @dev steps working of this contract
|
|
163
|
+
- The outcome amount of SY will be precomputed by MarketMathLib
|
|
164
|
+
- Release the calculated amount of SY to receiver
|
|
165
|
+
- Callback to msg.sender if data.length > 0
|
|
166
|
+
- Ensure exactPtIn amount of PT has been transferred to this address
|
|
167
|
+
* @dev will revert if PT is expired
|
|
168
|
+
* @param data bytes data to be sent in the callback (if any)
|
|
169
|
+
*/
|
|
170
|
+
function swapExactPtForSy(
|
|
171
|
+
address receiver,
|
|
172
|
+
uint256 exactPtIn,
|
|
173
|
+
bytes calldata data
|
|
174
|
+
) external nonReentrant notExpired returns (uint256 netSyOut, uint256 netSyFee) {
|
|
175
|
+
MarketState memory market = readState(msg.sender);
|
|
176
|
+
|
|
177
|
+
uint256 netSyToReserve;
|
|
178
|
+
(netSyOut, netSyFee, netSyToReserve) = market.swapExactPtForSy(
|
|
179
|
+
YT.newIndex(),
|
|
180
|
+
exactPtIn,
|
|
181
|
+
block.timestamp
|
|
182
|
+
);
|
|
183
|
+
|
|
184
|
+
if (receiver != address(this)) IERC20(SY).safeTransfer(receiver, netSyOut);
|
|
185
|
+
IERC20(SY).safeTransfer(market.treasury, netSyToReserve);
|
|
186
|
+
|
|
187
|
+
_writeState(market);
|
|
188
|
+
|
|
189
|
+
if (data.length > 0) {
|
|
190
|
+
IPMarketSwapCallback(msg.sender).swapCallback(exactPtIn.neg(), netSyOut.Int(), data);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
if (_selfBalance(PT) < market.totalPt.Uint())
|
|
194
|
+
revert Errors.MarketInsufficientPtReceived(_selfBalance(PT), market.totalPt.Uint());
|
|
195
|
+
|
|
196
|
+
emit Swap(msg.sender, receiver, exactPtIn.neg(), netSyOut.Int(), netSyFee, netSyToReserve);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* @notice Pendle Market allows swaps between PT & SY it is holding. This function
|
|
201
|
+
* aims to swap SY for an exact amount of PT.
|
|
202
|
+
* @dev steps working of this function
|
|
203
|
+
- The exact outcome amount of PT will be transferred to receiver
|
|
204
|
+
- Callback to msg.sender if data.length > 0
|
|
205
|
+
- Ensure the calculated required amount of SY is transferred to this address
|
|
206
|
+
* @dev will revert if PT is expired
|
|
207
|
+
* @param data bytes data to be sent in the callback (if any)
|
|
208
|
+
*/
|
|
209
|
+
function swapSyForExactPt(
|
|
210
|
+
address receiver,
|
|
211
|
+
uint256 exactPtOut,
|
|
212
|
+
bytes calldata data
|
|
213
|
+
) external nonReentrant notExpired returns (uint256 netSyIn, uint256 netSyFee) {
|
|
214
|
+
MarketState memory market = readState(msg.sender);
|
|
215
|
+
|
|
216
|
+
uint256 netSyToReserve;
|
|
217
|
+
(netSyIn, netSyFee, netSyToReserve) = market.swapSyForExactPt(
|
|
218
|
+
YT.newIndex(),
|
|
219
|
+
exactPtOut,
|
|
220
|
+
block.timestamp
|
|
221
|
+
);
|
|
222
|
+
|
|
223
|
+
if (receiver != address(this)) IERC20(PT).safeTransfer(receiver, exactPtOut);
|
|
224
|
+
IERC20(SY).safeTransfer(market.treasury, netSyToReserve);
|
|
225
|
+
|
|
226
|
+
_writeState(market);
|
|
227
|
+
|
|
228
|
+
if (data.length > 0) {
|
|
229
|
+
IPMarketSwapCallback(msg.sender).swapCallback(exactPtOut.Int(), netSyIn.neg(), data);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
// have received enough SY
|
|
233
|
+
if (_selfBalance(SY) < market.totalSy.Uint())
|
|
234
|
+
revert Errors.MarketInsufficientSyReceived(_selfBalance(SY), market.totalSy.Uint());
|
|
235
|
+
|
|
236
|
+
emit Swap(msg.sender, receiver, exactPtOut.Int(), netSyIn.neg(), netSyFee, netSyToReserve);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/// @notice forces balances to match reserves
|
|
240
|
+
function skim() external nonReentrant {
|
|
241
|
+
MarketState memory market = readState(msg.sender);
|
|
242
|
+
uint256 excessPt = _selfBalance(PT) - market.totalPt.Uint();
|
|
243
|
+
uint256 excessSy = _selfBalance(SY) - market.totalSy.Uint();
|
|
244
|
+
if (excessPt != 0) IERC20(PT).safeTransfer(market.treasury, excessPt);
|
|
245
|
+
if (excessSy != 0) IERC20(SY).safeTransfer(market.treasury, excessSy);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* @notice redeems the user's reward
|
|
250
|
+
* @return amount of reward token redeemed, in the same order as `getRewardTokens()`
|
|
251
|
+
*/
|
|
252
|
+
function redeemRewards(address user) external nonReentrant returns (uint256[] memory) {
|
|
253
|
+
return _redeemRewards(user);
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
/// @notice returns the list of reward tokens
|
|
257
|
+
function getRewardTokens() external view returns (address[] memory) {
|
|
258
|
+
return _getRewardTokens();
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
/*///////////////////////////////////////////////////////////////
|
|
262
|
+
ORACLE
|
|
263
|
+
//////////////////////////////////////////////////////////////*/
|
|
264
|
+
|
|
265
|
+
function observe(
|
|
266
|
+
uint32[] memory secondsAgos
|
|
267
|
+
) external view returns (uint216[] memory lnImpliedRateCumulative) {
|
|
268
|
+
return
|
|
269
|
+
observations.observe(
|
|
270
|
+
uint32(block.timestamp),
|
|
271
|
+
secondsAgos,
|
|
272
|
+
_storage.lastLnImpliedRate,
|
|
273
|
+
_storage.observationIndex,
|
|
274
|
+
_storage.observationCardinality
|
|
275
|
+
);
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
function increaseObservationsCardinalityNext(uint16 cardinalityNext) external nonReentrant {
|
|
279
|
+
uint16 cardinalityNextOld = _storage.observationCardinalityNext;
|
|
280
|
+
uint16 cardinalityNextNew = observations.grow(cardinalityNextOld, cardinalityNext);
|
|
281
|
+
if (cardinalityNextOld != cardinalityNextNew) {
|
|
282
|
+
_storage.observationCardinalityNext = cardinalityNextNew;
|
|
283
|
+
emit IncreaseObservationCardinalityNext(cardinalityNextOld, cardinalityNextNew);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
/*///////////////////////////////////////////////////////////////
|
|
288
|
+
READ/WRITE STATES
|
|
289
|
+
//////////////////////////////////////////////////////////////*/
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* @notice read the state of the market from storage into memory for gas-efficient manipulation
|
|
293
|
+
*/
|
|
294
|
+
function readState(address router) public view returns (MarketState memory market) {
|
|
295
|
+
market.totalPt = _storage.totalPt;
|
|
296
|
+
market.totalSy = _storage.totalSy;
|
|
297
|
+
market.totalLp = totalSupply().Int();
|
|
298
|
+
|
|
299
|
+
(market.treasury, market.lnFeeRateRoot, market.reserveFeePercent) = IPMarketFactory(
|
|
300
|
+
factory
|
|
301
|
+
).getMarketConfig(router);
|
|
302
|
+
|
|
303
|
+
market.scalarRoot = scalarRoot;
|
|
304
|
+
market.expiry = expiry;
|
|
305
|
+
|
|
306
|
+
market.lastLnImpliedRate = _storage.lastLnImpliedRate;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
/// @notice write back the state of the market from memory to storage
|
|
310
|
+
function _writeState(MarketState memory market) internal {
|
|
311
|
+
uint96 lastLnImpliedRate96 = market.lastLnImpliedRate.Uint96();
|
|
312
|
+
int128 totalPt128 = market.totalPt.Int128();
|
|
313
|
+
int128 totalSy128 = market.totalSy.Int128();
|
|
314
|
+
|
|
315
|
+
(uint16 observationIndex, uint16 observationCardinality) = observations.write(
|
|
316
|
+
_storage.observationIndex,
|
|
317
|
+
uint32(block.timestamp),
|
|
318
|
+
_storage.lastLnImpliedRate,
|
|
319
|
+
_storage.observationCardinality,
|
|
320
|
+
_storage.observationCardinalityNext
|
|
321
|
+
);
|
|
322
|
+
|
|
323
|
+
_storage.totalPt = totalPt128;
|
|
324
|
+
_storage.totalSy = totalSy128;
|
|
325
|
+
_storage.lastLnImpliedRate = lastLnImpliedRate96;
|
|
326
|
+
_storage.observationIndex = observationIndex;
|
|
327
|
+
_storage.observationCardinality = observationCardinality;
|
|
328
|
+
|
|
329
|
+
emit UpdateImpliedRate(block.timestamp, market.lastLnImpliedRate);
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
/*///////////////////////////////////////////////////////////////
|
|
333
|
+
TRIVIAL FUNCTIONS
|
|
334
|
+
//////////////////////////////////////////////////////////////*/
|
|
335
|
+
|
|
336
|
+
function readTokens()
|
|
337
|
+
external
|
|
338
|
+
view
|
|
339
|
+
returns (IStandardizedYield _SY, IPPrincipalToken _PT, IPYieldToken _YT)
|
|
340
|
+
{
|
|
341
|
+
_SY = SY;
|
|
342
|
+
_PT = PT;
|
|
343
|
+
_YT = YT;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
function isExpired() public view returns (bool) {
|
|
347
|
+
return MiniHelpers.isCurrentlyExpired(expiry);
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
/*///////////////////////////////////////////////////////////////
|
|
351
|
+
PENDLE GAUGE - RELATED
|
|
352
|
+
//////////////////////////////////////////////////////////////*/
|
|
353
|
+
|
|
354
|
+
function _stakedBalance(address user) internal view override returns (uint256) {
|
|
355
|
+
return balanceOf(user);
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
function _totalStaked() internal view override returns (uint256) {
|
|
359
|
+
return totalSupply();
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
// solhint-disable-next-line ordering
|
|
363
|
+
function _beforeTokenTransfer(
|
|
364
|
+
address from,
|
|
365
|
+
address to,
|
|
366
|
+
uint256 amount
|
|
367
|
+
) internal override(PendleERC20, PendleGaugeV2) {
|
|
368
|
+
PendleGaugeV2._beforeTokenTransfer(from, to, amount);
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
// solhint-disable-next-line ordering
|
|
372
|
+
function _afterTokenTransfer(
|
|
373
|
+
address from,
|
|
374
|
+
address to,
|
|
375
|
+
uint256 amount
|
|
376
|
+
) internal override(PendleERC20, PendleGaugeV2) {
|
|
377
|
+
PendleGaugeV2._afterTokenTransfer(from, to, amount);
|
|
378
|
+
}
|
|
379
|
+
}
|
|
@@ -13,6 +13,8 @@ import "./RewardManagerAbstract.sol";
|
|
|
13
13
|
abstract contract RewardManagerAbstract is IRewardManager, TokenHelper {
|
|
14
14
|
using Math for uint256;
|
|
15
15
|
|
|
16
|
+
uint256 internal constant INITIAL_REWARD_INDEX = 1;
|
|
17
|
+
|
|
16
18
|
struct RewardState {
|
|
17
19
|
uint128 index;
|
|
18
20
|
uint128 lastBalance;
|
|
@@ -56,8 +58,7 @@ abstract contract RewardManagerAbstract is IRewardManager, TokenHelper {
|
|
|
56
58
|
uint256 userIndex = userReward[token][user].index;
|
|
57
59
|
|
|
58
60
|
if (userIndex == 0) {
|
|
59
|
-
|
|
60
|
-
continue;
|
|
61
|
+
userIndex = INITIAL_REWARD_INDEX.Uint128();
|
|
61
62
|
}
|
|
62
63
|
|
|
63
64
|
if (userIndex == index) continue;
|