@strkfarm/sdk 2.0.0-staging.70 → 2.0.0-staging.71
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 +47 -25
- package/dist/index.browser.mjs +47 -25
- package/dist/index.d.ts +8 -2
- package/dist/index.js +47 -25
- package/dist/index.mjs +47 -25
- package/package.json +1 -1
- package/src/global.ts +10 -9
- package/src/interfaces/common.tsx +8 -0
- package/src/modules/pricer.ts +27 -15
- package/src/strategies/ekubo-cl-vault.tsx +3 -0
- package/src/strategies/universal-lst-muliplier-strategy.tsx +3 -0
- package/src/strategies/universal-strategy.tsx +3 -0
- package/src/strategies/yoloVault.ts +3 -0
|
@@ -72931,7 +72931,8 @@ ${JSON.stringify(data, null, 2)}`;
|
|
|
72931
72931
|
decimals: 18,
|
|
72932
72932
|
coingeckId: "starknet",
|
|
72933
72933
|
displayDecimals: 2,
|
|
72934
|
-
priceCheckAmount:
|
|
72934
|
+
priceCheckAmount: 5e3,
|
|
72935
|
+
priceMethod: "Avnu"
|
|
72935
72936
|
}, {
|
|
72936
72937
|
name: "xSTRK",
|
|
72937
72938
|
symbol: "xSTRK",
|
|
@@ -72939,8 +72940,9 @@ ${JSON.stringify(data, null, 2)}`;
|
|
|
72939
72940
|
address: ContractAddr.from("0x028d709c875c0ceac3dce7065bec5328186dc89fe254527084d1689910954b0a"),
|
|
72940
72941
|
decimals: 18,
|
|
72941
72942
|
coingeckId: void 0,
|
|
72942
|
-
priceCheckAmount:
|
|
72943
|
-
displayDecimals: 2
|
|
72943
|
+
priceCheckAmount: 5e3,
|
|
72944
|
+
displayDecimals: 2,
|
|
72945
|
+
priceMethod: "Avnu"
|
|
72944
72946
|
}, {
|
|
72945
72947
|
name: "ETH",
|
|
72946
72948
|
symbol: "ETH",
|
|
@@ -73027,9 +73029,9 @@ ${JSON.stringify(data, null, 2)}`;
|
|
|
73027
73029
|
decimals: 8,
|
|
73028
73030
|
coingeckId: void 0,
|
|
73029
73031
|
displayDecimals: 6,
|
|
73030
|
-
|
|
73031
|
-
priceCheckAmount: 1e-3
|
|
73032
|
+
priceCheckAmount: 1e-3,
|
|
73032
73033
|
// 112000 * 0.0001 = $110.2
|
|
73034
|
+
priceMethod: "Avnu"
|
|
73033
73035
|
}, {
|
|
73034
73036
|
name: "xsBTC",
|
|
73035
73037
|
symbol: "xsBTC",
|
|
@@ -73038,11 +73040,10 @@ ${JSON.stringify(data, null, 2)}`;
|
|
|
73038
73040
|
decimals: 18,
|
|
73039
73041
|
coingeckId: void 0,
|
|
73040
73042
|
displayDecimals: 6,
|
|
73041
|
-
|
|
73042
|
-
priceCheckAmount: 1e-4
|
|
73043
|
+
priceCheckAmount: 1e-4,
|
|
73043
73044
|
// 112000 * 0.0001 = $11.2
|
|
73045
|
+
priceMethod: "Avnu"
|
|
73044
73046
|
}, {
|
|
73045
|
-
// todo upgrade proxy tokens once feeds are available
|
|
73046
73047
|
name: "xtBTC",
|
|
73047
73048
|
symbol: "xtBTC",
|
|
73048
73049
|
logo: "https://assets.strkfarm.com/integrations/tokens/xtbtc.svg",
|
|
@@ -73052,7 +73053,7 @@ ${JSON.stringify(data, null, 2)}`;
|
|
|
73052
73053
|
displayDecimals: 6,
|
|
73053
73054
|
priceCheckAmount: 1e-3,
|
|
73054
73055
|
// 112000 * 0.0001 = $110.2
|
|
73055
|
-
|
|
73056
|
+
priceMethod: "Avnu"
|
|
73056
73057
|
}, {
|
|
73057
73058
|
name: "xLBTC",
|
|
73058
73059
|
symbol: "xLBTC",
|
|
@@ -73061,9 +73062,9 @@ ${JSON.stringify(data, null, 2)}`;
|
|
|
73061
73062
|
decimals: 8,
|
|
73062
73063
|
coingeckId: void 0,
|
|
73063
73064
|
displayDecimals: 6,
|
|
73064
|
-
|
|
73065
|
-
priceCheckAmount: 1e-4
|
|
73065
|
+
priceCheckAmount: 1e-4,
|
|
73066
73066
|
// 112000 * 0.0001 = $11.2
|
|
73067
|
+
priceMethod: "Avnu"
|
|
73067
73068
|
}, {
|
|
73068
73069
|
name: "mRe7BTC",
|
|
73069
73070
|
symbol: "mRe7BTC",
|
|
@@ -73126,7 +73127,7 @@ ${JSON.stringify(data, null, 2)}`;
|
|
|
73126
73127
|
displayDecimals: 6,
|
|
73127
73128
|
priceCheckAmount: 1e-3,
|
|
73128
73129
|
// 112000 * 0.0001 = $110.2
|
|
73129
|
-
|
|
73130
|
+
priceMethod: "Avnu"
|
|
73130
73131
|
}, {
|
|
73131
73132
|
name: "xstrkBTC",
|
|
73132
73133
|
symbol: "xstrkBTC",
|
|
@@ -73136,7 +73137,7 @@ ${JSON.stringify(data, null, 2)}`;
|
|
|
73136
73137
|
coingeckId: void 0,
|
|
73137
73138
|
displayDecimals: 6,
|
|
73138
73139
|
priceCheckAmount: 1e-3,
|
|
73139
|
-
|
|
73140
|
+
priceMethod: "Avnu"
|
|
73140
73141
|
}];
|
|
73141
73142
|
var tokens = defaultTokens;
|
|
73142
73143
|
var _Global = class _Global {
|
|
@@ -76088,21 +76089,14 @@ ${JSON.stringify(data, null, 2)}`;
|
|
|
76088
76089
|
}
|
|
76089
76090
|
}
|
|
76090
76091
|
async _getPrice(token) {
|
|
76091
|
-
const
|
|
76092
|
-
|
|
76093
|
-
logger2.verbose(`Fetching price of ${token.symbol} using pinned ${pinned}`);
|
|
76094
|
-
try {
|
|
76095
|
-
return await this._tryPriceMethod(token, pinned);
|
|
76096
|
-
} catch (error2) {
|
|
76097
|
-
console.warn(`${pinned}: pinned price failed [${token.symbol}]: `, error2.message);
|
|
76098
|
-
delete this.methodToUse[token.symbol];
|
|
76099
|
-
}
|
|
76100
|
-
}
|
|
76101
|
-
for (const method of PRICE_METHOD_PRIORITY) {
|
|
76092
|
+
const methodsToTry = this._getMethodsToTry(token);
|
|
76093
|
+
for (const method of methodsToTry) {
|
|
76102
76094
|
logger2.verbose(`Fetching price of ${token.symbol} using ${method}`);
|
|
76103
76095
|
try {
|
|
76104
76096
|
const result2 = await this._tryPriceMethod(token, method);
|
|
76105
|
-
|
|
76097
|
+
if (!token.priceMethod) {
|
|
76098
|
+
this.methodToUse[token.symbol] = method;
|
|
76099
|
+
}
|
|
76106
76100
|
return result2;
|
|
76107
76101
|
} catch (error2) {
|
|
76108
76102
|
console.warn(`${method}: price err [${token.symbol}]: `, error2.message);
|
|
@@ -76110,6 +76104,22 @@ ${JSON.stringify(data, null, 2)}`;
|
|
|
76110
76104
|
}
|
|
76111
76105
|
throw new FatalError(`Price not found for ${token.symbol}`);
|
|
76112
76106
|
}
|
|
76107
|
+
_getMethodsToTry(token) {
|
|
76108
|
+
const methods2 = [];
|
|
76109
|
+
if (token.priceMethod) {
|
|
76110
|
+
methods2.push(token.priceMethod);
|
|
76111
|
+
}
|
|
76112
|
+
const pinned = this.methodToUse[token.symbol];
|
|
76113
|
+
if (pinned && pinned !== token.priceMethod) {
|
|
76114
|
+
methods2.push(pinned);
|
|
76115
|
+
}
|
|
76116
|
+
for (const method of PRICE_METHOD_PRIORITY) {
|
|
76117
|
+
if (!methods2.includes(method)) {
|
|
76118
|
+
methods2.push(method);
|
|
76119
|
+
}
|
|
76120
|
+
}
|
|
76121
|
+
return methods2;
|
|
76122
|
+
}
|
|
76113
76123
|
async _tryPriceMethod(token, method) {
|
|
76114
76124
|
switch (method) {
|
|
76115
76125
|
case "AvnuApi":
|
|
@@ -105604,6 +105614,9 @@ spurious results.`);
|
|
|
105604
105614
|
},
|
|
105605
105615
|
apyMethodology: "APY based on 30-day historical performance, including fees and rewards.",
|
|
105606
105616
|
realizedApyMethodology: "The realizedAPY is based on past 14 days performance by the vault",
|
|
105617
|
+
feeBps: {
|
|
105618
|
+
performanceFeeBps: 1e3
|
|
105619
|
+
},
|
|
105607
105620
|
additionalInfo: {
|
|
105608
105621
|
newBounds: {
|
|
105609
105622
|
lower: -1,
|
|
@@ -117046,6 +117059,9 @@ spurious results.`);
|
|
|
117046
117059
|
notARisks: getNoRiskTags(yoloRiskFactors)
|
|
117047
117060
|
},
|
|
117048
117061
|
apyMethodology: "Not a primary yield strategy. Funds earn yield when idle, but the main return comes from BTC price appreciation and your conviction to hold. This vault simply helps you accumulate more BTC.",
|
|
117062
|
+
feeBps: {
|
|
117063
|
+
performanceFeeBps: 1e3
|
|
117064
|
+
},
|
|
117049
117065
|
additionalInfo: {
|
|
117050
117066
|
mainToken: yoloConfig.mainToken,
|
|
117051
117067
|
secondaryToken: yoloConfig.secondaryToken,
|
|
@@ -120671,6 +120687,9 @@ spurious results.`);
|
|
|
120671
120687
|
auditUrl: AUDIT_URL3,
|
|
120672
120688
|
protocols: [Protocols.VESU],
|
|
120673
120689
|
realizedApyMethodology: "The realizedAPY is based on past 14 days performance by the vault",
|
|
120690
|
+
feeBps: {
|
|
120691
|
+
performanceFeeBps: 1e3
|
|
120692
|
+
},
|
|
120674
120693
|
curator: UnwrapLabsCurator,
|
|
120675
120694
|
settings: createUniversalSettings(params.tokenSymbol),
|
|
120676
120695
|
contractDetails: getContractDetails(params.vaultSettings),
|
|
@@ -122386,6 +122405,9 @@ spurious results.`);
|
|
|
122386
122405
|
isPreview,
|
|
122387
122406
|
apyMethodology: "Current annualized APY in terms of base asset of the LST. There is no additional fee taken by Troves on LST APY. We charge a 10% performance fee on the additional gain which is already accounted in the APY shown.",
|
|
122388
122407
|
realizedApyMethodology: "The realizedAPY is based on past 14 days performance by the vault",
|
|
122408
|
+
feeBps: {
|
|
122409
|
+
performanceFeeBps: 1e3
|
|
122410
|
+
},
|
|
122389
122411
|
tags: lstSymbol.includes("BTC") ? ["BTC" /* BTC */, "Maxx" /* LEVERED */] : ["Maxx" /* LEVERED */],
|
|
122390
122412
|
security: HYPER_LST_SECURITY,
|
|
122391
122413
|
redemptionInfo: HYPER_LST_REDEMPTION_INFO,
|
package/dist/index.browser.mjs
CHANGED
|
@@ -282,7 +282,8 @@ var defaultTokens = [{
|
|
|
282
282
|
decimals: 18,
|
|
283
283
|
coingeckId: "starknet",
|
|
284
284
|
displayDecimals: 2,
|
|
285
|
-
priceCheckAmount:
|
|
285
|
+
priceCheckAmount: 5e3,
|
|
286
|
+
priceMethod: "Avnu"
|
|
286
287
|
}, {
|
|
287
288
|
name: "xSTRK",
|
|
288
289
|
symbol: "xSTRK",
|
|
@@ -290,8 +291,9 @@ var defaultTokens = [{
|
|
|
290
291
|
address: ContractAddr.from("0x028d709c875c0ceac3dce7065bec5328186dc89fe254527084d1689910954b0a"),
|
|
291
292
|
decimals: 18,
|
|
292
293
|
coingeckId: void 0,
|
|
293
|
-
priceCheckAmount:
|
|
294
|
-
displayDecimals: 2
|
|
294
|
+
priceCheckAmount: 5e3,
|
|
295
|
+
displayDecimals: 2,
|
|
296
|
+
priceMethod: "Avnu"
|
|
295
297
|
}, {
|
|
296
298
|
name: "ETH",
|
|
297
299
|
symbol: "ETH",
|
|
@@ -378,9 +380,9 @@ var defaultTokens = [{
|
|
|
378
380
|
decimals: 8,
|
|
379
381
|
coingeckId: void 0,
|
|
380
382
|
displayDecimals: 6,
|
|
381
|
-
|
|
382
|
-
priceCheckAmount: 1e-3
|
|
383
|
+
priceCheckAmount: 1e-3,
|
|
383
384
|
// 112000 * 0.0001 = $110.2
|
|
385
|
+
priceMethod: "Avnu"
|
|
384
386
|
}, {
|
|
385
387
|
name: "xsBTC",
|
|
386
388
|
symbol: "xsBTC",
|
|
@@ -389,11 +391,10 @@ var defaultTokens = [{
|
|
|
389
391
|
decimals: 18,
|
|
390
392
|
coingeckId: void 0,
|
|
391
393
|
displayDecimals: 6,
|
|
392
|
-
|
|
393
|
-
priceCheckAmount: 1e-4
|
|
394
|
+
priceCheckAmount: 1e-4,
|
|
394
395
|
// 112000 * 0.0001 = $11.2
|
|
396
|
+
priceMethod: "Avnu"
|
|
395
397
|
}, {
|
|
396
|
-
// todo upgrade proxy tokens once feeds are available
|
|
397
398
|
name: "xtBTC",
|
|
398
399
|
symbol: "xtBTC",
|
|
399
400
|
logo: "https://assets.strkfarm.com/integrations/tokens/xtbtc.svg",
|
|
@@ -403,7 +404,7 @@ var defaultTokens = [{
|
|
|
403
404
|
displayDecimals: 6,
|
|
404
405
|
priceCheckAmount: 1e-3,
|
|
405
406
|
// 112000 * 0.0001 = $110.2
|
|
406
|
-
|
|
407
|
+
priceMethod: "Avnu"
|
|
407
408
|
}, {
|
|
408
409
|
name: "xLBTC",
|
|
409
410
|
symbol: "xLBTC",
|
|
@@ -412,9 +413,9 @@ var defaultTokens = [{
|
|
|
412
413
|
decimals: 8,
|
|
413
414
|
coingeckId: void 0,
|
|
414
415
|
displayDecimals: 6,
|
|
415
|
-
|
|
416
|
-
priceCheckAmount: 1e-4
|
|
416
|
+
priceCheckAmount: 1e-4,
|
|
417
417
|
// 112000 * 0.0001 = $11.2
|
|
418
|
+
priceMethod: "Avnu"
|
|
418
419
|
}, {
|
|
419
420
|
name: "mRe7BTC",
|
|
420
421
|
symbol: "mRe7BTC",
|
|
@@ -477,7 +478,7 @@ var defaultTokens = [{
|
|
|
477
478
|
displayDecimals: 6,
|
|
478
479
|
priceCheckAmount: 1e-3,
|
|
479
480
|
// 112000 * 0.0001 = $110.2
|
|
480
|
-
|
|
481
|
+
priceMethod: "Avnu"
|
|
481
482
|
}, {
|
|
482
483
|
name: "xstrkBTC",
|
|
483
484
|
symbol: "xstrkBTC",
|
|
@@ -487,7 +488,7 @@ var defaultTokens = [{
|
|
|
487
488
|
coingeckId: void 0,
|
|
488
489
|
displayDecimals: 6,
|
|
489
490
|
priceCheckAmount: 1e-3,
|
|
490
|
-
|
|
491
|
+
priceMethod: "Avnu"
|
|
491
492
|
}];
|
|
492
493
|
var tokens = defaultTokens;
|
|
493
494
|
var _Global = class _Global {
|
|
@@ -971,21 +972,14 @@ var Pricer = class extends PricerBase {
|
|
|
971
972
|
}
|
|
972
973
|
}
|
|
973
974
|
async _getPrice(token) {
|
|
974
|
-
const
|
|
975
|
-
|
|
976
|
-
logger.verbose(`Fetching price of ${token.symbol} using pinned ${pinned}`);
|
|
977
|
-
try {
|
|
978
|
-
return await this._tryPriceMethod(token, pinned);
|
|
979
|
-
} catch (error) {
|
|
980
|
-
console.warn(`${pinned}: pinned price failed [${token.symbol}]: `, error.message);
|
|
981
|
-
delete this.methodToUse[token.symbol];
|
|
982
|
-
}
|
|
983
|
-
}
|
|
984
|
-
for (const method of PRICE_METHOD_PRIORITY) {
|
|
975
|
+
const methodsToTry = this._getMethodsToTry(token);
|
|
976
|
+
for (const method of methodsToTry) {
|
|
985
977
|
logger.verbose(`Fetching price of ${token.symbol} using ${method}`);
|
|
986
978
|
try {
|
|
987
979
|
const result = await this._tryPriceMethod(token, method);
|
|
988
|
-
|
|
980
|
+
if (!token.priceMethod) {
|
|
981
|
+
this.methodToUse[token.symbol] = method;
|
|
982
|
+
}
|
|
989
983
|
return result;
|
|
990
984
|
} catch (error) {
|
|
991
985
|
console.warn(`${method}: price err [${token.symbol}]: `, error.message);
|
|
@@ -993,6 +987,22 @@ var Pricer = class extends PricerBase {
|
|
|
993
987
|
}
|
|
994
988
|
throw new FatalError(`Price not found for ${token.symbol}`);
|
|
995
989
|
}
|
|
990
|
+
_getMethodsToTry(token) {
|
|
991
|
+
const methods = [];
|
|
992
|
+
if (token.priceMethod) {
|
|
993
|
+
methods.push(token.priceMethod);
|
|
994
|
+
}
|
|
995
|
+
const pinned = this.methodToUse[token.symbol];
|
|
996
|
+
if (pinned && pinned !== token.priceMethod) {
|
|
997
|
+
methods.push(pinned);
|
|
998
|
+
}
|
|
999
|
+
for (const method of PRICE_METHOD_PRIORITY) {
|
|
1000
|
+
if (!methods.includes(method)) {
|
|
1001
|
+
methods.push(method);
|
|
1002
|
+
}
|
|
1003
|
+
}
|
|
1004
|
+
return methods;
|
|
1005
|
+
}
|
|
996
1006
|
async _tryPriceMethod(token, method) {
|
|
997
1007
|
switch (method) {
|
|
998
1008
|
case "AvnuApi":
|
|
@@ -18193,6 +18203,9 @@ var xSTRKSTRK = {
|
|
|
18193
18203
|
},
|
|
18194
18204
|
apyMethodology: "APY based on 30-day historical performance, including fees and rewards.",
|
|
18195
18205
|
realizedApyMethodology: "The realizedAPY is based on past 14 days performance by the vault",
|
|
18206
|
+
feeBps: {
|
|
18207
|
+
performanceFeeBps: 1e3
|
|
18208
|
+
},
|
|
18196
18209
|
additionalInfo: {
|
|
18197
18210
|
newBounds: {
|
|
18198
18211
|
lower: -1,
|
|
@@ -29644,6 +29657,9 @@ var YoloVaultStrategies = yoloVaultsConfig.map((yoloConfig) => {
|
|
|
29644
29657
|
notARisks: getNoRiskTags(yoloRiskFactors)
|
|
29645
29658
|
},
|
|
29646
29659
|
apyMethodology: "Not a primary yield strategy. Funds earn yield when idle, but the main return comes from BTC price appreciation and your conviction to hold. This vault simply helps you accumulate more BTC.",
|
|
29660
|
+
feeBps: {
|
|
29661
|
+
performanceFeeBps: 1e3
|
|
29662
|
+
},
|
|
29647
29663
|
additionalInfo: {
|
|
29648
29664
|
mainToken: yoloConfig.mainToken,
|
|
29649
29665
|
secondaryToken: yoloConfig.secondaryToken,
|
|
@@ -33273,6 +33289,9 @@ var createUniversalStrategy = (params) => {
|
|
|
33273
33289
|
auditUrl: AUDIT_URL3,
|
|
33274
33290
|
protocols: [Protocols.VESU],
|
|
33275
33291
|
realizedApyMethodology: "The realizedAPY is based on past 14 days performance by the vault",
|
|
33292
|
+
feeBps: {
|
|
33293
|
+
performanceFeeBps: 1e3
|
|
33294
|
+
},
|
|
33276
33295
|
curator: UnwrapLabsCurator,
|
|
33277
33296
|
settings: createUniversalSettings(params.tokenSymbol),
|
|
33278
33297
|
contractDetails: getContractDetails(params.vaultSettings),
|
|
@@ -34991,6 +35010,9 @@ function getStrategySettings(lstSymbol, underlyingSymbol, settings, isPreview =
|
|
|
34991
35010
|
isPreview,
|
|
34992
35011
|
apyMethodology: "Current annualized APY in terms of base asset of the LST. There is no additional fee taken by Troves on LST APY. We charge a 10% performance fee on the additional gain which is already accounted in the APY shown.",
|
|
34993
35012
|
realizedApyMethodology: "The realizedAPY is based on past 14 days performance by the vault",
|
|
35013
|
+
feeBps: {
|
|
35014
|
+
performanceFeeBps: 1e3
|
|
35015
|
+
},
|
|
34994
35016
|
tags: lstSymbol.includes("BTC") ? ["BTC" /* BTC */, "Maxx" /* LEVERED */] : ["Maxx" /* LEVERED */],
|
|
34995
35017
|
security: HYPER_LST_SECURITY,
|
|
34996
35018
|
redemptionInfo: HYPER_LST_REDEMPTION_INFO,
|
package/dist/index.d.ts
CHANGED
|
@@ -99,6 +99,7 @@ interface RiskFactor {
|
|
|
99
99
|
weight: number;
|
|
100
100
|
reason?: string;
|
|
101
101
|
}
|
|
102
|
+
type PriceMethod = 'AvnuApi' | 'Coinbase' | 'Coinmarketcap' | 'Ekubo' | 'Avnu';
|
|
102
103
|
interface TokenInfo {
|
|
103
104
|
name: string;
|
|
104
105
|
symbol: string;
|
|
@@ -109,6 +110,7 @@ interface TokenInfo {
|
|
|
109
110
|
displayDecimals: number;
|
|
110
111
|
priceProxySymbol?: string;
|
|
111
112
|
priceCheckAmount?: number;
|
|
113
|
+
priceMethod?: PriceMethod;
|
|
112
114
|
dontPrice?: boolean;
|
|
113
115
|
}
|
|
114
116
|
declare enum Network {
|
|
@@ -223,6 +225,9 @@ interface StrategyApyHistoryUIConfig {
|
|
|
223
225
|
showApyHistory?: boolean;
|
|
224
226
|
noApyHistoryMessage?: string;
|
|
225
227
|
}
|
|
228
|
+
interface FeeBps {
|
|
229
|
+
performanceFeeBps: number;
|
|
230
|
+
}
|
|
226
231
|
/**
|
|
227
232
|
* @property risk.riskFactor.factor - The risk factors that are considered for the strategy.
|
|
228
233
|
* @property risk.riskFactor.factor - The value of the risk factor from 0 to 10, 0 being the lowest and 10 being the highest.
|
|
@@ -263,6 +268,7 @@ interface IStrategyMetadata<T> {
|
|
|
263
268
|
};
|
|
264
269
|
apyMethodology?: string;
|
|
265
270
|
realizedApyMethodology?: string;
|
|
271
|
+
feeBps?: FeeBps;
|
|
266
272
|
additionalInfo: T;
|
|
267
273
|
contractDetails: {
|
|
268
274
|
address: ContractAddr;
|
|
@@ -452,7 +458,6 @@ interface PriceInfo {
|
|
|
452
458
|
price: number;
|
|
453
459
|
timestamp: Date;
|
|
454
460
|
}
|
|
455
|
-
type PriceMethod = 'AvnuApi' | 'Coinbase' | 'Coinmarketcap' | 'Ekubo' | 'Avnu';
|
|
456
461
|
declare class Pricer extends PricerBase {
|
|
457
462
|
protected prices: {
|
|
458
463
|
[key: string]: PriceInfo;
|
|
@@ -477,6 +482,7 @@ declare class Pricer extends PricerBase {
|
|
|
477
482
|
getPrice(tokenSymbol: string, blockNumber?: BlockIdentifier): Promise<PriceInfo>;
|
|
478
483
|
protected _loadPrices(onUpdate?: (tokenSymbol: string) => void): void;
|
|
479
484
|
_getPrice(token: TokenInfo): Promise<number>;
|
|
485
|
+
protected _getMethodsToTry(token: TokenInfo): PriceMethod[];
|
|
480
486
|
protected _tryPriceMethod(token: TokenInfo, method: PriceMethod): Promise<number>;
|
|
481
487
|
_getPriceAvnuApi(token: TokenInfo): Promise<number>;
|
|
482
488
|
_getPriceCoinbase(token: TokenInfo): Promise<number>;
|
|
@@ -2410,4 +2416,4 @@ declare class PasswordJsonCryptoUtil {
|
|
|
2410
2416
|
decrypt(encryptedData: string, password: string): any;
|
|
2411
2417
|
}
|
|
2412
2418
|
|
|
2413
|
-
export { APYType, AUMTypes, AVNU_EXCHANGE, AVNU_MIDDLEWARE, type AccessControlInfo, AccessControlType, type AccountInfo, type AdapterLeafType, type AllAccountsStore, type AmountInfo, type AmountsInfo, type ApproveCallParams, AuditStatus, AutoCompounderSTRK, type AvnuSwapCallParams, AvnuWrapper, BaseAdapter, type BaseAdapterConfig, BaseStrategy, type CLVaultStrategySettings, CommonAdapter, type CommonAdapterConfig, ContractAddr, type DecreaseLeverParams, Deployer, type DualActionAmount, type DualTokenInfo, ERC20, type EkuboBounds, EkuboCLVault, EkuboCLVaultStrategies, type EkuboPoolKey, EkuboPricer, type EkuboQuote, EkuboQuoter, type EkuboRouteNode, type EkuboSplit, type FAQ, FactoryStrategyType, FatalError, type FilterOption, type FlashloanCallParams, FlowChartColors, type GenerateCallFn, Global, HyperLSTStrategies, type HyperLSTStrategySettings, type IConfig, type ICurator, type IInvestmentFlow, ILending, type ILendingMetadata, type ILendingPosition, type IProtocol, type IStrategyMetadata, type IncreaseLeverParams, Initializable, type InputModeFromAction, InstantWithdrawalVault, LSTAPRService, LSTPriceType, type LSTStats, type LeafAdapterFn, type LeafData, type LendingToken, type ManageCall, MarginType, MyNumber, type NetAPYDetails, type NetAPYSplit, Network, PRICE_ROUTER, PasswordJsonCryptoUtil, type PositionAPY, type PositionInfo, Pragma, type PriceInfo, Pricer, PricerAvnuApi, PricerFromApi, PricerLST, PricerRedis, Protocols, type RedemptionInfo, type RequiredFields, type RequiredKeys, type RequiredStoreConfig, type RiskFactor, RiskType, type Route, type RouteNode, SIMPLE_SANITIZER, SIMPLE_SANITIZER_V2, SIMPLE_SANITIZER_VESU_V1_DELEGATIONS, type SecurityMetadata, SenseiStrategies, SenseiVault, type SenseiVaultSettings, type SingleActionAmount, type SingleTokenInfo, type SourceCodeInfo, SourceCodeType, StandardMerkleTree, type StandardMerkleTreeData, Store, type StoreConfig, type StrategyAlert, type StrategyApyHistoryUIConfig, type StrategyCapabilities, type StrategyFilterMetadata, type StrategyInputMode, StrategyLiveStatus, type StrategyMetadata, type StrategyRegistryEntry, type StrategySettings, StrategyTag, StrategyType, type SupportedPosition, type Swap, type SwapInfo, TelegramGroupNotif, TelegramNotif, type TokenAmount, type TokenInfo, UNIVERSAL_ADAPTERS, UNIVERSAL_MANAGE_IDS, UniversalLstMultiplierStrategy, type UniversalManageCall, UniversalStrategies, UniversalStrategy, type UniversalStrategySettings, UnwrapLabsCurator, type UserPositionCard, type UserPositionCardSubValueColor, type UserPositionCardsInput, type UserYoloInfo, VESU_SINGLETON, VESU_V2_MODIFY_POSITION_SANITIZER, type VaultPosition, VaultType, VesuAdapter, type VesuAdapterConfig, type VesuAmount, VesuAmountDenomination, VesuAmountType, type VesuDefiSpringRewardsCallParams, type VesuModifyDelegationCallParams, type VesuModifyPositionCallParams, type VesuMultiplyCallParams, VesuPoolMetadata, VesuPools, VesuRebalance, type VesuRebalanceSettings, VesuRebalanceStrategies, Web3Number, YoLoVault, type YoloSettings, type YoloSpendingLevel, type YoloVaultSettings, type YoloVaultStatus, YoloVaultStrategies, ZkLend, assert, buildStrategyRegistry, createEkuboCLStrategy, createHyperLSTStrategy, createSenseiStrategy, createStrategy, createUniversalStrategy, createVesuRebalanceStrategy, createYoloVaultStrategy, detectCapabilities, extensionMap, getAPIUsingHeadlessBrowser, getAllStrategyMetadata, getAllStrategyTags, getContractDetails, getDefaultStoreConfig, getFilterMetadata, getLiveStrategies, getMainnetConfig, getNoRiskTags, getRiskColor, getRiskExplaination, getStrategiesByType, getStrategyTagDesciption, getStrategyTypeFromMetadata, getTrovesEndpoint, getVesuSingletonAddress, highlightTextWithLinks, type i257, isDualTokenStrategy, logger, toAmountsInfo, toBigInt };
|
|
2419
|
+
export { APYType, AUMTypes, AVNU_EXCHANGE, AVNU_MIDDLEWARE, type AccessControlInfo, AccessControlType, type AccountInfo, type AdapterLeafType, type AllAccountsStore, type AmountInfo, type AmountsInfo, type ApproveCallParams, AuditStatus, AutoCompounderSTRK, type AvnuSwapCallParams, AvnuWrapper, BaseAdapter, type BaseAdapterConfig, BaseStrategy, type CLVaultStrategySettings, CommonAdapter, type CommonAdapterConfig, ContractAddr, type DecreaseLeverParams, Deployer, type DualActionAmount, type DualTokenInfo, ERC20, type EkuboBounds, EkuboCLVault, EkuboCLVaultStrategies, type EkuboPoolKey, EkuboPricer, type EkuboQuote, EkuboQuoter, type EkuboRouteNode, type EkuboSplit, type FAQ, FactoryStrategyType, FatalError, type FeeBps, type FilterOption, type FlashloanCallParams, FlowChartColors, type GenerateCallFn, Global, HyperLSTStrategies, type HyperLSTStrategySettings, type IConfig, type ICurator, type IInvestmentFlow, ILending, type ILendingMetadata, type ILendingPosition, type IProtocol, type IStrategyMetadata, type IncreaseLeverParams, Initializable, type InputModeFromAction, InstantWithdrawalVault, LSTAPRService, LSTPriceType, type LSTStats, type LeafAdapterFn, type LeafData, type LendingToken, type ManageCall, MarginType, MyNumber, type NetAPYDetails, type NetAPYSplit, Network, PRICE_ROUTER, PasswordJsonCryptoUtil, type PositionAPY, type PositionInfo, Pragma, type PriceInfo, type PriceMethod, Pricer, PricerAvnuApi, PricerFromApi, PricerLST, PricerRedis, Protocols, type RedemptionInfo, type RequiredFields, type RequiredKeys, type RequiredStoreConfig, type RiskFactor, RiskType, type Route, type RouteNode, SIMPLE_SANITIZER, SIMPLE_SANITIZER_V2, SIMPLE_SANITIZER_VESU_V1_DELEGATIONS, type SecurityMetadata, SenseiStrategies, SenseiVault, type SenseiVaultSettings, type SingleActionAmount, type SingleTokenInfo, type SourceCodeInfo, SourceCodeType, StandardMerkleTree, type StandardMerkleTreeData, Store, type StoreConfig, type StrategyAlert, type StrategyApyHistoryUIConfig, type StrategyCapabilities, type StrategyFilterMetadata, type StrategyInputMode, StrategyLiveStatus, type StrategyMetadata, type StrategyRegistryEntry, type StrategySettings, StrategyTag, StrategyType, type SupportedPosition, type Swap, type SwapInfo, TelegramGroupNotif, TelegramNotif, type TokenAmount, type TokenInfo, UNIVERSAL_ADAPTERS, UNIVERSAL_MANAGE_IDS, UniversalLstMultiplierStrategy, type UniversalManageCall, UniversalStrategies, UniversalStrategy, type UniversalStrategySettings, UnwrapLabsCurator, type UserPositionCard, type UserPositionCardSubValueColor, type UserPositionCardsInput, type UserYoloInfo, VESU_SINGLETON, VESU_V2_MODIFY_POSITION_SANITIZER, type VaultPosition, VaultType, VesuAdapter, type VesuAdapterConfig, type VesuAmount, VesuAmountDenomination, VesuAmountType, type VesuDefiSpringRewardsCallParams, type VesuModifyDelegationCallParams, type VesuModifyPositionCallParams, type VesuMultiplyCallParams, VesuPoolMetadata, VesuPools, VesuRebalance, type VesuRebalanceSettings, VesuRebalanceStrategies, Web3Number, YoLoVault, type YoloSettings, type YoloSpendingLevel, type YoloVaultSettings, type YoloVaultStatus, YoloVaultStrategies, ZkLend, assert, buildStrategyRegistry, createEkuboCLStrategy, createHyperLSTStrategy, createSenseiStrategy, createStrategy, createUniversalStrategy, createVesuRebalanceStrategy, createYoloVaultStrategy, detectCapabilities, extensionMap, getAPIUsingHeadlessBrowser, getAllStrategyMetadata, getAllStrategyTags, getContractDetails, getDefaultStoreConfig, getFilterMetadata, getLiveStrategies, getMainnetConfig, getNoRiskTags, getRiskColor, getRiskExplaination, getStrategiesByType, getStrategyTagDesciption, getStrategyTypeFromMetadata, getTrovesEndpoint, getVesuSingletonAddress, highlightTextWithLinks, type i257, isDualTokenStrategy, logger, toAmountsInfo, toBigInt };
|
package/dist/index.js
CHANGED
|
@@ -466,7 +466,8 @@ var defaultTokens = [{
|
|
|
466
466
|
decimals: 18,
|
|
467
467
|
coingeckId: "starknet",
|
|
468
468
|
displayDecimals: 2,
|
|
469
|
-
priceCheckAmount:
|
|
469
|
+
priceCheckAmount: 5e3,
|
|
470
|
+
priceMethod: "Avnu"
|
|
470
471
|
}, {
|
|
471
472
|
name: "xSTRK",
|
|
472
473
|
symbol: "xSTRK",
|
|
@@ -474,8 +475,9 @@ var defaultTokens = [{
|
|
|
474
475
|
address: ContractAddr.from("0x028d709c875c0ceac3dce7065bec5328186dc89fe254527084d1689910954b0a"),
|
|
475
476
|
decimals: 18,
|
|
476
477
|
coingeckId: void 0,
|
|
477
|
-
priceCheckAmount:
|
|
478
|
-
displayDecimals: 2
|
|
478
|
+
priceCheckAmount: 5e3,
|
|
479
|
+
displayDecimals: 2,
|
|
480
|
+
priceMethod: "Avnu"
|
|
479
481
|
}, {
|
|
480
482
|
name: "ETH",
|
|
481
483
|
symbol: "ETH",
|
|
@@ -562,9 +564,9 @@ var defaultTokens = [{
|
|
|
562
564
|
decimals: 8,
|
|
563
565
|
coingeckId: void 0,
|
|
564
566
|
displayDecimals: 6,
|
|
565
|
-
|
|
566
|
-
priceCheckAmount: 1e-3
|
|
567
|
+
priceCheckAmount: 1e-3,
|
|
567
568
|
// 112000 * 0.0001 = $110.2
|
|
569
|
+
priceMethod: "Avnu"
|
|
568
570
|
}, {
|
|
569
571
|
name: "xsBTC",
|
|
570
572
|
symbol: "xsBTC",
|
|
@@ -573,11 +575,10 @@ var defaultTokens = [{
|
|
|
573
575
|
decimals: 18,
|
|
574
576
|
coingeckId: void 0,
|
|
575
577
|
displayDecimals: 6,
|
|
576
|
-
|
|
577
|
-
priceCheckAmount: 1e-4
|
|
578
|
+
priceCheckAmount: 1e-4,
|
|
578
579
|
// 112000 * 0.0001 = $11.2
|
|
580
|
+
priceMethod: "Avnu"
|
|
579
581
|
}, {
|
|
580
|
-
// todo upgrade proxy tokens once feeds are available
|
|
581
582
|
name: "xtBTC",
|
|
582
583
|
symbol: "xtBTC",
|
|
583
584
|
logo: "https://assets.strkfarm.com/integrations/tokens/xtbtc.svg",
|
|
@@ -587,7 +588,7 @@ var defaultTokens = [{
|
|
|
587
588
|
displayDecimals: 6,
|
|
588
589
|
priceCheckAmount: 1e-3,
|
|
589
590
|
// 112000 * 0.0001 = $110.2
|
|
590
|
-
|
|
591
|
+
priceMethod: "Avnu"
|
|
591
592
|
}, {
|
|
592
593
|
name: "xLBTC",
|
|
593
594
|
symbol: "xLBTC",
|
|
@@ -596,9 +597,9 @@ var defaultTokens = [{
|
|
|
596
597
|
decimals: 8,
|
|
597
598
|
coingeckId: void 0,
|
|
598
599
|
displayDecimals: 6,
|
|
599
|
-
|
|
600
|
-
priceCheckAmount: 1e-4
|
|
600
|
+
priceCheckAmount: 1e-4,
|
|
601
601
|
// 112000 * 0.0001 = $11.2
|
|
602
|
+
priceMethod: "Avnu"
|
|
602
603
|
}, {
|
|
603
604
|
name: "mRe7BTC",
|
|
604
605
|
symbol: "mRe7BTC",
|
|
@@ -661,7 +662,7 @@ var defaultTokens = [{
|
|
|
661
662
|
displayDecimals: 6,
|
|
662
663
|
priceCheckAmount: 1e-3,
|
|
663
664
|
// 112000 * 0.0001 = $110.2
|
|
664
|
-
|
|
665
|
+
priceMethod: "Avnu"
|
|
665
666
|
}, {
|
|
666
667
|
name: "xstrkBTC",
|
|
667
668
|
symbol: "xstrkBTC",
|
|
@@ -671,7 +672,7 @@ var defaultTokens = [{
|
|
|
671
672
|
coingeckId: void 0,
|
|
672
673
|
displayDecimals: 6,
|
|
673
674
|
priceCheckAmount: 1e-3,
|
|
674
|
-
|
|
675
|
+
priceMethod: "Avnu"
|
|
675
676
|
}];
|
|
676
677
|
var tokens = defaultTokens;
|
|
677
678
|
var _Global = class _Global {
|
|
@@ -1155,21 +1156,14 @@ var Pricer = class extends PricerBase {
|
|
|
1155
1156
|
}
|
|
1156
1157
|
}
|
|
1157
1158
|
async _getPrice(token) {
|
|
1158
|
-
const
|
|
1159
|
-
|
|
1160
|
-
logger.verbose(`Fetching price of ${token.symbol} using pinned ${pinned}`);
|
|
1161
|
-
try {
|
|
1162
|
-
return await this._tryPriceMethod(token, pinned);
|
|
1163
|
-
} catch (error) {
|
|
1164
|
-
console.warn(`${pinned}: pinned price failed [${token.symbol}]: `, error.message);
|
|
1165
|
-
delete this.methodToUse[token.symbol];
|
|
1166
|
-
}
|
|
1167
|
-
}
|
|
1168
|
-
for (const method of PRICE_METHOD_PRIORITY) {
|
|
1159
|
+
const methodsToTry = this._getMethodsToTry(token);
|
|
1160
|
+
for (const method of methodsToTry) {
|
|
1169
1161
|
logger.verbose(`Fetching price of ${token.symbol} using ${method}`);
|
|
1170
1162
|
try {
|
|
1171
1163
|
const result = await this._tryPriceMethod(token, method);
|
|
1172
|
-
|
|
1164
|
+
if (!token.priceMethod) {
|
|
1165
|
+
this.methodToUse[token.symbol] = method;
|
|
1166
|
+
}
|
|
1173
1167
|
return result;
|
|
1174
1168
|
} catch (error) {
|
|
1175
1169
|
console.warn(`${method}: price err [${token.symbol}]: `, error.message);
|
|
@@ -1177,6 +1171,22 @@ var Pricer = class extends PricerBase {
|
|
|
1177
1171
|
}
|
|
1178
1172
|
throw new FatalError(`Price not found for ${token.symbol}`);
|
|
1179
1173
|
}
|
|
1174
|
+
_getMethodsToTry(token) {
|
|
1175
|
+
const methods = [];
|
|
1176
|
+
if (token.priceMethod) {
|
|
1177
|
+
methods.push(token.priceMethod);
|
|
1178
|
+
}
|
|
1179
|
+
const pinned = this.methodToUse[token.symbol];
|
|
1180
|
+
if (pinned && pinned !== token.priceMethod) {
|
|
1181
|
+
methods.push(pinned);
|
|
1182
|
+
}
|
|
1183
|
+
for (const method of PRICE_METHOD_PRIORITY) {
|
|
1184
|
+
if (!methods.includes(method)) {
|
|
1185
|
+
methods.push(method);
|
|
1186
|
+
}
|
|
1187
|
+
}
|
|
1188
|
+
return methods;
|
|
1189
|
+
}
|
|
1180
1190
|
async _tryPriceMethod(token, method) {
|
|
1181
1191
|
switch (method) {
|
|
1182
1192
|
case "AvnuApi":
|
|
@@ -18234,6 +18244,9 @@ var xSTRKSTRK = {
|
|
|
18234
18244
|
},
|
|
18235
18245
|
apyMethodology: "APY based on 30-day historical performance, including fees and rewards.",
|
|
18236
18246
|
realizedApyMethodology: "The realizedAPY is based on past 14 days performance by the vault",
|
|
18247
|
+
feeBps: {
|
|
18248
|
+
performanceFeeBps: 1e3
|
|
18249
|
+
},
|
|
18237
18250
|
additionalInfo: {
|
|
18238
18251
|
newBounds: {
|
|
18239
18252
|
lower: -1,
|
|
@@ -29786,6 +29799,9 @@ var YoloVaultStrategies = yoloVaultsConfig.map((yoloConfig) => {
|
|
|
29786
29799
|
notARisks: getNoRiskTags(yoloRiskFactors)
|
|
29787
29800
|
},
|
|
29788
29801
|
apyMethodology: "Not a primary yield strategy. Funds earn yield when idle, but the main return comes from BTC price appreciation and your conviction to hold. This vault simply helps you accumulate more BTC.",
|
|
29802
|
+
feeBps: {
|
|
29803
|
+
performanceFeeBps: 1e3
|
|
29804
|
+
},
|
|
29789
29805
|
additionalInfo: {
|
|
29790
29806
|
mainToken: yoloConfig.mainToken,
|
|
29791
29807
|
secondaryToken: yoloConfig.secondaryToken,
|
|
@@ -33415,6 +33431,9 @@ var createUniversalStrategy = (params) => {
|
|
|
33415
33431
|
auditUrl: AUDIT_URL3,
|
|
33416
33432
|
protocols: [Protocols.VESU],
|
|
33417
33433
|
realizedApyMethodology: "The realizedAPY is based on past 14 days performance by the vault",
|
|
33434
|
+
feeBps: {
|
|
33435
|
+
performanceFeeBps: 1e3
|
|
33436
|
+
},
|
|
33418
33437
|
curator: UnwrapLabsCurator,
|
|
33419
33438
|
settings: createUniversalSettings(params.tokenSymbol),
|
|
33420
33439
|
contractDetails: getContractDetails(params.vaultSettings),
|
|
@@ -35133,6 +35152,9 @@ function getStrategySettings(lstSymbol, underlyingSymbol, settings, isPreview =
|
|
|
35133
35152
|
isPreview,
|
|
35134
35153
|
apyMethodology: "Current annualized APY in terms of base asset of the LST. There is no additional fee taken by Troves on LST APY. We charge a 10% performance fee on the additional gain which is already accounted in the APY shown.",
|
|
35135
35154
|
realizedApyMethodology: "The realizedAPY is based on past 14 days performance by the vault",
|
|
35155
|
+
feeBps: {
|
|
35156
|
+
performanceFeeBps: 1e3
|
|
35157
|
+
},
|
|
35136
35158
|
tags: lstSymbol.includes("BTC") ? ["BTC" /* BTC */, "Maxx" /* LEVERED */] : ["Maxx" /* LEVERED */],
|
|
35137
35159
|
security: HYPER_LST_SECURITY,
|
|
35138
35160
|
redemptionInfo: HYPER_LST_REDEMPTION_INFO,
|
package/dist/index.mjs
CHANGED
|
@@ -325,7 +325,8 @@ var defaultTokens = [{
|
|
|
325
325
|
decimals: 18,
|
|
326
326
|
coingeckId: "starknet",
|
|
327
327
|
displayDecimals: 2,
|
|
328
|
-
priceCheckAmount:
|
|
328
|
+
priceCheckAmount: 5e3,
|
|
329
|
+
priceMethod: "Avnu"
|
|
329
330
|
}, {
|
|
330
331
|
name: "xSTRK",
|
|
331
332
|
symbol: "xSTRK",
|
|
@@ -333,8 +334,9 @@ var defaultTokens = [{
|
|
|
333
334
|
address: ContractAddr.from("0x028d709c875c0ceac3dce7065bec5328186dc89fe254527084d1689910954b0a"),
|
|
334
335
|
decimals: 18,
|
|
335
336
|
coingeckId: void 0,
|
|
336
|
-
priceCheckAmount:
|
|
337
|
-
displayDecimals: 2
|
|
337
|
+
priceCheckAmount: 5e3,
|
|
338
|
+
displayDecimals: 2,
|
|
339
|
+
priceMethod: "Avnu"
|
|
338
340
|
}, {
|
|
339
341
|
name: "ETH",
|
|
340
342
|
symbol: "ETH",
|
|
@@ -421,9 +423,9 @@ var defaultTokens = [{
|
|
|
421
423
|
decimals: 8,
|
|
422
424
|
coingeckId: void 0,
|
|
423
425
|
displayDecimals: 6,
|
|
424
|
-
|
|
425
|
-
priceCheckAmount: 1e-3
|
|
426
|
+
priceCheckAmount: 1e-3,
|
|
426
427
|
// 112000 * 0.0001 = $110.2
|
|
428
|
+
priceMethod: "Avnu"
|
|
427
429
|
}, {
|
|
428
430
|
name: "xsBTC",
|
|
429
431
|
symbol: "xsBTC",
|
|
@@ -432,11 +434,10 @@ var defaultTokens = [{
|
|
|
432
434
|
decimals: 18,
|
|
433
435
|
coingeckId: void 0,
|
|
434
436
|
displayDecimals: 6,
|
|
435
|
-
|
|
436
|
-
priceCheckAmount: 1e-4
|
|
437
|
+
priceCheckAmount: 1e-4,
|
|
437
438
|
// 112000 * 0.0001 = $11.2
|
|
439
|
+
priceMethod: "Avnu"
|
|
438
440
|
}, {
|
|
439
|
-
// todo upgrade proxy tokens once feeds are available
|
|
440
441
|
name: "xtBTC",
|
|
441
442
|
symbol: "xtBTC",
|
|
442
443
|
logo: "https://assets.strkfarm.com/integrations/tokens/xtbtc.svg",
|
|
@@ -446,7 +447,7 @@ var defaultTokens = [{
|
|
|
446
447
|
displayDecimals: 6,
|
|
447
448
|
priceCheckAmount: 1e-3,
|
|
448
449
|
// 112000 * 0.0001 = $110.2
|
|
449
|
-
|
|
450
|
+
priceMethod: "Avnu"
|
|
450
451
|
}, {
|
|
451
452
|
name: "xLBTC",
|
|
452
453
|
symbol: "xLBTC",
|
|
@@ -455,9 +456,9 @@ var defaultTokens = [{
|
|
|
455
456
|
decimals: 8,
|
|
456
457
|
coingeckId: void 0,
|
|
457
458
|
displayDecimals: 6,
|
|
458
|
-
|
|
459
|
-
priceCheckAmount: 1e-4
|
|
459
|
+
priceCheckAmount: 1e-4,
|
|
460
460
|
// 112000 * 0.0001 = $11.2
|
|
461
|
+
priceMethod: "Avnu"
|
|
461
462
|
}, {
|
|
462
463
|
name: "mRe7BTC",
|
|
463
464
|
symbol: "mRe7BTC",
|
|
@@ -520,7 +521,7 @@ var defaultTokens = [{
|
|
|
520
521
|
displayDecimals: 6,
|
|
521
522
|
priceCheckAmount: 1e-3,
|
|
522
523
|
// 112000 * 0.0001 = $110.2
|
|
523
|
-
|
|
524
|
+
priceMethod: "Avnu"
|
|
524
525
|
}, {
|
|
525
526
|
name: "xstrkBTC",
|
|
526
527
|
symbol: "xstrkBTC",
|
|
@@ -530,7 +531,7 @@ var defaultTokens = [{
|
|
|
530
531
|
coingeckId: void 0,
|
|
531
532
|
displayDecimals: 6,
|
|
532
533
|
priceCheckAmount: 1e-3,
|
|
533
|
-
|
|
534
|
+
priceMethod: "Avnu"
|
|
534
535
|
}];
|
|
535
536
|
var tokens = defaultTokens;
|
|
536
537
|
var _Global = class _Global {
|
|
@@ -1014,21 +1015,14 @@ var Pricer = class extends PricerBase {
|
|
|
1014
1015
|
}
|
|
1015
1016
|
}
|
|
1016
1017
|
async _getPrice(token) {
|
|
1017
|
-
const
|
|
1018
|
-
|
|
1019
|
-
logger.verbose(`Fetching price of ${token.symbol} using pinned ${pinned}`);
|
|
1020
|
-
try {
|
|
1021
|
-
return await this._tryPriceMethod(token, pinned);
|
|
1022
|
-
} catch (error) {
|
|
1023
|
-
console.warn(`${pinned}: pinned price failed [${token.symbol}]: `, error.message);
|
|
1024
|
-
delete this.methodToUse[token.symbol];
|
|
1025
|
-
}
|
|
1026
|
-
}
|
|
1027
|
-
for (const method of PRICE_METHOD_PRIORITY) {
|
|
1018
|
+
const methodsToTry = this._getMethodsToTry(token);
|
|
1019
|
+
for (const method of methodsToTry) {
|
|
1028
1020
|
logger.verbose(`Fetching price of ${token.symbol} using ${method}`);
|
|
1029
1021
|
try {
|
|
1030
1022
|
const result = await this._tryPriceMethod(token, method);
|
|
1031
|
-
|
|
1023
|
+
if (!token.priceMethod) {
|
|
1024
|
+
this.methodToUse[token.symbol] = method;
|
|
1025
|
+
}
|
|
1032
1026
|
return result;
|
|
1033
1027
|
} catch (error) {
|
|
1034
1028
|
console.warn(`${method}: price err [${token.symbol}]: `, error.message);
|
|
@@ -1036,6 +1030,22 @@ var Pricer = class extends PricerBase {
|
|
|
1036
1030
|
}
|
|
1037
1031
|
throw new FatalError(`Price not found for ${token.symbol}`);
|
|
1038
1032
|
}
|
|
1033
|
+
_getMethodsToTry(token) {
|
|
1034
|
+
const methods = [];
|
|
1035
|
+
if (token.priceMethod) {
|
|
1036
|
+
methods.push(token.priceMethod);
|
|
1037
|
+
}
|
|
1038
|
+
const pinned = this.methodToUse[token.symbol];
|
|
1039
|
+
if (pinned && pinned !== token.priceMethod) {
|
|
1040
|
+
methods.push(pinned);
|
|
1041
|
+
}
|
|
1042
|
+
for (const method of PRICE_METHOD_PRIORITY) {
|
|
1043
|
+
if (!methods.includes(method)) {
|
|
1044
|
+
methods.push(method);
|
|
1045
|
+
}
|
|
1046
|
+
}
|
|
1047
|
+
return methods;
|
|
1048
|
+
}
|
|
1039
1049
|
async _tryPriceMethod(token, method) {
|
|
1040
1050
|
switch (method) {
|
|
1041
1051
|
case "AvnuApi":
|
|
@@ -18097,6 +18107,9 @@ var xSTRKSTRK = {
|
|
|
18097
18107
|
},
|
|
18098
18108
|
apyMethodology: "APY based on 30-day historical performance, including fees and rewards.",
|
|
18099
18109
|
realizedApyMethodology: "The realizedAPY is based on past 14 days performance by the vault",
|
|
18110
|
+
feeBps: {
|
|
18111
|
+
performanceFeeBps: 1e3
|
|
18112
|
+
},
|
|
18100
18113
|
additionalInfo: {
|
|
18101
18114
|
newBounds: {
|
|
18102
18115
|
lower: -1,
|
|
@@ -29649,6 +29662,9 @@ var YoloVaultStrategies = yoloVaultsConfig.map((yoloConfig) => {
|
|
|
29649
29662
|
notARisks: getNoRiskTags(yoloRiskFactors)
|
|
29650
29663
|
},
|
|
29651
29664
|
apyMethodology: "Not a primary yield strategy. Funds earn yield when idle, but the main return comes from BTC price appreciation and your conviction to hold. This vault simply helps you accumulate more BTC.",
|
|
29665
|
+
feeBps: {
|
|
29666
|
+
performanceFeeBps: 1e3
|
|
29667
|
+
},
|
|
29652
29668
|
additionalInfo: {
|
|
29653
29669
|
mainToken: yoloConfig.mainToken,
|
|
29654
29670
|
secondaryToken: yoloConfig.secondaryToken,
|
|
@@ -33278,6 +33294,9 @@ var createUniversalStrategy = (params) => {
|
|
|
33278
33294
|
auditUrl: AUDIT_URL3,
|
|
33279
33295
|
protocols: [Protocols.VESU],
|
|
33280
33296
|
realizedApyMethodology: "The realizedAPY is based on past 14 days performance by the vault",
|
|
33297
|
+
feeBps: {
|
|
33298
|
+
performanceFeeBps: 1e3
|
|
33299
|
+
},
|
|
33281
33300
|
curator: UnwrapLabsCurator,
|
|
33282
33301
|
settings: createUniversalSettings(params.tokenSymbol),
|
|
33283
33302
|
contractDetails: getContractDetails(params.vaultSettings),
|
|
@@ -34996,6 +35015,9 @@ function getStrategySettings(lstSymbol, underlyingSymbol, settings, isPreview =
|
|
|
34996
35015
|
isPreview,
|
|
34997
35016
|
apyMethodology: "Current annualized APY in terms of base asset of the LST. There is no additional fee taken by Troves on LST APY. We charge a 10% performance fee on the additional gain which is already accounted in the APY shown.",
|
|
34998
35017
|
realizedApyMethodology: "The realizedAPY is based on past 14 days performance by the vault",
|
|
35018
|
+
feeBps: {
|
|
35019
|
+
performanceFeeBps: 1e3
|
|
35020
|
+
},
|
|
34999
35021
|
tags: lstSymbol.includes("BTC") ? ["BTC" /* BTC */, "Maxx" /* LEVERED */] : ["Maxx" /* LEVERED */],
|
|
35000
35022
|
security: HYPER_LST_SECURITY,
|
|
35001
35023
|
redemptionInfo: HYPER_LST_REDEMPTION_INFO,
|
package/package.json
CHANGED
package/src/global.ts
CHANGED
|
@@ -22,7 +22,8 @@ const defaultTokens: TokenInfo[] = [{
|
|
|
22
22
|
decimals: 18,
|
|
23
23
|
coingeckId: 'starknet',
|
|
24
24
|
displayDecimals: 2,
|
|
25
|
-
priceCheckAmount:
|
|
25
|
+
priceCheckAmount: 5000,
|
|
26
|
+
priceMethod: 'Avnu'
|
|
26
27
|
}, {
|
|
27
28
|
name: 'xSTRK',
|
|
28
29
|
symbol: 'xSTRK',
|
|
@@ -30,8 +31,9 @@ const defaultTokens: TokenInfo[] = [{
|
|
|
30
31
|
address: ContractAddr.from('0x028d709c875c0ceac3dce7065bec5328186dc89fe254527084d1689910954b0a'),
|
|
31
32
|
decimals: 18,
|
|
32
33
|
coingeckId: undefined,
|
|
33
|
-
priceCheckAmount:
|
|
34
|
+
priceCheckAmount: 5000,
|
|
34
35
|
displayDecimals: 2,
|
|
36
|
+
priceMethod: 'Avnu'
|
|
35
37
|
}, {
|
|
36
38
|
name: 'ETH',
|
|
37
39
|
symbol: 'ETH',
|
|
@@ -114,8 +116,8 @@ const defaultTokens: TokenInfo[] = [{
|
|
|
114
116
|
decimals: 8,
|
|
115
117
|
coingeckId: undefined,
|
|
116
118
|
displayDecimals: 6,
|
|
117
|
-
priceProxySymbol: 'WBTC',
|
|
118
119
|
priceCheckAmount: 0.001, // 112000 * 0.0001 = $110.2
|
|
120
|
+
priceMethod: 'Avnu'
|
|
119
121
|
}, {
|
|
120
122
|
name: 'xsBTC',
|
|
121
123
|
symbol: 'xsBTC',
|
|
@@ -124,10 +126,9 @@ const defaultTokens: TokenInfo[] = [{
|
|
|
124
126
|
decimals: 18,
|
|
125
127
|
coingeckId: undefined,
|
|
126
128
|
displayDecimals: 6,
|
|
127
|
-
priceProxySymbol: 'WBTC',
|
|
128
129
|
priceCheckAmount: 0.0001, // 112000 * 0.0001 = $11.2
|
|
130
|
+
priceMethod: 'Avnu'
|
|
129
131
|
}, {
|
|
130
|
-
// todo upgrade proxy tokens once feeds are available
|
|
131
132
|
name: 'xtBTC',
|
|
132
133
|
symbol: 'xtBTC',
|
|
133
134
|
logo: 'https://assets.strkfarm.com/integrations/tokens/xtbtc.svg',
|
|
@@ -136,7 +137,7 @@ const defaultTokens: TokenInfo[] = [{
|
|
|
136
137
|
coingeckId: undefined,
|
|
137
138
|
displayDecimals: 6,
|
|
138
139
|
priceCheckAmount: 0.001, // 112000 * 0.0001 = $110.2
|
|
139
|
-
|
|
140
|
+
priceMethod: 'Avnu'
|
|
140
141
|
}, {
|
|
141
142
|
name: 'xLBTC',
|
|
142
143
|
symbol: 'xLBTC',
|
|
@@ -145,8 +146,8 @@ const defaultTokens: TokenInfo[] = [{
|
|
|
145
146
|
decimals: 8,
|
|
146
147
|
coingeckId: undefined,
|
|
147
148
|
displayDecimals: 6,
|
|
148
|
-
priceProxySymbol: 'WBTC',
|
|
149
149
|
priceCheckAmount: 0.0001, // 112000 * 0.0001 = $11.2
|
|
150
|
+
priceMethod: 'Avnu'
|
|
150
151
|
}, {
|
|
151
152
|
name: 'mRe7BTC',
|
|
152
153
|
symbol: 'mRe7BTC',
|
|
@@ -206,7 +207,7 @@ const defaultTokens: TokenInfo[] = [{
|
|
|
206
207
|
coingeckId: undefined,
|
|
207
208
|
displayDecimals: 6,
|
|
208
209
|
priceCheckAmount: 0.001, // 112000 * 0.0001 = $110.2
|
|
209
|
-
|
|
210
|
+
priceMethod: 'Avnu'
|
|
210
211
|
}, {
|
|
211
212
|
name: 'xstrkBTC',
|
|
212
213
|
symbol: 'xstrkBTC',
|
|
@@ -216,7 +217,7 @@ const defaultTokens: TokenInfo[] = [{
|
|
|
216
217
|
coingeckId: undefined,
|
|
217
218
|
displayDecimals: 6,
|
|
218
219
|
priceCheckAmount: 0.001,
|
|
219
|
-
|
|
220
|
+
priceMethod: 'Avnu'
|
|
220
221
|
},]
|
|
221
222
|
const tokens: TokenInfo[] = defaultTokens;
|
|
222
223
|
|
|
@@ -25,6 +25,8 @@ export interface RiskFactor {
|
|
|
25
25
|
reason?: string; // optional reason for the risk factor
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
+
export type PriceMethod = 'AvnuApi' | 'Coinbase' | 'Coinmarketcap' | 'Ekubo' | 'Avnu';
|
|
29
|
+
|
|
28
30
|
export interface TokenInfo {
|
|
29
31
|
name: string;
|
|
30
32
|
symbol: string;
|
|
@@ -35,6 +37,7 @@ export interface TokenInfo {
|
|
|
35
37
|
displayDecimals: number;
|
|
36
38
|
priceProxySymbol?: string; // for tokens like illiquid tokens, we use a proxy symbol to get the price
|
|
37
39
|
priceCheckAmount?: number; // for tokens like BTC, doing 1BTC price check may not be ideal, esp on illiquid netwrks like sn
|
|
40
|
+
priceMethod?: PriceMethod; // preferred price source; tried first, then falls back to other methods
|
|
38
41
|
dontPrice?: boolean; // a flag that skips pricer to check these tokens.
|
|
39
42
|
}
|
|
40
43
|
|
|
@@ -174,6 +177,10 @@ export interface StrategyApyHistoryUIConfig {
|
|
|
174
177
|
noApyHistoryMessage?: string;
|
|
175
178
|
}
|
|
176
179
|
|
|
180
|
+
export interface FeeBps {
|
|
181
|
+
performanceFeeBps: number;
|
|
182
|
+
}
|
|
183
|
+
|
|
177
184
|
/**
|
|
178
185
|
* @property risk.riskFactor.factor - The risk factors that are considered for the strategy.
|
|
179
186
|
* @property risk.riskFactor.factor - The value of the risk factor from 0 to 10, 0 being the lowest and 10 being the highest.
|
|
@@ -214,6 +221,7 @@ export interface IStrategyMetadata<T> {
|
|
|
214
221
|
};
|
|
215
222
|
apyMethodology?: string;
|
|
216
223
|
realizedApyMethodology?: string;
|
|
224
|
+
feeBps?: FeeBps;
|
|
217
225
|
additionalInfo: T;
|
|
218
226
|
contractDetails: {
|
|
219
227
|
address: ContractAddr;
|
package/src/modules/pricer.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import axios from "axios";
|
|
2
2
|
import { FatalError, Global } from "@/global";
|
|
3
|
-
import { TokenInfo } from "@/interfaces/common";
|
|
3
|
+
import { PriceMethod, TokenInfo } from "@/interfaces/common";
|
|
4
4
|
import { IConfig } from "@/interfaces/common";
|
|
5
5
|
import { Web3Number } from "@/dataTypes";
|
|
6
6
|
import { PricerBase } from "./pricerBase";
|
|
@@ -14,8 +14,6 @@ export interface PriceInfo {
|
|
|
14
14
|
timestamp: Date
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
type PriceMethod = 'AvnuApi' | 'Coinbase' | 'Coinmarketcap' | 'Ekubo' | 'Avnu';
|
|
18
|
-
|
|
19
17
|
const PRICE_METHOD_PRIORITY: PriceMethod[] = [
|
|
20
18
|
'AvnuApi',
|
|
21
19
|
'Coinbase',
|
|
@@ -164,22 +162,15 @@ export class Pricer extends PricerBase {
|
|
|
164
162
|
}
|
|
165
163
|
|
|
166
164
|
async _getPrice(token: TokenInfo): Promise<number> {
|
|
167
|
-
const
|
|
168
|
-
if (pinned) {
|
|
169
|
-
logger.verbose(`Fetching price of ${token.symbol} using pinned ${pinned}`);
|
|
170
|
-
try {
|
|
171
|
-
return await this._tryPriceMethod(token, pinned);
|
|
172
|
-
} catch (error: any) {
|
|
173
|
-
console.warn(`${pinned}: pinned price failed [${token.symbol}]: `, error.message);
|
|
174
|
-
delete this.methodToUse[token.symbol];
|
|
175
|
-
}
|
|
176
|
-
}
|
|
165
|
+
const methodsToTry = this._getMethodsToTry(token);
|
|
177
166
|
|
|
178
|
-
for (const method of
|
|
167
|
+
for (const method of methodsToTry) {
|
|
179
168
|
logger.verbose(`Fetching price of ${token.symbol} using ${method}`);
|
|
180
169
|
try {
|
|
181
170
|
const result = await this._tryPriceMethod(token, method);
|
|
182
|
-
|
|
171
|
+
if (!token.priceMethod) {
|
|
172
|
+
this.methodToUse[token.symbol] = method;
|
|
173
|
+
}
|
|
183
174
|
return result;
|
|
184
175
|
} catch (error: any) {
|
|
185
176
|
console.warn(`${method}: price err [${token.symbol}]: `, error.message);
|
|
@@ -189,6 +180,27 @@ export class Pricer extends PricerBase {
|
|
|
189
180
|
throw new FatalError(`Price not found for ${token.symbol}`);
|
|
190
181
|
}
|
|
191
182
|
|
|
183
|
+
protected _getMethodsToTry(token: TokenInfo): PriceMethod[] {
|
|
184
|
+
const methods: PriceMethod[] = [];
|
|
185
|
+
|
|
186
|
+
if (token.priceMethod) {
|
|
187
|
+
methods.push(token.priceMethod);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
const pinned = this.methodToUse[token.symbol];
|
|
191
|
+
if (pinned && pinned !== token.priceMethod) {
|
|
192
|
+
methods.push(pinned);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
for (const method of PRICE_METHOD_PRIORITY) {
|
|
196
|
+
if (!methods.includes(method)) {
|
|
197
|
+
methods.push(method);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
return methods;
|
|
202
|
+
}
|
|
203
|
+
|
|
192
204
|
protected async _tryPriceMethod(token: TokenInfo, method: PriceMethod): Promise<number> {
|
|
193
205
|
switch (method) {
|
|
194
206
|
case 'AvnuApi':
|
|
@@ -2443,6 +2443,9 @@ const xSTRKSTRK: IStrategyMetadata<CLVaultStrategySettings> = {
|
|
|
2443
2443
|
apyMethodology:
|
|
2444
2444
|
"APY based on 30-day historical performance, including fees and rewards.",
|
|
2445
2445
|
realizedApyMethodology: "The realizedAPY is based on past 14 days performance by the vault",
|
|
2446
|
+
feeBps: {
|
|
2447
|
+
performanceFeeBps: 1000,
|
|
2448
|
+
},
|
|
2446
2449
|
additionalInfo: {
|
|
2447
2450
|
newBounds: {
|
|
2448
2451
|
lower: -1,
|
|
@@ -2166,6 +2166,9 @@ function getStrategySettings(
|
|
|
2166
2166
|
"Current annualized APY in terms of base asset of the LST. There is no additional fee taken by Troves on LST APY. We charge a 10% performance fee on the additional gain which is already accounted in the APY shown.",
|
|
2167
2167
|
realizedApyMethodology:
|
|
2168
2168
|
"The realizedAPY is based on past 14 days performance by the vault",
|
|
2169
|
+
feeBps: {
|
|
2170
|
+
performanceFeeBps: 1000,
|
|
2171
|
+
},
|
|
2169
2172
|
tags: lstSymbol.includes("BTC")
|
|
2170
2173
|
? [StrategyTag.BTC, StrategyTag.LEVERED]
|
|
2171
2174
|
: [StrategyTag.LEVERED],
|
|
@@ -1404,6 +1404,9 @@ const createUniversalStrategy = (params: {
|
|
|
1404
1404
|
auditUrl: AUDIT_URL,
|
|
1405
1405
|
protocols: [Protocols.VESU],
|
|
1406
1406
|
realizedApyMethodology: "The realizedAPY is based on past 14 days performance by the vault",
|
|
1407
|
+
feeBps: {
|
|
1408
|
+
performanceFeeBps: 1000,
|
|
1409
|
+
},
|
|
1407
1410
|
curator: UnwrapLabsCurator,
|
|
1408
1411
|
settings: createUniversalSettings(params.tokenSymbol),
|
|
1409
1412
|
contractDetails: getContractDetails(params.vaultSettings),
|
|
@@ -1042,6 +1042,9 @@ export const YoloVaultStrategies: IStrategyMetadata<YoloVaultSettings>[] = yoloV
|
|
|
1042
1042
|
},
|
|
1043
1043
|
apyMethodology:
|
|
1044
1044
|
"Not a primary yield strategy. Funds earn yield when idle, but the main return comes from BTC price appreciation and your conviction to hold. This vault simply helps you accumulate more BTC.",
|
|
1045
|
+
feeBps: {
|
|
1046
|
+
performanceFeeBps: 1000,
|
|
1047
|
+
},
|
|
1045
1048
|
additionalInfo: {
|
|
1046
1049
|
mainToken: yoloConfig.mainToken,
|
|
1047
1050
|
secondaryToken: yoloConfig.secondaryToken,
|