@strkfarm/sdk 1.1.55 → 1.1.57
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 +7 -3
- package/dist/index.browser.mjs +7 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.js +7 -3
- package/dist/index.mjs +7 -3
- package/package.json +1 -1
- package/src/strategies/ekubo-cl-vault.tsx +3 -2
- package/src/strategies/universal-lst-muliplier-strategy.tsx +8 -1
|
@@ -80582,8 +80582,9 @@ spurious results.`);
|
|
|
80582
80582
|
const ekuboHarvests = new EkuboHarvests(this.config);
|
|
80583
80583
|
return await ekuboHarvests.getUnHarvestedRewards(this.address);
|
|
80584
80584
|
}
|
|
80585
|
-
async harvest(acc, maxIterations = 20, priceRatioPrecision = 4) {
|
|
80586
|
-
const
|
|
80585
|
+
async harvest(acc, maxIterations = 20, priceRatioPrecision = 4, minRewardAmount = new Web3Number(0, 18)) {
|
|
80586
|
+
const _pendingRewards = await this.getPendingRewards();
|
|
80587
|
+
const pendingRewards = _pendingRewards.filter((claim) => claim.actualReward.greaterThanOrEqualTo(minRewardAmount));
|
|
80587
80588
|
if (pendingRewards.length == 0) {
|
|
80588
80589
|
logger2.verbose(`${_EkuboCLVault.name}: harvest => no pending rewards found`);
|
|
80589
80590
|
return [];
|
|
@@ -95004,9 +95005,12 @@ spurious results.`);
|
|
|
95004
95005
|
const x_debt_usd = numeratorPart1.minus(numeratorPart2).dividedBy(denominatorPart);
|
|
95005
95006
|
logger2.verbose(`${this.getTag()}::getVesuMultiplyCall x_debt_usd: ${x_debt_usd}`);
|
|
95006
95007
|
logger2.debug(`${this.getTag()}::getVesuMultiplyCall numeratorPart1: ${numeratorPart1}, numeratorPart2: ${numeratorPart2}, denominatorPart: ${denominatorPart}`);
|
|
95007
|
-
|
|
95008
|
+
let debtAmount = x_debt_usd.dividedBy(debtPrice);
|
|
95008
95009
|
const marginAmount = addedCollateral;
|
|
95009
95010
|
logger2.verbose(`${this.getTag()}::getVesuMultiplyCall debtAmount: ${debtAmount}, marginAmount: ${marginAmount}`);
|
|
95011
|
+
if (marginAmount.lt(0) && debtAmount.gt(0)) {
|
|
95012
|
+
debtAmount = Web3Number.fromWei(0, this.asset().decimals);
|
|
95013
|
+
}
|
|
95010
95014
|
return this.getModifyLeverCall({
|
|
95011
95015
|
marginAmount,
|
|
95012
95016
|
debtAmount,
|
package/dist/index.browser.mjs
CHANGED
|
@@ -16659,8 +16659,9 @@ var EkuboCLVault = class _EkuboCLVault extends BaseStrategy {
|
|
|
16659
16659
|
const ekuboHarvests = new EkuboHarvests(this.config);
|
|
16660
16660
|
return await ekuboHarvests.getUnHarvestedRewards(this.address);
|
|
16661
16661
|
}
|
|
16662
|
-
async harvest(acc, maxIterations = 20, priceRatioPrecision = 4) {
|
|
16663
|
-
const
|
|
16662
|
+
async harvest(acc, maxIterations = 20, priceRatioPrecision = 4, minRewardAmount = new Web3Number(0, 18)) {
|
|
16663
|
+
const _pendingRewards = await this.getPendingRewards();
|
|
16664
|
+
const pendingRewards = _pendingRewards.filter((claim) => claim.actualReward.greaterThanOrEqualTo(minRewardAmount));
|
|
16664
16665
|
if (pendingRewards.length == 0) {
|
|
16665
16666
|
logger.verbose(`${_EkuboCLVault.name}: harvest => no pending rewards found`);
|
|
16666
16667
|
return [];
|
|
@@ -31097,9 +31098,12 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
31097
31098
|
const x_debt_usd = numeratorPart1.minus(numeratorPart2).dividedBy(denominatorPart);
|
|
31098
31099
|
logger.verbose(`${this.getTag()}::getVesuMultiplyCall x_debt_usd: ${x_debt_usd}`);
|
|
31099
31100
|
logger.debug(`${this.getTag()}::getVesuMultiplyCall numeratorPart1: ${numeratorPart1}, numeratorPart2: ${numeratorPart2}, denominatorPart: ${denominatorPart}`);
|
|
31100
|
-
|
|
31101
|
+
let debtAmount = x_debt_usd.dividedBy(debtPrice);
|
|
31101
31102
|
const marginAmount = addedCollateral;
|
|
31102
31103
|
logger.verbose(`${this.getTag()}::getVesuMultiplyCall debtAmount: ${debtAmount}, marginAmount: ${marginAmount}`);
|
|
31104
|
+
if (marginAmount.lt(0) && debtAmount.gt(0)) {
|
|
31105
|
+
debtAmount = Web3Number.fromWei(0, this.asset().decimals);
|
|
31106
|
+
}
|
|
31103
31107
|
return this.getModifyLeverCall({
|
|
31104
31108
|
marginAmount,
|
|
31105
31109
|
debtAmount,
|
package/dist/index.d.ts
CHANGED
|
@@ -836,7 +836,7 @@ declare class EkuboCLVault extends BaseStrategy<DualTokenInfo, DualActionAmount>
|
|
|
836
836
|
amount1: Web3Number;
|
|
837
837
|
}>;
|
|
838
838
|
getPendingRewards(): Promise<HarvestInfo[]>;
|
|
839
|
-
harvest(acc: Account, maxIterations?: number, priceRatioPrecision?: number): Promise<Call[]>;
|
|
839
|
+
harvest(acc: Account, maxIterations?: number, priceRatioPrecision?: number, minRewardAmount?: Web3Number): Promise<Call[]>;
|
|
840
840
|
/**
|
|
841
841
|
* @description This funciton requires atleast one of the pool tokens to be reward token
|
|
842
842
|
* i.e. STRK.
|
package/dist/index.js
CHANGED
|
@@ -16659,8 +16659,9 @@ var EkuboCLVault = class _EkuboCLVault extends BaseStrategy {
|
|
|
16659
16659
|
const ekuboHarvests = new EkuboHarvests(this.config);
|
|
16660
16660
|
return await ekuboHarvests.getUnHarvestedRewards(this.address);
|
|
16661
16661
|
}
|
|
16662
|
-
async harvest(acc, maxIterations = 20, priceRatioPrecision = 4) {
|
|
16663
|
-
const
|
|
16662
|
+
async harvest(acc, maxIterations = 20, priceRatioPrecision = 4, minRewardAmount = new Web3Number(0, 18)) {
|
|
16663
|
+
const _pendingRewards = await this.getPendingRewards();
|
|
16664
|
+
const pendingRewards = _pendingRewards.filter((claim) => claim.actualReward.greaterThanOrEqualTo(minRewardAmount));
|
|
16664
16665
|
if (pendingRewards.length == 0) {
|
|
16665
16666
|
logger.verbose(`${_EkuboCLVault.name}: harvest => no pending rewards found`);
|
|
16666
16667
|
return [];
|
|
@@ -31097,9 +31098,12 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
31097
31098
|
const x_debt_usd = numeratorPart1.minus(numeratorPart2).dividedBy(denominatorPart);
|
|
31098
31099
|
logger.verbose(`${this.getTag()}::getVesuMultiplyCall x_debt_usd: ${x_debt_usd}`);
|
|
31099
31100
|
logger.debug(`${this.getTag()}::getVesuMultiplyCall numeratorPart1: ${numeratorPart1}, numeratorPart2: ${numeratorPart2}, denominatorPart: ${denominatorPart}`);
|
|
31100
|
-
|
|
31101
|
+
let debtAmount = x_debt_usd.dividedBy(debtPrice);
|
|
31101
31102
|
const marginAmount = addedCollateral;
|
|
31102
31103
|
logger.verbose(`${this.getTag()}::getVesuMultiplyCall debtAmount: ${debtAmount}, marginAmount: ${marginAmount}`);
|
|
31104
|
+
if (marginAmount.lt(0) && debtAmount.gt(0)) {
|
|
31105
|
+
debtAmount = Web3Number.fromWei(0, this.asset().decimals);
|
|
31106
|
+
}
|
|
31103
31107
|
return this.getModifyLeverCall({
|
|
31104
31108
|
marginAmount,
|
|
31105
31109
|
debtAmount,
|
package/dist/index.mjs
CHANGED
|
@@ -16557,8 +16557,9 @@ var EkuboCLVault = class _EkuboCLVault extends BaseStrategy {
|
|
|
16557
16557
|
const ekuboHarvests = new EkuboHarvests(this.config);
|
|
16558
16558
|
return await ekuboHarvests.getUnHarvestedRewards(this.address);
|
|
16559
16559
|
}
|
|
16560
|
-
async harvest(acc, maxIterations = 20, priceRatioPrecision = 4) {
|
|
16561
|
-
const
|
|
16560
|
+
async harvest(acc, maxIterations = 20, priceRatioPrecision = 4, minRewardAmount = new Web3Number(0, 18)) {
|
|
16561
|
+
const _pendingRewards = await this.getPendingRewards();
|
|
16562
|
+
const pendingRewards = _pendingRewards.filter((claim) => claim.actualReward.greaterThanOrEqualTo(minRewardAmount));
|
|
16562
16563
|
if (pendingRewards.length == 0) {
|
|
16563
16564
|
logger.verbose(`${_EkuboCLVault.name}: harvest => no pending rewards found`);
|
|
16564
16565
|
return [];
|
|
@@ -30995,9 +30996,12 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
30995
30996
|
const x_debt_usd = numeratorPart1.minus(numeratorPart2).dividedBy(denominatorPart);
|
|
30996
30997
|
logger.verbose(`${this.getTag()}::getVesuMultiplyCall x_debt_usd: ${x_debt_usd}`);
|
|
30997
30998
|
logger.debug(`${this.getTag()}::getVesuMultiplyCall numeratorPart1: ${numeratorPart1}, numeratorPart2: ${numeratorPart2}, denominatorPart: ${denominatorPart}`);
|
|
30998
|
-
|
|
30999
|
+
let debtAmount = x_debt_usd.dividedBy(debtPrice);
|
|
30999
31000
|
const marginAmount = addedCollateral;
|
|
31000
31001
|
logger.verbose(`${this.getTag()}::getVesuMultiplyCall debtAmount: ${debtAmount}, marginAmount: ${marginAmount}`);
|
|
31002
|
+
if (marginAmount.lt(0) && debtAmount.gt(0)) {
|
|
31003
|
+
debtAmount = Web3Number.fromWei(0, this.asset().decimals);
|
|
31004
|
+
}
|
|
31001
31005
|
return this.getModifyLeverCall({
|
|
31002
31006
|
marginAmount,
|
|
31003
31007
|
debtAmount,
|
package/package.json
CHANGED
|
@@ -1602,8 +1602,9 @@ export class EkuboCLVault extends BaseStrategy<
|
|
|
1602
1602
|
return await ekuboHarvests.getUnHarvestedRewards(this.address);
|
|
1603
1603
|
}
|
|
1604
1604
|
|
|
1605
|
-
async harvest(acc: Account, maxIterations = 20, priceRatioPrecision = 4): Promise<Call[]> {
|
|
1606
|
-
const
|
|
1605
|
+
async harvest(acc: Account, maxIterations = 20, priceRatioPrecision = 4, minRewardAmount: Web3Number = new Web3Number(0, 18)): Promise<Call[]> {
|
|
1606
|
+
const _pendingRewards = await this.getPendingRewards();
|
|
1607
|
+
const pendingRewards = _pendingRewards.filter(claim => claim.actualReward.greaterThanOrEqualTo(minRewardAmount));
|
|
1607
1608
|
if (pendingRewards.length == 0) {
|
|
1608
1609
|
logger.verbose(`${EkuboCLVault.name}: harvest => no pending rewards found`);
|
|
1609
1610
|
return [];
|
|
@@ -485,10 +485,17 @@ export class UniversalLstMultiplierStrategy extends UniversalStrategy<HyperLSTSt
|
|
|
485
485
|
logger.debug(`${this.getTag()}::getVesuMultiplyCall numeratorPart1: ${numeratorPart1}, numeratorPart2: ${numeratorPart2}, denominatorPart: ${denominatorPart}`);
|
|
486
486
|
|
|
487
487
|
// both in underlying
|
|
488
|
-
|
|
488
|
+
let debtAmount = x_debt_usd.dividedBy(debtPrice);
|
|
489
489
|
const marginAmount = addedCollateral;
|
|
490
490
|
logger.verbose(`${this.getTag()}::getVesuMultiplyCall debtAmount: ${debtAmount}, marginAmount: ${marginAmount}`);
|
|
491
491
|
|
|
492
|
+
if (marginAmount.lt(0) && debtAmount.gt(0)) {
|
|
493
|
+
// if we want to withdraw, but debt can go high, its conflicting between
|
|
494
|
+
// increasing and reducing lever. and in this case, the HF will go high,
|
|
495
|
+
// which is ok.
|
|
496
|
+
debtAmount = Web3Number.fromWei(0, this.asset().decimals);
|
|
497
|
+
}
|
|
498
|
+
|
|
492
499
|
// Cases of lever increase (within the scopr of this function)
|
|
493
500
|
// 1. debtAmount > 0 and marginAmount > 0
|
|
494
501
|
// 2. debtAmount > 0 and marginAmount < 0
|