@pendle/core-v2 2.20.0 → 2.21.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/ExcessivelySafeCall.sol/ExcessivelySafeCall.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/libraries/LayerZeroHelper.sol/LayerZeroHelper.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/libraries/LayerZeroHelper.sol/LayerZeroHelper.json +2 -2
- package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerBaseUpg.sol/PendleGaugeControllerBaseUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerMainchainUpg.sol/PendleGaugeControllerMainchainUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerMainchainUpg.sol/PendleGaugeControllerMainchainUpg.json +2 -2
- package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerSidechainUpg.sol/PendleGaugeControllerSidechainUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerSidechainUpg.sol/PendleGaugeControllerSidechainUpg.json +2 -2
- package/build/artifacts/contracts/LiquidityMining/VeDistributor/PendleFeeDistributor.sol/PendleFeeDistributor.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/VeDistributor/PendleFeeDistributor.sol/PendleFeeDistributor.json +2 -2
- package/build/artifacts/contracts/LiquidityMining/VeDistributor/PendleFeeDistributorV2.sol/PendleFeeDistributorV2.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/VeDistributor/PendleFeeDistributorV2.sol/PendleFeeDistributorV2.json +2 -2
- package/build/artifacts/contracts/LiquidityMining/VotingController/PendleVotingControllerUpg.sol/PendleVotingControllerUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/VotingController/PendleVotingControllerUpg.sol/PendleVotingControllerUpg.json +2 -2
- package/build/artifacts/contracts/LiquidityMining/VotingController/VotingControllerStorageUpg.sol/VotingControllerStorageUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol/VotingEscrowPendleMainchain.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol/VotingEscrowPendleMainchain.json +2 -2
- package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowPendleSidechain.sol/VotingEscrowPendleSidechain.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowPendleSidechain.sol/VotingEscrowPendleSidechain.json +2 -2
- package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowTokenBase.sol/VotingEscrowTokenBase.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/libraries/VeBalanceLib.sol/VeBalanceLib.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/libraries/VeBalanceLib.sol/VeBalanceLib.json +2 -2
- package/build/artifacts/contracts/LiquidityMining/libraries/VeHistoryLib.sol/CheckpointHelper.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/libraries/VeHistoryLib.sol/CheckpointHelper.json +2 -2
- package/build/artifacts/contracts/LiquidityMining/libraries/VeHistoryLib.sol/Checkpoints.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/libraries/VeHistoryLib.sol/Checkpoints.json +2 -2
- package/build/artifacts/contracts/LiquidityMining/libraries/WeekMath.sol/WeekMath.dbg.json +1 -1
- package/build/artifacts/contracts/core/BulkSeller/BulkSeller.sol/BulkSeller.dbg.json +1 -1
- package/build/artifacts/contracts/core/BulkSeller/BulkSeller.sol/BulkSeller.json +2 -2
- package/build/artifacts/contracts/core/BulkSeller/BulkSellerFactory.sol/BulkSellerFactory.dbg.json +1 -1
- package/build/artifacts/contracts/core/BulkSeller/BulkSellerFactory.sol/BulkSellerFactory.json +2 -2
- package/build/artifacts/contracts/core/BulkSeller/BulkSellerMathCore.sol/BulkSellerMathCore.dbg.json +1 -1
- package/build/artifacts/contracts/core/BulkSeller/BulkSellerMathCore.sol/BulkSellerMathCore.json +2 -2
- package/build/artifacts/contracts/core/Market/MarketMathCore.sol/MarketMathCore.dbg.json +1 -1
- package/build/artifacts/contracts/core/Market/MarketMathCore.sol/MarketMathCore.json +2 -2
- package/build/artifacts/contracts/core/Market/OracleLib.sol/OracleLib.dbg.json +1 -1
- package/build/artifacts/contracts/core/Market/OracleLib.sol/OracleLib.json +2 -2
- package/build/artifacts/contracts/core/Market/PendleGauge.sol/PendleGauge.dbg.json +1 -1
- package/build/artifacts/contracts/core/Market/PendleGauge.sol/PendleGauge.json +0 -19
- package/build/artifacts/contracts/core/Market/PendleMarket.sol/PendleMarket.dbg.json +1 -1
- package/build/artifacts/contracts/core/Market/PendleMarket.sol/PendleMarket.json +2 -21
- 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/PYIndex.sol/PYIndexLib.json +2 -2
- package/build/artifacts/contracts/core/StandardizedYield/SYBase.sol/SYBase.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/SYBaseWithRewards.sol/SYBaseWithRewards.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/SYUtils.sol/SYUtils.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/StEthHelper.sol/StEthHelper.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Ape/sAPE.sol/sAPE.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Ape/sAPE.sol/sAPE.json +2 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraBbAWethSwethSY.sol/PendleAuraBbAWethSwethSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraBbAWethSwethSY.sol/PendleAuraBbAWethSwethSY.json +2 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWethAnkrethSYV2.sol/PendleAuraWethAnkrethSYV2.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWethAnkrethSYV2.sol/PendleAuraWethAnkrethSYV2.json +2 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWethRocketEthSYV2.sol/PendleAuraWethRocketEthSYV2.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWethRocketEthSYV2.sol/PendleAuraWethRocketEthSYV2.json +2 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWethStafiEthSY.sol/PendleAuraWethStafiEthSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWethStafiEthSY.sol/PendleAuraWethStafiEthSY.json +2 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWethWstethSYV2.sol/PendleAuraWethWstethSYV2.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWethWstethSYV2.sol/PendleAuraWethWstethSYV2.json +2 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/ComposableStable/ComposableStableMath.sol/ComposableStableMath.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/ComposableStable/ComposableStablePreview.sol/ComposableStablePreview.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/FixedPoint.sol/FixedPoint.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/Linear/BbAPoolHelper.sol/BbAPoolHelper.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/Linear/BbAPoolHelper.sol/BbAWethHelper.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/Linear/LinearMath.sol/LinearMath.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/Linear/LinearPreview.sol/LinearPreview.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/MetaStable/MetaStableMath.sol/MetaStableMath.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/MetaStable/MetaStablePreview.sol/MetaStablePreview.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/PendleAuraBalancerStableLPSYV2.sol/PendleAuraBalancerStableLPSYV2.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/StablePoolUserData.sol/StablePoolUserData.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/StablePreviewBase.sol/StablePreviewBase.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BenQi/PendleQiTokenHelper.sol/PendleQiTokenHelper.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BenQi/PendleQiTokenHelper.sol/PendleQiTokenHelper.json +2 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BenQi/PendleQiTokenSY.sol/PendleQiTokenSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BenQi/PendleQiTokenSY.sol/PendleQiTokenSY.json +2 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/CamelotV1Volatile/CamelotRewardHelper.sol/CamelotRewardHelper.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/CamelotV1Volatile/CamelotV1VolatileCommon.sol/CamelotV1VolatileCommon.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/CamelotV1Volatile/CamelotV1VolatileLpHelper.sol/CamelotV1VolatileLpHelper.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/CamelotV1Volatile/CamelotV1VolatilePreview.sol/CamelotV1VolatilePreview.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/CamelotV1Volatile/PendleCamelotV1VolatileSY.sol/PendleCamelotV1VolatileSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/CamelotV1Volatile/PendleCamelotV1VolatileSY.sol/PendleCamelotV1VolatileSY.json +2 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/PendleCurveFraxUsdcSY.sol/PendleCurveFraxUsdcSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/PendleCurveFraxUsdcSY.sol/PendleCurveFraxUsdcSY.json +2 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/PendleCurveUsdd3CrvSY.sol/PendleCurveUsdd3CrvSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/PendleCurveUsdd3CrvSY.sol/PendleCurveUsdd3CrvSY.json +2 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/Curve3CrvPoolHelper.sol/Curve3CrvPoolHelper.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/CurveFraxUsdcPoolHelper.sol/CurveFraxUsdcPoolHelper.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/CurveUsdd3CrvPoolHelper.sol/CurveUsdd3CrvPoolHelper.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/PendleConvexLPSY.sol/PendleConvexLPSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/GLP/GLPPreviewHelper.sol/GLPPreviewHelper.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/GLP/PendleGlpSY.sol/PendleGlpSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/GLP/PendleGlpSY.sol/PendleGlpSY.json +2 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleGdaiSY.sol/PendleGDaiSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleGdaiSY.sol/PendleGDaiSY.json +2 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleLooksStakingSY.sol/PendleLooksStakingSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleLooksStakingSY.sol/PendleLooksStakingSY.json +2 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleSfrxEthSY.sol/PendleSfrxEthSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleSfrxEthSY.sol/PendleSfrxEthSY.json +2 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleStargateLPSY.sol/PendleStargateLPSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleStargateLPSY.sol/PendleStargateLPSY.json +2 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleWstEthSY.sol/PendleWstEthSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleWstEthSY.sol/PendleWstEthSY.json +2 -2
- package/build/artifacts/contracts/core/TradingBot/DecisionHelper/BotDecisionHelperBase.sol/BotDecisionHelperBase.dbg.json +4 -0
- package/build/artifacts/contracts/core/TradingBot/DecisionHelper/BotDecisionHelperBase.sol/BotDecisionHelperBase.json +816 -0
- package/build/artifacts/contracts/core/TradingBot/DecisionHelper/LongYieldDecisionHelper.sol/LongYieldDecisionHelper.dbg.json +4 -0
- package/build/artifacts/contracts/core/TradingBot/DecisionHelper/LongYieldDecisionHelper.sol/LongYieldDecisionHelper.json +1411 -0
- package/build/artifacts/contracts/core/TradingBot/LongYieldTradingBot.sol/LongYieldTradingBot.dbg.json +4 -0
- package/build/artifacts/contracts/core/TradingBot/LongYieldTradingBot.sol/LongYieldTradingBot.json +2240 -0
- package/build/artifacts/contracts/core/TradingBot/TradingBotBase.sol/TradingBotBase.dbg.json +4 -0
- package/build/artifacts/contracts/core/TradingBot/TradingBotBase.sol/TradingBotBase.json +1641 -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/LongYieldActionLib.sol/LongYieldActionLib.dbg.json +4 -0
- package/build/artifacts/contracts/core/TradingBot/libraries/LongYieldActionLib.sol/LongYieldActionLib.json +154 -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/TradingBot/libraries/TvlLib.sol/TvlLib.dbg.json +4 -0
- package/build/artifacts/contracts/core/TradingBot/libraries/TvlLib.sol/TvlLib.json +262 -0
- package/build/artifacts/contracts/core/YieldContracts/InterestManagerYT.sol/InterestManagerYT.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContracts/PendlePrincipalToken.sol/PendlePrincipalToken.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContracts/PendlePrincipalToken.sol/PendlePrincipalToken.json +2 -2
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldContractFactory.sol/PendleYieldContractFactory.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldContractFactory.sol/PendleYieldContractFactory.json +2 -2
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldToken.sol/PendleYieldToken.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldToken.sol/PendleYieldToken.json +2 -2
- package/build/artifacts/contracts/core/YieldContractsV2/InterestManagerYTV2.sol/InterestManagerYTV2.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContractsV2/PendlePrincipalTokenV2.sol/PendlePrincipalTokenV2.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContractsV2/PendlePrincipalTokenV2.sol/PendlePrincipalTokenV2.json +2 -2
- package/build/artifacts/contracts/core/YieldContractsV2/PendleYieldContractFactoryV2.sol/PendleYieldContractFactoryV2.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContractsV2/PendleYieldContractFactoryV2.sol/PendleYieldContractFactoryV2.json +2 -2
- package/build/artifacts/contracts/core/YieldContractsV2/PendleYieldTokenV2.sol/PendleYieldTokenV2.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContractsV2/PendleYieldTokenV2.sol/PendleYieldTokenV2.json +2 -2
- package/build/artifacts/contracts/core/erc20/PendleERC20.sol/PendleERC20.dbg.json +1 -1
- package/build/artifacts/contracts/core/erc20/PendleERC20Permit.sol/PendleERC20Permit.dbg.json +1 -1
- package/build/artifacts/contracts/core/libraries/ArrayLib.sol/ArrayLib.dbg.json +1 -1
- package/build/artifacts/contracts/core/libraries/BaseSplitCodeFactory.sol/BaseSplitCodeFactory.dbg.json +1 -1
- package/build/artifacts/contracts/core/libraries/BaseSplitCodeFactory.sol/CodeDeployer.dbg.json +1 -1
- package/build/artifacts/contracts/core/libraries/BoringOwnableUpgradeable.sol/BoringOwnableUpgradeable.dbg.json +1 -1
- package/build/artifacts/contracts/core/libraries/BoringOwnableUpgradeable.sol/BoringOwnableUpgradeableData.dbg.json +1 -1
- package/build/artifacts/contracts/core/libraries/Errors.sol/Errors.dbg.json +1 -1
- package/build/artifacts/contracts/core/libraries/Errors.sol/Errors.json +151 -2
- package/build/artifacts/contracts/core/libraries/ExpiryUtilsLib.sol/ExpiryUtils.dbg.json +1 -1
- package/build/artifacts/contracts/core/libraries/MiniHelpers.sol/MiniHelpers.dbg.json +1 -1
- package/build/artifacts/contracts/core/libraries/StringLib.sol/StringLib.dbg.json +1 -1
- package/build/artifacts/contracts/core/libraries/TokenAmountLib.sol/TokenAmountLib.dbg.json +4 -0
- package/build/artifacts/contracts/core/libraries/TokenAmountLib.sol/TokenAmountLib.json +10 -0
- package/build/artifacts/contracts/core/libraries/TokenHelper.sol/TokenHelper.dbg.json +1 -1
- package/build/artifacts/contracts/core/libraries/math/LogExpMath.sol/LogExpMath.dbg.json +1 -1
- package/build/artifacts/contracts/core/libraries/math/Math.sol/Math.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Balancer/IAsset.sol/IAsset.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Balancer/IBalancerFees.sol/IBalancerFees.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Balancer/IBalancerStablePreview.sol/IBalancerStablePreview.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Balancer/IBasePool.sol/IBasePool.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Balancer/IComposableStable.sol/IComposableStable.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Balancer/IERC4626LinearPool.sol/IERC4626LinearPool.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Balancer/IGauge.sol/IGauge.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Balancer/ILiquidityGaugeFactory.sol/ILiquidityGaugeFactory.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Balancer/IMetaStablePool.sol/IMetaStablePool.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Balancer/IRateProvider.sol/IRateProvider.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Balancer/IVault.sol/IVault.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Camelot/ICamelotFactory.sol/ICamelotFactory.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Camelot/ICamelotNFTFactory.sol/ICamelotNFTFactory.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Camelot/ICamelotNFTHandler.sol/ICamelotNFTHandler.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Camelot/ICamelotNFTPool.sol/ICamelotNFTPool.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Camelot/ICamelotNitroPool.sol/ICamelotNitroPool.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Camelot/ICamelotNitroPoolFactory.sol/ICamelotNitroPoolFactory.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Camelot/ICamelotPair.sol/ICamelotPair.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Camelot/ICamelotRouter.sol/ICamelotRouter.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Camelot/ICamelotYieldBooster.sol/ICamelotYieldBooster.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Camelot/IXGrail.sol/IXGrail.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/ConvexCurve/IBooster.sol/IBooster.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/ConvexCurve/ICrvDepositor.sol/ICrvDepositor.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/ConvexCurve/ICvxCrv.sol/ICvxCrv.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/ConvexCurve/IRewards.sol/IRewards.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Curve/ICrvPool.sol/ICrvPool.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Curve/ITriCrvPool.sol/ITriCrvPool.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Frax/IFrxEthMinter.sol/IFrxEthMinter.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/GMX/IGMXVault.sol/IGMXVault.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/GMX/IGlpManager.sol/IGlpManager.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/GMX/IRewardRouterV2.sol/IRewardRouterV2.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/GMX/IVaultPriceFeed.sol/IVaultPriceFeed.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IAddressProvider.sol/IAddressProvider.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IApeStaking.sol/IApeStaking.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IBenQiComptroller.sol/IBenQiComptroller.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IBenQiInterestRateModel.sol/IBenQiInterestRateModel.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IDiamondCut.sol/IDiamondCut.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IDiamondLoupe.sol/IDiamondLoupe.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IERC4626.sol/IERC4626.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/ILayerZeroEndpoint.sol/ILayerZeroEndpoint.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/ILayerZeroReceiver.sol/ILayerZeroReceiver.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/ILooksFeeSharing.sol/ILooksFeeSharing.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/ILooksStaking.sol/ILooksStaking.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionAddRemoveLiq.sol/IPActionAddRemoveLiq.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionInfoStatic.sol/IPActionInfoStatic.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionMarketAuxStatic.sol/IPActionMarketAuxStatic.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionMarketAuxStatic.sol/IPActionMarketAuxStatic.json +6 -82
- package/build/artifacts/contracts/interfaces/IPActionMarketCoreStatic.sol/IPActionMarketCoreStatic.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionMarketCoreStatic.sol/IPActionMarketCoreStatic.json +22 -22
- 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/IPActionMintRedeemStatic.sol/IPActionMintRedeemStatic.json +4 -42
- package/build/artifacts/contracts/interfaces/IPActionMisc.sol/IPActionMisc.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionStorageStatic.sol/IPActionStorageStatic.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionSwapPT.sol/IPActionSwapPT.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionSwapYT.sol/IPActionSwapYT.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionVePendleStatic.sol/IPActionVePendleStatic.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPAllAction.sol/IPAllAction.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPBulkSeller.sol/IPBulkSeller.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPBulkSellerFactory.sol/IPBulkSellerFactory.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPBulkSellerSYCallback.sol/IPBulkSellerCallback.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPFeeDistributor.sol/IPFeeDistributor.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPFeeDistributorV2.sol/IPFeeDistributorV2.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPGauge.sol/IPGauge.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPGauge.sol/IPGauge.json +0 -19
- package/build/artifacts/contracts/interfaces/IPGaugeController.sol/IPGaugeController.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPGaugeControllerMainchain.sol/IPGaugeControllerMainchain.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPInterestManagerYT.sol/IPInterestManagerYT.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPInterestManagerYTV2.sol/IPInterestManagerYTV2.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPMarket.sol/IPMarket.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPMarket.sol/IPMarket.json +0 -19
- package/build/artifacts/contracts/interfaces/IPMarketFactory.sol/IPMarketFactory.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPMarketSwapCallback.sol/IPMarketSwapCallback.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPMiniDiamond.sol/IPMiniDiamond.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPMsgReceiverApp.sol/IPMsgReceiverApp.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPMsgSendEndpoint.sol/IPMsgSendEndpoint.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPPrincipalToken.sol/IPPrincipalToken.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPPtOracle.sol/IPPtOracle.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPRouterHelper.sol/IPRouterHelper.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPRouterStatic.sol/IPRouterStatic.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPRouterStatic.sol/IPRouterStatic.json +32 -146
- package/build/artifacts/contracts/interfaces/IPVeToken.sol/IPVeToken.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPVotingController.sol/IPVotingController.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPVotingEscrowMainchain.sol/IPVotingEscrowMainchain.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPYieldContractFactory.sol/IPYieldContractFactory.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPYieldToken.sol/IPYieldToken.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPYieldTokenV2.sol/IPYieldTokenV2.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IQiAvax.sol/IQiAvax.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IQiErc20.sol/IQiErc20.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IQiToken.sol/IQiToken.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IRewardManager.sol/IRewardManager.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IStETH.sol/IStETH.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IStandardizedYield.sol/IStandardizedYield.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IStargateLP.sol/IStargateLP.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IStargateRouter.sol/IStargateRouter.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IStargateStaking.sol/IStargateStaking.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IWETH.sol/IWETH.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IWstETH.sol/IWstETH.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/TradingBot/IBotDecisionHelper.sol/IBotDecisionHelper.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/TradingBot/IBotDecisionHelper.sol/IBotDecisionHelper.json +679 -0
- package/build/artifacts/contracts/interfaces/TradingBot/ILongYieldDecisionHelper.sol/ILongYieldDecisionHelper.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/TradingBot/ILongYieldDecisionHelper.sol/ILongYieldDecisionHelper.json +698 -0
- package/build/artifacts/contracts/interfaces/TradingBot/ILongYieldTradingBot.sol/ILongYieldTradingBot.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/TradingBot/ILongYieldTradingBot.sol/ILongYieldTradingBot.json +745 -0
- package/build/artifacts/contracts/interfaces/TradingBot/IShortYieldDecisionHelper.sol/IShortYieldDecisionHelper.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/TradingBot/IShortYieldDecisionHelper.sol/IShortYieldDecisionHelper.json +679 -0
- package/build/artifacts/contracts/interfaces/TradingBot/IShortYieldTradingBot.sol/IShortYieldTradingBot.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/TradingBot/IShortYieldTradingBot.sol/IShortYieldTradingBot.json +794 -0
- package/build/artifacts/contracts/interfaces/TradingBot/ITradingBotBase.sol/ITradingBotBase.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/TradingBot/ITradingBotBase.sol/ITradingBotBase.json +351 -0
- package/build/artifacts/contracts/offchain-helpers/AddressProvider.sol/AddressProvider.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/BaseSplitCodeFactoryContract.sol/BaseSplitCodeFactoryContract.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/BoringLpSeller.sol/BoringLpSeller.dbg.json +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/Broadcaster.sol/Broadcaster.json +2 -2
- package/build/artifacts/contracts/offchain-helpers/BulkSellerOffchain.sol/BulkSellerOffchain.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/BulkSellerOffchain.sol/BulkSellerOffchain.json +2 -2
- package/build/artifacts/contracts/offchain-helpers/EmptyUUPS.sol/EmptyUUPS.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/MarketExchangeRateLib.sol/MarketExchangeRateLib.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/MarketExchangeRateLib.sol/MarketExchangeRateLib.json +2 -2
- package/build/artifacts/contracts/offchain-helpers/Multicall2.sol/Multicall2.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/PendleMulticallV1.sol/PendleMulticallV1.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/router-static/PendleRouterStatic.sol/PendleRouterStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/router-static/PendleRouterStatic.sol/PendleRouterStatic.json +2 -2
- package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionInfoStatic.sol/ActionInfoStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionInfoStatic.sol/ActionInfoStatic.json +2 -2
- package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionMarketAuxStatic.sol/ActionMarketAuxStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionMarketAuxStatic.sol/ActionMarketAuxStatic.json +8 -84
- 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 +24 -24
- 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 +6 -44
- 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 +1 -1
- package/build/artifacts/contracts/oracles/samples/PendleLpGlpOracle.sol/PendleLpGlpOracle.json +2 -2
- package/build/artifacts/contracts/oracles/samples/PendlePtGlpOracle.sol/PendlePtGlpOracle.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/samples/PendlePtGlpOracle.sol/PendlePtGlpOracle.json +2 -2
- package/build/artifacts/contracts/oracles/samples/PendlePtUsdChainlinkOracle.sol/PendlePtUsdChainlinkOracle.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionAddRemoveLiq.sol/ActionAddRemoveLiq.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionAddRemoveLiq.sol/ActionAddRemoveLiq.json +2 -2
- package/build/artifacts/contracts/router/ActionMintRedeem.sol/ActionMintRedeem.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionMintRedeem.sol/ActionMintRedeem.json +2 -2
- package/build/artifacts/contracts/router/ActionMisc.sol/ActionMisc.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionSwapPT.sol/ActionSwapPT.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionSwapPT.sol/ActionSwapPT.json +2 -2
- package/build/artifacts/contracts/router/ActionSwapYT.sol/ActionSwapYT.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionSwapYT.sol/ActionSwapYT.json +2 -2
- package/build/artifacts/contracts/router/PendleRouter.sol/PendleRouter.dbg.json +1 -1
- package/build/artifacts/contracts/router/PendleRouter.sol/PendleRouter.json +2 -2
- package/build/artifacts/contracts/router/PendleRouterHelper.sol/PendleRouterHelper.dbg.json +1 -1
- package/build/artifacts/contracts/router/PendleRouterHelper.sol/PendleRouterHelper.json +2 -2
- package/build/artifacts/contracts/router/base/ActionBaseCallback.sol/ActionBaseCallback.dbg.json +1 -1
- package/build/artifacts/contracts/router/base/ActionBaseMintRedeem.sol/ActionBaseMintRedeem.dbg.json +1 -1
- package/build/artifacts/contracts/router/base/CallbackHelper.sol/CallbackHelper.dbg.json +1 -1
- package/build/artifacts/contracts/router/base/MarketApproxLib.sol/MarketApproxPtInLib.dbg.json +1 -1
- package/build/artifacts/contracts/router/base/MarketApproxLib.sol/MarketApproxPtInLib.json +2 -2
- package/build/artifacts/contracts/router/base/MarketApproxLib.sol/MarketApproxPtOutLib.dbg.json +1 -1
- package/build/artifacts/contracts/router/base/MarketApproxLib.sol/MarketApproxPtOutLib.json +2 -2
- package/build/artifacts/contracts/router/swap-aggregator/IPSwapAggregator.sol/IPSwapAggregator.dbg.json +1 -1
- package/build/artifacts/contracts/router/swap-aggregator/PendleSwap.sol/PendleSwap.dbg.json +1 -1
- package/build/artifacts/contracts/router/swap-aggregator/kyberswap/IAggregationExecutor.sol/IAggregationExecutor.dbg.json +1 -1
- package/build/artifacts/contracts/router/swap-aggregator/kyberswap/IExecutorHelper.sol/IExecutorHelper.dbg.json +1 -1
- package/build/artifacts/contracts/router/swap-aggregator/kyberswap/IHashflow.sol/IHashflow.dbg.json +1 -1
- package/build/artifacts/contracts/router/swap-aggregator/kyberswap/IMetaAggregationRouterV2.sol/IMetaAggregationRouterV2.dbg.json +1 -1
- package/build/artifacts/contracts/router/swap-aggregator/kyberswap/KyberInputScalingHelper.sol/KyberInputScalingHelper.dbg.json +1 -1
- package/build/artifacts/contracts/router/swap-aggregator/kyberswap/ScalingDataLib.sol/ScalingDataLib.dbg.json +1 -1
- package/contracts/LiquidityMining/CrossChainMsg/libraries/LayerZeroHelper.sol +0 -4
- package/contracts/core/Market/PendleGauge.sol +2 -3
- package/contracts/core/StandardizedYield/PYIndex.sol +14 -0
- package/contracts/core/TradingBot/DecisionHelper/BotDecisionHelperBase.sol +265 -0
- package/contracts/core/TradingBot/DecisionHelper/LongYieldDecisionHelper.sol +333 -0
- package/contracts/core/TradingBot/LongYieldTradingBot.sol +144 -0
- package/contracts/core/TradingBot/TradingBotBase.sol +253 -0
- package/contracts/core/TradingBot/libraries/BotSimulationLib.sol +99 -0
- package/contracts/core/TradingBot/libraries/LongYieldActionLib.sol +308 -0
- package/contracts/core/TradingBot/libraries/MarketExtLib.sol +272 -0
- package/contracts/core/TradingBot/libraries/SpecSegmentLib.sol +78 -0
- package/contracts/core/TradingBot/libraries/TvlLib.sol +69 -0
- package/contracts/core/libraries/Errors.sol +12 -0
- package/contracts/core/libraries/TokenAmountLib.sol +47 -0
- package/contracts/interfaces/IPActionInfoStatic.sol +7 -8
- package/contracts/interfaces/IPActionMarketAuxStatic.sol +14 -21
- package/contracts/interfaces/IPActionMarketCoreStatic.sol +67 -70
- package/contracts/interfaces/IPActionMintRedeemStatic.sol +11 -23
- package/contracts/interfaces/IPGauge.sol +0 -3
- package/contracts/interfaces/IPRouterStatic.sol +1 -5
- package/contracts/interfaces/IStandardizedYield.sol +10 -15
- package/contracts/interfaces/TradingBot/IBotDecisionHelper.sol +76 -0
- package/contracts/interfaces/TradingBot/ILongYieldDecisionHelper.sol +8 -0
- package/contracts/interfaces/TradingBot/ILongYieldTradingBot.sol +74 -0
- package/contracts/interfaces/TradingBot/IShortYieldDecisionHelper.sol +7 -0
- package/contracts/interfaces/TradingBot/IShortYieldTradingBot.sol +27 -0
- package/contracts/interfaces/TradingBot/ITradingBotBase.sol +54 -0
- package/contracts/offchain-helpers/BulkSellerOffchain.sol +8 -11
- package/contracts/offchain-helpers/router-static/base/ActionInfoStatic.sol +11 -14
- package/contracts/offchain-helpers/router-static/base/ActionMarketAuxStatic.sol +37 -96
- package/contracts/offchain-helpers/router-static/base/ActionMarketCoreStatic.sol +80 -88
- package/contracts/offchain-helpers/router-static/base/ActionMintRedeemStatic.sol +14 -43
- package/contracts/oracles/PendleLpOracleLib.sol +1 -1
- package/deployments/core.ts +29 -0
- package/deployments/index.ts +4 -0
- package/deployments/markets/ape-june-29-2023.ts +3 -0
- package/deployments/markets/balancer-reth-dec-28-2023.ts +3 -0
- package/deployments/markets/balancer-wsteth-jun-27-2024.ts +3 -0
- package/deployments/markets/curve-fraxusdc-march-30-2023.ts +3 -0
- package/deployments/markets/index.ts +17 -0
- package/deployments/markets/looks-march-30-2023.ts +3 -0
- package/deployments/markets/steth-june-29-2023.ts +3 -0
- package/deployments/markets/steth-march-30-2023.ts +3 -0
- package/deployments/markets/types.ts +9 -0
- package/deployments/misc.ts +23 -0
- package/package.json +1 -1
- package/typechain-types/ActionMarketAuxStatic.ts +38 -191
- package/typechain-types/ActionMarketCoreStatic.ts +134 -600
- package/typechain-types/ActionMintRedeemStatic.ts +26 -92
- package/typechain-types/AuraEthxBbAWethSY.ts +1532 -0
- package/typechain-types/AuraSwEthBbAWethSYV2.ts +1532 -0
- package/typechain-types/AutomateReady.ts +102 -0
- package/typechain-types/AutomationBase.ts +57 -0
- package/typechain-types/AutomationCompatible.ts +140 -0
- package/typechain-types/AutomationCompatibleInterface.ts +141 -0
- package/typechain-types/BotDecisionHelperBase.ts +508 -0
- package/typechain-types/ChainlinkRelayerAutomation.ts +305 -0
- package/typechain-types/ChainlinkRelayerGelato.ts +311 -0
- package/typechain-types/ComposableStablePreviewProxy.ts +352 -0
- package/typechain-types/ComposableStablePreviewV4.ts +217 -0
- package/typechain-types/ComposableStablePreviewV5.ts +217 -0
- package/typechain-types/{CamelotV1Preview.ts → HLPPricingHelper.ts} +50 -84
- package/typechain-types/IAnkrBNB.ts +150 -0
- package/typechain-types/IAnkrLiquidStaking.ts +253 -0
- package/typechain-types/IAutomate.ts +203 -0
- package/typechain-types/IBotDecisionHelper.ts +208 -239
- package/typechain-types/IEUSD.ts +194 -0
- package/typechain-types/IFluxErc20.ts +298 -0
- package/typechain-types/IFluxInterestRateModel.ts +113 -0
- package/typechain-types/IHLPStaking.ts +154 -0
- package/typechain-types/IHMXCalculator.ts +96 -0
- package/typechain-types/IHMXCompounder.ts +122 -0
- package/typechain-types/IHMXStaking.ts +165 -0
- package/typechain-types/IHMXVester.ts +163 -0
- package/typechain-types/IInterestUSTP.ts +156 -0
- package/typechain-types/IKyberElasticFactory.ts +734 -0
- package/typechain-types/IKyberElasticPool.ts +514 -0
- package/typechain-types/IKyberElasticRouter.ts +315 -0
- package/typechain-types/IKyberLiquidityMining.ts +968 -0
- package/typechain-types/IKyberMathHelper.ts +231 -0
- package/typechain-types/IKyberPositionManager.ts +773 -0
- package/typechain-types/ILongYieldDecisionHelper.ts +512 -0
- package/typechain-types/ILongYieldTradingBot.ts +197 -502
- package/typechain-types/IOpsProxyFactory.ts +93 -0
- package/typechain-types/IPActionMarketAuxStatic.ts +38 -191
- package/typechain-types/IPActionMarketCoreStatic.ts +134 -600
- package/typechain-types/IPActionMintRedeemStatic.ts +26 -92
- package/typechain-types/IPComposableStablePreview.ts +217 -0
- package/typechain-types/IPExternalRewardDistributor.ts +198 -0
- package/typechain-types/IPGauge.ts +3 -23
- package/typechain-types/IPMarket.ts +0 -18
- package/typechain-types/IPMarketFactoryV2.ts +253 -0
- package/typechain-types/{ICamelotSY.ts → IPOracleForSy.ts} +13 -26
- package/typechain-types/IPRouterStatic.ts +197 -888
- package/typechain-types/IRebasingUSTP.ts +133 -0
- package/typechain-types/IShortYieldDecisionHelper.ts +476 -0
- package/typechain-types/IShortYieldTradingBot.ts +574 -0
- package/typechain-types/IStaderStakeManager.ts +700 -0
- package/typechain-types/{IExecutorHelper2.ts → ISwETH.ts} +40 -32
- package/typechain-types/ITaskTreasuryUpgradable.ts +160 -0
- package/typechain-types/ITradingBotBase.ts +97 -247
- package/typechain-types/IUSTP.ts +127 -0
- package/typechain-types/IVersion.ts +81 -0
- package/typechain-types/KyberMathHelper.ts +583 -0
- package/typechain-types/KyberNftManagerBase.ts +364 -0
- package/typechain-types/LegacyNFTHelper.ts +87 -0
- package/typechain-types/LongYieldActionLib.ts +57 -0
- package/typechain-types/LongYieldDecisionHelper.ts +663 -0
- package/typechain-types/LongYieldTradingBot.ts +1374 -437
- package/typechain-types/PendleAnkrBNBSY.ts +1235 -0
- package/typechain-types/PendleAuraWethVethSY.ts +1511 -0
- package/typechain-types/PendleAuraWstethAnkreth.ts +1511 -0
- package/typechain-types/PendleBridgedLSDSY.ts +1222 -0
- package/typechain-types/PendleChainlinkReceiver.ts +239 -0
- package/typechain-types/PendleChainlinkRelayer.ts +158 -0
- package/typechain-types/{PendleBinanceEth.ts → PendleERC4626SY.ts} +18 -31
- package/typechain-types/PendleETHXSY.ts +1231 -0
- package/typechain-types/PendleEUSDSY.ts +1216 -0
- package/typechain-types/PendleExternalRewardDistributor.ts +596 -0
- package/typechain-types/PendleFluxLendingSY.ts +1232 -0
- package/typechain-types/PendleGauge.ts +3 -23
- package/typechain-types/PendleGaugeV2.ts +225 -0
- package/typechain-types/PendleHlpSY.ts +1517 -0
- package/typechain-types/PendleIUSTPSY.ts +1255 -0
- package/typechain-types/{PendleCamelotV1SY.ts → PendleKyberElasticSY.ts} +385 -516
- package/typechain-types/PendleMantleStakedEthSY.ts +1222 -0
- package/typechain-types/PendleMarket.ts +0 -18
- package/typechain-types/PendleMarketFactoryV2.ts +932 -0
- package/typechain-types/PendleMarketV2.ts +1311 -0
- package/typechain-types/PendleMulticallV2.ts +241 -0
- package/typechain-types/PendleOracleForSyProxy.ts +275 -0
- package/typechain-types/SDKErrorsDirectory.ts +57 -0
- package/typechain-types/StarNFTV1.ts +880 -0
- package/typechain-types/SwETHSY.ts +1216 -0
- package/typechain-types/TradingBotBase.ts +1275 -157
- package/typechain-types/TvlLib.ts +215 -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 +7 -83
- package/typechain-types/factories/ActionMarketCoreStatic__factory.ts +23 -23
- package/typechain-types/factories/ActionMintRedeemStatic__factory.ts +5 -43
- 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/AuraEthxBbAWethSY__factory.ts +1240 -0
- package/typechain-types/factories/AuraSwEthBbAWethSYV2__factory.ts +1244 -0
- package/typechain-types/factories/{ICamelotSY__factory.ts → AutomateReady__factory.ts} +9 -9
- package/typechain-types/factories/AutomationBase__factory.ts +69 -0
- package/typechain-types/factories/AutomationCompatibleInterface__factory.ts +67 -0
- package/typechain-types/factories/AutomationCompatible__factory.ts +72 -0
- package/typechain-types/factories/BotDecisionHelperBase__factory.ts +835 -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/ChainlinkRelayerAutomation__factory.ts +238 -0
- package/typechain-types/factories/ChainlinkRelayerGelato__factory.ts +263 -0
- package/typechain-types/factories/ComposableStablePreviewProxy__factory.ts +288 -0
- package/typechain-types/factories/ComposableStablePreviewV4__factory.ts +190 -0
- package/typechain-types/factories/ComposableStablePreviewV5__factory.ts +190 -0
- package/typechain-types/factories/Errors__factory.ts +150 -1
- package/typechain-types/factories/HLPPricingHelper__factory.ts +311 -0
- package/typechain-types/factories/IAnkrBNB__factory.ts +74 -0
- package/typechain-types/factories/IAnkrLiquidStaking__factory.ts +123 -0
- package/typechain-types/factories/IAutomate__factory.ts +126 -0
- package/typechain-types/factories/IBotDecisionHelper__factory.ts +377 -615
- package/typechain-types/factories/IEUSD__factory.ts +101 -0
- package/typechain-types/factories/IFluxErc20__factory.ts +178 -0
- package/typechain-types/factories/{IExecutorHelper2__factory.ts → IFluxInterestRateModel__factory.ts} +19 -15
- package/typechain-types/factories/IHLPStaking__factory.ts +67 -0
- package/typechain-types/factories/IHMXCalculator__factory.ts +45 -0
- package/typechain-types/factories/IHMXCompounder__factory.ts +59 -0
- package/typechain-types/factories/IHMXStaking__factory.ts +78 -0
- package/typechain-types/factories/IHMXVester__factory.ts +85 -0
- package/typechain-types/factories/IInterestUSTP__factory.ts +75 -0
- package/typechain-types/factories/IKyberElasticFactory__factory.ts +455 -0
- package/typechain-types/factories/IKyberElasticPool__factory.ts +315 -0
- package/typechain-types/factories/IKyberElasticRouter__factory.ts +240 -0
- package/typechain-types/factories/IKyberLiquidityMining__factory.ts +913 -0
- package/typechain-types/factories/IKyberMathHelper__factory.ts +143 -0
- package/typechain-types/factories/IKyberPositionManager__factory.ts +633 -0
- package/typechain-types/factories/ILongYieldDecisionHelper__factory.ts +717 -0
- package/typechain-types/factories/ILongYieldTradingBot__factory.ts +250 -658
- package/typechain-types/factories/IOpsProxyFactory__factory.ts +50 -0
- package/typechain-types/factories/IPActionMarketAuxStatic__factory.ts +6 -82
- package/typechain-types/factories/IPActionMarketCoreStatic__factory.ts +22 -22
- package/typechain-types/factories/IPActionMintRedeemStatic__factory.ts +4 -42
- package/typechain-types/factories/IPComposableStablePreview__factory.ts +152 -0
- package/typechain-types/factories/IPExternalRewardDistributor__factory.ts +128 -0
- package/typechain-types/factories/IPGauge__factory.ts +0 -19
- package/typechain-types/factories/IPMarketFactoryV2__factory.ts +181 -0
- package/typechain-types/factories/IPMarket__factory.ts +0 -19
- package/typechain-types/factories/IPOracleForSy__factory.ts +36 -0
- package/typechain-types/factories/IPRouterStatic__factory.ts +32 -146
- package/typechain-types/factories/IRebasingUSTP__factory.ts +49 -0
- package/typechain-types/factories/IShortYieldDecisionHelper__factory.ts +698 -0
- package/typechain-types/factories/IShortYieldTradingBot__factory.ts +813 -0
- package/typechain-types/factories/IStaderStakeManager__factory.ts +435 -0
- package/typechain-types/factories/ISwETH__factory.ts +53 -0
- package/typechain-types/factories/ITaskTreasuryUpgradable__factory.ts +76 -0
- package/typechain-types/factories/ITradingBotBase__factory.ts +138 -227
- package/typechain-types/factories/IUSTP__factory.ts +46 -0
- package/typechain-types/factories/IVersion__factory.ts +36 -0
- package/typechain-types/factories/KyberMathHelper__factory.ts +417 -0
- package/typechain-types/factories/KyberNftManagerBase__factory.ts +279 -0
- package/typechain-types/factories/LegacyNFTHelper__factory.ts +83 -0
- package/typechain-types/factories/LongYieldActionLib__factory.ts +207 -0
- package/typechain-types/factories/LongYieldDecisionHelper__factory.ts +1468 -0
- package/typechain-types/factories/LongYieldTradingBot__factory.ts +1153 -748
- package/typechain-types/factories/MarketExtLib__factory.ts +1 -1
- 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 +1 -1
- package/typechain-types/factories/PendleAuraBbAWethSwethSY__factory.ts +1 -1
- package/typechain-types/factories/PendleAuraWethAnkrethSYV2__factory.ts +1 -1
- package/typechain-types/factories/PendleAuraWethRocketEthSYV2__factory.ts +1 -1
- package/typechain-types/factories/PendleAuraWethStafiEthSY__factory.ts +1 -1
- package/typechain-types/factories/PendleAuraWethVethSY__factory.ts +1231 -0
- package/typechain-types/factories/PendleAuraWethWstethSYV2__factory.ts +1 -1
- package/typechain-types/factories/PendleAuraWstethAnkreth__factory.ts +1244 -0
- package/typechain-types/factories/PendleBridgedLSDSY__factory.ts +1064 -0
- package/typechain-types/factories/PendleCamelotV1VolatileSY__factory.ts +1 -1
- package/typechain-types/factories/PendleChainlinkReceiver__factory.ts +216 -0
- package/typechain-types/factories/PendleChainlinkRelayer__factory.ts +180 -0
- package/typechain-types/factories/PendleCurveFraxUsdcSY__factory.ts +1 -1
- package/typechain-types/factories/PendleCurveUsdd3CrvSY__factory.ts +1 -1
- package/typechain-types/factories/PendleERC4626SY__factory.ts +1030 -0
- package/typechain-types/factories/PendleETHXSY__factory.ts +1059 -0
- package/typechain-types/factories/PendleEUSDSY__factory.ts +1022 -0
- package/typechain-types/factories/PendleExternalRewardDistributor__factory.ts +437 -0
- package/typechain-types/factories/PendleFeeDistributorV2__factory.ts +1 -1
- package/typechain-types/factories/PendleFeeDistributor__factory.ts +1 -1
- package/typechain-types/factories/PendleFluxLendingSY__factory.ts +1049 -0
- 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/{CamelotV1LpHelper__factory.ts → PendleGaugeV2__factory.ts} +50 -53
- package/typechain-types/factories/PendleGauge__factory.ts +0 -19
- package/typechain-types/factories/PendleGlpSY__factory.ts +1 -1
- package/typechain-types/factories/PendleHlpSY__factory.ts +1283 -0
- package/typechain-types/factories/PendleIUSTPSY__factory.ts +1061 -0
- package/typechain-types/factories/PendleKyberElasticSY__factory.ts +1512 -0
- package/typechain-types/factories/PendleLooksStakingSY__factory.ts +1 -1
- package/typechain-types/factories/PendleLpGlpOracle__factory.ts +1 -1
- package/typechain-types/factories/PendleMantleStakedEthSY__factory.ts +1068 -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 +1299 -0
- package/typechain-types/factories/PendleMarket__factory.ts +1 -20
- package/typechain-types/factories/PendleMsgReceiveEndpointUpg__factory.ts +1 -1
- package/typechain-types/factories/PendleMsgSendEndpointUpg__factory.ts +1 -1
- package/typechain-types/factories/PendleMulticallV2__factory.ts +212 -0
- package/typechain-types/factories/PendleOracleForSyProxy__factory.ts +211 -0
- package/typechain-types/factories/PendlePrincipalTokenV2__factory.ts +1 -1
- package/typechain-types/factories/PendlePrincipalToken__factory.ts +1 -1
- package/typechain-types/factories/PendlePtGlpOracle__factory.ts +1 -1
- package/typechain-types/factories/PendlePtOracle__factory.ts +1 -1
- package/typechain-types/factories/PendleQiTokenHelper__factory.ts +1 -1
- package/typechain-types/factories/PendleQiTokenSY__factory.ts +1 -1
- package/typechain-types/factories/PendleRouterHelper__factory.ts +1 -1
- package/typechain-types/factories/PendleRouterStatic__factory.ts +1 -1
- package/typechain-types/factories/PendleRouter__factory.ts +1 -1
- package/typechain-types/factories/PendleSfrxEthSY__factory.ts +1 -1
- package/typechain-types/factories/PendleStargateLPSY__factory.ts +1 -1
- package/typechain-types/factories/PendleThenaSY__factory.ts +1 -1
- package/typechain-types/factories/PendleVotingControllerUpg__factory.ts +1 -1
- package/typechain-types/factories/PendleWbEthSY__factory.ts +1 -1
- package/typechain-types/factories/PendleWstEthSY__factory.ts +1 -1
- package/typechain-types/factories/PendleYieldContractFactoryV2__factory.ts +1 -1
- package/typechain-types/factories/PendleYieldContractFactory__factory.ts +1 -1
- package/typechain-types/factories/PendleYieldTokenV2__factory.ts +1 -1
- package/typechain-types/factories/PendleYieldToken__factory.ts +1 -1
- package/typechain-types/factories/PtAndLpToAsset__factory.ts +1 -1
- package/typechain-types/factories/SAPE__factory.ts +1 -1
- package/typechain-types/factories/SDKErrorsDirectory__factory.ts +1596 -0
- package/typechain-types/factories/StarNFTV1__factory.ts +584 -0
- package/typechain-types/factories/SwETHSY__factory.ts +1022 -0
- package/typechain-types/factories/ThenaPreview__factory.ts +1 -1
- package/typechain-types/factories/TradingBotBase__factory.ts +1258 -230
- package/typechain-types/factories/TvlLib__factory.ts +309 -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 +115 -232
- package/typechain-types/index.ts +34 -50
- 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 -976
- package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleWbEthSY.sol/PendleWbEthSY.dbg.json +0 -4
- package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleWbEthSY.sol/PendleWbEthSY.json +0 -979
- package/build/artifacts/contracts/interfaces/BinanceEth/IWBETH.sol/IWBETH.dbg.json +0 -4
- package/build/artifacts/contracts/interfaces/BinanceEth/IWBETH.sol/IWBETH.json +0 -42
- package/build/artifacts/contracts/offchain-helpers/PtAndLpToAsset.sol/PtAndLpToAsset.dbg.json +0 -4
- package/build/artifacts/contracts/offchain-helpers/PtAndLpToAsset.sol/PtAndLpToAsset.json +0 -97
- package/contracts/core/StandardizedYield/implementations/PendleArbitrumStakedEthSY.sol +0 -120
- package/contracts/core/StandardizedYield/implementations/PendleWbEthSY.sol +0 -108
- package/contracts/interfaces/BinanceEth/IWBETH.sol +0 -9
- package/contracts/offchain-helpers/PtAndLpToAsset.sol +0 -62
- package/deployments/42161-markets/RETH-ARBITRUM-JUNE2025.json +0 -10
- package/deployments/42161-markets/WSTETH-ARBITRUM-JUNE2024.json +0 -10
- package/deployments/42161-markets/WSTETH-ARBITRUM-JUNE2025.json +0 -10
- package/deployments/56-core.json +0 -28
- package/deployments/56-markets/THENA-FRXETH-ETH-JUNE2024.json +0 -10
- package/deployments/56-markets/WBETH-DEC2024.json +0 -10
- package/deployments/56-offchain-helper.json +0 -4
- package/typechain-types/BotActionCallback.ts +0 -763
- package/typechain-types/BotActionHelper.ts +0 -763
- package/typechain-types/BotDecisionHelper.ts +0 -527
- package/typechain-types/BotDecisionLib.ts +0 -335
- package/typechain-types/CamelotV1LpHelper.ts +0 -203
- package/typechain-types/IExecutorHelper1.ts +0 -643
- package/typechain-types/IExecutorHelperEthereum1.ts +0 -643
- package/typechain-types/PendleSwapArbitrum.ts +0 -126
- package/typechain-types/PendleSwapEthereum.ts +0 -126
- package/typechain-types/TradingBotOffchain.ts +0 -568
- package/typechain-types/factories/BotActionCallback__factory.ts +0 -678
- package/typechain-types/factories/BotActionHelper__factory.ts +0 -678
- package/typechain-types/factories/BotDecisionHelper__factory.ts +0 -1123
- package/typechain-types/factories/BotDecisionLib__factory.ts +0 -642
- package/typechain-types/factories/CamelotV1Preview__factory.ts +0 -309
- package/typechain-types/factories/IExecutorHelper1__factory.ts +0 -403
- package/typechain-types/factories/IExecutorHelperEthereum1__factory.ts +0 -407
- package/typechain-types/factories/PendleBinanceEth__factory.ts +0 -1052
- package/typechain-types/factories/PendleCamelotV1SY__factory.ts +0 -1595
- package/typechain-types/factories/PendleSwapArbitrum__factory.ts +0 -129
- package/typechain-types/factories/PendleSwapEthereum__factory.ts +0 -129
- package/typechain-types/factories/TradingBotOffchain__factory.ts +0 -1133
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
pragma solidity 0.8.17;
|
|
3
|
+
|
|
4
|
+
import "../libraries/BoringOwnableUpgradeable.sol";
|
|
5
|
+
import "../libraries/TokenHelper.sol";
|
|
6
|
+
import "../../interfaces/TradingBot/ITradingBotBase.sol";
|
|
7
|
+
import "../../interfaces/TradingBot/IBotDecisionHelper.sol";
|
|
8
|
+
import "../StandardizedYield/SYBaseWithRewards.sol";
|
|
9
|
+
import "./libraries/TvlLib.sol";
|
|
10
|
+
|
|
11
|
+
contract TradingBotBase is SYBaseWithRewards, ITradingBotBase {
|
|
12
|
+
using TokenAmountLib for TokenAmount[];
|
|
13
|
+
using PYIndexLib for IPYieldToken;
|
|
14
|
+
using MarketExtLib for MarketExtState;
|
|
15
|
+
using Math for uint256;
|
|
16
|
+
using Math for int256;
|
|
17
|
+
|
|
18
|
+
IBotDecisionHelper public immutable decisionHelper;
|
|
19
|
+
address public immutable market;
|
|
20
|
+
address public immutable router;
|
|
21
|
+
address public immutable SY;
|
|
22
|
+
address public immutable PT;
|
|
23
|
+
address public immutable YT;
|
|
24
|
+
address public immutable PENDLE;
|
|
25
|
+
|
|
26
|
+
TradingSpecs public specs;
|
|
27
|
+
uint256 public buyBins;
|
|
28
|
+
|
|
29
|
+
constructor(
|
|
30
|
+
address _market,
|
|
31
|
+
address _router,
|
|
32
|
+
address _PENDLE,
|
|
33
|
+
address _decisionHelper
|
|
34
|
+
) SYBaseWithRewards("Fortknox Vault", "Fortknox Vault", _getSYAddress(_market)) {
|
|
35
|
+
(IStandardizedYield _SY, IPPrincipalToken _PT, IPYieldToken _YT) = IPMarket(_market)
|
|
36
|
+
.readTokens();
|
|
37
|
+
|
|
38
|
+
market = _market;
|
|
39
|
+
router = _router;
|
|
40
|
+
SY = address(_SY);
|
|
41
|
+
PT = address(_PT);
|
|
42
|
+
YT = address(_YT);
|
|
43
|
+
PENDLE = _PENDLE;
|
|
44
|
+
decisionHelper = IBotDecisionHelper(_decisionHelper);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function _getSYAddress(address _market) internal view returns (address) {
|
|
48
|
+
(IStandardizedYield _SY, , ) = IPMarket(_market).readTokens();
|
|
49
|
+
return address(_SY);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function approveInf(address token, address to) external onlyOwner {
|
|
53
|
+
_safeApproveInf(token, to);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function compound(
|
|
57
|
+
TokenInput calldata inp,
|
|
58
|
+
uint256 minSyOut
|
|
59
|
+
) external onlyOwner returns (uint256 netSyOut) {
|
|
60
|
+
netSyOut = _compoundSingle(inp, minSyOut);
|
|
61
|
+
_transferOut(PENDLE, owner, _selfBalance(PENDLE));
|
|
62
|
+
emit ClaimAndCompound(netSyOut);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function _readMarketExtState() internal view returns (MarketExtState memory marketExt) {
|
|
66
|
+
marketExt.state = IPMarket(market).readState(router);
|
|
67
|
+
marketExt.index = IPYieldToken(YT).newIndexView();
|
|
68
|
+
marketExt.blockTime = block.timestamp;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function _readBotState() internal view returns (BotState memory botState) {
|
|
72
|
+
botState.lpBalance = _selfBalance(market);
|
|
73
|
+
botState.syBalance = _selfBalance(SY);
|
|
74
|
+
botState.ytBalance = _selfBalance(YT);
|
|
75
|
+
botState.ptBalance = _selfBalance(PT);
|
|
76
|
+
botState.buyBins = buyBins;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function _setBuyBins(uint256 _buyBins) internal {
|
|
80
|
+
buyBins = _buyBins;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function _compoundSingle(
|
|
84
|
+
TokenInput memory inp,
|
|
85
|
+
uint256 minSyOut
|
|
86
|
+
) internal returns (uint256 /*netSyOut*/) {
|
|
87
|
+
if (inp.netTokenIn == type(uint256).max) inp.netTokenIn = _selfBalance(inp.tokenIn);
|
|
88
|
+
|
|
89
|
+
return
|
|
90
|
+
IPAllAction(router).mintSyFromToken{
|
|
91
|
+
value: inp.tokenIn == NATIVE ? inp.netTokenIn : 0
|
|
92
|
+
}(address(this), SY, minSyOut, inp);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function setSpecs(TradingSpecs calldata _specs) external onlyOwner {
|
|
96
|
+
_setSpecs(_specs);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function _setSpecs(TradingSpecs memory _specs) internal {
|
|
100
|
+
specs = _specs;
|
|
101
|
+
_setBuyBins(specs.numOfBins);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function readStrategyData() public view returns (StrategyData memory strategyData) {
|
|
105
|
+
strategyData.botState = _readBotState();
|
|
106
|
+
strategyData.marketExt = _readMarketExtState();
|
|
107
|
+
strategyData.specs = specs;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function _updateSellBinAfterTrade() internal {
|
|
111
|
+
int256 binShift = IBotDecisionHelper(decisionHelper).getCurrentBin(readStrategyData());
|
|
112
|
+
_setBuyBins((buyBins.Int() + binShift).Uint());
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function getTvl(bool isLiquidateTvl) external view returns (uint256) {
|
|
116
|
+
if (isLiquidateTvl) {
|
|
117
|
+
return TvlLib.getLiquidateTvl(_readBotState(), _readMarketExtState());
|
|
118
|
+
} else {
|
|
119
|
+
return TvlLib.getOracleTvl(market, _readBotState());
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
function getMaxAmountSharesToRedeem() external view returns (uint256) {
|
|
124
|
+
uint256 liquidateTvl = TvlLib.getLiquidateTvl(_readBotState(), _readMarketExtState());
|
|
125
|
+
return (_selfBalance(SY) * totalSupply()) / liquidateTvl;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/*///////////////////////////////////////////////////////////////
|
|
129
|
+
EIP-5115
|
|
130
|
+
//////////////////////////////////////////////////////////////*/
|
|
131
|
+
|
|
132
|
+
function _deposit(
|
|
133
|
+
address,
|
|
134
|
+
uint256 amountDeposited
|
|
135
|
+
) internal virtual override returns (uint256 amountSharesOut) {
|
|
136
|
+
BotState memory botState = _readBotState();
|
|
137
|
+
MarketExtState memory marketExt = _readMarketExtState();
|
|
138
|
+
|
|
139
|
+
uint256 supply = totalSupply();
|
|
140
|
+
if (supply == 0) return amountDeposited;
|
|
141
|
+
|
|
142
|
+
uint256 tvl = Math.max(
|
|
143
|
+
TvlLib.getOracleTvl(market, botState),
|
|
144
|
+
TvlLib.getLiquidateTvl(botState, marketExt)
|
|
145
|
+
);
|
|
146
|
+
|
|
147
|
+
// Excluding the amount of SY already transferred in
|
|
148
|
+
return (amountDeposited * totalSupply()) / (tvl - amountDeposited);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
function _redeem(
|
|
152
|
+
address receiver,
|
|
153
|
+
address,
|
|
154
|
+
uint256 amountSharesToRedeem
|
|
155
|
+
) internal virtual override returns (uint256 amountTokenOut) {
|
|
156
|
+
uint256 tvlLiquidate = TvlLib.getLiquidateTvl(_readBotState(), _readMarketExtState());
|
|
157
|
+
|
|
158
|
+
// including the amount of shares already burned when this function is called
|
|
159
|
+
amountTokenOut =
|
|
160
|
+
(tvlLiquidate * amountSharesToRedeem) /
|
|
161
|
+
(totalSupply() + amountSharesToRedeem);
|
|
162
|
+
_transferOut(SY, receiver, amountTokenOut);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
function _previewDeposit(
|
|
166
|
+
address,
|
|
167
|
+
uint256 amountTokenToDeposit
|
|
168
|
+
) internal view override returns (uint256 amountSharesOut) {
|
|
169
|
+
uint256 supply = totalSupply();
|
|
170
|
+
if (supply == 0) return amountTokenToDeposit;
|
|
171
|
+
|
|
172
|
+
BotState memory botState = _readBotState();
|
|
173
|
+
MarketExtState memory marketExt = _readMarketExtState();
|
|
174
|
+
|
|
175
|
+
uint256 tvl = Math.max(
|
|
176
|
+
TvlLib.getOracleTvl(market, botState),
|
|
177
|
+
TvlLib.getLiquidateTvl(botState, marketExt)
|
|
178
|
+
);
|
|
179
|
+
return (amountTokenToDeposit * supply) / tvl;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
function _previewRedeem(
|
|
183
|
+
address,
|
|
184
|
+
uint256 amountSharesToRedeem
|
|
185
|
+
) internal view override returns (uint256 amountTokenOut) {
|
|
186
|
+
uint256 tvlLiquidate = TvlLib.getLiquidateTvl(_readBotState(), _readMarketExtState());
|
|
187
|
+
return (tvlLiquidate * amountSharesToRedeem) / totalSupply();
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
function exchangeRate() public view virtual override returns (uint256) {
|
|
191
|
+
return TvlLib.getOracleTvl(market, _readBotState()).divDown(totalSupply());
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
function _redeemExternalReward() internal override {
|
|
195
|
+
IPYieldToken(YT).redeemDueInterestAndRewards(address(this), true, true);
|
|
196
|
+
IPMarket(market).redeemRewards(address(this));
|
|
197
|
+
IStandardizedYield(SY).claimRewards(address(this));
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
function _getRewardTokens() internal view virtual override returns (address[] memory res) {
|
|
201
|
+
res = new address[](1);
|
|
202
|
+
res[0] = PENDLE;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
function getTokensIn() public view virtual override returns (address[] memory res) {
|
|
206
|
+
res = new address[](1);
|
|
207
|
+
res[0] = SY;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
function getTokensOut() public view virtual override returns (address[] memory res) {
|
|
211
|
+
res = new address[](1);
|
|
212
|
+
res[0] = SY;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
function isValidTokenIn(address token) public view virtual override returns (bool) {
|
|
216
|
+
return token == SY;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
function isValidTokenOut(address token) public view virtual override returns (bool) {
|
|
220
|
+
return token == SY;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
function assetInfo()
|
|
224
|
+
external
|
|
225
|
+
view
|
|
226
|
+
returns (AssetType assetType, address assetAddress, uint8 assetDecimals)
|
|
227
|
+
{
|
|
228
|
+
return (AssetType.TOKEN, SY, IERC20Metadata(SY).decimals());
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* ERC20 overrides
|
|
233
|
+
*/
|
|
234
|
+
function name()
|
|
235
|
+
public
|
|
236
|
+
view
|
|
237
|
+
virtual
|
|
238
|
+
override(PendleERC20, IERC20Metadata)
|
|
239
|
+
returns (string memory)
|
|
240
|
+
{
|
|
241
|
+
return "Fortknox Vault";
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
function symbol()
|
|
245
|
+
public
|
|
246
|
+
view
|
|
247
|
+
virtual
|
|
248
|
+
override(PendleERC20, IERC20Metadata)
|
|
249
|
+
returns (string memory)
|
|
250
|
+
{
|
|
251
|
+
return "Fortknox Vault";
|
|
252
|
+
}
|
|
253
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
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 addLiqKeepYt(
|
|
14
|
+
BotState memory bot,
|
|
15
|
+
MarketExtState memory marketExt,
|
|
16
|
+
uint256 netSyIn
|
|
17
|
+
) internal pure returns (bool /*success*/) {
|
|
18
|
+
if (netSyIn > bot.syBalance) return false;
|
|
19
|
+
|
|
20
|
+
(uint256 netLpOut, uint256 netYtOut) = marketExt.addLiqKeepYt(netSyIn);
|
|
21
|
+
|
|
22
|
+
bot.syBalance -= netSyIn;
|
|
23
|
+
bot.lpBalance += netLpOut;
|
|
24
|
+
bot.ytBalance += netYtOut;
|
|
25
|
+
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function addLiqFromYt(
|
|
30
|
+
BotState memory bot,
|
|
31
|
+
MarketExtState memory marketExt,
|
|
32
|
+
uint256 netPtFromSwap
|
|
33
|
+
) internal pure returns (bool /*success*/) {
|
|
34
|
+
(uint256 netLpOut, uint256 netYtIn) = marketExt.addLiqFromYt(netPtFromSwap);
|
|
35
|
+
|
|
36
|
+
if (netYtIn > bot.ytBalance) return false;
|
|
37
|
+
|
|
38
|
+
bot.ytBalance -= netYtIn;
|
|
39
|
+
bot.lpBalance += netLpOut;
|
|
40
|
+
|
|
41
|
+
return true;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function removeLiqToYt(
|
|
45
|
+
BotState memory bot,
|
|
46
|
+
MarketExtState memory marketExt,
|
|
47
|
+
uint256 netLpToRemove,
|
|
48
|
+
ApproxParams memory approxParams
|
|
49
|
+
) internal pure returns (bool /*success*/) {
|
|
50
|
+
if (netLpToRemove > bot.lpBalance) return false;
|
|
51
|
+
|
|
52
|
+
(uint256 netYtOut, ) = marketExt.removeLiqToYt(
|
|
53
|
+
netLpToRemove,
|
|
54
|
+
cloneApproxParams(approxParams)
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
bot.lpBalance -= netLpToRemove;
|
|
58
|
+
bot.ytBalance += netYtOut;
|
|
59
|
+
|
|
60
|
+
return true;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function tvlInSy(
|
|
64
|
+
BotState memory bot,
|
|
65
|
+
MarketExtState memory marketExt
|
|
66
|
+
) internal pure returns (uint256) {
|
|
67
|
+
MarketExtState memory marketExtClone = marketExt.clone();
|
|
68
|
+
|
|
69
|
+
(uint256 syInLp, uint256 ptInLp) = marketExtClone.removeLiqDual(bot.lpBalance);
|
|
70
|
+
uint256 totalValue = bot.syBalance + syInLp;
|
|
71
|
+
|
|
72
|
+
uint256 totalPt = ptInLp + bot.ptBalance;
|
|
73
|
+
if (totalPt <= bot.ytBalance) {
|
|
74
|
+
totalValue += marketExtClone.previewPyToSy(totalPt);
|
|
75
|
+
totalValue += marketExtClone.swapYtToSy(bot.ytBalance - totalPt);
|
|
76
|
+
} else {
|
|
77
|
+
totalValue += marketExtClone.previewPyToSy(bot.ytBalance);
|
|
78
|
+
totalValue += marketExtClone.swapPtToSy(totalPt - bot.ytBalance);
|
|
79
|
+
}
|
|
80
|
+
return totalValue;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function clone(BotState memory bot) internal pure returns (BotState memory) {
|
|
84
|
+
return BotState(bot.lpBalance, bot.ytBalance, bot.ptBalance, bot.syBalance, bot.buyBins);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function cloneApproxParams(
|
|
88
|
+
ApproxParams memory params
|
|
89
|
+
) internal pure returns (ApproxParams memory) {
|
|
90
|
+
return
|
|
91
|
+
ApproxParams(
|
|
92
|
+
params.guessMin,
|
|
93
|
+
params.guessMax,
|
|
94
|
+
params.guessOffchain,
|
|
95
|
+
params.maxIteration,
|
|
96
|
+
params.eps
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
pragma solidity 0.8.17;
|
|
3
|
+
|
|
4
|
+
// import "../base/TradingBotBase.sol";
|
|
5
|
+
import "../../../router/base/MarketApproxLib.sol";
|
|
6
|
+
import "../../../interfaces/IPAllAction.sol";
|
|
7
|
+
import "../../../interfaces/IPMarket.sol";
|
|
8
|
+
import "../../../interfaces/TradingBot/IBotDecisionHelper.sol";
|
|
9
|
+
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
|
|
10
|
+
import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
|
|
11
|
+
|
|
12
|
+
// This external library aims to implements all the action logics for LongYieldTradingBot
|
|
13
|
+
// No technical perference. Only purpose is to smaller the bytecode size of LongYieldTradingBot.sol
|
|
14
|
+
|
|
15
|
+
library LongYieldActionLib {
|
|
16
|
+
using PYIndexLib for IPYieldToken;
|
|
17
|
+
using PYIndexLib for PYIndex;
|
|
18
|
+
using MarketMathCore for MarketState;
|
|
19
|
+
using MarketApproxPtInLib for MarketState;
|
|
20
|
+
using Math for int256;
|
|
21
|
+
using SafeERC20 for IERC20;
|
|
22
|
+
|
|
23
|
+
bytes internal constant EMPTY_BYTES = abi.encode();
|
|
24
|
+
|
|
25
|
+
address internal constant ROUTER = 0x0000000001E4ef00d069e71d6bA041b0A16F7eA0;
|
|
26
|
+
|
|
27
|
+
function liquidateLpToSy(
|
|
28
|
+
address market,
|
|
29
|
+
uint256 netLpToRemove,
|
|
30
|
+
uint256 minSyOut
|
|
31
|
+
) public returns (uint256 netSyOut) {
|
|
32
|
+
(uint256 netSyFromLp, uint256 netPtOut) = IPAllAction(ROUTER).removeLiquidityDualSyAndPt(
|
|
33
|
+
address(this),
|
|
34
|
+
market,
|
|
35
|
+
netLpToRemove,
|
|
36
|
+
0,
|
|
37
|
+
0
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
(uint256 netSyFromPt, ) = IPAllAction(ROUTER).swapExactPtForSy(
|
|
41
|
+
address(this),
|
|
42
|
+
market,
|
|
43
|
+
netPtOut,
|
|
44
|
+
0
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
netSyOut = netSyFromLp + netSyFromPt;
|
|
48
|
+
require(netSyOut > minSyOut, "liquidateLpToSy: insufficient sy out");
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function removeLiquidityToSy(
|
|
52
|
+
address market,
|
|
53
|
+
uint256 netLpToRemove,
|
|
54
|
+
uint256 minSyOut
|
|
55
|
+
) public returns (uint256 netSyOut) {
|
|
56
|
+
(uint256 netSyFromLp, uint256 netPtOut) = IPAllAction(ROUTER).removeLiquidityDualSyAndPt(
|
|
57
|
+
address(this),
|
|
58
|
+
market,
|
|
59
|
+
netLpToRemove,
|
|
60
|
+
0,
|
|
61
|
+
0
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
(, , IPYieldToken YT) = IPMarket(market).readTokens();
|
|
65
|
+
uint256 netSyFromRedeemPY = IPAllAction(ROUTER).redeemPyToSy(
|
|
66
|
+
address(this),
|
|
67
|
+
address(YT),
|
|
68
|
+
Math.min(netPtOut, YT.balanceOf(address(this))),
|
|
69
|
+
0
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
netSyOut = netSyFromLp + netSyFromRedeemPY;
|
|
73
|
+
require(netSyOut > minSyOut, "removeLiquidityToSy: insufficient sy out");
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function swapYtToSy(
|
|
77
|
+
address market,
|
|
78
|
+
uint256 netYtIn,
|
|
79
|
+
uint256 minSyOut
|
|
80
|
+
) public returns (uint256 netSyOut) {
|
|
81
|
+
(netSyOut, ) = IPAllAction(ROUTER).swapExactYtForSy(
|
|
82
|
+
address(this),
|
|
83
|
+
market,
|
|
84
|
+
netYtIn,
|
|
85
|
+
minSyOut
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function addLiqKeepYt(
|
|
90
|
+
address market,
|
|
91
|
+
uint256 netSyIn,
|
|
92
|
+
uint256 minLpOut,
|
|
93
|
+
uint256 minYtOut
|
|
94
|
+
) public returns (uint256 /*netLpOut*/, uint256 /*netYtOut*/) {
|
|
95
|
+
return
|
|
96
|
+
IPAllAction(ROUTER).addLiquiditySingleSyKeepYt(
|
|
97
|
+
address(this),
|
|
98
|
+
market,
|
|
99
|
+
netSyIn,
|
|
100
|
+
minLpOut,
|
|
101
|
+
minYtOut
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function addLiqFromYt(
|
|
106
|
+
address market,
|
|
107
|
+
uint256 netPtFromSwap,
|
|
108
|
+
uint256 minLpOut
|
|
109
|
+
) public returns (uint256 netLpOut, uint256 netYtIn) {
|
|
110
|
+
MarketState memory state = IPMarket(market).readState(address(this));
|
|
111
|
+
(, , IPYieldToken YT) = IPMarket(market).readTokens();
|
|
112
|
+
|
|
113
|
+
PYIndex index = YT.newIndex();
|
|
114
|
+
|
|
115
|
+
(uint256 netSyToSwap, , ) = state.swapSyForExactPt(index, netPtFromSwap, block.timestamp);
|
|
116
|
+
|
|
117
|
+
// (1) --> netPtRedeemSy = netPtFromSwap - netPtToAdd
|
|
118
|
+
// (2) --> (netPtRedeemSy * ONE / pyIndex) = (netPtToAdd * totalSy / totalPt) + netSyToSwap
|
|
119
|
+
// (2) * pyIndex / ONE --> netPtRedeemSy = (netPtToAdd * totalSy / totalPt * pyIndex / ONE) + netSyToSwap * pyIndex / ONE
|
|
120
|
+
// ==> netPtFromSwap - netPtToAdd = (netPtToAdd * totalSy / totalPt * pyIndex / ONE) + netSyToSwap * pyIndex / ONE
|
|
121
|
+
// ==> netPtToAdd * (ONE + totalSy * pyIndex / totalPt) = netPtFromSwap * ONE - netSyToSwap * pyIndex
|
|
122
|
+
|
|
123
|
+
uint256 pyIndex = PYIndex.unwrap(index);
|
|
124
|
+
uint256 netPtToAddNumerator = (netPtFromSwap * Math.ONE - netSyToSwap * pyIndex);
|
|
125
|
+
uint256 netPtToAddDenominator = (Math.ONE +
|
|
126
|
+
(state.totalSy.Uint() * pyIndex) /
|
|
127
|
+
state.totalPt.Uint());
|
|
128
|
+
uint256 netPtToAdd = netPtToAddNumerator / netPtToAddDenominator;
|
|
129
|
+
|
|
130
|
+
netYtIn = netPtFromSwap - netPtToAdd; // = netPtRedeemSy
|
|
131
|
+
|
|
132
|
+
IPMarket(market).swapSyForExactPt(
|
|
133
|
+
address(this),
|
|
134
|
+
netPtFromSwap,
|
|
135
|
+
_encodeAddLiqFromYt(netYtIn)
|
|
136
|
+
);
|
|
137
|
+
|
|
138
|
+
uint256 netSyFromPy = index.assetToSy(netYtIn);
|
|
139
|
+
uint256 netSyToAdd = netSyFromPy - netSyToSwap;
|
|
140
|
+
|
|
141
|
+
(netLpOut, , ) = IPMarket(market).mint(address(this), netSyToAdd, netPtToAdd);
|
|
142
|
+
if (netLpOut < minLpOut) revert Errors.BotInsufficientLpOut(netLpOut, minLpOut);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/// @dev Behaves like PendleRouter's removeLiquidityDualSyAndPt then swapExactPtForYt
|
|
146
|
+
/// @param guessTotalPtToSwap Same like for PendleRouter's swapExactPtForYt
|
|
147
|
+
function removeLiqToYt(
|
|
148
|
+
address market,
|
|
149
|
+
uint256 netLpToRemove,
|
|
150
|
+
ApproxParams memory guessTotalPtToSwap,
|
|
151
|
+
uint256 minYtOut
|
|
152
|
+
) public returns (uint256 netYtOut, uint256 totalPtToSwap) {
|
|
153
|
+
IERC20(market).safeTransfer(market, netLpToRemove);
|
|
154
|
+
(, , IPYieldToken YT) = IPMarket(market).readTokens();
|
|
155
|
+
(uint256 netSyFromLp, uint256 netPtFromLp) = IPMarket(market).burn(
|
|
156
|
+
address(YT),
|
|
157
|
+
market,
|
|
158
|
+
netLpToRemove
|
|
159
|
+
); // SY goes to YT to mint PY, PT goes to market to swap
|
|
160
|
+
|
|
161
|
+
MarketState memory state = IPMarket(market).readState(address(this));
|
|
162
|
+
PYIndex index = IPYieldToken(YT).newIndex();
|
|
163
|
+
|
|
164
|
+
uint256 netPtFromSy = index.syToAsset(netSyFromLp);
|
|
165
|
+
|
|
166
|
+
uint256 netYtFromSwap;
|
|
167
|
+
(netYtFromSwap, totalPtToSwap, ) = state.approxSwapExactPtForYt(
|
|
168
|
+
index,
|
|
169
|
+
netPtFromLp + netPtFromSy,
|
|
170
|
+
block.timestamp,
|
|
171
|
+
guessTotalPtToSwap
|
|
172
|
+
);
|
|
173
|
+
|
|
174
|
+
netYtOut = netYtFromSwap + netPtFromSy;
|
|
175
|
+
if (netYtOut < minYtOut) revert Errors.BotInsufficientYtOut(netYtOut, minYtOut);
|
|
176
|
+
|
|
177
|
+
IPMarket(market).swapExactPtForSy(
|
|
178
|
+
address(YT),
|
|
179
|
+
totalPtToSwap,
|
|
180
|
+
_encodeRemoveLiqToYt(minYtOut)
|
|
181
|
+
); // SY goes to YT to mint PY
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/*///////////////////////////////////////////////////////////////
|
|
185
|
+
Callback
|
|
186
|
+
//////////////////////////////////////////////////////////////*/
|
|
187
|
+
|
|
188
|
+
function swapCallback(
|
|
189
|
+
address market,
|
|
190
|
+
int256 ptToAccount,
|
|
191
|
+
int256 syToAccount,
|
|
192
|
+
bytes calldata data
|
|
193
|
+
) public {
|
|
194
|
+
TradeActionType swapType = _getActionType(data);
|
|
195
|
+
|
|
196
|
+
(, IPPrincipalToken PT, IPYieldToken YT) = IPMarket(market).readTokens();
|
|
197
|
+
|
|
198
|
+
if (swapType == TradeActionType.AddLiqFromYt) {
|
|
199
|
+
_callbackAddLiqFromYt(
|
|
200
|
+
market,
|
|
201
|
+
address(PT),
|
|
202
|
+
address(YT),
|
|
203
|
+
ptToAccount,
|
|
204
|
+
syToAccount,
|
|
205
|
+
data
|
|
206
|
+
);
|
|
207
|
+
} else if (swapType == TradeActionType.RemoveLiqToYt) {
|
|
208
|
+
_callbackRemoveLiqToYt(
|
|
209
|
+
market,
|
|
210
|
+
address(PT),
|
|
211
|
+
address(YT),
|
|
212
|
+
ptToAccount,
|
|
213
|
+
syToAccount,
|
|
214
|
+
data
|
|
215
|
+
);
|
|
216
|
+
} else {
|
|
217
|
+
assert(false);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/// ------------------------------------------------------------
|
|
222
|
+
/// AddLiqFromYt
|
|
223
|
+
/// ------------------------------------------------------------
|
|
224
|
+
|
|
225
|
+
function _callbackAddLiqFromYt(
|
|
226
|
+
address market,
|
|
227
|
+
address PT,
|
|
228
|
+
address YT,
|
|
229
|
+
int256 ptToAccount,
|
|
230
|
+
int256 /*syToAccount*/,
|
|
231
|
+
bytes calldata data
|
|
232
|
+
) internal {
|
|
233
|
+
uint256 netPyRedeemSy = _decodeAddLiqFromYt(data);
|
|
234
|
+
IERC20(PT).safeTransfer(address(YT), netPyRedeemSy);
|
|
235
|
+
|
|
236
|
+
bool needToBurnYt = (!IPYieldToken(YT).isExpired());
|
|
237
|
+
if (needToBurnYt) IERC20(YT).safeTransfer(YT, netPyRedeemSy);
|
|
238
|
+
|
|
239
|
+
IPYieldToken(YT).redeemPY(market); // all SY goes to market to repay and mint LP
|
|
240
|
+
IERC20(PT).safeTransfer(market, ptToAccount.Uint() - netPyRedeemSy); // remaining PT goes to market to mint LP
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
function _decodeAddLiqFromYt(
|
|
244
|
+
bytes calldata data
|
|
245
|
+
) internal pure returns (uint256 netPyRedeemSy) {
|
|
246
|
+
assembly {
|
|
247
|
+
// first 32 bytes is ActionType
|
|
248
|
+
netPyRedeemSy := calldataload(add(data.offset, 32))
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
/// ------------------------------------------------------------
|
|
253
|
+
/// RemoveLiqToYt
|
|
254
|
+
/// ------------------------------------------------------------
|
|
255
|
+
|
|
256
|
+
function _callbackRemoveLiqToYt(
|
|
257
|
+
address market,
|
|
258
|
+
address /*PT*/,
|
|
259
|
+
address YT,
|
|
260
|
+
int256 /*ptToAccount*/,
|
|
261
|
+
int256 /*syToAccount*/,
|
|
262
|
+
bytes calldata data
|
|
263
|
+
) internal {
|
|
264
|
+
uint256 minYtOut = _decodeRemoveLiqToYt(data);
|
|
265
|
+
|
|
266
|
+
uint256 netYtOut = IPYieldToken(YT).mintPY(market, address(this)); // PT goes to market to repay
|
|
267
|
+
if (netYtOut < minYtOut) revert Errors.BotInsufficientYtOut(netYtOut, minYtOut); // 2nd check
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
/// ------------------------------------------------------------
|
|
271
|
+
/// Misc functions
|
|
272
|
+
/// ------------------------------------------------------------
|
|
273
|
+
|
|
274
|
+
function _getActionType(
|
|
275
|
+
bytes calldata data
|
|
276
|
+
) internal pure returns (TradeActionType actionType) {
|
|
277
|
+
assembly {
|
|
278
|
+
actionType := calldataload(data.offset)
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
function _decodeRemoveLiqToYt(bytes calldata data) internal pure returns (uint256 minYtOut) {
|
|
283
|
+
assembly {
|
|
284
|
+
// first 32 bytes is ActionType
|
|
285
|
+
minYtOut := calldataload(add(data.offset, 32))
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
function _encodeRemoveLiqToYt(uint256 minYtOut) internal pure returns (bytes memory res) {
|
|
290
|
+
res = new bytes(64);
|
|
291
|
+
uint256 actionType = uint256(TradeActionType.RemoveLiqToYt);
|
|
292
|
+
|
|
293
|
+
assembly {
|
|
294
|
+
mstore(add(res, 32), actionType)
|
|
295
|
+
mstore(add(res, 64), minYtOut)
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
function _encodeAddLiqFromYt(uint256 netPyRedeemSy) internal pure returns (bytes memory res) {
|
|
300
|
+
res = new bytes(64);
|
|
301
|
+
uint256 actionType = uint256(TradeActionType.AddLiqFromYt);
|
|
302
|
+
|
|
303
|
+
assembly {
|
|
304
|
+
mstore(add(res, 32), actionType)
|
|
305
|
+
mstore(add(res, 64), netPyRedeemSy)
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
}
|