@pendle/core-v2 2.18.0 → 2.19.0-tradingbot
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/PendleMsgReceiveEndpointUpg.sol/PendleMsgReceiveEndpointUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/PendleMsgReceiveEndpointUpg.sol/PendleMsgReceiveEndpointUpg.json +2 -2
- package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/PendleMsgReceiverAppUpg.sol/PendleMsgReceiverAppUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/PendleMsgSendEndpointUpg.sol/PendleMsgSendEndpointUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/PendleMsgSendEndpointUpg.sol/PendleMsgSendEndpointUpg.json +2 -2
- package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/PendleMsgSenderAppUpg.sol/PendleMsgSenderAppUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/libraries/LayerZeroHelper.sol/LayerZeroHelper.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerBaseUpg.sol/PendleGaugeControllerBaseUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerMainchainUpg.sol/PendleGaugeControllerMainchainUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerMainchainUpg.sol/PendleGaugeControllerMainchainUpg.json +2 -2
- package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerSidechainUpg.sol/PendleGaugeControllerSidechainUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerSidechainUpg.sol/PendleGaugeControllerSidechainUpg.json +2 -2
- package/build/artifacts/contracts/LiquidityMining/VeDistributor/PendleFeeDistributor.sol/PendleFeeDistributor.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/VeDistributor/PendleFeeDistributor.sol/PendleFeeDistributor.json +2 -2
- package/build/artifacts/contracts/LiquidityMining/VeDistributor/PendleFeeDistributorV2.sol/PendleFeeDistributorV2.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/VeDistributor/PendleFeeDistributorV2.sol/PendleFeeDistributorV2.json +2 -2
- package/build/artifacts/contracts/LiquidityMining/VotingController/PendleVotingControllerUpg.sol/PendleVotingControllerUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/VotingController/PendleVotingControllerUpg.sol/PendleVotingControllerUpg.json +2 -2
- package/build/artifacts/contracts/LiquidityMining/VotingController/VotingControllerStorageUpg.sol/VotingControllerStorageUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol/VotingEscrowPendleMainchain.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol/VotingEscrowPendleMainchain.json +2 -2
- package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowPendleSidechain.sol/VotingEscrowPendleSidechain.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowPendleSidechain.sol/VotingEscrowPendleSidechain.json +2 -2
- package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowTokenBase.sol/VotingEscrowTokenBase.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/libraries/VeBalanceLib.sol/VeBalanceLib.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/libraries/VeBalanceLib.sol/VeBalanceLib.json +2 -2
- package/build/artifacts/contracts/LiquidityMining/libraries/VeHistoryLib.sol/CheckpointHelper.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/libraries/VeHistoryLib.sol/CheckpointHelper.json +2 -2
- package/build/artifacts/contracts/LiquidityMining/libraries/VeHistoryLib.sol/Checkpoints.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/libraries/VeHistoryLib.sol/Checkpoints.json +2 -2
- package/build/artifacts/contracts/core/BulkSeller/BulkSeller.sol/BulkSeller.dbg.json +1 -1
- package/build/artifacts/contracts/core/BulkSeller/BulkSeller.sol/BulkSeller.json +2 -2
- package/build/artifacts/contracts/core/BulkSeller/BulkSellerFactory.sol/BulkSellerFactory.dbg.json +1 -1
- package/build/artifacts/contracts/core/BulkSeller/BulkSellerFactory.sol/BulkSellerFactory.json +2 -2
- package/build/artifacts/contracts/core/BulkSeller/BulkSellerMathCore.sol/BulkSellerMathCore.dbg.json +1 -1
- package/build/artifacts/contracts/core/BulkSeller/BulkSellerMathCore.sol/BulkSellerMathCore.json +2 -2
- package/build/artifacts/contracts/core/Market/MarketMathCore.sol/MarketMathCore.dbg.json +1 -1
- package/build/artifacts/contracts/core/Market/MarketMathCore.sol/MarketMathCore.json +2 -2
- package/build/artifacts/contracts/core/Market/OracleLib.sol/OracleLib.dbg.json +1 -1
- package/build/artifacts/contracts/core/Market/OracleLib.sol/OracleLib.json +2 -2
- package/build/artifacts/contracts/core/Market/PendleGauge.sol/PendleGauge.dbg.json +1 -1
- package/build/artifacts/contracts/core/Market/PendleMarket.sol/PendleMarket.dbg.json +1 -1
- package/build/artifacts/contracts/core/Market/PendleMarket.sol/PendleMarket.json +2 -2
- package/build/artifacts/contracts/core/Market/PendleMarketFactory.sol/PendleMarketFactory.dbg.json +1 -1
- package/build/artifacts/contracts/core/Market/PendleMarketFactory.sol/PendleMarketFactory.json +2 -2
- package/build/artifacts/contracts/core/RewardManager/RewardManager.sol/RewardManager.dbg.json +1 -1
- package/build/artifacts/contracts/core/RewardManager/RewardManagerAbstract.sol/RewardManagerAbstract.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/PYIndex.sol/PYIndexLib.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/SYBase.sol/SYBase.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/SYBaseWithRewards.sol/SYBaseWithRewards.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Ape/sAPE.sol/sAPE.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Ape/sAPE.sol/sAPE.json +2 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraBbAWethSwethSY.sol/PendleAuraBbAWethSwethSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraBbAWethSwethSY.sol/PendleAuraBbAWethSwethSY.json +2 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWethAnkrethSYV2.sol/PendleAuraWethAnkrethSYV2.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWethAnkrethSYV2.sol/PendleAuraWethAnkrethSYV2.json +2 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWethRocketEthSYV2.sol/PendleAuraWethRocketEthSYV2.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWethRocketEthSYV2.sol/PendleAuraWethRocketEthSYV2.json +2 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWethStafiEthSY.sol/PendleAuraWethStafiEthSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWethStafiEthSY.sol/PendleAuraWethStafiEthSY.json +2 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWethWstethSYV2.sol/PendleAuraWethWstethSYV2.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWethWstethSYV2.sol/PendleAuraWethWstethSYV2.json +2 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/ComposableStable/ComposableStableMath.sol/ComposableStableMath.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/ComposableStable/ComposableStablePreview.sol/ComposableStablePreview.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/Linear/BbAPoolHelper.sol/BbAPoolHelper.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/Linear/BbAPoolHelper.sol/BbAWethHelper.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/Linear/LinearMath.sol/LinearMath.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/Linear/LinearPreview.sol/LinearPreview.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/MetaStable/MetaStablePreview.sol/MetaStablePreview.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/PendleAuraBalancerStableLPSYV2.sol/PendleAuraBalancerStableLPSYV2.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/StablePreviewBase.sol/StablePreviewBase.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BenQi/PendleQiTokenHelper.sol/PendleQiTokenHelper.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BenQi/PendleQiTokenHelper.sol/PendleQiTokenHelper.json +2 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BenQi/PendleQiTokenSY.sol/PendleQiTokenSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BenQi/PendleQiTokenSY.sol/PendleQiTokenSY.json +2 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/CamelotV1Volatile/CamelotRewardHelper.sol/CamelotRewardHelper.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/CamelotV1Volatile/CamelotV1VolatileCommon.sol/CamelotV1VolatileCommon.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/CamelotV1Volatile/CamelotV1VolatileLpHelper.sol/CamelotV1VolatileLpHelper.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/CamelotV1Volatile/CamelotV1VolatilePreview.sol/CamelotV1VolatilePreview.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/CamelotV1Volatile/PendleCamelotV1VolatileSY.sol/PendleCamelotV1VolatileSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/CamelotV1Volatile/PendleCamelotV1VolatileSY.sol/PendleCamelotV1VolatileSY.json +2 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/PendleCurveFraxUsdcSY.sol/PendleCurveFraxUsdcSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/PendleCurveFraxUsdcSY.sol/PendleCurveFraxUsdcSY.json +2 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/PendleCurveUsdd3CrvSY.sol/PendleCurveUsdd3CrvSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/PendleCurveUsdd3CrvSY.sol/PendleCurveUsdd3CrvSY.json +2 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/Curve3CrvPoolHelper.sol/Curve3CrvPoolHelper.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/CurveFraxUsdcPoolHelper.sol/CurveFraxUsdcPoolHelper.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/CurveUsdd3CrvPoolHelper.sol/CurveUsdd3CrvPoolHelper.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/PendleConvexLPSY.sol/PendleConvexLPSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/GLP/PendleGlpSY.sol/PendleGlpSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/GLP/PendleGlpSY.sol/PendleGlpSY.json +2 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleGdaiSY.sol/PendleGDaiSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleGdaiSY.sol/PendleGDaiSY.json +2 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleLooksStakingSY.sol/PendleLooksStakingSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleLooksStakingSY.sol/PendleLooksStakingSY.json +2 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleSfrxEthSY.sol/PendleSfrxEthSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleSfrxEthSY.sol/PendleSfrxEthSY.json +2 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleStargateLPSY.sol/PendleStargateLPSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleStargateLPSY.sol/PendleStargateLPSY.json +2 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleWstEthSY.sol/PendleWstEthSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleWstEthSY.sol/PendleWstEthSY.json +2 -2
- package/build/artifacts/contracts/core/TradingBot/LongYield/LongYieldDecisionHelper.sol/LongYieldDecisionHelper.dbg.json +4 -0
- package/build/artifacts/contracts/core/TradingBot/LongYield/LongYieldDecisionHelper.sol/LongYieldDecisionHelper.json +1215 -0
- package/build/artifacts/contracts/core/TradingBot/LongYield/LongYieldTradingBot.sol/LongYieldTradingBot.dbg.json +4 -0
- package/build/artifacts/contracts/core/TradingBot/LongYield/LongYieldTradingBot.sol/LongYieldTradingBot.json +1681 -0
- package/build/artifacts/contracts/core/TradingBot/ShortYield/ShortYieldDecisionHelper.sol/ShortYieldDecisionHelper.dbg.json +4 -0
- package/build/artifacts/contracts/core/TradingBot/ShortYield/ShortYieldDecisionHelper.sol/ShortYieldDecisionHelper.json +1215 -0
- package/build/artifacts/contracts/core/TradingBot/ShortYield/ShortYieldTradingBot.sol/ShortYieldTradingBot.dbg.json +4 -0
- package/build/artifacts/contracts/core/TradingBot/ShortYield/ShortYieldTradingBot.sol/ShortYieldTradingBot.json +1535 -0
- package/build/artifacts/contracts/core/TradingBot/base/BotActionCallback.sol/BotActionCallback.dbg.json +4 -0
- package/build/artifacts/contracts/core/TradingBot/base/BotActionCallback.sol/BotActionCallback.json +932 -0
- package/build/artifacts/contracts/core/TradingBot/base/BotActionHelper.sol/BotActionHelper.dbg.json +4 -0
- package/build/artifacts/contracts/core/TradingBot/base/BotActionHelper.sol/BotActionHelper.json +932 -0
- package/build/artifacts/contracts/core/TradingBot/base/BotDecisionHelperBase.sol/BotDecisionHelperBase.dbg.json +4 -0
- package/build/artifacts/contracts/core/TradingBot/base/BotDecisionHelperBase.sol/BotDecisionHelperBase.json +789 -0
- package/build/artifacts/contracts/core/TradingBot/base/TradingBotBase.sol/TradingBotBase.dbg.json +4 -0
- package/build/artifacts/contracts/core/TradingBot/base/TradingBotBase.sol/TradingBotBase.json +882 -0
- package/build/artifacts/contracts/core/TradingBot/libraries/BotSimulationLib.sol/BotSimulationLib.dbg.json +4 -0
- package/build/artifacts/contracts/core/TradingBot/libraries/BotSimulationLib.sol/BotSimulationLib.json +10 -0
- package/build/artifacts/contracts/core/TradingBot/libraries/MarketExtLib.sol/MarketExtLib.dbg.json +4 -0
- package/build/artifacts/contracts/core/TradingBot/libraries/MarketExtLib.sol/MarketExtLib.json +24 -0
- package/build/artifacts/contracts/core/TradingBot/libraries/SpecSegmentLib.sol/SpecSegmentLib.dbg.json +4 -0
- package/build/artifacts/contracts/core/TradingBot/libraries/SpecSegmentLib.sol/SpecSegmentLib.json +10 -0
- package/build/artifacts/contracts/core/YieldContracts/InterestManagerYT.sol/InterestManagerYT.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContracts/PendlePrincipalToken.sol/PendlePrincipalToken.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContracts/PendlePrincipalToken.sol/PendlePrincipalToken.json +2 -2
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldContractFactory.sol/PendleYieldContractFactory.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldContractFactory.sol/PendleYieldContractFactory.json +2 -2
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldToken.sol/PendleYieldToken.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldToken.sol/PendleYieldToken.json +2 -2
- package/build/artifacts/contracts/core/YieldContractsV2/InterestManagerYTV2.sol/InterestManagerYTV2.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContractsV2/PendlePrincipalTokenV2.sol/PendlePrincipalTokenV2.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContractsV2/PendlePrincipalTokenV2.sol/PendlePrincipalTokenV2.json +2 -2
- package/build/artifacts/contracts/core/YieldContractsV2/PendleYieldContractFactoryV2.sol/PendleYieldContractFactoryV2.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContractsV2/PendleYieldContractFactoryV2.sol/PendleYieldContractFactoryV2.json +2 -2
- package/build/artifacts/contracts/core/YieldContractsV2/PendleYieldTokenV2.sol/PendleYieldTokenV2.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContractsV2/PendleYieldTokenV2.sol/PendleYieldTokenV2.json +2 -2
- package/build/artifacts/contracts/core/libraries/ArrayLib.sol/ArrayLib.dbg.json +1 -1
- package/build/artifacts/contracts/core/libraries/Errors.sol/Errors.dbg.json +1 -1
- package/build/artifacts/contracts/core/libraries/Errors.sol/Errors.json +151 -2
- package/build/artifacts/contracts/core/libraries/TokenAmountLib.sol/TokenAmountLib.dbg.json +4 -0
- package/build/artifacts/contracts/core/libraries/TokenAmountLib.sol/TokenAmountLib.json +10 -0
- package/build/artifacts/contracts/core/libraries/math/Math.sol/Math.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Balancer/IBalancerStablePreview.sol/IBalancerStablePreview.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Balancer/IERC4626LinearPool.sol/IERC4626LinearPool.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Balancer/IVault.sol/IVault.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Camelot/ICamelotNFTPool.sol/ICamelotNFTPool.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Camelot/ICamelotNitroPool.sol/ICamelotNitroPool.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Camelot/ICamelotPair.sol/ICamelotPair.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionAddRemoveLiq.sol/IPActionAddRemoveLiq.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionInfoStatic.sol/IPActionInfoStatic.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionMarketAuxStatic.sol/IPActionMarketAuxStatic.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionMarketCoreStatic.sol/IPActionMarketCoreStatic.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionMintRedeem.sol/IPActionMintRedeem.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionMintRedeemStatic.sol/IPActionMintRedeemStatic.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionStorageStatic.sol/IPActionStorageStatic.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionSwapPT.sol/IPActionSwapPT.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionSwapYT.sol/IPActionSwapYT.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPAllAction.sol/IPAllAction.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPBulkSeller.sol/IPBulkSeller.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPGauge.sol/IPGauge.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPMarket.sol/IPMarket.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPRouterHelper.sol/IPRouterHelper.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPRouterStatic.sol/IPRouterStatic.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPVotingController.sol/IPVotingController.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPVotingEscrowMainchain.sol/IPVotingEscrowMainchain.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPYieldContractFactory.sol/IPYieldContractFactory.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IStandardizedYield.sol/IStandardizedYield.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/TradingBot/IBotDecisionHelper.sol/IBotDecisionHelper.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/TradingBot/IBotDecisionHelper.sol/IBotDecisionHelper.json +652 -0
- package/build/artifacts/contracts/interfaces/TradingBot/ILongYieldDecisionHelper.sol/ILongYieldDecisionHelper.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/TradingBot/ILongYieldDecisionHelper.sol/ILongYieldDecisionHelper.json +671 -0
- package/build/artifacts/contracts/interfaces/TradingBot/ILongYieldTradingBot.sol/ILongYieldTradingBot.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/TradingBot/ILongYieldTradingBot.sol/ILongYieldTradingBot.json +1094 -0
- package/build/artifacts/contracts/interfaces/TradingBot/IShortYieldDecisionHelper.sol/IShortYieldDecisionHelper.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/TradingBot/IShortYieldDecisionHelper.sol/IShortYieldDecisionHelper.json +652 -0
- package/build/artifacts/contracts/interfaces/TradingBot/IShortYieldTradingBot.sol/IShortYieldTradingBot.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/TradingBot/IShortYieldTradingBot.sol/IShortYieldTradingBot.json +1075 -0
- package/build/artifacts/contracts/interfaces/TradingBot/ITradingBotBase.sol/ITradingBotBase.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/TradingBot/ITradingBotBase.sol/ITradingBotBase.json +632 -0
- package/build/artifacts/contracts/offchain-helpers/BoringLpSeller.sol/BoringLpSeller.dbg.json +4 -0
- package/build/artifacts/contracts/offchain-helpers/BoringLpSeller.sol/BoringLpSeller.json +10 -0
- package/build/artifacts/contracts/offchain-helpers/BoringPtSeller.sol/BoringPtSeller.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/Broadcaster.sol/Broadcaster.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/Broadcaster.sol/Broadcaster.json +2 -2
- package/build/artifacts/contracts/offchain-helpers/BulkSellerOffchain.sol/BulkSellerOffchain.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/BulkSellerOffchain.sol/BulkSellerOffchain.json +2 -2
- package/build/artifacts/contracts/offchain-helpers/MarketExchangeRateLib.sol/MarketExchangeRateLib.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/MarketExchangeRateLib.sol/MarketExchangeRateLib.json +2 -2
- package/build/artifacts/contracts/offchain-helpers/router-static/PendleRouterStatic.sol/PendleRouterStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/router-static/PendleRouterStatic.sol/PendleRouterStatic.json +2 -2
- package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionInfoStatic.sol/ActionInfoStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionInfoStatic.sol/ActionInfoStatic.json +2 -2
- package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionMarketAuxStatic.sol/ActionMarketAuxStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionMarketAuxStatic.sol/ActionMarketAuxStatic.json +2 -2
- package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionMarketCoreStatic.sol/ActionMarketCoreStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionMarketCoreStatic.sol/ActionMarketCoreStatic.json +2 -2
- package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionMintRedeemStatic.sol/ActionMintRedeemStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionMintRedeemStatic.sol/ActionMintRedeemStatic.json +2 -2
- package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionStorageStatic.sol/ActionStorageStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionStorageStatic.sol/ActionStorageStatic.json +2 -2
- package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionVePendleStatic.sol/ActionVePendleStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionVePendleStatic.sol/ActionVePendleStatic.json +2 -2
- package/build/artifacts/contracts/offchain-helpers/router-static/base/StorageLayout.sol/StorageLayout.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/PendleLpOracleLib.sol/PendleLpOracleLib.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/PendleLpOracleLib.sol/PendleLpOracleLib.json +2 -2
- package/build/artifacts/contracts/oracles/PendlePtOracle.sol/PendlePtOracle.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/PendlePtOracle.sol/PendlePtOracle.json +2 -2
- package/build/artifacts/contracts/oracles/PendlePtOracleLib.sol/PendlePtOracleLib.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/PendlePtOracleLib.sol/PendlePtOracleLib.json +2 -2
- package/build/artifacts/contracts/oracles/samples/PendleLpGlpOracle.sol/PendleLpGlpOracle.dbg.json +4 -0
- package/build/artifacts/contracts/oracles/samples/PendleLpGlpOracle.sol/PendleLpGlpOracle.json +166 -0
- package/build/artifacts/contracts/oracles/samples/PendlePtGlpOracle.sol/PendlePtGlpOracle.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/samples/PendlePtGlpOracle.sol/PendlePtGlpOracle.json +2 -2
- package/build/artifacts/contracts/oracles/samples/PendlePtUsdChainlinkOracle.sol/PendlePtUsdChainlinkOracle.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionAddRemoveLiq.sol/ActionAddRemoveLiq.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionAddRemoveLiq.sol/ActionAddRemoveLiq.json +2 -2
- package/build/artifacts/contracts/router/ActionMintRedeem.sol/ActionMintRedeem.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionMintRedeem.sol/ActionMintRedeem.json +2 -2
- package/build/artifacts/contracts/router/ActionSwapPT.sol/ActionSwapPT.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionSwapPT.sol/ActionSwapPT.json +2 -2
- package/build/artifacts/contracts/router/ActionSwapYT.sol/ActionSwapYT.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionSwapYT.sol/ActionSwapYT.json +2 -2
- package/build/artifacts/contracts/router/PendleRouter.sol/PendleRouter.dbg.json +1 -1
- package/build/artifacts/contracts/router/PendleRouter.sol/PendleRouter.json +2 -2
- package/build/artifacts/contracts/router/PendleRouterHelper.sol/PendleRouterHelper.dbg.json +1 -1
- package/build/artifacts/contracts/router/PendleRouterHelper.sol/PendleRouterHelper.json +2 -2
- package/build/artifacts/contracts/router/base/ActionBaseCallback.sol/ActionBaseCallback.dbg.json +1 -1
- package/build/artifacts/contracts/router/base/ActionBaseMintRedeem.sol/ActionBaseMintRedeem.dbg.json +1 -1
- package/build/artifacts/contracts/router/base/CallbackHelper.sol/CallbackHelper.dbg.json +1 -1
- package/build/artifacts/contracts/router/base/MarketApproxLib.sol/MarketApproxPtInLib.dbg.json +1 -1
- package/build/artifacts/contracts/router/base/MarketApproxLib.sol/MarketApproxPtInLib.json +2 -2
- package/build/artifacts/contracts/router/base/MarketApproxLib.sol/MarketApproxPtOutLib.dbg.json +1 -1
- package/build/artifacts/contracts/router/base/MarketApproxLib.sol/MarketApproxPtOutLib.json +2 -2
- package/build/artifacts/contracts/router/swap-aggregator/PendleSwap.sol/PendleSwap.dbg.json +1 -1
- package/build/artifacts/contracts/router/swap-aggregator/kyberswap/IAggregationExecutor.sol/IAggregationExecutor.dbg.json +1 -1
- package/build/artifacts/contracts/router/swap-aggregator/kyberswap/IExecutorHelper.sol/IExecutorHelper.dbg.json +1 -1
- package/build/artifacts/contracts/router/swap-aggregator/kyberswap/IHashflow.sol/IHashflow.dbg.json +1 -1
- package/build/artifacts/contracts/router/swap-aggregator/kyberswap/IMetaAggregationRouterV2.sol/IMetaAggregationRouterV2.dbg.json +1 -1
- package/build/artifacts/contracts/router/swap-aggregator/kyberswap/KyberInputScalingHelper.sol/KyberInputScalingHelper.dbg.json +1 -1
- package/build/artifacts/contracts/router/swap-aggregator/kyberswap/ScalingDataLib.sol/ScalingDataLib.dbg.json +1 -1
- package/contracts/core/TradingBot/LongYield/LongYieldDecisionHelper.sol +216 -0
- package/contracts/core/TradingBot/LongYield/LongYieldTradingBot.sol +97 -0
- package/contracts/core/TradingBot/README.md +153 -0
- package/contracts/core/TradingBot/ShortYield/ShortYieldDecisionHelper.sol +198 -0
- package/contracts/core/TradingBot/ShortYield/ShortYieldTradingBot.sol +101 -0
- package/contracts/core/TradingBot/base/BotActionCallback.sol +112 -0
- package/contracts/core/TradingBot/base/BotActionHelper.sol +178 -0
- package/contracts/core/TradingBot/base/BotDecisionHelperBase.sol +235 -0
- package/contracts/core/TradingBot/base/TradingBotBase.sol +184 -0
- package/contracts/core/TradingBot/libraries/BotSimulationLib.sol +155 -0
- package/contracts/core/TradingBot/libraries/MarketExtLib.sol +310 -0
- package/contracts/core/TradingBot/libraries/SpecSegmentLib.sol +62 -0
- package/contracts/core/libraries/Errors.sol +12 -0
- package/contracts/core/libraries/TokenAmountLib.sol +47 -0
- package/contracts/interfaces/TradingBot/IBotDecisionHelper.sol +57 -0
- package/contracts/interfaces/TradingBot/ILongYieldDecisionHelper.sol +8 -0
- package/contracts/interfaces/TradingBot/ILongYieldTradingBot.sol +51 -0
- package/contracts/interfaces/TradingBot/IShortYieldDecisionHelper.sol +7 -0
- package/contracts/interfaces/TradingBot/IShortYieldTradingBot.sol +27 -0
- package/contracts/interfaces/TradingBot/ITradingBotBase.sol +67 -0
- package/contracts/offchain-helpers/BoringLpSeller.sol +47 -0
- package/contracts/oracles/samples/PendleLpGlpOracle.sol +49 -0
- package/package.json +1 -1
- package/typechain-types/BotActionCallback.ts +950 -0
- package/typechain-types/BotActionHelper.ts +950 -0
- package/typechain-types/BotDecisionHelper.ts +561 -0
- package/typechain-types/BotDecisionHelperBase.ts +484 -0
- package/typechain-types/BotDecisionLib.ts +335 -0
- package/typechain-types/CamelotV1LpHelper.ts +203 -0
- package/typechain-types/CamelotV1Preview.ts +431 -0
- package/typechain-types/I1inchAggregationRouterV5.ts +257 -0
- package/typechain-types/IAnkrBNB.ts +150 -0
- package/typechain-types/IAnkrLiquidStaking.ts +253 -0
- package/typechain-types/IBotDecisionHelper.ts +452 -0
- package/typechain-types/ICamelotSY.ts +100 -0
- package/typechain-types/IExecutorHelper1.ts +643 -0
- package/typechain-types/IExecutorHelper2.ts +115 -0
- package/typechain-types/IExecutorHelperEthereum1.ts +643 -0
- package/typechain-types/ILongYieldDecisionHelper.ts +486 -0
- package/typechain-types/ILongYieldTradingBot.ts +928 -0
- package/typechain-types/IPExternalRewardDistributor.ts +192 -0
- package/typechain-types/IPMarketFactoryV2.ts +253 -0
- package/typechain-types/IPendlePreviewHelper.ts +147 -0
- package/typechain-types/IShortYieldDecisionHelper.ts +452 -0
- package/typechain-types/IShortYieldTradingBot.ts +820 -0
- package/typechain-types/ISwETH.ts +123 -0
- package/typechain-types/IThenaFactory.ts +245 -0
- package/typechain-types/IThenaGaugeV2.ts +206 -0
- package/typechain-types/IThenaPair.ts +579 -0
- package/typechain-types/IThenaRouter.ts +313 -0
- package/typechain-types/IThenaSY.ts +81 -0
- package/typechain-types/ITradingBotBase.ts +619 -0
- package/typechain-types/IWBETH.ts +128 -0
- package/typechain-types/LongYieldDecisionHelper.ts +601 -0
- package/typechain-types/LongYieldTradingBot.ts +1414 -0
- package/typechain-types/MarketExtLib.ts +81 -0
- package/typechain-types/PendleAnkrBNBSY.ts +1235 -0
- package/typechain-types/PendleAuraWstethAnkreth.ts +1511 -0
- package/typechain-types/PendleBinanceEth.ts +1229 -0
- package/typechain-types/PendleCamelotV1SY.ts +1961 -0
- package/typechain-types/PendleExternalRewardDistributor.ts +546 -0
- package/typechain-types/PendleGaugeV2.ts +225 -0
- package/typechain-types/PendleLpGlpOracle.ts +145 -0
- package/typechain-types/PendleMarketFactoryV2.ts +930 -0
- package/typechain-types/PendleMarketV2.ts +1311 -0
- package/typechain-types/PendleSwETH.ts +1216 -0
- package/typechain-types/PendleSwapArbitrum.ts +126 -0
- package/typechain-types/PendleSwapEthereum.ts +126 -0
- package/typechain-types/PendleThenaSY.ts +1598 -0
- package/typechain-types/PendleWbEthSY.ts +1229 -0
- package/typechain-types/PtAndLpToAsset.ts +136 -0
- package/typechain-types/ShortYieldDecisionHelper.ts +601 -0
- package/typechain-types/ShortYieldTradingBot.ts +1306 -0
- package/typechain-types/ThenaLpHelper.ts +191 -0
- package/typechain-types/ThenaMath.ts +87 -0
- package/typechain-types/ThenaPreview.ts +450 -0
- package/typechain-types/TradingBotBase.ts +906 -0
- package/typechain-types/TradingBotOffchain.ts +568 -0
- package/typechain-types/factories/ActionAddRemoveLiq__factory.ts +1 -1
- package/typechain-types/factories/ActionInfoStatic__factory.ts +1 -1
- package/typechain-types/factories/ActionMarketAuxStatic__factory.ts +1 -1
- package/typechain-types/factories/ActionMarketCoreStatic__factory.ts +1 -1
- package/typechain-types/factories/ActionMintRedeemStatic__factory.ts +1 -1
- package/typechain-types/factories/ActionMintRedeem__factory.ts +1 -1
- package/typechain-types/factories/ActionStorageStatic__factory.ts +1 -1
- package/typechain-types/factories/ActionSwapPT__factory.ts +1 -1
- package/typechain-types/factories/ActionSwapYT__factory.ts +1 -1
- package/typechain-types/factories/ActionVePendleStatic__factory.ts +1 -1
- package/typechain-types/factories/BotActionCallback__factory.ts +947 -0
- package/typechain-types/factories/BotActionHelper__factory.ts +947 -0
- package/typechain-types/factories/BotDecisionHelperBase__factory.ts +808 -0
- package/typechain-types/factories/BotDecisionHelper__factory.ts +1192 -0
- package/typechain-types/factories/BotDecisionLib__factory.ts +642 -0
- package/typechain-types/factories/Broadcaster__factory.ts +1 -1
- package/typechain-types/factories/BulkSellerFactory__factory.ts +1 -1
- package/typechain-types/factories/BulkSellerOffchain__factory.ts +1 -1
- package/typechain-types/factories/BulkSeller__factory.ts +1 -1
- package/typechain-types/factories/CamelotV1LpHelper__factory.ts +143 -0
- package/typechain-types/factories/CamelotV1Preview__factory.ts +309 -0
- package/typechain-types/factories/Errors__factory.ts +150 -1
- package/typechain-types/factories/I1inchAggregationRouterV5__factory.ts +179 -0
- package/typechain-types/factories/IAnkrBNB__factory.ts +74 -0
- package/typechain-types/factories/IAnkrLiquidStaking__factory.ts +123 -0
- package/typechain-types/factories/IBotDecisionHelper__factory.ts +667 -0
- package/typechain-types/factories/ICamelotSY__factory.ts +49 -0
- package/typechain-types/factories/IExecutorHelper1__factory.ts +403 -0
- package/typechain-types/factories/IExecutorHelper2__factory.ts +55 -0
- package/typechain-types/factories/IExecutorHelperEthereum1__factory.ts +407 -0
- package/typechain-types/factories/ILongYieldDecisionHelper__factory.ts +690 -0
- package/typechain-types/factories/ILongYieldTradingBot__factory.ts +1113 -0
- package/typechain-types/factories/IPExternalRewardDistributor__factory.ts +128 -0
- package/typechain-types/factories/IPMarketFactoryV2__factory.ts +181 -0
- package/typechain-types/factories/IPendlePreviewHelper__factory.ts +78 -0
- package/typechain-types/factories/IShortYieldDecisionHelper__factory.ts +671 -0
- package/typechain-types/factories/IShortYieldTradingBot__factory.ts +1094 -0
- package/typechain-types/factories/ISwETH__factory.ts +53 -0
- package/typechain-types/factories/IThenaFactory__factory.ts +164 -0
- package/typechain-types/factories/IThenaGaugeV2__factory.ts +83 -0
- package/typechain-types/factories/IThenaPair__factory.ts +421 -0
- package/typechain-types/factories/IThenaRouter__factory.ts +200 -0
- package/typechain-types/factories/IThenaSY__factory.ts +36 -0
- package/typechain-types/factories/ITradingBotBase__factory.ts +647 -0
- package/typechain-types/factories/IWBETH__factory.ts +51 -0
- package/typechain-types/factories/LongYieldDecisionHelper__factory.ts +1272 -0
- package/typechain-types/factories/LongYieldTradingBot__factory.ts +1754 -0
- package/typechain-types/factories/MarketExtLib__factory.ts +74 -0
- package/typechain-types/factories/OracleLib__factory.ts +1 -1
- package/typechain-types/factories/PendleAnkrBNBSY__factory.ts +1100 -0
- package/typechain-types/factories/PendleArbitrumStakedEthSY__factory.ts +27 -2
- package/typechain-types/factories/PendleAuraBbAWethSwethSY__factory.ts +1 -1
- package/typechain-types/factories/PendleAuraWethAnkrethSYV2__factory.ts +1 -1
- package/typechain-types/factories/PendleAuraWethRocketEthSYV2__factory.ts +1 -1
- package/typechain-types/factories/PendleAuraWethStafiEthSY__factory.ts +1 -1
- package/typechain-types/factories/PendleAuraWethWstethSYV2__factory.ts +1 -1
- package/typechain-types/factories/PendleAuraWstethAnkreth__factory.ts +1244 -0
- package/typechain-types/factories/PendleBinanceEth__factory.ts +1052 -0
- package/typechain-types/factories/PendleCamelotV1SY__factory.ts +1595 -0
- package/typechain-types/factories/PendleCamelotV1VolatileSY__factory.ts +1 -1
- package/typechain-types/factories/PendleCurveFraxUsdcSY__factory.ts +1 -1
- package/typechain-types/factories/PendleCurveUsdd3CrvSY__factory.ts +1 -1
- package/typechain-types/factories/PendleExternalRewardDistributor__factory.ts +414 -0
- package/typechain-types/factories/PendleFeeDistributorV2__factory.ts +1 -1
- package/typechain-types/factories/PendleFeeDistributor__factory.ts +1 -1
- package/typechain-types/factories/PendleGDaiSY__factory.ts +1 -1
- package/typechain-types/factories/PendleGaugeControllerMainchainUpg__factory.ts +1 -1
- package/typechain-types/factories/PendleGaugeControllerSidechainUpg__factory.ts +1 -1
- package/typechain-types/factories/PendleGaugeV2__factory.ts +140 -0
- package/typechain-types/factories/PendleGlpSY__factory.ts +1 -1
- package/typechain-types/factories/PendleLooksStakingSY__factory.ts +1 -1
- package/typechain-types/factories/PendleLpGlpOracle__factory.ts +246 -0
- package/typechain-types/factories/PendleMarketFactoryV2__factory.ts +770 -0
- package/typechain-types/factories/PendleMarketFactory__factory.ts +1 -1
- package/typechain-types/factories/PendleMarketV2__factory.ts +1290 -0
- package/typechain-types/factories/PendleMarket__factory.ts +1 -1
- package/typechain-types/factories/PendleMsgReceiveEndpointUpg__factory.ts +1 -1
- package/typechain-types/factories/PendleMsgSendEndpointUpg__factory.ts +1 -1
- package/typechain-types/factories/PendlePrincipalTokenV2__factory.ts +1 -1
- package/typechain-types/factories/PendlePrincipalToken__factory.ts +1 -1
- package/typechain-types/factories/PendlePtGlpOracle__factory.ts +1 -1
- package/typechain-types/factories/PendlePtOracle__factory.ts +1 -1
- package/typechain-types/factories/PendleQiTokenHelper__factory.ts +1 -1
- package/typechain-types/factories/PendleQiTokenSY__factory.ts +1 -1
- package/typechain-types/factories/PendleRouterHelper__factory.ts +1 -1
- package/typechain-types/factories/PendleRouterStatic__factory.ts +1 -1
- package/typechain-types/factories/PendleRouter__factory.ts +1 -1
- package/typechain-types/factories/PendleSfrxEthSY__factory.ts +1 -1
- package/typechain-types/factories/PendleStargateLPSY__factory.ts +1 -1
- package/typechain-types/factories/PendleSwETH__factory.ts +1022 -0
- package/typechain-types/factories/PendleSwapArbitrum__factory.ts +129 -0
- package/typechain-types/factories/PendleSwapEthereum__factory.ts +129 -0
- package/typechain-types/factories/PendleThenaSY__factory.ts +1352 -0
- package/typechain-types/factories/PendleVotingControllerUpg__factory.ts +1 -1
- package/typechain-types/factories/PendleWbEthSY__factory.ts +1049 -0
- package/typechain-types/factories/PendleWstEthSY__factory.ts +1 -1
- package/typechain-types/factories/PendleYieldContractFactoryV2__factory.ts +1 -1
- package/typechain-types/factories/PendleYieldContractFactory__factory.ts +1 -1
- package/typechain-types/factories/PendleYieldTokenV2__factory.ts +1 -1
- package/typechain-types/factories/PendleYieldToken__factory.ts +1 -1
- package/typechain-types/factories/PtAndLpToAsset__factory.ts +150 -0
- package/typechain-types/factories/SAPE__factory.ts +1 -1
- package/typechain-types/factories/ShortYieldDecisionHelper__factory.ts +1272 -0
- package/typechain-types/factories/ShortYieldTradingBot__factory.ts +1612 -0
- package/typechain-types/factories/ThenaLpHelper__factory.ts +140 -0
- package/typechain-types/factories/ThenaMath__factory.ts +36 -0
- package/typechain-types/factories/ThenaPreview__factory.ts +319 -0
- package/typechain-types/factories/TradingBotBase__factory.ts +897 -0
- package/typechain-types/factories/TradingBotOffchain__factory.ts +1133 -0
- package/typechain-types/factories/VotingEscrowPendleMainchain__factory.ts +1 -1
- package/typechain-types/factories/VotingEscrowPendleSidechain__factory.ts +1 -1
- package/typechain-types/hardhat.d.ts +144 -9
- package/typechain-types/index.ts +32 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleArbitrumStakedEthSY.sol/PendleArbitrumStakedEthSY.dbg.json +0 -4
- package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleArbitrumStakedEthSY.sol/PendleArbitrumStakedEthSY.json +0 -966
- package/contracts/core/StandardizedYield/implementations/PendleArbitrumStakedEthSY.sol +0 -114
- package/deployments/42161-markets/RETH-ARBITRUM-JUNE2024.json +0 -10
- package/deployments/42161-markets/WSTETH-ARBITRUM-JUNE2024.json +0 -10
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
pragma solidity ^0.8.0;
|
|
3
|
+
|
|
4
|
+
import "./MarketExtLib.sol";
|
|
5
|
+
import "../../../interfaces/TradingBot/IBotDecisionHelper.sol";
|
|
6
|
+
|
|
7
|
+
library BotSimulationLib {
|
|
8
|
+
using MarketMathCore for MarketState;
|
|
9
|
+
using MarketExtLib for MarketExtState;
|
|
10
|
+
using Math for uint256;
|
|
11
|
+
using Math for int256;
|
|
12
|
+
|
|
13
|
+
function swapSyToYt(
|
|
14
|
+
BotState memory bot,
|
|
15
|
+
MarketExtState memory marketExt,
|
|
16
|
+
uint256 exactYtOut
|
|
17
|
+
) internal pure returns (bool /*success*/) {
|
|
18
|
+
uint256 netSyIn = marketExt.swapSyToYt(exactYtOut);
|
|
19
|
+
|
|
20
|
+
if (netSyIn > bot.syBalance) return false;
|
|
21
|
+
|
|
22
|
+
bot.syBalance -= netSyIn;
|
|
23
|
+
bot.ytBalance += exactYtOut;
|
|
24
|
+
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function addLiqKeepYt(
|
|
29
|
+
BotState memory bot,
|
|
30
|
+
MarketExtState memory marketExt,
|
|
31
|
+
uint256 netSyIn
|
|
32
|
+
) internal pure returns (bool /*success*/) {
|
|
33
|
+
if (netSyIn > bot.syBalance) return false;
|
|
34
|
+
|
|
35
|
+
(uint256 netLpOut, uint256 netYtOut) = marketExt.addLiqKeepYt(netSyIn);
|
|
36
|
+
|
|
37
|
+
bot.syBalance -= netSyIn;
|
|
38
|
+
bot.lpBalance += netLpOut;
|
|
39
|
+
bot.ytBalance += netYtOut;
|
|
40
|
+
|
|
41
|
+
return true;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function addLiqFromSy(
|
|
45
|
+
BotState memory bot,
|
|
46
|
+
MarketExtState memory marketExt,
|
|
47
|
+
uint256 netPtFromSwap
|
|
48
|
+
) internal pure returns (bool /*success*/) {
|
|
49
|
+
(uint256 netLpOut, uint256 netSyIn) = marketExt.addLiqFromSy(netPtFromSwap);
|
|
50
|
+
|
|
51
|
+
if (netSyIn > bot.syBalance) return false;
|
|
52
|
+
|
|
53
|
+
bot.syBalance -= netSyIn;
|
|
54
|
+
bot.lpBalance += netLpOut;
|
|
55
|
+
|
|
56
|
+
return true;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function addLiqFromYt(
|
|
60
|
+
BotState memory bot,
|
|
61
|
+
MarketExtState memory marketExt,
|
|
62
|
+
uint256 netPtFromSwap
|
|
63
|
+
) internal pure returns (bool /*success*/) {
|
|
64
|
+
(uint256 netLpOut, uint256 netYtIn) = marketExt.addLiqFromYt(netPtFromSwap);
|
|
65
|
+
|
|
66
|
+
if (netYtIn > bot.ytBalance) return false;
|
|
67
|
+
|
|
68
|
+
bot.ytBalance -= netYtIn;
|
|
69
|
+
bot.lpBalance += netLpOut;
|
|
70
|
+
|
|
71
|
+
return true;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function removeLiqToYt(
|
|
75
|
+
BotState memory bot,
|
|
76
|
+
MarketExtState memory marketExt,
|
|
77
|
+
uint256 netLpToRemove,
|
|
78
|
+
ApproxParams memory approxParams
|
|
79
|
+
) internal pure returns (bool /*success*/) {
|
|
80
|
+
if (netLpToRemove > bot.lpBalance) return false;
|
|
81
|
+
|
|
82
|
+
(uint256 netYtOut, ) = marketExt.removeLiqToYt(
|
|
83
|
+
netLpToRemove,
|
|
84
|
+
cloneApproxParams(approxParams)
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
bot.lpBalance -= netLpToRemove;
|
|
88
|
+
bot.ytBalance += netYtOut;
|
|
89
|
+
|
|
90
|
+
return true;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function swapPtToYt(
|
|
94
|
+
BotState memory bot,
|
|
95
|
+
MarketExtState memory marketExt,
|
|
96
|
+
uint256 netPtToSwap,
|
|
97
|
+
ApproxParams memory approxParams
|
|
98
|
+
) internal pure returns (bool /*success*/) {
|
|
99
|
+
if (netPtToSwap > bot.ptBalance) return false;
|
|
100
|
+
(uint256 netYtOut, ) = marketExt.swapPtToYt(netPtToSwap, cloneApproxParams(approxParams));
|
|
101
|
+
bot.ptBalance -= netPtToSwap;
|
|
102
|
+
bot.ytBalance += netYtOut;
|
|
103
|
+
return true;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function swapYtToPt(
|
|
107
|
+
BotState memory bot,
|
|
108
|
+
MarketExtState memory marketExt,
|
|
109
|
+
uint256 netYtToSwap,
|
|
110
|
+
ApproxParams memory approxParams
|
|
111
|
+
) internal pure returns (bool /*success*/) {
|
|
112
|
+
if (netYtToSwap > bot.ytBalance) return false;
|
|
113
|
+
(uint256 netPtOut, ) = marketExt.swapYtToPt(netYtToSwap, cloneApproxParams(approxParams));
|
|
114
|
+
bot.ptBalance += netPtOut;
|
|
115
|
+
bot.ytBalance -= netYtToSwap;
|
|
116
|
+
return true;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function tvlInSy(
|
|
120
|
+
BotState memory bot,
|
|
121
|
+
MarketExtState memory marketExt
|
|
122
|
+
) internal pure returns (uint256) {
|
|
123
|
+
MarketExtState memory marketExtClone = marketExt.clone();
|
|
124
|
+
|
|
125
|
+
(uint256 syInLp, uint256 ptInLp) = marketExtClone.removeLiqDual(bot.lpBalance);
|
|
126
|
+
uint256 totalValue = bot.syBalance + syInLp;
|
|
127
|
+
|
|
128
|
+
uint256 totalPt = ptInLp + bot.ptBalance;
|
|
129
|
+
if (totalPt <= bot.ytBalance) {
|
|
130
|
+
totalValue += marketExtClone.previewPyToSy(totalPt);
|
|
131
|
+
totalValue += marketExtClone.swapYtToSy(bot.ytBalance - totalPt);
|
|
132
|
+
} else {
|
|
133
|
+
totalValue += marketExtClone.previewPyToSy(bot.ytBalance);
|
|
134
|
+
totalValue += marketExtClone.swapPtToSy(totalPt - bot.ytBalance);
|
|
135
|
+
}
|
|
136
|
+
return totalValue;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function clone(BotState memory bot) internal pure returns (BotState memory) {
|
|
140
|
+
return BotState(bot.lpBalance, bot.ytBalance, bot.ptBalance, bot.syBalance, bot.buyBins);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
function cloneApproxParams(
|
|
144
|
+
ApproxParams memory params
|
|
145
|
+
) internal pure returns (ApproxParams memory) {
|
|
146
|
+
return
|
|
147
|
+
ApproxParams(
|
|
148
|
+
params.guessMin,
|
|
149
|
+
params.guessMax,
|
|
150
|
+
params.guessOffchain,
|
|
151
|
+
params.maxIteration,
|
|
152
|
+
params.eps
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
pragma solidity ^0.8.0;
|
|
3
|
+
|
|
4
|
+
import "../../../interfaces/IPMarket.sol";
|
|
5
|
+
import "../../StandardizedYield/PYIndex.sol";
|
|
6
|
+
import "../../../router/base/MarketApproxLib.sol";
|
|
7
|
+
|
|
8
|
+
struct MarketExtState {
|
|
9
|
+
MarketState state;
|
|
10
|
+
PYIndex index;
|
|
11
|
+
uint256 blockTime;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
library MarketExtLib {
|
|
15
|
+
using MarketMathCore for MarketState;
|
|
16
|
+
using MarketApproxPtInLib for MarketState;
|
|
17
|
+
using MarketApproxPtOutLib for MarketState;
|
|
18
|
+
using PYIndexLib for PYIndex;
|
|
19
|
+
using PYIndexLib for IPYieldToken;
|
|
20
|
+
using LogExpMath for uint256;
|
|
21
|
+
using Math for uint256;
|
|
22
|
+
using Math for int256;
|
|
23
|
+
|
|
24
|
+
uint256 public constant ONE_YEAR = 31536000;
|
|
25
|
+
|
|
26
|
+
/// @dev Simulates PendleRouter's swapExactYtForSy
|
|
27
|
+
function swapYtToSy(
|
|
28
|
+
MarketExtState memory marketExt,
|
|
29
|
+
uint256 exactYtIn
|
|
30
|
+
) internal pure returns (uint256 /*netSyOut*/) {
|
|
31
|
+
(uint256 netSyOwedInt, , ) = marketExt.state.swapSyForExactPt(
|
|
32
|
+
marketExt.index,
|
|
33
|
+
exactYtIn,
|
|
34
|
+
marketExt.blockTime
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
uint256 netPYToRepaySyOwedInt = marketExt.index.syToAssetUp(netSyOwedInt);
|
|
38
|
+
uint256 netPYToRedeemSyOutInt = exactYtIn - netPYToRepaySyOwedInt;
|
|
39
|
+
|
|
40
|
+
return marketExt.index.assetToSy(netPYToRedeemSyOutInt);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/// @dev Simulates PendleRouter's swapSyForExactYt
|
|
44
|
+
function swapSyToYt(
|
|
45
|
+
MarketExtState memory marketExt,
|
|
46
|
+
uint256 exactYtOut
|
|
47
|
+
) internal pure returns (uint256 /*netSyIn*/) {
|
|
48
|
+
(uint256 netSyReceivedInt, , ) = marketExt.state.swapExactPtForSy(
|
|
49
|
+
marketExt.index,
|
|
50
|
+
exactYtOut,
|
|
51
|
+
marketExt.blockTime
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
uint256 totalSyNeedInt = marketExt.index.assetToSyUp(exactYtOut);
|
|
55
|
+
return totalSyNeedInt.subMax0(netSyReceivedInt);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/// @dev Simulates PendleRouter's swapExactPtForSy
|
|
59
|
+
function swapPtToSy(
|
|
60
|
+
MarketExtState memory marketExt,
|
|
61
|
+
uint256 exactPtIn
|
|
62
|
+
) internal pure returns (uint256 netSyOut) {
|
|
63
|
+
(netSyOut, , ) = marketExt.state.swapExactPtForSy(
|
|
64
|
+
marketExt.index,
|
|
65
|
+
exactPtIn,
|
|
66
|
+
marketExt.blockTime
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/// @dev Simulates PendleRouter's addLiquiditySingleSyKeepYt
|
|
71
|
+
function addLiqKeepYt(
|
|
72
|
+
MarketExtState memory marketExt,
|
|
73
|
+
uint256 netSyIn
|
|
74
|
+
) internal pure returns (uint256 netLpOut, uint256 netYtOut) {
|
|
75
|
+
uint256 netSyToPt = (netSyIn * marketExt.state.totalPt.Uint()) /
|
|
76
|
+
(marketExt.state.totalPt.Uint() +
|
|
77
|
+
marketExt.index.syToAsset(marketExt.state.totalSy.Uint()));
|
|
78
|
+
|
|
79
|
+
netYtOut = marketExt.index.syToAsset(netSyToPt);
|
|
80
|
+
|
|
81
|
+
netLpOut = addLiqDual(marketExt, netSyIn - netSyToPt, netYtOut);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function addLiqFromSy(
|
|
85
|
+
MarketExtState memory marketExt,
|
|
86
|
+
uint256 netPtFromSwap
|
|
87
|
+
) internal pure returns (uint256 netLpOut, uint256 netSyIn) {
|
|
88
|
+
(uint256 netSyToSwap, , ) = marketExt.state.swapSyForExactPt(
|
|
89
|
+
marketExt.index,
|
|
90
|
+
netPtFromSwap,
|
|
91
|
+
marketExt.blockTime
|
|
92
|
+
);
|
|
93
|
+
uint256 netSyToAdd = (netPtFromSwap * marketExt.state.totalSy.Uint()) /
|
|
94
|
+
marketExt.state.totalPt.Uint();
|
|
95
|
+
|
|
96
|
+
netLpOut = addLiqDual(marketExt, netSyToAdd, netPtFromSwap);
|
|
97
|
+
netSyIn = netSyToSwap + netSyToAdd;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function addLiqFromYt(
|
|
101
|
+
MarketExtState memory marketExt,
|
|
102
|
+
uint256 netPtFromSwap
|
|
103
|
+
) internal pure returns (uint256 netLpOut, uint256 netYtIn) {
|
|
104
|
+
(uint256 netSyToSwap, , ) = marketExt.state.swapSyForExactPt(
|
|
105
|
+
marketExt.index,
|
|
106
|
+
netPtFromSwap,
|
|
107
|
+
marketExt.blockTime
|
|
108
|
+
);
|
|
109
|
+
|
|
110
|
+
uint256 pyIndex = PYIndex.unwrap(marketExt.index);
|
|
111
|
+
uint256 netPtToAddNumerator = (netPtFromSwap * Math.ONE - netSyToSwap * pyIndex);
|
|
112
|
+
uint256 netPtToAddDenominator = (Math.ONE +
|
|
113
|
+
(marketExt.state.totalSy.Uint() * pyIndex) /
|
|
114
|
+
marketExt.state.totalPt.Uint());
|
|
115
|
+
uint256 netPtToAdd = netPtToAddNumerator / netPtToAddDenominator;
|
|
116
|
+
|
|
117
|
+
netYtIn = netPtFromSwap - netPtToAdd;
|
|
118
|
+
|
|
119
|
+
uint256 netSyFromPy = marketExt.index.assetToSy(netYtIn);
|
|
120
|
+
uint256 netSyToAdd = netSyFromPy - netSyToSwap;
|
|
121
|
+
|
|
122
|
+
netLpOut = addLiqDual(marketExt, netSyToAdd, netPtToAdd);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/// @dev Simulates PendleRouter's removeLiquidityDualSyAndPt then swapExactPtForYt
|
|
126
|
+
function removeLiqToYt(
|
|
127
|
+
MarketExtState memory marketExt,
|
|
128
|
+
uint256 netLpToRemove,
|
|
129
|
+
ApproxParams memory approxParams
|
|
130
|
+
) internal pure returns (uint256 netYtOut, uint256 totalPtToSwap) {
|
|
131
|
+
(uint256 netSyRemoved, uint256 netPtRemoved) = removeLiqDual(marketExt, netLpToRemove);
|
|
132
|
+
|
|
133
|
+
uint256 netYtFromSy = marketExt.index.syToAsset(netSyRemoved);
|
|
134
|
+
uint256 netPtToSwap = netPtRemoved + netYtFromSy;
|
|
135
|
+
|
|
136
|
+
uint256 netYtFromSwap;
|
|
137
|
+
(netYtFromSwap, totalPtToSwap, ) = marketExt.state.approxSwapExactPtForYt(
|
|
138
|
+
marketExt.index,
|
|
139
|
+
netPtToSwap,
|
|
140
|
+
marketExt.blockTime,
|
|
141
|
+
clone(approxParams)
|
|
142
|
+
);
|
|
143
|
+
|
|
144
|
+
marketExt.state.swapExactPtForSy(marketExt.index, totalPtToSwap, marketExt.blockTime);
|
|
145
|
+
|
|
146
|
+
netYtOut = netYtFromSy + netYtFromSwap;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/// @dev Simplified version of MarketMathCore's addLiquidity
|
|
150
|
+
function addLiqDual(
|
|
151
|
+
MarketExtState memory marketExt,
|
|
152
|
+
uint256 netSyIn,
|
|
153
|
+
uint256 netPtIn
|
|
154
|
+
) internal pure returns (uint256 /*netLpOut*/) {
|
|
155
|
+
require(
|
|
156
|
+
!MiniHelpers.isExpired(marketExt.state.expiry, marketExt.blockTime),
|
|
157
|
+
"MarketExtLib: expired market"
|
|
158
|
+
);
|
|
159
|
+
require(marketExt.state.totalLp > 0, "MarketExtLib: LP < 0");
|
|
160
|
+
|
|
161
|
+
int256 syDesired = netSyIn.Int();
|
|
162
|
+
int256 ptDesired = netPtIn.Int();
|
|
163
|
+
int256 lpToAccount;
|
|
164
|
+
int256 ptUsed;
|
|
165
|
+
int256 syUsed;
|
|
166
|
+
|
|
167
|
+
int256 netLpByPt = (ptDesired * marketExt.state.totalLp) / marketExt.state.totalPt;
|
|
168
|
+
int256 netLpBySy = (syDesired * marketExt.state.totalLp) / marketExt.state.totalSy;
|
|
169
|
+
if (netLpByPt < netLpBySy) {
|
|
170
|
+
lpToAccount = netLpByPt;
|
|
171
|
+
ptUsed = ptDesired;
|
|
172
|
+
syUsed = (marketExt.state.totalSy * lpToAccount) / marketExt.state.totalLp;
|
|
173
|
+
} else {
|
|
174
|
+
lpToAccount = netLpBySy;
|
|
175
|
+
syUsed = syDesired;
|
|
176
|
+
ptUsed = (marketExt.state.totalPt * lpToAccount) / marketExt.state.totalLp;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
marketExt.state.totalSy += syUsed;
|
|
180
|
+
marketExt.state.totalPt += ptUsed;
|
|
181
|
+
marketExt.state.totalLp += lpToAccount;
|
|
182
|
+
|
|
183
|
+
return lpToAccount.Uint();
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/// @dev Simplified version of MarketMathCore's removeLiquidity
|
|
187
|
+
function removeLiqDual(
|
|
188
|
+
MarketExtState memory marketExt,
|
|
189
|
+
uint256 netLpToRemove
|
|
190
|
+
) internal pure returns (uint256 /*netSyToAccount*/, uint256 /*netPtToAccount*/) {
|
|
191
|
+
int256 lpToRemove = netLpToRemove.Int();
|
|
192
|
+
|
|
193
|
+
int256 netSyToAccount = (lpToRemove * marketExt.state.totalSy) / marketExt.state.totalLp;
|
|
194
|
+
int256 netPtToAccount = (lpToRemove * marketExt.state.totalPt) / marketExt.state.totalLp;
|
|
195
|
+
|
|
196
|
+
marketExt.state.totalLp = marketExt.state.totalLp.subNoNeg(lpToRemove);
|
|
197
|
+
marketExt.state.totalPt = marketExt.state.totalPt.subNoNeg(netPtToAccount);
|
|
198
|
+
marketExt.state.totalSy = marketExt.state.totalSy.subNoNeg(netSyToAccount);
|
|
199
|
+
|
|
200
|
+
return (netSyToAccount.Uint(), netPtToAccount.Uint());
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
function swapPtToYt(
|
|
204
|
+
MarketExtState memory marketExt,
|
|
205
|
+
uint256 exactPtIn,
|
|
206
|
+
ApproxParams memory approxParams
|
|
207
|
+
) internal pure returns (uint256 netYtOut, uint256 totalPtToSwap) {
|
|
208
|
+
(netYtOut, totalPtToSwap,) = marketExt.state.approxSwapExactPtForYt(
|
|
209
|
+
marketExt.index,
|
|
210
|
+
exactPtIn,
|
|
211
|
+
marketExt.blockTime,
|
|
212
|
+
approxParams
|
|
213
|
+
);
|
|
214
|
+
|
|
215
|
+
marketExt.state.swapExactPtForSy(marketExt.index, totalPtToSwap, marketExt.blockTime);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
function swapYtToPt(
|
|
219
|
+
MarketExtState memory marketExt,
|
|
220
|
+
uint256 exactYtIn,
|
|
221
|
+
ApproxParams memory approxParams
|
|
222
|
+
) internal pure returns (uint256 netPtOut, uint256 totalPtSwapped) {
|
|
223
|
+
(netPtOut, totalPtSwapped,) = marketExt.state.approxSwapExactYtForPt(
|
|
224
|
+
marketExt.index,
|
|
225
|
+
exactYtIn,
|
|
226
|
+
marketExt.blockTime,
|
|
227
|
+
approxParams
|
|
228
|
+
);
|
|
229
|
+
|
|
230
|
+
marketExt.state.swapSyForExactPt(marketExt.index, totalPtSwapped, marketExt.blockTime);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
function previewPyToSy(
|
|
234
|
+
MarketExtState memory marketExt,
|
|
235
|
+
uint256 netPYToRedeem
|
|
236
|
+
) internal pure returns (uint256) {
|
|
237
|
+
return marketExt.index.assetToSy(netPYToRedeem);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/// @notice Returns the trade exchange rate, fee excluded
|
|
241
|
+
function exchangeRate(MarketExtState memory marketExt) internal pure returns (uint256) {
|
|
242
|
+
MarketPreCompute memory comp = marketExt.state.getMarketPreCompute(
|
|
243
|
+
marketExt.index,
|
|
244
|
+
marketExt.blockTime
|
|
245
|
+
);
|
|
246
|
+
|
|
247
|
+
int256 preFeeExchangeRate = MarketMathCore._getExchangeRate(
|
|
248
|
+
marketExt.state.totalPt,
|
|
249
|
+
comp.totalAsset,
|
|
250
|
+
comp.rateScalar,
|
|
251
|
+
comp.rateAnchor,
|
|
252
|
+
0
|
|
253
|
+
);
|
|
254
|
+
|
|
255
|
+
return preFeeExchangeRate.Uint();
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
function impliedYield(MarketExtState memory marketExt) internal pure returns (uint256) {
|
|
259
|
+
return
|
|
260
|
+
exchangeRate(marketExt).pow(
|
|
261
|
+
ONE_YEAR.divDown(marketExt.state.expiry - marketExt.blockTime)
|
|
262
|
+
) - Math.ONE;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
function clone(MarketState memory state) internal pure returns (MarketState memory) {
|
|
266
|
+
return
|
|
267
|
+
MarketState(
|
|
268
|
+
state.totalPt,
|
|
269
|
+
state.totalSy,
|
|
270
|
+
state.totalLp,
|
|
271
|
+
state.treasury,
|
|
272
|
+
state.scalarRoot,
|
|
273
|
+
state.expiry,
|
|
274
|
+
state.lnFeeRateRoot,
|
|
275
|
+
state.reserveFeePercent,
|
|
276
|
+
state.lastLnImpliedRate
|
|
277
|
+
);
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
function clone(MarketExtState memory marketExt) internal pure returns (MarketExtState memory) {
|
|
281
|
+
return MarketExtState(clone(marketExt.state), marketExt.index, marketExt.blockTime);
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
function clone(ApproxParams memory params) internal pure returns (ApproxParams memory) {
|
|
285
|
+
return
|
|
286
|
+
ApproxParams(
|
|
287
|
+
params.guessMin,
|
|
288
|
+
params.guessMax,
|
|
289
|
+
params.guessOffchain,
|
|
290
|
+
params.maxIteration,
|
|
291
|
+
params.eps
|
|
292
|
+
);
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
function calcMaxPtIn(MarketExtState memory marketExt) internal pure returns (uint256) {
|
|
296
|
+
return
|
|
297
|
+
(MarketApproxPtInLib.calcMaxPtIn(
|
|
298
|
+
marketExt.state,
|
|
299
|
+
marketExt.state.getMarketPreCompute(marketExt.index, marketExt.blockTime)
|
|
300
|
+
) * 9) / 10;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
function calcMaxPtOut(MarketExtState memory marketExt) internal pure returns (uint256) {
|
|
304
|
+
return
|
|
305
|
+
MarketApproxPtOutLib.calcMaxPtOut(
|
|
306
|
+
marketExt.state.getMarketPreCompute(marketExt.index, marketExt.blockTime),
|
|
307
|
+
marketExt.state.totalPt
|
|
308
|
+
);
|
|
309
|
+
}
|
|
310
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
pragma solidity 0.8.17;
|
|
3
|
+
|
|
4
|
+
import "../../../interfaces/TradingBot/IBotDecisionHelper.sol";
|
|
5
|
+
import "../../libraries/math/Math.sol";
|
|
6
|
+
|
|
7
|
+
library SpecSegmentLib {
|
|
8
|
+
using Math for uint256;
|
|
9
|
+
using Math for int256;
|
|
10
|
+
|
|
11
|
+
function getSegLength(TradingSpecs memory specs) internal pure returns (uint256) {
|
|
12
|
+
return (specs.sellYtIy - specs.buyYtIy) / (2 * specs.numOfBins);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function getMidIyOfSeg(
|
|
16
|
+
TradingSpecs memory specs,
|
|
17
|
+
uint256 segId
|
|
18
|
+
) internal pure returns (uint256) {
|
|
19
|
+
assert(segId != 0 && segId != specs.numOfBins * 2);
|
|
20
|
+
uint256 length = getSegLength(specs);
|
|
21
|
+
return specs.buyYtIy + length * (segId - 1) + length / 2;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function getSegIdForIy(
|
|
25
|
+
TradingSpecs memory specs,
|
|
26
|
+
uint256 iy
|
|
27
|
+
) internal pure returns (uint256) {
|
|
28
|
+
if (iy < specs.buyYtIy) {
|
|
29
|
+
return 0;
|
|
30
|
+
}
|
|
31
|
+
if (iy > specs.sellYtIy) {
|
|
32
|
+
return 2 * specs.numOfBins + 1;
|
|
33
|
+
}
|
|
34
|
+
return (iy - specs.buyYtIy) / getSegLength(specs) + 1;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function convertSegIdToBinId(
|
|
38
|
+
BotState memory botState,
|
|
39
|
+
uint256 segId
|
|
40
|
+
) internal pure returns (int256) {
|
|
41
|
+
int256 binId = segId.Int() - botState.buyBins.Int();
|
|
42
|
+
if (binId >= 1) binId--;
|
|
43
|
+
return binId;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function convertBinIdToSegId(
|
|
47
|
+
BotState memory botState,
|
|
48
|
+
int256 binId
|
|
49
|
+
) internal pure returns (uint256) {
|
|
50
|
+
assert(binId != 0);
|
|
51
|
+
if (binId >= 1) binId++;
|
|
52
|
+
return (binId + botState.buyBins.Int()).Uint();
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function getBinIdForIy(
|
|
56
|
+
TradingSpecs memory specs,
|
|
57
|
+
BotState memory botState,
|
|
58
|
+
uint256 iy
|
|
59
|
+
) internal pure returns (int256) {
|
|
60
|
+
return convertSegIdToBinId(botState, getSegIdForIy(specs, iy));
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -177,4 +177,16 @@ library Errors {
|
|
|
177
177
|
// Swap Aggregator
|
|
178
178
|
error SAInsufficientTokenIn(address tokenIn, uint256 amountExpected, uint256 amountActual);
|
|
179
179
|
error UnsupportedSelector(uint256 aggregatorType, bytes4 selector);
|
|
180
|
+
|
|
181
|
+
// Trading Bot
|
|
182
|
+
error BotBinarySearchInvalidRange(uint256 action, uint256 guessMin, uint256 guessMax);
|
|
183
|
+
error BotBinarySearchGuessMinInvalid(uint256 action, uint256 guessMin);
|
|
184
|
+
error BotBinarySearchFail();
|
|
185
|
+
error BotExceededLimitSyIn(uint256 actualSyIn, uint256 limitSyIn);
|
|
186
|
+
error BotExceededLimitYtIn(uint256 actualYtIn, uint256 limitYtIn);
|
|
187
|
+
error BotExceededLimitLpToRemove(uint256 actualLpToRemove, uint256 limitLpToRemove);
|
|
188
|
+
error BotInsufficientSyOut(uint256 actualSyOut, uint256 requiredSyOut);
|
|
189
|
+
error BotInsufficientYtOut(uint256 actualYtOut, uint256 requiredYtOut);
|
|
190
|
+
error BotInsufficientLpOut(uint256 actualLpOut, uint256 requiredLpOut);
|
|
191
|
+
error BotCallbackNotMarket(address caller);
|
|
180
192
|
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
pragma solidity >=0.8.0;
|
|
3
|
+
|
|
4
|
+
struct TokenAmount {
|
|
5
|
+
address token;
|
|
6
|
+
uint256 amount;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
library TokenAmountLib {
|
|
10
|
+
function add(
|
|
11
|
+
TokenAmount[] memory list,
|
|
12
|
+
address token,
|
|
13
|
+
uint256 amount
|
|
14
|
+
) internal pure returns (TokenAmount[] memory newList) {
|
|
15
|
+
if (amount == 0) return list;
|
|
16
|
+
|
|
17
|
+
uint256 newTokenIndex = list.length;
|
|
18
|
+
for (uint256 i = 0; i < list.length; i++) {
|
|
19
|
+
if (list[i].token == token) {
|
|
20
|
+
newTokenIndex = i;
|
|
21
|
+
break;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
newList = new TokenAmount[](list.length + (newTokenIndex == list.length ? 1 : 0));
|
|
26
|
+
for (uint256 i = 0; i < list.length; i++) {
|
|
27
|
+
newList[i] = list[i];
|
|
28
|
+
}
|
|
29
|
+
newList[newTokenIndex] = TokenAmount(
|
|
30
|
+
token,
|
|
31
|
+
(newTokenIndex == list.length ? 0 : list[newTokenIndex].amount) + amount
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function add(
|
|
36
|
+
TokenAmount[] memory list,
|
|
37
|
+
address[] memory tokens,
|
|
38
|
+
uint256[] memory amounts
|
|
39
|
+
) internal pure returns (TokenAmount[] memory newList) {
|
|
40
|
+
newList = list;
|
|
41
|
+
require(tokens.length == amounts.length, "TokenAmountLib: length mismatch");
|
|
42
|
+
for (uint256 i = 0; i < tokens.length; i++) {
|
|
43
|
+
newList = add(newList, tokens[i], amounts[i]);
|
|
44
|
+
}
|
|
45
|
+
return newList;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
pragma solidity 0.8.17;
|
|
3
|
+
|
|
4
|
+
import "./ITradingBotBase.sol";
|
|
5
|
+
|
|
6
|
+
enum ActionType {
|
|
7
|
+
NONE,
|
|
8
|
+
AddLiqFromYt, // Sell YT for LP
|
|
9
|
+
RemoveLiqToYt, // Zap out to YT,
|
|
10
|
+
SwapPtForYt,
|
|
11
|
+
SwapYtForPt
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
interface IBotDecisionHelper {
|
|
15
|
+
enum RebalanceResult {
|
|
16
|
+
TARGET_NOT_REACHED,
|
|
17
|
+
SUCCESS,
|
|
18
|
+
FAIL_OR_TARGET_EXCEED
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
struct RebalanceDetails {
|
|
22
|
+
StrategyData strategyData;
|
|
23
|
+
ActionType action;
|
|
24
|
+
uint256 targetIy;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
struct ActionToTakeResult {
|
|
28
|
+
ActionType action;
|
|
29
|
+
int currentBin;
|
|
30
|
+
uint256 targetIy;
|
|
31
|
+
uint256 guessBotParams;
|
|
32
|
+
uint256 guessIntParams;
|
|
33
|
+
uint256 amountOut;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function getCurrentBin(StrategyData memory strategyData) external view returns (int256);
|
|
37
|
+
|
|
38
|
+
function botExtStats(
|
|
39
|
+
StrategyData memory strategyData
|
|
40
|
+
)
|
|
41
|
+
external
|
|
42
|
+
view
|
|
43
|
+
returns (uint256 tvlInSy, uint256 iy, uint256 currentSyRatio, uint256 currentYtPtRatio);
|
|
44
|
+
|
|
45
|
+
function searchForBotParam(
|
|
46
|
+
StrategyData memory strategyData,
|
|
47
|
+
ActionType action,
|
|
48
|
+
uint256 targetIy,
|
|
49
|
+
uint256 rebalanceAdditionalCheck,
|
|
50
|
+
ApproxParams memory botParams,
|
|
51
|
+
ApproxParams memory intParams
|
|
52
|
+
) external view returns (uint256);
|
|
53
|
+
|
|
54
|
+
function getFloatingSyAmount(address botAddress) external returns (uint256 floatingSyAmount);
|
|
55
|
+
|
|
56
|
+
function getActionDetails(address botAddress) external returns (ActionToTakeResult memory res);
|
|
57
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
pragma solidity 0.8.17;
|
|
3
|
+
|
|
4
|
+
import "./IBotDecisionHelper.sol";
|
|
5
|
+
|
|
6
|
+
interface ILongYieldDecisionHelper is IBotDecisionHelper {
|
|
7
|
+
function getAvailableZpiAmount(address botAddress) external returns (uint256 amountSyToZpi);
|
|
8
|
+
}
|