@strkfarm/sdk 1.1.37 → 1.1.38
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 +9 -6
- package/dist/index.browser.mjs +9 -6
- package/dist/index.d.ts +1 -1
- package/dist/index.js +9 -6
- package/dist/index.mjs +9 -6
- package/package.json +1 -1
- package/src/strategies/universal-lst-muliplier-strategy.tsx +4 -1
- package/src/strategies/universal-strategy.tsx +5 -6
|
@@ -93328,9 +93328,12 @@ spurious results.`);
|
|
|
93328
93328
|
rewardAPYs.push(0);
|
|
93329
93329
|
const weights = positions.map((p, index) => p.usdValue * (index % 2 == 0 ? 1 : -1));
|
|
93330
93330
|
weights.push(unusedBalanceAPY.weight);
|
|
93331
|
-
|
|
93331
|
+
const prevAUM = await this.getPrevAUM();
|
|
93332
|
+
const price = await this.pricer.getPrice(this.metadata.depositTokens[0].symbol);
|
|
93333
|
+
const prevAUMUSD = prevAUM.multipliedBy(price.price);
|
|
93334
|
+
return this.returnNetAPY(baseAPYs, rewardAPYs, weights, prevAUMUSD);
|
|
93332
93335
|
}
|
|
93333
|
-
async returnNetAPY(baseAPYs, rewardAPYs, weights) {
|
|
93336
|
+
async returnNetAPY(baseAPYs, rewardAPYs, weights, prevAUMUSD) {
|
|
93334
93337
|
if (weights.every((p) => p == 0)) {
|
|
93335
93338
|
return { net: 0, splits: [{
|
|
93336
93339
|
apy: 0,
|
|
@@ -93340,9 +93343,6 @@ spurious results.`);
|
|
|
93340
93343
|
id: "defispring"
|
|
93341
93344
|
}] };
|
|
93342
93345
|
}
|
|
93343
|
-
const prevAUM = await this.getPrevAUM();
|
|
93344
|
-
const price = await this.pricer.getPrice(this.metadata.depositTokens[0].symbol);
|
|
93345
|
-
const prevAUMUSD = prevAUM.multipliedBy(price.price);
|
|
93346
93346
|
const baseAPY = this.computeAPY(baseAPYs, weights, prevAUMUSD);
|
|
93347
93347
|
const rewardAPY = this.computeAPY(rewardAPYs, weights, prevAUMUSD);
|
|
93348
93348
|
const netAPY = baseAPY + rewardAPY;
|
|
@@ -94492,13 +94492,16 @@ spurious results.`);
|
|
|
94492
94492
|
const maxNewDeposits = await this.maxNewDeposits();
|
|
94493
94493
|
const lstAPY = await this.getLSTAPR(this.getLSTUnderlyingTokenInfo().address);
|
|
94494
94494
|
if (maxNewDeposits * 1.5 < unusedBalance.amount.toNumber()) {
|
|
94495
|
+
logger2.verbose(`${this.getTag()}::netAPY: unused balance is > max servicable from loan, lstAPY: ${lstAPY}`);
|
|
94495
94496
|
const output = await super.netAPY();
|
|
94496
94497
|
output.splits.push({ apy: lstAPY, id: "lst_apy" });
|
|
94497
94498
|
return output;
|
|
94498
94499
|
} else {
|
|
94500
|
+
logger2.verbose(`${this.getTag()}::netAPY: we can take more deposits, use theoretical max APY`);
|
|
94499
94501
|
const { positions, baseAPYs, rewardAPYs } = await this.getVesuAPYs();
|
|
94500
94502
|
const weights = positions.map((p, index) => p.usdValue * (index % 2 == 0 ? 1 : -1));
|
|
94501
|
-
const
|
|
94503
|
+
const aum = weights.reduce((acc, curr) => acc + curr, 0);
|
|
94504
|
+
const output = await this.returnNetAPY(baseAPYs, rewardAPYs, weights, new Web3Number(aum.toFixed(9), this.getLSTUnderlyingTokenInfo().decimals));
|
|
94502
94505
|
output.splits.push({ apy: lstAPY, id: "lst_apy" });
|
|
94503
94506
|
return output;
|
|
94504
94507
|
}
|
package/dist/index.browser.mjs
CHANGED
|
@@ -29421,9 +29421,12 @@ var UniversalStrategy = class _UniversalStrategy extends BaseStrategy {
|
|
|
29421
29421
|
rewardAPYs.push(0);
|
|
29422
29422
|
const weights = positions.map((p, index) => p.usdValue * (index % 2 == 0 ? 1 : -1));
|
|
29423
29423
|
weights.push(unusedBalanceAPY.weight);
|
|
29424
|
-
|
|
29424
|
+
const prevAUM = await this.getPrevAUM();
|
|
29425
|
+
const price = await this.pricer.getPrice(this.metadata.depositTokens[0].symbol);
|
|
29426
|
+
const prevAUMUSD = prevAUM.multipliedBy(price.price);
|
|
29427
|
+
return this.returnNetAPY(baseAPYs, rewardAPYs, weights, prevAUMUSD);
|
|
29425
29428
|
}
|
|
29426
|
-
async returnNetAPY(baseAPYs, rewardAPYs, weights) {
|
|
29429
|
+
async returnNetAPY(baseAPYs, rewardAPYs, weights, prevAUMUSD) {
|
|
29427
29430
|
if (weights.every((p) => p == 0)) {
|
|
29428
29431
|
return { net: 0, splits: [{
|
|
29429
29432
|
apy: 0,
|
|
@@ -29433,9 +29436,6 @@ var UniversalStrategy = class _UniversalStrategy extends BaseStrategy {
|
|
|
29433
29436
|
id: "defispring"
|
|
29434
29437
|
}] };
|
|
29435
29438
|
}
|
|
29436
|
-
const prevAUM = await this.getPrevAUM();
|
|
29437
|
-
const price = await this.pricer.getPrice(this.metadata.depositTokens[0].symbol);
|
|
29438
|
-
const prevAUMUSD = prevAUM.multipliedBy(price.price);
|
|
29439
29439
|
const baseAPY = this.computeAPY(baseAPYs, weights, prevAUMUSD);
|
|
29440
29440
|
const rewardAPY = this.computeAPY(rewardAPYs, weights, prevAUMUSD);
|
|
29441
29441
|
const netAPY = baseAPY + rewardAPY;
|
|
@@ -30586,13 +30586,16 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
30586
30586
|
const maxNewDeposits = await this.maxNewDeposits();
|
|
30587
30587
|
const lstAPY = await this.getLSTAPR(this.getLSTUnderlyingTokenInfo().address);
|
|
30588
30588
|
if (maxNewDeposits * 1.5 < unusedBalance.amount.toNumber()) {
|
|
30589
|
+
logger.verbose(`${this.getTag()}::netAPY: unused balance is > max servicable from loan, lstAPY: ${lstAPY}`);
|
|
30589
30590
|
const output = await super.netAPY();
|
|
30590
30591
|
output.splits.push({ apy: lstAPY, id: "lst_apy" });
|
|
30591
30592
|
return output;
|
|
30592
30593
|
} else {
|
|
30594
|
+
logger.verbose(`${this.getTag()}::netAPY: we can take more deposits, use theoretical max APY`);
|
|
30593
30595
|
const { positions, baseAPYs, rewardAPYs } = await this.getVesuAPYs();
|
|
30594
30596
|
const weights = positions.map((p, index) => p.usdValue * (index % 2 == 0 ? 1 : -1));
|
|
30595
|
-
const
|
|
30597
|
+
const aum = weights.reduce((acc, curr) => acc + curr, 0);
|
|
30598
|
+
const output = await this.returnNetAPY(baseAPYs, rewardAPYs, weights, new Web3Number(aum.toFixed(9), this.getLSTUnderlyingTokenInfo().decimals));
|
|
30596
30599
|
output.splits.push({ apy: lstAPY, id: "lst_apy" });
|
|
30597
30600
|
return output;
|
|
30598
30601
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1226,7 +1226,7 @@ declare class UniversalStrategy<S extends UniversalStrategySettings> extends Bas
|
|
|
1226
1226
|
id: string;
|
|
1227
1227
|
}[];
|
|
1228
1228
|
}>;
|
|
1229
|
-
protected returnNetAPY(baseAPYs: number[], rewardAPYs: number[], weights: number[]): Promise<{
|
|
1229
|
+
protected returnNetAPY(baseAPYs: number[], rewardAPYs: number[], weights: number[], prevAUMUSD: Web3Number): Promise<{
|
|
1230
1230
|
net: number;
|
|
1231
1231
|
splits: {
|
|
1232
1232
|
apy: number;
|
package/dist/index.js
CHANGED
|
@@ -29420,9 +29420,12 @@ var UniversalStrategy = class _UniversalStrategy extends BaseStrategy {
|
|
|
29420
29420
|
rewardAPYs.push(0);
|
|
29421
29421
|
const weights = positions.map((p, index) => p.usdValue * (index % 2 == 0 ? 1 : -1));
|
|
29422
29422
|
weights.push(unusedBalanceAPY.weight);
|
|
29423
|
-
|
|
29423
|
+
const prevAUM = await this.getPrevAUM();
|
|
29424
|
+
const price = await this.pricer.getPrice(this.metadata.depositTokens[0].symbol);
|
|
29425
|
+
const prevAUMUSD = prevAUM.multipliedBy(price.price);
|
|
29426
|
+
return this.returnNetAPY(baseAPYs, rewardAPYs, weights, prevAUMUSD);
|
|
29424
29427
|
}
|
|
29425
|
-
async returnNetAPY(baseAPYs, rewardAPYs, weights) {
|
|
29428
|
+
async returnNetAPY(baseAPYs, rewardAPYs, weights, prevAUMUSD) {
|
|
29426
29429
|
if (weights.every((p) => p == 0)) {
|
|
29427
29430
|
return { net: 0, splits: [{
|
|
29428
29431
|
apy: 0,
|
|
@@ -29432,9 +29435,6 @@ var UniversalStrategy = class _UniversalStrategy extends BaseStrategy {
|
|
|
29432
29435
|
id: "defispring"
|
|
29433
29436
|
}] };
|
|
29434
29437
|
}
|
|
29435
|
-
const prevAUM = await this.getPrevAUM();
|
|
29436
|
-
const price = await this.pricer.getPrice(this.metadata.depositTokens[0].symbol);
|
|
29437
|
-
const prevAUMUSD = prevAUM.multipliedBy(price.price);
|
|
29438
29438
|
const baseAPY = this.computeAPY(baseAPYs, weights, prevAUMUSD);
|
|
29439
29439
|
const rewardAPY = this.computeAPY(rewardAPYs, weights, prevAUMUSD);
|
|
29440
29440
|
const netAPY = baseAPY + rewardAPY;
|
|
@@ -30585,13 +30585,16 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
30585
30585
|
const maxNewDeposits = await this.maxNewDeposits();
|
|
30586
30586
|
const lstAPY = await this.getLSTAPR(this.getLSTUnderlyingTokenInfo().address);
|
|
30587
30587
|
if (maxNewDeposits * 1.5 < unusedBalance.amount.toNumber()) {
|
|
30588
|
+
logger.verbose(`${this.getTag()}::netAPY: unused balance is > max servicable from loan, lstAPY: ${lstAPY}`);
|
|
30588
30589
|
const output = await super.netAPY();
|
|
30589
30590
|
output.splits.push({ apy: lstAPY, id: "lst_apy" });
|
|
30590
30591
|
return output;
|
|
30591
30592
|
} else {
|
|
30593
|
+
logger.verbose(`${this.getTag()}::netAPY: we can take more deposits, use theoretical max APY`);
|
|
30592
30594
|
const { positions, baseAPYs, rewardAPYs } = await this.getVesuAPYs();
|
|
30593
30595
|
const weights = positions.map((p, index) => p.usdValue * (index % 2 == 0 ? 1 : -1));
|
|
30594
|
-
const
|
|
30596
|
+
const aum = weights.reduce((acc, curr) => acc + curr, 0);
|
|
30597
|
+
const output = await this.returnNetAPY(baseAPYs, rewardAPYs, weights, new Web3Number(aum.toFixed(9), this.getLSTUnderlyingTokenInfo().decimals));
|
|
30595
30598
|
output.splits.push({ apy: lstAPY, id: "lst_apy" });
|
|
30596
30599
|
return output;
|
|
30597
30600
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -29319,9 +29319,12 @@ var UniversalStrategy = class _UniversalStrategy extends BaseStrategy {
|
|
|
29319
29319
|
rewardAPYs.push(0);
|
|
29320
29320
|
const weights = positions.map((p, index) => p.usdValue * (index % 2 == 0 ? 1 : -1));
|
|
29321
29321
|
weights.push(unusedBalanceAPY.weight);
|
|
29322
|
-
|
|
29322
|
+
const prevAUM = await this.getPrevAUM();
|
|
29323
|
+
const price = await this.pricer.getPrice(this.metadata.depositTokens[0].symbol);
|
|
29324
|
+
const prevAUMUSD = prevAUM.multipliedBy(price.price);
|
|
29325
|
+
return this.returnNetAPY(baseAPYs, rewardAPYs, weights, prevAUMUSD);
|
|
29323
29326
|
}
|
|
29324
|
-
async returnNetAPY(baseAPYs, rewardAPYs, weights) {
|
|
29327
|
+
async returnNetAPY(baseAPYs, rewardAPYs, weights, prevAUMUSD) {
|
|
29325
29328
|
if (weights.every((p) => p == 0)) {
|
|
29326
29329
|
return { net: 0, splits: [{
|
|
29327
29330
|
apy: 0,
|
|
@@ -29331,9 +29334,6 @@ var UniversalStrategy = class _UniversalStrategy extends BaseStrategy {
|
|
|
29331
29334
|
id: "defispring"
|
|
29332
29335
|
}] };
|
|
29333
29336
|
}
|
|
29334
|
-
const prevAUM = await this.getPrevAUM();
|
|
29335
|
-
const price = await this.pricer.getPrice(this.metadata.depositTokens[0].symbol);
|
|
29336
|
-
const prevAUMUSD = prevAUM.multipliedBy(price.price);
|
|
29337
29337
|
const baseAPY = this.computeAPY(baseAPYs, weights, prevAUMUSD);
|
|
29338
29338
|
const rewardAPY = this.computeAPY(rewardAPYs, weights, prevAUMUSD);
|
|
29339
29339
|
const netAPY = baseAPY + rewardAPY;
|
|
@@ -30484,13 +30484,16 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
30484
30484
|
const maxNewDeposits = await this.maxNewDeposits();
|
|
30485
30485
|
const lstAPY = await this.getLSTAPR(this.getLSTUnderlyingTokenInfo().address);
|
|
30486
30486
|
if (maxNewDeposits * 1.5 < unusedBalance.amount.toNumber()) {
|
|
30487
|
+
logger.verbose(`${this.getTag()}::netAPY: unused balance is > max servicable from loan, lstAPY: ${lstAPY}`);
|
|
30487
30488
|
const output = await super.netAPY();
|
|
30488
30489
|
output.splits.push({ apy: lstAPY, id: "lst_apy" });
|
|
30489
30490
|
return output;
|
|
30490
30491
|
} else {
|
|
30492
|
+
logger.verbose(`${this.getTag()}::netAPY: we can take more deposits, use theoretical max APY`);
|
|
30491
30493
|
const { positions, baseAPYs, rewardAPYs } = await this.getVesuAPYs();
|
|
30492
30494
|
const weights = positions.map((p, index) => p.usdValue * (index % 2 == 0 ? 1 : -1));
|
|
30493
|
-
const
|
|
30495
|
+
const aum = weights.reduce((acc, curr) => acc + curr, 0);
|
|
30496
|
+
const output = await this.returnNetAPY(baseAPYs, rewardAPYs, weights, new Web3Number(aum.toFixed(9), this.getLSTUnderlyingTokenInfo().decimals));
|
|
30494
30497
|
output.splits.push({ apy: lstAPY, id: "lst_apy" });
|
|
30495
30498
|
return output;
|
|
30496
30499
|
}
|
package/package.json
CHANGED
|
@@ -466,14 +466,17 @@ export class UniversalLstMultiplierStrategy extends UniversalStrategy<HyperLSTSt
|
|
|
466
466
|
// we also allow accepting little higher deposits (1.5x) to have room for future looping when theres more liquidity or debt cap rises
|
|
467
467
|
if (maxNewDeposits * 1.5 < unusedBalance.amount.toNumber()) {
|
|
468
468
|
// we have excess, just use real APY
|
|
469
|
+
logger.verbose(`${this.getTag()}::netAPY: unused balance is > max servicable from loan, lstAPY: ${lstAPY}`);
|
|
469
470
|
const output = await super.netAPY();
|
|
470
471
|
output.splits.push({apy: lstAPY, id: 'lst_apy'});
|
|
471
472
|
return output;
|
|
472
473
|
} else {
|
|
473
474
|
// we have little bit room to accept more deposits, we use theoretical max APY
|
|
475
|
+
logger.verbose(`${this.getTag()}::netAPY: we can take more deposits, use theoretical max APY`);
|
|
474
476
|
const { positions, baseAPYs, rewardAPYs } = await this.getVesuAPYs();
|
|
475
477
|
const weights = positions.map((p, index) => p.usdValue * (index % 2 == 0 ? 1 : -1));
|
|
476
|
-
const
|
|
478
|
+
const aum = weights.reduce((acc, curr) => acc + curr, 0);
|
|
479
|
+
const output = await this.returnNetAPY(baseAPYs, rewardAPYs, weights, new Web3Number(aum.toFixed(9), this.getLSTUnderlyingTokenInfo().decimals));
|
|
477
480
|
output.splits.push({apy: lstAPY, id: 'lst_apy'});
|
|
478
481
|
return output;
|
|
479
482
|
}
|
|
@@ -264,10 +264,13 @@ export class UniversalStrategy<
|
|
|
264
264
|
const weights = positions.map((p, index) => p.usdValue * (index % 2 == 0 ? 1 : -1));
|
|
265
265
|
weights.push(unusedBalanceAPY.weight);
|
|
266
266
|
|
|
267
|
-
|
|
267
|
+
const prevAUM = await this.getPrevAUM();
|
|
268
|
+
const price = await this.pricer.getPrice(this.metadata.depositTokens[0].symbol);
|
|
269
|
+
const prevAUMUSD = prevAUM.multipliedBy(price.price);
|
|
270
|
+
return this.returnNetAPY(baseAPYs, rewardAPYs, weights, prevAUMUSD);
|
|
268
271
|
}
|
|
269
272
|
|
|
270
|
-
protected async returnNetAPY(baseAPYs: number[], rewardAPYs: number[], weights: number[]) {
|
|
273
|
+
protected async returnNetAPY(baseAPYs: number[], rewardAPYs: number[], weights: number[], prevAUMUSD: Web3Number) {
|
|
271
274
|
// If no positions, return 0
|
|
272
275
|
if (weights.every(p => p == 0)) {
|
|
273
276
|
return { net: 0, splits: [{
|
|
@@ -277,10 +280,6 @@ export class UniversalStrategy<
|
|
|
277
280
|
}]};
|
|
278
281
|
}
|
|
279
282
|
|
|
280
|
-
const prevAUM = await this.getPrevAUM();
|
|
281
|
-
|
|
282
|
-
const price = await this.pricer.getPrice(this.metadata.depositTokens[0].symbol);
|
|
283
|
-
const prevAUMUSD = prevAUM.multipliedBy(price.price);
|
|
284
283
|
const baseAPY = this.computeAPY(baseAPYs, weights, prevAUMUSD);
|
|
285
284
|
const rewardAPY = this.computeAPY(rewardAPYs, weights, prevAUMUSD);
|
|
286
285
|
const netAPY = baseAPY + rewardAPY;
|