@strkfarm/sdk 1.1.36 → 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 +15 -7
- package/dist/index.browser.mjs +15 -7
- package/dist/index.d.ts +1 -1
- package/dist/index.js +15 -7
- package/dist/index.mjs +15 -7
- package/package.json +1 -1
- package/src/strategies/universal-lst-muliplier-strategy.tsx +10 -2
- 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;
|
|
@@ -94490,12 +94490,20 @@ spurious results.`);
|
|
|
94490
94490
|
async netAPY() {
|
|
94491
94491
|
const unusedBalance = await this.getUnusedBalance();
|
|
94492
94492
|
const maxNewDeposits = await this.maxNewDeposits();
|
|
94493
|
+
const lstAPY = await this.getLSTAPR(this.getLSTUnderlyingTokenInfo().address);
|
|
94493
94494
|
if (maxNewDeposits * 1.5 < unusedBalance.amount.toNumber()) {
|
|
94494
|
-
|
|
94495
|
+
logger2.verbose(`${this.getTag()}::netAPY: unused balance is > max servicable from loan, lstAPY: ${lstAPY}`);
|
|
94496
|
+
const output = await super.netAPY();
|
|
94497
|
+
output.splits.push({ apy: lstAPY, id: "lst_apy" });
|
|
94498
|
+
return output;
|
|
94495
94499
|
} else {
|
|
94500
|
+
logger2.verbose(`${this.getTag()}::netAPY: we can take more deposits, use theoretical max APY`);
|
|
94496
94501
|
const { positions, baseAPYs, rewardAPYs } = await this.getVesuAPYs();
|
|
94497
94502
|
const weights = positions.map((p, index) => p.usdValue * (index % 2 == 0 ? 1 : -1));
|
|
94498
|
-
|
|
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));
|
|
94505
|
+
output.splits.push({ apy: lstAPY, id: "lst_apy" });
|
|
94506
|
+
return output;
|
|
94499
94507
|
}
|
|
94500
94508
|
}
|
|
94501
94509
|
async maxNewDeposits() {
|
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;
|
|
@@ -30584,12 +30584,20 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
30584
30584
|
async netAPY() {
|
|
30585
30585
|
const unusedBalance = await this.getUnusedBalance();
|
|
30586
30586
|
const maxNewDeposits = await this.maxNewDeposits();
|
|
30587
|
+
const lstAPY = await this.getLSTAPR(this.getLSTUnderlyingTokenInfo().address);
|
|
30587
30588
|
if (maxNewDeposits * 1.5 < unusedBalance.amount.toNumber()) {
|
|
30588
|
-
|
|
30589
|
+
logger.verbose(`${this.getTag()}::netAPY: unused balance is > max servicable from loan, lstAPY: ${lstAPY}`);
|
|
30590
|
+
const output = await super.netAPY();
|
|
30591
|
+
output.splits.push({ apy: lstAPY, id: "lst_apy" });
|
|
30592
|
+
return output;
|
|
30589
30593
|
} else {
|
|
30594
|
+
logger.verbose(`${this.getTag()}::netAPY: we can take more deposits, use theoretical max APY`);
|
|
30590
30595
|
const { positions, baseAPYs, rewardAPYs } = await this.getVesuAPYs();
|
|
30591
30596
|
const weights = positions.map((p, index) => p.usdValue * (index % 2 == 0 ? 1 : -1));
|
|
30592
|
-
|
|
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));
|
|
30599
|
+
output.splits.push({ apy: lstAPY, id: "lst_apy" });
|
|
30600
|
+
return output;
|
|
30593
30601
|
}
|
|
30594
30602
|
}
|
|
30595
30603
|
async maxNewDeposits() {
|
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;
|
|
@@ -30583,12 +30583,20 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
30583
30583
|
async netAPY() {
|
|
30584
30584
|
const unusedBalance = await this.getUnusedBalance();
|
|
30585
30585
|
const maxNewDeposits = await this.maxNewDeposits();
|
|
30586
|
+
const lstAPY = await this.getLSTAPR(this.getLSTUnderlyingTokenInfo().address);
|
|
30586
30587
|
if (maxNewDeposits * 1.5 < unusedBalance.amount.toNumber()) {
|
|
30587
|
-
|
|
30588
|
+
logger.verbose(`${this.getTag()}::netAPY: unused balance is > max servicable from loan, lstAPY: ${lstAPY}`);
|
|
30589
|
+
const output = await super.netAPY();
|
|
30590
|
+
output.splits.push({ apy: lstAPY, id: "lst_apy" });
|
|
30591
|
+
return output;
|
|
30588
30592
|
} else {
|
|
30593
|
+
logger.verbose(`${this.getTag()}::netAPY: we can take more deposits, use theoretical max APY`);
|
|
30589
30594
|
const { positions, baseAPYs, rewardAPYs } = await this.getVesuAPYs();
|
|
30590
30595
|
const weights = positions.map((p, index) => p.usdValue * (index % 2 == 0 ? 1 : -1));
|
|
30591
|
-
|
|
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));
|
|
30598
|
+
output.splits.push({ apy: lstAPY, id: "lst_apy" });
|
|
30599
|
+
return output;
|
|
30592
30600
|
}
|
|
30593
30601
|
}
|
|
30594
30602
|
async maxNewDeposits() {
|
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;
|
|
@@ -30482,12 +30482,20 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
30482
30482
|
async netAPY() {
|
|
30483
30483
|
const unusedBalance = await this.getUnusedBalance();
|
|
30484
30484
|
const maxNewDeposits = await this.maxNewDeposits();
|
|
30485
|
+
const lstAPY = await this.getLSTAPR(this.getLSTUnderlyingTokenInfo().address);
|
|
30485
30486
|
if (maxNewDeposits * 1.5 < unusedBalance.amount.toNumber()) {
|
|
30486
|
-
|
|
30487
|
+
logger.verbose(`${this.getTag()}::netAPY: unused balance is > max servicable from loan, lstAPY: ${lstAPY}`);
|
|
30488
|
+
const output = await super.netAPY();
|
|
30489
|
+
output.splits.push({ apy: lstAPY, id: "lst_apy" });
|
|
30490
|
+
return output;
|
|
30487
30491
|
} else {
|
|
30492
|
+
logger.verbose(`${this.getTag()}::netAPY: we can take more deposits, use theoretical max APY`);
|
|
30488
30493
|
const { positions, baseAPYs, rewardAPYs } = await this.getVesuAPYs();
|
|
30489
30494
|
const weights = positions.map((p, index) => p.usdValue * (index % 2 == 0 ? 1 : -1));
|
|
30490
|
-
|
|
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));
|
|
30497
|
+
output.splits.push({ apy: lstAPY, id: "lst_apy" });
|
|
30498
|
+
return output;
|
|
30491
30499
|
}
|
|
30492
30500
|
}
|
|
30493
30501
|
async maxNewDeposits() {
|
package/package.json
CHANGED
|
@@ -460,17 +460,25 @@ export class UniversalLstMultiplierStrategy extends UniversalStrategy<HyperLSTSt
|
|
|
460
460
|
async netAPY(): Promise<{ net: number; splits: { apy: number; id: string; }[]; }> {
|
|
461
461
|
const unusedBalance = await this.getUnusedBalance();
|
|
462
462
|
const maxNewDeposits = await this.maxNewDeposits();
|
|
463
|
+
const lstAPY = await this.getLSTAPR(this.getLSTUnderlyingTokenInfo().address);
|
|
463
464
|
|
|
464
465
|
// if unused balance is > max servicable from loan, we are limited by the max borrowing we can do
|
|
465
466
|
// we also allow accepting little higher deposits (1.5x) to have room for future looping when theres more liquidity or debt cap rises
|
|
466
467
|
if (maxNewDeposits * 1.5 < unusedBalance.amount.toNumber()) {
|
|
467
468
|
// we have excess, just use real APY
|
|
468
|
-
|
|
469
|
+
logger.verbose(`${this.getTag()}::netAPY: unused balance is > max servicable from loan, lstAPY: ${lstAPY}`);
|
|
470
|
+
const output = await super.netAPY();
|
|
471
|
+
output.splits.push({apy: lstAPY, id: 'lst_apy'});
|
|
472
|
+
return output;
|
|
469
473
|
} else {
|
|
470
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`);
|
|
471
476
|
const { positions, baseAPYs, rewardAPYs } = await this.getVesuAPYs();
|
|
472
477
|
const weights = positions.map((p, index) => p.usdValue * (index % 2 == 0 ? 1 : -1));
|
|
473
|
-
|
|
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));
|
|
480
|
+
output.splits.push({apy: lstAPY, id: 'lst_apy'});
|
|
481
|
+
return output;
|
|
474
482
|
}
|
|
475
483
|
}
|
|
476
484
|
|
|
@@ -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;
|