@strkfarm/sdk 1.1.9 → 1.1.11
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 +166 -24
- package/dist/index.browser.mjs +161 -18
- package/dist/index.d.ts +20 -4
- package/dist/index.js +160 -16
- package/dist/index.mjs +159 -16
- package/package.json +1 -1
- package/src/global.ts +10 -0
- package/src/interfaces/common.tsx +2 -1
- package/src/modules/index.ts +2 -1
- package/src/modules/pricer-from-api.ts +1 -1
- package/src/modules/pricer-lst.ts +66 -0
- package/src/modules/pricer.ts +1 -1
- package/src/strategies/ekubo-cl-vault.tsx +23 -0
- package/src/strategies/universal-lst-muliplier-strategy.tsx +70 -13
- package/src/strategies/universal-strategy.tsx +12 -4
package/dist/index.d.ts
CHANGED
|
@@ -143,6 +143,7 @@ interface IStrategyMetadata<T> {
|
|
|
143
143
|
name: string;
|
|
144
144
|
logo: string;
|
|
145
145
|
};
|
|
146
|
+
isPreview?: boolean;
|
|
146
147
|
}
|
|
147
148
|
interface IInvestmentFlow {
|
|
148
149
|
id?: string;
|
|
@@ -244,7 +245,9 @@ declare class Pricer extends PricerBase {
|
|
|
244
245
|
};
|
|
245
246
|
refreshInterval: number;
|
|
246
247
|
staleTime: number;
|
|
247
|
-
|
|
248
|
+
protected methodToUse: {
|
|
249
|
+
[tokenSymbol: string]: 'Ekubo' | 'Coinbase' | 'Coinmarketcap';
|
|
250
|
+
};
|
|
248
251
|
/**
|
|
249
252
|
* TOKENA and TOKENB are the two token names to get price of TokenA in terms of TokenB
|
|
250
253
|
*/
|
|
@@ -1246,9 +1249,8 @@ declare const UniversalStrategies: IStrategyMetadata<UniversalStrategySettings>[
|
|
|
1246
1249
|
|
|
1247
1250
|
declare class UniversalLstMultiplierStrategy extends UniversalStrategy<UniversalStrategySettings> {
|
|
1248
1251
|
private quoteAmountToFetchPrice;
|
|
1249
|
-
constructor(config: IConfig, pricer:
|
|
1252
|
+
constructor(config: IConfig, pricer: PricerLST, metadata: IStrategyMetadata<UniversalStrategySettings>);
|
|
1250
1253
|
getVesuAdapters(): VesuAdapter[];
|
|
1251
|
-
protected getRewardsAUM(prevAum: Web3Number): Promise<Web3Number>;
|
|
1252
1254
|
getLSTDexPrice(): Promise<number>;
|
|
1253
1255
|
/**
|
|
1254
1256
|
* Uses vesu's multiple call to create leverage on LST
|
|
@@ -1268,6 +1270,7 @@ declare class UniversalLstMultiplierStrategy extends UniversalStrategy<Universal
|
|
|
1268
1270
|
getModifyLeverCall(params: {
|
|
1269
1271
|
marginAmount: Web3Number;
|
|
1270
1272
|
debtAmount: Web3Number;
|
|
1273
|
+
lstDexPriceInUnderlying: number;
|
|
1271
1274
|
isIncrease: boolean;
|
|
1272
1275
|
}): Promise<Call[]>;
|
|
1273
1276
|
}
|
|
@@ -1337,6 +1340,19 @@ declare class Global {
|
|
|
1337
1340
|
static getGlobalCache<T>(key: string): T | null;
|
|
1338
1341
|
}
|
|
1339
1342
|
|
|
1343
|
+
declare class PricerLST extends Pricer {
|
|
1344
|
+
private tokenMaps;
|
|
1345
|
+
protected EKUBO_API: string;
|
|
1346
|
+
constructor(config: IConfig, tokenMaps: {
|
|
1347
|
+
lst: TokenInfo;
|
|
1348
|
+
underlying: TokenInfo;
|
|
1349
|
+
}[]);
|
|
1350
|
+
isUnderlying(token: TokenInfo): boolean;
|
|
1351
|
+
getUnderlying(token: TokenInfo): TokenInfo;
|
|
1352
|
+
_getPrice(token: TokenInfo, defaultMethod?: string): Promise<number>;
|
|
1353
|
+
_getPriceEkubo(token: TokenInfo, amountIn?: Web3Number, retry?: number): Promise<number>;
|
|
1354
|
+
}
|
|
1355
|
+
|
|
1340
1356
|
declare class TelegramNotif {
|
|
1341
1357
|
private subscribers;
|
|
1342
1358
|
readonly bot: TelegramBot;
|
|
@@ -1469,4 +1485,4 @@ declare class PasswordJsonCryptoUtil {
|
|
|
1469
1485
|
decrypt(encryptedData: string, password: string): any;
|
|
1470
1486
|
}
|
|
1471
1487
|
|
|
1472
|
-
export { AUMTypes, type AccountInfo, type AdapterLeafType, type AllAccountsStore, type ApproveCallParams, AutoCompounderSTRK, type AvnuSwapCallParams, AvnuWrapper, BaseAdapter, BaseStrategy, type CLVaultStrategySettings, CommonAdapter, type CommonAdapterConfig, ContractAddr, type DecreaseLeverParams, Deployer, type DualActionAmount, type DualTokenInfo, ERC20, type EkuboBounds, EkuboCLVault, EkuboCLVaultStrategies, type EkuboPoolKey, type EkuboQuote, EkuboQuoter, type EkuboRouteNode, type EkuboSplit, type FAQ, FatalError, type FlashloanCallParams, FlowChartColors, type GenerateCallFn, Global, HyperLSTStrategies, type IConfig, type IInvestmentFlow, ILending, type ILendingMetadata, type ILendingPosition, type IProtocol, type IStrategyMetadata, type IncreaseLeverParams, Initializable, type LeafAdapterFn, type LeafData, type LendingToken, type ManageCall, MarginType, Network, PasswordJsonCryptoUtil, Pragma, type PriceInfo, Pricer, PricerFromApi, PricerRedis, Protocols, type RequiredFields, type RequiredKeys, type RequiredStoreConfig, type RiskFactor, RiskType, type Route, type RouteNode, SenseiStrategies, SenseiVault, type SenseiVaultSettings, type SingleActionAmount, type SingleTokenInfo, StandardMerkleTree, type StandardMerkleTreeData, Store, type StoreConfig, type Swap, type SwapInfo, TelegramNotif, type TokenAmount, type TokenInfo, UNIVERSAL_ADAPTERS, UNIVERSAL_MANAGE_IDS, UniversalLstMultiplierStrategy, type UniversalManageCall, UniversalStrategies, UniversalStrategy, type UniversalStrategySettings, type VaultPosition, VesuAdapter, type VesuAdapterConfig, type VesuAmount, VesuAmountDenomination, VesuAmountType, type VesuDefiSpringRewardsCallParams, type VesuModifyDelegationCallParams, type VesuModifyPositionCallParams, type VesuMultiplyCallParams, VesuPools, VesuRebalance, type VesuRebalanceSettings, VesuRebalanceStrategies, Web3Number, ZkLend, assert, getAPIUsingHeadlessBrowser, getContractDetails, getDefaultStoreConfig, getMainnetConfig, getNoRiskTags, getRiskColor, getRiskExplaination, getTrovesEndpoint, highlightTextWithLinks, type i257, logger };
|
|
1488
|
+
export { AUMTypes, type AccountInfo, type AdapterLeafType, type AllAccountsStore, type ApproveCallParams, AutoCompounderSTRK, type AvnuSwapCallParams, AvnuWrapper, BaseAdapter, BaseStrategy, type CLVaultStrategySettings, CommonAdapter, type CommonAdapterConfig, ContractAddr, type DecreaseLeverParams, Deployer, type DualActionAmount, type DualTokenInfo, ERC20, type EkuboBounds, EkuboCLVault, EkuboCLVaultStrategies, type EkuboPoolKey, type EkuboQuote, EkuboQuoter, type EkuboRouteNode, type EkuboSplit, type FAQ, FatalError, type FlashloanCallParams, FlowChartColors, type GenerateCallFn, Global, HyperLSTStrategies, type IConfig, type IInvestmentFlow, ILending, type ILendingMetadata, type ILendingPosition, type IProtocol, type IStrategyMetadata, type IncreaseLeverParams, Initializable, type LeafAdapterFn, type LeafData, type LendingToken, type ManageCall, MarginType, Network, PasswordJsonCryptoUtil, Pragma, type PriceInfo, Pricer, PricerFromApi, PricerLST, PricerRedis, Protocols, type RequiredFields, type RequiredKeys, type RequiredStoreConfig, type RiskFactor, RiskType, type Route, type RouteNode, SenseiStrategies, SenseiVault, type SenseiVaultSettings, type SingleActionAmount, type SingleTokenInfo, StandardMerkleTree, type StandardMerkleTreeData, Store, type StoreConfig, type Swap, type SwapInfo, TelegramNotif, type TokenAmount, type TokenInfo, UNIVERSAL_ADAPTERS, UNIVERSAL_MANAGE_IDS, UniversalLstMultiplierStrategy, type UniversalManageCall, UniversalStrategies, UniversalStrategy, type UniversalStrategySettings, type VaultPosition, VesuAdapter, type VesuAdapterConfig, type VesuAmount, VesuAmountDenomination, VesuAmountType, type VesuDefiSpringRewardsCallParams, type VesuModifyDelegationCallParams, type VesuModifyPositionCallParams, type VesuMultiplyCallParams, VesuPools, VesuRebalance, type VesuRebalanceSettings, VesuRebalanceStrategies, Web3Number, ZkLend, assert, getAPIUsingHeadlessBrowser, getContractDetails, getDefaultStoreConfig, getMainnetConfig, getNoRiskTags, getRiskColor, getRiskExplaination, getTrovesEndpoint, highlightTextWithLinks, type i257, logger };
|
package/dist/index.js
CHANGED
|
@@ -54,6 +54,7 @@ __export(index_exports, {
|
|
|
54
54
|
Pragma: () => Pragma,
|
|
55
55
|
Pricer: () => Pricer,
|
|
56
56
|
PricerFromApi: () => PricerFromApi,
|
|
57
|
+
PricerLST: () => PricerLST2,
|
|
57
58
|
PricerRedis: () => PricerRedis,
|
|
58
59
|
Protocols: () => Protocols,
|
|
59
60
|
RiskType: () => RiskType,
|
|
@@ -385,6 +386,17 @@ var defaultTokens = [{
|
|
|
385
386
|
symbol: "xtBTC",
|
|
386
387
|
logo: "https://assets.strkfarm.com/integrations/tokens/xtbtc.svg",
|
|
387
388
|
address: ContractAddr.from("0x43a35c1425a0125ef8c171f1a75c6f31ef8648edcc8324b55ce1917db3f9b91"),
|
|
389
|
+
decimals: 18,
|
|
390
|
+
coingeckId: void 0,
|
|
391
|
+
displayDecimals: 6,
|
|
392
|
+
priceProxySymbol: "WBTC",
|
|
393
|
+
priceCheckAmount: 1e-4
|
|
394
|
+
// 112000 * 0.0001 = $11.2
|
|
395
|
+
}, {
|
|
396
|
+
name: "xLBTC",
|
|
397
|
+
symbol: "xLBTC",
|
|
398
|
+
logo: "https://assets.strkfarm.com/integrations/tokens/xlbtc.svg",
|
|
399
|
+
address: ContractAddr.from("0x036834a40984312f7f7de8d31e3f6305b325389eaeea5b1c0664b2fb936461a4"),
|
|
388
400
|
decimals: 8,
|
|
389
401
|
coingeckId: void 0,
|
|
390
402
|
displayDecimals: 6,
|
|
@@ -988,7 +1000,7 @@ var PricerFromApi = class extends PricerBase {
|
|
|
988
1000
|
}
|
|
989
1001
|
async getPriceFromMyAPI(tokenSymbol) {
|
|
990
1002
|
logger.verbose(`getPrice from redis: ${tokenSymbol}`);
|
|
991
|
-
const endpoint = "https://
|
|
1003
|
+
const endpoint = "https://cache-server-t2me.onrender.com";
|
|
992
1004
|
const url = `${endpoint}/api/price/${tokenSymbol}`;
|
|
993
1005
|
const priceInfoRes = await fetch(url);
|
|
994
1006
|
const priceInfo = await priceInfoRes.json();
|
|
@@ -16687,6 +16699,29 @@ var lstStrategies = [
|
|
|
16687
16699
|
points: [],
|
|
16688
16700
|
contractDetails: [],
|
|
16689
16701
|
investmentSteps: []
|
|
16702
|
+
},
|
|
16703
|
+
{
|
|
16704
|
+
...xSTRKSTRK,
|
|
16705
|
+
name: "Ekubo xLBTC/LBTC",
|
|
16706
|
+
description: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, {}),
|
|
16707
|
+
address: ContractAddr.from(
|
|
16708
|
+
"0x315a614603b1f702e466aedcbcb1ad97a77eb1192b8bd077e5154d4f2ee4fab"
|
|
16709
|
+
),
|
|
16710
|
+
launchBlock: 2344809,
|
|
16711
|
+
// must be same order as poolKey token0 and token1
|
|
16712
|
+
depositTokens: [
|
|
16713
|
+
Global.getDefaultTokens().find((t) => t.symbol === "LBTC"),
|
|
16714
|
+
Global.getDefaultTokens().find((t) => t.symbol === "xLBTC")
|
|
16715
|
+
],
|
|
16716
|
+
additionalInfo: {
|
|
16717
|
+
...xSTRKSTRK.additionalInfo,
|
|
16718
|
+
quoteAsset: Global.getDefaultTokens().find((t) => t.symbol === "LBTC"),
|
|
16719
|
+
lstContract: Global.getDefaultTokens().find((t) => t.symbol === "xLBTC").address
|
|
16720
|
+
},
|
|
16721
|
+
faqs: getLSTFAQs("xLBTC"),
|
|
16722
|
+
points: [],
|
|
16723
|
+
contractDetails: [],
|
|
16724
|
+
investmentSteps: []
|
|
16690
16725
|
}
|
|
16691
16726
|
];
|
|
16692
16727
|
var ETHUSDCRe7Strategy = {
|
|
@@ -24689,6 +24724,15 @@ var UniversalStrategy = class _UniversalStrategy extends BaseStrategy {
|
|
|
24689
24724
|
* @returns {Promise<number>} The weighted average APY across all pools
|
|
24690
24725
|
*/
|
|
24691
24726
|
async netAPY() {
|
|
24727
|
+
if (this.metadata.isPreview) {
|
|
24728
|
+
return { net: 0, splits: [{
|
|
24729
|
+
apy: 0,
|
|
24730
|
+
id: "base"
|
|
24731
|
+
}, {
|
|
24732
|
+
apy: 0,
|
|
24733
|
+
id: "defispring"
|
|
24734
|
+
}] };
|
|
24735
|
+
}
|
|
24692
24736
|
const prevAUM = await this.getPrevAUM();
|
|
24693
24737
|
const vesuAdapters = this.getVesuAdapters();
|
|
24694
24738
|
const allVesuPools = await VesuAdapter.getVesuPools();
|
|
@@ -24780,17 +24824,16 @@ var UniversalStrategy = class _UniversalStrategy extends BaseStrategy {
|
|
|
24780
24824
|
const legAUM = await adapter.getPositions(this.config);
|
|
24781
24825
|
const underlying = this.asset();
|
|
24782
24826
|
let vesuAum = Web3Number.fromWei("0", underlying.decimals);
|
|
24827
|
+
let tokenUnderlyingPrice = await this.pricer.getPrice(this.asset().symbol);
|
|
24783
24828
|
if (legAUM[0].token.address.eq(underlying.address)) {
|
|
24784
24829
|
vesuAum = vesuAum.plus(legAUM[0].amount);
|
|
24785
24830
|
} else {
|
|
24786
|
-
|
|
24787
|
-
vesuAum = vesuAum.plus(legAUM[1].usdValue / tokenPrice.price);
|
|
24831
|
+
vesuAum = vesuAum.plus(legAUM[1].usdValue / tokenUnderlyingPrice.price);
|
|
24788
24832
|
}
|
|
24789
24833
|
if (legAUM[1].token.address.eq(underlying.address)) {
|
|
24790
24834
|
vesuAum = vesuAum.minus(legAUM[1].amount);
|
|
24791
24835
|
} else {
|
|
24792
|
-
|
|
24793
|
-
vesuAum = vesuAum.minus(legAUM[1].usdValue / tokenPrice.price);
|
|
24836
|
+
vesuAum = vesuAum.minus(legAUM[1].usdValue / tokenUnderlyingPrice.price);
|
|
24794
24837
|
}
|
|
24795
24838
|
;
|
|
24796
24839
|
logger.verbose(`${this.getTag()} Vesu AUM: ${vesuAum}, legCollateral: ${legAUM[0].amount.toNumber()}, legDebt: ${legAUM[1].amount.toNumber()}`);
|
|
@@ -25547,9 +25590,9 @@ var UniversalLstMultiplierStrategy = class extends UniversalStrategy {
|
|
|
25547
25590
|
}
|
|
25548
25591
|
// not applicable for this strategy
|
|
25549
25592
|
// No rewards on collateral or borrowing of LST assets
|
|
25550
|
-
async getRewardsAUM(prevAum) {
|
|
25551
|
-
|
|
25552
|
-
}
|
|
25593
|
+
// protected async getRewardsAUM(prevAum: Web3Number): Promise<Web3Number> {
|
|
25594
|
+
// return Web3Number.fromWei("0", this.asset().decimals);
|
|
25595
|
+
// }
|
|
25553
25596
|
async getLSTDexPrice() {
|
|
25554
25597
|
const ekuboQuoter = new EkuboQuoter(this.config);
|
|
25555
25598
|
const lstTokenInfo = this.asset();
|
|
@@ -25581,12 +25624,12 @@ var UniversalLstMultiplierStrategy = class extends UniversalStrategy {
|
|
|
25581
25624
|
const collateralPrice = collateralisation[0].usdValue > 0 ? collateralisation[0].usdValue / existingCollateralInfo.amount.toNumber() : 1;
|
|
25582
25625
|
const debtPrice = collateralisation[1].usdValue > 0 ? collateralisation[1].usdValue / existingDebtInfo.amount.toNumber() : 1;
|
|
25583
25626
|
logger.debug(`${this.getTag()}::getVesuMultiplyCall collateralPrice: ${collateralPrice}, debtPrice: ${debtPrice}`);
|
|
25627
|
+
const dexPrice = await this.getLSTDexPrice();
|
|
25584
25628
|
const addedCollateral = params.leg1DepositAmount.multipliedBy(params.isDeposit ? 1 : -1);
|
|
25585
|
-
const DEXPrice = await this.getLSTDexPrice();
|
|
25586
25629
|
logger.verbose(`${this.getTag()}::getVesuMultiplyCall addedCollateral: ${addedCollateral}`);
|
|
25587
25630
|
const numeratorPart1 = existingCollateralInfo.amount.plus(addedCollateral).multipliedBy(collateralPrice).multipliedBy(legLTV);
|
|
25588
25631
|
const numeratorPart2 = existingDebtInfo.amount.multipliedBy(debtPrice).multipliedBy(this.metadata.additionalInfo.targetHealthFactor);
|
|
25589
|
-
const denominatorPart = this.metadata.additionalInfo.targetHealthFactor - legLTV /
|
|
25632
|
+
const denominatorPart = this.metadata.additionalInfo.targetHealthFactor - legLTV / dexPrice;
|
|
25590
25633
|
const x_debt_usd = numeratorPart1.minus(numeratorPart2).dividedBy(denominatorPart);
|
|
25591
25634
|
logger.verbose(`${this.getTag()}::getVesuMultiplyCall x_debt_usd: ${x_debt_usd}`);
|
|
25592
25635
|
logger.debug(`${this.getTag()}::getVesuMultiplyCall numeratorPart1: ${numeratorPart1}, numeratorPart2: ${numeratorPart2}, denominatorPart: ${denominatorPart}`);
|
|
@@ -25596,6 +25639,7 @@ var UniversalLstMultiplierStrategy = class extends UniversalStrategy {
|
|
|
25596
25639
|
return this.getModifyLeverCall({
|
|
25597
25640
|
marginAmount,
|
|
25598
25641
|
debtAmount,
|
|
25642
|
+
lstDexPriceInUnderlying: dexPrice,
|
|
25599
25643
|
isIncrease: debtAmount.greaterThan(0)
|
|
25600
25644
|
});
|
|
25601
25645
|
}
|
|
@@ -25637,8 +25681,8 @@ var UniversalLstMultiplierStrategy = class extends UniversalStrategy {
|
|
|
25637
25681
|
proofsIDs.push(STEP1_ID);
|
|
25638
25682
|
manageCalls.push(manageCall1);
|
|
25639
25683
|
}
|
|
25684
|
+
const lstDexPriceInUnderlying = params.lstDexPriceInUnderlying;
|
|
25640
25685
|
const ekuboQuoter = new EkuboQuoter(this.config);
|
|
25641
|
-
const lstPrice = await this.getLSTExchangeRate();
|
|
25642
25686
|
const marginSwap = [];
|
|
25643
25687
|
const MAX_SLIPPAGE = 0.01;
|
|
25644
25688
|
const fromToken = params.isIncrease ? lstUnderlyingTokenInfo : lstTokenInfo;
|
|
@@ -25651,8 +25695,8 @@ var UniversalLstMultiplierStrategy = class extends UniversalStrategy {
|
|
|
25651
25695
|
);
|
|
25652
25696
|
assert(leverSwapQuote.price_impact < MAX_SLIPPAGE, "getIncreaseLeverCall: Price impact is too high [Debt swap]");
|
|
25653
25697
|
const leverSwap = ekuboQuoter.getVesuMultiplyQuote(leverSwapQuote, fromToken, toToken);
|
|
25654
|
-
const minExpectedDebt = params.debtAmount.dividedBy(
|
|
25655
|
-
const maxUsedCollateral = params.debtAmount.abs().dividedBy(
|
|
25698
|
+
const minExpectedDebt = params.debtAmount.dividedBy(lstDexPriceInUnderlying).multipliedBy(1 - MAX_SLIPPAGE);
|
|
25699
|
+
const maxUsedCollateral = params.debtAmount.abs().dividedBy(lstDexPriceInUnderlying).multipliedBy(1 + MAX_SLIPPAGE);
|
|
25656
25700
|
const STEP2_ID = "switch_delegation_on" /* SWITCH_DELEGATION_ON */;
|
|
25657
25701
|
const manage2Info = this.getProofs(STEP2_ID);
|
|
25658
25702
|
const manageCall2 = manage2Info.callConstructor({
|
|
@@ -25817,6 +25861,50 @@ var hyperxSTRK = {
|
|
|
25817
25861
|
targetHealthFactor: 1.1,
|
|
25818
25862
|
minHealthFactor: 1.05
|
|
25819
25863
|
};
|
|
25864
|
+
var hyperxWBTC = {
|
|
25865
|
+
vaultAddress: ContractAddr.from("0x2da9d0f96a46b453f55604313785dc866424240b1c6811d13bef594343db818"),
|
|
25866
|
+
manager: ContractAddr.from("0x75866db44c81e6986f06035206ee9c7d15833ddb22d6a22c016cfb5c866a491"),
|
|
25867
|
+
vaultAllocator: ContractAddr.from("0x57b5c1bb457b5e840a2714ae53ada87d77be2f3fd33a59b4fe709ef20c020c1"),
|
|
25868
|
+
redeemRequestNFT: ContractAddr.from("0x7a5dc288325456f05e70e9616e16bc02ffbe448f4b89f80b47c0970b989c7c"),
|
|
25869
|
+
aumOracle: ContractAddr.from(""),
|
|
25870
|
+
leafAdapters: [],
|
|
25871
|
+
adapters: [],
|
|
25872
|
+
targetHealthFactor: 1.1,
|
|
25873
|
+
minHealthFactor: 1.05
|
|
25874
|
+
};
|
|
25875
|
+
var hyperxtBTC = {
|
|
25876
|
+
vaultAddress: ContractAddr.from("0x47d5f68477e5637ce0e56436c6b5eee5a354e6828995dae106b11a48679328"),
|
|
25877
|
+
manager: ContractAddr.from("0xc4cc3e08029a0ae076f5fdfca70575abb78d23c5cd1c49a957f7e697885401"),
|
|
25878
|
+
vaultAllocator: ContractAddr.from("0x50bbd4fe69f841ecb13b2619fe50ebfa4e8944671b5d0ebf7868fd80c61b31e"),
|
|
25879
|
+
redeemRequestNFT: ContractAddr.from("0xeac9032f02057779816e38a6cb9185d12d86b3aacc9949b96b36de359c1e3"),
|
|
25880
|
+
aumOracle: ContractAddr.from(""),
|
|
25881
|
+
leafAdapters: [],
|
|
25882
|
+
adapters: [],
|
|
25883
|
+
targetHealthFactor: 1.1,
|
|
25884
|
+
minHealthFactor: 1.05
|
|
25885
|
+
};
|
|
25886
|
+
var hyperxsBTC = {
|
|
25887
|
+
vaultAddress: ContractAddr.from("0x437ef1e7d0f100b2e070b7a65cafec0b2be31b0290776da8b4112f5473d8d9"),
|
|
25888
|
+
manager: ContractAddr.from("0xc9ac023090625b0be3f6532ca353f086746f9c09f939dbc1b2613f09e5f821"),
|
|
25889
|
+
vaultAllocator: ContractAddr.from("0x60c2d856936b975459a5b4eb28b8672d91f757bd76cebb6241f8d670185dc01"),
|
|
25890
|
+
redeemRequestNFT: ContractAddr.from("0x429e8ee8bc7ecd1ade72630d350a2e0f10f9a2507c45f188ba17fe8f2ab4cf3"),
|
|
25891
|
+
aumOracle: ContractAddr.from(""),
|
|
25892
|
+
leafAdapters: [],
|
|
25893
|
+
adapters: [],
|
|
25894
|
+
targetHealthFactor: 1.1,
|
|
25895
|
+
minHealthFactor: 1.05
|
|
25896
|
+
};
|
|
25897
|
+
var hyperxLBTC = {
|
|
25898
|
+
vaultAddress: ContractAddr.from("0x38e96a301428d204ab4553799aa386a0f14a5ef9b30a5830be1814e4fb8da1c"),
|
|
25899
|
+
manager: ContractAddr.from("0x18d376446d9df1f783e17aff1f21bac3d97aa3ba378e367742cdd744468ad35"),
|
|
25900
|
+
vaultAllocator: ContractAddr.from("0x3e98774ca0508505ba6d7f17d95ec391648f44f947b0d211241464a4f5b9b20"),
|
|
25901
|
+
redeemRequestNFT: ContractAddr.from("0x268017b4c8b2117ca0136d9a77e3666db44b143447566f0746ca0b1c9ab1e72"),
|
|
25902
|
+
aumOracle: ContractAddr.from("0x521a3f339c65e918e0d8a065b14baef1ea25676bb7fca1e0238ac47e20d7755"),
|
|
25903
|
+
leafAdapters: [],
|
|
25904
|
+
adapters: [],
|
|
25905
|
+
targetHealthFactor: 1.1,
|
|
25906
|
+
minHealthFactor: 1.05
|
|
25907
|
+
};
|
|
25820
25908
|
function getInvestmentSteps(lstSymbol, underlyingSymbol) {
|
|
25821
25909
|
return [
|
|
25822
25910
|
`Deposit ${underlyingSymbol} into the vault`,
|
|
@@ -25827,7 +25915,7 @@ function getInvestmentSteps(lstSymbol, underlyingSymbol) {
|
|
|
25827
25915
|
`If required, adjust leverage or re-allocate assets within LST pool on Vesu to optimize yield`
|
|
25828
25916
|
];
|
|
25829
25917
|
}
|
|
25830
|
-
function getStrategySettings(lstSymbol, underlyingSymbol, addresses) {
|
|
25918
|
+
function getStrategySettings(lstSymbol, underlyingSymbol, addresses, isPreview = false) {
|
|
25831
25919
|
return {
|
|
25832
25920
|
name: `Hyper ${lstSymbol}`,
|
|
25833
25921
|
description: getDescription2(lstSymbol),
|
|
@@ -25845,13 +25933,68 @@ function getStrategySettings(lstSymbol, underlyingSymbol, addresses) {
|
|
|
25845
25933
|
maxTVL: Web3Number.fromWei(0, 18),
|
|
25846
25934
|
contractDetails: getContractDetails(addresses),
|
|
25847
25935
|
faqs: getFAQs2(lstSymbol, underlyingSymbol),
|
|
25848
|
-
investmentSteps: getInvestmentSteps(lstSymbol, underlyingSymbol)
|
|
25936
|
+
investmentSteps: getInvestmentSteps(lstSymbol, underlyingSymbol),
|
|
25937
|
+
isPreview
|
|
25849
25938
|
};
|
|
25850
25939
|
}
|
|
25851
25940
|
var HyperLSTStrategies = [
|
|
25852
|
-
getStrategySettings("xSTRK", "STRK", hyperxSTRK)
|
|
25941
|
+
getStrategySettings("xSTRK", "STRK", hyperxSTRK, false),
|
|
25942
|
+
getStrategySettings("xWBTC", "WBTC", hyperxWBTC, true),
|
|
25943
|
+
getStrategySettings("xtBTC", "tBTC", hyperxtBTC, true),
|
|
25944
|
+
getStrategySettings("xsBTC", "solvBTC", hyperxsBTC, true),
|
|
25945
|
+
getStrategySettings("xLBTC", "LBTC", hyperxLBTC, true)
|
|
25853
25946
|
];
|
|
25854
25947
|
|
|
25948
|
+
// src/modules/pricer-lst.ts
|
|
25949
|
+
var import_axios7 = __toESM(require("axios"));
|
|
25950
|
+
var PricerLST2 = class extends Pricer {
|
|
25951
|
+
// e.g. xSTRK/STRK
|
|
25952
|
+
constructor(config, tokenMaps) {
|
|
25953
|
+
const refreshInterval = 5e3;
|
|
25954
|
+
const staleTime = 6e4;
|
|
25955
|
+
const allTokens = tokenMaps.map((map) => [map.lst, map.underlying]).flat();
|
|
25956
|
+
super(config, allTokens, refreshInterval, staleTime);
|
|
25957
|
+
this.EKUBO_API = "https://quoter-mainnet-api.ekubo.org/{{AMOUNT}}/{{TOKEN_ADDRESS}}/{{UNDERLYING_ADDRESS}}";
|
|
25958
|
+
this.tokenMaps = tokenMaps;
|
|
25959
|
+
}
|
|
25960
|
+
isUnderlying(token) {
|
|
25961
|
+
return this.tokenMaps.some((map) => map.underlying.address.eq(token.address));
|
|
25962
|
+
}
|
|
25963
|
+
getUnderlying(token) {
|
|
25964
|
+
return this.tokenMaps.find((map) => map.lst.address.eq(token.address)).underlying;
|
|
25965
|
+
}
|
|
25966
|
+
async _getPrice(token, defaultMethod = "all") {
|
|
25967
|
+
if (this.isUnderlying(token)) {
|
|
25968
|
+
return 1;
|
|
25969
|
+
}
|
|
25970
|
+
const methodToUse = this.methodToUse[token.symbol] || defaultMethod;
|
|
25971
|
+
logger.verbose(`Fetching price of ${token.symbol} using ${methodToUse}`);
|
|
25972
|
+
try {
|
|
25973
|
+
const result = await this._getPriceEkubo(token, new Web3Number(token.priceCheckAmount ? token.priceCheckAmount : 1, token.decimals));
|
|
25974
|
+
this.methodToUse[token.symbol] = "Ekubo";
|
|
25975
|
+
return result;
|
|
25976
|
+
} catch (error) {
|
|
25977
|
+
console.warn(`Ekubo: price err [${token.symbol}]: `, error.message);
|
|
25978
|
+
console.warn(`Ekubo: price err [${token.symbol}]: `, Object.keys(error));
|
|
25979
|
+
}
|
|
25980
|
+
throw new FatalError(`Price not found for ${token.symbol}`);
|
|
25981
|
+
}
|
|
25982
|
+
async _getPriceEkubo(token, amountIn = new Web3Number(1, token.decimals), retry = 0) {
|
|
25983
|
+
const underlying = this.getUnderlying(token);
|
|
25984
|
+
const url = this.EKUBO_API.replace("{{TOKEN_ADDRESS}}", token.address.toString()).replace("{{AMOUNT}}", amountIn.toWei()).replace("{{UNDERLYING_ADDRESS}}", underlying.address.toString());
|
|
25985
|
+
const result = await import_axios7.default.get(url);
|
|
25986
|
+
const data = result.data;
|
|
25987
|
+
const multiplier = 1 / amountIn.toNumber();
|
|
25988
|
+
const outputUnderlying = Number(Web3Number.fromWei(data.total_calculated, underlying.decimals).toFixed(6)) * multiplier;
|
|
25989
|
+
logger.verbose(`Ekubo: ${token.symbol} -> ${underlying.symbol}: ${outputUnderlying}, retry: ${retry}`);
|
|
25990
|
+
if (outputUnderlying === 0 && retry < 3) {
|
|
25991
|
+
const amountIn2 = new Web3Number(100, token.decimals);
|
|
25992
|
+
return await this._getPriceEkubo(token, amountIn2, retry + 1);
|
|
25993
|
+
}
|
|
25994
|
+
return outputUnderlying;
|
|
25995
|
+
}
|
|
25996
|
+
};
|
|
25997
|
+
|
|
25855
25998
|
// src/notifs/telegram.ts
|
|
25856
25999
|
var import_node_telegram_bot_api = __toESM(require("node-telegram-bot-api"));
|
|
25857
26000
|
var TelegramNotif = class {
|
|
@@ -26299,6 +26442,7 @@ var deployer_default = Deployer;
|
|
|
26299
26442
|
Pragma,
|
|
26300
26443
|
Pricer,
|
|
26301
26444
|
PricerFromApi,
|
|
26445
|
+
PricerLST,
|
|
26302
26446
|
PricerRedis,
|
|
26303
26447
|
Protocols,
|
|
26304
26448
|
RiskType,
|
package/dist/index.mjs
CHANGED
|
@@ -294,6 +294,17 @@ var defaultTokens = [{
|
|
|
294
294
|
symbol: "xtBTC",
|
|
295
295
|
logo: "https://assets.strkfarm.com/integrations/tokens/xtbtc.svg",
|
|
296
296
|
address: ContractAddr.from("0x43a35c1425a0125ef8c171f1a75c6f31ef8648edcc8324b55ce1917db3f9b91"),
|
|
297
|
+
decimals: 18,
|
|
298
|
+
coingeckId: void 0,
|
|
299
|
+
displayDecimals: 6,
|
|
300
|
+
priceProxySymbol: "WBTC",
|
|
301
|
+
priceCheckAmount: 1e-4
|
|
302
|
+
// 112000 * 0.0001 = $11.2
|
|
303
|
+
}, {
|
|
304
|
+
name: "xLBTC",
|
|
305
|
+
symbol: "xLBTC",
|
|
306
|
+
logo: "https://assets.strkfarm.com/integrations/tokens/xlbtc.svg",
|
|
307
|
+
address: ContractAddr.from("0x036834a40984312f7f7de8d31e3f6305b325389eaeea5b1c0664b2fb936461a4"),
|
|
297
308
|
decimals: 8,
|
|
298
309
|
coingeckId: void 0,
|
|
299
310
|
displayDecimals: 6,
|
|
@@ -897,7 +908,7 @@ var PricerFromApi = class extends PricerBase {
|
|
|
897
908
|
}
|
|
898
909
|
async getPriceFromMyAPI(tokenSymbol) {
|
|
899
910
|
logger.verbose(`getPrice from redis: ${tokenSymbol}`);
|
|
900
|
-
const endpoint = "https://
|
|
911
|
+
const endpoint = "https://cache-server-t2me.onrender.com";
|
|
901
912
|
const url = `${endpoint}/api/price/${tokenSymbol}`;
|
|
902
913
|
const priceInfoRes = await fetch(url);
|
|
903
914
|
const priceInfo = await priceInfoRes.json();
|
|
@@ -16600,6 +16611,29 @@ var lstStrategies = [
|
|
|
16600
16611
|
points: [],
|
|
16601
16612
|
contractDetails: [],
|
|
16602
16613
|
investmentSteps: []
|
|
16614
|
+
},
|
|
16615
|
+
{
|
|
16616
|
+
...xSTRKSTRK,
|
|
16617
|
+
name: "Ekubo xLBTC/LBTC",
|
|
16618
|
+
description: /* @__PURE__ */ jsx3(Fragment2, {}),
|
|
16619
|
+
address: ContractAddr.from(
|
|
16620
|
+
"0x315a614603b1f702e466aedcbcb1ad97a77eb1192b8bd077e5154d4f2ee4fab"
|
|
16621
|
+
),
|
|
16622
|
+
launchBlock: 2344809,
|
|
16623
|
+
// must be same order as poolKey token0 and token1
|
|
16624
|
+
depositTokens: [
|
|
16625
|
+
Global.getDefaultTokens().find((t) => t.symbol === "LBTC"),
|
|
16626
|
+
Global.getDefaultTokens().find((t) => t.symbol === "xLBTC")
|
|
16627
|
+
],
|
|
16628
|
+
additionalInfo: {
|
|
16629
|
+
...xSTRKSTRK.additionalInfo,
|
|
16630
|
+
quoteAsset: Global.getDefaultTokens().find((t) => t.symbol === "LBTC"),
|
|
16631
|
+
lstContract: Global.getDefaultTokens().find((t) => t.symbol === "xLBTC").address
|
|
16632
|
+
},
|
|
16633
|
+
faqs: getLSTFAQs("xLBTC"),
|
|
16634
|
+
points: [],
|
|
16635
|
+
contractDetails: [],
|
|
16636
|
+
investmentSteps: []
|
|
16603
16637
|
}
|
|
16604
16638
|
];
|
|
16605
16639
|
var ETHUSDCRe7Strategy = {
|
|
@@ -24602,6 +24636,15 @@ var UniversalStrategy = class _UniversalStrategy extends BaseStrategy {
|
|
|
24602
24636
|
* @returns {Promise<number>} The weighted average APY across all pools
|
|
24603
24637
|
*/
|
|
24604
24638
|
async netAPY() {
|
|
24639
|
+
if (this.metadata.isPreview) {
|
|
24640
|
+
return { net: 0, splits: [{
|
|
24641
|
+
apy: 0,
|
|
24642
|
+
id: "base"
|
|
24643
|
+
}, {
|
|
24644
|
+
apy: 0,
|
|
24645
|
+
id: "defispring"
|
|
24646
|
+
}] };
|
|
24647
|
+
}
|
|
24605
24648
|
const prevAUM = await this.getPrevAUM();
|
|
24606
24649
|
const vesuAdapters = this.getVesuAdapters();
|
|
24607
24650
|
const allVesuPools = await VesuAdapter.getVesuPools();
|
|
@@ -24693,17 +24736,16 @@ var UniversalStrategy = class _UniversalStrategy extends BaseStrategy {
|
|
|
24693
24736
|
const legAUM = await adapter.getPositions(this.config);
|
|
24694
24737
|
const underlying = this.asset();
|
|
24695
24738
|
let vesuAum = Web3Number.fromWei("0", underlying.decimals);
|
|
24739
|
+
let tokenUnderlyingPrice = await this.pricer.getPrice(this.asset().symbol);
|
|
24696
24740
|
if (legAUM[0].token.address.eq(underlying.address)) {
|
|
24697
24741
|
vesuAum = vesuAum.plus(legAUM[0].amount);
|
|
24698
24742
|
} else {
|
|
24699
|
-
|
|
24700
|
-
vesuAum = vesuAum.plus(legAUM[1].usdValue / tokenPrice.price);
|
|
24743
|
+
vesuAum = vesuAum.plus(legAUM[1].usdValue / tokenUnderlyingPrice.price);
|
|
24701
24744
|
}
|
|
24702
24745
|
if (legAUM[1].token.address.eq(underlying.address)) {
|
|
24703
24746
|
vesuAum = vesuAum.minus(legAUM[1].amount);
|
|
24704
24747
|
} else {
|
|
24705
|
-
|
|
24706
|
-
vesuAum = vesuAum.minus(legAUM[1].usdValue / tokenPrice.price);
|
|
24748
|
+
vesuAum = vesuAum.minus(legAUM[1].usdValue / tokenUnderlyingPrice.price);
|
|
24707
24749
|
}
|
|
24708
24750
|
;
|
|
24709
24751
|
logger.verbose(`${this.getTag()} Vesu AUM: ${vesuAum}, legCollateral: ${legAUM[0].amount.toNumber()}, legDebt: ${legAUM[1].amount.toNumber()}`);
|
|
@@ -25460,9 +25502,9 @@ var UniversalLstMultiplierStrategy = class extends UniversalStrategy {
|
|
|
25460
25502
|
}
|
|
25461
25503
|
// not applicable for this strategy
|
|
25462
25504
|
// No rewards on collateral or borrowing of LST assets
|
|
25463
|
-
async getRewardsAUM(prevAum) {
|
|
25464
|
-
|
|
25465
|
-
}
|
|
25505
|
+
// protected async getRewardsAUM(prevAum: Web3Number): Promise<Web3Number> {
|
|
25506
|
+
// return Web3Number.fromWei("0", this.asset().decimals);
|
|
25507
|
+
// }
|
|
25466
25508
|
async getLSTDexPrice() {
|
|
25467
25509
|
const ekuboQuoter = new EkuboQuoter(this.config);
|
|
25468
25510
|
const lstTokenInfo = this.asset();
|
|
@@ -25494,12 +25536,12 @@ var UniversalLstMultiplierStrategy = class extends UniversalStrategy {
|
|
|
25494
25536
|
const collateralPrice = collateralisation[0].usdValue > 0 ? collateralisation[0].usdValue / existingCollateralInfo.amount.toNumber() : 1;
|
|
25495
25537
|
const debtPrice = collateralisation[1].usdValue > 0 ? collateralisation[1].usdValue / existingDebtInfo.amount.toNumber() : 1;
|
|
25496
25538
|
logger.debug(`${this.getTag()}::getVesuMultiplyCall collateralPrice: ${collateralPrice}, debtPrice: ${debtPrice}`);
|
|
25539
|
+
const dexPrice = await this.getLSTDexPrice();
|
|
25497
25540
|
const addedCollateral = params.leg1DepositAmount.multipliedBy(params.isDeposit ? 1 : -1);
|
|
25498
|
-
const DEXPrice = await this.getLSTDexPrice();
|
|
25499
25541
|
logger.verbose(`${this.getTag()}::getVesuMultiplyCall addedCollateral: ${addedCollateral}`);
|
|
25500
25542
|
const numeratorPart1 = existingCollateralInfo.amount.plus(addedCollateral).multipliedBy(collateralPrice).multipliedBy(legLTV);
|
|
25501
25543
|
const numeratorPart2 = existingDebtInfo.amount.multipliedBy(debtPrice).multipliedBy(this.metadata.additionalInfo.targetHealthFactor);
|
|
25502
|
-
const denominatorPart = this.metadata.additionalInfo.targetHealthFactor - legLTV /
|
|
25544
|
+
const denominatorPart = this.metadata.additionalInfo.targetHealthFactor - legLTV / dexPrice;
|
|
25503
25545
|
const x_debt_usd = numeratorPart1.minus(numeratorPart2).dividedBy(denominatorPart);
|
|
25504
25546
|
logger.verbose(`${this.getTag()}::getVesuMultiplyCall x_debt_usd: ${x_debt_usd}`);
|
|
25505
25547
|
logger.debug(`${this.getTag()}::getVesuMultiplyCall numeratorPart1: ${numeratorPart1}, numeratorPart2: ${numeratorPart2}, denominatorPart: ${denominatorPart}`);
|
|
@@ -25509,6 +25551,7 @@ var UniversalLstMultiplierStrategy = class extends UniversalStrategy {
|
|
|
25509
25551
|
return this.getModifyLeverCall({
|
|
25510
25552
|
marginAmount,
|
|
25511
25553
|
debtAmount,
|
|
25554
|
+
lstDexPriceInUnderlying: dexPrice,
|
|
25512
25555
|
isIncrease: debtAmount.greaterThan(0)
|
|
25513
25556
|
});
|
|
25514
25557
|
}
|
|
@@ -25550,8 +25593,8 @@ var UniversalLstMultiplierStrategy = class extends UniversalStrategy {
|
|
|
25550
25593
|
proofsIDs.push(STEP1_ID);
|
|
25551
25594
|
manageCalls.push(manageCall1);
|
|
25552
25595
|
}
|
|
25596
|
+
const lstDexPriceInUnderlying = params.lstDexPriceInUnderlying;
|
|
25553
25597
|
const ekuboQuoter = new EkuboQuoter(this.config);
|
|
25554
|
-
const lstPrice = await this.getLSTExchangeRate();
|
|
25555
25598
|
const marginSwap = [];
|
|
25556
25599
|
const MAX_SLIPPAGE = 0.01;
|
|
25557
25600
|
const fromToken = params.isIncrease ? lstUnderlyingTokenInfo : lstTokenInfo;
|
|
@@ -25564,8 +25607,8 @@ var UniversalLstMultiplierStrategy = class extends UniversalStrategy {
|
|
|
25564
25607
|
);
|
|
25565
25608
|
assert(leverSwapQuote.price_impact < MAX_SLIPPAGE, "getIncreaseLeverCall: Price impact is too high [Debt swap]");
|
|
25566
25609
|
const leverSwap = ekuboQuoter.getVesuMultiplyQuote(leverSwapQuote, fromToken, toToken);
|
|
25567
|
-
const minExpectedDebt = params.debtAmount.dividedBy(
|
|
25568
|
-
const maxUsedCollateral = params.debtAmount.abs().dividedBy(
|
|
25610
|
+
const minExpectedDebt = params.debtAmount.dividedBy(lstDexPriceInUnderlying).multipliedBy(1 - MAX_SLIPPAGE);
|
|
25611
|
+
const maxUsedCollateral = params.debtAmount.abs().dividedBy(lstDexPriceInUnderlying).multipliedBy(1 + MAX_SLIPPAGE);
|
|
25569
25612
|
const STEP2_ID = "switch_delegation_on" /* SWITCH_DELEGATION_ON */;
|
|
25570
25613
|
const manage2Info = this.getProofs(STEP2_ID);
|
|
25571
25614
|
const manageCall2 = manage2Info.callConstructor({
|
|
@@ -25730,6 +25773,50 @@ var hyperxSTRK = {
|
|
|
25730
25773
|
targetHealthFactor: 1.1,
|
|
25731
25774
|
minHealthFactor: 1.05
|
|
25732
25775
|
};
|
|
25776
|
+
var hyperxWBTC = {
|
|
25777
|
+
vaultAddress: ContractAddr.from("0x2da9d0f96a46b453f55604313785dc866424240b1c6811d13bef594343db818"),
|
|
25778
|
+
manager: ContractAddr.from("0x75866db44c81e6986f06035206ee9c7d15833ddb22d6a22c016cfb5c866a491"),
|
|
25779
|
+
vaultAllocator: ContractAddr.from("0x57b5c1bb457b5e840a2714ae53ada87d77be2f3fd33a59b4fe709ef20c020c1"),
|
|
25780
|
+
redeemRequestNFT: ContractAddr.from("0x7a5dc288325456f05e70e9616e16bc02ffbe448f4b89f80b47c0970b989c7c"),
|
|
25781
|
+
aumOracle: ContractAddr.from(""),
|
|
25782
|
+
leafAdapters: [],
|
|
25783
|
+
adapters: [],
|
|
25784
|
+
targetHealthFactor: 1.1,
|
|
25785
|
+
minHealthFactor: 1.05
|
|
25786
|
+
};
|
|
25787
|
+
var hyperxtBTC = {
|
|
25788
|
+
vaultAddress: ContractAddr.from("0x47d5f68477e5637ce0e56436c6b5eee5a354e6828995dae106b11a48679328"),
|
|
25789
|
+
manager: ContractAddr.from("0xc4cc3e08029a0ae076f5fdfca70575abb78d23c5cd1c49a957f7e697885401"),
|
|
25790
|
+
vaultAllocator: ContractAddr.from("0x50bbd4fe69f841ecb13b2619fe50ebfa4e8944671b5d0ebf7868fd80c61b31e"),
|
|
25791
|
+
redeemRequestNFT: ContractAddr.from("0xeac9032f02057779816e38a6cb9185d12d86b3aacc9949b96b36de359c1e3"),
|
|
25792
|
+
aumOracle: ContractAddr.from(""),
|
|
25793
|
+
leafAdapters: [],
|
|
25794
|
+
adapters: [],
|
|
25795
|
+
targetHealthFactor: 1.1,
|
|
25796
|
+
minHealthFactor: 1.05
|
|
25797
|
+
};
|
|
25798
|
+
var hyperxsBTC = {
|
|
25799
|
+
vaultAddress: ContractAddr.from("0x437ef1e7d0f100b2e070b7a65cafec0b2be31b0290776da8b4112f5473d8d9"),
|
|
25800
|
+
manager: ContractAddr.from("0xc9ac023090625b0be3f6532ca353f086746f9c09f939dbc1b2613f09e5f821"),
|
|
25801
|
+
vaultAllocator: ContractAddr.from("0x60c2d856936b975459a5b4eb28b8672d91f757bd76cebb6241f8d670185dc01"),
|
|
25802
|
+
redeemRequestNFT: ContractAddr.from("0x429e8ee8bc7ecd1ade72630d350a2e0f10f9a2507c45f188ba17fe8f2ab4cf3"),
|
|
25803
|
+
aumOracle: ContractAddr.from(""),
|
|
25804
|
+
leafAdapters: [],
|
|
25805
|
+
adapters: [],
|
|
25806
|
+
targetHealthFactor: 1.1,
|
|
25807
|
+
minHealthFactor: 1.05
|
|
25808
|
+
};
|
|
25809
|
+
var hyperxLBTC = {
|
|
25810
|
+
vaultAddress: ContractAddr.from("0x38e96a301428d204ab4553799aa386a0f14a5ef9b30a5830be1814e4fb8da1c"),
|
|
25811
|
+
manager: ContractAddr.from("0x18d376446d9df1f783e17aff1f21bac3d97aa3ba378e367742cdd744468ad35"),
|
|
25812
|
+
vaultAllocator: ContractAddr.from("0x3e98774ca0508505ba6d7f17d95ec391648f44f947b0d211241464a4f5b9b20"),
|
|
25813
|
+
redeemRequestNFT: ContractAddr.from("0x268017b4c8b2117ca0136d9a77e3666db44b143447566f0746ca0b1c9ab1e72"),
|
|
25814
|
+
aumOracle: ContractAddr.from("0x521a3f339c65e918e0d8a065b14baef1ea25676bb7fca1e0238ac47e20d7755"),
|
|
25815
|
+
leafAdapters: [],
|
|
25816
|
+
adapters: [],
|
|
25817
|
+
targetHealthFactor: 1.1,
|
|
25818
|
+
minHealthFactor: 1.05
|
|
25819
|
+
};
|
|
25733
25820
|
function getInvestmentSteps(lstSymbol, underlyingSymbol) {
|
|
25734
25821
|
return [
|
|
25735
25822
|
`Deposit ${underlyingSymbol} into the vault`,
|
|
@@ -25740,7 +25827,7 @@ function getInvestmentSteps(lstSymbol, underlyingSymbol) {
|
|
|
25740
25827
|
`If required, adjust leverage or re-allocate assets within LST pool on Vesu to optimize yield`
|
|
25741
25828
|
];
|
|
25742
25829
|
}
|
|
25743
|
-
function getStrategySettings(lstSymbol, underlyingSymbol, addresses) {
|
|
25830
|
+
function getStrategySettings(lstSymbol, underlyingSymbol, addresses, isPreview = false) {
|
|
25744
25831
|
return {
|
|
25745
25832
|
name: `Hyper ${lstSymbol}`,
|
|
25746
25833
|
description: getDescription2(lstSymbol),
|
|
@@ -25758,13 +25845,68 @@ function getStrategySettings(lstSymbol, underlyingSymbol, addresses) {
|
|
|
25758
25845
|
maxTVL: Web3Number.fromWei(0, 18),
|
|
25759
25846
|
contractDetails: getContractDetails(addresses),
|
|
25760
25847
|
faqs: getFAQs2(lstSymbol, underlyingSymbol),
|
|
25761
|
-
investmentSteps: getInvestmentSteps(lstSymbol, underlyingSymbol)
|
|
25848
|
+
investmentSteps: getInvestmentSteps(lstSymbol, underlyingSymbol),
|
|
25849
|
+
isPreview
|
|
25762
25850
|
};
|
|
25763
25851
|
}
|
|
25764
25852
|
var HyperLSTStrategies = [
|
|
25765
|
-
getStrategySettings("xSTRK", "STRK", hyperxSTRK)
|
|
25853
|
+
getStrategySettings("xSTRK", "STRK", hyperxSTRK, false),
|
|
25854
|
+
getStrategySettings("xWBTC", "WBTC", hyperxWBTC, true),
|
|
25855
|
+
getStrategySettings("xtBTC", "tBTC", hyperxtBTC, true),
|
|
25856
|
+
getStrategySettings("xsBTC", "solvBTC", hyperxsBTC, true),
|
|
25857
|
+
getStrategySettings("xLBTC", "LBTC", hyperxLBTC, true)
|
|
25766
25858
|
];
|
|
25767
25859
|
|
|
25860
|
+
// src/modules/pricer-lst.ts
|
|
25861
|
+
import axios7 from "axios";
|
|
25862
|
+
var PricerLST2 = class extends Pricer {
|
|
25863
|
+
// e.g. xSTRK/STRK
|
|
25864
|
+
constructor(config, tokenMaps) {
|
|
25865
|
+
const refreshInterval = 5e3;
|
|
25866
|
+
const staleTime = 6e4;
|
|
25867
|
+
const allTokens = tokenMaps.map((map) => [map.lst, map.underlying]).flat();
|
|
25868
|
+
super(config, allTokens, refreshInterval, staleTime);
|
|
25869
|
+
this.EKUBO_API = "https://quoter-mainnet-api.ekubo.org/{{AMOUNT}}/{{TOKEN_ADDRESS}}/{{UNDERLYING_ADDRESS}}";
|
|
25870
|
+
this.tokenMaps = tokenMaps;
|
|
25871
|
+
}
|
|
25872
|
+
isUnderlying(token) {
|
|
25873
|
+
return this.tokenMaps.some((map) => map.underlying.address.eq(token.address));
|
|
25874
|
+
}
|
|
25875
|
+
getUnderlying(token) {
|
|
25876
|
+
return this.tokenMaps.find((map) => map.lst.address.eq(token.address)).underlying;
|
|
25877
|
+
}
|
|
25878
|
+
async _getPrice(token, defaultMethod = "all") {
|
|
25879
|
+
if (this.isUnderlying(token)) {
|
|
25880
|
+
return 1;
|
|
25881
|
+
}
|
|
25882
|
+
const methodToUse = this.methodToUse[token.symbol] || defaultMethod;
|
|
25883
|
+
logger.verbose(`Fetching price of ${token.symbol} using ${methodToUse}`);
|
|
25884
|
+
try {
|
|
25885
|
+
const result = await this._getPriceEkubo(token, new Web3Number(token.priceCheckAmount ? token.priceCheckAmount : 1, token.decimals));
|
|
25886
|
+
this.methodToUse[token.symbol] = "Ekubo";
|
|
25887
|
+
return result;
|
|
25888
|
+
} catch (error) {
|
|
25889
|
+
console.warn(`Ekubo: price err [${token.symbol}]: `, error.message);
|
|
25890
|
+
console.warn(`Ekubo: price err [${token.symbol}]: `, Object.keys(error));
|
|
25891
|
+
}
|
|
25892
|
+
throw new FatalError(`Price not found for ${token.symbol}`);
|
|
25893
|
+
}
|
|
25894
|
+
async _getPriceEkubo(token, amountIn = new Web3Number(1, token.decimals), retry = 0) {
|
|
25895
|
+
const underlying = this.getUnderlying(token);
|
|
25896
|
+
const url = this.EKUBO_API.replace("{{TOKEN_ADDRESS}}", token.address.toString()).replace("{{AMOUNT}}", amountIn.toWei()).replace("{{UNDERLYING_ADDRESS}}", underlying.address.toString());
|
|
25897
|
+
const result = await axios7.get(url);
|
|
25898
|
+
const data = result.data;
|
|
25899
|
+
const multiplier = 1 / amountIn.toNumber();
|
|
25900
|
+
const outputUnderlying = Number(Web3Number.fromWei(data.total_calculated, underlying.decimals).toFixed(6)) * multiplier;
|
|
25901
|
+
logger.verbose(`Ekubo: ${token.symbol} -> ${underlying.symbol}: ${outputUnderlying}, retry: ${retry}`);
|
|
25902
|
+
if (outputUnderlying === 0 && retry < 3) {
|
|
25903
|
+
const amountIn2 = new Web3Number(100, token.decimals);
|
|
25904
|
+
return await this._getPriceEkubo(token, amountIn2, retry + 1);
|
|
25905
|
+
}
|
|
25906
|
+
return outputUnderlying;
|
|
25907
|
+
}
|
|
25908
|
+
};
|
|
25909
|
+
|
|
25768
25910
|
// src/notifs/telegram.ts
|
|
25769
25911
|
import TelegramBot from "node-telegram-bot-api";
|
|
25770
25912
|
var TelegramNotif = class {
|
|
@@ -26211,6 +26353,7 @@ export {
|
|
|
26211
26353
|
Pragma,
|
|
26212
26354
|
Pricer,
|
|
26213
26355
|
PricerFromApi,
|
|
26356
|
+
PricerLST2 as PricerLST,
|
|
26214
26357
|
PricerRedis,
|
|
26215
26358
|
Protocols,
|
|
26216
26359
|
RiskType,
|