@pendle/core-v2 2.17.3-tradingbot → 2.17.4-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.
@@ -248,11 +248,12 @@ contract BotDecisionLib {
248
248
  }
249
249
  }
250
250
 
251
- function actionToTake(StrategyState memory currentState) public pure returns (ActionType) {
251
+ function actionToTake(BotState memory botState, StrategyState memory currentState) public pure returns (ActionType) {
252
252
  if (currentState.iyFlag == StrategyFlag.TOO_LOW) {
253
253
  if (currentState.syRatioFlag == StrategyFlag.TOO_HIGH) {
254
254
  return ActionType.SwapSyToYt;
255
255
  } else {
256
+ if (botState.lpBalance == 0) return ActionType.NONE;
256
257
  return ActionType.RemoveLiqToYt;
257
258
  }
258
259
  } else if (currentState.iyFlag == StrategyFlag.GOOD) {
@@ -265,6 +266,7 @@ contract BotDecisionLib {
265
266
  if (currentState.syRatioFlag == StrategyFlag.TOO_HIGH) {
266
267
  return ActionType.AddLiqFromSy;
267
268
  } else {
269
+ if (botState.ytBalance == 0) return ActionType.NONE;
268
270
  return ActionType.AddLiqFromYt;
269
271
  }
270
272
  }
@@ -3,6 +3,7 @@ pragma solidity 0.8.17;
3
3
 
4
4
  import "./BotDecisionLib.sol";
5
5
  import "../libraries/TokenAmountLib.sol";
6
+ import "../../interfaces/TradingBot/ITradingBotBase.sol";
6
7
 
7
8
  contract TradingBotOffchain {
8
9
  using TokenAmountLib for TokenAmount[];
@@ -11,11 +12,11 @@ contract TradingBotOffchain {
11
12
  using MarketApproxPtInLib for MarketState;
12
13
  using PYIndexLib for PYIndex;
13
14
 
14
- address immutable public decisionLib;
15
+ address public immutable decisionLib;
15
16
 
16
17
  constructor(address _decisionLib) {
17
18
  decisionLib = _decisionLib;
18
- }
19
+ }
19
20
 
20
21
  /// SY interest from YT is excluded
21
22
  function claimForBot(
@@ -104,8 +105,11 @@ contract TradingBotOffchain {
104
105
  return BotDecisionLib(decisionLib).strategyState(bot, marketExt, specs);
105
106
  }
106
107
 
107
- function actionToTake(StrategyState memory currentState) external view returns (ActionType) {
108
- return BotDecisionLib(decisionLib).actionToTake(currentState);
108
+ function actionToTake(
109
+ BotState memory botState,
110
+ StrategyState memory currentState
111
+ ) external view returns (ActionType) {
112
+ return BotDecisionLib(decisionLib).actionToTake(botState, currentState);
109
113
  }
110
114
 
111
115
  function tvlInSy(
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@pendle/core-v2",
3
3
  "description": "Core smart contracts of Pendle Protocol.",
4
4
  "license": "BUSL-1.1",
5
- "version": "2.17.3-tradingbot",
5
+ "version": "2.17.4-tradingbot",
6
6
  "homepage": "https://pendle.finance",
7
7
  "keywords": [
8
8
  "pendle",