@pendle/core-v2 2.18.0 → 2.19.0-tradingbot
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/PendleMsgReceiveEndpointUpg.sol/PendleMsgReceiveEndpointUpg.json +2 -2
- 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/PendleMsgSendEndpointUpg.sol/PendleMsgSendEndpointUpg.json +2 -2
- 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/PendleGaugeControllerMainchainUpg.sol/PendleGaugeControllerMainchainUpg.json +2 -2
- package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerSidechainUpg.sol/PendleGaugeControllerSidechainUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerSidechainUpg.sol/PendleGaugeControllerSidechainUpg.json +2 -2
- 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/VeDistributor/PendleFeeDistributorV2.sol/PendleFeeDistributorV2.json +2 -2
- package/build/artifacts/contracts/LiquidityMining/VotingController/PendleVotingControllerUpg.sol/PendleVotingControllerUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/VotingController/PendleVotingControllerUpg.sol/PendleVotingControllerUpg.json +2 -2
- 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/VotingEscrowPendleMainchain.sol/VotingEscrowPendleMainchain.json +2 -2
- package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowPendleSidechain.sol/VotingEscrowPendleSidechain.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowPendleSidechain.sol/VotingEscrowPendleSidechain.json +2 -2
- 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/VeBalanceLib.sol/VeBalanceLib.json +2 -2
- package/build/artifacts/contracts/LiquidityMining/libraries/VeHistoryLib.sol/CheckpointHelper.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/libraries/VeHistoryLib.sol/CheckpointHelper.json +2 -2
- package/build/artifacts/contracts/LiquidityMining/libraries/VeHistoryLib.sol/Checkpoints.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/libraries/VeHistoryLib.sol/Checkpoints.json +2 -2
- package/build/artifacts/contracts/core/BulkSeller/BulkSeller.sol/BulkSeller.dbg.json +1 -1
- package/build/artifacts/contracts/core/BulkSeller/BulkSeller.sol/BulkSeller.json +2 -2
- package/build/artifacts/contracts/core/BulkSeller/BulkSellerFactory.sol/BulkSellerFactory.dbg.json +1 -1
- package/build/artifacts/contracts/core/BulkSeller/BulkSellerFactory.sol/BulkSellerFactory.json +2 -2
- package/build/artifacts/contracts/core/BulkSeller/BulkSellerMathCore.sol/BulkSellerMathCore.dbg.json +1 -1
- package/build/artifacts/contracts/core/BulkSeller/BulkSellerMathCore.sol/BulkSellerMathCore.json +2 -2
- package/build/artifacts/contracts/core/Market/MarketMathCore.sol/MarketMathCore.dbg.json +1 -1
- package/build/artifacts/contracts/core/Market/MarketMathCore.sol/MarketMathCore.json +2 -2
- package/build/artifacts/contracts/core/Market/OracleLib.sol/OracleLib.dbg.json +1 -1
- package/build/artifacts/contracts/core/Market/OracleLib.sol/OracleLib.json +2 -2
- 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/PendleMarketFactory.sol/PendleMarketFactory.json +2 -2
- 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/Ape/sAPE.sol/sAPE.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Ape/sAPE.sol/sAPE.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/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/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/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/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/BalancerStable/base/StablePreviewBase.sol/StablePreviewBase.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/PendleQiTokenHelper.sol/PendleQiTokenHelper.json +2 -2
- 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/PendleGdaiSY.sol/PendleGDaiSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleGdaiSY.sol/PendleGDaiSY.json +2 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleLooksStakingSY.sol/PendleLooksStakingSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleLooksStakingSY.sol/PendleLooksStakingSY.json +2 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleSfrxEthSY.sol/PendleSfrxEthSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleSfrxEthSY.sol/PendleSfrxEthSY.json +2 -2
- 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/PendleWstEthSY.sol/PendleWstEthSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleWstEthSY.sol/PendleWstEthSY.json +2 -2
- package/build/artifacts/contracts/core/TradingBot/LongYield/LongYieldDecisionHelper.sol/LongYieldDecisionHelper.dbg.json +4 -0
- package/build/artifacts/contracts/core/TradingBot/LongYield/LongYieldDecisionHelper.sol/LongYieldDecisionHelper.json +1215 -0
- package/build/artifacts/contracts/core/TradingBot/LongYield/LongYieldTradingBot.sol/LongYieldTradingBot.dbg.json +4 -0
- package/build/artifacts/contracts/core/TradingBot/LongYield/LongYieldTradingBot.sol/LongYieldTradingBot.json +1681 -0
- package/build/artifacts/contracts/core/TradingBot/ShortYield/ShortYieldDecisionHelper.sol/ShortYieldDecisionHelper.dbg.json +4 -0
- package/build/artifacts/contracts/core/TradingBot/ShortYield/ShortYieldDecisionHelper.sol/ShortYieldDecisionHelper.json +1215 -0
- package/build/artifacts/contracts/core/TradingBot/ShortYield/ShortYieldTradingBot.sol/ShortYieldTradingBot.dbg.json +4 -0
- package/build/artifacts/contracts/core/TradingBot/ShortYield/ShortYieldTradingBot.sol/ShortYieldTradingBot.json +1535 -0
- package/build/artifacts/contracts/core/TradingBot/base/BotActionCallback.sol/BotActionCallback.dbg.json +4 -0
- package/build/artifacts/contracts/core/TradingBot/base/BotActionCallback.sol/BotActionCallback.json +932 -0
- package/build/artifacts/contracts/core/TradingBot/base/BotActionHelper.sol/BotActionHelper.dbg.json +4 -0
- package/build/artifacts/contracts/core/TradingBot/base/BotActionHelper.sol/BotActionHelper.json +932 -0
- package/build/artifacts/contracts/core/TradingBot/base/BotDecisionHelperBase.sol/BotDecisionHelperBase.dbg.json +4 -0
- package/build/artifacts/contracts/core/TradingBot/base/BotDecisionHelperBase.sol/BotDecisionHelperBase.json +789 -0
- package/build/artifacts/contracts/core/TradingBot/base/TradingBotBase.sol/TradingBotBase.dbg.json +4 -0
- package/build/artifacts/contracts/core/TradingBot/base/TradingBotBase.sol/TradingBotBase.json +882 -0
- package/build/artifacts/contracts/core/TradingBot/libraries/BotSimulationLib.sol/BotSimulationLib.dbg.json +4 -0
- package/build/artifacts/contracts/core/TradingBot/libraries/BotSimulationLib.sol/BotSimulationLib.json +10 -0
- package/build/artifacts/contracts/core/TradingBot/libraries/MarketExtLib.sol/MarketExtLib.dbg.json +4 -0
- package/build/artifacts/contracts/core/TradingBot/libraries/MarketExtLib.sol/MarketExtLib.json +24 -0
- package/build/artifacts/contracts/core/TradingBot/libraries/SpecSegmentLib.sol/SpecSegmentLib.dbg.json +4 -0
- package/build/artifacts/contracts/core/TradingBot/libraries/SpecSegmentLib.sol/SpecSegmentLib.json +10 -0
- 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/PendlePrincipalToken.sol/PendlePrincipalToken.json +2 -2
- 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/PendlePrincipalTokenV2.sol/PendlePrincipalTokenV2.json +2 -2
- 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/Errors.sol/Errors.dbg.json +1 -1
- package/build/artifacts/contracts/core/libraries/Errors.sol/Errors.json +151 -2
- package/build/artifacts/contracts/core/libraries/TokenAmountLib.sol/TokenAmountLib.dbg.json +4 -0
- package/build/artifacts/contracts/core/libraries/TokenAmountLib.sol/TokenAmountLib.json +10 -0
- package/build/artifacts/contracts/core/libraries/math/Math.sol/Math.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Balancer/IBalancerStablePreview.sol/IBalancerStablePreview.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Balancer/IERC4626LinearPool.sol/IERC4626LinearPool.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Balancer/IVault.sol/IVault.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/IPGauge.sol/IPGauge.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPMarket.sol/IPMarket.dbg.json +1 -1
- 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/IPYieldContractFactory.sol/IPYieldContractFactory.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IStandardizedYield.sol/IStandardizedYield.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/TradingBot/IBotDecisionHelper.sol/IBotDecisionHelper.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/TradingBot/IBotDecisionHelper.sol/IBotDecisionHelper.json +652 -0
- package/build/artifacts/contracts/interfaces/TradingBot/ILongYieldDecisionHelper.sol/ILongYieldDecisionHelper.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/TradingBot/ILongYieldDecisionHelper.sol/ILongYieldDecisionHelper.json +671 -0
- package/build/artifacts/contracts/interfaces/TradingBot/ILongYieldTradingBot.sol/ILongYieldTradingBot.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/TradingBot/ILongYieldTradingBot.sol/ILongYieldTradingBot.json +1094 -0
- package/build/artifacts/contracts/interfaces/TradingBot/IShortYieldDecisionHelper.sol/IShortYieldDecisionHelper.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/TradingBot/IShortYieldDecisionHelper.sol/IShortYieldDecisionHelper.json +652 -0
- package/build/artifacts/contracts/interfaces/TradingBot/IShortYieldTradingBot.sol/IShortYieldTradingBot.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/TradingBot/IShortYieldTradingBot.sol/IShortYieldTradingBot.json +1075 -0
- package/build/artifacts/contracts/interfaces/TradingBot/ITradingBotBase.sol/ITradingBotBase.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/TradingBot/ITradingBotBase.sol/ITradingBotBase.json +632 -0
- package/build/artifacts/contracts/offchain-helpers/BoringLpSeller.sol/BoringLpSeller.dbg.json +4 -0
- package/build/artifacts/contracts/offchain-helpers/BoringLpSeller.sol/BoringLpSeller.json +10 -0
- 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/Broadcaster.sol/Broadcaster.json +2 -2
- package/build/artifacts/contracts/offchain-helpers/BulkSellerOffchain.sol/BulkSellerOffchain.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/BulkSellerOffchain.sol/BulkSellerOffchain.json +2 -2
- package/build/artifacts/contracts/offchain-helpers/MarketExchangeRateLib.sol/MarketExchangeRateLib.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/MarketExchangeRateLib.sol/MarketExchangeRateLib.json +2 -2
- package/build/artifacts/contracts/offchain-helpers/router-static/PendleRouterStatic.sol/PendleRouterStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/router-static/PendleRouterStatic.sol/PendleRouterStatic.json +2 -2
- 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/ActionInfoStatic.sol/ActionInfoStatic.json +2 -2
- 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/ActionMarketAuxStatic.sol/ActionMarketAuxStatic.json +2 -2
- 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/ActionMarketCoreStatic.sol/ActionMarketCoreStatic.json +2 -2
- 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/ActionMintRedeemStatic.sol/ActionMintRedeemStatic.json +2 -2
- 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/ActionStorageStatic.sol/ActionStorageStatic.json +2 -2
- 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/ActionVePendleStatic.sol/ActionVePendleStatic.json +2 -2
- 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/PendleLpOracleLib.sol/PendleLpOracleLib.json +2 -2
- package/build/artifacts/contracts/oracles/PendlePtOracle.sol/PendlePtOracle.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/PendlePtOracle.sol/PendlePtOracle.json +2 -2
- package/build/artifacts/contracts/oracles/PendlePtOracleLib.sol/PendlePtOracleLib.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/PendlePtOracleLib.sol/PendlePtOracleLib.json +2 -2
- package/build/artifacts/contracts/oracles/samples/PendleLpGlpOracle.sol/PendleLpGlpOracle.dbg.json +4 -0
- package/build/artifacts/contracts/oracles/samples/PendleLpGlpOracle.sol/PendleLpGlpOracle.json +166 -0
- package/build/artifacts/contracts/oracles/samples/PendlePtGlpOracle.sol/PendlePtGlpOracle.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/samples/PendlePtGlpOracle.sol/PendlePtGlpOracle.json +2 -2
- 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/ActionAddRemoveLiq.sol/ActionAddRemoveLiq.json +2 -2
- package/build/artifacts/contracts/router/ActionMintRedeem.sol/ActionMintRedeem.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionMintRedeem.sol/ActionMintRedeem.json +2 -2
- package/build/artifacts/contracts/router/ActionSwapPT.sol/ActionSwapPT.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionSwapPT.sol/ActionSwapPT.json +2 -2
- package/build/artifacts/contracts/router/ActionSwapYT.sol/ActionSwapYT.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionSwapYT.sol/ActionSwapYT.json +2 -2
- package/build/artifacts/contracts/router/PendleRouter.sol/PendleRouter.dbg.json +1 -1
- package/build/artifacts/contracts/router/PendleRouter.sol/PendleRouter.json +2 -2
- package/build/artifacts/contracts/router/PendleRouterHelper.sol/PendleRouterHelper.dbg.json +1 -1
- package/build/artifacts/contracts/router/PendleRouterHelper.sol/PendleRouterHelper.json +2 -2
- 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/MarketApproxPtInLib.json +2 -2
- package/build/artifacts/contracts/router/base/MarketApproxLib.sol/MarketApproxPtOutLib.dbg.json +1 -1
- package/build/artifacts/contracts/router/base/MarketApproxLib.sol/MarketApproxPtOutLib.json +2 -2
- package/build/artifacts/contracts/router/swap-aggregator/PendleSwap.sol/PendleSwap.dbg.json +1 -1
- package/build/artifacts/contracts/router/swap-aggregator/kyberswap/IAggregationExecutor.sol/IAggregationExecutor.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/IHashflow.sol/IHashflow.dbg.json +1 -1
- package/build/artifacts/contracts/router/swap-aggregator/kyberswap/IMetaAggregationRouterV2.sol/IMetaAggregationRouterV2.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/core/TradingBot/LongYield/LongYieldDecisionHelper.sol +216 -0
- package/contracts/core/TradingBot/LongYield/LongYieldTradingBot.sol +97 -0
- package/contracts/core/TradingBot/README.md +153 -0
- package/contracts/core/TradingBot/ShortYield/ShortYieldDecisionHelper.sol +198 -0
- package/contracts/core/TradingBot/ShortYield/ShortYieldTradingBot.sol +101 -0
- package/contracts/core/TradingBot/base/BotActionCallback.sol +112 -0
- package/contracts/core/TradingBot/base/BotActionHelper.sol +178 -0
- package/contracts/core/TradingBot/base/BotDecisionHelperBase.sol +235 -0
- package/contracts/core/TradingBot/base/TradingBotBase.sol +184 -0
- package/contracts/core/TradingBot/libraries/BotSimulationLib.sol +155 -0
- package/contracts/core/TradingBot/libraries/MarketExtLib.sol +310 -0
- package/contracts/core/TradingBot/libraries/SpecSegmentLib.sol +62 -0
- package/contracts/core/libraries/Errors.sol +12 -0
- package/contracts/core/libraries/TokenAmountLib.sol +47 -0
- package/contracts/interfaces/TradingBot/IBotDecisionHelper.sol +57 -0
- package/contracts/interfaces/TradingBot/ILongYieldDecisionHelper.sol +8 -0
- package/contracts/interfaces/TradingBot/ILongYieldTradingBot.sol +51 -0
- package/contracts/interfaces/TradingBot/IShortYieldDecisionHelper.sol +7 -0
- package/contracts/interfaces/TradingBot/IShortYieldTradingBot.sol +27 -0
- package/contracts/interfaces/TradingBot/ITradingBotBase.sol +67 -0
- package/contracts/offchain-helpers/BoringLpSeller.sol +47 -0
- package/contracts/oracles/samples/PendleLpGlpOracle.sol +49 -0
- package/package.json +1 -1
- package/typechain-types/BotActionCallback.ts +950 -0
- package/typechain-types/BotActionHelper.ts +950 -0
- package/typechain-types/BotDecisionHelper.ts +561 -0
- package/typechain-types/BotDecisionHelperBase.ts +484 -0
- package/typechain-types/BotDecisionLib.ts +335 -0
- package/typechain-types/CamelotV1LpHelper.ts +203 -0
- package/typechain-types/CamelotV1Preview.ts +431 -0
- package/typechain-types/I1inchAggregationRouterV5.ts +257 -0
- package/typechain-types/IAnkrBNB.ts +150 -0
- package/typechain-types/IAnkrLiquidStaking.ts +253 -0
- package/typechain-types/IBotDecisionHelper.ts +452 -0
- package/typechain-types/ICamelotSY.ts +100 -0
- package/typechain-types/IExecutorHelper1.ts +643 -0
- package/typechain-types/IExecutorHelper2.ts +115 -0
- package/typechain-types/IExecutorHelperEthereum1.ts +643 -0
- package/typechain-types/ILongYieldDecisionHelper.ts +486 -0
- package/typechain-types/ILongYieldTradingBot.ts +928 -0
- package/typechain-types/IPExternalRewardDistributor.ts +192 -0
- package/typechain-types/IPMarketFactoryV2.ts +253 -0
- package/typechain-types/IPendlePreviewHelper.ts +147 -0
- package/typechain-types/IShortYieldDecisionHelper.ts +452 -0
- package/typechain-types/IShortYieldTradingBot.ts +820 -0
- package/typechain-types/ISwETH.ts +123 -0
- package/typechain-types/IThenaFactory.ts +245 -0
- package/typechain-types/IThenaGaugeV2.ts +206 -0
- package/typechain-types/IThenaPair.ts +579 -0
- package/typechain-types/IThenaRouter.ts +313 -0
- package/typechain-types/IThenaSY.ts +81 -0
- package/typechain-types/ITradingBotBase.ts +619 -0
- package/typechain-types/IWBETH.ts +128 -0
- package/typechain-types/LongYieldDecisionHelper.ts +601 -0
- package/typechain-types/LongYieldTradingBot.ts +1414 -0
- package/typechain-types/MarketExtLib.ts +81 -0
- package/typechain-types/PendleAnkrBNBSY.ts +1235 -0
- package/typechain-types/PendleAuraWstethAnkreth.ts +1511 -0
- package/typechain-types/PendleBinanceEth.ts +1229 -0
- package/typechain-types/PendleCamelotV1SY.ts +1961 -0
- package/typechain-types/PendleExternalRewardDistributor.ts +546 -0
- package/typechain-types/PendleGaugeV2.ts +225 -0
- package/typechain-types/PendleLpGlpOracle.ts +145 -0
- package/typechain-types/PendleMarketFactoryV2.ts +930 -0
- package/typechain-types/PendleMarketV2.ts +1311 -0
- package/typechain-types/PendleSwETH.ts +1216 -0
- package/typechain-types/PendleSwapArbitrum.ts +126 -0
- package/typechain-types/PendleSwapEthereum.ts +126 -0
- package/typechain-types/PendleThenaSY.ts +1598 -0
- package/typechain-types/PendleWbEthSY.ts +1229 -0
- package/typechain-types/PtAndLpToAsset.ts +136 -0
- package/typechain-types/ShortYieldDecisionHelper.ts +601 -0
- package/typechain-types/ShortYieldTradingBot.ts +1306 -0
- package/typechain-types/ThenaLpHelper.ts +191 -0
- package/typechain-types/ThenaMath.ts +87 -0
- package/typechain-types/ThenaPreview.ts +450 -0
- package/typechain-types/TradingBotBase.ts +906 -0
- package/typechain-types/TradingBotOffchain.ts +568 -0
- package/typechain-types/factories/ActionAddRemoveLiq__factory.ts +1 -1
- package/typechain-types/factories/ActionInfoStatic__factory.ts +1 -1
- package/typechain-types/factories/ActionMarketAuxStatic__factory.ts +1 -1
- package/typechain-types/factories/ActionMarketCoreStatic__factory.ts +1 -1
- package/typechain-types/factories/ActionMintRedeemStatic__factory.ts +1 -1
- package/typechain-types/factories/ActionMintRedeem__factory.ts +1 -1
- package/typechain-types/factories/ActionStorageStatic__factory.ts +1 -1
- package/typechain-types/factories/ActionSwapPT__factory.ts +1 -1
- package/typechain-types/factories/ActionSwapYT__factory.ts +1 -1
- package/typechain-types/factories/ActionVePendleStatic__factory.ts +1 -1
- package/typechain-types/factories/BotActionCallback__factory.ts +947 -0
- package/typechain-types/factories/BotActionHelper__factory.ts +947 -0
- package/typechain-types/factories/BotDecisionHelperBase__factory.ts +808 -0
- package/typechain-types/factories/BotDecisionHelper__factory.ts +1192 -0
- package/typechain-types/factories/BotDecisionLib__factory.ts +642 -0
- package/typechain-types/factories/Broadcaster__factory.ts +1 -1
- package/typechain-types/factories/BulkSellerFactory__factory.ts +1 -1
- package/typechain-types/factories/BulkSellerOffchain__factory.ts +1 -1
- package/typechain-types/factories/BulkSeller__factory.ts +1 -1
- package/typechain-types/factories/CamelotV1LpHelper__factory.ts +143 -0
- package/typechain-types/factories/CamelotV1Preview__factory.ts +309 -0
- package/typechain-types/factories/Errors__factory.ts +150 -1
- package/typechain-types/factories/I1inchAggregationRouterV5__factory.ts +179 -0
- package/typechain-types/factories/IAnkrBNB__factory.ts +74 -0
- package/typechain-types/factories/IAnkrLiquidStaking__factory.ts +123 -0
- package/typechain-types/factories/IBotDecisionHelper__factory.ts +667 -0
- package/typechain-types/factories/ICamelotSY__factory.ts +49 -0
- package/typechain-types/factories/IExecutorHelper1__factory.ts +403 -0
- package/typechain-types/factories/IExecutorHelper2__factory.ts +55 -0
- package/typechain-types/factories/IExecutorHelperEthereum1__factory.ts +407 -0
- package/typechain-types/factories/ILongYieldDecisionHelper__factory.ts +690 -0
- package/typechain-types/factories/ILongYieldTradingBot__factory.ts +1113 -0
- package/typechain-types/factories/IPExternalRewardDistributor__factory.ts +128 -0
- package/typechain-types/factories/IPMarketFactoryV2__factory.ts +181 -0
- package/typechain-types/factories/IPendlePreviewHelper__factory.ts +78 -0
- package/typechain-types/factories/IShortYieldDecisionHelper__factory.ts +671 -0
- package/typechain-types/factories/IShortYieldTradingBot__factory.ts +1094 -0
- package/typechain-types/factories/ISwETH__factory.ts +53 -0
- package/typechain-types/factories/IThenaFactory__factory.ts +164 -0
- package/typechain-types/factories/IThenaGaugeV2__factory.ts +83 -0
- package/typechain-types/factories/IThenaPair__factory.ts +421 -0
- package/typechain-types/factories/IThenaRouter__factory.ts +200 -0
- package/typechain-types/factories/IThenaSY__factory.ts +36 -0
- package/typechain-types/factories/ITradingBotBase__factory.ts +647 -0
- package/typechain-types/factories/IWBETH__factory.ts +51 -0
- package/typechain-types/factories/LongYieldDecisionHelper__factory.ts +1272 -0
- package/typechain-types/factories/LongYieldTradingBot__factory.ts +1754 -0
- package/typechain-types/factories/MarketExtLib__factory.ts +74 -0
- package/typechain-types/factories/OracleLib__factory.ts +1 -1
- package/typechain-types/factories/PendleAnkrBNBSY__factory.ts +1100 -0
- package/typechain-types/factories/PendleArbitrumStakedEthSY__factory.ts +27 -2
- 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/PendleAuraWethWstethSYV2__factory.ts +1 -1
- package/typechain-types/factories/PendleAuraWstethAnkreth__factory.ts +1244 -0
- package/typechain-types/factories/PendleBinanceEth__factory.ts +1052 -0
- package/typechain-types/factories/PendleCamelotV1SY__factory.ts +1595 -0
- package/typechain-types/factories/PendleCamelotV1VolatileSY__factory.ts +1 -1
- 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 +414 -0
- package/typechain-types/factories/PendleFeeDistributorV2__factory.ts +1 -1
- package/typechain-types/factories/PendleFeeDistributor__factory.ts +1 -1
- package/typechain-types/factories/PendleGDaiSY__factory.ts +1 -1
- package/typechain-types/factories/PendleGaugeControllerMainchainUpg__factory.ts +1 -1
- package/typechain-types/factories/PendleGaugeControllerSidechainUpg__factory.ts +1 -1
- package/typechain-types/factories/PendleGaugeV2__factory.ts +140 -0
- package/typechain-types/factories/PendleGlpSY__factory.ts +1 -1
- package/typechain-types/factories/PendleLooksStakingSY__factory.ts +1 -1
- package/typechain-types/factories/PendleLpGlpOracle__factory.ts +246 -0
- package/typechain-types/factories/PendleMarketFactoryV2__factory.ts +770 -0
- package/typechain-types/factories/PendleMarketFactory__factory.ts +1 -1
- package/typechain-types/factories/PendleMarketV2__factory.ts +1290 -0
- package/typechain-types/factories/PendleMarket__factory.ts +1 -1
- package/typechain-types/factories/PendleMsgReceiveEndpointUpg__factory.ts +1 -1
- package/typechain-types/factories/PendleMsgSendEndpointUpg__factory.ts +1 -1
- package/typechain-types/factories/PendlePrincipalTokenV2__factory.ts +1 -1
- package/typechain-types/factories/PendlePrincipalToken__factory.ts +1 -1
- package/typechain-types/factories/PendlePtGlpOracle__factory.ts +1 -1
- package/typechain-types/factories/PendlePtOracle__factory.ts +1 -1
- package/typechain-types/factories/PendleQiTokenHelper__factory.ts +1 -1
- package/typechain-types/factories/PendleQiTokenSY__factory.ts +1 -1
- package/typechain-types/factories/PendleRouterHelper__factory.ts +1 -1
- package/typechain-types/factories/PendleRouterStatic__factory.ts +1 -1
- package/typechain-types/factories/PendleRouter__factory.ts +1 -1
- package/typechain-types/factories/PendleSfrxEthSY__factory.ts +1 -1
- package/typechain-types/factories/PendleStargateLPSY__factory.ts +1 -1
- package/typechain-types/factories/PendleSwETH__factory.ts +1022 -0
- package/typechain-types/factories/PendleSwapArbitrum__factory.ts +129 -0
- package/typechain-types/factories/PendleSwapEthereum__factory.ts +129 -0
- package/typechain-types/factories/PendleThenaSY__factory.ts +1352 -0
- package/typechain-types/factories/PendleVotingControllerUpg__factory.ts +1 -1
- package/typechain-types/factories/PendleWbEthSY__factory.ts +1049 -0
- package/typechain-types/factories/PendleWstEthSY__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/PtAndLpToAsset__factory.ts +150 -0
- package/typechain-types/factories/SAPE__factory.ts +1 -1
- package/typechain-types/factories/ShortYieldDecisionHelper__factory.ts +1272 -0
- package/typechain-types/factories/ShortYieldTradingBot__factory.ts +1612 -0
- package/typechain-types/factories/ThenaLpHelper__factory.ts +140 -0
- package/typechain-types/factories/ThenaMath__factory.ts +36 -0
- package/typechain-types/factories/ThenaPreview__factory.ts +319 -0
- package/typechain-types/factories/TradingBotBase__factory.ts +897 -0
- package/typechain-types/factories/TradingBotOffchain__factory.ts +1133 -0
- package/typechain-types/factories/VotingEscrowPendleMainchain__factory.ts +1 -1
- package/typechain-types/factories/VotingEscrowPendleSidechain__factory.ts +1 -1
- package/typechain-types/hardhat.d.ts +144 -9
- package/typechain-types/index.ts +32 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleArbitrumStakedEthSY.sol/PendleArbitrumStakedEthSY.dbg.json +0 -4
- package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleArbitrumStakedEthSY.sol/PendleArbitrumStakedEthSY.json +0 -966
- package/contracts/core/StandardizedYield/implementations/PendleArbitrumStakedEthSY.sol +0 -114
- package/deployments/42161-markets/RETH-ARBITRUM-JUNE2024.json +0 -10
- package/deployments/42161-markets/WSTETH-ARBITRUM-JUNE2024.json +0 -10
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
# Trading Bot
|
|
2
|
+
|
|
3
|
+
## Structs and enums
|
|
4
|
+
|
|
5
|
+
### MarketExtState
|
|
6
|
+
|
|
7
|
+
Struct for external market state.
|
|
8
|
+
|
|
9
|
+
- `state`: MarketState
|
|
10
|
+
- `index`: YT's index
|
|
11
|
+
- `blockTime`: timestamp
|
|
12
|
+
|
|
13
|
+
### BotState
|
|
14
|
+
|
|
15
|
+
Struct for bot's balances: `lpBalance`, `ytBalance`, `syBalance`.
|
|
16
|
+
|
|
17
|
+
### TradingSpecs
|
|
18
|
+
|
|
19
|
+
Struct for bot's trading limits:
|
|
20
|
+
|
|
21
|
+
- `lowerIyLimit`: apeYtApy
|
|
22
|
+
- `upperIyLimit`: sellYtApy
|
|
23
|
+
- `floatingSyRatioLimit`: h_r - f/TVL limit, TVL calculated in number of SY.
|
|
24
|
+
- `floatingSyRatioTarget`: l_r - f/TVL target.
|
|
25
|
+
- `ytPtRatioLimit`: h_x - limit for YT/PT
|
|
26
|
+
- `ytPtRatioTarget`: l_x - target for YT/PT
|
|
27
|
+
|
|
28
|
+
### ActionType
|
|
29
|
+
|
|
30
|
+
Enum for action.
|
|
31
|
+
|
|
32
|
+
- 0: SwapSyToYt - Buy YT with SY
|
|
33
|
+
- 1: AddLiqKeepYt - ZPI Zap
|
|
34
|
+
- 2: AddLiqFromSy - Single sided LP
|
|
35
|
+
- 3: AddLiqFromYt - Sell YT for LP
|
|
36
|
+
- 4: RemoveLiqToYt - Zap out to YT
|
|
37
|
+
- 5: NONE
|
|
38
|
+
|
|
39
|
+
### StrategyFlag
|
|
40
|
+
|
|
41
|
+
Enum for strategy state.
|
|
42
|
+
|
|
43
|
+
- 0: GOOD
|
|
44
|
+
- 1: TOO_LOW
|
|
45
|
+
- 2: TOO_HIGH
|
|
46
|
+
|
|
47
|
+
### StrategyState
|
|
48
|
+
|
|
49
|
+
Struct for strategy state.
|
|
50
|
+
|
|
51
|
+
- `iyFlag`: StrategyFlag for IY compared to ape/sellYtApy
|
|
52
|
+
- `syRatioFlag`: StrategyFlag for f/TVL compared to given limit \(r\)
|
|
53
|
+
|
|
54
|
+
## TradingBotBase.sol
|
|
55
|
+
|
|
56
|
+
### 1. depositSy
|
|
57
|
+
|
|
58
|
+
Deposit SY into the bot.
|
|
59
|
+
- SY approval needed.
|
|
60
|
+
|
|
61
|
+
### 2. depositToken
|
|
62
|
+
|
|
63
|
+
Deposit funds into the bot, which are then compounded into SY.
|
|
64
|
+
- `inp`: Token input data to swap deposited token to SY.
|
|
65
|
+
- If `inp.netTokenIn` is set to `2**256 - 1` then it will be set to `_selfBalance()` internally.`
|
|
66
|
+
- Needs sender's approval to bot & bot's approval to router.
|
|
67
|
+
|
|
68
|
+
### 3. withdrawFunds
|
|
69
|
+
|
|
70
|
+
Withdraw funds back to sender (only owner).
|
|
71
|
+
|
|
72
|
+
### 4. approveInf
|
|
73
|
+
|
|
74
|
+
Infinite approve token to spender.
|
|
75
|
+
|
|
76
|
+
### 5. claimAndCompound
|
|
77
|
+
|
|
78
|
+
Claim rewards from SY, YT, market. Then compound the rewards into SY.
|
|
79
|
+
|
|
80
|
+
- `inps`: Token input data to swap claimed rewards into SY
|
|
81
|
+
- If `inp.netTokenIn` is set to `2**256 - 1` then it will be set to `_selfBalance()` internally.
|
|
82
|
+
- Needs sender's approval to bot & bot's approval to router for tokens.
|
|
83
|
+
|
|
84
|
+
### 6. claimWithoutCompound
|
|
85
|
+
Intended to be static called from offchain. Claim rewards from SY, YT, market, then return amounts of tokens claimed.
|
|
86
|
+
|
|
87
|
+
### 7. readMarketExtState
|
|
88
|
+
Return the current `MarketExtState`: state of market, YT's index, current block timestamp.
|
|
89
|
+
|
|
90
|
+
### 8. readBotState
|
|
91
|
+
Return the current `BotState`: The bot's balance in LP, SY, YT.
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
## LongYieldTradingBot.sol
|
|
95
|
+
|
|
96
|
+
There are 5 functions for rebalancing actions.
|
|
97
|
+
- For all of them, `botParams` is ApproxParams to find the optimal internal trade parameter.
|
|
98
|
+
- For functions interacting with the router, approval is needed.
|
|
99
|
+
|
|
100
|
+
### 1. setSpecs
|
|
101
|
+
|
|
102
|
+
Set the bot's specs: apeYtApy, sellYtApy, h_r (f/TVL limit), l_r (f/TVL target), h_x (YT/PT ratio limit), l_x (YT/PT ratio target).
|
|
103
|
+
|
|
104
|
+
### 2. swapSyToYt
|
|
105
|
+
|
|
106
|
+
Rebalance by buying YT with SY.
|
|
107
|
+
|
|
108
|
+
### 3. addLiqKeepYt
|
|
109
|
+
|
|
110
|
+
Rebalance by ZPI zap.
|
|
111
|
+
|
|
112
|
+
### 4. addLiqFromSy
|
|
113
|
+
|
|
114
|
+
Rebalance by adding single sided LP from SY.
|
|
115
|
+
|
|
116
|
+
### 5. addLiqFromYt
|
|
117
|
+
|
|
118
|
+
Rebalance by selling YT to LP.
|
|
119
|
+
|
|
120
|
+
### 6. removeLiqToYt
|
|
121
|
+
|
|
122
|
+
Rebalance by zapping out LP to YT.
|
|
123
|
+
|
|
124
|
+
- `intParams`: ApproxParams for internal approx function (approxSwapExactPtForYt).
|
|
125
|
+
- Zapping LP to YT can lose a few percent of the `tvlInSy`, the estimated TVL of bot in SY. Zapping out too much can cause a significant change in `tvlInSy`, which can unintentionally increase the estimated f/TVL.
|
|
126
|
+
|
|
127
|
+
## BotDecisionHelper.sol
|
|
128
|
+
|
|
129
|
+
Offchain helper for trading bot.
|
|
130
|
+
|
|
131
|
+
### 1. searchForBotParam
|
|
132
|
+
Binary search for the optimal `botParam` for the rebalancing action. To be used in bot's actual rebalancing actions.
|
|
133
|
+
|
|
134
|
+
- Searches for the minimum `botParam` so that the bot trades just "target" is met.
|
|
135
|
+
- Target to meet is calculated based on the `action` (desired f/TVL, YT/PT, IY).
|
|
136
|
+
- `botParam`: The parameter for the rebalancing function (e.g. `netPtFromSwap` for addLiqFromSy).
|
|
137
|
+
|
|
138
|
+
### 2. searchForIntParam
|
|
139
|
+
(Only useful for `removeLiqToYt`)
|
|
140
|
+
Given `botParam`, binary search for the optimal `intParam` for the internal calculations (e.g. `approxSwapExactPtForYt`).
|
|
141
|
+
|
|
142
|
+
### 3. strategyState
|
|
143
|
+
Calculate the strategy state from BotState, MarketExtState, TradingSpecs.
|
|
144
|
+
|
|
145
|
+
### 4. actionToTake
|
|
146
|
+
Return optimal action to take based on the BotState and StrategyState.
|
|
147
|
+
|
|
148
|
+
### 5. previewAction
|
|
149
|
+
Simulate rebalancing action (swap/add/remove) from BotState and MarketExtState.
|
|
150
|
+
|
|
151
|
+
### 6. botExtStats
|
|
152
|
+
Calculate the external stats for the bot: Estimated TVL in equivalent SY amount, current IY, current f/TVL ratio, current YT/PT ratio
|
|
153
|
+
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
pragma solidity ^0.8.0;
|
|
3
|
+
|
|
4
|
+
import "../libraries/BotSimulationLib.sol";
|
|
5
|
+
import "../../libraries/Errors.sol";
|
|
6
|
+
import "../libraries/SpecSegmentLib.sol";
|
|
7
|
+
import "../base/BotDecisionHelperBase.sol";
|
|
8
|
+
import "../../../interfaces/TradingBot/IShortYieldDecisionHelper.sol";
|
|
9
|
+
import "../../../interfaces/TradingBot/IShortYieldTradingBot.sol";
|
|
10
|
+
|
|
11
|
+
contract ShortYieldDecisionHelper is BotDecisionHelperBase, IShortYieldDecisionHelper {
|
|
12
|
+
using MarketExtLib for MarketExtState;
|
|
13
|
+
using MarketExtLib for ApproxParams;
|
|
14
|
+
using MarketMathCore for MarketState;
|
|
15
|
+
using MarketApproxPtInLib for MarketState;
|
|
16
|
+
using BotSimulationLib for BotState;
|
|
17
|
+
using PYIndexLib for PYIndex;
|
|
18
|
+
using Math for uint256;
|
|
19
|
+
using Math for int256;
|
|
20
|
+
using LogExpMath for uint256;
|
|
21
|
+
using SpecSegmentLib for TradingSpecs;
|
|
22
|
+
|
|
23
|
+
// We dont care about AddLiqKeepYt here
|
|
24
|
+
function getActionDetails(address botAddress) public returns (ActionToTakeResult memory res) {
|
|
25
|
+
StrategyData memory strategyData = IShortYieldTradingBot(botAddress).readStrategyData();
|
|
26
|
+
uint256 iy = strategyData.marketExt.impliedYield();
|
|
27
|
+
|
|
28
|
+
res.currentBin = _getCurrentBin(strategyData.botState, strategyData.specs, iy);
|
|
29
|
+
if (res.currentBin == 0) {
|
|
30
|
+
res.action = ActionType.NONE;
|
|
31
|
+
return res;
|
|
32
|
+
}
|
|
33
|
+
res.targetIy = _getTargetImpliedYieldForBin(
|
|
34
|
+
strategyData.botState,
|
|
35
|
+
strategyData.specs,
|
|
36
|
+
res.currentBin
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
uint256 maxAmountForAction = INF;
|
|
40
|
+
|
|
41
|
+
if (res.currentBin < 0) {
|
|
42
|
+
res.action = ActionType.SwapPtForYt;
|
|
43
|
+
uint256 maxPtToSwap = _searchMaxPtToSwap(strategyData);
|
|
44
|
+
maxAmountForAction = _calcMaxAmountForAction(
|
|
45
|
+
maxPtToSwap,
|
|
46
|
+
res.currentBin,
|
|
47
|
+
strategyData.botState.buyBins,
|
|
48
|
+
strategyData.specs.numOfBins
|
|
49
|
+
);
|
|
50
|
+
} else {
|
|
51
|
+
res.action = ActionType.SwapYtForPt;
|
|
52
|
+
maxAmountForAction = _calcMaxAmountForAction(
|
|
53
|
+
strategyData.botState.ytBalance,
|
|
54
|
+
res.currentBin,
|
|
55
|
+
strategyData.botState.buyBins,
|
|
56
|
+
strategyData.specs.numOfBins
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (maxAmountForAction == 0) {
|
|
61
|
+
return res;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
res.guessBotParams = searchForBotParam(
|
|
65
|
+
strategyData,
|
|
66
|
+
res.action,
|
|
67
|
+
res.targetIy,
|
|
68
|
+
0,
|
|
69
|
+
_getMockApproxParamsWithGuessMax(maxAmountForAction),
|
|
70
|
+
_getMockApproxParams()
|
|
71
|
+
);
|
|
72
|
+
(res.amountOut, res.guessIntParams) = _calcAmountOutAndIntParams(
|
|
73
|
+
strategyData.marketExt,
|
|
74
|
+
res.action,
|
|
75
|
+
res.guessBotParams
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Given the rebalancing action and its `botParam`, binary search for the optimal internal
|
|
81
|
+
* parameter `intParam` for the internal action's approximation (e.g. for router's swap)
|
|
82
|
+
*/
|
|
83
|
+
function _calcAmountOutAndIntParams(
|
|
84
|
+
MarketExtState memory marketExt,
|
|
85
|
+
ActionType action,
|
|
86
|
+
uint256 botParam
|
|
87
|
+
) public pure returns (uint256 amountOut, uint256 intParams) {
|
|
88
|
+
if (action == ActionType.SwapPtForYt) {
|
|
89
|
+
(amountOut, intParams) = marketExt.clone().swapPtToYt(
|
|
90
|
+
botParam,
|
|
91
|
+
_getMockApproxParams()
|
|
92
|
+
);
|
|
93
|
+
} else {
|
|
94
|
+
(amountOut, intParams) = marketExt.clone().swapYtToPt(
|
|
95
|
+
botParam,
|
|
96
|
+
_getMockApproxParams()
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function _searchMaxPtToSwap(StrategyData memory strategyData) internal pure returns (uint256) {
|
|
102
|
+
(, , , uint256 ytPtRatio) = _calcBotExtStats(
|
|
103
|
+
strategyData.botState,
|
|
104
|
+
strategyData.marketExt
|
|
105
|
+
);
|
|
106
|
+
if (ytPtRatio > strategyData.specs.targetYtPtRatio) {
|
|
107
|
+
return 0;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
ApproxParams memory guessParams = _getMockApproxParamsWithGuessMax(
|
|
111
|
+
strategyData.botState.ptBalance
|
|
112
|
+
);
|
|
113
|
+
ApproxParams memory mockSwapParams = _getMockApproxParams();
|
|
114
|
+
while (guessParams.guessMax > guessParams.guessMin + 1) {
|
|
115
|
+
uint256 guess = guessParams.guessMin +
|
|
116
|
+
(guessParams.guessMax - guessParams.guessMin) /
|
|
117
|
+
2;
|
|
118
|
+
|
|
119
|
+
(
|
|
120
|
+
bool success,
|
|
121
|
+
BotState memory botStateAfter,
|
|
122
|
+
MarketExtState memory marketExtAfter
|
|
123
|
+
) = previewAction(strategyData, ActionType.SwapPtForYt, guess, mockSwapParams);
|
|
124
|
+
|
|
125
|
+
if (!success) {
|
|
126
|
+
guessParams.guessMax = guess - 1;
|
|
127
|
+
continue;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
(, , , uint256 ytPtRatioAfter) = _calcBotExtStats(botStateAfter, marketExtAfter);
|
|
131
|
+
if (ytPtRatioAfter <= strategyData.specs.targetYtPtRatio) {
|
|
132
|
+
guessParams.guessMin = guess;
|
|
133
|
+
} else {
|
|
134
|
+
guessParams.guessMax = guess - 1;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
return guessParams.guessMin;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/// @dev Does not modify params, structs are cloned before simulation
|
|
141
|
+
function previewAction(
|
|
142
|
+
StrategyData memory strategyData,
|
|
143
|
+
ActionType action,
|
|
144
|
+
uint256 botParam,
|
|
145
|
+
ApproxParams memory intParams
|
|
146
|
+
) public pure returns (bool success, BotState memory bot, MarketExtState memory marketExt) {
|
|
147
|
+
bot = strategyData.botState.clone();
|
|
148
|
+
marketExt = strategyData.marketExt.clone();
|
|
149
|
+
|
|
150
|
+
if (action == ActionType.SwapPtForYt) {
|
|
151
|
+
success = bot.swapPtToYt(marketExt, botParam, intParams);
|
|
152
|
+
} else if (action == ActionType.SwapYtForPt) {
|
|
153
|
+
success = bot.swapYtToPt(marketExt, botParam, intParams);
|
|
154
|
+
} else {
|
|
155
|
+
success = false;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/// @dev Gives a weak upper bound so that MarketExtLib's simulation doesn't revert
|
|
160
|
+
function _weakUpperBound(
|
|
161
|
+
BotState memory bot,
|
|
162
|
+
MarketExtState memory,
|
|
163
|
+
ActionType action
|
|
164
|
+
) internal pure override returns (uint256) {
|
|
165
|
+
if (action == ActionType.SwapPtForYt) {
|
|
166
|
+
return bot.ptBalance;
|
|
167
|
+
} else {
|
|
168
|
+
return bot.ytBalance;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
function _rebalanceResult(
|
|
173
|
+
RebalanceDetails memory rebalance,
|
|
174
|
+
uint256 botParam,
|
|
175
|
+
uint256,
|
|
176
|
+
uint256 eps,
|
|
177
|
+
ApproxParams memory intParams
|
|
178
|
+
) internal pure override returns (RebalanceResult) {
|
|
179
|
+
(bool success, , MarketExtState memory marketExt) = previewAction(
|
|
180
|
+
rebalance.strategyData,
|
|
181
|
+
rebalance.action,
|
|
182
|
+
botParam,
|
|
183
|
+
intParams
|
|
184
|
+
);
|
|
185
|
+
|
|
186
|
+
if (!success) return RebalanceResult.FAIL_OR_TARGET_EXCEED;
|
|
187
|
+
|
|
188
|
+
uint256 iy = marketExt.impliedYield();
|
|
189
|
+
if (rebalance.action == ActionType.SwapPtForYt) {
|
|
190
|
+
if (iy > rebalance.targetIy) return RebalanceResult.FAIL_OR_TARGET_EXCEED;
|
|
191
|
+
} else {
|
|
192
|
+
if (iy < rebalance.targetIy) return RebalanceResult.FAIL_OR_TARGET_EXCEED;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
if (Math.isAApproxB(iy, rebalance.targetIy, eps)) return RebalanceResult.SUCCESS;
|
|
196
|
+
else return RebalanceResult.TARGET_NOT_REACHED;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
pragma solidity 0.8.17;
|
|
3
|
+
|
|
4
|
+
import "../base/TradingBotBase.sol";
|
|
5
|
+
import "../base/BotActionHelper.sol";
|
|
6
|
+
import "../../../interfaces/TradingBot/IShortYieldTradingBot.sol";
|
|
7
|
+
import "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol";
|
|
8
|
+
|
|
9
|
+
contract ShortYieldTradingBot is
|
|
10
|
+
TradingBotBase,
|
|
11
|
+
BotActionHelper,
|
|
12
|
+
IShortYieldTradingBot,
|
|
13
|
+
UUPSUpgradeable
|
|
14
|
+
{
|
|
15
|
+
using MarketExtLib for MarketExtState;
|
|
16
|
+
using Math for uint256;
|
|
17
|
+
using Math for int256;
|
|
18
|
+
|
|
19
|
+
constructor(
|
|
20
|
+
address _market,
|
|
21
|
+
address _router,
|
|
22
|
+
address _PENDLE,
|
|
23
|
+
address _decisionHelper
|
|
24
|
+
) TradingBotBase(_market, _router, _PENDLE, _decisionHelper) {}
|
|
25
|
+
|
|
26
|
+
function _authorizeUpgrade(address) internal override onlyOwner {}
|
|
27
|
+
|
|
28
|
+
function initialize(TradingSpecs memory _specs) external initializer {
|
|
29
|
+
_setSpecs(_specs);
|
|
30
|
+
__BoringOwnable_init();
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function mintPY(
|
|
34
|
+
uint256 netSyIn,
|
|
35
|
+
uint256 minPyOut
|
|
36
|
+
) external onlyOwner returns (uint256 netPyOut) {
|
|
37
|
+
netPyOut = _mintPY(netSyIn, minPyOut);
|
|
38
|
+
emit MintPy(netSyIn, minPyOut);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function swapPtForYt(
|
|
42
|
+
SwapInput calldata inputParams
|
|
43
|
+
) external onlyOwner returns (uint256 netYtOut) {
|
|
44
|
+
StrategyData memory strategyData = readStrategyData();
|
|
45
|
+
|
|
46
|
+
require(
|
|
47
|
+
IBotDecisionHelper(decisionHelper).getCurrentBin(strategyData) ==
|
|
48
|
+
inputParams.currentBin,
|
|
49
|
+
"removeLiqToYt: bin state expired"
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
uint256 netPtToSwap = decisionHelper.searchForBotParam(
|
|
53
|
+
strategyData,
|
|
54
|
+
ActionType.SwapPtForYt,
|
|
55
|
+
inputParams.targetIy,
|
|
56
|
+
type(uint256).max,
|
|
57
|
+
inputParams.botParams,
|
|
58
|
+
inputParams.guessTotalPtToSwap
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
netYtOut = _swapPtForYt(
|
|
62
|
+
netPtToSwap,
|
|
63
|
+
inputParams.guessTotalPtToSwap,
|
|
64
|
+
inputParams.minAmountOut
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
_updateSellBinAfterTrade();
|
|
68
|
+
|
|
69
|
+
emit SwapPtForYt(inputParams, netYtOut);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function swapYtForPt(
|
|
73
|
+
SwapInput calldata inputParams
|
|
74
|
+
) external onlyOwner returns (uint256 netPtOut) {
|
|
75
|
+
StrategyData memory strategyData = readStrategyData();
|
|
76
|
+
|
|
77
|
+
require(
|
|
78
|
+
IBotDecisionHelper(decisionHelper).getCurrentBin(strategyData) ==
|
|
79
|
+
inputParams.currentBin,
|
|
80
|
+
"removeLiqToYt: bin state expired"
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
uint256 netYtToSwap = decisionHelper.searchForBotParam(
|
|
84
|
+
strategyData,
|
|
85
|
+
ActionType.SwapYtForPt,
|
|
86
|
+
inputParams.targetIy,
|
|
87
|
+
type(uint256).max,
|
|
88
|
+
inputParams.botParams,
|
|
89
|
+
inputParams.guessTotalPtToSwap
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
netPtOut = _swapYtForPt(
|
|
93
|
+
netYtToSwap,
|
|
94
|
+
inputParams.guessTotalPtToSwap,
|
|
95
|
+
inputParams.minAmountOut
|
|
96
|
+
);
|
|
97
|
+
|
|
98
|
+
_updateSellBinAfterTrade();
|
|
99
|
+
emit SwapYtForPt(inputParams, netPtOut);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
pragma solidity 0.8.17;
|
|
3
|
+
|
|
4
|
+
import "../../../interfaces/IPMarketSwapCallback.sol";
|
|
5
|
+
import "../../../interfaces/TradingBot/IBotDecisionHelper.sol";
|
|
6
|
+
import "./TradingBotBase.sol";
|
|
7
|
+
|
|
8
|
+
abstract contract BotActionCallback is TradingBotBase, IPMarketSwapCallback {
|
|
9
|
+
using Math for int256;
|
|
10
|
+
|
|
11
|
+
modifier onlyMarket(address caller) {
|
|
12
|
+
if (caller != market) revert Errors.BotCallbackNotMarket(caller);
|
|
13
|
+
_;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function swapCallback(
|
|
17
|
+
int256 ptToAccount,
|
|
18
|
+
int256 syToAccount,
|
|
19
|
+
bytes calldata data
|
|
20
|
+
) external override onlyMarket(msg.sender) {
|
|
21
|
+
ActionType swapType = _getActionType(data);
|
|
22
|
+
if (swapType == ActionType.AddLiqFromYt) {
|
|
23
|
+
_callbackAddLiqFromYt(ptToAccount, syToAccount, data);
|
|
24
|
+
} else if (swapType == ActionType.RemoveLiqToYt) {
|
|
25
|
+
_callbackRemoveLiqToYt(ptToAccount, syToAccount, data);
|
|
26
|
+
} else {
|
|
27
|
+
assert(false);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/// ------------------------------------------------------------
|
|
32
|
+
/// AddLiqFromYt
|
|
33
|
+
/// ------------------------------------------------------------
|
|
34
|
+
|
|
35
|
+
function _callbackAddLiqFromYt(
|
|
36
|
+
int256 ptToAccount,
|
|
37
|
+
int256 /*syToAccount*/,
|
|
38
|
+
bytes calldata data
|
|
39
|
+
) internal {
|
|
40
|
+
uint256 netPyRedeemSy = _decodeAddLiqFromYt(data);
|
|
41
|
+
|
|
42
|
+
_transferOut(PT, YT, netPyRedeemSy);
|
|
43
|
+
|
|
44
|
+
bool needToBurnYt = (!IPYieldToken(YT).isExpired());
|
|
45
|
+
if (needToBurnYt) _transferOut(YT, YT, netPyRedeemSy);
|
|
46
|
+
|
|
47
|
+
IPYieldToken(YT).redeemPY(market); // all SY goes to market to repay and mint LP
|
|
48
|
+
|
|
49
|
+
_transferOut(PT, market, ptToAccount.Uint() - netPyRedeemSy); // remaining PT goes to market to mint LP
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function _encodeAddLiqFromYt(uint256 netPyRedeemSy) internal pure returns (bytes memory res) {
|
|
53
|
+
res = new bytes(64);
|
|
54
|
+
uint256 actionType = uint256(ActionType.AddLiqFromYt);
|
|
55
|
+
|
|
56
|
+
assembly {
|
|
57
|
+
mstore(add(res, 32), actionType)
|
|
58
|
+
mstore(add(res, 64), netPyRedeemSy)
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function _decodeAddLiqFromYt(
|
|
63
|
+
bytes calldata data
|
|
64
|
+
) internal pure returns (uint256 netPyRedeemSy) {
|
|
65
|
+
assembly {
|
|
66
|
+
// first 32 bytes is ActionType
|
|
67
|
+
netPyRedeemSy := calldataload(add(data.offset, 32))
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/// ------------------------------------------------------------
|
|
72
|
+
/// RemoveLiqToYt
|
|
73
|
+
/// ------------------------------------------------------------
|
|
74
|
+
|
|
75
|
+
function _callbackRemoveLiqToYt(
|
|
76
|
+
int256 /*ptToAccount*/,
|
|
77
|
+
int256 /*syToAccount*/,
|
|
78
|
+
bytes calldata data
|
|
79
|
+
) internal {
|
|
80
|
+
uint256 minYtOut = _decodeRemoveLiqToYt(data);
|
|
81
|
+
|
|
82
|
+
uint256 netYtOut = IPYieldToken(YT).mintPY(market, address(this)); // PT goes to market to repay
|
|
83
|
+
if (netYtOut < minYtOut) revert Errors.BotInsufficientYtOut(netYtOut, minYtOut); // 2nd check
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function _encodeRemoveLiqToYt(uint256 minYtOut) internal pure returns (bytes memory res) {
|
|
87
|
+
res = new bytes(64);
|
|
88
|
+
uint256 actionType = uint256(ActionType.RemoveLiqToYt);
|
|
89
|
+
|
|
90
|
+
assembly {
|
|
91
|
+
mstore(add(res, 32), actionType)
|
|
92
|
+
mstore(add(res, 64), minYtOut)
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function _decodeRemoveLiqToYt(bytes calldata data) internal pure returns (uint256 minYtOut) {
|
|
97
|
+
assembly {
|
|
98
|
+
// first 32 bytes is ActionType
|
|
99
|
+
minYtOut := calldataload(add(data.offset, 32))
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/// ------------------------------------------------------------
|
|
104
|
+
/// Misc functions
|
|
105
|
+
/// ------------------------------------------------------------
|
|
106
|
+
|
|
107
|
+
function _getActionType(bytes calldata data) internal pure returns (ActionType actionType) {
|
|
108
|
+
assembly {
|
|
109
|
+
actionType := calldataload(data.offset)
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|