@pendle/core-v2 2.17.7-tradingbot → 2.18.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/PendleMsgReceiverAppUpg.sol/PendleMsgReceiverAppUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/PendleMsgSendEndpointUpg.sol/PendleMsgSendEndpointUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/PendleMsgSenderAppUpg.sol/PendleMsgSenderAppUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/libraries/LayerZeroHelper.sol/LayerZeroHelper.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerBaseUpg.sol/PendleGaugeControllerBaseUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerMainchainUpg.sol/PendleGaugeControllerMainchainUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerSidechainUpg.sol/PendleGaugeControllerSidechainUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/VeDistributor/PendleFeeDistributor.sol/PendleFeeDistributor.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/VeDistributor/PendleFeeDistributorV2.sol/PendleFeeDistributorV2.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/VotingController/PendleVotingControllerUpg.sol/PendleVotingControllerUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/VotingController/VotingControllerStorageUpg.sol/VotingControllerStorageUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol/VotingEscrowPendleMainchain.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowPendleSidechain.sol/VotingEscrowPendleSidechain.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowTokenBase.sol/VotingEscrowTokenBase.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/libraries/VeBalanceLib.sol/VeBalanceLib.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/libraries/VeHistoryLib.sol/CheckpointHelper.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/libraries/VeHistoryLib.sol/Checkpoints.dbg.json +1 -1
- package/build/artifacts/contracts/core/BulkSeller/BulkSeller.sol/BulkSeller.dbg.json +1 -1
- package/build/artifacts/contracts/core/BulkSeller/BulkSellerFactory.sol/BulkSellerFactory.dbg.json +1 -1
- package/build/artifacts/contracts/core/BulkSeller/BulkSellerMathCore.sol/BulkSellerMathCore.dbg.json +1 -1
- package/build/artifacts/contracts/core/Market/MarketMathCore.sol/MarketMathCore.dbg.json +1 -1
- package/build/artifacts/contracts/core/Market/OracleLib.sol/OracleLib.dbg.json +1 -1
- package/build/artifacts/contracts/core/Market/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/PendleMarketFactory.sol/PendleMarketFactory.dbg.json +1 -1
- 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/BalancerStable/PendleAuraBbAWethSwethSY.sol/PendleAuraBbAWethSwethSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWethAnkrethSYV2.sol/PendleAuraWethAnkrethSYV2.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWethRocketEthSYV2.sol/PendleAuraWethRocketEthSYV2.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWethStafiEthSY.sol/PendleAuraWethStafiEthSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWethWstethSYV2.sol/PendleAuraWethWstethSYV2.dbg.json +1 -1
- 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/PendleQiTokenSY.sol/PendleQiTokenSY.dbg.json +1 -1
- 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/Convex/PendleCurveFraxUsdcSY.sol/PendleCurveFraxUsdcSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/PendleCurveUsdd3CrvSY.sol/PendleCurveUsdd3CrvSY.dbg.json +1 -1
- 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/PendleGdaiSY.sol/PendleGDaiSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleLooksStakingSY.sol/PendleLooksStakingSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleSfrxEthSY.sol/PendleSfrxEthSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleStargateLPSY.sol/PendleStargateLPSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleWstEthSY.sol/PendleWstEthSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/TradingBot/BotActionCallback.sol/BotActionCallback.dbg.json +1 -1
- package/build/artifacts/contracts/core/TradingBot/BotActionCallback.sol/BotActionCallback.json +32 -17
- package/build/artifacts/contracts/core/TradingBot/BotActionHelper.sol/BotActionHelper.dbg.json +1 -1
- package/build/artifacts/contracts/core/TradingBot/BotActionHelper.sol/BotActionHelper.json +32 -17
- package/build/artifacts/contracts/core/TradingBot/BotSimulationLib.sol/BotSimulationLib.dbg.json +1 -1
- package/build/artifacts/contracts/core/TradingBot/BotSimulationLib.sol/BotSimulationLib.json +2 -2
- package/build/artifacts/contracts/core/TradingBot/LongYieldDecisionHelper.sol/LongYieldDecisionHelper.dbg.json +4 -0
- package/build/artifacts/contracts/core/TradingBot/LongYieldDecisionHelper.sol/LongYieldDecisionHelper.json +1190 -0
- package/build/artifacts/contracts/core/TradingBot/LongYieldTradingBot.sol/LongYieldTradingBot.dbg.json +1 -1
- package/build/artifacts/contracts/core/TradingBot/LongYieldTradingBot.sol/LongYieldTradingBot.json +301 -397
- package/build/artifacts/contracts/core/TradingBot/MarketExtLib.sol/MarketExtLib.dbg.json +1 -1
- package/build/artifacts/contracts/core/TradingBot/SpecSegmentLib.sol/SpecSegmentLib.dbg.json +4 -0
- package/build/artifacts/contracts/core/TradingBot/SpecSegmentLib.sol/SpecSegmentLib.json +10 -0
- package/build/artifacts/contracts/core/TradingBot/TradingBotBase.sol/TradingBotBase.dbg.json +1 -1
- package/build/artifacts/contracts/core/TradingBot/TradingBotBase.sol/TradingBotBase.json +32 -17
- package/build/artifacts/contracts/core/YieldContracts/InterestManagerYT.sol/InterestManagerYT.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContracts/PendlePrincipalToken.sol/PendlePrincipalToken.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldContractFactory.sol/PendleYieldContractFactory.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldToken.sol/PendleYieldToken.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContractsV2/InterestManagerYTV2.sol/InterestManagerYTV2.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContractsV2/PendlePrincipalTokenV2.sol/PendlePrincipalTokenV2.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContractsV2/PendleYieldContractFactoryV2.sol/PendleYieldContractFactoryV2.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContractsV2/PendleYieldTokenV2.sol/PendleYieldTokenV2.dbg.json +1 -1
- package/build/artifacts/contracts/core/libraries/Errors.sol/Errors.dbg.json +1 -1
- package/build/artifacts/contracts/core/libraries/TokenAmountLib.sol/TokenAmountLib.dbg.json +1 -1
- 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 +1 -1
- package/build/artifacts/contracts/interfaces/TradingBot/IBotDecisionHelper.sol/IBotDecisionHelper.json +542 -581
- package/build/artifacts/contracts/interfaces/TradingBot/ILongYieldTradingBot.sol/ILongYieldTradingBot.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/TradingBot/ILongYieldTradingBot.sol/ILongYieldTradingBot.json +256 -325
- package/build/artifacts/contracts/interfaces/TradingBot/ITradingBotBase.sol/ITradingBotBase.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/TradingBot/ITradingBotBase.sol/ITradingBotBase.json +6 -17
- package/build/artifacts/contracts/offchain-helpers/BoringLpSeller.sol/BoringLpSeller.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/BoringPtSeller.sol/BoringPtSeller.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/Broadcaster.sol/Broadcaster.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/BulkSellerOffchain.sol/BulkSellerOffchain.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/MarketExchangeRateLib.sol/MarketExchangeRateLib.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/router-static/PendleRouterStatic.sol/PendleRouterStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionInfoStatic.sol/ActionInfoStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionMarketAuxStatic.sol/ActionMarketAuxStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionMarketCoreStatic.sol/ActionMarketCoreStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionMintRedeemStatic.sol/ActionMintRedeemStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionStorageStatic.sol/ActionStorageStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionVePendleStatic.sol/ActionVePendleStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/router-static/base/StorageLayout.sol/StorageLayout.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/PendleLpOracleLib.sol/PendleLpOracleLib.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/PendlePtOracle.sol/PendlePtOracle.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/PendlePtOracleLib.sol/PendlePtOracleLib.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/samples/PendleLpGlpOracle.sol/PendleLpGlpOracle.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/samples/PendlePtGlpOracle.sol/PendlePtGlpOracle.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/samples/PendlePtUsdChainlinkOracle.sol/PendlePtUsdChainlinkOracle.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionAddRemoveLiq.sol/ActionAddRemoveLiq.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionMintRedeem.sol/ActionMintRedeem.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionSwapPT.sol/ActionSwapPT.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionSwapYT.sol/ActionSwapYT.dbg.json +1 -1
- package/build/artifacts/contracts/router/PendleRouter.sol/PendleRouter.dbg.json +1 -1
- package/build/artifacts/contracts/router/PendleRouterHelper.sol/PendleRouterHelper.dbg.json +1 -1
- package/build/artifacts/contracts/router/base/ActionBaseCallback.sol/ActionBaseCallback.dbg.json +1 -1
- package/build/artifacts/contracts/router/base/ActionBaseMintRedeem.sol/ActionBaseMintRedeem.dbg.json +1 -1
- package/build/artifacts/contracts/router/base/CallbackHelper.sol/CallbackHelper.dbg.json +1 -1
- package/build/artifacts/contracts/router/base/MarketApproxLib.sol/MarketApproxPtInLib.dbg.json +1 -1
- package/build/artifacts/contracts/router/base/MarketApproxLib.sol/MarketApproxPtOutLib.dbg.json +1 -1
- package/build/artifacts/contracts/router/swap-aggregator/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 +1 -1
- package/contracts/core/TradingBot/BotActionHelper.sol +1 -3
- package/contracts/core/TradingBot/BotSimulationLib.sol +2 -1
- package/contracts/core/TradingBot/LongYieldDecisionHelper.sol +413 -0
- package/contracts/core/TradingBot/LongYieldTradingBot.sol +63 -91
- package/contracts/core/TradingBot/SpecSegmentLib.sol +62 -0
- package/contracts/core/TradingBot/TradingBotBase.sol +14 -9
- package/contracts/interfaces/TradingBot/IBotDecisionHelper.sol +41 -57
- package/contracts/interfaces/TradingBot/ILongYieldTradingBot.sol +24 -34
- package/contracts/interfaces/TradingBot/ITradingBotBase.sol +1 -3
- package/package.json +1 -1
- package/typechain-types/BotActionCallback.ts +40 -22
- package/typechain-types/BotActionHelper.ts +40 -22
- package/typechain-types/BotDecisionHelper.ts +221 -187
- package/typechain-types/IAnkrBNB.ts +150 -0
- package/typechain-types/IAnkrLiquidStaking.ts +253 -0
- package/typechain-types/IBotDecisionHelper.ts +142 -212
- package/typechain-types/ILongYieldTradingBot.ts +147 -230
- package/typechain-types/ISwETH.ts +123 -0
- package/typechain-types/ITradingBotBase.ts +14 -22
- package/typechain-types/LongYieldDecisionHelper.ts +598 -0
- package/typechain-types/LongYieldTradingBot.ts +191 -248
- package/typechain-types/PendleAnkrBNBSY.ts +1235 -0
- package/typechain-types/PendleAuraWstethAnkreth.ts +1511 -0
- package/typechain-types/PendleSwETH.ts +1216 -0
- package/typechain-types/PendleThenaSY.ts +153 -0
- package/typechain-types/PendleWbEthSY.ts +1229 -0
- package/typechain-types/ThenaLpHelper.ts +19 -0
- package/typechain-types/ThenaMath.ts +87 -0
- package/typechain-types/ThenaPreview.ts +19 -0
- package/typechain-types/TradingBotBase.ts +40 -22
- package/typechain-types/factories/BotActionCallback__factory.ts +31 -16
- package/typechain-types/factories/BotActionHelper__factory.ts +31 -16
- package/typechain-types/factories/BotDecisionHelper__factory.ts +490 -421
- 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 +540 -579
- package/typechain-types/factories/ILongYieldTradingBot__factory.ts +255 -324
- package/typechain-types/factories/ISwETH__factory.ts +53 -0
- package/typechain-types/factories/ITradingBotBase__factory.ts +6 -17
- package/typechain-types/factories/LongYieldDecisionHelper__factory.ts +1247 -0
- package/typechain-types/factories/LongYieldTradingBot__factory.ts +301 -393
- package/typechain-types/factories/PendleAnkrBNBSY__factory.ts +1100 -0
- package/typechain-types/factories/PendleAuraWstethAnkreth__factory.ts +1244 -0
- package/typechain-types/factories/PendleSwETH__factory.ts +1022 -0
- package/typechain-types/factories/PendleThenaSY__factory.ts +85 -1
- package/typechain-types/factories/PendleWbEthSY__factory.ts +1049 -0
- package/typechain-types/factories/PtAndLpToAsset__factory.ts +1 -1
- package/typechain-types/factories/ThenaLpHelper__factory.ts +13 -0
- package/typechain-types/factories/ThenaMath__factory.ts +36 -0
- package/typechain-types/factories/ThenaPreview__factory.ts +14 -1
- package/typechain-types/factories/TradingBotBase__factory.ts +31 -16
- package/typechain-types/hardhat.d.ts +4 -40
- package/typechain-types/index.ts +2 -10
- package/build/artifacts/contracts/core/TradingBot/BotDecisionHelper.sol/BotDecisionHelper.dbg.json +0 -4
- package/build/artifacts/contracts/core/TradingBot/BotDecisionHelper.sol/BotDecisionHelper.json +0 -1070
- package/contracts/core/TradingBot/BotDecisionHelper.sol +0 -306
|
@@ -1,306 +0,0 @@
|
|
|
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
|
-
import "../../interfaces/TradingBot/IBotDecisionHelper.sol";
|
|
7
|
-
|
|
8
|
-
contract BotDecisionHelper is IBotDecisionHelper {
|
|
9
|
-
using MarketExtLib for MarketExtState;
|
|
10
|
-
using MarketExtLib for ApproxParams;
|
|
11
|
-
using MarketMathCore for MarketState;
|
|
12
|
-
using MarketApproxPtInLib for MarketState;
|
|
13
|
-
using BotSimulationLib for BotState;
|
|
14
|
-
using PYIndexLib for PYIndex;
|
|
15
|
-
using Math for uint256;
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Binary search for the smallest parameter `botParam` for the corresponding rebalancing action
|
|
19
|
-
* such that the bot reaches desired target, otherwise give the largest `botParam` possible
|
|
20
|
-
* that action doesn't revert.
|
|
21
|
-
*
|
|
22
|
-
* @param action Action to take, from which target is derived
|
|
23
|
-
* @param botParams ApproxParams for `botParam`
|
|
24
|
-
* @param intParams ApproxParams for internal action's approximation (e.g. for router's swap)
|
|
25
|
-
*
|
|
26
|
-
* For `botParams`, eps = the precision such that slightly lower
|
|
27
|
-
* (param = (return value) * (1 - eps)) does not reach target
|
|
28
|
-
*
|
|
29
|
-
* - Returns `botParams.guessOffchain` if it reaches target, and slightly lower does not
|
|
30
|
-
* - Reverts if `botParams.guessMin` is invalid, or returns `botParams.guessMin` if reaches
|
|
31
|
-
* target
|
|
32
|
-
* - Returns `botParams.guessMax` if it is valid & does not reach target
|
|
33
|
-
* - Otherwise, binary search for `guess` such that it reaches target, and slightly lower does
|
|
34
|
-
* not
|
|
35
|
-
*
|
|
36
|
-
*/
|
|
37
|
-
function searchForBotParam(
|
|
38
|
-
BotState memory bot,
|
|
39
|
-
MarketExtState memory marketExt,
|
|
40
|
-
LongTradingSpecs memory specs,
|
|
41
|
-
ActionType action,
|
|
42
|
-
ApproxParams memory botParams,
|
|
43
|
-
ApproxParams memory intParams
|
|
44
|
-
) public pure returns (uint256, RebalanceResult) {
|
|
45
|
-
RebalanceDetails memory rebalance = RebalanceDetails(bot, marketExt, specs, action);
|
|
46
|
-
|
|
47
|
-
if (botParams.guessOffchain != 0) {
|
|
48
|
-
uint256 guessOffchainMinusDelta = botParams.guessOffchain.mulDown(
|
|
49
|
-
Math.ONE - botParams.eps
|
|
50
|
-
);
|
|
51
|
-
if (
|
|
52
|
-
_rebalanceResult(rebalance, botParams.guessOffchain, intParams) ==
|
|
53
|
-
RebalanceResult.TARGET_REACHED &&
|
|
54
|
-
_rebalanceResult(rebalance, guessOffchainMinusDelta, intParams) ==
|
|
55
|
-
RebalanceResult.TARGET_NOT_REACHED
|
|
56
|
-
) return (botParams.guessOffchain, RebalanceResult.TARGET_REACHED);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
{
|
|
60
|
-
uint256 guessUpperBound = _weakUpperBound(bot, marketExt, action);
|
|
61
|
-
if (botParams.guessMax > guessUpperBound) botParams.guessMax = guessUpperBound;
|
|
62
|
-
if (botParams.guessMin > botParams.guessMax)
|
|
63
|
-
revert Errors.BotBinarySearchInvalidRange(
|
|
64
|
-
uint256(action),
|
|
65
|
-
botParams.guessMin,
|
|
66
|
-
botParams.guessMax
|
|
67
|
-
);
|
|
68
|
-
|
|
69
|
-
if (
|
|
70
|
-
_rebalanceResult(rebalance, botParams.guessMax, intParams) ==
|
|
71
|
-
RebalanceResult.TARGET_NOT_REACHED
|
|
72
|
-
) return (botParams.guessMax, RebalanceResult.TARGET_NOT_REACHED);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
{
|
|
76
|
-
RebalanceResult guessMinResult = _rebalanceResult(
|
|
77
|
-
rebalance,
|
|
78
|
-
botParams.guessMin,
|
|
79
|
-
intParams
|
|
80
|
-
);
|
|
81
|
-
if (guessMinResult == RebalanceResult.FAIL)
|
|
82
|
-
revert Errors.BotBinarySearchGuessMinInvalid(uint256(action), botParams.guessMin);
|
|
83
|
-
if (guessMinResult == RebalanceResult.TARGET_REACHED)
|
|
84
|
-
return (botParams.guessMin, RebalanceResult.TARGET_REACHED);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
for (uint256 iter = 0; iter < botParams.maxIteration; ++iter) {
|
|
88
|
-
uint256 guess = botParams.guessMin + (botParams.guessMax - botParams.guessMin) / 2;
|
|
89
|
-
|
|
90
|
-
if (
|
|
91
|
-
_rebalanceResult(rebalance, guess, intParams) == RebalanceResult.TARGET_NOT_REACHED
|
|
92
|
-
) {
|
|
93
|
-
botParams.guessMin = guess;
|
|
94
|
-
} else {
|
|
95
|
-
botParams.guessMax = guess;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
if (Math.isASmallerApproxB(botParams.guessMin, botParams.guessMax, botParams.eps)) {
|
|
99
|
-
if (
|
|
100
|
-
_rebalanceResult(rebalance, botParams.guessMin, intParams) ==
|
|
101
|
-
RebalanceResult.FAIL
|
|
102
|
-
)
|
|
103
|
-
return (
|
|
104
|
-
botParams.guessMin,
|
|
105
|
-
_rebalanceResult(rebalance, botParams.guessMin, intParams)
|
|
106
|
-
);
|
|
107
|
-
|
|
108
|
-
return (
|
|
109
|
-
botParams.guessMax,
|
|
110
|
-
_rebalanceResult(rebalance, botParams.guessMax, intParams)
|
|
111
|
-
);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
revert Errors.BotBinarySearchFail();
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* Given the rebalancing action and its `botParam`, binary search for the optimal internal
|
|
120
|
-
* parameter `intParam` for the internal action's approximation (e.g. for router's swap)
|
|
121
|
-
*/
|
|
122
|
-
function searchForIntParam(
|
|
123
|
-
MarketExtState memory marketExt,
|
|
124
|
-
ActionType action,
|
|
125
|
-
uint256 botParam,
|
|
126
|
-
ApproxParams memory intParams
|
|
127
|
-
) public pure returns (uint256) {
|
|
128
|
-
if (action == ActionType.RemoveLiqToYt) {
|
|
129
|
-
(, uint256 totalPtToSwap) = marketExt.clone().removeLiqToYt(botParam, intParams);
|
|
130
|
-
return totalPtToSwap;
|
|
131
|
-
} else {
|
|
132
|
-
return 0;
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
function strategyState(
|
|
137
|
-
BotState memory bot,
|
|
138
|
-
MarketExtState memory marketExt,
|
|
139
|
-
LongTradingSpecs memory specs
|
|
140
|
-
) public pure returns (StrategyState memory currentState) {
|
|
141
|
-
(, uint256 iy, uint256 currentSyRatio, uint256 currentYtPtRatio) = botExtStats(
|
|
142
|
-
bot,
|
|
143
|
-
marketExt
|
|
144
|
-
);
|
|
145
|
-
|
|
146
|
-
if (iy < specs.lowerIyLimit) {
|
|
147
|
-
currentState.iyFlag = StrategyFlag.TOO_LOW;
|
|
148
|
-
} else if (specs.upperIyLimit < iy && currentYtPtRatio > specs.ytPtRatioLimit) {
|
|
149
|
-
currentState.iyFlag = StrategyFlag.TOO_HIGH;
|
|
150
|
-
} else {
|
|
151
|
-
currentState.iyFlag = StrategyFlag.GOOD;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
if (currentSyRatio > specs.floatingSyRatioLimit) {
|
|
155
|
-
currentState.syRatioFlag = StrategyFlag.TOO_HIGH;
|
|
156
|
-
} else {
|
|
157
|
-
currentState.syRatioFlag = StrategyFlag.GOOD;
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
function actionToTake(
|
|
162
|
-
BotState memory botState,
|
|
163
|
-
StrategyState memory currentState
|
|
164
|
-
) public pure returns (ActionType) {
|
|
165
|
-
if (currentState.iyFlag == StrategyFlag.TOO_LOW) {
|
|
166
|
-
if (currentState.syRatioFlag == StrategyFlag.TOO_HIGH) {
|
|
167
|
-
if (botState.syBalance == 0) return ActionType.NONE;
|
|
168
|
-
return ActionType.SwapSyToYt;
|
|
169
|
-
} else {
|
|
170
|
-
if (botState.lpBalance == 0) return ActionType.NONE;
|
|
171
|
-
return ActionType.RemoveLiqToYt;
|
|
172
|
-
}
|
|
173
|
-
} else if (currentState.iyFlag == StrategyFlag.GOOD) {
|
|
174
|
-
if (currentState.syRatioFlag == StrategyFlag.TOO_HIGH) {
|
|
175
|
-
if (botState.syBalance == 0) return ActionType.NONE;
|
|
176
|
-
return ActionType.AddLiqKeepYt;
|
|
177
|
-
} else {
|
|
178
|
-
return ActionType.NONE;
|
|
179
|
-
}
|
|
180
|
-
} else {
|
|
181
|
-
if (currentState.syRatioFlag == StrategyFlag.TOO_HIGH) {
|
|
182
|
-
if (botState.syBalance == 0) return ActionType.NONE;
|
|
183
|
-
return ActionType.AddLiqFromSy;
|
|
184
|
-
} else {
|
|
185
|
-
if (botState.ytBalance == 0) return ActionType.NONE;
|
|
186
|
-
return ActionType.AddLiqFromYt;
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
/// @dev Does not modify params, structs are cloned before simulation
|
|
192
|
-
function previewAction(
|
|
193
|
-
BotState memory botData,
|
|
194
|
-
MarketExtState memory marketExtData,
|
|
195
|
-
ActionType action,
|
|
196
|
-
uint256 botParam,
|
|
197
|
-
ApproxParams memory swapApproxParams
|
|
198
|
-
) public pure returns (bool success, BotState memory bot, MarketExtState memory marketExt) {
|
|
199
|
-
bot = botData.clone();
|
|
200
|
-
marketExt = marketExtData.clone();
|
|
201
|
-
|
|
202
|
-
if (action == ActionType.SwapSyToYt) {
|
|
203
|
-
success = bot.swapSyToYt(marketExt, botParam);
|
|
204
|
-
} else if (action == ActionType.AddLiqKeepYt) {
|
|
205
|
-
success = bot.addLiqKeepYt(marketExt, botParam);
|
|
206
|
-
} else if (action == ActionType.AddLiqFromSy) {
|
|
207
|
-
success = bot.addLiqFromSy(marketExt, botParam);
|
|
208
|
-
} else if (action == ActionType.AddLiqFromYt) {
|
|
209
|
-
success = bot.addLiqFromYt(marketExt, botParam);
|
|
210
|
-
} else if (action == ActionType.RemoveLiqToYt) {
|
|
211
|
-
success = bot.removeLiqToYt(marketExt, botParam, swapApproxParams);
|
|
212
|
-
} else {
|
|
213
|
-
success = false;
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
function botExtStats(
|
|
218
|
-
BotState memory bot,
|
|
219
|
-
MarketExtState memory marketExt
|
|
220
|
-
)
|
|
221
|
-
public
|
|
222
|
-
pure
|
|
223
|
-
returns (uint256 tvlInSy, uint256 iy, uint256 currentSyRatio, uint256 currentYtPtRatio)
|
|
224
|
-
{
|
|
225
|
-
tvlInSy = bot.tvlInSy(marketExt);
|
|
226
|
-
|
|
227
|
-
iy = marketExt.impliedYield();
|
|
228
|
-
|
|
229
|
-
currentSyRatio = bot.syBalance.divDown(tvlInSy);
|
|
230
|
-
|
|
231
|
-
(, uint256 ptInLp) = marketExt.clone().removeLiqDual(bot.lpBalance);
|
|
232
|
-
currentYtPtRatio = (ptInLp == 0 ? type(uint256).max : bot.ytBalance.divDown(ptInLp));
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
/// @dev Gives a weak upper bound so that MarketExtLib's simulation doesn't revert
|
|
236
|
-
function _weakUpperBound(
|
|
237
|
-
BotState memory bot,
|
|
238
|
-
MarketExtState memory marketExt,
|
|
239
|
-
ActionType action
|
|
240
|
-
) private pure returns (uint256) {
|
|
241
|
-
if (action == ActionType.SwapSyToYt) {
|
|
242
|
-
return marketExt.calcMaxPtIn();
|
|
243
|
-
} else if (action == ActionType.AddLiqKeepYt) {
|
|
244
|
-
return bot.syBalance;
|
|
245
|
-
} else if (action == ActionType.AddLiqFromSy) {
|
|
246
|
-
return marketExt.calcMaxPtOut();
|
|
247
|
-
} else if (action == ActionType.AddLiqFromYt) {
|
|
248
|
-
return marketExt.calcMaxPtOut();
|
|
249
|
-
} else if (action == ActionType.RemoveLiqToYt) {
|
|
250
|
-
return bot.lpBalance;
|
|
251
|
-
} else {
|
|
252
|
-
return 0;
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
function _rebalanceResult(
|
|
257
|
-
RebalanceDetails memory rebalance,
|
|
258
|
-
uint256 botParam,
|
|
259
|
-
ApproxParams memory intParams
|
|
260
|
-
) private pure returns (RebalanceResult) {
|
|
261
|
-
(bool success, BotState memory bot, MarketExtState memory marketExt) = previewAction(
|
|
262
|
-
rebalance.bot,
|
|
263
|
-
rebalance.marketExt,
|
|
264
|
-
rebalance.action,
|
|
265
|
-
botParam,
|
|
266
|
-
intParams
|
|
267
|
-
);
|
|
268
|
-
|
|
269
|
-
if (!success) return RebalanceResult.FAIL;
|
|
270
|
-
if (_reachedTarget(bot, marketExt, rebalance.specs, rebalance.action)) {
|
|
271
|
-
return RebalanceResult.TARGET_REACHED;
|
|
272
|
-
}
|
|
273
|
-
return RebalanceResult.TARGET_NOT_REACHED;
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
function _reachedTarget(
|
|
277
|
-
BotState memory bot,
|
|
278
|
-
MarketExtState memory marketExt,
|
|
279
|
-
LongTradingSpecs memory specs,
|
|
280
|
-
ActionType action
|
|
281
|
-
) private pure returns (bool) {
|
|
282
|
-
uint256 targetIy = (specs.lowerIyLimit + specs.upperIyLimit) / 2;
|
|
283
|
-
|
|
284
|
-
(, uint256 iy, uint256 currentSyRatio, uint256 currentYtPtRatio) = botExtStats(
|
|
285
|
-
bot,
|
|
286
|
-
marketExt
|
|
287
|
-
);
|
|
288
|
-
|
|
289
|
-
if (action == ActionType.SwapSyToYt) {
|
|
290
|
-
return iy >= targetIy || currentSyRatio <= specs.floatingSyRatioTarget;
|
|
291
|
-
} else if (action == ActionType.AddLiqKeepYt) {
|
|
292
|
-
return currentSyRatio <= specs.floatingSyRatioTarget;
|
|
293
|
-
} else if (action == ActionType.AddLiqFromSy) {
|
|
294
|
-
return
|
|
295
|
-
iy <= targetIy ||
|
|
296
|
-
currentSyRatio <= specs.floatingSyRatioTarget ||
|
|
297
|
-
currentYtPtRatio <= specs.ytPtRatioTarget;
|
|
298
|
-
} else if (action == ActionType.AddLiqFromYt) {
|
|
299
|
-
return iy <= targetIy || currentYtPtRatio <= specs.ytPtRatioTarget;
|
|
300
|
-
} else if (action == ActionType.RemoveLiqToYt) {
|
|
301
|
-
return iy >= targetIy;
|
|
302
|
-
} else {
|
|
303
|
-
return true;
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
}
|