@strkfarm/sdk 2.0.0-staging.41 → 2.0.0-staging.42
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 +18 -66
- package/dist/index.browser.mjs +18 -66
- package/dist/index.d.ts +2 -10
- package/dist/index.js +18 -66
- package/dist/index.mjs +18 -66
- package/package.json +1 -1
- package/src/strategies/base-strategy.ts +0 -52
- package/src/strategies/ekubo-cl-vault.tsx +0 -1
- package/src/strategies/sensei.ts +3 -3
- package/src/strategies/universal-lst-muliplier-strategy.tsx +5 -8
- package/src/strategies/universal-strategy.tsx +0 -2
- package/src/strategies/yoloVault.ts +9 -10
|
@@ -92154,48 +92154,6 @@ spurious results.`);
|
|
|
92154
92154
|
if (!Number.isFinite(value)) return "N/A";
|
|
92155
92155
|
return `${(value * 100).toFixed(2)}%`;
|
|
92156
92156
|
}
|
|
92157
|
-
resolveApyMethod(input) {
|
|
92158
|
-
const fromInput = input?.apyMethod?.trim();
|
|
92159
|
-
if (fromInput) return fromInput;
|
|
92160
|
-
const metadataApyMethod = this?.metadata?.apyMethodology;
|
|
92161
|
-
if (typeof metadataApyMethod === "string" && metadataApyMethod.trim().length > 0) {
|
|
92162
|
-
return metadataApyMethod;
|
|
92163
|
-
}
|
|
92164
|
-
return void 0;
|
|
92165
|
-
}
|
|
92166
|
-
normalizeApyDisplayValue(apy) {
|
|
92167
|
-
if (typeof apy === "number") {
|
|
92168
|
-
return this.formatPercentForCard(apy);
|
|
92169
|
-
}
|
|
92170
|
-
if (typeof apy === "string") {
|
|
92171
|
-
return apy.trim().length > 0 ? apy : "N/A";
|
|
92172
|
-
}
|
|
92173
|
-
if (apy && typeof apy === "object" && "net" in apy) {
|
|
92174
|
-
return this.formatPercentForCard(Number(apy.net));
|
|
92175
|
-
}
|
|
92176
|
-
return "N/A";
|
|
92177
|
-
}
|
|
92178
|
-
async resolveApyValueForCard(input) {
|
|
92179
|
-
if (input && input.apy !== void 0 && input.apy !== null) {
|
|
92180
|
-
return this.normalizeApyDisplayValue(input.apy);
|
|
92181
|
-
}
|
|
92182
|
-
try {
|
|
92183
|
-
const netApy = await this.netAPY();
|
|
92184
|
-
return this.normalizeApyDisplayValue(netApy);
|
|
92185
|
-
} catch {
|
|
92186
|
-
return "N/A";
|
|
92187
|
-
}
|
|
92188
|
-
}
|
|
92189
|
-
async createApyCard(input) {
|
|
92190
|
-
const apyMethod = this.resolveApyMethod(input);
|
|
92191
|
-
return {
|
|
92192
|
-
title: "APY",
|
|
92193
|
-
value: await this.resolveApyValueForCard(input),
|
|
92194
|
-
tooltip: apyMethod,
|
|
92195
|
-
kind: "apy",
|
|
92196
|
-
apyMethod
|
|
92197
|
-
};
|
|
92198
|
-
}
|
|
92199
92157
|
formatUSDForCard(value) {
|
|
92200
92158
|
if (!Number.isFinite(value)) return "$0.00";
|
|
92201
92159
|
return new Intl.NumberFormat("en-US", {
|
|
@@ -104022,7 +103980,6 @@ spurious results.`);
|
|
|
104022
103980
|
subValueColor: "default"
|
|
104023
103981
|
}
|
|
104024
103982
|
];
|
|
104025
|
-
cards.push(await this.createApyCard(input));
|
|
104026
103983
|
return cards;
|
|
104027
103984
|
}
|
|
104028
103985
|
async feeBasedAPY(timeperiod = "24h") {
|
|
@@ -115765,8 +115722,8 @@ spurious results.`);
|
|
|
115765
115722
|
async getUserRealizedAPY(blockIdentifier = "latest", sinceBlocks = 6e5) {
|
|
115766
115723
|
throw new Error("getUserRealizedAPY not implemented yet for Sensei strategy");
|
|
115767
115724
|
}
|
|
115768
|
-
async getUserPositionCards(
|
|
115769
|
-
return [
|
|
115725
|
+
async getUserPositionCards(_input) {
|
|
115726
|
+
return [];
|
|
115770
115727
|
}
|
|
115771
115728
|
};
|
|
115772
115729
|
var senseiDescription = `Deposit your {{token1}} to automatically loop your funds via Endur ({{token2}}) and Vesu to create a delta neutral position. This strategy is designed to maximize your yield on {{token1}}. Your position is automatically adjusted periodically to maintain a healthy health factor. You receive a NFT as representation for your stake on Troves. You can withdraw anytime by redeeming your NFT for {{token1}}.`;
|
|
@@ -115918,7 +115875,7 @@ spurious results.`);
|
|
|
115918
115875
|
alerts: []
|
|
115919
115876
|
},
|
|
115920
115877
|
usualTimeToEarnings: "2 weeks",
|
|
115921
|
-
usualTimeToEarningsDescription: "Strategy returns depend on LST price on DEXes. Even though the true price of LST on Endur increases continuously, the DEX price may lag sometimes, and historically is seen to rebase at least once every 2
|
|
115878
|
+
usualTimeToEarningsDescription: "Strategy returns depend on LST price on DEXes. Even though the true price of LST on Endur increases continuously, the DEX price may lag sometimes, and historically is seen to rebase at least once every 2 weeks. This is when you realise your earnings.",
|
|
115922
115879
|
points: [{
|
|
115923
115880
|
multiplier: 4,
|
|
115924
115881
|
logo: "https://endur.fi/favicon.ico",
|
|
@@ -117079,8 +117036,10 @@ spurious results.`);
|
|
|
117079
117036
|
// const formattedAmount = amount.dividedBy(10 ** decimals);
|
|
117080
117037
|
// return formattedAmount;
|
|
117081
117038
|
// }
|
|
117082
|
-
async getNormalizedUserInfo(user) {
|
|
117083
|
-
const userInfo = await this.contract.call("get_user_info", [user.address]
|
|
117039
|
+
async getNormalizedUserInfo(user, blockIdentifier = "latest") {
|
|
117040
|
+
const userInfo = await this.contract.call("get_user_info", [user.address], {
|
|
117041
|
+
blockIdentifier
|
|
117042
|
+
});
|
|
117084
117043
|
const {
|
|
117085
117044
|
shares,
|
|
117086
117045
|
base_token_balance,
|
|
@@ -117121,12 +117080,12 @@ spurious results.`);
|
|
|
117121
117080
|
}
|
|
117122
117081
|
return null;
|
|
117123
117082
|
}
|
|
117124
|
-
async getUserTVL(user) {
|
|
117083
|
+
async getUserTVL(user, blockIdentifier = "latest") {
|
|
117125
117084
|
try {
|
|
117126
117085
|
const [{ primaryTokenBalance, claimableSecondaryTokens }, primaryTokenPrice, secondaryTokenPrice] = await Promise.all([
|
|
117127
|
-
this.getNormalizedUserInfo(user),
|
|
117128
|
-
this.pricer.getPrice(this.primaryToken.symbol),
|
|
117129
|
-
this.pricer.getPrice(this.secondaryToken.symbol)
|
|
117086
|
+
this.getNormalizedUserInfo(user, blockIdentifier),
|
|
117087
|
+
this.pricer.getPrice(this.primaryToken.symbol, blockIdentifier),
|
|
117088
|
+
this.pricer.getPrice(this.secondaryToken.symbol, blockIdentifier)
|
|
117130
117089
|
]);
|
|
117131
117090
|
const primaryTokenUsd = primaryTokenBalance.multipliedBy(primaryTokenPrice.price).toNumber();
|
|
117132
117091
|
const secondaryTokenUsd = claimableSecondaryTokens.multipliedBy(secondaryTokenPrice.price);
|
|
@@ -117345,9 +117304,7 @@ spurious results.`);
|
|
|
117345
117304
|
{
|
|
117346
117305
|
title: "Your Holdings",
|
|
117347
117306
|
tooltip: "Combined value of your remaining base token and accumulated secondary token",
|
|
117348
|
-
value: this.formatUSDForCard(userTVL.usdValue)
|
|
117349
|
-
subValue: `${holdingsTitle} + ${earningsTitle}`,
|
|
117350
|
-
subValueColor: "positive"
|
|
117307
|
+
value: this.formatUSDForCard(userTVL.usdValue)
|
|
117351
117308
|
},
|
|
117352
117309
|
{
|
|
117353
117310
|
title: holdingsTitle,
|
|
@@ -117364,7 +117321,6 @@ spurious results.`);
|
|
|
117364
117321
|
subValueColor: "default"
|
|
117365
117322
|
}
|
|
117366
117323
|
];
|
|
117367
|
-
cards.push(await this.createApyCard(input));
|
|
117368
117324
|
return cards;
|
|
117369
117325
|
}
|
|
117370
117326
|
};
|
|
@@ -120303,7 +120259,6 @@ spurious results.`);
|
|
|
120303
120259
|
subValue: `\u2248 ${this.formatUSDForCard(lifetimeUsdValue)}`,
|
|
120304
120260
|
subValueColor: this.getSubValueColorFromSignedNumber(lifetimeUsdValue)
|
|
120305
120261
|
});
|
|
120306
|
-
cards.push(await this.createApyCard(input));
|
|
120307
120262
|
return cards;
|
|
120308
120263
|
}
|
|
120309
120264
|
/**
|
|
@@ -121657,7 +121612,7 @@ spurious results.`);
|
|
|
121657
121612
|
}
|
|
121658
121613
|
const unrealizedCard = {
|
|
121659
121614
|
title: "Unrealized Gains",
|
|
121660
|
-
tooltip: "Unrealized gains based on current market prices vs
|
|
121615
|
+
tooltip: "Unrealized gains based on current market prices vs Endur prices. If you withdraw now, you will forgo these gains.",
|
|
121661
121616
|
value: this.formatTokenAmountForCard(amount, unrealizedResult.tokenInfo),
|
|
121662
121617
|
subValue: `\u2248 ${this.formatUSDForCard(usdValue)}`,
|
|
121663
121618
|
subValueColor: this.getSubValueColorFromSignedNumber(usdValue)
|
|
@@ -121673,7 +121628,7 @@ spurious results.`);
|
|
|
121673
121628
|
logger2.warn(`${this.getTag()}::getUserPositionCards unrealized gains fallback`, error2);
|
|
121674
121629
|
cards.push({
|
|
121675
121630
|
title: "Unrealized Gains",
|
|
121676
|
-
tooltip: "Unrealized gains based on current market prices vs
|
|
121631
|
+
tooltip: "Unrealized gains based on current market prices vs Endur prices. If you withdraw now, you will forgo these gains.",
|
|
121677
121632
|
value: this.formatTokenAmountForCard(
|
|
121678
121633
|
Web3Number.fromWei("0", this.asset().decimals),
|
|
121679
121634
|
this.asset()
|
|
@@ -121689,14 +121644,11 @@ spurious results.`);
|
|
|
121689
121644
|
}
|
|
121690
121645
|
if (this.asset().symbol === "xSTRK") {
|
|
121691
121646
|
const index = cards.findIndex((card) => card.title === "Lifetime Earnings");
|
|
121647
|
+
const originalCard = cards[index];
|
|
121692
121648
|
if (index >= 0) {
|
|
121693
121649
|
cards[index] = {
|
|
121694
|
-
|
|
121695
|
-
tooltip: "Lifetime earnings of the vault. Due to migration of xSTRK Sensei to this vault, any migrated funds are also seen as lifetime earnings. Team is working to fix this soon."
|
|
121696
|
-
value: this.formatTokenAmountForCard(
|
|
121697
|
-
Web3Number.fromWei("0", this.asset().decimals),
|
|
121698
|
-
this.asset()
|
|
121699
|
-
)
|
|
121650
|
+
...originalCard,
|
|
121651
|
+
tooltip: "Lifetime earnings of the vault. Due to migration of xSTRK Sensei to this vault, any migrated funds are also seen as lifetime earnings. Team is working to fix this soon."
|
|
121700
121652
|
};
|
|
121701
121653
|
}
|
|
121702
121654
|
}
|
|
@@ -122814,7 +122766,7 @@ spurious results.`);
|
|
|
122814
122766
|
security: HYPER_LST_SECURITY,
|
|
122815
122767
|
redemptionInfo: HYPER_LST_REDEMPTION_INFO,
|
|
122816
122768
|
usualTimeToEarnings: "2 weeks",
|
|
122817
|
-
usualTimeToEarningsDescription: "Strategy returns depend on LST price on DEXes. Even though the true price of LST on Endur increases continuously, the DEX price may lag sometimes, and historically is seen to rebase at least once every 2
|
|
122769
|
+
usualTimeToEarningsDescription: "Strategy returns depend on LST price on DEXes. Even though the true price of LST on Endur increases continuously, the DEX price may lag sometimes, and historically is seen to rebase at least once every 2 weeks. This is when you realise your earnings.",
|
|
122818
122770
|
points: [
|
|
122819
122771
|
{
|
|
122820
122772
|
multiplier: 4,
|
package/dist/index.browser.mjs
CHANGED
|
@@ -4922,48 +4922,6 @@ var BaseStrategy = class extends CacheClass {
|
|
|
4922
4922
|
if (!Number.isFinite(value)) return "N/A";
|
|
4923
4923
|
return `${(value * 100).toFixed(2)}%`;
|
|
4924
4924
|
}
|
|
4925
|
-
resolveApyMethod(input) {
|
|
4926
|
-
const fromInput = input?.apyMethod?.trim();
|
|
4927
|
-
if (fromInput) return fromInput;
|
|
4928
|
-
const metadataApyMethod = this?.metadata?.apyMethodology;
|
|
4929
|
-
if (typeof metadataApyMethod === "string" && metadataApyMethod.trim().length > 0) {
|
|
4930
|
-
return metadataApyMethod;
|
|
4931
|
-
}
|
|
4932
|
-
return void 0;
|
|
4933
|
-
}
|
|
4934
|
-
normalizeApyDisplayValue(apy) {
|
|
4935
|
-
if (typeof apy === "number") {
|
|
4936
|
-
return this.formatPercentForCard(apy);
|
|
4937
|
-
}
|
|
4938
|
-
if (typeof apy === "string") {
|
|
4939
|
-
return apy.trim().length > 0 ? apy : "N/A";
|
|
4940
|
-
}
|
|
4941
|
-
if (apy && typeof apy === "object" && "net" in apy) {
|
|
4942
|
-
return this.formatPercentForCard(Number(apy.net));
|
|
4943
|
-
}
|
|
4944
|
-
return "N/A";
|
|
4945
|
-
}
|
|
4946
|
-
async resolveApyValueForCard(input) {
|
|
4947
|
-
if (input && input.apy !== void 0 && input.apy !== null) {
|
|
4948
|
-
return this.normalizeApyDisplayValue(input.apy);
|
|
4949
|
-
}
|
|
4950
|
-
try {
|
|
4951
|
-
const netApy = await this.netAPY();
|
|
4952
|
-
return this.normalizeApyDisplayValue(netApy);
|
|
4953
|
-
} catch {
|
|
4954
|
-
return "N/A";
|
|
4955
|
-
}
|
|
4956
|
-
}
|
|
4957
|
-
async createApyCard(input) {
|
|
4958
|
-
const apyMethod = this.resolveApyMethod(input);
|
|
4959
|
-
return {
|
|
4960
|
-
title: "APY",
|
|
4961
|
-
value: await this.resolveApyValueForCard(input),
|
|
4962
|
-
tooltip: apyMethod,
|
|
4963
|
-
kind: "apy",
|
|
4964
|
-
apyMethod
|
|
4965
|
-
};
|
|
4966
|
-
}
|
|
4967
4925
|
formatUSDForCard(value) {
|
|
4968
4926
|
if (!Number.isFinite(value)) return "$0.00";
|
|
4969
4927
|
return new Intl.NumberFormat("en-US", {
|
|
@@ -16803,7 +16761,6 @@ var EkuboCLVault = class _EkuboCLVault extends BaseStrategy {
|
|
|
16803
16761
|
subValueColor: "default"
|
|
16804
16762
|
}
|
|
16805
16763
|
];
|
|
16806
|
-
cards.push(await this.createApyCard(input));
|
|
16807
16764
|
return cards;
|
|
16808
16765
|
}
|
|
16809
16766
|
async feeBasedAPY(timeperiod = "24h") {
|
|
@@ -28553,8 +28510,8 @@ var SenseiVault = class _SenseiVault extends BaseStrategy {
|
|
|
28553
28510
|
async getUserRealizedAPY(blockIdentifier = "latest", sinceBlocks = 6e5) {
|
|
28554
28511
|
throw new Error("getUserRealizedAPY not implemented yet for Sensei strategy");
|
|
28555
28512
|
}
|
|
28556
|
-
async getUserPositionCards(
|
|
28557
|
-
return [
|
|
28513
|
+
async getUserPositionCards(_input) {
|
|
28514
|
+
return [];
|
|
28558
28515
|
}
|
|
28559
28516
|
};
|
|
28560
28517
|
var senseiDescription = `Deposit your {{token1}} to automatically loop your funds via Endur ({{token2}}) and Vesu to create a delta neutral position. This strategy is designed to maximize your yield on {{token1}}. Your position is automatically adjusted periodically to maintain a healthy health factor. You receive a NFT as representation for your stake on Troves. You can withdraw anytime by redeeming your NFT for {{token1}}.`;
|
|
@@ -28706,7 +28663,7 @@ var SenseiStrategies = [
|
|
|
28706
28663
|
alerts: []
|
|
28707
28664
|
},
|
|
28708
28665
|
usualTimeToEarnings: "2 weeks",
|
|
28709
|
-
usualTimeToEarningsDescription: "Strategy returns depend on LST price on DEXes. Even though the true price of LST on Endur increases continuously, the DEX price may lag sometimes, and historically is seen to rebase at least once every 2
|
|
28666
|
+
usualTimeToEarningsDescription: "Strategy returns depend on LST price on DEXes. Even though the true price of LST on Endur increases continuously, the DEX price may lag sometimes, and historically is seen to rebase at least once every 2 weeks. This is when you realise your earnings.",
|
|
28710
28667
|
points: [{
|
|
28711
28668
|
multiplier: 4,
|
|
28712
28669
|
logo: "https://endur.fi/favicon.ico",
|
|
@@ -29871,8 +29828,10 @@ var YoLoVault = class extends BaseStrategy {
|
|
|
29871
29828
|
// const formattedAmount = amount.dividedBy(10 ** decimals);
|
|
29872
29829
|
// return formattedAmount;
|
|
29873
29830
|
// }
|
|
29874
|
-
async getNormalizedUserInfo(user) {
|
|
29875
|
-
const userInfo = await this.contract.call("get_user_info", [user.address]
|
|
29831
|
+
async getNormalizedUserInfo(user, blockIdentifier = "latest") {
|
|
29832
|
+
const userInfo = await this.contract.call("get_user_info", [user.address], {
|
|
29833
|
+
blockIdentifier
|
|
29834
|
+
});
|
|
29876
29835
|
const {
|
|
29877
29836
|
shares,
|
|
29878
29837
|
base_token_balance,
|
|
@@ -29913,12 +29872,12 @@ var YoLoVault = class extends BaseStrategy {
|
|
|
29913
29872
|
}
|
|
29914
29873
|
return null;
|
|
29915
29874
|
}
|
|
29916
|
-
async getUserTVL(user) {
|
|
29875
|
+
async getUserTVL(user, blockIdentifier = "latest") {
|
|
29917
29876
|
try {
|
|
29918
29877
|
const [{ primaryTokenBalance, claimableSecondaryTokens }, primaryTokenPrice, secondaryTokenPrice] = await Promise.all([
|
|
29919
|
-
this.getNormalizedUserInfo(user),
|
|
29920
|
-
this.pricer.getPrice(this.primaryToken.symbol),
|
|
29921
|
-
this.pricer.getPrice(this.secondaryToken.symbol)
|
|
29878
|
+
this.getNormalizedUserInfo(user, blockIdentifier),
|
|
29879
|
+
this.pricer.getPrice(this.primaryToken.symbol, blockIdentifier),
|
|
29880
|
+
this.pricer.getPrice(this.secondaryToken.symbol, blockIdentifier)
|
|
29922
29881
|
]);
|
|
29923
29882
|
const primaryTokenUsd = primaryTokenBalance.multipliedBy(primaryTokenPrice.price).toNumber();
|
|
29924
29883
|
const secondaryTokenUsd = claimableSecondaryTokens.multipliedBy(secondaryTokenPrice.price);
|
|
@@ -30137,9 +30096,7 @@ var YoLoVault = class extends BaseStrategy {
|
|
|
30137
30096
|
{
|
|
30138
30097
|
title: "Your Holdings",
|
|
30139
30098
|
tooltip: "Combined value of your remaining base token and accumulated secondary token",
|
|
30140
|
-
value: this.formatUSDForCard(userTVL.usdValue)
|
|
30141
|
-
subValue: `${holdingsTitle} + ${earningsTitle}`,
|
|
30142
|
-
subValueColor: "positive"
|
|
30099
|
+
value: this.formatUSDForCard(userTVL.usdValue)
|
|
30143
30100
|
},
|
|
30144
30101
|
{
|
|
30145
30102
|
title: holdingsTitle,
|
|
@@ -30156,7 +30113,6 @@ var YoLoVault = class extends BaseStrategy {
|
|
|
30156
30113
|
subValueColor: "default"
|
|
30157
30114
|
}
|
|
30158
30115
|
];
|
|
30159
|
-
cards.push(await this.createApyCard(input));
|
|
30160
30116
|
return cards;
|
|
30161
30117
|
}
|
|
30162
30118
|
};
|
|
@@ -33099,7 +33055,6 @@ var UniversalStrategy = class _UniversalStrategy extends BaseStrategy {
|
|
|
33099
33055
|
subValue: `\u2248 ${this.formatUSDForCard(lifetimeUsdValue)}`,
|
|
33100
33056
|
subValueColor: this.getSubValueColorFromSignedNumber(lifetimeUsdValue)
|
|
33101
33057
|
});
|
|
33102
|
-
cards.push(await this.createApyCard(input));
|
|
33103
33058
|
return cards;
|
|
33104
33059
|
}
|
|
33105
33060
|
/**
|
|
@@ -34456,7 +34411,7 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
34456
34411
|
}
|
|
34457
34412
|
const unrealizedCard = {
|
|
34458
34413
|
title: "Unrealized Gains",
|
|
34459
|
-
tooltip: "Unrealized gains based on current market prices vs
|
|
34414
|
+
tooltip: "Unrealized gains based on current market prices vs Endur prices. If you withdraw now, you will forgo these gains.",
|
|
34460
34415
|
value: this.formatTokenAmountForCard(amount, unrealizedResult.tokenInfo),
|
|
34461
34416
|
subValue: `\u2248 ${this.formatUSDForCard(usdValue)}`,
|
|
34462
34417
|
subValueColor: this.getSubValueColorFromSignedNumber(usdValue)
|
|
@@ -34472,7 +34427,7 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
34472
34427
|
logger.warn(`${this.getTag()}::getUserPositionCards unrealized gains fallback`, error);
|
|
34473
34428
|
cards.push({
|
|
34474
34429
|
title: "Unrealized Gains",
|
|
34475
|
-
tooltip: "Unrealized gains based on current market prices vs
|
|
34430
|
+
tooltip: "Unrealized gains based on current market prices vs Endur prices. If you withdraw now, you will forgo these gains.",
|
|
34476
34431
|
value: this.formatTokenAmountForCard(
|
|
34477
34432
|
Web3Number.fromWei("0", this.asset().decimals),
|
|
34478
34433
|
this.asset()
|
|
@@ -34488,14 +34443,11 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
34488
34443
|
}
|
|
34489
34444
|
if (this.asset().symbol === "xSTRK") {
|
|
34490
34445
|
const index = cards.findIndex((card) => card.title === "Lifetime Earnings");
|
|
34446
|
+
const originalCard = cards[index];
|
|
34491
34447
|
if (index >= 0) {
|
|
34492
34448
|
cards[index] = {
|
|
34493
|
-
|
|
34494
|
-
tooltip: "Lifetime earnings of the vault. Due to migration of xSTRK Sensei to this vault, any migrated funds are also seen as lifetime earnings. Team is working to fix this soon."
|
|
34495
|
-
value: this.formatTokenAmountForCard(
|
|
34496
|
-
Web3Number.fromWei("0", this.asset().decimals),
|
|
34497
|
-
this.asset()
|
|
34498
|
-
)
|
|
34449
|
+
...originalCard,
|
|
34450
|
+
tooltip: "Lifetime earnings of the vault. Due to migration of xSTRK Sensei to this vault, any migrated funds are also seen as lifetime earnings. Team is working to fix this soon."
|
|
34499
34451
|
};
|
|
34500
34452
|
}
|
|
34501
34453
|
}
|
|
@@ -35613,7 +35565,7 @@ function getStrategySettings(lstSymbol, underlyingSymbol, settings, isPreview =
|
|
|
35613
35565
|
security: HYPER_LST_SECURITY,
|
|
35614
35566
|
redemptionInfo: HYPER_LST_REDEMPTION_INFO,
|
|
35615
35567
|
usualTimeToEarnings: "2 weeks",
|
|
35616
|
-
usualTimeToEarningsDescription: "Strategy returns depend on LST price on DEXes. Even though the true price of LST on Endur increases continuously, the DEX price may lag sometimes, and historically is seen to rebase at least once every 2
|
|
35568
|
+
usualTimeToEarningsDescription: "Strategy returns depend on LST price on DEXes. Even though the true price of LST on Endur increases continuously, the DEX price may lag sometimes, and historically is seen to rebase at least once every 2 weeks. This is when you realise your earnings.",
|
|
35617
35569
|
points: [
|
|
35618
35570
|
{
|
|
35619
35571
|
multiplier: 4,
|
package/dist/index.d.ts
CHANGED
|
@@ -624,8 +624,6 @@ interface UserPositionCard {
|
|
|
624
624
|
tooltip?: string;
|
|
625
625
|
subValue?: string;
|
|
626
626
|
subValueColor?: UserPositionCardSubValueColor;
|
|
627
|
-
kind?: "metric" | "apy";
|
|
628
|
-
apyMethod?: string;
|
|
629
627
|
}
|
|
630
628
|
interface UserPositionCardsInput {
|
|
631
629
|
user: ContractAddr;
|
|
@@ -637,8 +635,6 @@ interface UserPositionCardsInput {
|
|
|
637
635
|
}>;
|
|
638
636
|
usualTimeToEarnings?: string | null;
|
|
639
637
|
usualTimeToEarningsDescription?: string | null;
|
|
640
|
-
apy?: number | string | null;
|
|
641
|
-
apyMethod?: string | null;
|
|
642
638
|
}
|
|
643
639
|
interface CacheData {
|
|
644
640
|
timestamp: number;
|
|
@@ -667,10 +663,6 @@ declare class BaseStrategy<TVLInfo, DepositActionInfo, WithdrawActionInfo = Depo
|
|
|
667
663
|
getUserPositionCards(_input: UserPositionCardsInput): Promise<UserPositionCard[]>;
|
|
668
664
|
protected formatTokenAmountForCard(amount: Web3Number, tokenInfo: TokenInfo): string;
|
|
669
665
|
protected formatPercentForCard(value: number): string;
|
|
670
|
-
protected resolveApyMethod(input?: UserPositionCardsInput): string | undefined;
|
|
671
|
-
protected normalizeApyDisplayValue(apy: number | string | NetAPYDetails | null | undefined): string;
|
|
672
|
-
protected resolveApyValueForCard(input?: UserPositionCardsInput): Promise<string>;
|
|
673
|
-
protected createApyCard(input?: UserPositionCardsInput): Promise<UserPositionCard>;
|
|
674
666
|
protected formatUSDForCard(value: number): string;
|
|
675
667
|
protected getSubValueColorFromSignedNumber(value: number): UserPositionCardSubValueColor;
|
|
676
668
|
/**
|
|
@@ -1215,7 +1207,7 @@ declare class SenseiVault extends BaseStrategy<SingleTokenInfo, SingleActionAmou
|
|
|
1215
1207
|
* Not implemented for Sensei Strategy yet.
|
|
1216
1208
|
*/
|
|
1217
1209
|
getUserRealizedAPY(blockIdentifier?: BlockIdentifier, sinceBlocks?: number): Promise<number>;
|
|
1218
|
-
getUserPositionCards(
|
|
1210
|
+
getUserPositionCards(_input: UserPositionCardsInput): Promise<UserPositionCard[]>;
|
|
1219
1211
|
}
|
|
1220
1212
|
declare const SenseiStrategies: IStrategyMetadata<SenseiVaultSettings>[];
|
|
1221
1213
|
|
|
@@ -1272,7 +1264,7 @@ declare class YoLoVault extends BaseStrategy<DualTokenInfo, SingleActionAmount,
|
|
|
1272
1264
|
constructor(config: IConfig, pricer: PricerBase, metadata: IStrategyMetadata<YoloVaultSettings>);
|
|
1273
1265
|
private getNormalizedUserInfo;
|
|
1274
1266
|
private resolveWithdrawRequest;
|
|
1275
|
-
getUserTVL(user: ContractAddr): Promise<DualTokenInfo>;
|
|
1267
|
+
getUserTVL(user: ContractAddr, blockIdentifier?: BlockIdentifier): Promise<DualTokenInfo>;
|
|
1276
1268
|
getVaultPositions(): Promise<VaultPosition[]>;
|
|
1277
1269
|
getTVL(): Promise<DualTokenInfo>;
|
|
1278
1270
|
depositCall(amountInfo: SingleActionAmount, receiver: ContractAddr): Promise<Call[]>;
|
package/dist/index.js
CHANGED
|
@@ -4965,48 +4965,6 @@ var BaseStrategy = class extends CacheClass {
|
|
|
4965
4965
|
if (!Number.isFinite(value)) return "N/A";
|
|
4966
4966
|
return `${(value * 100).toFixed(2)}%`;
|
|
4967
4967
|
}
|
|
4968
|
-
resolveApyMethod(input) {
|
|
4969
|
-
const fromInput = input?.apyMethod?.trim();
|
|
4970
|
-
if (fromInput) return fromInput;
|
|
4971
|
-
const metadataApyMethod = this?.metadata?.apyMethodology;
|
|
4972
|
-
if (typeof metadataApyMethod === "string" && metadataApyMethod.trim().length > 0) {
|
|
4973
|
-
return metadataApyMethod;
|
|
4974
|
-
}
|
|
4975
|
-
return void 0;
|
|
4976
|
-
}
|
|
4977
|
-
normalizeApyDisplayValue(apy) {
|
|
4978
|
-
if (typeof apy === "number") {
|
|
4979
|
-
return this.formatPercentForCard(apy);
|
|
4980
|
-
}
|
|
4981
|
-
if (typeof apy === "string") {
|
|
4982
|
-
return apy.trim().length > 0 ? apy : "N/A";
|
|
4983
|
-
}
|
|
4984
|
-
if (apy && typeof apy === "object" && "net" in apy) {
|
|
4985
|
-
return this.formatPercentForCard(Number(apy.net));
|
|
4986
|
-
}
|
|
4987
|
-
return "N/A";
|
|
4988
|
-
}
|
|
4989
|
-
async resolveApyValueForCard(input) {
|
|
4990
|
-
if (input && input.apy !== void 0 && input.apy !== null) {
|
|
4991
|
-
return this.normalizeApyDisplayValue(input.apy);
|
|
4992
|
-
}
|
|
4993
|
-
try {
|
|
4994
|
-
const netApy = await this.netAPY();
|
|
4995
|
-
return this.normalizeApyDisplayValue(netApy);
|
|
4996
|
-
} catch {
|
|
4997
|
-
return "N/A";
|
|
4998
|
-
}
|
|
4999
|
-
}
|
|
5000
|
-
async createApyCard(input) {
|
|
5001
|
-
const apyMethod = this.resolveApyMethod(input);
|
|
5002
|
-
return {
|
|
5003
|
-
title: "APY",
|
|
5004
|
-
value: await this.resolveApyValueForCard(input),
|
|
5005
|
-
tooltip: apyMethod,
|
|
5006
|
-
kind: "apy",
|
|
5007
|
-
apyMethod
|
|
5008
|
-
};
|
|
5009
|
-
}
|
|
5010
4968
|
formatUSDForCard(value) {
|
|
5011
4969
|
if (!Number.isFinite(value)) return "$0.00";
|
|
5012
4970
|
return new Intl.NumberFormat("en-US", {
|
|
@@ -16842,7 +16800,6 @@ var EkuboCLVault = class _EkuboCLVault extends BaseStrategy {
|
|
|
16842
16800
|
subValueColor: "default"
|
|
16843
16801
|
}
|
|
16844
16802
|
];
|
|
16845
|
-
cards.push(await this.createApyCard(input));
|
|
16846
16803
|
return cards;
|
|
16847
16804
|
}
|
|
16848
16805
|
async feeBasedAPY(timeperiod = "24h") {
|
|
@@ -28693,8 +28650,8 @@ var SenseiVault = class _SenseiVault extends BaseStrategy {
|
|
|
28693
28650
|
async getUserRealizedAPY(blockIdentifier = "latest", sinceBlocks = 6e5) {
|
|
28694
28651
|
throw new Error("getUserRealizedAPY not implemented yet for Sensei strategy");
|
|
28695
28652
|
}
|
|
28696
|
-
async getUserPositionCards(
|
|
28697
|
-
return [
|
|
28653
|
+
async getUserPositionCards(_input) {
|
|
28654
|
+
return [];
|
|
28698
28655
|
}
|
|
28699
28656
|
};
|
|
28700
28657
|
var senseiDescription = `Deposit your {{token1}} to automatically loop your funds via Endur ({{token2}}) and Vesu to create a delta neutral position. This strategy is designed to maximize your yield on {{token1}}. Your position is automatically adjusted periodically to maintain a healthy health factor. You receive a NFT as representation for your stake on Troves. You can withdraw anytime by redeeming your NFT for {{token1}}.`;
|
|
@@ -28846,7 +28803,7 @@ var SenseiStrategies = [
|
|
|
28846
28803
|
alerts: []
|
|
28847
28804
|
},
|
|
28848
28805
|
usualTimeToEarnings: "2 weeks",
|
|
28849
|
-
usualTimeToEarningsDescription: "Strategy returns depend on LST price on DEXes. Even though the true price of LST on Endur increases continuously, the DEX price may lag sometimes, and historically is seen to rebase at least once every 2
|
|
28806
|
+
usualTimeToEarningsDescription: "Strategy returns depend on LST price on DEXes. Even though the true price of LST on Endur increases continuously, the DEX price may lag sometimes, and historically is seen to rebase at least once every 2 weeks. This is when you realise your earnings.",
|
|
28850
28807
|
points: [{
|
|
28851
28808
|
multiplier: 4,
|
|
28852
28809
|
logo: "https://endur.fi/favicon.ico",
|
|
@@ -30011,8 +29968,10 @@ var YoLoVault = class extends BaseStrategy {
|
|
|
30011
29968
|
// const formattedAmount = amount.dividedBy(10 ** decimals);
|
|
30012
29969
|
// return formattedAmount;
|
|
30013
29970
|
// }
|
|
30014
|
-
async getNormalizedUserInfo(user) {
|
|
30015
|
-
const userInfo = await this.contract.call("get_user_info", [user.address]
|
|
29971
|
+
async getNormalizedUserInfo(user, blockIdentifier = "latest") {
|
|
29972
|
+
const userInfo = await this.contract.call("get_user_info", [user.address], {
|
|
29973
|
+
blockIdentifier
|
|
29974
|
+
});
|
|
30016
29975
|
const {
|
|
30017
29976
|
shares,
|
|
30018
29977
|
base_token_balance,
|
|
@@ -30053,12 +30012,12 @@ var YoLoVault = class extends BaseStrategy {
|
|
|
30053
30012
|
}
|
|
30054
30013
|
return null;
|
|
30055
30014
|
}
|
|
30056
|
-
async getUserTVL(user) {
|
|
30015
|
+
async getUserTVL(user, blockIdentifier = "latest") {
|
|
30057
30016
|
try {
|
|
30058
30017
|
const [{ primaryTokenBalance, claimableSecondaryTokens }, primaryTokenPrice, secondaryTokenPrice] = await Promise.all([
|
|
30059
|
-
this.getNormalizedUserInfo(user),
|
|
30060
|
-
this.pricer.getPrice(this.primaryToken.symbol),
|
|
30061
|
-
this.pricer.getPrice(this.secondaryToken.symbol)
|
|
30018
|
+
this.getNormalizedUserInfo(user, blockIdentifier),
|
|
30019
|
+
this.pricer.getPrice(this.primaryToken.symbol, blockIdentifier),
|
|
30020
|
+
this.pricer.getPrice(this.secondaryToken.symbol, blockIdentifier)
|
|
30062
30021
|
]);
|
|
30063
30022
|
const primaryTokenUsd = primaryTokenBalance.multipliedBy(primaryTokenPrice.price).toNumber();
|
|
30064
30023
|
const secondaryTokenUsd = claimableSecondaryTokens.multipliedBy(secondaryTokenPrice.price);
|
|
@@ -30277,9 +30236,7 @@ var YoLoVault = class extends BaseStrategy {
|
|
|
30277
30236
|
{
|
|
30278
30237
|
title: "Your Holdings",
|
|
30279
30238
|
tooltip: "Combined value of your remaining base token and accumulated secondary token",
|
|
30280
|
-
value: this.formatUSDForCard(userTVL.usdValue)
|
|
30281
|
-
subValue: `${holdingsTitle} + ${earningsTitle}`,
|
|
30282
|
-
subValueColor: "positive"
|
|
30239
|
+
value: this.formatUSDForCard(userTVL.usdValue)
|
|
30283
30240
|
},
|
|
30284
30241
|
{
|
|
30285
30242
|
title: holdingsTitle,
|
|
@@ -30296,7 +30253,6 @@ var YoLoVault = class extends BaseStrategy {
|
|
|
30296
30253
|
subValueColor: "default"
|
|
30297
30254
|
}
|
|
30298
30255
|
];
|
|
30299
|
-
cards.push(await this.createApyCard(input));
|
|
30300
30256
|
return cards;
|
|
30301
30257
|
}
|
|
30302
30258
|
};
|
|
@@ -33239,7 +33195,6 @@ var UniversalStrategy = class _UniversalStrategy extends BaseStrategy {
|
|
|
33239
33195
|
subValue: `\u2248 ${this.formatUSDForCard(lifetimeUsdValue)}`,
|
|
33240
33196
|
subValueColor: this.getSubValueColorFromSignedNumber(lifetimeUsdValue)
|
|
33241
33197
|
});
|
|
33242
|
-
cards.push(await this.createApyCard(input));
|
|
33243
33198
|
return cards;
|
|
33244
33199
|
}
|
|
33245
33200
|
/**
|
|
@@ -34596,7 +34551,7 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
34596
34551
|
}
|
|
34597
34552
|
const unrealizedCard = {
|
|
34598
34553
|
title: "Unrealized Gains",
|
|
34599
|
-
tooltip: "Unrealized gains based on current market prices vs
|
|
34554
|
+
tooltip: "Unrealized gains based on current market prices vs Endur prices. If you withdraw now, you will forgo these gains.",
|
|
34600
34555
|
value: this.formatTokenAmountForCard(amount, unrealizedResult.tokenInfo),
|
|
34601
34556
|
subValue: `\u2248 ${this.formatUSDForCard(usdValue)}`,
|
|
34602
34557
|
subValueColor: this.getSubValueColorFromSignedNumber(usdValue)
|
|
@@ -34612,7 +34567,7 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
34612
34567
|
logger.warn(`${this.getTag()}::getUserPositionCards unrealized gains fallback`, error);
|
|
34613
34568
|
cards.push({
|
|
34614
34569
|
title: "Unrealized Gains",
|
|
34615
|
-
tooltip: "Unrealized gains based on current market prices vs
|
|
34570
|
+
tooltip: "Unrealized gains based on current market prices vs Endur prices. If you withdraw now, you will forgo these gains.",
|
|
34616
34571
|
value: this.formatTokenAmountForCard(
|
|
34617
34572
|
Web3Number.fromWei("0", this.asset().decimals),
|
|
34618
34573
|
this.asset()
|
|
@@ -34628,14 +34583,11 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
34628
34583
|
}
|
|
34629
34584
|
if (this.asset().symbol === "xSTRK") {
|
|
34630
34585
|
const index = cards.findIndex((card) => card.title === "Lifetime Earnings");
|
|
34586
|
+
const originalCard = cards[index];
|
|
34631
34587
|
if (index >= 0) {
|
|
34632
34588
|
cards[index] = {
|
|
34633
|
-
|
|
34634
|
-
tooltip: "Lifetime earnings of the vault. Due to migration of xSTRK Sensei to this vault, any migrated funds are also seen as lifetime earnings. Team is working to fix this soon."
|
|
34635
|
-
value: this.formatTokenAmountForCard(
|
|
34636
|
-
Web3Number.fromWei("0", this.asset().decimals),
|
|
34637
|
-
this.asset()
|
|
34638
|
-
)
|
|
34589
|
+
...originalCard,
|
|
34590
|
+
tooltip: "Lifetime earnings of the vault. Due to migration of xSTRK Sensei to this vault, any migrated funds are also seen as lifetime earnings. Team is working to fix this soon."
|
|
34639
34591
|
};
|
|
34640
34592
|
}
|
|
34641
34593
|
}
|
|
@@ -35753,7 +35705,7 @@ function getStrategySettings(lstSymbol, underlyingSymbol, settings, isPreview =
|
|
|
35753
35705
|
security: HYPER_LST_SECURITY,
|
|
35754
35706
|
redemptionInfo: HYPER_LST_REDEMPTION_INFO,
|
|
35755
35707
|
usualTimeToEarnings: "2 weeks",
|
|
35756
|
-
usualTimeToEarningsDescription: "Strategy returns depend on LST price on DEXes. Even though the true price of LST on Endur increases continuously, the DEX price may lag sometimes, and historically is seen to rebase at least once every 2
|
|
35708
|
+
usualTimeToEarningsDescription: "Strategy returns depend on LST price on DEXes. Even though the true price of LST on Endur increases continuously, the DEX price may lag sometimes, and historically is seen to rebase at least once every 2 weeks. This is when you realise your earnings.",
|
|
35757
35709
|
points: [
|
|
35758
35710
|
{
|
|
35759
35711
|
multiplier: 4,
|
package/dist/index.mjs
CHANGED
|
@@ -4826,48 +4826,6 @@ var BaseStrategy = class extends CacheClass {
|
|
|
4826
4826
|
if (!Number.isFinite(value)) return "N/A";
|
|
4827
4827
|
return `${(value * 100).toFixed(2)}%`;
|
|
4828
4828
|
}
|
|
4829
|
-
resolveApyMethod(input) {
|
|
4830
|
-
const fromInput = input?.apyMethod?.trim();
|
|
4831
|
-
if (fromInput) return fromInput;
|
|
4832
|
-
const metadataApyMethod = this?.metadata?.apyMethodology;
|
|
4833
|
-
if (typeof metadataApyMethod === "string" && metadataApyMethod.trim().length > 0) {
|
|
4834
|
-
return metadataApyMethod;
|
|
4835
|
-
}
|
|
4836
|
-
return void 0;
|
|
4837
|
-
}
|
|
4838
|
-
normalizeApyDisplayValue(apy) {
|
|
4839
|
-
if (typeof apy === "number") {
|
|
4840
|
-
return this.formatPercentForCard(apy);
|
|
4841
|
-
}
|
|
4842
|
-
if (typeof apy === "string") {
|
|
4843
|
-
return apy.trim().length > 0 ? apy : "N/A";
|
|
4844
|
-
}
|
|
4845
|
-
if (apy && typeof apy === "object" && "net" in apy) {
|
|
4846
|
-
return this.formatPercentForCard(Number(apy.net));
|
|
4847
|
-
}
|
|
4848
|
-
return "N/A";
|
|
4849
|
-
}
|
|
4850
|
-
async resolveApyValueForCard(input) {
|
|
4851
|
-
if (input && input.apy !== void 0 && input.apy !== null) {
|
|
4852
|
-
return this.normalizeApyDisplayValue(input.apy);
|
|
4853
|
-
}
|
|
4854
|
-
try {
|
|
4855
|
-
const netApy = await this.netAPY();
|
|
4856
|
-
return this.normalizeApyDisplayValue(netApy);
|
|
4857
|
-
} catch {
|
|
4858
|
-
return "N/A";
|
|
4859
|
-
}
|
|
4860
|
-
}
|
|
4861
|
-
async createApyCard(input) {
|
|
4862
|
-
const apyMethod = this.resolveApyMethod(input);
|
|
4863
|
-
return {
|
|
4864
|
-
title: "APY",
|
|
4865
|
-
value: await this.resolveApyValueForCard(input),
|
|
4866
|
-
tooltip: apyMethod,
|
|
4867
|
-
kind: "apy",
|
|
4868
|
-
apyMethod
|
|
4869
|
-
};
|
|
4870
|
-
}
|
|
4871
4829
|
formatUSDForCard(value) {
|
|
4872
4830
|
if (!Number.isFinite(value)) return "$0.00";
|
|
4873
4831
|
return new Intl.NumberFormat("en-US", {
|
|
@@ -16707,7 +16665,6 @@ var EkuboCLVault = class _EkuboCLVault extends BaseStrategy {
|
|
|
16707
16665
|
subValueColor: "default"
|
|
16708
16666
|
}
|
|
16709
16667
|
];
|
|
16710
|
-
cards.push(await this.createApyCard(input));
|
|
16711
16668
|
return cards;
|
|
16712
16669
|
}
|
|
16713
16670
|
async feeBasedAPY(timeperiod = "24h") {
|
|
@@ -28558,8 +28515,8 @@ var SenseiVault = class _SenseiVault extends BaseStrategy {
|
|
|
28558
28515
|
async getUserRealizedAPY(blockIdentifier = "latest", sinceBlocks = 6e5) {
|
|
28559
28516
|
throw new Error("getUserRealizedAPY not implemented yet for Sensei strategy");
|
|
28560
28517
|
}
|
|
28561
|
-
async getUserPositionCards(
|
|
28562
|
-
return [
|
|
28518
|
+
async getUserPositionCards(_input) {
|
|
28519
|
+
return [];
|
|
28563
28520
|
}
|
|
28564
28521
|
};
|
|
28565
28522
|
var senseiDescription = `Deposit your {{token1}} to automatically loop your funds via Endur ({{token2}}) and Vesu to create a delta neutral position. This strategy is designed to maximize your yield on {{token1}}. Your position is automatically adjusted periodically to maintain a healthy health factor. You receive a NFT as representation for your stake on Troves. You can withdraw anytime by redeeming your NFT for {{token1}}.`;
|
|
@@ -28711,7 +28668,7 @@ var SenseiStrategies = [
|
|
|
28711
28668
|
alerts: []
|
|
28712
28669
|
},
|
|
28713
28670
|
usualTimeToEarnings: "2 weeks",
|
|
28714
|
-
usualTimeToEarningsDescription: "Strategy returns depend on LST price on DEXes. Even though the true price of LST on Endur increases continuously, the DEX price may lag sometimes, and historically is seen to rebase at least once every 2
|
|
28671
|
+
usualTimeToEarningsDescription: "Strategy returns depend on LST price on DEXes. Even though the true price of LST on Endur increases continuously, the DEX price may lag sometimes, and historically is seen to rebase at least once every 2 weeks. This is when you realise your earnings.",
|
|
28715
28672
|
points: [{
|
|
28716
28673
|
multiplier: 4,
|
|
28717
28674
|
logo: "https://endur.fi/favicon.ico",
|
|
@@ -29876,8 +29833,10 @@ var YoLoVault = class extends BaseStrategy {
|
|
|
29876
29833
|
// const formattedAmount = amount.dividedBy(10 ** decimals);
|
|
29877
29834
|
// return formattedAmount;
|
|
29878
29835
|
// }
|
|
29879
|
-
async getNormalizedUserInfo(user) {
|
|
29880
|
-
const userInfo = await this.contract.call("get_user_info", [user.address]
|
|
29836
|
+
async getNormalizedUserInfo(user, blockIdentifier = "latest") {
|
|
29837
|
+
const userInfo = await this.contract.call("get_user_info", [user.address], {
|
|
29838
|
+
blockIdentifier
|
|
29839
|
+
});
|
|
29881
29840
|
const {
|
|
29882
29841
|
shares,
|
|
29883
29842
|
base_token_balance,
|
|
@@ -29918,12 +29877,12 @@ var YoLoVault = class extends BaseStrategy {
|
|
|
29918
29877
|
}
|
|
29919
29878
|
return null;
|
|
29920
29879
|
}
|
|
29921
|
-
async getUserTVL(user) {
|
|
29880
|
+
async getUserTVL(user, blockIdentifier = "latest") {
|
|
29922
29881
|
try {
|
|
29923
29882
|
const [{ primaryTokenBalance, claimableSecondaryTokens }, primaryTokenPrice, secondaryTokenPrice] = await Promise.all([
|
|
29924
|
-
this.getNormalizedUserInfo(user),
|
|
29925
|
-
this.pricer.getPrice(this.primaryToken.symbol),
|
|
29926
|
-
this.pricer.getPrice(this.secondaryToken.symbol)
|
|
29883
|
+
this.getNormalizedUserInfo(user, blockIdentifier),
|
|
29884
|
+
this.pricer.getPrice(this.primaryToken.symbol, blockIdentifier),
|
|
29885
|
+
this.pricer.getPrice(this.secondaryToken.symbol, blockIdentifier)
|
|
29927
29886
|
]);
|
|
29928
29887
|
const primaryTokenUsd = primaryTokenBalance.multipliedBy(primaryTokenPrice.price).toNumber();
|
|
29929
29888
|
const secondaryTokenUsd = claimableSecondaryTokens.multipliedBy(secondaryTokenPrice.price);
|
|
@@ -30142,9 +30101,7 @@ var YoLoVault = class extends BaseStrategy {
|
|
|
30142
30101
|
{
|
|
30143
30102
|
title: "Your Holdings",
|
|
30144
30103
|
tooltip: "Combined value of your remaining base token and accumulated secondary token",
|
|
30145
|
-
value: this.formatUSDForCard(userTVL.usdValue)
|
|
30146
|
-
subValue: `${holdingsTitle} + ${earningsTitle}`,
|
|
30147
|
-
subValueColor: "positive"
|
|
30104
|
+
value: this.formatUSDForCard(userTVL.usdValue)
|
|
30148
30105
|
},
|
|
30149
30106
|
{
|
|
30150
30107
|
title: holdingsTitle,
|
|
@@ -30161,7 +30118,6 @@ var YoLoVault = class extends BaseStrategy {
|
|
|
30161
30118
|
subValueColor: "default"
|
|
30162
30119
|
}
|
|
30163
30120
|
];
|
|
30164
|
-
cards.push(await this.createApyCard(input));
|
|
30165
30121
|
return cards;
|
|
30166
30122
|
}
|
|
30167
30123
|
};
|
|
@@ -33104,7 +33060,6 @@ var UniversalStrategy = class _UniversalStrategy extends BaseStrategy {
|
|
|
33104
33060
|
subValue: `\u2248 ${this.formatUSDForCard(lifetimeUsdValue)}`,
|
|
33105
33061
|
subValueColor: this.getSubValueColorFromSignedNumber(lifetimeUsdValue)
|
|
33106
33062
|
});
|
|
33107
|
-
cards.push(await this.createApyCard(input));
|
|
33108
33063
|
return cards;
|
|
33109
33064
|
}
|
|
33110
33065
|
/**
|
|
@@ -34461,7 +34416,7 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
34461
34416
|
}
|
|
34462
34417
|
const unrealizedCard = {
|
|
34463
34418
|
title: "Unrealized Gains",
|
|
34464
|
-
tooltip: "Unrealized gains based on current market prices vs
|
|
34419
|
+
tooltip: "Unrealized gains based on current market prices vs Endur prices. If you withdraw now, you will forgo these gains.",
|
|
34465
34420
|
value: this.formatTokenAmountForCard(amount, unrealizedResult.tokenInfo),
|
|
34466
34421
|
subValue: `\u2248 ${this.formatUSDForCard(usdValue)}`,
|
|
34467
34422
|
subValueColor: this.getSubValueColorFromSignedNumber(usdValue)
|
|
@@ -34477,7 +34432,7 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
34477
34432
|
logger.warn(`${this.getTag()}::getUserPositionCards unrealized gains fallback`, error);
|
|
34478
34433
|
cards.push({
|
|
34479
34434
|
title: "Unrealized Gains",
|
|
34480
|
-
tooltip: "Unrealized gains based on current market prices vs
|
|
34435
|
+
tooltip: "Unrealized gains based on current market prices vs Endur prices. If you withdraw now, you will forgo these gains.",
|
|
34481
34436
|
value: this.formatTokenAmountForCard(
|
|
34482
34437
|
Web3Number.fromWei("0", this.asset().decimals),
|
|
34483
34438
|
this.asset()
|
|
@@ -34493,14 +34448,11 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
34493
34448
|
}
|
|
34494
34449
|
if (this.asset().symbol === "xSTRK") {
|
|
34495
34450
|
const index = cards.findIndex((card) => card.title === "Lifetime Earnings");
|
|
34451
|
+
const originalCard = cards[index];
|
|
34496
34452
|
if (index >= 0) {
|
|
34497
34453
|
cards[index] = {
|
|
34498
|
-
|
|
34499
|
-
tooltip: "Lifetime earnings of the vault. Due to migration of xSTRK Sensei to this vault, any migrated funds are also seen as lifetime earnings. Team is working to fix this soon."
|
|
34500
|
-
value: this.formatTokenAmountForCard(
|
|
34501
|
-
Web3Number.fromWei("0", this.asset().decimals),
|
|
34502
|
-
this.asset()
|
|
34503
|
-
)
|
|
34454
|
+
...originalCard,
|
|
34455
|
+
tooltip: "Lifetime earnings of the vault. Due to migration of xSTRK Sensei to this vault, any migrated funds are also seen as lifetime earnings. Team is working to fix this soon."
|
|
34504
34456
|
};
|
|
34505
34457
|
}
|
|
34506
34458
|
}
|
|
@@ -35618,7 +35570,7 @@ function getStrategySettings(lstSymbol, underlyingSymbol, settings, isPreview =
|
|
|
35618
35570
|
security: HYPER_LST_SECURITY,
|
|
35619
35571
|
redemptionInfo: HYPER_LST_REDEMPTION_INFO,
|
|
35620
35572
|
usualTimeToEarnings: "2 weeks",
|
|
35621
|
-
usualTimeToEarningsDescription: "Strategy returns depend on LST price on DEXes. Even though the true price of LST on Endur increases continuously, the DEX price may lag sometimes, and historically is seen to rebase at least once every 2
|
|
35573
|
+
usualTimeToEarningsDescription: "Strategy returns depend on LST price on DEXes. Even though the true price of LST on Endur increases continuously, the DEX price may lag sometimes, and historically is seen to rebase at least once every 2 weeks. This is when you realise your earnings.",
|
|
35622
35574
|
points: [
|
|
35623
35575
|
{
|
|
35624
35576
|
multiplier: 4,
|
package/package.json
CHANGED
|
@@ -44,8 +44,6 @@ export interface UserPositionCard {
|
|
|
44
44
|
tooltip?: string;
|
|
45
45
|
subValue?: string;
|
|
46
46
|
subValueColor?: UserPositionCardSubValueColor;
|
|
47
|
-
kind?: "metric" | "apy";
|
|
48
|
-
apyMethod?: string;
|
|
49
47
|
}
|
|
50
48
|
|
|
51
49
|
export interface UserPositionCardsInput {
|
|
@@ -53,8 +51,6 @@ export interface UserPositionCardsInput {
|
|
|
53
51
|
investmentFlows?: Array<{ amount: string; type: string; timestamp: number; tx_hash: string }>;
|
|
54
52
|
usualTimeToEarnings?: string | null;
|
|
55
53
|
usualTimeToEarningsDescription?: string | null;
|
|
56
|
-
apy?: number | string | null;
|
|
57
|
-
apyMethod?: string | null;
|
|
58
54
|
}
|
|
59
55
|
|
|
60
56
|
interface CacheData {
|
|
@@ -153,54 +149,6 @@ export class BaseStrategy<
|
|
|
153
149
|
return `${(value * 100).toFixed(2)}%`;
|
|
154
150
|
}
|
|
155
151
|
|
|
156
|
-
protected resolveApyMethod(input?: UserPositionCardsInput): string | undefined {
|
|
157
|
-
const fromInput = input?.apyMethod?.trim();
|
|
158
|
-
if (fromInput) return fromInput;
|
|
159
|
-
const metadataApyMethod = (this as any)?.metadata?.apyMethodology;
|
|
160
|
-
if (typeof metadataApyMethod === "string" && metadataApyMethod.trim().length > 0) {
|
|
161
|
-
return metadataApyMethod;
|
|
162
|
-
}
|
|
163
|
-
return undefined;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
protected normalizeApyDisplayValue(
|
|
167
|
-
apy: number | string | NetAPYDetails | null | undefined
|
|
168
|
-
): string {
|
|
169
|
-
if (typeof apy === "number") {
|
|
170
|
-
return this.formatPercentForCard(apy);
|
|
171
|
-
}
|
|
172
|
-
if (typeof apy === "string") {
|
|
173
|
-
return apy.trim().length > 0 ? apy : "N/A";
|
|
174
|
-
}
|
|
175
|
-
if (apy && typeof apy === "object" && "net" in apy) {
|
|
176
|
-
return this.formatPercentForCard(Number(apy.net));
|
|
177
|
-
}
|
|
178
|
-
return "N/A";
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
protected async resolveApyValueForCard(input?: UserPositionCardsInput): Promise<string> {
|
|
182
|
-
if (input && input.apy !== undefined && input.apy !== null) {
|
|
183
|
-
return this.normalizeApyDisplayValue(input.apy);
|
|
184
|
-
}
|
|
185
|
-
try {
|
|
186
|
-
const netApy = await this.netAPY();
|
|
187
|
-
return this.normalizeApyDisplayValue(netApy as number | string | NetAPYDetails);
|
|
188
|
-
} catch {
|
|
189
|
-
return "N/A";
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
protected async createApyCard(input?: UserPositionCardsInput): Promise<UserPositionCard> {
|
|
194
|
-
const apyMethod = this.resolveApyMethod(input);
|
|
195
|
-
return {
|
|
196
|
-
title: "APY",
|
|
197
|
-
value: await this.resolveApyValueForCard(input),
|
|
198
|
-
tooltip: apyMethod,
|
|
199
|
-
kind: "apy",
|
|
200
|
-
apyMethod,
|
|
201
|
-
};
|
|
202
|
-
}
|
|
203
|
-
|
|
204
152
|
protected formatUSDForCard(value: number): string {
|
|
205
153
|
if (!Number.isFinite(value)) return "$0.00";
|
|
206
154
|
return new Intl.NumberFormat("en-US", {
|
package/src/strategies/sensei.ts
CHANGED
|
@@ -506,8 +506,8 @@ export class SenseiVault extends BaseStrategy<
|
|
|
506
506
|
*/
|
|
507
507
|
}
|
|
508
508
|
|
|
509
|
-
async getUserPositionCards(
|
|
510
|
-
return [
|
|
509
|
+
async getUserPositionCards(_input: UserPositionCardsInput): Promise<UserPositionCard[]> {
|
|
510
|
+
return [];
|
|
511
511
|
}
|
|
512
512
|
}
|
|
513
513
|
|
|
@@ -664,7 +664,7 @@ export const SenseiStrategies: IStrategyMetadata<SenseiVaultSettings>[] =
|
|
|
664
664
|
alerts: [],
|
|
665
665
|
},
|
|
666
666
|
usualTimeToEarnings: "2 weeks",
|
|
667
|
-
usualTimeToEarningsDescription: "Strategy returns depend on LST price on DEXes. Even though the true price of LST on Endur increases continuously, the DEX price may lag sometimes, and historically is seen to rebase at least once every 2
|
|
667
|
+
usualTimeToEarningsDescription: "Strategy returns depend on LST price on DEXes. Even though the true price of LST on Endur increases continuously, the DEX price may lag sometimes, and historically is seen to rebase at least once every 2 weeks. This is when you realise your earnings.",
|
|
668
668
|
points: [{
|
|
669
669
|
multiplier: 4,
|
|
670
670
|
logo: 'https://endur.fi/favicon.ico',
|
|
@@ -695,7 +695,7 @@ export class UniversalLstMultiplierStrategy extends UniversalStrategy<HyperLSTSt
|
|
|
695
695
|
|
|
696
696
|
const unrealizedCard = {
|
|
697
697
|
title: "Unrealized Gains",
|
|
698
|
-
tooltip: "Unrealized gains based on current market prices vs
|
|
698
|
+
tooltip: "Unrealized gains based on current market prices vs Endur prices. If you withdraw now, you will forgo these gains.",
|
|
699
699
|
value: this.formatTokenAmountForCard(amount, unrealizedResult.tokenInfo),
|
|
700
700
|
subValue: `≈ ${this.formatUSDForCard(usdValue)}`,
|
|
701
701
|
subValueColor: this.getSubValueColorFromSignedNumber(usdValue),
|
|
@@ -716,7 +716,7 @@ export class UniversalLstMultiplierStrategy extends UniversalStrategy<HyperLSTSt
|
|
|
716
716
|
logger.warn(`${this.getTag()}::getUserPositionCards unrealized gains fallback`, error);
|
|
717
717
|
cards.push({
|
|
718
718
|
title: "Unrealized Gains",
|
|
719
|
-
tooltip: "Unrealized gains based on current market prices vs
|
|
719
|
+
tooltip: "Unrealized gains based on current market prices vs Endur prices. If you withdraw now, you will forgo these gains.",
|
|
720
720
|
value: this.formatTokenAmountForCard(
|
|
721
721
|
Web3Number.fromWei("0", this.asset().decimals),
|
|
722
722
|
this.asset()
|
|
@@ -734,14 +734,11 @@ export class UniversalLstMultiplierStrategy extends UniversalStrategy<HyperLSTSt
|
|
|
734
734
|
// if xstrk vault, update lifetype earnings to specific title.
|
|
735
735
|
if (this.asset().symbol === "xSTRK") {
|
|
736
736
|
const index = cards.findIndex((card) => card.title === "Lifetime Earnings");
|
|
737
|
+
const originalCard = cards[index];
|
|
737
738
|
if (index >= 0) {
|
|
738
739
|
cards[index] = {
|
|
739
|
-
|
|
740
|
+
...originalCard,
|
|
740
741
|
tooltip: "Lifetime earnings of the vault. Due to migration of xSTRK Sensei to this vault, any migrated funds are also seen as lifetime earnings. Team is working to fix this soon.",
|
|
741
|
-
value: this.formatTokenAmountForCard(
|
|
742
|
-
Web3Number.fromWei("0", this.asset().decimals),
|
|
743
|
-
this.asset()
|
|
744
|
-
),
|
|
745
742
|
};
|
|
746
743
|
}
|
|
747
744
|
}
|
|
@@ -2190,7 +2187,7 @@ function getStrategySettings(
|
|
|
2190
2187
|
redemptionInfo: HYPER_LST_REDEMPTION_INFO,
|
|
2191
2188
|
usualTimeToEarnings: "2 weeks",
|
|
2192
2189
|
usualTimeToEarningsDescription:
|
|
2193
|
-
"Strategy returns depend on LST price on DEXes. Even though the true price of LST on Endur increases continuously, the DEX price may lag sometimes, and historically is seen to rebase at least once every 2
|
|
2190
|
+
"Strategy returns depend on LST price on DEXes. Even though the true price of LST on Endur increases continuously, the DEX price may lag sometimes, and historically is seen to rebase at least once every 2 weeks. This is when you realise your earnings.",
|
|
2194
2191
|
points: [
|
|
2195
2192
|
{
|
|
2196
2193
|
multiplier: 4,
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
BaseStrategy,
|
|
26
26
|
DualTokenInfo,
|
|
27
27
|
} from "./base-strategy";
|
|
28
|
-
import { uint256 } from "starknet";
|
|
28
|
+
import { BlockIdentifier, uint256 } from "starknet";
|
|
29
29
|
import { ContractAddr } from "@/dataTypes";
|
|
30
30
|
import { Web3Number } from "@/dataTypes";
|
|
31
31
|
import { DualActionAmount } from "./base-strategy";
|
|
@@ -129,13 +129,15 @@ export class YoLoVault extends BaseStrategy<DualTokenInfo, SingleActionAmount, D
|
|
|
129
129
|
// return formattedAmount;
|
|
130
130
|
// }
|
|
131
131
|
|
|
132
|
-
private async getNormalizedUserInfo(user: ContractAddr): Promise<{
|
|
132
|
+
private async getNormalizedUserInfo(user: ContractAddr, blockIdentifier: BlockIdentifier = "latest"): Promise<{
|
|
133
133
|
shares: Web3Number;
|
|
134
134
|
primaryTokenBalance: Web3Number;
|
|
135
135
|
secondaryTokenBalance: Web3Number;
|
|
136
136
|
claimableSecondaryTokens: Web3Number;
|
|
137
137
|
}> {
|
|
138
|
-
const userInfo = await this.contract.call("get_user_info", [user.address]
|
|
138
|
+
const userInfo = await this.contract.call("get_user_info", [user.address], {
|
|
139
|
+
blockIdentifier,
|
|
140
|
+
});
|
|
139
141
|
const {
|
|
140
142
|
shares,
|
|
141
143
|
base_token_balance,
|
|
@@ -199,12 +201,12 @@ export class YoLoVault extends BaseStrategy<DualTokenInfo, SingleActionAmount, D
|
|
|
199
201
|
return null;
|
|
200
202
|
}
|
|
201
203
|
|
|
202
|
-
async getUserTVL(user: ContractAddr): Promise<DualTokenInfo> {
|
|
204
|
+
async getUserTVL(user: ContractAddr, blockIdentifier: BlockIdentifier = "latest"): Promise<DualTokenInfo> {
|
|
203
205
|
try {
|
|
204
206
|
const [{ primaryTokenBalance, claimableSecondaryTokens }, primaryTokenPrice, secondaryTokenPrice] = await Promise.all([
|
|
205
|
-
this.getNormalizedUserInfo(user),
|
|
206
|
-
this.pricer.getPrice(this.primaryToken.symbol),
|
|
207
|
-
this.pricer.getPrice(this.secondaryToken.symbol),
|
|
207
|
+
this.getNormalizedUserInfo(user, blockIdentifier),
|
|
208
|
+
this.pricer.getPrice(this.primaryToken.symbol, blockIdentifier),
|
|
209
|
+
this.pricer.getPrice(this.secondaryToken.symbol, blockIdentifier),
|
|
208
210
|
]);
|
|
209
211
|
|
|
210
212
|
// ! todo u can simply do primaryTokenAmount.multipliedBy(primaryTokenPrice.price).toNumber()
|
|
@@ -460,8 +462,6 @@ export class YoLoVault extends BaseStrategy<DualTokenInfo, SingleActionAmount, D
|
|
|
460
462
|
title: "Your Holdings",
|
|
461
463
|
tooltip: "Combined value of your remaining base token and accumulated secondary token",
|
|
462
464
|
value: this.formatUSDForCard(userTVL.usdValue),
|
|
463
|
-
subValue: `${holdingsTitle} + ${earningsTitle}`,
|
|
464
|
-
subValueColor: "positive",
|
|
465
465
|
},
|
|
466
466
|
{
|
|
467
467
|
title: holdingsTitle,
|
|
@@ -478,7 +478,6 @@ export class YoLoVault extends BaseStrategy<DualTokenInfo, SingleActionAmount, D
|
|
|
478
478
|
subValueColor: "default",
|
|
479
479
|
},
|
|
480
480
|
];
|
|
481
|
-
cards.push(await this.createApyCard(input));
|
|
482
481
|
return cards;
|
|
483
482
|
}
|
|
484
483
|
}
|