@pendle/core-v2 2.17.0 → 2.17.2-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/ExcessivelySafeCall.sol/ExcessivelySafeCall.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/LiquidityMining/libraries/WeekMath.sol/WeekMath.dbg.json +1 -1
- 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/SYUtils.sol/SYUtils.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/StEthHelper.sol/StEthHelper.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/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/BalancerStable/base/StablePoolUserData.sol/StablePoolUserData.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/GLPPreviewHelper.sol/GLPPreviewHelper.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/BotActionCallback.sol/BotActionCallback.dbg.json +4 -0
- package/build/artifacts/contracts/core/TradingBot/BotActionCallback.sol/BotActionCallback.json +638 -0
- package/build/artifacts/contracts/core/TradingBot/BotActionHelper.sol/BotActionHelper.dbg.json +4 -0
- package/build/artifacts/contracts/core/TradingBot/BotActionHelper.sol/BotActionHelper.json +638 -0
- package/build/artifacts/contracts/core/TradingBot/BotDecisionLib.sol/BotDecisionLib.dbg.json +4 -0
- package/build/artifacts/contracts/core/TradingBot/BotDecisionLib.sol/BotDecisionLib.json +567 -0
- package/build/artifacts/contracts/core/TradingBot/BotSimulationLib.sol/BotSimulationLib.dbg.json +4 -0
- package/build/artifacts/contracts/core/TradingBot/BotSimulationLib.sol/BotSimulationLib.json +10 -0
- package/build/artifacts/contracts/core/TradingBot/LongYieldTradingBot.sol/LongYieldTradingBot.dbg.json +4 -0
- package/build/artifacts/contracts/core/TradingBot/LongYieldTradingBot.sol/LongYieldTradingBot.json +1882 -0
- package/build/artifacts/contracts/core/TradingBot/MarketExtLib.sol/MarketExtLib.dbg.json +4 -0
- package/build/artifacts/contracts/core/TradingBot/MarketExtLib.sol/MarketExtLib.json +24 -0
- package/build/artifacts/contracts/core/TradingBot/TradingBotBase.sol/TradingBotBase.dbg.json +4 -0
- package/build/artifacts/contracts/core/TradingBot/TradingBotBase.sol/TradingBotBase.json +588 -0
- package/build/artifacts/contracts/core/TradingBot/TradingBotOffchain.sol/TradingBotOffchain.dbg.json +4 -0
- package/build/artifacts/contracts/core/TradingBot/TradingBotOffchain.sol/TradingBotOffchain.json +1053 -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/erc20/PendleERC20.sol/PendleERC20.dbg.json +1 -1
- package/build/artifacts/contracts/core/erc20/PendleERC20Permit.sol/PendleERC20Permit.dbg.json +1 -1
- package/build/artifacts/contracts/core/libraries/ArrayLib.sol/ArrayLib.dbg.json +1 -1
- package/build/artifacts/contracts/core/libraries/BaseSplitCodeFactory.sol/BaseSplitCodeFactory.dbg.json +1 -1
- package/build/artifacts/contracts/core/libraries/BaseSplitCodeFactory.sol/CodeDeployer.dbg.json +1 -1
- package/build/artifacts/contracts/core/libraries/BoringOwnableUpgradeable.sol/BoringOwnableUpgradeable.dbg.json +1 -1
- package/build/artifacts/contracts/core/libraries/BoringOwnableUpgradeable.sol/BoringOwnableUpgradeableData.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/ExpiryUtilsLib.sol/ExpiryUtils.dbg.json +1 -1
- package/build/artifacts/contracts/core/libraries/MiniHelpers.sol/MiniHelpers.dbg.json +1 -1
- package/build/artifacts/contracts/core/libraries/StringLib.sol/StringLib.dbg.json +1 -1
- 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/TokenHelper.sol/TokenHelper.dbg.json +1 -1
- package/build/artifacts/contracts/core/libraries/math/LogExpMath.sol/LogExpMath.dbg.json +1 -1
- package/build/artifacts/contracts/core/libraries/math/Math.sol/Math.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Balancer/IAsset.sol/IAsset.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Balancer/IBalancerFees.sol/IBalancerFees.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Balancer/IBalancerStablePreview.sol/IBalancerStablePreview.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Balancer/IBasePool.sol/IBasePool.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Balancer/IComposableStable.sol/IComposableStable.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Balancer/IERC4626LinearPool.sol/IERC4626LinearPool.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Balancer/IGauge.sol/IGauge.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Balancer/ILiquidityGaugeFactory.sol/ILiquidityGaugeFactory.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Balancer/IMetaStablePool.sol/IMetaStablePool.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Balancer/IRateProvider.sol/IRateProvider.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Balancer/IVault.sol/IVault.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Camelot/ICamelotFactory.sol/ICamelotFactory.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Camelot/ICamelotNFTFactory.sol/ICamelotNFTFactory.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Camelot/ICamelotNFTHandler.sol/ICamelotNFTHandler.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/ICamelotNitroPoolFactory.sol/ICamelotNitroPoolFactory.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Camelot/ICamelotPair.sol/ICamelotPair.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Camelot/ICamelotRouter.sol/ICamelotRouter.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Camelot/ICamelotYieldBooster.sol/ICamelotYieldBooster.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Camelot/IXGrail.sol/IXGrail.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/ConvexCurve/IBooster.sol/IBooster.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/ConvexCurve/ICrvDepositor.sol/ICrvDepositor.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/ConvexCurve/ICvxCrv.sol/ICvxCrv.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/ConvexCurve/IRewards.sol/IRewards.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Curve/ICrvPool.sol/ICrvPool.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Curve/ITriCrvPool.sol/ITriCrvPool.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Frax/IFrxEthMinter.sol/IFrxEthMinter.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/GMX/IGMXVault.sol/IGMXVault.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/GMX/IGlpManager.sol/IGlpManager.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/GMX/IRewardRouterV2.sol/IRewardRouterV2.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/GMX/IVaultPriceFeed.sol/IVaultPriceFeed.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IAddressProvider.sol/IAddressProvider.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IApeStaking.sol/IApeStaking.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IBenQiComptroller.sol/IBenQiComptroller.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IBenQiInterestRateModel.sol/IBenQiInterestRateModel.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IDiamondCut.sol/IDiamondCut.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IDiamondLoupe.sol/IDiamondLoupe.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IERC4626.sol/IERC4626.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/ILayerZeroEndpoint.sol/ILayerZeroEndpoint.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/ILayerZeroReceiver.sol/ILayerZeroReceiver.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/ILooksFeeSharing.sol/ILooksFeeSharing.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/ILooksStaking.sol/ILooksStaking.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/IPActionMisc.sol/IPActionMisc.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/IPActionVePendleStatic.sol/IPActionVePendleStatic.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/IPBulkSellerFactory.sol/IPBulkSellerFactory.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPBulkSellerSYCallback.sol/IPBulkSellerCallback.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPFeeDistributor.sol/IPFeeDistributor.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPFeeDistributorV2.sol/IPFeeDistributorV2.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPGauge.sol/IPGauge.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPGaugeController.sol/IPGaugeController.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPGaugeControllerMainchain.sol/IPGaugeControllerMainchain.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPInterestManagerYT.sol/IPInterestManagerYT.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPInterestManagerYTV2.sol/IPInterestManagerYTV2.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPMarket.sol/IPMarket.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPMarketFactory.sol/IPMarketFactory.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPMarketSwapCallback.sol/IPMarketSwapCallback.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPMiniDiamond.sol/IPMiniDiamond.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPMsgReceiverApp.sol/IPMsgReceiverApp.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPMsgSendEndpoint.sol/IPMsgSendEndpoint.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPPrincipalToken.sol/IPPrincipalToken.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPPtOracle.sol/IPPtOracle.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/IPVeToken.sol/IPVeToken.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/IPYieldToken.sol/IPYieldToken.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPYieldTokenV2.sol/IPYieldTokenV2.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IQiAvax.sol/IQiAvax.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IQiErc20.sol/IQiErc20.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IQiToken.sol/IQiToken.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IRewardManager.sol/IRewardManager.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IStETH.sol/IStETH.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IStandardizedYield.sol/IStandardizedYield.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IStargateLP.sol/IStargateLP.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IStargateRouter.sol/IStargateRouter.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IStargateStaking.sol/IStargateStaking.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IWETH.sol/IWETH.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IWstETH.sol/IWstETH.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/TradingBot/ILongYieldTradingBot.sol/ILongYieldTradingBot.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/TradingBot/ILongYieldTradingBot.sol/ILongYieldTradingBot.json +884 -0
- package/build/artifacts/contracts/interfaces/TradingBot/ITradingBotBase.sol/ITradingBotBase.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/TradingBot/ITradingBotBase.sol/ITradingBotBase.json +390 -0
- package/build/artifacts/contracts/offchain-helpers/AddressProvider.sol/AddressProvider.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/BaseSplitCodeFactoryContract.sol/BaseSplitCodeFactoryContract.dbg.json +1 -1
- 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/EmptyUUPS.sol/EmptyUUPS.dbg.json +1 -1
- 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/Multicall2.sol/Multicall2.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/PendleMulticallV1.sol/PendleMulticallV1.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/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/ActionMisc.sol/ActionMisc.dbg.json +1 -1
- 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/IPSwapAggregator.sol/IPSwapAggregator.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/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/BotActionCallback.sol +112 -0
- package/contracts/core/TradingBot/BotActionHelper.sol +138 -0
- package/contracts/core/TradingBot/BotDecisionLib.sol +272 -0
- package/contracts/core/TradingBot/BotSimulationLib.sol +115 -0
- package/contracts/core/TradingBot/LongYieldTradingBot.sol +154 -0
- package/contracts/core/TradingBot/MarketExtLib.sol +246 -0
- package/contracts/core/TradingBot/README.md +151 -0
- package/contracts/core/TradingBot/TradingBotBase.sol +131 -0
- package/contracts/core/TradingBot/TradingBotOffchain.sol +137 -0
- package/contracts/core/libraries/Errors.sol +12 -0
- package/contracts/core/libraries/TokenAmountLib.sol +47 -0
- package/contracts/interfaces/TradingBot/ILongYieldTradingBot.sol +89 -0
- package/contracts/interfaces/TradingBot/ITradingBotBase.sol +43 -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 +727 -0
- package/typechain-types/BotActionHelper.ts +727 -0
- package/typechain-types/BotDecisionLib.ts +330 -0
- package/typechain-types/CamelotV1LpHelper.ts +203 -0
- package/typechain-types/CamelotV1Preview.ts +431 -0
- package/typechain-types/ICamelotSY.ts +100 -0
- package/typechain-types/ILongYieldTradingBot.ts +652 -0
- package/typechain-types/IPendlePreviewHelper.ts +147 -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 +447 -0
- package/typechain-types/LongYieldTradingBot.ts +1520 -0
- package/typechain-types/MarketExtLib.ts +81 -0
- package/typechain-types/PendleArbitrumStakedEthSY.ts +1222 -0
- package/typechain-types/PendleCamelotV1SY.ts +1961 -0
- package/typechain-types/PendleLpGlpOracle.ts +145 -0
- package/typechain-types/PendleThenaSY.ts +1445 -0
- package/typechain-types/ThenaLpHelper.ts +172 -0
- package/typechain-types/ThenaPreview.ts +431 -0
- package/typechain-types/TradingBotBase.ts +683 -0
- package/typechain-types/TradingBotOffchain.ts +563 -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 +653 -0
- package/typechain-types/factories/BotActionHelper__factory.ts +653 -0
- package/typechain-types/factories/BotDecisionLib__factory.ts +620 -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/ICamelotSY__factory.ts +49 -0
- package/typechain-types/factories/ILongYieldTradingBot__factory.ts +903 -0
- package/typechain-types/factories/IPendlePreviewHelper__factory.ts +78 -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 +405 -0
- package/typechain-types/factories/LongYieldTradingBot__factory.ts +1951 -0
- package/typechain-types/factories/MarketExtLib__factory.ts +74 -0
- package/typechain-types/factories/OracleLib__factory.ts +1 -1
- package/typechain-types/factories/PendleArbitrumStakedEthSY__factory.ts +1068 -0
- 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/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/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/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/PendleMarketFactory__factory.ts +1 -1
- 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/PendleThenaSY__factory.ts +1268 -0
- package/typechain-types/factories/PendleVotingControllerUpg__factory.ts +1 -1
- 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/SAPE__factory.ts +1 -1
- package/typechain-types/factories/ThenaLpHelper__factory.ts +127 -0
- package/typechain-types/factories/ThenaPreview__factory.ts +306 -0
- package/typechain-types/factories/TradingBotBase__factory.ts +603 -0
- package/typechain-types/factories/TradingBotOffchain__factory.ts +1111 -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 +90 -108
- package/typechain-types/index.ts +22 -14
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
pragma solidity ^0.8.0;
|
|
3
|
+
|
|
4
|
+
import "./BotSimulationLib.sol";
|
|
5
|
+
import "../libraries/Errors.sol";
|
|
6
|
+
|
|
7
|
+
struct LongTradingSpecs {
|
|
8
|
+
uint256 lowerIyLimit; // apeYtApy
|
|
9
|
+
uint256 upperIyLimit; // sellYtApy
|
|
10
|
+
uint256 floatingSyRatioLimit; // r
|
|
11
|
+
uint256 ytPtRatioLimit; // ytPtRatio (x)
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
enum ActionType {
|
|
15
|
+
SwapSyToYt, // Buy YT with SY
|
|
16
|
+
AddLiqKeepYt, // ZPI Zap
|
|
17
|
+
AddLiqFromSy, // Single sided LP
|
|
18
|
+
AddLiqFromYt, // Sell YT for LP
|
|
19
|
+
RemoveLiqToYt, // Zap out to YT,
|
|
20
|
+
NONE
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
enum StrategyFlag {
|
|
24
|
+
GOOD,
|
|
25
|
+
TOO_LOW,
|
|
26
|
+
TOO_HIGH
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
struct StrategyState {
|
|
30
|
+
StrategyFlag iyFlag;
|
|
31
|
+
StrategyFlag syRatioFlag;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
contract BotDecisionLib {
|
|
35
|
+
using MarketExtLib for MarketExtState;
|
|
36
|
+
using MarketExtLib for ApproxParams;
|
|
37
|
+
using BotSimulationLib for BotState;
|
|
38
|
+
using Math for uint256;
|
|
39
|
+
|
|
40
|
+
enum RebalanceResult {
|
|
41
|
+
FAIL,
|
|
42
|
+
OLD_STATE,
|
|
43
|
+
NEW_STATE
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
struct RebalanceDetails {
|
|
47
|
+
BotState bot;
|
|
48
|
+
MarketExtState marketExt;
|
|
49
|
+
LongTradingSpecs specs;
|
|
50
|
+
ActionType action;
|
|
51
|
+
StrategyState oldState;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Finds the smallest paramater such that the bot reaches a new state, otherwise finds the
|
|
56
|
+
* largest parameter possible that doesn't fail.
|
|
57
|
+
*
|
|
58
|
+
* @param botParams ApproxParams for this binary search function
|
|
59
|
+
* @param oldState The initial StrategyState, to be moved away from
|
|
60
|
+
* @param intParams ApproxParams for public action's approximation (e.g. for router's swap)
|
|
61
|
+
* @dev For `botParams`, eps = the precision such that slightly lower
|
|
62
|
+
* ((return value) * (1 - eps)) does not reach a new state
|
|
63
|
+
*
|
|
64
|
+
* - Returns `botParams.guessOffchain` if verifies that it reaches a new state,
|
|
65
|
+
* and slightly lower does not reach a new state.
|
|
66
|
+
* - Reverts if `botParams.guessMin` is invalid, or returns `botParams.guessMin` if reaches a
|
|
67
|
+
* new state
|
|
68
|
+
* - Returns `botParams.guessMax` if it is valid & does not reach a new state
|
|
69
|
+
* - Otherwise, binary search for `guess` such that it reaches a new state, and slightly lower
|
|
70
|
+
* does not reach a new state
|
|
71
|
+
*
|
|
72
|
+
*/
|
|
73
|
+
function binarySearchUntilSwitchState(
|
|
74
|
+
BotState memory bot,
|
|
75
|
+
MarketExtState memory marketExt,
|
|
76
|
+
LongTradingSpecs memory specs,
|
|
77
|
+
ActionType action,
|
|
78
|
+
StrategyState memory oldState,
|
|
79
|
+
ApproxParams memory botParams,
|
|
80
|
+
ApproxParams memory intParams
|
|
81
|
+
) public pure returns (uint256) {
|
|
82
|
+
RebalanceDetails memory rebalance = RebalanceDetails(
|
|
83
|
+
bot,
|
|
84
|
+
marketExt,
|
|
85
|
+
specs,
|
|
86
|
+
action,
|
|
87
|
+
oldState
|
|
88
|
+
);
|
|
89
|
+
|
|
90
|
+
if (botParams.guessOffchain != 0) {
|
|
91
|
+
uint256 guessOffchainMinusDelta = botParams.guessOffchain.mulDown(
|
|
92
|
+
Math.ONE - botParams.eps
|
|
93
|
+
);
|
|
94
|
+
if (
|
|
95
|
+
_rebalanceResult(rebalance, botParams.guessOffchain, intParams) ==
|
|
96
|
+
RebalanceResult.NEW_STATE &&
|
|
97
|
+
_rebalanceResult(rebalance, guessOffchainMinusDelta, intParams) ==
|
|
98
|
+
RebalanceResult.OLD_STATE
|
|
99
|
+
) return botParams.guessOffchain;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
{
|
|
103
|
+
uint256 guessUpperBound = _weakUpperBound(bot, marketExt, action);
|
|
104
|
+
if (botParams.guessMax > guessUpperBound) botParams.guessMax = guessUpperBound;
|
|
105
|
+
if (botParams.guessMin > botParams.guessMax)
|
|
106
|
+
revert Errors.BotBinarySearchInvalidRange(
|
|
107
|
+
uint256(action),
|
|
108
|
+
botParams.guessMin,
|
|
109
|
+
botParams.guessMax
|
|
110
|
+
);
|
|
111
|
+
|
|
112
|
+
if (
|
|
113
|
+
_rebalanceResult(rebalance, botParams.guessMax, intParams) ==
|
|
114
|
+
RebalanceResult.OLD_STATE
|
|
115
|
+
) return botParams.guessMax;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
{
|
|
119
|
+
RebalanceResult guessMinResult = _rebalanceResult(
|
|
120
|
+
rebalance,
|
|
121
|
+
botParams.guessMin,
|
|
122
|
+
intParams
|
|
123
|
+
);
|
|
124
|
+
if (guessMinResult == RebalanceResult.FAIL)
|
|
125
|
+
revert Errors.BotBinarySearchGuessMinInvalid(uint256(action), botParams.guessMin);
|
|
126
|
+
if (guessMinResult == RebalanceResult.NEW_STATE) return botParams.guessMin;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
for (uint256 iter = 0; iter < botParams.maxIteration; ++iter) {
|
|
130
|
+
uint256 guess = botParams.guessMin + (botParams.guessMax - botParams.guessMin) / 2;
|
|
131
|
+
|
|
132
|
+
if (_rebalanceResult(rebalance, guess, intParams) == RebalanceResult.OLD_STATE) {
|
|
133
|
+
botParams.guessMin = guess;
|
|
134
|
+
} else {
|
|
135
|
+
botParams.guessMax = guess;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
if (Math.isASmallerApproxB(botParams.guessMin, botParams.guessMax, botParams.eps)) {
|
|
139
|
+
if (
|
|
140
|
+
_rebalanceResult(rebalance, botParams.guessMax, intParams) ==
|
|
141
|
+
RebalanceResult.FAIL
|
|
142
|
+
) return botParams.guessMin;
|
|
143
|
+
|
|
144
|
+
return botParams.guessMax;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
revert Errors.BotBinarySearchFail();
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
function _rebalanceResult(
|
|
152
|
+
RebalanceDetails memory rebalance,
|
|
153
|
+
uint256 botParam,
|
|
154
|
+
ApproxParams memory intParams
|
|
155
|
+
) private pure returns (RebalanceResult) {
|
|
156
|
+
(bool success, StrategyState memory newState) = _stateAfterRebalance(
|
|
157
|
+
rebalance,
|
|
158
|
+
botParam,
|
|
159
|
+
intParams
|
|
160
|
+
);
|
|
161
|
+
|
|
162
|
+
if (!success) return RebalanceResult.FAIL;
|
|
163
|
+
if (_sameStrategyState(rebalance.oldState, newState)) return RebalanceResult.OLD_STATE;
|
|
164
|
+
return RebalanceResult.NEW_STATE;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
function _sameStrategyState(
|
|
168
|
+
StrategyState memory initialState,
|
|
169
|
+
StrategyState memory otherState
|
|
170
|
+
) private pure returns (bool) {
|
|
171
|
+
return
|
|
172
|
+
(initialState.iyFlag == otherState.iyFlag) &&
|
|
173
|
+
(initialState.syRatioFlag == otherState.syRatioFlag);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
function _stateAfterRebalance(
|
|
177
|
+
RebalanceDetails memory rebalance,
|
|
178
|
+
uint256 botParam,
|
|
179
|
+
ApproxParams memory intParams
|
|
180
|
+
) private pure returns (bool success, StrategyState memory currentState) {
|
|
181
|
+
BotState memory botClone = rebalance.bot.clone();
|
|
182
|
+
MarketExtState memory marketExtClone = rebalance.marketExt.clone();
|
|
183
|
+
|
|
184
|
+
if (rebalance.action == ActionType.SwapSyToYt) {
|
|
185
|
+
success = botClone.swapSyToYt(marketExtClone, botParam);
|
|
186
|
+
} else if (rebalance.action == ActionType.AddLiqKeepYt) {
|
|
187
|
+
success = botClone.addLiqKeepYt(marketExtClone, botParam);
|
|
188
|
+
} else if (rebalance.action == ActionType.AddLiqFromSy) {
|
|
189
|
+
success = botClone.addLiqFromSy(marketExtClone, botParam);
|
|
190
|
+
} else if (rebalance.action == ActionType.AddLiqFromYt) {
|
|
191
|
+
success = botClone.addLiqFromYt(marketExtClone, botParam);
|
|
192
|
+
} else if (rebalance.action == ActionType.RemoveLiqToYt) {
|
|
193
|
+
success = botClone.removeLiqToYt(marketExtClone, botParam, intParams.clone());
|
|
194
|
+
} else {
|
|
195
|
+
success = false;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
if (success) {
|
|
199
|
+
currentState = strategyState(botClone, marketExtClone, rebalance.specs);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/// @dev Gives a weak upper bound so that MarketExtLib's simulation doesn't revert
|
|
204
|
+
function _weakUpperBound(
|
|
205
|
+
BotState memory bot,
|
|
206
|
+
MarketExtState memory marketExt,
|
|
207
|
+
ActionType action
|
|
208
|
+
) private pure returns (uint256) {
|
|
209
|
+
if (action == ActionType.SwapSyToYt) {
|
|
210
|
+
return marketExt.calcMaxPtIn();
|
|
211
|
+
} else if (action == ActionType.AddLiqKeepYt) {
|
|
212
|
+
return bot.syBalance;
|
|
213
|
+
} else if (action == ActionType.AddLiqFromSy) {
|
|
214
|
+
return marketExt.calcMaxPtOut();
|
|
215
|
+
} else if (action == ActionType.AddLiqFromYt) {
|
|
216
|
+
return marketExt.calcMaxPtOut();
|
|
217
|
+
} else if (action == ActionType.RemoveLiqToYt) {
|
|
218
|
+
return bot.lpBalance;
|
|
219
|
+
} else {
|
|
220
|
+
return 0;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
function strategyState(
|
|
225
|
+
BotState memory bot,
|
|
226
|
+
MarketExtState memory marketExt,
|
|
227
|
+
LongTradingSpecs memory specs
|
|
228
|
+
) public pure returns (StrategyState memory currentState) {
|
|
229
|
+
uint256 iy = marketExt.impliedYield();
|
|
230
|
+
(, uint256 ptInLp) = marketExt.previewAssetsFromLp(bot.lpBalance);
|
|
231
|
+
uint256 currentYtPtRatio = (
|
|
232
|
+
ptInLp == 0 ? type(uint256).max : bot.ytBalance.divDown(ptInLp)
|
|
233
|
+
);
|
|
234
|
+
|
|
235
|
+
if (iy < specs.lowerIyLimit) {
|
|
236
|
+
currentState.iyFlag = StrategyFlag.TOO_LOW;
|
|
237
|
+
} else if (specs.upperIyLimit < iy && currentYtPtRatio > specs.ytPtRatioLimit) {
|
|
238
|
+
currentState.iyFlag = StrategyFlag.TOO_HIGH;
|
|
239
|
+
} else {
|
|
240
|
+
currentState.iyFlag = StrategyFlag.GOOD;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
uint256 currentSyRatio = bot.syBalance.divDown(bot.tvlInSy(marketExt));
|
|
244
|
+
if (currentSyRatio > specs.floatingSyRatioLimit) {
|
|
245
|
+
currentState.syRatioFlag = StrategyFlag.TOO_HIGH;
|
|
246
|
+
} else {
|
|
247
|
+
currentState.syRatioFlag = StrategyFlag.GOOD;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
function actionToTake(StrategyState memory currentState) public pure returns (ActionType) {
|
|
252
|
+
if (currentState.iyFlag == StrategyFlag.TOO_LOW) {
|
|
253
|
+
if (currentState.syRatioFlag == StrategyFlag.TOO_HIGH) {
|
|
254
|
+
return ActionType.SwapSyToYt;
|
|
255
|
+
} else {
|
|
256
|
+
return ActionType.RemoveLiqToYt;
|
|
257
|
+
}
|
|
258
|
+
} else if (currentState.iyFlag == StrategyFlag.GOOD) {
|
|
259
|
+
if (currentState.syRatioFlag == StrategyFlag.TOO_HIGH) {
|
|
260
|
+
return ActionType.AddLiqKeepYt;
|
|
261
|
+
} else {
|
|
262
|
+
return ActionType.NONE;
|
|
263
|
+
}
|
|
264
|
+
} else {
|
|
265
|
+
if (currentState.syRatioFlag == StrategyFlag.TOO_HIGH) {
|
|
266
|
+
return ActionType.AddLiqFromSy;
|
|
267
|
+
} else {
|
|
268
|
+
return ActionType.AddLiqFromYt;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
pragma solidity ^0.8.0;
|
|
3
|
+
|
|
4
|
+
import "./MarketExtLib.sol";
|
|
5
|
+
|
|
6
|
+
struct BotState {
|
|
7
|
+
uint256 lpBalance;
|
|
8
|
+
uint256 ytBalance;
|
|
9
|
+
uint256 syBalance;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
library BotSimulationLib {
|
|
13
|
+
using MarketMathCore for MarketState;
|
|
14
|
+
using MarketExtLib for MarketExtState;
|
|
15
|
+
using Math for uint256;
|
|
16
|
+
using Math for int256;
|
|
17
|
+
|
|
18
|
+
function swapSyToYt(
|
|
19
|
+
BotState memory bot,
|
|
20
|
+
MarketExtState memory marketExt,
|
|
21
|
+
uint256 exactYtOut
|
|
22
|
+
) internal pure returns (bool /*success*/) {
|
|
23
|
+
uint256 netSyIn = marketExt.swapSyToYt(exactYtOut);
|
|
24
|
+
|
|
25
|
+
if (netSyIn > bot.syBalance) return false;
|
|
26
|
+
|
|
27
|
+
bot.syBalance -= netSyIn;
|
|
28
|
+
bot.ytBalance += exactYtOut;
|
|
29
|
+
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function addLiqKeepYt(
|
|
34
|
+
BotState memory bot,
|
|
35
|
+
MarketExtState memory marketExt,
|
|
36
|
+
uint256 netSyIn
|
|
37
|
+
) internal pure returns (bool /*success*/) {
|
|
38
|
+
if (netSyIn > bot.syBalance) return false;
|
|
39
|
+
|
|
40
|
+
(uint256 netLpOut, uint256 netYtOut) = marketExt.addLiqKeepYt(netSyIn);
|
|
41
|
+
|
|
42
|
+
bot.syBalance -= netSyIn;
|
|
43
|
+
bot.lpBalance += netLpOut;
|
|
44
|
+
bot.ytBalance += netYtOut;
|
|
45
|
+
|
|
46
|
+
return true;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function addLiqFromSy(
|
|
50
|
+
BotState memory bot,
|
|
51
|
+
MarketExtState memory marketExt,
|
|
52
|
+
uint256 netPtFromSwap
|
|
53
|
+
) internal pure returns (bool /*success*/) {
|
|
54
|
+
(uint256 netLpOut, uint256 netSyIn) = marketExt.addLiqFromSy(netPtFromSwap);
|
|
55
|
+
|
|
56
|
+
if (netSyIn > bot.syBalance) return false;
|
|
57
|
+
|
|
58
|
+
bot.syBalance -= netSyIn;
|
|
59
|
+
bot.lpBalance += netLpOut;
|
|
60
|
+
|
|
61
|
+
return true;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function addLiqFromYt(
|
|
65
|
+
BotState memory bot,
|
|
66
|
+
MarketExtState memory marketExt,
|
|
67
|
+
uint256 netPtFromSwap
|
|
68
|
+
) internal pure returns (bool /*success*/) {
|
|
69
|
+
(uint256 netLpOut, uint256 netYtIn) = marketExt.addLiqFromYt(netPtFromSwap);
|
|
70
|
+
|
|
71
|
+
if (netYtIn > bot.ytBalance) return false;
|
|
72
|
+
|
|
73
|
+
bot.ytBalance -= netYtIn;
|
|
74
|
+
bot.lpBalance += netLpOut;
|
|
75
|
+
|
|
76
|
+
return true;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function removeLiqToYt(
|
|
80
|
+
BotState memory bot,
|
|
81
|
+
MarketExtState memory marketExt,
|
|
82
|
+
uint256 netLpToRemove,
|
|
83
|
+
ApproxParams memory approxParams
|
|
84
|
+
) internal pure returns (bool /*success*/) {
|
|
85
|
+
if (netLpToRemove > bot.lpBalance) return false;
|
|
86
|
+
|
|
87
|
+
uint256 netYtOut = marketExt.removeLiqToYt(netLpToRemove, approxParams);
|
|
88
|
+
|
|
89
|
+
bot.lpBalance -= netLpToRemove;
|
|
90
|
+
bot.ytBalance += netYtOut;
|
|
91
|
+
|
|
92
|
+
return true;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/// @dev Only for estimation, does not reflect exact SY amount that would be redeemed
|
|
96
|
+
function tvlInSy(
|
|
97
|
+
BotState memory bot,
|
|
98
|
+
MarketExtState memory marketExt
|
|
99
|
+
) internal pure returns (uint256) {
|
|
100
|
+
(uint256 syInLp, uint256 ptInLp) = marketExt.previewAssetsFromLp(bot.lpBalance);
|
|
101
|
+
uint256 totalValue = bot.syBalance + syInLp;
|
|
102
|
+
if (ptInLp <= bot.ytBalance) {
|
|
103
|
+
totalValue += marketExt.previewPyToSy(ptInLp);
|
|
104
|
+
totalValue += marketExt.clone().swapYtToSy(bot.ytBalance - ptInLp);
|
|
105
|
+
} else {
|
|
106
|
+
totalValue += marketExt.previewPyToSy(bot.ytBalance);
|
|
107
|
+
totalValue += marketExt.clone().swapPtToSy(ptInLp - bot.ytBalance);
|
|
108
|
+
}
|
|
109
|
+
return totalValue;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function clone(BotState memory bot) internal pure returns (BotState memory) {
|
|
113
|
+
return BotState(bot.lpBalance, bot.ytBalance, bot.syBalance);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
pragma solidity 0.8.17;
|
|
3
|
+
|
|
4
|
+
import "./TradingBotBase.sol";
|
|
5
|
+
import "./BotActionHelper.sol";
|
|
6
|
+
import "./BotDecisionLib.sol";
|
|
7
|
+
import "../../interfaces/TradingBot/ILongYieldTradingBot.sol";
|
|
8
|
+
import "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol";
|
|
9
|
+
|
|
10
|
+
contract LongYieldTradingBot is
|
|
11
|
+
TradingBotBase,
|
|
12
|
+
BotActionHelper,
|
|
13
|
+
ILongYieldTradingBot,
|
|
14
|
+
UUPSUpgradeable
|
|
15
|
+
{
|
|
16
|
+
LongTradingSpecs public specs;
|
|
17
|
+
address public immutable decisionLib;
|
|
18
|
+
|
|
19
|
+
constructor(
|
|
20
|
+
address _market,
|
|
21
|
+
address _PENDLE,
|
|
22
|
+
address _decisionLib
|
|
23
|
+
) TradingBotBase(_market, _PENDLE) {
|
|
24
|
+
decisionLib = _decisionLib;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function _authorizeUpgrade(address) internal override onlyOwner {}
|
|
28
|
+
|
|
29
|
+
function initialize(LongTradingSpecs memory _specs) external initializer {
|
|
30
|
+
_setSpecs(_specs);
|
|
31
|
+
__BoringOwnable_init();
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function setSpecs(LongTradingSpecs calldata _specs) external onlyOwner {
|
|
35
|
+
_setSpecs(_specs);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function _setSpecs(LongTradingSpecs memory _specs) internal {
|
|
39
|
+
specs = _specs;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function swapSyToYt(
|
|
43
|
+
address router,
|
|
44
|
+
StrategyState memory oldState,
|
|
45
|
+
ApproxParams calldata botParams,
|
|
46
|
+
uint256 minYtOut,
|
|
47
|
+
uint256 maxSyIn
|
|
48
|
+
) external onlyOwner returns (uint256 exactYtOut, uint256 netSyIn) {
|
|
49
|
+
exactYtOut = BotDecisionLib(decisionLib).binarySearchUntilSwitchState(
|
|
50
|
+
readBotState(),
|
|
51
|
+
readMarketExtState(router),
|
|
52
|
+
specs,
|
|
53
|
+
ActionType.SwapSyToYt,
|
|
54
|
+
oldState,
|
|
55
|
+
botParams,
|
|
56
|
+
botParams // only placeholder, value doesn't matter
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
if (exactYtOut < minYtOut) revert Errors.BotInsufficientYtOut(exactYtOut, minYtOut);
|
|
60
|
+
netSyIn = _swapSyToYt(router, exactYtOut, maxSyIn);
|
|
61
|
+
|
|
62
|
+
emit SwapSyToYt(oldState, botParams, maxSyIn, exactYtOut, netSyIn);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function addLiqKeepYt(
|
|
66
|
+
address router,
|
|
67
|
+
StrategyState memory oldState,
|
|
68
|
+
ApproxParams calldata botParams,
|
|
69
|
+
uint256 maxSyIn,
|
|
70
|
+
uint256 minLpOut,
|
|
71
|
+
uint256 minYtOut
|
|
72
|
+
) external onlyOwner returns (uint256 netSyIn, uint256 netLpOut, uint256 netYtOut) {
|
|
73
|
+
netSyIn = BotDecisionLib(decisionLib).binarySearchUntilSwitchState(
|
|
74
|
+
readBotState(),
|
|
75
|
+
readMarketExtState(router),
|
|
76
|
+
specs,
|
|
77
|
+
ActionType.AddLiqKeepYt,
|
|
78
|
+
oldState,
|
|
79
|
+
botParams,
|
|
80
|
+
botParams // only placeholder, value doesn't matter
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
if (netSyIn > maxSyIn) revert Errors.BotExceededLimitSyIn(netSyIn, maxSyIn);
|
|
84
|
+
(netLpOut, netYtOut) = _addLiqKeepYt(router, netSyIn, minLpOut, minYtOut);
|
|
85
|
+
|
|
86
|
+
emit AddLiqKeepYt(oldState, botParams, maxSyIn, netSyIn, netLpOut, netYtOut);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function addLiqFromSy(
|
|
90
|
+
StrategyState memory oldState,
|
|
91
|
+
ApproxParams calldata botParams,
|
|
92
|
+
uint256 minLpOut,
|
|
93
|
+
uint256 maxSyIn
|
|
94
|
+
) external onlyOwner returns (uint256 netPtFromSwap, uint256 netLpOut, uint256 netSyIn) {
|
|
95
|
+
netPtFromSwap = BotDecisionLib(decisionLib).binarySearchUntilSwitchState(
|
|
96
|
+
readBotState(),
|
|
97
|
+
readMarketExtState(address(this)),
|
|
98
|
+
specs,
|
|
99
|
+
ActionType.AddLiqFromSy,
|
|
100
|
+
oldState,
|
|
101
|
+
botParams,
|
|
102
|
+
botParams // only placeholder, value doesn't matter
|
|
103
|
+
);
|
|
104
|
+
|
|
105
|
+
(netLpOut, netSyIn) = _addLiqFromSy(netPtFromSwap, minLpOut, maxSyIn);
|
|
106
|
+
|
|
107
|
+
emit AddLiqFromSy(oldState, botParams, maxSyIn, netSyIn, netLpOut);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function addLiqFromYt(
|
|
111
|
+
StrategyState memory oldState,
|
|
112
|
+
ApproxParams calldata botParams,
|
|
113
|
+
uint256 minLpOut,
|
|
114
|
+
uint256 maxYtIn
|
|
115
|
+
) external onlyOwner returns (uint256 netPtFromSwap, uint256 netLpOut, uint256 netYtIn) {
|
|
116
|
+
netPtFromSwap = BotDecisionLib(decisionLib).binarySearchUntilSwitchState(
|
|
117
|
+
readBotState(),
|
|
118
|
+
readMarketExtState(address(this)),
|
|
119
|
+
specs,
|
|
120
|
+
ActionType.AddLiqFromYt,
|
|
121
|
+
oldState,
|
|
122
|
+
botParams,
|
|
123
|
+
botParams // only placeholder, value doesn't matter
|
|
124
|
+
);
|
|
125
|
+
(netLpOut, netYtIn) = _addLiqFromYt(netPtFromSwap, minLpOut, maxYtIn);
|
|
126
|
+
|
|
127
|
+
emit AddLiqFromYt(oldState, botParams, maxYtIn, netYtIn, netLpOut);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
function removeLiqToYt(
|
|
131
|
+
StrategyState memory oldState,
|
|
132
|
+
ApproxParams calldata botParams,
|
|
133
|
+
ApproxParams calldata guessTotalPtToSwap,
|
|
134
|
+
uint256 maxLpRemoved,
|
|
135
|
+
uint256 minYtOut
|
|
136
|
+
) external onlyOwner returns (uint256 netLpRemoved, uint256 netYtOut) {
|
|
137
|
+
netLpRemoved = BotDecisionLib(decisionLib).binarySearchUntilSwitchState(
|
|
138
|
+
readBotState(),
|
|
139
|
+
readMarketExtState(address(this)),
|
|
140
|
+
specs,
|
|
141
|
+
ActionType.RemoveLiqToYt,
|
|
142
|
+
oldState,
|
|
143
|
+
botParams,
|
|
144
|
+
guessTotalPtToSwap // value DOES matter
|
|
145
|
+
);
|
|
146
|
+
|
|
147
|
+
if (netLpRemoved > maxLpRemoved)
|
|
148
|
+
revert Errors.BotExceededLimitLpToRemove(netLpRemoved, maxLpRemoved);
|
|
149
|
+
|
|
150
|
+
netYtOut = _removeLiqToYt(netLpRemoved, guessTotalPtToSwap, minYtOut);
|
|
151
|
+
|
|
152
|
+
emit RemoveLiqToYt(oldState, botParams, maxLpRemoved, netLpRemoved, netYtOut);
|
|
153
|
+
}
|
|
154
|
+
}
|