@strkfarm/sdk 1.1.52 → 1.1.55
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/dist/index.browser.global.js +35 -19
- package/dist/index.browser.mjs +35 -19
- package/dist/index.d.ts +19 -15
- package/dist/index.js +35 -19
- package/dist/index.mjs +35 -19
- package/package.json +1 -1
- package/src/modules/harvests.ts +4 -0
- package/src/strategies/base-strategy.ts +5 -0
- package/src/strategies/ekubo-cl-vault.tsx +10 -12
- package/src/strategies/universal-lst-muliplier-strategy.tsx +8 -6
- package/src/strategies/universal-strategy.tsx +10 -3
- package/src/strategies/vesu-rebalance.tsx +11 -4
|
@@ -55712,6 +55712,9 @@ ${JSON.stringify(data, null, 2)}`;
|
|
|
55712
55712
|
async getVaultPositions() {
|
|
55713
55713
|
throw new Error("Not implemented");
|
|
55714
55714
|
}
|
|
55715
|
+
async getPendingRewards() {
|
|
55716
|
+
return [];
|
|
55717
|
+
}
|
|
55715
55718
|
};
|
|
55716
55719
|
|
|
55717
55720
|
// src/node/headless.browser.ts
|
|
@@ -55795,6 +55798,10 @@ ${JSON.stringify(data, null, 2)}`;
|
|
|
55795
55798
|
const claimed_amount = Web3Number.fromWei(_claimed_amount.toString(), 18);
|
|
55796
55799
|
logger2.verbose(`${_VesuHarvests.name}: claimed_amount: ${claimed_amount.toString()}`);
|
|
55797
55800
|
const data = _data.data["defiSpring"];
|
|
55801
|
+
if (!data) {
|
|
55802
|
+
logger2.verbose(`${_VesuHarvests.name}: no defiSpring data found`);
|
|
55803
|
+
return [];
|
|
55804
|
+
}
|
|
55798
55805
|
const actualReward = Web3Number.fromWei(data.amount, 18).minus(claimed_amount);
|
|
55799
55806
|
logger2.verbose(`${_VesuHarvests.name}: actualReward: ${actualReward.toString()}`);
|
|
55800
55807
|
return [{
|
|
@@ -61810,10 +61817,16 @@ ${JSON.stringify(data, null, 2)}`;
|
|
|
61810
61817
|
});
|
|
61811
61818
|
return [baseFlow];
|
|
61812
61819
|
}
|
|
61820
|
+
async getPendingRewards() {
|
|
61821
|
+
const vesuHarvests = new VesuHarvests(this.config);
|
|
61822
|
+
return await vesuHarvests.getUnHarvestedRewards(this.address);
|
|
61823
|
+
}
|
|
61813
61824
|
async harvest(acc) {
|
|
61814
|
-
const
|
|
61815
|
-
|
|
61816
|
-
|
|
61825
|
+
const pendingRewards = await this.getPendingRewards();
|
|
61826
|
+
if (pendingRewards.length == 0) {
|
|
61827
|
+
throw new Error(`No pending rewards found`);
|
|
61828
|
+
}
|
|
61829
|
+
const harvest = pendingRewards[0];
|
|
61817
61830
|
const avnu = new AvnuWrapper();
|
|
61818
61831
|
let swapInfo = {
|
|
61819
61832
|
token_from_address: harvest.token.address,
|
|
@@ -80565,13 +80578,14 @@ spurious results.`);
|
|
|
80565
80578
|
amount1
|
|
80566
80579
|
};
|
|
80567
80580
|
}
|
|
80568
|
-
async
|
|
80581
|
+
async getPendingRewards() {
|
|
80569
80582
|
const ekuboHarvests = new EkuboHarvests(this.config);
|
|
80570
|
-
|
|
80571
|
-
|
|
80572
|
-
|
|
80573
|
-
|
|
80574
|
-
|
|
80583
|
+
return await ekuboHarvests.getUnHarvestedRewards(this.address);
|
|
80584
|
+
}
|
|
80585
|
+
async harvest(acc, maxIterations = 20, priceRatioPrecision = 4) {
|
|
80586
|
+
const pendingRewards = await this.getPendingRewards();
|
|
80587
|
+
if (pendingRewards.length == 0) {
|
|
80588
|
+
logger2.verbose(`${_EkuboCLVault.name}: harvest => no pending rewards found`);
|
|
80575
80589
|
return [];
|
|
80576
80590
|
}
|
|
80577
80591
|
const poolKey = await this.getPoolKey();
|
|
@@ -80579,10 +80593,10 @@ spurious results.`);
|
|
|
80579
80593
|
const token1Info = await Global.getTokenInfoFromAddr(poolKey.token1);
|
|
80580
80594
|
const bounds = await this.getCurrentBounds();
|
|
80581
80595
|
logger2.verbose(
|
|
80582
|
-
`${_EkuboCLVault.name}: harvest => unClaimedRewards: ${
|
|
80596
|
+
`${_EkuboCLVault.name}: harvest => unClaimedRewards: ${pendingRewards.length}`
|
|
80583
80597
|
);
|
|
80584
80598
|
const calls = [];
|
|
80585
|
-
const chosenClaim =
|
|
80599
|
+
const chosenClaim = pendingRewards[0];
|
|
80586
80600
|
logger2.info(`${_EkuboCLVault.name}: harvest => doing one at a time`);
|
|
80587
80601
|
logger2.info(`${_EkuboCLVault.name}: harvest => chosenClaim -> Claim ID: ${chosenClaim.claim.id}, Amount: ${chosenClaim.claim.amount.toString()}, actualAmount: ${chosenClaim.actualReward.toString()}, addr: ${chosenClaim.claim.claimee.toString()}`);
|
|
80588
80602
|
for (let claim of [chosenClaim]) {
|
|
@@ -94156,9 +94170,15 @@ spurious results.`);
|
|
|
94156
94170
|
const manageCall = this.getManageCall(["approve_bring_liquidity" /* APPROVE_BRING_LIQUIDITY */, "bring_liquidity" /* BRING_LIQUIDITY */], [manageCall1, manageCall2]);
|
|
94157
94171
|
return manageCall;
|
|
94158
94172
|
}
|
|
94159
|
-
async
|
|
94173
|
+
async getPendingRewards() {
|
|
94160
94174
|
const vesuHarvest = new VesuHarvests(this.config);
|
|
94161
|
-
|
|
94175
|
+
return await vesuHarvest.getUnHarvestedRewards(this.metadata.additionalInfo.vaultAllocator);
|
|
94176
|
+
}
|
|
94177
|
+
async getHarvestCall() {
|
|
94178
|
+
const harvestInfo = await this.getPendingRewards();
|
|
94179
|
+
if (harvestInfo.length == 0) {
|
|
94180
|
+
throw new Error(`No pending rewards found`);
|
|
94181
|
+
}
|
|
94162
94182
|
if (harvestInfo.length != 1) {
|
|
94163
94183
|
throw new Error(`Expected 1 harvest info, got ${harvestInfo.length}`);
|
|
94164
94184
|
}
|
|
@@ -95174,16 +95194,12 @@ spurious results.`);
|
|
|
95174
95194
|
logger2.verbose(`${this.getTag()}::getModifyLeverCall leverSwap: ${JSON.stringify(leverSwap)}`);
|
|
95175
95195
|
let minLSTReceived = params.debtAmount.dividedBy(lstDexPriceInUnderlying).multipliedBy(1 - MAX_SLIPPAGE);
|
|
95176
95196
|
const minLSTReceivedAsPerTruePrice = params.debtAmount.dividedBy(lstTrueExchangeRate);
|
|
95177
|
-
|
|
95178
|
-
minLSTReceived = minLSTReceivedAsPerTruePrice;
|
|
95179
|
-
}
|
|
95197
|
+
minLSTReceived = minLSTReceivedAsPerTruePrice;
|
|
95180
95198
|
logger2.verbose(`${this.getTag()}::getModifyLeverCall minLSTReceivedAsPerTruePrice: ${minLSTReceivedAsPerTruePrice}, minLSTReceived: ${minLSTReceived}`);
|
|
95181
95199
|
let maxUsedCollateral = params.debtAmount.abs().dividedBy(lstDexPriceInUnderlying).multipliedBy(1 + MAX_SLIPPAGE);
|
|
95182
95200
|
const maxUsedCollateralInLST = params.debtAmount.abs().dividedBy(lstTrueExchangeRate).multipliedBy(1.005);
|
|
95183
95201
|
logger2.verbose(`${this.getTag()}::getModifyLeverCall maxUsedCollateralInLST: ${maxUsedCollateralInLST}, maxUsedCollateral: ${maxUsedCollateral}`);
|
|
95184
|
-
|
|
95185
|
-
maxUsedCollateral = maxUsedCollateralInLST;
|
|
95186
|
-
}
|
|
95202
|
+
maxUsedCollateral = maxUsedCollateralInLST;
|
|
95187
95203
|
const STEP2_ID = "switch_delegation_on" /* SWITCH_DELEGATION_ON */;
|
|
95188
95204
|
const manage2Info = this.getProofs(STEP2_ID);
|
|
95189
95205
|
const manageCall2 = manage2Info.callConstructor({
|
package/dist/index.browser.mjs
CHANGED
|
@@ -4110,6 +4110,9 @@ var BaseStrategy = class extends CacheClass {
|
|
|
4110
4110
|
async getVaultPositions() {
|
|
4111
4111
|
throw new Error("Not implemented");
|
|
4112
4112
|
}
|
|
4113
|
+
async getPendingRewards() {
|
|
4114
|
+
return [];
|
|
4115
|
+
}
|
|
4113
4116
|
};
|
|
4114
4117
|
|
|
4115
4118
|
// src/node/headless.browser.ts
|
|
@@ -4195,6 +4198,10 @@ var VesuHarvests = class _VesuHarvests extends Harvests {
|
|
|
4195
4198
|
const claimed_amount = Web3Number.fromWei(_claimed_amount.toString(), 18);
|
|
4196
4199
|
logger.verbose(`${_VesuHarvests.name}: claimed_amount: ${claimed_amount.toString()}`);
|
|
4197
4200
|
const data = _data.data["defiSpring"];
|
|
4201
|
+
if (!data) {
|
|
4202
|
+
logger.verbose(`${_VesuHarvests.name}: no defiSpring data found`);
|
|
4203
|
+
return [];
|
|
4204
|
+
}
|
|
4198
4205
|
const actualReward = Web3Number.fromWei(data.amount, 18).minus(claimed_amount);
|
|
4199
4206
|
logger.verbose(`${_VesuHarvests.name}: actualReward: ${actualReward.toString()}`);
|
|
4200
4207
|
return [{
|
|
@@ -10210,10 +10217,16 @@ var VesuRebalance = class _VesuRebalance extends BaseStrategy {
|
|
|
10210
10217
|
});
|
|
10211
10218
|
return [baseFlow];
|
|
10212
10219
|
}
|
|
10220
|
+
async getPendingRewards() {
|
|
10221
|
+
const vesuHarvests = new VesuHarvests(this.config);
|
|
10222
|
+
return await vesuHarvests.getUnHarvestedRewards(this.address);
|
|
10223
|
+
}
|
|
10213
10224
|
async harvest(acc) {
|
|
10214
|
-
const
|
|
10215
|
-
|
|
10216
|
-
|
|
10225
|
+
const pendingRewards = await this.getPendingRewards();
|
|
10226
|
+
if (pendingRewards.length == 0) {
|
|
10227
|
+
throw new Error(`No pending rewards found`);
|
|
10228
|
+
}
|
|
10229
|
+
const harvest = pendingRewards[0];
|
|
10217
10230
|
const avnu = new AvnuWrapper();
|
|
10218
10231
|
let swapInfo = {
|
|
10219
10232
|
token_from_address: harvest.token.address,
|
|
@@ -16642,13 +16655,14 @@ var EkuboCLVault = class _EkuboCLVault extends BaseStrategy {
|
|
|
16642
16655
|
amount1
|
|
16643
16656
|
};
|
|
16644
16657
|
}
|
|
16645
|
-
async
|
|
16658
|
+
async getPendingRewards() {
|
|
16646
16659
|
const ekuboHarvests = new EkuboHarvests(this.config);
|
|
16647
|
-
|
|
16648
|
-
|
|
16649
|
-
|
|
16650
|
-
|
|
16651
|
-
|
|
16660
|
+
return await ekuboHarvests.getUnHarvestedRewards(this.address);
|
|
16661
|
+
}
|
|
16662
|
+
async harvest(acc, maxIterations = 20, priceRatioPrecision = 4) {
|
|
16663
|
+
const pendingRewards = await this.getPendingRewards();
|
|
16664
|
+
if (pendingRewards.length == 0) {
|
|
16665
|
+
logger.verbose(`${_EkuboCLVault.name}: harvest => no pending rewards found`);
|
|
16652
16666
|
return [];
|
|
16653
16667
|
}
|
|
16654
16668
|
const poolKey = await this.getPoolKey();
|
|
@@ -16656,10 +16670,10 @@ var EkuboCLVault = class _EkuboCLVault extends BaseStrategy {
|
|
|
16656
16670
|
const token1Info = await Global.getTokenInfoFromAddr(poolKey.token1);
|
|
16657
16671
|
const bounds = await this.getCurrentBounds();
|
|
16658
16672
|
logger.verbose(
|
|
16659
|
-
`${_EkuboCLVault.name}: harvest => unClaimedRewards: ${
|
|
16673
|
+
`${_EkuboCLVault.name}: harvest => unClaimedRewards: ${pendingRewards.length}`
|
|
16660
16674
|
);
|
|
16661
16675
|
const calls = [];
|
|
16662
|
-
const chosenClaim =
|
|
16676
|
+
const chosenClaim = pendingRewards[0];
|
|
16663
16677
|
logger.info(`${_EkuboCLVault.name}: harvest => doing one at a time`);
|
|
16664
16678
|
logger.info(`${_EkuboCLVault.name}: harvest => chosenClaim -> Claim ID: ${chosenClaim.claim.id}, Amount: ${chosenClaim.claim.amount.toString()}, actualAmount: ${chosenClaim.actualReward.toString()}, addr: ${chosenClaim.claim.claimee.toString()}`);
|
|
16665
16679
|
for (let claim of [chosenClaim]) {
|
|
@@ -30246,9 +30260,15 @@ var UniversalStrategy = class _UniversalStrategy extends BaseStrategy {
|
|
|
30246
30260
|
const manageCall = this.getManageCall(["approve_bring_liquidity" /* APPROVE_BRING_LIQUIDITY */, "bring_liquidity" /* BRING_LIQUIDITY */], [manageCall1, manageCall2]);
|
|
30247
30261
|
return manageCall;
|
|
30248
30262
|
}
|
|
30249
|
-
async
|
|
30263
|
+
async getPendingRewards() {
|
|
30250
30264
|
const vesuHarvest = new VesuHarvests(this.config);
|
|
30251
|
-
|
|
30265
|
+
return await vesuHarvest.getUnHarvestedRewards(this.metadata.additionalInfo.vaultAllocator);
|
|
30266
|
+
}
|
|
30267
|
+
async getHarvestCall() {
|
|
30268
|
+
const harvestInfo = await this.getPendingRewards();
|
|
30269
|
+
if (harvestInfo.length == 0) {
|
|
30270
|
+
throw new Error(`No pending rewards found`);
|
|
30271
|
+
}
|
|
30252
30272
|
if (harvestInfo.length != 1) {
|
|
30253
30273
|
throw new Error(`Expected 1 harvest info, got ${harvestInfo.length}`);
|
|
30254
30274
|
}
|
|
@@ -31267,16 +31287,12 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
31267
31287
|
logger.verbose(`${this.getTag()}::getModifyLeverCall leverSwap: ${JSON.stringify(leverSwap)}`);
|
|
31268
31288
|
let minLSTReceived = params.debtAmount.dividedBy(lstDexPriceInUnderlying).multipliedBy(1 - MAX_SLIPPAGE);
|
|
31269
31289
|
const minLSTReceivedAsPerTruePrice = params.debtAmount.dividedBy(lstTrueExchangeRate);
|
|
31270
|
-
|
|
31271
|
-
minLSTReceived = minLSTReceivedAsPerTruePrice;
|
|
31272
|
-
}
|
|
31290
|
+
minLSTReceived = minLSTReceivedAsPerTruePrice;
|
|
31273
31291
|
logger.verbose(`${this.getTag()}::getModifyLeverCall minLSTReceivedAsPerTruePrice: ${minLSTReceivedAsPerTruePrice}, minLSTReceived: ${minLSTReceived}`);
|
|
31274
31292
|
let maxUsedCollateral = params.debtAmount.abs().dividedBy(lstDexPriceInUnderlying).multipliedBy(1 + MAX_SLIPPAGE);
|
|
31275
31293
|
const maxUsedCollateralInLST = params.debtAmount.abs().dividedBy(lstTrueExchangeRate).multipliedBy(1.005);
|
|
31276
31294
|
logger.verbose(`${this.getTag()}::getModifyLeverCall maxUsedCollateralInLST: ${maxUsedCollateralInLST}, maxUsedCollateral: ${maxUsedCollateral}`);
|
|
31277
|
-
|
|
31278
|
-
maxUsedCollateral = maxUsedCollateralInLST;
|
|
31279
|
-
}
|
|
31295
|
+
maxUsedCollateral = maxUsedCollateralInLST;
|
|
31280
31296
|
const STEP2_ID = "switch_delegation_on" /* SWITCH_DELEGATION_ON */;
|
|
31281
31297
|
const manage2Info = this.getProofs(STEP2_ID);
|
|
31282
31298
|
const manageCall2 = manage2Info.callConstructor({
|
package/dist/index.d.ts
CHANGED
|
@@ -375,6 +375,20 @@ declare class AutoCompounderSTRK {
|
|
|
375
375
|
}>;
|
|
376
376
|
}
|
|
377
377
|
|
|
378
|
+
interface HarvestInfo {
|
|
379
|
+
rewardsContract: ContractAddr;
|
|
380
|
+
token: ContractAddr;
|
|
381
|
+
startDate: Date;
|
|
382
|
+
endDate: Date;
|
|
383
|
+
claim: {
|
|
384
|
+
id: number;
|
|
385
|
+
amount: Web3Number;
|
|
386
|
+
claimee: ContractAddr;
|
|
387
|
+
};
|
|
388
|
+
actualReward: Web3Number;
|
|
389
|
+
proof: string[];
|
|
390
|
+
}
|
|
391
|
+
|
|
378
392
|
interface CacheData$1 {
|
|
379
393
|
timestamp: number;
|
|
380
394
|
ttl: number;
|
|
@@ -417,6 +431,7 @@ declare class BaseStrategy<TVLInfo, ActionInfo> extends CacheClass {
|
|
|
417
431
|
depositCall(amountInfo: ActionInfo, receiver: ContractAddr): Promise<Call[]>;
|
|
418
432
|
withdrawCall(amountInfo: ActionInfo, receiver: ContractAddr, owner: ContractAddr): Promise<Call[]>;
|
|
419
433
|
getVaultPositions(): Promise<VaultPosition[]>;
|
|
434
|
+
getPendingRewards(): Promise<HarvestInfo[]>;
|
|
420
435
|
}
|
|
421
436
|
|
|
422
437
|
interface PoolProps {
|
|
@@ -615,6 +630,7 @@ declare class VesuRebalance extends BaseStrategy<SingleTokenInfo, SingleActionAm
|
|
|
615
630
|
*/
|
|
616
631
|
getRebalanceCall(pools: Awaited<ReturnType<typeof this.getRebalancedPositions>>["changes"], isOverWeightAdjustment: boolean): Promise<starknet.Call | null>;
|
|
617
632
|
getInvestmentFlows(pools: PoolInfoFull[]): Promise<IInvestmentFlow[]>;
|
|
633
|
+
getPendingRewards(): Promise<HarvestInfo[]>;
|
|
618
634
|
harvest(acc: Account): Promise<starknet.Call[]>;
|
|
619
635
|
/**
|
|
620
636
|
* Calculates the fees deducted in different vTokens based on the current and previous state.
|
|
@@ -631,20 +647,6 @@ declare class VesuRebalance extends BaseStrategy<SingleTokenInfo, SingleActionAm
|
|
|
631
647
|
*/
|
|
632
648
|
declare const VesuRebalanceStrategies: IStrategyMetadata<VesuRebalanceSettings>[];
|
|
633
649
|
|
|
634
|
-
interface HarvestInfo {
|
|
635
|
-
rewardsContract: ContractAddr;
|
|
636
|
-
token: ContractAddr;
|
|
637
|
-
startDate: Date;
|
|
638
|
-
endDate: Date;
|
|
639
|
-
claim: {
|
|
640
|
-
id: number;
|
|
641
|
-
amount: Web3Number;
|
|
642
|
-
claimee: ContractAddr;
|
|
643
|
-
};
|
|
644
|
-
actualReward: Web3Number;
|
|
645
|
-
proof: string[];
|
|
646
|
-
}
|
|
647
|
-
|
|
648
650
|
interface EkuboPoolKey {
|
|
649
651
|
token0: ContractAddr;
|
|
650
652
|
token1: ContractAddr;
|
|
@@ -833,7 +835,8 @@ declare class EkuboCLVault extends BaseStrategy<DualTokenInfo, DualActionAmount>
|
|
|
833
835
|
amount0: Web3Number;
|
|
834
836
|
amount1: Web3Number;
|
|
835
837
|
}>;
|
|
836
|
-
|
|
838
|
+
getPendingRewards(): Promise<HarvestInfo[]>;
|
|
839
|
+
harvest(acc: Account, maxIterations?: number, priceRatioPrecision?: number): Promise<Call[]>;
|
|
837
840
|
/**
|
|
838
841
|
* @description This funciton requires atleast one of the pool tokens to be reward token
|
|
839
842
|
* i.e. STRK.
|
|
@@ -1378,6 +1381,7 @@ declare class UniversalStrategy<S extends UniversalStrategySettings> extends Bas
|
|
|
1378
1381
|
getBringLiquidityCall(params: {
|
|
1379
1382
|
amount: Web3Number;
|
|
1380
1383
|
}): Promise<Call>;
|
|
1384
|
+
getPendingRewards(): Promise<HarvestInfo[]>;
|
|
1381
1385
|
getHarvestCall(): Promise<{
|
|
1382
1386
|
call: Call;
|
|
1383
1387
|
reward: Web3Number;
|
package/dist/index.js
CHANGED
|
@@ -4114,6 +4114,9 @@ var BaseStrategy = class extends CacheClass {
|
|
|
4114
4114
|
async getVaultPositions() {
|
|
4115
4115
|
throw new Error("Not implemented");
|
|
4116
4116
|
}
|
|
4117
|
+
async getPendingRewards() {
|
|
4118
|
+
return [];
|
|
4119
|
+
}
|
|
4117
4120
|
};
|
|
4118
4121
|
|
|
4119
4122
|
// src/node/headless.browser.ts
|
|
@@ -4199,6 +4202,10 @@ var VesuHarvests = class _VesuHarvests extends Harvests {
|
|
|
4199
4202
|
const claimed_amount = Web3Number.fromWei(_claimed_amount.toString(), 18);
|
|
4200
4203
|
logger.verbose(`${_VesuHarvests.name}: claimed_amount: ${claimed_amount.toString()}`);
|
|
4201
4204
|
const data = _data.data["defiSpring"];
|
|
4205
|
+
if (!data) {
|
|
4206
|
+
logger.verbose(`${_VesuHarvests.name}: no defiSpring data found`);
|
|
4207
|
+
return [];
|
|
4208
|
+
}
|
|
4202
4209
|
const actualReward = Web3Number.fromWei(data.amount, 18).minus(claimed_amount);
|
|
4203
4210
|
logger.verbose(`${_VesuHarvests.name}: actualReward: ${actualReward.toString()}`);
|
|
4204
4211
|
return [{
|
|
@@ -10214,10 +10221,16 @@ var VesuRebalance = class _VesuRebalance extends BaseStrategy {
|
|
|
10214
10221
|
});
|
|
10215
10222
|
return [baseFlow];
|
|
10216
10223
|
}
|
|
10224
|
+
async getPendingRewards() {
|
|
10225
|
+
const vesuHarvests = new VesuHarvests(this.config);
|
|
10226
|
+
return await vesuHarvests.getUnHarvestedRewards(this.address);
|
|
10227
|
+
}
|
|
10217
10228
|
async harvest(acc) {
|
|
10218
|
-
const
|
|
10219
|
-
|
|
10220
|
-
|
|
10229
|
+
const pendingRewards = await this.getPendingRewards();
|
|
10230
|
+
if (pendingRewards.length == 0) {
|
|
10231
|
+
throw new Error(`No pending rewards found`);
|
|
10232
|
+
}
|
|
10233
|
+
const harvest = pendingRewards[0];
|
|
10221
10234
|
const avnu = new AvnuWrapper();
|
|
10222
10235
|
let swapInfo = {
|
|
10223
10236
|
token_from_address: harvest.token.address,
|
|
@@ -16642,13 +16655,14 @@ var EkuboCLVault = class _EkuboCLVault extends BaseStrategy {
|
|
|
16642
16655
|
amount1
|
|
16643
16656
|
};
|
|
16644
16657
|
}
|
|
16645
|
-
async
|
|
16658
|
+
async getPendingRewards() {
|
|
16646
16659
|
const ekuboHarvests = new EkuboHarvests(this.config);
|
|
16647
|
-
|
|
16648
|
-
|
|
16649
|
-
|
|
16650
|
-
|
|
16651
|
-
|
|
16660
|
+
return await ekuboHarvests.getUnHarvestedRewards(this.address);
|
|
16661
|
+
}
|
|
16662
|
+
async harvest(acc, maxIterations = 20, priceRatioPrecision = 4) {
|
|
16663
|
+
const pendingRewards = await this.getPendingRewards();
|
|
16664
|
+
if (pendingRewards.length == 0) {
|
|
16665
|
+
logger.verbose(`${_EkuboCLVault.name}: harvest => no pending rewards found`);
|
|
16652
16666
|
return [];
|
|
16653
16667
|
}
|
|
16654
16668
|
const poolKey = await this.getPoolKey();
|
|
@@ -16656,10 +16670,10 @@ var EkuboCLVault = class _EkuboCLVault extends BaseStrategy {
|
|
|
16656
16670
|
const token1Info = await Global.getTokenInfoFromAddr(poolKey.token1);
|
|
16657
16671
|
const bounds = await this.getCurrentBounds();
|
|
16658
16672
|
logger.verbose(
|
|
16659
|
-
`${_EkuboCLVault.name}: harvest => unClaimedRewards: ${
|
|
16673
|
+
`${_EkuboCLVault.name}: harvest => unClaimedRewards: ${pendingRewards.length}`
|
|
16660
16674
|
);
|
|
16661
16675
|
const calls = [];
|
|
16662
|
-
const chosenClaim =
|
|
16676
|
+
const chosenClaim = pendingRewards[0];
|
|
16663
16677
|
logger.info(`${_EkuboCLVault.name}: harvest => doing one at a time`);
|
|
16664
16678
|
logger.info(`${_EkuboCLVault.name}: harvest => chosenClaim -> Claim ID: ${chosenClaim.claim.id}, Amount: ${chosenClaim.claim.amount.toString()}, actualAmount: ${chosenClaim.actualReward.toString()}, addr: ${chosenClaim.claim.claimee.toString()}`);
|
|
16665
16679
|
for (let claim of [chosenClaim]) {
|
|
@@ -30246,9 +30260,15 @@ var UniversalStrategy = class _UniversalStrategy extends BaseStrategy {
|
|
|
30246
30260
|
const manageCall = this.getManageCall(["approve_bring_liquidity" /* APPROVE_BRING_LIQUIDITY */, "bring_liquidity" /* BRING_LIQUIDITY */], [manageCall1, manageCall2]);
|
|
30247
30261
|
return manageCall;
|
|
30248
30262
|
}
|
|
30249
|
-
async
|
|
30263
|
+
async getPendingRewards() {
|
|
30250
30264
|
const vesuHarvest = new VesuHarvests(this.config);
|
|
30251
|
-
|
|
30265
|
+
return await vesuHarvest.getUnHarvestedRewards(this.metadata.additionalInfo.vaultAllocator);
|
|
30266
|
+
}
|
|
30267
|
+
async getHarvestCall() {
|
|
30268
|
+
const harvestInfo = await this.getPendingRewards();
|
|
30269
|
+
if (harvestInfo.length == 0) {
|
|
30270
|
+
throw new Error(`No pending rewards found`);
|
|
30271
|
+
}
|
|
30252
30272
|
if (harvestInfo.length != 1) {
|
|
30253
30273
|
throw new Error(`Expected 1 harvest info, got ${harvestInfo.length}`);
|
|
30254
30274
|
}
|
|
@@ -31267,16 +31287,12 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
31267
31287
|
logger.verbose(`${this.getTag()}::getModifyLeverCall leverSwap: ${JSON.stringify(leverSwap)}`);
|
|
31268
31288
|
let minLSTReceived = params.debtAmount.dividedBy(lstDexPriceInUnderlying).multipliedBy(1 - MAX_SLIPPAGE);
|
|
31269
31289
|
const minLSTReceivedAsPerTruePrice = params.debtAmount.dividedBy(lstTrueExchangeRate);
|
|
31270
|
-
|
|
31271
|
-
minLSTReceived = minLSTReceivedAsPerTruePrice;
|
|
31272
|
-
}
|
|
31290
|
+
minLSTReceived = minLSTReceivedAsPerTruePrice;
|
|
31273
31291
|
logger.verbose(`${this.getTag()}::getModifyLeverCall minLSTReceivedAsPerTruePrice: ${minLSTReceivedAsPerTruePrice}, minLSTReceived: ${minLSTReceived}`);
|
|
31274
31292
|
let maxUsedCollateral = params.debtAmount.abs().dividedBy(lstDexPriceInUnderlying).multipliedBy(1 + MAX_SLIPPAGE);
|
|
31275
31293
|
const maxUsedCollateralInLST = params.debtAmount.abs().dividedBy(lstTrueExchangeRate).multipliedBy(1.005);
|
|
31276
31294
|
logger.verbose(`${this.getTag()}::getModifyLeverCall maxUsedCollateralInLST: ${maxUsedCollateralInLST}, maxUsedCollateral: ${maxUsedCollateral}`);
|
|
31277
|
-
|
|
31278
|
-
maxUsedCollateral = maxUsedCollateralInLST;
|
|
31279
|
-
}
|
|
31295
|
+
maxUsedCollateral = maxUsedCollateralInLST;
|
|
31280
31296
|
const STEP2_ID = "switch_delegation_on" /* SWITCH_DELEGATION_ON */;
|
|
31281
31297
|
const manage2Info = this.getProofs(STEP2_ID);
|
|
31282
31298
|
const manageCall2 = manage2Info.callConstructor({
|
package/dist/index.mjs
CHANGED
|
@@ -4008,6 +4008,9 @@ var BaseStrategy = class extends CacheClass {
|
|
|
4008
4008
|
async getVaultPositions() {
|
|
4009
4009
|
throw new Error("Not implemented");
|
|
4010
4010
|
}
|
|
4011
|
+
async getPendingRewards() {
|
|
4012
|
+
return [];
|
|
4013
|
+
}
|
|
4011
4014
|
};
|
|
4012
4015
|
|
|
4013
4016
|
// src/node/headless.browser.ts
|
|
@@ -4093,6 +4096,10 @@ var VesuHarvests = class _VesuHarvests extends Harvests {
|
|
|
4093
4096
|
const claimed_amount = Web3Number.fromWei(_claimed_amount.toString(), 18);
|
|
4094
4097
|
logger.verbose(`${_VesuHarvests.name}: claimed_amount: ${claimed_amount.toString()}`);
|
|
4095
4098
|
const data = _data.data["defiSpring"];
|
|
4099
|
+
if (!data) {
|
|
4100
|
+
logger.verbose(`${_VesuHarvests.name}: no defiSpring data found`);
|
|
4101
|
+
return [];
|
|
4102
|
+
}
|
|
4096
4103
|
const actualReward = Web3Number.fromWei(data.amount, 18).minus(claimed_amount);
|
|
4097
4104
|
logger.verbose(`${_VesuHarvests.name}: actualReward: ${actualReward.toString()}`);
|
|
4098
4105
|
return [{
|
|
@@ -10108,10 +10115,16 @@ var VesuRebalance = class _VesuRebalance extends BaseStrategy {
|
|
|
10108
10115
|
});
|
|
10109
10116
|
return [baseFlow];
|
|
10110
10117
|
}
|
|
10118
|
+
async getPendingRewards() {
|
|
10119
|
+
const vesuHarvests = new VesuHarvests(this.config);
|
|
10120
|
+
return await vesuHarvests.getUnHarvestedRewards(this.address);
|
|
10121
|
+
}
|
|
10111
10122
|
async harvest(acc) {
|
|
10112
|
-
const
|
|
10113
|
-
|
|
10114
|
-
|
|
10123
|
+
const pendingRewards = await this.getPendingRewards();
|
|
10124
|
+
if (pendingRewards.length == 0) {
|
|
10125
|
+
throw new Error(`No pending rewards found`);
|
|
10126
|
+
}
|
|
10127
|
+
const harvest = pendingRewards[0];
|
|
10115
10128
|
const avnu = new AvnuWrapper();
|
|
10116
10129
|
let swapInfo = {
|
|
10117
10130
|
token_from_address: harvest.token.address,
|
|
@@ -16540,13 +16553,14 @@ var EkuboCLVault = class _EkuboCLVault extends BaseStrategy {
|
|
|
16540
16553
|
amount1
|
|
16541
16554
|
};
|
|
16542
16555
|
}
|
|
16543
|
-
async
|
|
16556
|
+
async getPendingRewards() {
|
|
16544
16557
|
const ekuboHarvests = new EkuboHarvests(this.config);
|
|
16545
|
-
|
|
16546
|
-
|
|
16547
|
-
|
|
16548
|
-
|
|
16549
|
-
|
|
16558
|
+
return await ekuboHarvests.getUnHarvestedRewards(this.address);
|
|
16559
|
+
}
|
|
16560
|
+
async harvest(acc, maxIterations = 20, priceRatioPrecision = 4) {
|
|
16561
|
+
const pendingRewards = await this.getPendingRewards();
|
|
16562
|
+
if (pendingRewards.length == 0) {
|
|
16563
|
+
logger.verbose(`${_EkuboCLVault.name}: harvest => no pending rewards found`);
|
|
16550
16564
|
return [];
|
|
16551
16565
|
}
|
|
16552
16566
|
const poolKey = await this.getPoolKey();
|
|
@@ -16554,10 +16568,10 @@ var EkuboCLVault = class _EkuboCLVault extends BaseStrategy {
|
|
|
16554
16568
|
const token1Info = await Global.getTokenInfoFromAddr(poolKey.token1);
|
|
16555
16569
|
const bounds = await this.getCurrentBounds();
|
|
16556
16570
|
logger.verbose(
|
|
16557
|
-
`${_EkuboCLVault.name}: harvest => unClaimedRewards: ${
|
|
16571
|
+
`${_EkuboCLVault.name}: harvest => unClaimedRewards: ${pendingRewards.length}`
|
|
16558
16572
|
);
|
|
16559
16573
|
const calls = [];
|
|
16560
|
-
const chosenClaim =
|
|
16574
|
+
const chosenClaim = pendingRewards[0];
|
|
16561
16575
|
logger.info(`${_EkuboCLVault.name}: harvest => doing one at a time`);
|
|
16562
16576
|
logger.info(`${_EkuboCLVault.name}: harvest => chosenClaim -> Claim ID: ${chosenClaim.claim.id}, Amount: ${chosenClaim.claim.amount.toString()}, actualAmount: ${chosenClaim.actualReward.toString()}, addr: ${chosenClaim.claim.claimee.toString()}`);
|
|
16563
16577
|
for (let claim of [chosenClaim]) {
|
|
@@ -30144,9 +30158,15 @@ var UniversalStrategy = class _UniversalStrategy extends BaseStrategy {
|
|
|
30144
30158
|
const manageCall = this.getManageCall(["approve_bring_liquidity" /* APPROVE_BRING_LIQUIDITY */, "bring_liquidity" /* BRING_LIQUIDITY */], [manageCall1, manageCall2]);
|
|
30145
30159
|
return manageCall;
|
|
30146
30160
|
}
|
|
30147
|
-
async
|
|
30161
|
+
async getPendingRewards() {
|
|
30148
30162
|
const vesuHarvest = new VesuHarvests(this.config);
|
|
30149
|
-
|
|
30163
|
+
return await vesuHarvest.getUnHarvestedRewards(this.metadata.additionalInfo.vaultAllocator);
|
|
30164
|
+
}
|
|
30165
|
+
async getHarvestCall() {
|
|
30166
|
+
const harvestInfo = await this.getPendingRewards();
|
|
30167
|
+
if (harvestInfo.length == 0) {
|
|
30168
|
+
throw new Error(`No pending rewards found`);
|
|
30169
|
+
}
|
|
30150
30170
|
if (harvestInfo.length != 1) {
|
|
30151
30171
|
throw new Error(`Expected 1 harvest info, got ${harvestInfo.length}`);
|
|
30152
30172
|
}
|
|
@@ -31165,16 +31185,12 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
31165
31185
|
logger.verbose(`${this.getTag()}::getModifyLeverCall leverSwap: ${JSON.stringify(leverSwap)}`);
|
|
31166
31186
|
let minLSTReceived = params.debtAmount.dividedBy(lstDexPriceInUnderlying).multipliedBy(1 - MAX_SLIPPAGE);
|
|
31167
31187
|
const minLSTReceivedAsPerTruePrice = params.debtAmount.dividedBy(lstTrueExchangeRate);
|
|
31168
|
-
|
|
31169
|
-
minLSTReceived = minLSTReceivedAsPerTruePrice;
|
|
31170
|
-
}
|
|
31188
|
+
minLSTReceived = minLSTReceivedAsPerTruePrice;
|
|
31171
31189
|
logger.verbose(`${this.getTag()}::getModifyLeverCall minLSTReceivedAsPerTruePrice: ${minLSTReceivedAsPerTruePrice}, minLSTReceived: ${minLSTReceived}`);
|
|
31172
31190
|
let maxUsedCollateral = params.debtAmount.abs().dividedBy(lstDexPriceInUnderlying).multipliedBy(1 + MAX_SLIPPAGE);
|
|
31173
31191
|
const maxUsedCollateralInLST = params.debtAmount.abs().dividedBy(lstTrueExchangeRate).multipliedBy(1.005);
|
|
31174
31192
|
logger.verbose(`${this.getTag()}::getModifyLeverCall maxUsedCollateralInLST: ${maxUsedCollateralInLST}, maxUsedCollateral: ${maxUsedCollateral}`);
|
|
31175
|
-
|
|
31176
|
-
maxUsedCollateral = maxUsedCollateralInLST;
|
|
31177
|
-
}
|
|
31193
|
+
maxUsedCollateral = maxUsedCollateralInLST;
|
|
31178
31194
|
const STEP2_ID = "switch_delegation_on" /* SWITCH_DELEGATION_ON */;
|
|
31179
31195
|
const manage2Info = this.getProofs(STEP2_ID);
|
|
31180
31196
|
const manageCall2 = manage2Info.callConstructor({
|
package/package.json
CHANGED
package/src/modules/harvests.ts
CHANGED
|
@@ -108,6 +108,10 @@ export class VesuHarvests extends Harvests {
|
|
|
108
108
|
logger.verbose(`${VesuHarvests.name}: claimed_amount: ${claimed_amount.toString()}`);
|
|
109
109
|
|
|
110
110
|
const data = _data.data['defiSpring'];
|
|
111
|
+
if (!data) {
|
|
112
|
+
logger.verbose(`${VesuHarvests.name}: no defiSpring data found`);
|
|
113
|
+
return [];
|
|
114
|
+
}
|
|
111
115
|
|
|
112
116
|
// get the actual reward
|
|
113
117
|
const actualReward = Web3Number.fromWei(data.amount, 18).minus(claimed_amount);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ContractAddr, Web3Number } from "@/dataTypes";
|
|
2
2
|
import { IConfig, TokenInfo, VaultPosition } from "@/interfaces";
|
|
3
|
+
import { HarvestInfo } from "@/modules/harvests";
|
|
3
4
|
import { CacheClass } from "@/utils/cacheClass";
|
|
4
5
|
import { Call } from "starknet";
|
|
5
6
|
|
|
@@ -55,4 +56,8 @@ export class BaseStrategy<TVLInfo, ActionInfo> extends CacheClass {
|
|
|
55
56
|
async getVaultPositions(): Promise<VaultPosition[]> {
|
|
56
57
|
throw new Error("Not implemented");
|
|
57
58
|
}
|
|
59
|
+
|
|
60
|
+
async getPendingRewards(): Promise<HarvestInfo[]> {
|
|
61
|
+
return [];
|
|
62
|
+
}
|
|
58
63
|
}
|
|
@@ -1597,32 +1597,30 @@ export class EkuboCLVault extends BaseStrategy<
|
|
|
1597
1597
|
};
|
|
1598
1598
|
}
|
|
1599
1599
|
|
|
1600
|
-
async
|
|
1600
|
+
async getPendingRewards(): Promise<HarvestInfo[]> {
|
|
1601
1601
|
const ekuboHarvests = new EkuboHarvests(this.config);
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
logger.verbose(`${EkuboCLVault.name}: harvest => no unclaimed rewards found`);
|
|
1602
|
+
return await ekuboHarvests.getUnHarvestedRewards(this.address);
|
|
1603
|
+
}
|
|
1604
|
+
|
|
1605
|
+
async harvest(acc: Account, maxIterations = 20, priceRatioPrecision = 4): Promise<Call[]> {
|
|
1606
|
+
const pendingRewards = await this.getPendingRewards();
|
|
1607
|
+
if (pendingRewards.length == 0) {
|
|
1608
|
+
logger.verbose(`${EkuboCLVault.name}: harvest => no pending rewards found`);
|
|
1610
1609
|
return [];
|
|
1611
1610
|
}
|
|
1612
|
-
|
|
1613
1611
|
// get necessary info for the harvest
|
|
1614
1612
|
const poolKey = await this.getPoolKey();
|
|
1615
1613
|
const token0Info = await Global.getTokenInfoFromAddr(poolKey.token0);
|
|
1616
1614
|
const token1Info = await Global.getTokenInfoFromAddr(poolKey.token1);
|
|
1617
1615
|
const bounds = await this.getCurrentBounds();
|
|
1618
1616
|
logger.verbose(
|
|
1619
|
-
`${EkuboCLVault.name}: harvest => unClaimedRewards: ${
|
|
1617
|
+
`${EkuboCLVault.name}: harvest => unClaimedRewards: ${pendingRewards.length}`
|
|
1620
1618
|
);
|
|
1621
1619
|
|
|
1622
1620
|
// execute the harvest
|
|
1623
1621
|
const calls: Call[] = [];
|
|
1624
1622
|
// do one at a time.
|
|
1625
|
-
const chosenClaim =
|
|
1623
|
+
const chosenClaim = pendingRewards[0];
|
|
1626
1624
|
logger.info(`${EkuboCLVault.name}: harvest => doing one at a time`);
|
|
1627
1625
|
logger.info(`${EkuboCLVault.name}: harvest => chosenClaim -> Claim ID: ${chosenClaim.claim.id}, Amount: ${chosenClaim.claim.amount.toString()}, actualAmount: ${chosenClaim.actualReward.toString()}, addr: ${chosenClaim.claim.claimee.toString()}`);
|
|
1628
1626
|
for (let claim of [chosenClaim]) {
|
|
@@ -726,18 +726,20 @@ export class UniversalLstMultiplierStrategy extends UniversalStrategy<HyperLSTSt
|
|
|
726
726
|
// is Deposit
|
|
727
727
|
let minLSTReceived = params.debtAmount.dividedBy(lstDexPriceInUnderlying).multipliedBy(1 - MAX_SLIPPAGE); // used for increase
|
|
728
728
|
const minLSTReceivedAsPerTruePrice = params.debtAmount.dividedBy(lstTrueExchangeRate); // execution output to be <= True LST price
|
|
729
|
-
if (minLSTReceived < minLSTReceivedAsPerTruePrice) {
|
|
730
|
-
|
|
731
|
-
}
|
|
729
|
+
// if (minLSTReceived < minLSTReceivedAsPerTruePrice) {
|
|
730
|
+
// minLSTReceived = minLSTReceivedAsPerTruePrice; // the execution shouldn't be bad than True price logi
|
|
731
|
+
// }
|
|
732
|
+
minLSTReceived = minLSTReceivedAsPerTruePrice; // in any case, we are ok with this, bcz the BTC LST spread shouldnt be high
|
|
732
733
|
logger.verbose(`${this.getTag()}::getModifyLeverCall minLSTReceivedAsPerTruePrice: ${minLSTReceivedAsPerTruePrice}, minLSTReceived: ${minLSTReceived}`);
|
|
733
734
|
|
|
734
735
|
// is withdraw
|
|
735
736
|
let maxUsedCollateral = params.debtAmount.abs().dividedBy(lstDexPriceInUnderlying).multipliedBy(1 + MAX_SLIPPAGE); // +ve for exact amount out, used for decrease
|
|
736
737
|
const maxUsedCollateralInLST = params.debtAmount.abs().dividedBy(lstTrueExchangeRate).multipliedBy(1.005); // 0.5% slippage, worst case based on true price
|
|
737
738
|
logger.verbose(`${this.getTag()}::getModifyLeverCall maxUsedCollateralInLST: ${maxUsedCollateralInLST}, maxUsedCollateral: ${maxUsedCollateral}`);
|
|
738
|
-
if (maxUsedCollateralInLST > maxUsedCollateral) {
|
|
739
|
-
|
|
740
|
-
}
|
|
739
|
+
// if (maxUsedCollateralInLST > maxUsedCollateral) {
|
|
740
|
+
// maxUsedCollateral = maxUsedCollateralInLST;
|
|
741
|
+
// }
|
|
742
|
+
maxUsedCollateral = maxUsedCollateralInLST; // in any case, we are ok with this, bcz the BTC LST spread shouldnt be high
|
|
741
743
|
|
|
742
744
|
const STEP2_ID = LST_MULTIPLIER_MANAGE_IDS.SWITCH_DELEGATION_ON;
|
|
743
745
|
const manage2Info = this.getProofs<VesuModifyDelegationCallParams>(STEP2_ID);
|
|
@@ -11,7 +11,7 @@ import { ApproveCallParams, AvnuSwapCallParams, BaseAdapter, CommonAdapter, Flas
|
|
|
11
11
|
import { Global } from "@/global";
|
|
12
12
|
import { AvnuWrapper, ERC20 } from "@/modules";
|
|
13
13
|
import { AVNU_MIDDLEWARE, VESU_SINGLETON } from "./universal-adapters/adapter-utils";
|
|
14
|
-
import { VesuHarvests } from "@/modules/harvests";
|
|
14
|
+
import { HarvestInfo, VesuHarvests } from "@/modules/harvests";
|
|
15
15
|
|
|
16
16
|
export interface UniversalManageCall {
|
|
17
17
|
proofs: string[];
|
|
@@ -729,9 +729,16 @@ export class UniversalStrategy<
|
|
|
729
729
|
return manageCall;
|
|
730
730
|
}
|
|
731
731
|
|
|
732
|
-
async
|
|
732
|
+
async getPendingRewards(): Promise<HarvestInfo[]> {
|
|
733
733
|
const vesuHarvest = new VesuHarvests(this.config);
|
|
734
|
-
|
|
734
|
+
return await vesuHarvest.getUnHarvestedRewards(this.metadata.additionalInfo.vaultAllocator);
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
async getHarvestCall() {
|
|
738
|
+
const harvestInfo = await this.getPendingRewards();
|
|
739
|
+
if (harvestInfo.length == 0) {
|
|
740
|
+
throw new Error(`No pending rewards found`);
|
|
741
|
+
}
|
|
735
742
|
if (harvestInfo.length != 1) {
|
|
736
743
|
throw new Error(`Expected 1 harvest info, got ${harvestInfo.length}`);
|
|
737
744
|
}
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
SingleTokenInfo
|
|
26
26
|
} from "./base-strategy";
|
|
27
27
|
import { getAPIUsingHeadlessBrowser } from "@/node/headless";
|
|
28
|
-
import { VesuHarvests } from "@/modules/harvests";
|
|
28
|
+
import { HarvestInfo, VesuHarvests } from "@/modules/harvests";
|
|
29
29
|
import VesuPoolIDs from "@/data/vesu_pools.json";
|
|
30
30
|
import { COMMON_CONTRACTS, ENDPOINTS } from "./constants";
|
|
31
31
|
|
|
@@ -763,10 +763,17 @@ export class VesuRebalance extends BaseStrategy<
|
|
|
763
763
|
return [baseFlow];
|
|
764
764
|
}
|
|
765
765
|
|
|
766
|
+
async getPendingRewards(): Promise<HarvestInfo[]> {
|
|
767
|
+
const vesuHarvests = new VesuHarvests(this.config);
|
|
768
|
+
return await vesuHarvests.getUnHarvestedRewards(this.address);
|
|
769
|
+
}
|
|
770
|
+
|
|
766
771
|
async harvest(acc: Account) {
|
|
767
|
-
const
|
|
768
|
-
|
|
769
|
-
|
|
772
|
+
const pendingRewards = await this.getPendingRewards();
|
|
773
|
+
if (pendingRewards.length == 0) {
|
|
774
|
+
throw new Error(`No pending rewards found`);
|
|
775
|
+
}
|
|
776
|
+
const harvest = pendingRewards[0];
|
|
770
777
|
const avnu = new AvnuWrapper();
|
|
771
778
|
let swapInfo: SwapInfo = {
|
|
772
779
|
token_from_address: harvest.token.address,
|