@pendle/core-v2 2.19.0-tradingbot → 2.19.1-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/core/TradingBot/LongYield/LongYieldActionHelper.sol/LongYieldActionHelper.dbg.json +4 -0
- package/build/artifacts/contracts/core/TradingBot/{base/BotActionHelper.sol/BotActionHelper.json → LongYield/LongYieldActionHelper.sol/LongYieldActionHelper.json} +2 -119
- package/build/artifacts/contracts/core/TradingBot/LongYield/LongYieldDecisionHelper.sol/LongYieldDecisionHelper.dbg.json +1 -1
- package/build/artifacts/contracts/core/TradingBot/LongYield/LongYieldDecisionHelper.sol/LongYieldDecisionHelper.json +2 -2
- package/build/artifacts/contracts/core/TradingBot/LongYield/LongYieldTradingBot.sol/LongYieldTradingBot.dbg.json +1 -1
- package/build/artifacts/contracts/core/TradingBot/LongYield/LongYieldTradingBot.sol/LongYieldTradingBot.json +2 -119
- package/build/artifacts/contracts/core/TradingBot/ShortYield/ShortYieldActionHelper.sol/ShortYieldActionHelper.dbg.json +4 -0
- package/build/artifacts/contracts/core/TradingBot/ShortYield/ShortYieldActionHelper.sol/ShortYieldActionHelper.json +765 -0
- package/build/artifacts/contracts/core/TradingBot/ShortYield/ShortYieldDecisionHelper.sol/ShortYieldDecisionHelper.dbg.json +1 -1
- package/build/artifacts/contracts/core/TradingBot/ShortYield/ShortYieldDecisionHelper.sol/ShortYieldDecisionHelper.json +2 -2
- package/build/artifacts/contracts/core/TradingBot/ShortYield/ShortYieldTradingBot.sol/ShortYieldTradingBot.dbg.json +1 -1
- package/build/artifacts/contracts/core/TradingBot/ShortYield/ShortYieldTradingBot.sol/ShortYieldTradingBot.json +6 -173
- package/build/artifacts/contracts/core/TradingBot/base/BotActionCallback.sol/BotActionCallback.dbg.json +1 -1
- package/build/artifacts/contracts/core/TradingBot/base/BotActionCallback.sol/BotActionCallback.json +0 -117
- package/build/artifacts/contracts/core/TradingBot/base/BotDecisionHelperBase.sol/BotDecisionHelperBase.dbg.json +1 -1
- package/build/artifacts/contracts/core/TradingBot/base/TradingBotBase.sol/TradingBotBase.dbg.json +1 -1
- package/build/artifacts/contracts/core/TradingBot/base/TradingBotBase.sol/TradingBotBase.json +0 -117
- package/build/artifacts/contracts/core/TradingBot/libraries/BotSimulationLib.sol/BotSimulationLib.dbg.json +1 -1
- package/build/artifacts/contracts/core/TradingBot/libraries/BotSimulationLib.sol/BotSimulationLib.json +2 -2
- package/build/artifacts/contracts/core/TradingBot/libraries/SpecSegmentLib.sol/SpecSegmentLib.dbg.json +1 -1
- package/build/artifacts/contracts/core/TradingBot/libraries/SpecSegmentLib.sol/SpecSegmentLib.json +2 -2
- package/build/artifacts/contracts/interfaces/TradingBot/IBotDecisionHelper.sol/IBotDecisionHelper.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/TradingBot/ILongYieldDecisionHelper.sol/ILongYieldDecisionHelper.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/TradingBot/ILongYieldTradingBot.sol/ILongYieldTradingBot.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/TradingBot/ILongYieldTradingBot.sol/ILongYieldTradingBot.json +0 -117
- package/build/artifacts/contracts/interfaces/TradingBot/IShortYieldDecisionHelper.sol/IShortYieldDecisionHelper.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/TradingBot/IShortYieldTradingBot.sol/IShortYieldTradingBot.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/TradingBot/IShortYieldTradingBot.sol/IShortYieldTradingBot.json +4 -121
- package/build/artifacts/contracts/interfaces/TradingBot/ITradingBotBase.sol/ITradingBotBase.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/TradingBot/ITradingBotBase.sol/ITradingBotBase.json +0 -117
- package/contracts/core/TradingBot/{base/BotActionHelper.sol → LongYield/LongYieldActionHelper.sol} +4 -81
- package/contracts/core/TradingBot/LongYield/LongYieldTradingBot.sol +2 -2
- package/contracts/core/TradingBot/ShortYield/ShortYieldActionHelper.sol +54 -0
- package/contracts/core/TradingBot/ShortYield/ShortYieldTradingBot.sol +2 -2
- package/contracts/core/TradingBot/base/TradingBotBase.sol +5 -5
- package/contracts/interfaces/TradingBot/ITradingBotBase.sol +0 -4
- package/package.json +1 -1
- package/typechain-types/BotActionCallback.ts +0 -50
- package/typechain-types/ILongYieldTradingBot.ts +0 -50
- package/typechain-types/IShortYieldTradingBot.ts +2 -52
- package/typechain-types/ITradingBotBase.ts +0 -50
- package/typechain-types/LongYieldActionHelper.ts +900 -0
- package/typechain-types/LongYieldTradingBot.ts +0 -50
- package/typechain-types/ShortYieldActionHelper.ts +856 -0
- package/typechain-types/ShortYieldTradingBot.ts +2 -96
- package/typechain-types/TradingBotBase.ts +0 -50
- package/typechain-types/factories/BotActionCallback__factory.ts +0 -117
- package/typechain-types/factories/ILongYieldTradingBot__factory.ts +0 -117
- package/typechain-types/factories/IShortYieldTradingBot__factory.ts +4 -121
- package/typechain-types/factories/ITradingBotBase__factory.ts +0 -117
- package/typechain-types/factories/LongYieldActionHelper__factory.ts +834 -0
- package/typechain-types/factories/LongYieldDecisionHelper__factory.ts +1 -1
- package/typechain-types/factories/LongYieldTradingBot__factory.ts +1 -118
- package/typechain-types/factories/ShortYieldActionHelper__factory.ts +784 -0
- package/typechain-types/factories/ShortYieldDecisionHelper__factory.ts +1 -1
- package/typechain-types/factories/ShortYieldTradingBot__factory.ts +5 -172
- package/typechain-types/factories/TradingBotBase__factory.ts +0 -117
- package/typechain-types/hardhat.d.ts +18 -0
- package/typechain-types/index.ts +4 -0
- package/build/artifacts/contracts/core/TradingBot/base/BotActionHelper.sol/BotActionHelper.dbg.json +0 -4
package/build/artifacts/contracts/interfaces/TradingBot/ITradingBotBase.sol/ITradingBotBase.json
CHANGED
|
@@ -291,123 +291,6 @@
|
|
|
291
291
|
"stateMutability": "payable",
|
|
292
292
|
"type": "function"
|
|
293
293
|
},
|
|
294
|
-
{
|
|
295
|
-
"inputs": [],
|
|
296
|
-
"name": "readBotState",
|
|
297
|
-
"outputs": [
|
|
298
|
-
{
|
|
299
|
-
"components": [
|
|
300
|
-
{
|
|
301
|
-
"internalType": "uint256",
|
|
302
|
-
"name": "lpBalance",
|
|
303
|
-
"type": "uint256"
|
|
304
|
-
},
|
|
305
|
-
{
|
|
306
|
-
"internalType": "uint256",
|
|
307
|
-
"name": "ytBalance",
|
|
308
|
-
"type": "uint256"
|
|
309
|
-
},
|
|
310
|
-
{
|
|
311
|
-
"internalType": "uint256",
|
|
312
|
-
"name": "ptBalance",
|
|
313
|
-
"type": "uint256"
|
|
314
|
-
},
|
|
315
|
-
{
|
|
316
|
-
"internalType": "uint256",
|
|
317
|
-
"name": "syBalance",
|
|
318
|
-
"type": "uint256"
|
|
319
|
-
},
|
|
320
|
-
{
|
|
321
|
-
"internalType": "uint256",
|
|
322
|
-
"name": "buyBins",
|
|
323
|
-
"type": "uint256"
|
|
324
|
-
}
|
|
325
|
-
],
|
|
326
|
-
"internalType": "struct BotState",
|
|
327
|
-
"name": "botState",
|
|
328
|
-
"type": "tuple"
|
|
329
|
-
}
|
|
330
|
-
],
|
|
331
|
-
"stateMutability": "view",
|
|
332
|
-
"type": "function"
|
|
333
|
-
},
|
|
334
|
-
{
|
|
335
|
-
"inputs": [],
|
|
336
|
-
"name": "readMarketExtState",
|
|
337
|
-
"outputs": [
|
|
338
|
-
{
|
|
339
|
-
"components": [
|
|
340
|
-
{
|
|
341
|
-
"components": [
|
|
342
|
-
{
|
|
343
|
-
"internalType": "int256",
|
|
344
|
-
"name": "totalPt",
|
|
345
|
-
"type": "int256"
|
|
346
|
-
},
|
|
347
|
-
{
|
|
348
|
-
"internalType": "int256",
|
|
349
|
-
"name": "totalSy",
|
|
350
|
-
"type": "int256"
|
|
351
|
-
},
|
|
352
|
-
{
|
|
353
|
-
"internalType": "int256",
|
|
354
|
-
"name": "totalLp",
|
|
355
|
-
"type": "int256"
|
|
356
|
-
},
|
|
357
|
-
{
|
|
358
|
-
"internalType": "address",
|
|
359
|
-
"name": "treasury",
|
|
360
|
-
"type": "address"
|
|
361
|
-
},
|
|
362
|
-
{
|
|
363
|
-
"internalType": "int256",
|
|
364
|
-
"name": "scalarRoot",
|
|
365
|
-
"type": "int256"
|
|
366
|
-
},
|
|
367
|
-
{
|
|
368
|
-
"internalType": "uint256",
|
|
369
|
-
"name": "expiry",
|
|
370
|
-
"type": "uint256"
|
|
371
|
-
},
|
|
372
|
-
{
|
|
373
|
-
"internalType": "uint256",
|
|
374
|
-
"name": "lnFeeRateRoot",
|
|
375
|
-
"type": "uint256"
|
|
376
|
-
},
|
|
377
|
-
{
|
|
378
|
-
"internalType": "uint256",
|
|
379
|
-
"name": "reserveFeePercent",
|
|
380
|
-
"type": "uint256"
|
|
381
|
-
},
|
|
382
|
-
{
|
|
383
|
-
"internalType": "uint256",
|
|
384
|
-
"name": "lastLnImpliedRate",
|
|
385
|
-
"type": "uint256"
|
|
386
|
-
}
|
|
387
|
-
],
|
|
388
|
-
"internalType": "struct MarketState",
|
|
389
|
-
"name": "state",
|
|
390
|
-
"type": "tuple"
|
|
391
|
-
},
|
|
392
|
-
{
|
|
393
|
-
"internalType": "PYIndex",
|
|
394
|
-
"name": "index",
|
|
395
|
-
"type": "uint256"
|
|
396
|
-
},
|
|
397
|
-
{
|
|
398
|
-
"internalType": "uint256",
|
|
399
|
-
"name": "blockTime",
|
|
400
|
-
"type": "uint256"
|
|
401
|
-
}
|
|
402
|
-
],
|
|
403
|
-
"internalType": "struct MarketExtState",
|
|
404
|
-
"name": "marketExt",
|
|
405
|
-
"type": "tuple"
|
|
406
|
-
}
|
|
407
|
-
],
|
|
408
|
-
"stateMutability": "nonpayable",
|
|
409
|
-
"type": "function"
|
|
410
|
-
},
|
|
411
294
|
{
|
|
412
295
|
"inputs": [],
|
|
413
296
|
"name": "readStrategyData",
|
package/contracts/core/TradingBot/{base/BotActionHelper.sol → LongYield/LongYieldActionHelper.sol}
RENAMED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
2
|
pragma solidity 0.8.17;
|
|
3
3
|
|
|
4
|
-
import "
|
|
5
|
-
import "
|
|
4
|
+
import "../base/TradingBotBase.sol";
|
|
5
|
+
import "../base/BotActionCallback.sol";
|
|
6
6
|
|
|
7
|
-
abstract contract
|
|
7
|
+
abstract contract LongYieldActionHelper is TradingBotBase, BotActionCallback {
|
|
8
8
|
using PYIndexLib for IPYieldToken;
|
|
9
9
|
using PYIndexLib for PYIndex;
|
|
10
10
|
using MarketMathCore for MarketState;
|
|
@@ -13,31 +13,6 @@ abstract contract BotActionHelper is TradingBotBase, BotActionCallback {
|
|
|
13
13
|
|
|
14
14
|
bytes internal constant EMPTY_BYTES = abi.encode();
|
|
15
15
|
|
|
16
|
-
function _mintPY(
|
|
17
|
-
uint256 netSyIn,
|
|
18
|
-
uint256 minPyOut
|
|
19
|
-
) internal returns (uint256 netPyOut) {
|
|
20
|
-
return IPAllAction(router).mintPyFromSy(
|
|
21
|
-
address(this),
|
|
22
|
-
YT,
|
|
23
|
-
netSyIn,
|
|
24
|
-
minPyOut
|
|
25
|
-
);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function _swapSyToYt(
|
|
29
|
-
address router,
|
|
30
|
-
uint256 exactYtOut,
|
|
31
|
-
uint256 maxSyIn
|
|
32
|
-
) internal returns (uint256 netSyIn) {
|
|
33
|
-
(netSyIn, ) = IPAllAction(router).swapSyForExactYt(
|
|
34
|
-
address(this),
|
|
35
|
-
market,
|
|
36
|
-
exactYtOut,
|
|
37
|
-
maxSyIn
|
|
38
|
-
);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
16
|
function _addLiqKeepYt(
|
|
42
17
|
address router,
|
|
43
18
|
uint256 netSyIn,
|
|
@@ -53,31 +28,7 @@ abstract contract BotActionHelper is TradingBotBase, BotActionCallback {
|
|
|
53
28
|
minYtOut
|
|
54
29
|
);
|
|
55
30
|
}
|
|
56
|
-
|
|
57
|
-
/// @dev Mimics PendleRouter's addLiquiditySingleSy
|
|
58
|
-
function _addLiqFromSy(
|
|
59
|
-
uint256 netPtFromSwap,
|
|
60
|
-
uint256 minLpOut,
|
|
61
|
-
uint256 maxSyIn
|
|
62
|
-
) internal returns (uint256 netLpOut, uint256 netSyIn) {
|
|
63
|
-
MarketState memory state = IPMarket(market).readState(address(this));
|
|
64
|
-
PYIndex index = IPYieldToken(YT).newIndex();
|
|
65
|
-
|
|
66
|
-
(uint256 netSyToSwap, , ) = state.swapSyForExactPt(index, netPtFromSwap, block.timestamp);
|
|
67
|
-
(, , uint256 netSyToAdd, ) = state.addLiquidity(
|
|
68
|
-
maxSyIn - netSyToSwap,
|
|
69
|
-
netPtFromSwap,
|
|
70
|
-
block.timestamp
|
|
71
|
-
); // ensures netSyToAdd <= maxSyIn - netSyToSwap
|
|
72
|
-
netSyIn = netSyToSwap + netSyToAdd;
|
|
73
|
-
|
|
74
|
-
_transferOut(SY, market, netSyIn);
|
|
75
|
-
IPMarket(market).swapSyForExactPt(market, netPtFromSwap, EMPTY_BYTES); // PT goes to market for LP
|
|
76
|
-
(netLpOut, , ) = IPMarket(market).mint(address(this), netSyToAdd, netPtFromSwap);
|
|
77
|
-
|
|
78
|
-
if (netLpOut < minLpOut) revert Errors.BotInsufficientLpOut(netLpOut, minLpOut);
|
|
79
|
-
}
|
|
80
|
-
|
|
31
|
+
|
|
81
32
|
function _addLiqFromYt(
|
|
82
33
|
uint256 netPtFromSwap,
|
|
83
34
|
uint256 minLpOut
|
|
@@ -147,32 +98,4 @@ abstract contract BotActionHelper is TradingBotBase, BotActionCallback {
|
|
|
147
98
|
|
|
148
99
|
IPMarket(market).swapExactPtForSy(YT, totalPtToSwap, _encodeRemoveLiqToYt(minYtOut)); // SY goes to YT to mint PY
|
|
149
100
|
}
|
|
150
|
-
|
|
151
|
-
function _swapPtForYt(
|
|
152
|
-
uint256 netPtToSwap,
|
|
153
|
-
ApproxParams memory guessTotalPtToSwap,
|
|
154
|
-
uint256 minYtOut
|
|
155
|
-
) internal returns (uint256 netYtOut) {
|
|
156
|
-
(netYtOut, ) = IPAllAction(router).swapExactPtForYt(
|
|
157
|
-
address(this),
|
|
158
|
-
market,
|
|
159
|
-
netPtToSwap,
|
|
160
|
-
minYtOut,
|
|
161
|
-
guessTotalPtToSwap
|
|
162
|
-
);
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
function _swapYtForPt(
|
|
166
|
-
uint256 netYtToSwap,
|
|
167
|
-
ApproxParams memory guessTotalYtToSwap,
|
|
168
|
-
uint256 minPtOut
|
|
169
|
-
) internal returns (uint256 netPtOut) {
|
|
170
|
-
(netPtOut, ) = IPAllAction(router).swapExactYtForPt(
|
|
171
|
-
address(this),
|
|
172
|
-
market,
|
|
173
|
-
netYtToSwap,
|
|
174
|
-
minPtOut,
|
|
175
|
-
guessTotalYtToSwap
|
|
176
|
-
);
|
|
177
|
-
}
|
|
178
101
|
}
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
pragma solidity 0.8.17;
|
|
3
3
|
|
|
4
4
|
import "../base/TradingBotBase.sol";
|
|
5
|
-
import "
|
|
5
|
+
import "./LongYieldActionHelper.sol";
|
|
6
6
|
import "../../../interfaces/TradingBot/ILongYieldTradingBot.sol";
|
|
7
7
|
import "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol";
|
|
8
8
|
|
|
9
9
|
contract LongYieldTradingBot is
|
|
10
10
|
TradingBotBase,
|
|
11
|
-
|
|
11
|
+
LongYieldActionHelper,
|
|
12
12
|
ILongYieldTradingBot,
|
|
13
13
|
UUPSUpgradeable
|
|
14
14
|
{
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
pragma solidity 0.8.17;
|
|
3
|
+
|
|
4
|
+
import "../base/TradingBotBase.sol";
|
|
5
|
+
|
|
6
|
+
abstract contract ShortYieldActionHelper is TradingBotBase {
|
|
7
|
+
using PYIndexLib for IPYieldToken;
|
|
8
|
+
using PYIndexLib for PYIndex;
|
|
9
|
+
using MarketMathCore for MarketState;
|
|
10
|
+
using MarketApproxPtInLib for MarketState;
|
|
11
|
+
using Math for int256;
|
|
12
|
+
|
|
13
|
+
bytes internal constant EMPTY_BYTES = abi.encode();
|
|
14
|
+
|
|
15
|
+
function _mintPY(
|
|
16
|
+
uint256 netSyIn,
|
|
17
|
+
uint256 minPyOut
|
|
18
|
+
) internal returns (uint256 netPyOut) {
|
|
19
|
+
return IPAllAction(router).mintPyFromSy(
|
|
20
|
+
address(this),
|
|
21
|
+
YT,
|
|
22
|
+
netSyIn,
|
|
23
|
+
minPyOut
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function _swapPtForYt(
|
|
28
|
+
uint256 netPtToSwap,
|
|
29
|
+
ApproxParams memory guessTotalPtToSwap,
|
|
30
|
+
uint256 minYtOut
|
|
31
|
+
) internal returns (uint256 netYtOut) {
|
|
32
|
+
(netYtOut, ) = IPAllAction(router).swapExactPtForYt(
|
|
33
|
+
address(this),
|
|
34
|
+
market,
|
|
35
|
+
netPtToSwap,
|
|
36
|
+
minYtOut,
|
|
37
|
+
guessTotalPtToSwap
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function _swapYtForPt(
|
|
42
|
+
uint256 netYtToSwap,
|
|
43
|
+
ApproxParams memory guessTotalYtToSwap,
|
|
44
|
+
uint256 minPtOut
|
|
45
|
+
) internal returns (uint256 netPtOut) {
|
|
46
|
+
(netPtOut, ) = IPAllAction(router).swapExactYtForPt(
|
|
47
|
+
address(this),
|
|
48
|
+
market,
|
|
49
|
+
netYtToSwap,
|
|
50
|
+
minPtOut,
|
|
51
|
+
guessTotalYtToSwap
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
pragma solidity 0.8.17;
|
|
3
3
|
|
|
4
4
|
import "../base/TradingBotBase.sol";
|
|
5
|
-
import "
|
|
5
|
+
import "./ShortYieldActionHelper.sol";
|
|
6
6
|
import "../../../interfaces/TradingBot/IShortYieldTradingBot.sol";
|
|
7
7
|
import "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol";
|
|
8
8
|
|
|
9
9
|
contract ShortYieldTradingBot is
|
|
10
10
|
TradingBotBase,
|
|
11
|
-
|
|
11
|
+
ShortYieldActionHelper,
|
|
12
12
|
IShortYieldTradingBot,
|
|
13
13
|
UUPSUpgradeable
|
|
14
14
|
{
|
|
@@ -4,7 +4,7 @@ pragma solidity 0.8.17;
|
|
|
4
4
|
import "../../libraries/BoringOwnableUpgradeable.sol";
|
|
5
5
|
import "../../libraries/TokenHelper.sol";
|
|
6
6
|
import "../../../interfaces/TradingBot/ITradingBotBase.sol";
|
|
7
|
-
import "
|
|
7
|
+
import "../../../interfaces/TradingBot/IBotDecisionHelper.sol";
|
|
8
8
|
|
|
9
9
|
abstract contract TradingBotBase is BoringOwnableUpgradeable, TokenHelper, ITradingBotBase {
|
|
10
10
|
using TokenAmountLib for TokenAmount[];
|
|
@@ -110,13 +110,13 @@ abstract contract TradingBotBase is BoringOwnableUpgradeable, TokenHelper, ITrad
|
|
|
110
110
|
rewards = rewards.add(lpRewardTokens, lpRewardAmounts);
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
-
function
|
|
113
|
+
function _readMarketExtState() internal returns (MarketExtState memory marketExt) {
|
|
114
114
|
marketExt.state = IPMarket(market).readState(router);
|
|
115
115
|
marketExt.index = IPYieldToken(YT).newIndex();
|
|
116
116
|
marketExt.blockTime = block.timestamp;
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
-
function
|
|
119
|
+
function _readBotState() internal view returns (BotState memory botState) {
|
|
120
120
|
botState.lpBalance = _selfBalance(market);
|
|
121
121
|
botState.syBalance = _selfBalance(SY);
|
|
122
122
|
botState.ytBalance = _selfBalance(YT);
|
|
@@ -172,8 +172,8 @@ abstract contract TradingBotBase is BoringOwnableUpgradeable, TokenHelper, ITrad
|
|
|
172
172
|
}
|
|
173
173
|
|
|
174
174
|
function readStrategyData() public returns (StrategyData memory strategyData) {
|
|
175
|
-
strategyData.botState =
|
|
176
|
-
strategyData.marketExt =
|
|
175
|
+
strategyData.botState = _readBotState();
|
|
176
|
+
strategyData.marketExt = _readMarketExtState();
|
|
177
177
|
strategyData.specs = specs;
|
|
178
178
|
}
|
|
179
179
|
|
|
@@ -57,10 +57,6 @@ interface ITradingBotBase {
|
|
|
57
57
|
|
|
58
58
|
function claimWithoutCompound() external returns (TokenAmount[] memory rewards);
|
|
59
59
|
|
|
60
|
-
function readMarketExtState() external returns (MarketExtState memory marketExt);
|
|
61
|
-
|
|
62
|
-
function readBotState() external view returns (BotState memory botState);
|
|
63
|
-
|
|
64
60
|
function readStrategyData() external returns (StrategyData memory strategyData);
|
|
65
61
|
|
|
66
62
|
function setSpecs(TradingSpecs calldata _specs) external;
|
package/package.json
CHANGED
|
@@ -205,8 +205,6 @@ export interface BotActionCallbackInterface extends utils.Interface {
|
|
|
205
205
|
"market()": FunctionFragment;
|
|
206
206
|
"owner()": FunctionFragment;
|
|
207
207
|
"pendingOwner()": FunctionFragment;
|
|
208
|
-
"readBotState()": FunctionFragment;
|
|
209
|
-
"readMarketExtState()": FunctionFragment;
|
|
210
208
|
"readStrategyData()": FunctionFragment;
|
|
211
209
|
"router()": FunctionFragment;
|
|
212
210
|
"setSpecs((uint256,uint256,uint256,uint256,uint256,uint256))": FunctionFragment;
|
|
@@ -255,14 +253,6 @@ export interface BotActionCallbackInterface extends utils.Interface {
|
|
|
255
253
|
functionFragment: "pendingOwner",
|
|
256
254
|
values?: undefined
|
|
257
255
|
): string;
|
|
258
|
-
encodeFunctionData(
|
|
259
|
-
functionFragment: "readBotState",
|
|
260
|
-
values?: undefined
|
|
261
|
-
): string;
|
|
262
|
-
encodeFunctionData(
|
|
263
|
-
functionFragment: "readMarketExtState",
|
|
264
|
-
values?: undefined
|
|
265
|
-
): string;
|
|
266
256
|
encodeFunctionData(
|
|
267
257
|
functionFragment: "readStrategyData",
|
|
268
258
|
values?: undefined
|
|
@@ -319,14 +309,6 @@ export interface BotActionCallbackInterface extends utils.Interface {
|
|
|
319
309
|
functionFragment: "pendingOwner",
|
|
320
310
|
data: BytesLike
|
|
321
311
|
): Result;
|
|
322
|
-
decodeFunctionResult(
|
|
323
|
-
functionFragment: "readBotState",
|
|
324
|
-
data: BytesLike
|
|
325
|
-
): Result;
|
|
326
|
-
decodeFunctionResult(
|
|
327
|
-
functionFragment: "readMarketExtState",
|
|
328
|
-
data: BytesLike
|
|
329
|
-
): Result;
|
|
330
312
|
decodeFunctionResult(
|
|
331
313
|
functionFragment: "readStrategyData",
|
|
332
314
|
data: BytesLike
|
|
@@ -478,14 +460,6 @@ export interface BotActionCallback extends BaseContract {
|
|
|
478
460
|
|
|
479
461
|
pendingOwner(overrides?: CallOverrides): Promise<[string]>;
|
|
480
462
|
|
|
481
|
-
readBotState(
|
|
482
|
-
overrides?: CallOverrides
|
|
483
|
-
): Promise<[BotStateStructOutput] & { botState: BotStateStructOutput }>;
|
|
484
|
-
|
|
485
|
-
readMarketExtState(
|
|
486
|
-
overrides?: Overrides & { from?: string | Promise<string> }
|
|
487
|
-
): Promise<ContractTransaction>;
|
|
488
|
-
|
|
489
463
|
readStrategyData(
|
|
490
464
|
overrides?: Overrides & { from?: string | Promise<string> }
|
|
491
465
|
): Promise<ContractTransaction>;
|
|
@@ -579,12 +553,6 @@ export interface BotActionCallback extends BaseContract {
|
|
|
579
553
|
|
|
580
554
|
pendingOwner(overrides?: CallOverrides): Promise<string>;
|
|
581
555
|
|
|
582
|
-
readBotState(overrides?: CallOverrides): Promise<BotStateStructOutput>;
|
|
583
|
-
|
|
584
|
-
readMarketExtState(
|
|
585
|
-
overrides?: Overrides & { from?: string | Promise<string> }
|
|
586
|
-
): Promise<ContractTransaction>;
|
|
587
|
-
|
|
588
556
|
readStrategyData(
|
|
589
557
|
overrides?: Overrides & { from?: string | Promise<string> }
|
|
590
558
|
): Promise<ContractTransaction>;
|
|
@@ -675,12 +643,6 @@ export interface BotActionCallback extends BaseContract {
|
|
|
675
643
|
|
|
676
644
|
pendingOwner(overrides?: CallOverrides): Promise<string>;
|
|
677
645
|
|
|
678
|
-
readBotState(overrides?: CallOverrides): Promise<BotStateStructOutput>;
|
|
679
|
-
|
|
680
|
-
readMarketExtState(
|
|
681
|
-
overrides?: CallOverrides
|
|
682
|
-
): Promise<MarketExtStateStructOutput>;
|
|
683
|
-
|
|
684
646
|
readStrategyData(
|
|
685
647
|
overrides?: CallOverrides
|
|
686
648
|
): Promise<StrategyDataStructOutput>;
|
|
@@ -819,12 +781,6 @@ export interface BotActionCallback extends BaseContract {
|
|
|
819
781
|
|
|
820
782
|
pendingOwner(overrides?: CallOverrides): Promise<BigNumber>;
|
|
821
783
|
|
|
822
|
-
readBotState(overrides?: CallOverrides): Promise<BigNumber>;
|
|
823
|
-
|
|
824
|
-
readMarketExtState(
|
|
825
|
-
overrides?: Overrides & { from?: string | Promise<string> }
|
|
826
|
-
): Promise<BigNumber>;
|
|
827
|
-
|
|
828
784
|
readStrategyData(
|
|
829
785
|
overrides?: Overrides & { from?: string | Promise<string> }
|
|
830
786
|
): Promise<BigNumber>;
|
|
@@ -908,12 +864,6 @@ export interface BotActionCallback extends BaseContract {
|
|
|
908
864
|
|
|
909
865
|
pendingOwner(overrides?: CallOverrides): Promise<PopulatedTransaction>;
|
|
910
866
|
|
|
911
|
-
readBotState(overrides?: CallOverrides): Promise<PopulatedTransaction>;
|
|
912
|
-
|
|
913
|
-
readMarketExtState(
|
|
914
|
-
overrides?: Overrides & { from?: string | Promise<string> }
|
|
915
|
-
): Promise<PopulatedTransaction>;
|
|
916
|
-
|
|
917
867
|
readStrategyData(
|
|
918
868
|
overrides?: Overrides & { from?: string | Promise<string> }
|
|
919
869
|
): Promise<PopulatedTransaction>;
|
|
@@ -262,8 +262,6 @@ export interface ILongYieldTradingBotInterface extends utils.Interface {
|
|
|
262
262
|
"claimWithoutCompound()": FunctionFragment;
|
|
263
263
|
"depositSy(uint256)": FunctionFragment;
|
|
264
264
|
"depositToken((address,uint256,address,address,address,(uint8,address,bytes,bool)),uint256)": FunctionFragment;
|
|
265
|
-
"readBotState()": FunctionFragment;
|
|
266
|
-
"readMarketExtState()": FunctionFragment;
|
|
267
265
|
"readStrategyData()": FunctionFragment;
|
|
268
266
|
"removeLiqToYt(((uint256,uint256,uint256,uint256,uint256),(uint256,uint256,uint256,uint256,uint256),uint256,uint256,int256))": FunctionFragment;
|
|
269
267
|
"setSpecs((uint256,uint256,uint256,uint256,uint256,uint256))": FunctionFragment;
|
|
@@ -298,14 +296,6 @@ export interface ILongYieldTradingBotInterface extends utils.Interface {
|
|
|
298
296
|
functionFragment: "depositToken",
|
|
299
297
|
values: [TokenInputStruct, BigNumberish]
|
|
300
298
|
): string;
|
|
301
|
-
encodeFunctionData(
|
|
302
|
-
functionFragment: "readBotState",
|
|
303
|
-
values?: undefined
|
|
304
|
-
): string;
|
|
305
|
-
encodeFunctionData(
|
|
306
|
-
functionFragment: "readMarketExtState",
|
|
307
|
-
values?: undefined
|
|
308
|
-
): string;
|
|
309
299
|
encodeFunctionData(
|
|
310
300
|
functionFragment: "readStrategyData",
|
|
311
301
|
values?: undefined
|
|
@@ -345,14 +335,6 @@ export interface ILongYieldTradingBotInterface extends utils.Interface {
|
|
|
345
335
|
functionFragment: "depositToken",
|
|
346
336
|
data: BytesLike
|
|
347
337
|
): Result;
|
|
348
|
-
decodeFunctionResult(
|
|
349
|
-
functionFragment: "readBotState",
|
|
350
|
-
data: BytesLike
|
|
351
|
-
): Result;
|
|
352
|
-
decodeFunctionResult(
|
|
353
|
-
functionFragment: "readMarketExtState",
|
|
354
|
-
data: BytesLike
|
|
355
|
-
): Result;
|
|
356
338
|
decodeFunctionResult(
|
|
357
339
|
functionFragment: "readStrategyData",
|
|
358
340
|
data: BytesLike
|
|
@@ -535,14 +517,6 @@ export interface ILongYieldTradingBot extends BaseContract {
|
|
|
535
517
|
overrides?: PayableOverrides & { from?: string | Promise<string> }
|
|
536
518
|
): Promise<ContractTransaction>;
|
|
537
519
|
|
|
538
|
-
readBotState(
|
|
539
|
-
overrides?: CallOverrides
|
|
540
|
-
): Promise<[BotStateStructOutput] & { botState: BotStateStructOutput }>;
|
|
541
|
-
|
|
542
|
-
readMarketExtState(
|
|
543
|
-
overrides?: Overrides & { from?: string | Promise<string> }
|
|
544
|
-
): Promise<ContractTransaction>;
|
|
545
|
-
|
|
546
520
|
readStrategyData(
|
|
547
521
|
overrides?: Overrides & { from?: string | Promise<string> }
|
|
548
522
|
): Promise<ContractTransaction>;
|
|
@@ -602,12 +576,6 @@ export interface ILongYieldTradingBot extends BaseContract {
|
|
|
602
576
|
overrides?: PayableOverrides & { from?: string | Promise<string> }
|
|
603
577
|
): Promise<ContractTransaction>;
|
|
604
578
|
|
|
605
|
-
readBotState(overrides?: CallOverrides): Promise<BotStateStructOutput>;
|
|
606
|
-
|
|
607
|
-
readMarketExtState(
|
|
608
|
-
overrides?: Overrides & { from?: string | Promise<string> }
|
|
609
|
-
): Promise<ContractTransaction>;
|
|
610
|
-
|
|
611
579
|
readStrategyData(
|
|
612
580
|
overrides?: Overrides & { from?: string | Promise<string> }
|
|
613
581
|
): Promise<ContractTransaction>;
|
|
@@ -674,12 +642,6 @@ export interface ILongYieldTradingBot extends BaseContract {
|
|
|
674
642
|
overrides?: CallOverrides
|
|
675
643
|
): Promise<void>;
|
|
676
644
|
|
|
677
|
-
readBotState(overrides?: CallOverrides): Promise<BotStateStructOutput>;
|
|
678
|
-
|
|
679
|
-
readMarketExtState(
|
|
680
|
-
overrides?: CallOverrides
|
|
681
|
-
): Promise<MarketExtStateStructOutput>;
|
|
682
|
-
|
|
683
645
|
readStrategyData(
|
|
684
646
|
overrides?: CallOverrides
|
|
685
647
|
): Promise<StrategyDataStructOutput>;
|
|
@@ -833,12 +795,6 @@ export interface ILongYieldTradingBot extends BaseContract {
|
|
|
833
795
|
overrides?: PayableOverrides & { from?: string | Promise<string> }
|
|
834
796
|
): Promise<BigNumber>;
|
|
835
797
|
|
|
836
|
-
readBotState(overrides?: CallOverrides): Promise<BigNumber>;
|
|
837
|
-
|
|
838
|
-
readMarketExtState(
|
|
839
|
-
overrides?: Overrides & { from?: string | Promise<string> }
|
|
840
|
-
): Promise<BigNumber>;
|
|
841
|
-
|
|
842
798
|
readStrategyData(
|
|
843
799
|
overrides?: Overrides & { from?: string | Promise<string> }
|
|
844
800
|
): Promise<BigNumber>;
|
|
@@ -899,12 +855,6 @@ export interface ILongYieldTradingBot extends BaseContract {
|
|
|
899
855
|
overrides?: PayableOverrides & { from?: string | Promise<string> }
|
|
900
856
|
): Promise<PopulatedTransaction>;
|
|
901
857
|
|
|
902
|
-
readBotState(overrides?: CallOverrides): Promise<PopulatedTransaction>;
|
|
903
|
-
|
|
904
|
-
readMarketExtState(
|
|
905
|
-
overrides?: Overrides & { from?: string | Promise<string> }
|
|
906
|
-
): Promise<PopulatedTransaction>;
|
|
907
|
-
|
|
908
858
|
readStrategyData(
|
|
909
859
|
overrides?: Overrides & { from?: string | Promise<string> }
|
|
910
860
|
): Promise<PopulatedTransaction>;
|