@strkfarm/sdk 2.0.0-staging.22 → 2.0.0-staging.25
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 +912 -322
- package/dist/index.browser.mjs +836 -246
- package/dist/index.d.ts +24 -4
- package/dist/index.js +837 -246
- package/dist/index.mjs +836 -246
- package/package.json +1 -1
- package/src/interfaces/common.tsx +1 -0
- package/src/strategies/ekubo-cl-vault.tsx +2 -0
- package/src/strategies/index.ts +1 -0
- package/src/strategies/types.ts +4 -0
- package/src/strategies/universal-lst-muliplier-strategy.tsx +1385 -558
- package/src/strategies/universal-strategy.tsx +7 -4
package/dist/index.js
CHANGED
|
@@ -56,6 +56,7 @@ __export(index_exports, {
|
|
|
56
56
|
Initializable: () => Initializable,
|
|
57
57
|
InstantWithdrawalVault: () => InstantWithdrawalVault,
|
|
58
58
|
LSTAPRService: () => LSTAPRService,
|
|
59
|
+
LSTPriceType: () => LSTPriceType,
|
|
59
60
|
MarginType: () => MarginType,
|
|
60
61
|
MyNumber: () => MyNumber,
|
|
61
62
|
Network: () => Network,
|
|
@@ -17998,6 +17999,7 @@ var xSTRKSTRK = {
|
|
|
17998
17999
|
notARisks: getNoRiskTags(_lstPoolRiskFactors)
|
|
17999
18000
|
},
|
|
18000
18001
|
apyMethodology: "APY based on 30-day historical performance, including fees and rewards.",
|
|
18002
|
+
realizedAPYMethodology: "The realizedAPY is based on past 14 days performance by the vault",
|
|
18001
18003
|
additionalInfo: {
|
|
18002
18004
|
newBounds: {
|
|
18003
18005
|
lower: -1,
|
|
@@ -18150,6 +18152,7 @@ var createLSTStrategy = (params) => ({
|
|
|
18150
18152
|
),
|
|
18151
18153
|
Global.getDefaultTokens().find((t) => t.symbol === params.depositToken1Symbol)
|
|
18152
18154
|
],
|
|
18155
|
+
realizedAPYMethodology: "The realizedAPY is based on past 14 days performance by the vault",
|
|
18153
18156
|
additionalInfo: {
|
|
18154
18157
|
...xSTRKSTRK.additionalInfo,
|
|
18155
18158
|
quoteAsset: Global.getDefaultTokens().find(
|
|
@@ -31077,6 +31080,13 @@ var vault_manager_abi_default = [
|
|
|
31077
31080
|
}
|
|
31078
31081
|
];
|
|
31079
31082
|
|
|
31083
|
+
// src/strategies/types.ts
|
|
31084
|
+
var LSTPriceType = /* @__PURE__ */ ((LSTPriceType2) => {
|
|
31085
|
+
LSTPriceType2["ENDUR_PRICE"] = "ENDUR_PRICE";
|
|
31086
|
+
LSTPriceType2["AVNU_PRICE"] = "AVNU_PRICE";
|
|
31087
|
+
return LSTPriceType2;
|
|
31088
|
+
})(LSTPriceType || {});
|
|
31089
|
+
|
|
31080
31090
|
// src/strategies/universal-strategy.tsx
|
|
31081
31091
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
31082
31092
|
var AUMTypes = /* @__PURE__ */ ((AUMTypes3) => {
|
|
@@ -31385,7 +31395,7 @@ var UniversalStrategy = class _UniversalStrategy extends BaseStrategy {
|
|
|
31385
31395
|
usdValue
|
|
31386
31396
|
};
|
|
31387
31397
|
}
|
|
31388
|
-
async getVesuAUM(adapter) {
|
|
31398
|
+
async getVesuAUM(adapter, _priceType) {
|
|
31389
31399
|
const legAUM = await adapter.getPositions(this.config);
|
|
31390
31400
|
const underlying = this.asset();
|
|
31391
31401
|
let vesuAum = Web3Number.fromWei("0", underlying.decimals);
|
|
@@ -31411,13 +31421,15 @@ var UniversalStrategy = class _UniversalStrategy extends BaseStrategy {
|
|
|
31411
31421
|
logger.verbose(`${this.getTag()} Prev AUM: ${prevAum}`);
|
|
31412
31422
|
return prevAum;
|
|
31413
31423
|
}
|
|
31414
|
-
async getAUM() {
|
|
31424
|
+
async getAUM(unrealizedAUM) {
|
|
31415
31425
|
const prevAum = await this.getPrevAUM();
|
|
31416
31426
|
const token1Price = await this.pricer.getPrice(this.metadata.depositTokens[0].symbol);
|
|
31417
31427
|
const vesuAdapters = this.getVesuAdapters();
|
|
31418
31428
|
let vesuAum = Web3Number.fromWei("0", this.asset().decimals);
|
|
31419
31429
|
for (const adapter of vesuAdapters) {
|
|
31420
|
-
|
|
31430
|
+
const priceType = unrealizedAUM ? "ENDUR_PRICE" /* ENDUR_PRICE */ : "AVNU_PRICE" /* AVNU_PRICE */;
|
|
31431
|
+
const aumValue = await this.getVesuAUM(adapter, priceType);
|
|
31432
|
+
vesuAum = vesuAum.plus(aumValue);
|
|
31421
31433
|
}
|
|
31422
31434
|
const balance = await this.getUnusedBalance();
|
|
31423
31435
|
logger.verbose(`${this.getTag()} unused balance: ${balance.amount.toNumber()}`);
|
|
@@ -31928,7 +31940,6 @@ function MetaVaultDescription(allowedSources) {
|
|
|
31928
31940
|
const containerStyle = {
|
|
31929
31941
|
maxWidth: "800px",
|
|
31930
31942
|
margin: "0 auto",
|
|
31931
|
-
backgroundColor: "#111",
|
|
31932
31943
|
color: "#eee",
|
|
31933
31944
|
fontFamily: "Arial, sans-serif",
|
|
31934
31945
|
borderRadius: "12px"
|
|
@@ -32121,6 +32132,7 @@ var createUniversalStrategy = (params) => ({
|
|
|
32121
32132
|
risk: getUniversalRisk(),
|
|
32122
32133
|
auditUrl: AUDIT_URL3,
|
|
32123
32134
|
protocols: [Protocols.VESU],
|
|
32135
|
+
realizedAPYMethodology: "The realizedAPY is based on past 14 days performance by the vault",
|
|
32124
32136
|
curator: {
|
|
32125
32137
|
name: "Unwrap Labs",
|
|
32126
32138
|
logo: "https://assets.troves.fi/integrations/unwraplabs/white.png"
|
|
@@ -32231,23 +32243,36 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
32231
32243
|
constructor(config, pricer, metadata) {
|
|
32232
32244
|
super(config, pricer, metadata);
|
|
32233
32245
|
this.quoteAmountToFetchPrice = new Web3Number(1, 18);
|
|
32234
|
-
const STRKToken = Global.getDefaultTokens().find(
|
|
32246
|
+
const STRKToken = Global.getDefaultTokens().find(
|
|
32247
|
+
(token) => token.symbol === "STRK"
|
|
32248
|
+
);
|
|
32235
32249
|
const underlyingToken = this.getLSTUnderlyingTokenInfo();
|
|
32236
32250
|
if (underlyingToken.address.eq(STRKToken.address)) {
|
|
32237
32251
|
this.quoteAmountToFetchPrice = new Web3Number(100, 18);
|
|
32238
32252
|
} else {
|
|
32239
|
-
this.quoteAmountToFetchPrice = new Web3Number(
|
|
32253
|
+
this.quoteAmountToFetchPrice = new Web3Number(
|
|
32254
|
+
0.01,
|
|
32255
|
+
this.asset().decimals
|
|
32256
|
+
);
|
|
32240
32257
|
}
|
|
32241
32258
|
}
|
|
32242
32259
|
asset() {
|
|
32243
|
-
return this.getVesuSameTokenAdapter(
|
|
32260
|
+
return this.getVesuSameTokenAdapter(
|
|
32261
|
+
this.metadata.additionalInfo.defaultPoolId
|
|
32262
|
+
).config.collateral;
|
|
32244
32263
|
}
|
|
32245
32264
|
getTag() {
|
|
32246
32265
|
return `${_UniversalLstMultiplierStrategy.name}:${this.metadata.name}`;
|
|
32247
32266
|
}
|
|
32248
32267
|
// Vesu adapter with LST and base token match
|
|
32249
32268
|
getVesuSameTokenAdapter(poolId) {
|
|
32250
|
-
const baseAdapter = this.getAdapter(
|
|
32269
|
+
const baseAdapter = this.getAdapter(
|
|
32270
|
+
getVesuLegId(
|
|
32271
|
+
"vesu_leg1" /* VESU_LEG1 */,
|
|
32272
|
+
this.metadata.additionalInfo.underlyingToken.symbol,
|
|
32273
|
+
poolId.toString()
|
|
32274
|
+
)
|
|
32275
|
+
);
|
|
32251
32276
|
baseAdapter.networkConfig = this.config;
|
|
32252
32277
|
baseAdapter.pricer = this.pricer;
|
|
32253
32278
|
return baseAdapter;
|
|
@@ -32290,27 +32315,43 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
32290
32315
|
lstUnderlyingTokenInfo.address.address,
|
|
32291
32316
|
this.quoteAmountToFetchPrice
|
|
32292
32317
|
);
|
|
32293
|
-
const outputAmount = Web3Number.fromWei(
|
|
32318
|
+
const outputAmount = Web3Number.fromWei(
|
|
32319
|
+
quote.total_calculated,
|
|
32320
|
+
lstUnderlyingTokenInfo.decimals
|
|
32321
|
+
);
|
|
32294
32322
|
const price = outputAmount.toNumber() / this.quoteAmountToFetchPrice.toNumber();
|
|
32295
32323
|
logger.verbose(`${this.getTag()}:: LST Dex Price: ${price}`);
|
|
32296
32324
|
return price;
|
|
32297
32325
|
}
|
|
32298
32326
|
async getAvnuSwapMultiplyCall(params) {
|
|
32299
|
-
assert(
|
|
32300
|
-
|
|
32327
|
+
assert(
|
|
32328
|
+
params.isDeposit,
|
|
32329
|
+
"Only deposit is supported in getAvnuSwapMultiplyCall"
|
|
32330
|
+
);
|
|
32331
|
+
const maxBorrowableAmounts = await this.getMaxBorrowableAmount({
|
|
32332
|
+
isAPYComputation: false
|
|
32333
|
+
});
|
|
32301
32334
|
const allVesuAdapters = this.getVesuAdapters();
|
|
32302
32335
|
let remainingAmount = params.leg1DepositAmount;
|
|
32303
32336
|
const lstExRate = await this.getLSTExchangeRate();
|
|
32304
|
-
const baseAssetPrice = await this.pricer.getPrice(
|
|
32337
|
+
const baseAssetPrice = await this.pricer.getPrice(
|
|
32338
|
+
this.getLSTUnderlyingTokenInfo().symbol
|
|
32339
|
+
);
|
|
32305
32340
|
const lstPrice = baseAssetPrice.price * lstExRate;
|
|
32306
32341
|
for (let i = 0; i < maxBorrowableAmounts.maxBorrowables.length; i++) {
|
|
32307
32342
|
const maxBorrowable = maxBorrowableAmounts.maxBorrowables[i];
|
|
32308
|
-
const vesuAdapter = allVesuAdapters.find(
|
|
32343
|
+
const vesuAdapter = allVesuAdapters.find(
|
|
32344
|
+
(adapter) => adapter.config.debt.address.eq(maxBorrowable.borrowableAsset.address)
|
|
32345
|
+
);
|
|
32309
32346
|
if (!vesuAdapter) {
|
|
32310
|
-
throw new Error(
|
|
32347
|
+
throw new Error(
|
|
32348
|
+
`${this.getTag()}::getAvnuSwapMultiplyCall: vesuAdapter not found for borrowable asset: ${maxBorrowable.borrowableAsset.symbol}`
|
|
32349
|
+
);
|
|
32311
32350
|
}
|
|
32312
32351
|
const maxLTV = await vesuAdapter.getLTVConfig(this.config);
|
|
32313
|
-
const debtPrice = await this.pricer.getPrice(
|
|
32352
|
+
const debtPrice = await this.pricer.getPrice(
|
|
32353
|
+
maxBorrowable.borrowableAsset.symbol
|
|
32354
|
+
);
|
|
32314
32355
|
const maxAmountToDeposit = HealthFactorMath.getMinCollateralRequiredOnLooping(
|
|
32315
32356
|
maxBorrowable.amount,
|
|
32316
32357
|
debtPrice.price,
|
|
@@ -32320,7 +32361,9 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
32320
32361
|
this.asset()
|
|
32321
32362
|
);
|
|
32322
32363
|
const amountToDeposit = remainingAmount.minimum(maxAmountToDeposit);
|
|
32323
|
-
logger.verbose(
|
|
32364
|
+
logger.verbose(
|
|
32365
|
+
`${this.getTag()}::getAvnuSwapMultiplyCall::${vesuAdapter.config.debt.symbol}:: remainingAmount: ${remainingAmount}, amountToDeposit: ${amountToDeposit}, depositAmount: ${amountToDeposit}, maxBorrowable: ${maxBorrowable.amount}`
|
|
32366
|
+
);
|
|
32324
32367
|
const call = await this._getAvnuDepositSwapLegCall({
|
|
32325
32368
|
isDeposit: params.isDeposit,
|
|
32326
32369
|
// adjust decimals of debt asset
|
|
@@ -32332,36 +32375,60 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
32332
32375
|
remainingAmount = remainingAmount.minus(amountToDeposit);
|
|
32333
32376
|
return { call, vesuAdapter };
|
|
32334
32377
|
}
|
|
32335
|
-
throw new Error(
|
|
32378
|
+
throw new Error(
|
|
32379
|
+
`${this.getTag()}::getAvnuSwapMultiplyCall: no calls found`
|
|
32380
|
+
);
|
|
32336
32381
|
}
|
|
32337
32382
|
async _getAvnuDepositSwapLegCall(params) {
|
|
32338
32383
|
const { vesuAdapter } = params;
|
|
32339
|
-
logger.verbose(
|
|
32340
|
-
|
|
32384
|
+
logger.verbose(
|
|
32385
|
+
`${this.getTag()}::_getAvnuDepositSwapLegCall params: ${JSON.stringify(params)}`
|
|
32386
|
+
);
|
|
32387
|
+
assert(
|
|
32388
|
+
params.isDeposit,
|
|
32389
|
+
"Only deposit is supported in _getAvnuDepositSwapLegCall"
|
|
32390
|
+
);
|
|
32341
32391
|
const legLTV = await vesuAdapter.getLTVConfig(this.config);
|
|
32342
|
-
logger.verbose(
|
|
32392
|
+
logger.verbose(
|
|
32393
|
+
`${this.getTag()}::_getAvnuDepositSwapLegCall legLTV: ${legLTV}`
|
|
32394
|
+
);
|
|
32343
32395
|
const existingPositions = await vesuAdapter.getPositions(this.config);
|
|
32344
|
-
const collateralisation = await vesuAdapter.getCollateralization(
|
|
32396
|
+
const collateralisation = await vesuAdapter.getCollateralization(
|
|
32397
|
+
this.config
|
|
32398
|
+
);
|
|
32345
32399
|
const existingCollateralInfo = existingPositions[0];
|
|
32346
32400
|
const existingDebtInfo = existingPositions[1];
|
|
32347
32401
|
logger.debug(`${this.getTag()}::_getAvnuDepositSwapLegCall existingCollateralInfo: ${JSON.stringify(existingCollateralInfo)},
|
|
32348
32402
|
existingDebtInfo: ${JSON.stringify(existingDebtInfo)}, collateralisation: ${JSON.stringify(collateralisation)}`);
|
|
32349
32403
|
const collateralPrice = collateralisation[0].usdValue > 0 ? collateralisation[0].usdValue / existingCollateralInfo.amount.toNumber() : 1;
|
|
32350
32404
|
const debtPrice = collateralisation[1].usdValue > 0 ? collateralisation[1].usdValue / existingDebtInfo.amount.toNumber() : 1;
|
|
32351
|
-
logger.debug(
|
|
32405
|
+
logger.debug(
|
|
32406
|
+
`${this.getTag()}::_getAvnuDepositSwapLegCall collateralPrice: ${collateralPrice}, debtPrice: ${debtPrice}`
|
|
32407
|
+
);
|
|
32352
32408
|
const debtTokenInfo = vesuAdapter.config.debt;
|
|
32353
32409
|
let newDepositAmount = params.leg1DepositAmount;
|
|
32354
|
-
const totalCollateral = existingCollateralInfo.amount.plus(
|
|
32355
|
-
|
|
32410
|
+
const totalCollateral = existingCollateralInfo.amount.plus(
|
|
32411
|
+
params.leg1DepositAmount
|
|
32412
|
+
);
|
|
32413
|
+
logger.verbose(
|
|
32414
|
+
`${this.getTag()}::_getAvnuDepositSwapLegCall totalCollateral: ${totalCollateral}`
|
|
32415
|
+
);
|
|
32356
32416
|
const totalDebtAmount = new Web3Number(
|
|
32357
32417
|
totalCollateral.multipliedBy(collateralPrice).multipliedBy(legLTV).dividedBy(debtPrice).dividedBy(params.minHF).toString(),
|
|
32358
32418
|
debtTokenInfo.decimals
|
|
32359
32419
|
);
|
|
32360
32420
|
let debtAmount = totalDebtAmount.minus(existingDebtInfo.amount);
|
|
32361
|
-
logger.verbose(
|
|
32362
|
-
|
|
32421
|
+
logger.verbose(
|
|
32422
|
+
`${this.getTag()}::_getAvnuDepositSwapLegCall totalDebtAmount: ${totalDebtAmount}, initial computed debt: ${debtAmount}`
|
|
32423
|
+
);
|
|
32424
|
+
const maxBorrowable = await this.getMaxBorrowableAmountByVesuAdapter(
|
|
32425
|
+
vesuAdapter,
|
|
32426
|
+
false
|
|
32427
|
+
);
|
|
32363
32428
|
if (debtAmount.gt(0) && maxBorrowable.amount.eq(0)) {
|
|
32364
|
-
logger.verbose(
|
|
32429
|
+
logger.verbose(
|
|
32430
|
+
`${this.getTag()}::_getAvnuDepositSwapLegCall maxBorrowable is 0, skipping`
|
|
32431
|
+
);
|
|
32365
32432
|
return void 0;
|
|
32366
32433
|
} else if (debtAmount.gt(0) && maxBorrowable.amount.gt(0)) {
|
|
32367
32434
|
debtAmount = maxBorrowable.amount.minimum(debtAmount);
|
|
@@ -32374,16 +32441,24 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
32374
32441
|
collateralPrice,
|
|
32375
32442
|
this.asset()
|
|
32376
32443
|
);
|
|
32377
|
-
newDepositAmount = totalCollateralRequired.minus(
|
|
32444
|
+
newDepositAmount = totalCollateralRequired.minus(
|
|
32445
|
+
existingCollateralInfo.amount
|
|
32446
|
+
);
|
|
32378
32447
|
if (newDepositAmount.lt(0)) {
|
|
32379
|
-
throw new Error(
|
|
32448
|
+
throw new Error(
|
|
32449
|
+
`${this.getTag()}::_getAvnuDepositSwapLegCall newDepositAmount is less than 0, newDepositAmount: ${newDepositAmount}, totalCollateralRequired: ${totalCollateralRequired}, existingCollateralInfo.amount: ${existingCollateralInfo.amount}`
|
|
32450
|
+
);
|
|
32380
32451
|
}
|
|
32381
32452
|
if (newDebtUSDValue.toNumber() < 100) {
|
|
32382
|
-
logger.verbose(
|
|
32453
|
+
logger.verbose(
|
|
32454
|
+
`${this.getTag()}::_getAvnuDepositSwapLegCall newDebtUSDValue is less than 100, skipping`
|
|
32455
|
+
);
|
|
32383
32456
|
return void 0;
|
|
32384
32457
|
}
|
|
32385
32458
|
}
|
|
32386
|
-
logger.verbose(
|
|
32459
|
+
logger.verbose(
|
|
32460
|
+
`${this.getTag()}::_getAvnuDepositSwapLegCall debtAmount: ${debtAmount}`
|
|
32461
|
+
);
|
|
32387
32462
|
if (debtAmount.lt(0)) {
|
|
32388
32463
|
const lstDEXPrice = await this.getLSTDexPrice();
|
|
32389
32464
|
const debtAmountInLST = debtAmount.abs().dividedBy(lstDEXPrice);
|
|
@@ -32392,28 +32467,38 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
32392
32467
|
leg1DepositAmount: debtAmountInLST,
|
|
32393
32468
|
poolId: vesuAdapter.config.poolId
|
|
32394
32469
|
});
|
|
32395
|
-
assert(
|
|
32470
|
+
assert(
|
|
32471
|
+
calls.length == 1,
|
|
32472
|
+
`Expected 1 call for unwind, got ${calls.length}`
|
|
32473
|
+
);
|
|
32396
32474
|
return calls[0];
|
|
32397
32475
|
}
|
|
32398
|
-
console.log(`debtAmount`, debtAmount.toWei(), params.leg1DepositAmount.toWei());
|
|
32399
32476
|
const STEP0 = "approve_token1" /* APPROVE_TOKEN1 */;
|
|
32400
32477
|
const manage0Info = this.getProofs(STEP0);
|
|
32401
32478
|
const manageCall0 = manage0Info.callConstructor({
|
|
32402
32479
|
amount: newDepositAmount
|
|
32403
32480
|
});
|
|
32404
|
-
const STEP1 = getVesuLegId(
|
|
32481
|
+
const STEP1 = getVesuLegId(
|
|
32482
|
+
"vesu_leg1" /* VESU_LEG1 */,
|
|
32483
|
+
vesuAdapter.config.debt.symbol,
|
|
32484
|
+
vesuAdapter.config.poolId.toString()
|
|
32485
|
+
);
|
|
32405
32486
|
const manage1Info = this.getProofs(STEP1);
|
|
32406
|
-
const manageCall1 = manage1Info.callConstructor(
|
|
32407
|
-
|
|
32408
|
-
|
|
32409
|
-
|
|
32410
|
-
|
|
32411
|
-
|
|
32412
|
-
|
|
32487
|
+
const manageCall1 = manage1Info.callConstructor(
|
|
32488
|
+
VesuAdapter.getDefaultModifyPositionCallParams({
|
|
32489
|
+
collateralAmount: newDepositAmount,
|
|
32490
|
+
isAddCollateral: params.isDeposit,
|
|
32491
|
+
debtAmount,
|
|
32492
|
+
isBorrow: params.isDeposit
|
|
32493
|
+
})
|
|
32494
|
+
);
|
|
32413
32495
|
const proofIds = [STEP0, STEP1];
|
|
32414
32496
|
const manageCalls = [manageCall0, manageCall1];
|
|
32415
32497
|
if (debtAmount.gt(0)) {
|
|
32416
|
-
const STEP2 = getAvnuManageIDs(
|
|
32498
|
+
const STEP2 = getAvnuManageIDs(
|
|
32499
|
+
"avnu_mul_approve_dep" /* AVNU_MULTIPLY_APPROVE_DEPOSIT */,
|
|
32500
|
+
vesuAdapter.config.debt.symbol
|
|
32501
|
+
);
|
|
32417
32502
|
const manage2Info = this.getProofs(STEP2);
|
|
32418
32503
|
const manageCall2 = manage2Info.callConstructor({
|
|
32419
32504
|
amount: debtAmount
|
|
@@ -32429,7 +32514,9 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
32429
32514
|
);
|
|
32430
32515
|
const minAmount = await this._getMinOutputAmountLSTBuy(debtAmount);
|
|
32431
32516
|
const minAmountWei = minAmount.toWei();
|
|
32432
|
-
logger.verbose(
|
|
32517
|
+
logger.verbose(
|
|
32518
|
+
`${this.getTag()}::_getAvnuDepositSwapLegCall minAmount: ${minAmount}`
|
|
32519
|
+
);
|
|
32433
32520
|
const swapInfo = await avnuModule.getSwapInfo(
|
|
32434
32521
|
quote,
|
|
32435
32522
|
this.metadata.additionalInfo.vaultAllocator.address,
|
|
@@ -32437,8 +32524,13 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
32437
32524
|
this.address.address,
|
|
32438
32525
|
minAmountWei
|
|
32439
32526
|
);
|
|
32440
|
-
logger.verbose(
|
|
32441
|
-
|
|
32527
|
+
logger.verbose(
|
|
32528
|
+
`${this.getTag()}::_getAvnuDepositSwapLegCall swapInfo: ${JSON.stringify(swapInfo)}`
|
|
32529
|
+
);
|
|
32530
|
+
const STEP3 = getAvnuManageIDs(
|
|
32531
|
+
"avnu_mul_swap_dep" /* AVNU_MULTIPLY_SWAP_DEPOSIT */,
|
|
32532
|
+
vesuAdapter.config.debt.symbol
|
|
32533
|
+
);
|
|
32442
32534
|
const manage3Info = this.getProofs(STEP3);
|
|
32443
32535
|
const manageCall3 = manage3Info.callConstructor({
|
|
32444
32536
|
props: swapInfo
|
|
@@ -32448,22 +32540,32 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
32448
32540
|
manageCalls.push(manageCall2, manageCall3);
|
|
32449
32541
|
const newCollateral = minAmount.plus(totalCollateral);
|
|
32450
32542
|
const newHF = newCollateral.multipliedBy(collateralPrice).multipliedBy(legLTV).dividedBy(totalDebtAmount).dividedBy(debtPrice).toNumber();
|
|
32451
|
-
logger.verbose(
|
|
32543
|
+
logger.verbose(
|
|
32544
|
+
`${this.getTag()}::_getAvnuDepositSwapLegCall newHF: ${newHF}`
|
|
32545
|
+
);
|
|
32452
32546
|
if (newHF > this.metadata.additionalInfo.minHealthFactor && newHF < this.metadata.additionalInfo.targetHealthFactor + 0.05) {
|
|
32453
|
-
logger.verbose(
|
|
32547
|
+
logger.verbose(
|
|
32548
|
+
`${this.getTag()}::_getAvnuDepositSwapLegCall newHF is above min and below target + 0.05, adding collateral on vesu`
|
|
32549
|
+
);
|
|
32454
32550
|
const STEP4 = "approve_token1" /* APPROVE_TOKEN1 */;
|
|
32455
32551
|
const manage4Info = this.getProofs(STEP4);
|
|
32456
32552
|
const manageCall4 = manage4Info.callConstructor({
|
|
32457
32553
|
amount: minAmount
|
|
32458
32554
|
});
|
|
32459
|
-
const STEP5 = getVesuLegId(
|
|
32555
|
+
const STEP5 = getVesuLegId(
|
|
32556
|
+
"vesu_leg1" /* VESU_LEG1 */,
|
|
32557
|
+
vesuAdapter.config.debt.symbol,
|
|
32558
|
+
vesuAdapter.config.poolId.toString()
|
|
32559
|
+
);
|
|
32460
32560
|
const manage5Info = this.getProofs(STEP5);
|
|
32461
|
-
const manageCall5 = manage5Info.callConstructor(
|
|
32462
|
-
|
|
32463
|
-
|
|
32464
|
-
|
|
32465
|
-
|
|
32466
|
-
|
|
32561
|
+
const manageCall5 = manage5Info.callConstructor(
|
|
32562
|
+
VesuAdapter.getDefaultModifyPositionCallParams({
|
|
32563
|
+
collateralAmount: minAmount,
|
|
32564
|
+
isAddCollateral: true,
|
|
32565
|
+
debtAmount: Web3Number.fromWei("0", this.asset().decimals),
|
|
32566
|
+
isBorrow: params.isDeposit
|
|
32567
|
+
})
|
|
32568
|
+
);
|
|
32467
32569
|
proofIds.push(STEP4, STEP5);
|
|
32468
32570
|
manageCalls.push(manageCall4, manageCall5);
|
|
32469
32571
|
}
|
|
@@ -32471,11 +32573,13 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
32471
32573
|
const manageCall = this.getManageCall(proofIds, manageCalls);
|
|
32472
32574
|
return manageCall;
|
|
32473
32575
|
}
|
|
32474
|
-
// todo unwind or not deposit when the yield is bad.
|
|
32576
|
+
// todo unwind or not deposit when the yield is bad.
|
|
32475
32577
|
async getLSTMultiplierRebalanceCall() {
|
|
32476
32578
|
let shouldRebalance = false;
|
|
32477
32579
|
const calls = [];
|
|
32478
|
-
const allVesuAdapters = this.getVesuAdapters().filter(
|
|
32580
|
+
const allVesuAdapters = this.getVesuAdapters().filter(
|
|
32581
|
+
(vesuAdapter) => vesuAdapter.config.debt.symbol === "LBTC"
|
|
32582
|
+
);
|
|
32479
32583
|
for (const vesuAdapter of allVesuAdapters) {
|
|
32480
32584
|
const call = await this._getLSTMultiplierRebalanceCall(vesuAdapter);
|
|
32481
32585
|
if (call.shouldRebalance && call.manageCall) {
|
|
@@ -32487,18 +32591,27 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
32487
32591
|
}
|
|
32488
32592
|
async _getLSTMultiplierRebalanceCall(vesuAdapter) {
|
|
32489
32593
|
const positions = await vesuAdapter.getPositions(this.config);
|
|
32490
|
-
assert(
|
|
32594
|
+
assert(
|
|
32595
|
+
positions.length == 2,
|
|
32596
|
+
"Rebalance call is only supported for 2 positions"
|
|
32597
|
+
);
|
|
32491
32598
|
const existingCollateralInfo = positions[0];
|
|
32492
32599
|
const existingDebtInfo = positions[1];
|
|
32493
32600
|
const unusedBalance = await this.getUnusedBalance();
|
|
32494
32601
|
const healthFactor = await vesuAdapter.getHealthFactor();
|
|
32495
|
-
const collateralisation = await vesuAdapter.getCollateralization(
|
|
32602
|
+
const collateralisation = await vesuAdapter.getCollateralization(
|
|
32603
|
+
this.config
|
|
32604
|
+
);
|
|
32496
32605
|
logger.debug(`${this.getTag()}::getVesuMultiplyCall::${vesuAdapter.config.debt.symbol} existingCollateralInfo: ${JSON.stringify(existingCollateralInfo)},
|
|
32497
32606
|
existingDebtInfo: ${JSON.stringify(existingDebtInfo)}, collateralisation: ${JSON.stringify(collateralisation)}`);
|
|
32498
32607
|
const collateralPrice = collateralisation[0].usdValue > 0 ? collateralisation[0].usdValue / existingCollateralInfo.amount.toNumber() : 1;
|
|
32499
32608
|
const debtPrice = collateralisation[1].usdValue > 0 ? collateralisation[1].usdValue / existingDebtInfo.amount.toNumber() : 1;
|
|
32500
|
-
logger.debug(
|
|
32501
|
-
|
|
32609
|
+
logger.debug(
|
|
32610
|
+
`${this.getTag()}::getVesuMultiplyCall collateralPrice: ${collateralPrice}, debtPrice: ${debtPrice}`
|
|
32611
|
+
);
|
|
32612
|
+
logger.debug(
|
|
32613
|
+
`${this.getTag()}::getVesuMultiplyCall healthFactor: ${healthFactor}`
|
|
32614
|
+
);
|
|
32502
32615
|
const isHFTooLow = healthFactor < this.metadata.additionalInfo.minHealthFactor;
|
|
32503
32616
|
const isHFTooHigh = healthFactor > this.metadata.additionalInfo.targetHealthFactor + 0.05;
|
|
32504
32617
|
if (isHFTooLow || isHFTooHigh || 1) {
|
|
@@ -32506,7 +32619,7 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
32506
32619
|
isDeposit: true,
|
|
32507
32620
|
leg1DepositAmount: unusedBalance.amount,
|
|
32508
32621
|
minHF: 1.02,
|
|
32509
|
-
// todo, shouldnt use this 1.02 HF, if there isn;t more looping left.
|
|
32622
|
+
// todo, shouldnt use this 1.02 HF, if there isn;t more looping left.
|
|
32510
32623
|
vesuAdapter
|
|
32511
32624
|
});
|
|
32512
32625
|
return { shouldRebalance: true, manageCall };
|
|
@@ -32514,14 +32627,48 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
32514
32627
|
return { shouldRebalance: false, manageCall: void 0 };
|
|
32515
32628
|
}
|
|
32516
32629
|
}
|
|
32517
|
-
async getVesuAUM(adapter) {
|
|
32630
|
+
async getVesuAUM(adapter, priceType = "AVNU_PRICE" /* AVNU_PRICE */) {
|
|
32518
32631
|
const legAUM = await adapter.getPositions(this.config);
|
|
32519
32632
|
const underlying = this.asset();
|
|
32520
|
-
assert(
|
|
32633
|
+
assert(
|
|
32634
|
+
underlying.symbol.startsWith("x"),
|
|
32635
|
+
"Underlying is not an LST of Endur"
|
|
32636
|
+
);
|
|
32521
32637
|
let vesuAum = Web3Number.fromWei("0", underlying.decimals);
|
|
32522
|
-
let tokenUnderlyingPrice
|
|
32523
|
-
|
|
32524
|
-
|
|
32638
|
+
let tokenUnderlyingPrice;
|
|
32639
|
+
if (priceType === "ENDUR_PRICE" /* ENDUR_PRICE */) {
|
|
32640
|
+
tokenUnderlyingPrice = await this.getLSTExchangeRate();
|
|
32641
|
+
if (tokenUnderlyingPrice === 0) {
|
|
32642
|
+
throw new Error(
|
|
32643
|
+
`${this.getTag()}::getVesuAUM: tokenUnderlyingPrice (Endur) is 0`
|
|
32644
|
+
);
|
|
32645
|
+
}
|
|
32646
|
+
const avnuRate = await this.getLSTAvnuRate();
|
|
32647
|
+
if (avnuRate === 0) {
|
|
32648
|
+
throw new Error(
|
|
32649
|
+
`${this.getTag()}::getVesuAUM: tokenUnderlyingPrice (Avnu) is 0`
|
|
32650
|
+
);
|
|
32651
|
+
}
|
|
32652
|
+
const diff = Math.abs(tokenUnderlyingPrice - avnuRate) / tokenUnderlyingPrice;
|
|
32653
|
+
if (diff > 0.02) {
|
|
32654
|
+
throw new Error(
|
|
32655
|
+
`${this.getTag()}::getVesuAUM: Endur and Avnu prices differ by more than 2% (Endur: ${tokenUnderlyingPrice}, Avnu: ${avnuRate})`
|
|
32656
|
+
);
|
|
32657
|
+
}
|
|
32658
|
+
logger.verbose(
|
|
32659
|
+
`${this.getTag()} tokenUnderlyingPrice (Endur): ${tokenUnderlyingPrice}, avnuRate: ${avnuRate}, diff: ${diff}`
|
|
32660
|
+
);
|
|
32661
|
+
} else {
|
|
32662
|
+
tokenUnderlyingPrice = await this.getLSTAvnuRate();
|
|
32663
|
+
if (tokenUnderlyingPrice === 0) {
|
|
32664
|
+
throw new Error(
|
|
32665
|
+
`${this.getTag()}::getVesuAUM: tokenUnderlyingPrice (Avnu) is 0`
|
|
32666
|
+
);
|
|
32667
|
+
}
|
|
32668
|
+
logger.verbose(
|
|
32669
|
+
`${this.getTag()} tokenUnderlyingPrice (Avnu): ${tokenUnderlyingPrice}`
|
|
32670
|
+
);
|
|
32671
|
+
}
|
|
32525
32672
|
if (legAUM[0].token.address.eq(underlying.address)) {
|
|
32526
32673
|
vesuAum = vesuAum.plus(legAUM[0].amount);
|
|
32527
32674
|
} else {
|
|
@@ -32532,10 +32679,28 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
32532
32679
|
} else {
|
|
32533
32680
|
vesuAum = vesuAum.minus(legAUM[1].amount.dividedBy(tokenUnderlyingPrice));
|
|
32534
32681
|
}
|
|
32535
|
-
;
|
|
32536
|
-
logger.verbose(
|
|
32682
|
+
const priceTypeLabel = priceType === "ENDUR_PRICE" /* ENDUR_PRICE */ ? "Endur Price" : "Avnu Price";
|
|
32683
|
+
logger.verbose(
|
|
32684
|
+
`${this.getTag()} Vesu AUM (${priceTypeLabel}): ${vesuAum}, legCollateral: ${legAUM[0].amount.toNumber()}, legDebt: ${legAUM[1].amount.toNumber()}`
|
|
32685
|
+
);
|
|
32537
32686
|
return vesuAum;
|
|
32538
32687
|
}
|
|
32688
|
+
async getTVLUnrealized() {
|
|
32689
|
+
return await this.getAUM(true);
|
|
32690
|
+
}
|
|
32691
|
+
async getUserUnrealizedGains(user) {
|
|
32692
|
+
const tvl = await this.getTVL();
|
|
32693
|
+
const unrealizedTVL = await this.getTVLUnrealized();
|
|
32694
|
+
const unrealizedDiff = unrealizedTVL.net.amount.minus(tvl.amount);
|
|
32695
|
+
const userTVL = await this.getUserTVL(user);
|
|
32696
|
+
const userShare = userTVL.amount.dividedBy(tvl.amount);
|
|
32697
|
+
const unrealizedGains = unrealizedDiff.multipliedBy(userShare);
|
|
32698
|
+
return {
|
|
32699
|
+
unrealizedGains,
|
|
32700
|
+
userShare: userShare.toNumber(),
|
|
32701
|
+
tokenInfo: this.asset()
|
|
32702
|
+
};
|
|
32703
|
+
}
|
|
32539
32704
|
//
|
|
32540
32705
|
async _getMinOutputAmountLSTBuy(amountInUnderlying) {
|
|
32541
32706
|
const lstTruePrice = await this.getLSTExchangeRate();
|
|
@@ -32548,11 +32713,11 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
32548
32713
|
return minOutputAmount;
|
|
32549
32714
|
}
|
|
32550
32715
|
// todo add a function to findout max borrowable amount without fucking yield
|
|
32551
|
-
// if the current net yield < LST yield, add a function to calculate how much to unwind.
|
|
32716
|
+
// if the current net yield < LST yield, add a function to calculate how much to unwind.
|
|
32552
32717
|
/**
|
|
32553
32718
|
* Uses vesu's multiple call to create leverage on LST
|
|
32554
32719
|
* Deposit amount is in LST
|
|
32555
|
-
* @param params
|
|
32720
|
+
* @param params
|
|
32556
32721
|
*/
|
|
32557
32722
|
async getVesuMultiplyCall(params) {
|
|
32558
32723
|
const maxEkuboPriceImpact = params.maxEkuboPriceImpact || 0.01;
|
|
@@ -32561,32 +32726,54 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
32561
32726
|
logger.verbose(`${this.getTag()}::getVesuMultiplyCall legLTV: ${legLTV}`);
|
|
32562
32727
|
if (!params.isDeposit) {
|
|
32563
32728
|
const unusedBalance = await this.getUnusedBalance();
|
|
32564
|
-
logger.verbose(
|
|
32729
|
+
logger.verbose(
|
|
32730
|
+
`${this.getTag()}::getVesuMultiplyCall unusedBalance: ${unusedBalance.amount.toString()}, required: ${params.leg1DepositAmount.toString()}`
|
|
32731
|
+
);
|
|
32565
32732
|
}
|
|
32566
32733
|
const existingPositions = await vesuAdapter1.getPositions(this.config);
|
|
32567
|
-
const collateralisation = await vesuAdapter1.getCollateralization(
|
|
32734
|
+
const collateralisation = await vesuAdapter1.getCollateralization(
|
|
32735
|
+
this.config
|
|
32736
|
+
);
|
|
32568
32737
|
const existingCollateralInfo = existingPositions[0];
|
|
32569
32738
|
const existingDebtInfo = existingPositions[1];
|
|
32570
32739
|
logger.debug(`${this.getTag()}::getVesuMultiplyCall existingCollateralInfo: ${JSON.stringify(existingCollateralInfo)},
|
|
32571
32740
|
existingDebtInfo: ${JSON.stringify(existingDebtInfo)}, collateralisation: ${JSON.stringify(collateralisation)}`);
|
|
32572
32741
|
const collateralPrice = collateralisation[0].usdValue > 0 ? collateralisation[0].usdValue / existingCollateralInfo.amount.toNumber() : 1;
|
|
32573
32742
|
const debtPrice = collateralisation[1].usdValue > 0 ? collateralisation[1].usdValue / existingDebtInfo.amount.toNumber() : 1;
|
|
32574
|
-
logger.debug(
|
|
32743
|
+
logger.debug(
|
|
32744
|
+
`${this.getTag()}::getVesuMultiplyCall collateralPrice: ${collateralPrice}, debtPrice: ${debtPrice}`
|
|
32745
|
+
);
|
|
32575
32746
|
const dexPrice = await this.getLSTDexPrice();
|
|
32576
|
-
const addedCollateral = params.leg1DepositAmount.multipliedBy(
|
|
32577
|
-
|
|
32747
|
+
const addedCollateral = params.leg1DepositAmount.multipliedBy(
|
|
32748
|
+
params.isDeposit ? 1 : -1
|
|
32749
|
+
);
|
|
32750
|
+
logger.verbose(
|
|
32751
|
+
`${this.getTag()}::getVesuMultiplyCall addedCollateral: ${addedCollateral}`
|
|
32752
|
+
);
|
|
32578
32753
|
const numeratorPart1 = existingCollateralInfo.amount.plus(addedCollateral).multipliedBy(collateralPrice).multipliedBy(legLTV);
|
|
32579
|
-
logger.verbose(
|
|
32754
|
+
logger.verbose(
|
|
32755
|
+
`${this.getTag()}::getVesuMultiplyCall numeratorPart1: ${numeratorPart1}`
|
|
32756
|
+
);
|
|
32580
32757
|
const numeratorPart2 = existingDebtInfo.amount.multipliedBy(debtPrice).multipliedBy(this.metadata.additionalInfo.targetHealthFactor);
|
|
32581
|
-
logger.verbose(
|
|
32758
|
+
logger.verbose(
|
|
32759
|
+
`${this.getTag()}::getVesuMultiplyCall numeratorPart2: ${numeratorPart2}`
|
|
32760
|
+
);
|
|
32582
32761
|
const denominatorPart = this.metadata.additionalInfo.targetHealthFactor - legLTV / dexPrice;
|
|
32583
|
-
logger.verbose(
|
|
32762
|
+
logger.verbose(
|
|
32763
|
+
`${this.getTag()}::getVesuMultiplyCall denominatorPart: ${denominatorPart}`
|
|
32764
|
+
);
|
|
32584
32765
|
const x_debt_usd = numeratorPart1.minus(numeratorPart2).dividedBy(denominatorPart);
|
|
32585
|
-
logger.verbose(
|
|
32586
|
-
|
|
32766
|
+
logger.verbose(
|
|
32767
|
+
`${this.getTag()}::getVesuMultiplyCall x_debt_usd: ${x_debt_usd}`
|
|
32768
|
+
);
|
|
32769
|
+
logger.debug(
|
|
32770
|
+
`${this.getTag()}::getVesuMultiplyCall numeratorPart1: ${numeratorPart1}, numeratorPart2: ${numeratorPart2}, denominatorPart: ${denominatorPart}`
|
|
32771
|
+
);
|
|
32587
32772
|
let debtAmount = x_debt_usd.dividedBy(debtPrice);
|
|
32588
32773
|
const marginAmount = addedCollateral;
|
|
32589
|
-
logger.verbose(
|
|
32774
|
+
logger.verbose(
|
|
32775
|
+
`${this.getTag()}::getVesuMultiplyCall debtAmount: ${debtAmount}, marginAmount: ${marginAmount}`
|
|
32776
|
+
);
|
|
32590
32777
|
if (marginAmount.lt(0) && debtAmount.gt(0)) {
|
|
32591
32778
|
debtAmount = Web3Number.fromWei(0, this.asset().decimals);
|
|
32592
32779
|
}
|
|
@@ -32600,31 +32787,49 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
32600
32787
|
});
|
|
32601
32788
|
}
|
|
32602
32789
|
getLSTUnderlyingTokenInfo() {
|
|
32603
|
-
const vesuAdapter1 = this.getVesuSameTokenAdapter(
|
|
32790
|
+
const vesuAdapter1 = this.getVesuSameTokenAdapter(
|
|
32791
|
+
this.metadata.additionalInfo.defaultPoolId
|
|
32792
|
+
);
|
|
32604
32793
|
return vesuAdapter1.config.debt;
|
|
32605
32794
|
}
|
|
32606
32795
|
async getMaxBorrowableAmount(params = { isAPYComputation: false }) {
|
|
32607
32796
|
const vesuAdapters = this.getVesuAdapters();
|
|
32608
|
-
let netMaxBorrowableAmount = Web3Number.fromWei(
|
|
32797
|
+
let netMaxBorrowableAmount = Web3Number.fromWei(
|
|
32798
|
+
"0",
|
|
32799
|
+
this.getLSTUnderlyingTokenInfo().decimals
|
|
32800
|
+
);
|
|
32609
32801
|
const maxBorrowables = [];
|
|
32610
32802
|
for (const vesuAdapter of vesuAdapters) {
|
|
32611
|
-
const output = await this.getMaxBorrowableAmountByVesuAdapter(
|
|
32803
|
+
const output = await this.getMaxBorrowableAmountByVesuAdapter(
|
|
32804
|
+
vesuAdapter,
|
|
32805
|
+
params.isAPYComputation
|
|
32806
|
+
);
|
|
32612
32807
|
const ltv = await vesuAdapter.getLTVConfig(this.config);
|
|
32613
32808
|
maxBorrowables.push({ ...output, ltv });
|
|
32614
32809
|
}
|
|
32615
32810
|
maxBorrowables.sort((a, b) => b.amount.toNumber() - a.amount.toNumber());
|
|
32616
|
-
netMaxBorrowableAmount = maxBorrowables.reduce(
|
|
32811
|
+
netMaxBorrowableAmount = maxBorrowables.reduce(
|
|
32812
|
+
(acc, curr) => acc.plus(curr.amount),
|
|
32813
|
+
Web3Number.fromWei("0", this.getLSTUnderlyingTokenInfo().decimals)
|
|
32814
|
+
);
|
|
32617
32815
|
return { netMaxBorrowableAmount, maxBorrowables };
|
|
32618
32816
|
}
|
|
32619
|
-
// recursively, using binary search computes max swappable.
|
|
32817
|
+
// recursively, using binary search computes max swappable.
|
|
32620
32818
|
// @dev assumes 1 token of from == 1 token of to
|
|
32621
32819
|
async getMaxSwappableWithMaxSlippage(fromToken, toToken, maxSlippage, maxAmount) {
|
|
32622
32820
|
const output = await findMaxInputWithSlippage({
|
|
32623
32821
|
apiGetOutput: async (inputAmount) => {
|
|
32624
32822
|
const ekuboQuoter = new EkuboQuoter(this.config);
|
|
32625
32823
|
await new Promise((resolve) => setTimeout(resolve, 1e3));
|
|
32626
|
-
const quote = await ekuboQuoter.getQuote(
|
|
32627
|
-
|
|
32824
|
+
const quote = await ekuboQuoter.getQuote(
|
|
32825
|
+
fromToken.address.address,
|
|
32826
|
+
toToken.address.address,
|
|
32827
|
+
new Web3Number(inputAmount.toFixed(9), fromToken.decimals)
|
|
32828
|
+
);
|
|
32829
|
+
return Web3Number.fromWei(
|
|
32830
|
+
quote.total_calculated.toString(),
|
|
32831
|
+
toToken.decimals
|
|
32832
|
+
).toNumber();
|
|
32628
32833
|
},
|
|
32629
32834
|
maxInput: maxAmount.toNumber(),
|
|
32630
32835
|
maxSlippagePercent: maxSlippage,
|
|
@@ -32634,38 +32839,84 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
32634
32839
|
return new Web3Number(output.optimalInput, fromToken.decimals);
|
|
32635
32840
|
}
|
|
32636
32841
|
async getMaxBorrowableAmountByVesuAdapter(vesuAdapter, isAPYComputation) {
|
|
32637
|
-
const lstAPY = await this.getLSTAPR(
|
|
32842
|
+
const lstAPY = await this.getLSTAPR(
|
|
32843
|
+
this.getLSTUnderlyingTokenInfo().address
|
|
32844
|
+
);
|
|
32638
32845
|
const maxInterestRate = lstAPY * 0.8;
|
|
32639
|
-
const { maxDebtToHave: maxBorrowableAmount, currentDebt } = await vesuAdapter.getMaxBorrowableByInterestRate(
|
|
32846
|
+
const { maxDebtToHave: maxBorrowableAmount, currentDebt } = await vesuAdapter.getMaxBorrowableByInterestRate(
|
|
32847
|
+
this.config,
|
|
32848
|
+
vesuAdapter.config.debt,
|
|
32849
|
+
maxInterestRate
|
|
32850
|
+
);
|
|
32640
32851
|
const debtCap = await vesuAdapter.getDebtCap(this.config);
|
|
32641
32852
|
if (currentDebt.gte(debtCap)) {
|
|
32642
|
-
return {
|
|
32853
|
+
return {
|
|
32854
|
+
amount: Web3Number.fromWei("0", vesuAdapter.config.debt.decimals),
|
|
32855
|
+
dexSwappableAmount: Web3Number.fromWei(
|
|
32856
|
+
"0",
|
|
32857
|
+
vesuAdapter.config.debt.decimals
|
|
32858
|
+
),
|
|
32859
|
+
maxBorrowableAmount: Web3Number.fromWei(
|
|
32860
|
+
"0",
|
|
32861
|
+
vesuAdapter.config.debt.decimals
|
|
32862
|
+
),
|
|
32863
|
+
borrowableAsset: vesuAdapter.config.debt
|
|
32864
|
+
};
|
|
32643
32865
|
}
|
|
32644
32866
|
const availableToBorrow = debtCap.minus(currentDebt);
|
|
32645
32867
|
const maxBorrowable = maxBorrowableAmount.minimum(availableToBorrow).multipliedBy(0.999);
|
|
32646
|
-
if (vesuAdapter.config.debt.address.eq(
|
|
32647
|
-
|
|
32868
|
+
if (vesuAdapter.config.debt.address.eq(
|
|
32869
|
+
this.getLSTUnderlyingTokenInfo().address
|
|
32870
|
+
) || isAPYComputation) {
|
|
32871
|
+
return {
|
|
32872
|
+
amount: maxBorrowable,
|
|
32873
|
+
dexSwappableAmount: maxBorrowable,
|
|
32874
|
+
maxBorrowableAmount: maxBorrowable,
|
|
32875
|
+
borrowableAsset: vesuAdapter.config.debt
|
|
32876
|
+
};
|
|
32648
32877
|
}
|
|
32649
32878
|
try {
|
|
32650
|
-
const maxSwappable = await this.getMaxSwappableWithMaxSlippage(
|
|
32651
|
-
|
|
32879
|
+
const maxSwappable = await this.getMaxSwappableWithMaxSlippage(
|
|
32880
|
+
vesuAdapter.config.debt,
|
|
32881
|
+
this.getLSTUnderlyingTokenInfo(),
|
|
32882
|
+
2e-4,
|
|
32883
|
+
maxBorrowable
|
|
32884
|
+
);
|
|
32885
|
+
return {
|
|
32886
|
+
amount: maxBorrowable.minimum(maxSwappable),
|
|
32887
|
+
dexSwappableAmount: maxSwappable,
|
|
32888
|
+
maxBorrowableAmount: maxBorrowable,
|
|
32889
|
+
borrowableAsset: vesuAdapter.config.debt
|
|
32890
|
+
};
|
|
32652
32891
|
} catch (error) {
|
|
32653
32892
|
logger.warn(`${this.getTag()}: Failed to get max swappable: ${error}`);
|
|
32654
|
-
const maxSwappable = Web3Number.fromWei(
|
|
32655
|
-
|
|
32893
|
+
const maxSwappable = Web3Number.fromWei(
|
|
32894
|
+
"0",
|
|
32895
|
+
vesuAdapter.config.debt.decimals
|
|
32896
|
+
);
|
|
32897
|
+
return {
|
|
32898
|
+
amount: maxBorrowable.minimum(maxSwappable),
|
|
32899
|
+
dexSwappableAmount: maxSwappable,
|
|
32900
|
+
maxBorrowableAmount: maxBorrowable,
|
|
32901
|
+
borrowableAsset: vesuAdapter.config.debt
|
|
32902
|
+
};
|
|
32656
32903
|
}
|
|
32657
32904
|
}
|
|
32658
32905
|
// todo how much to unwind to get back healthy APY zone again
|
|
32659
32906
|
// if net APY < LST APR + 0.5%, we need to unwind to get back to LST APR + 1% atleast or 0 vesu position
|
|
32660
|
-
// For xSTRK, simply deposit in Vesu if looping is not viable
|
|
32907
|
+
// For xSTRK, simply deposit in Vesu if looping is not viable
|
|
32661
32908
|
/**
|
|
32662
32909
|
* Gets LST APR for the strategy's underlying asset from Endur API
|
|
32663
32910
|
* @returns Promise<number> The LST APR (not divided by 1e18)
|
|
32664
32911
|
*/
|
|
32665
32912
|
async getLSTAPR(_address) {
|
|
32666
32913
|
try {
|
|
32667
|
-
const vesuAdapter1 = this.getVesuSameTokenAdapter(
|
|
32668
|
-
|
|
32914
|
+
const vesuAdapter1 = this.getVesuSameTokenAdapter(
|
|
32915
|
+
this.metadata.additionalInfo.defaultPoolId
|
|
32916
|
+
);
|
|
32917
|
+
const apr = await LSTAPRService.getLSTAPR(
|
|
32918
|
+
vesuAdapter1.config.debt.address
|
|
32919
|
+
);
|
|
32669
32920
|
if (!apr) {
|
|
32670
32921
|
throw new Error("Failed to get LST APR");
|
|
32671
32922
|
}
|
|
@@ -32678,19 +32929,37 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
32678
32929
|
// todo undo this
|
|
32679
32930
|
async netAPY() {
|
|
32680
32931
|
const unusedBalance = await this.getUnusedBalance();
|
|
32681
|
-
const maxNewDeposits = await this.maxNewDeposits({
|
|
32682
|
-
|
|
32932
|
+
const maxNewDeposits = await this.maxNewDeposits({
|
|
32933
|
+
isAPYComputation: true
|
|
32934
|
+
});
|
|
32935
|
+
const lstAPY = await this.getLSTAPR(
|
|
32936
|
+
this.getLSTUnderlyingTokenInfo().address
|
|
32937
|
+
);
|
|
32683
32938
|
if (maxNewDeposits * 1.5 < unusedBalance.amount.toNumber()) {
|
|
32684
|
-
logger.verbose(
|
|
32939
|
+
logger.verbose(
|
|
32940
|
+
`${this.getTag()}::netAPY: unused balance is > max servicable from loan, lstAPY: ${lstAPY}`
|
|
32941
|
+
);
|
|
32685
32942
|
const output = await super.netAPY();
|
|
32686
32943
|
output.splits.push({ apy: lstAPY, id: "lst_apy" });
|
|
32687
32944
|
return output;
|
|
32688
32945
|
} else {
|
|
32689
|
-
logger.verbose(
|
|
32946
|
+
logger.verbose(
|
|
32947
|
+
`${this.getTag()}::netAPY: we can take more deposits, use theoretical max APY`
|
|
32948
|
+
);
|
|
32690
32949
|
const { positions, baseAPYs, rewardAPYs } = await this.getVesuAPYs();
|
|
32691
|
-
const weights = positions.map(
|
|
32950
|
+
const weights = positions.map(
|
|
32951
|
+
(p, index) => p.usdValue * (index % 2 == 0 ? 1 : -1)
|
|
32952
|
+
);
|
|
32692
32953
|
const aum = weights.reduce((acc, curr) => acc + curr, 0);
|
|
32693
|
-
const output = await this.returnNetAPY(
|
|
32954
|
+
const output = await this.returnNetAPY(
|
|
32955
|
+
baseAPYs,
|
|
32956
|
+
rewardAPYs,
|
|
32957
|
+
weights,
|
|
32958
|
+
new Web3Number(
|
|
32959
|
+
aum.toFixed(9),
|
|
32960
|
+
this.getLSTUnderlyingTokenInfo().decimals
|
|
32961
|
+
)
|
|
32962
|
+
);
|
|
32694
32963
|
output.splits.push({ apy: lstAPY, id: "lst_apy" });
|
|
32695
32964
|
return output;
|
|
32696
32965
|
}
|
|
@@ -32700,9 +32969,13 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
32700
32969
|
let numerator = 0;
|
|
32701
32970
|
let ltv = void 0;
|
|
32702
32971
|
for (let adapter of this.getVesuAdapters()) {
|
|
32703
|
-
const maxBorrowableAmountInfo = maxBorrowableAmounts.maxBorrowables.find(
|
|
32972
|
+
const maxBorrowableAmountInfo = maxBorrowableAmounts.maxBorrowables.find(
|
|
32973
|
+
(b) => b.borrowableAsset.address.eq(adapter.config.debt.address)
|
|
32974
|
+
);
|
|
32704
32975
|
if (!maxBorrowableAmountInfo || !maxBorrowableAmountInfo?.amount) {
|
|
32705
|
-
throw new Error(
|
|
32976
|
+
throw new Error(
|
|
32977
|
+
`Max borrowable amount not found for adapter: ${adapter.config.debt.symbol}`
|
|
32978
|
+
);
|
|
32706
32979
|
}
|
|
32707
32980
|
numerator += this.metadata.additionalInfo.targetHealthFactor * maxBorrowableAmountInfo.amount.toNumber() / maxBorrowableAmountInfo.ltv;
|
|
32708
32981
|
}
|
|
@@ -32711,7 +32984,9 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
32711
32984
|
// todo revisit cases where 0th adapters is used
|
|
32712
32985
|
async getUnusedBalanceAPY() {
|
|
32713
32986
|
const unusedBalance = await this.getUnusedBalance();
|
|
32714
|
-
const vesuAdapter = this.getVesuSameTokenAdapter(
|
|
32987
|
+
const vesuAdapter = this.getVesuSameTokenAdapter(
|
|
32988
|
+
this.metadata.additionalInfo.defaultPoolId
|
|
32989
|
+
);
|
|
32715
32990
|
const underlying = vesuAdapter.config.debt;
|
|
32716
32991
|
const lstAPY = await this.getLSTAPR(underlying.address);
|
|
32717
32992
|
return {
|
|
@@ -32719,37 +32994,80 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
32719
32994
|
weight: unusedBalance.usdValue
|
|
32720
32995
|
};
|
|
32721
32996
|
}
|
|
32997
|
+
async getLSTAvnuRate() {
|
|
32998
|
+
const vesuAdapter1 = this.getVesuSameTokenAdapter(
|
|
32999
|
+
this.metadata.additionalInfo.defaultPoolId
|
|
33000
|
+
);
|
|
33001
|
+
const lstTokenInfo = vesuAdapter1.config.collateral;
|
|
33002
|
+
const underlyingTokenInfo = vesuAdapter1.config.debt;
|
|
33003
|
+
const avnuModule = new AvnuWrapper();
|
|
33004
|
+
const sellAmount = lstTokenInfo.priceCheckAmount ? new Web3Number(
|
|
33005
|
+
lstTokenInfo.priceCheckAmount,
|
|
33006
|
+
underlyingTokenInfo.decimals
|
|
33007
|
+
) : new Web3Number(1, underlyingTokenInfo.decimals);
|
|
33008
|
+
const quote = await avnuModule.getQuotes(
|
|
33009
|
+
underlyingTokenInfo.address.address,
|
|
33010
|
+
lstTokenInfo.address.address,
|
|
33011
|
+
sellAmount.toWei(),
|
|
33012
|
+
this.metadata.additionalInfo.vaultAllocator.address
|
|
33013
|
+
);
|
|
33014
|
+
const underlyingAmountNumber = sellAmount.toNumber();
|
|
33015
|
+
const lstAmountNumber = Web3Number.fromWei(
|
|
33016
|
+
quote.buyAmount.toString(),
|
|
33017
|
+
lstTokenInfo.decimals
|
|
33018
|
+
).toNumber();
|
|
33019
|
+
assert(lstAmountNumber > 0, "Avnu LST amount is zero");
|
|
33020
|
+
const exchangeRate = underlyingAmountNumber / lstAmountNumber;
|
|
33021
|
+
logger.verbose(
|
|
33022
|
+
`${this.getTag()}:: LST Avnu Exchange Rate: ${exchangeRate}`
|
|
33023
|
+
);
|
|
33024
|
+
return exchangeRate;
|
|
33025
|
+
}
|
|
32722
33026
|
async getLSTExchangeRate() {
|
|
32723
|
-
const vesuAdapter1 = this.getVesuSameTokenAdapter(
|
|
33027
|
+
const vesuAdapter1 = this.getVesuSameTokenAdapter(
|
|
33028
|
+
this.metadata.additionalInfo.defaultPoolId
|
|
33029
|
+
);
|
|
32724
33030
|
const lstTokenInfo = vesuAdapter1.config.collateral;
|
|
32725
33031
|
const lstABI = new import_starknet19.Contract({
|
|
32726
33032
|
abi: erc4626_abi_default,
|
|
32727
33033
|
address: lstTokenInfo.address.address,
|
|
32728
33034
|
providerOrAccount: this.config.provider
|
|
32729
33035
|
});
|
|
32730
|
-
const price = await lstABI.call("convert_to_assets", [
|
|
33036
|
+
const price = await lstABI.call("convert_to_assets", [
|
|
33037
|
+
import_starknet19.uint256.bnToUint256(new Web3Number(1, lstTokenInfo.decimals).toWei())
|
|
33038
|
+
]);
|
|
32731
33039
|
const exchangeRate = Number(import_starknet19.uint256.uint256ToBN(price).toString()) / Math.pow(10, lstTokenInfo.decimals);
|
|
32732
33040
|
logger.verbose(`${this.getTag()}:: LST Exchange Rate: ${exchangeRate}`);
|
|
32733
33041
|
return exchangeRate;
|
|
32734
33042
|
}
|
|
32735
33043
|
/**
|
|
32736
|
-
*
|
|
33044
|
+
*
|
|
32737
33045
|
* @param params marginAmount is in LST, debtAmount is in underlying
|
|
32738
33046
|
*/
|
|
32739
33047
|
async getModifyLeverCall(params) {
|
|
32740
|
-
logger.verbose(
|
|
32741
|
-
|
|
33048
|
+
logger.verbose(
|
|
33049
|
+
`${this.getTag()}::getModifyLeverCall marginAmount: ${params.marginAmount}, debtAmount: ${params.debtAmount}, lstDexPriceInUnderlying: ${params.lstDexPriceInUnderlying}, isIncrease: ${params.isIncrease}`
|
|
33050
|
+
);
|
|
33051
|
+
assert(
|
|
33052
|
+
!params.marginAmount.isZero() || !params.debtAmount.isZero(),
|
|
33053
|
+
"Deposit/debt must be non-0"
|
|
33054
|
+
);
|
|
32742
33055
|
const vesuAdapter1 = this.getVesuSameTokenAdapter(params.poolId);
|
|
32743
33056
|
const lstTokenInfo = this.asset();
|
|
32744
33057
|
const lstUnderlyingTokenInfo = vesuAdapter1.config.debt;
|
|
32745
33058
|
const maxAmounts = lstTokenInfo.symbol == "xSTRK" ? 5e5 : 0.5;
|
|
32746
33059
|
if (params.marginAmount.greaterThan(maxAmounts)) {
|
|
32747
|
-
throw new Error(
|
|
33060
|
+
throw new Error(
|
|
33061
|
+
`Margin amount is greater than max amount: ${params.marginAmount.toNumber()} > ${maxAmounts}`
|
|
33062
|
+
);
|
|
32748
33063
|
}
|
|
32749
33064
|
const proofsIDs = [];
|
|
32750
33065
|
const manageCalls = [];
|
|
32751
33066
|
if (params.marginAmount.greaterThan(0)) {
|
|
32752
|
-
const STEP1_ID = getVesuGenericLegId(
|
|
33067
|
+
const STEP1_ID = getVesuGenericLegId(
|
|
33068
|
+
params.poolId.toString(),
|
|
33069
|
+
"multiple_approve" /* MULTIPLE_APPROVE */
|
|
33070
|
+
);
|
|
32753
33071
|
const manage1Info = this.getProofs(STEP1_ID);
|
|
32754
33072
|
const depositAmount = params.marginAmount;
|
|
32755
33073
|
const manageCall1 = manage1Info.callConstructor({
|
|
@@ -32770,31 +33088,56 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
32770
33088
|
params.debtAmount
|
|
32771
33089
|
// negative for exact amount out
|
|
32772
33090
|
);
|
|
32773
|
-
logger.verbose(
|
|
32774
|
-
|
|
32775
|
-
|
|
32776
|
-
|
|
33091
|
+
logger.verbose(
|
|
33092
|
+
`${this.getTag()}::getModifyLeverCall leverSwapQuote: ${JSON.stringify(leverSwapQuote)}`
|
|
33093
|
+
);
|
|
33094
|
+
assert(
|
|
33095
|
+
leverSwapQuote.price_impact <= params.maxEkuboPriceImpact,
|
|
33096
|
+
"getIncreaseLeverCall: Price impact is too high [Debt swap]"
|
|
33097
|
+
);
|
|
33098
|
+
const leverSwap = ekuboQuoter.getVesuMultiplyQuote(
|
|
33099
|
+
leverSwapQuote,
|
|
33100
|
+
fromToken,
|
|
33101
|
+
toToken
|
|
33102
|
+
);
|
|
33103
|
+
logger.verbose(
|
|
33104
|
+
`${this.getTag()}::getModifyLeverCall leverSwap: ${JSON.stringify(leverSwap)}`
|
|
33105
|
+
);
|
|
32777
33106
|
let minLSTReceived = params.debtAmount.dividedBy(lstDexPriceInUnderlying).multipliedBy(1 - MAX_SLIPPAGE);
|
|
32778
33107
|
const minLSTReceivedAsPerTruePrice = params.debtAmount.dividedBy(lstTrueExchangeRate);
|
|
32779
33108
|
minLSTReceived = minLSTReceivedAsPerTruePrice;
|
|
32780
|
-
logger.verbose(
|
|
33109
|
+
logger.verbose(
|
|
33110
|
+
`${this.getTag()}::getModifyLeverCall minLSTReceivedAsPerTruePrice: ${minLSTReceivedAsPerTruePrice}, minLSTReceived: ${minLSTReceived}`
|
|
33111
|
+
);
|
|
32781
33112
|
let maxUsedCollateral = params.debtAmount.abs().dividedBy(lstDexPriceInUnderlying).multipliedBy(1 + MAX_SLIPPAGE);
|
|
32782
33113
|
const maxUsedCollateralInLST = params.debtAmount.abs().dividedBy(lstTrueExchangeRate).multipliedBy(1.005);
|
|
32783
|
-
logger.verbose(
|
|
33114
|
+
logger.verbose(
|
|
33115
|
+
`${this.getTag()}::getModifyLeverCall maxUsedCollateralInLST: ${maxUsedCollateralInLST}, maxUsedCollateral: ${maxUsedCollateral}`
|
|
33116
|
+
);
|
|
32784
33117
|
maxUsedCollateral = maxUsedCollateralInLST;
|
|
32785
|
-
const STEP2_ID = getVesuGenericLegId(
|
|
33118
|
+
const STEP2_ID = getVesuGenericLegId(
|
|
33119
|
+
params.poolId.toString(),
|
|
33120
|
+
"switch_delegation_on" /* SWITCH_DELEGATION_ON */
|
|
33121
|
+
);
|
|
32786
33122
|
const manage2Info = this.getProofs(STEP2_ID);
|
|
32787
33123
|
const manageCall2 = manage2Info.callConstructor({
|
|
32788
33124
|
delegation: true
|
|
32789
33125
|
});
|
|
32790
|
-
const STEP3_ID = getVesuLegId(
|
|
33126
|
+
const STEP3_ID = getVesuLegId(
|
|
33127
|
+
"multiply_vesu" /* MULTIPLY_VESU */,
|
|
33128
|
+
vesuAdapter1.config.debt.symbol,
|
|
33129
|
+
vesuAdapter1.config.poolId.toString()
|
|
33130
|
+
);
|
|
32791
33131
|
const manage3Info = this.getProofs(STEP3_ID);
|
|
32792
33132
|
const multiplyParams = params.isIncrease ? {
|
|
32793
33133
|
isIncrease: true,
|
|
32794
33134
|
increaseParams: {
|
|
32795
33135
|
add_margin: params.marginAmount,
|
|
32796
33136
|
margin_swap: [],
|
|
32797
|
-
margin_swap_limit_amount: Web3Number.fromWei(
|
|
33137
|
+
margin_swap_limit_amount: Web3Number.fromWei(
|
|
33138
|
+
0,
|
|
33139
|
+
this.asset().decimals
|
|
33140
|
+
),
|
|
32798
33141
|
lever_swap: leverSwap,
|
|
32799
33142
|
lever_swap_limit_amount: minLSTReceived
|
|
32800
33143
|
}
|
|
@@ -32806,15 +33149,21 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
32806
33149
|
lever_swap_limit_amount: maxUsedCollateral,
|
|
32807
33150
|
// only required for close position
|
|
32808
33151
|
lever_swap_weights: [],
|
|
32809
|
-
// no need to swap collateral to anything, and any residuals return our contract anyways.
|
|
33152
|
+
// no need to swap collateral to anything, and any residuals return our contract anyways.
|
|
32810
33153
|
withdraw_swap: [],
|
|
32811
|
-
withdraw_swap_limit_amount: Web3Number.fromWei(
|
|
33154
|
+
withdraw_swap_limit_amount: Web3Number.fromWei(
|
|
33155
|
+
0,
|
|
33156
|
+
this.asset().decimals
|
|
33157
|
+
),
|
|
32812
33158
|
withdraw_swap_weights: [],
|
|
32813
33159
|
close_position: false
|
|
32814
33160
|
}
|
|
32815
33161
|
};
|
|
32816
33162
|
const manageCall3 = manage3Info.callConstructor(multiplyParams);
|
|
32817
|
-
const STEP4_ID = getVesuGenericLegId(
|
|
33163
|
+
const STEP4_ID = getVesuGenericLegId(
|
|
33164
|
+
params.poolId.toString(),
|
|
33165
|
+
"switch_delegation_off" /* SWITCH_DELEGATION_OFF */
|
|
33166
|
+
);
|
|
32818
33167
|
const manage4Info = this.getProofs(STEP4_ID);
|
|
32819
33168
|
const manageCall4 = manage4Info.callConstructor({
|
|
32820
33169
|
delegation: false
|
|
@@ -32828,7 +33177,6 @@ function VaultDescription(lstSymbol, underlyingSymbol) {
|
|
|
32828
33177
|
const containerStyle = {
|
|
32829
33178
|
maxWidth: "800px",
|
|
32830
33179
|
margin: "0 auto",
|
|
32831
|
-
backgroundColor: "#111",
|
|
32832
33180
|
color: "#eee",
|
|
32833
33181
|
fontFamily: "Arial, sans-serif",
|
|
32834
33182
|
borderRadius: "12px"
|
|
@@ -32851,21 +33199,52 @@ function VaultDescription(lstSymbol, underlyingSymbol) {
|
|
|
32851
33199
|
" to create leverage. Depositors receive vault shares that represent a proportional claim on the underlying assets and accrued yield."
|
|
32852
33200
|
] }),
|
|
32853
33201
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("p", { style: { fontSize: "14px", lineHeight: "1.5", marginBottom: "16px" }, children: [
|
|
32854
|
-
"This vault uses Vesu for lending and borrowing. The oracle used by this pool is a
|
|
32855
|
-
|
|
33202
|
+
"This vault uses Vesu for lending and borrowing. The oracle used by this pool is a",
|
|
33203
|
+
" ",
|
|
33204
|
+
highlightTextWithLinks("conversion rate oracle", [
|
|
33205
|
+
{
|
|
33206
|
+
highlight: "conversion rate oracle",
|
|
33207
|
+
link: "https://docs.pragma.build/starknet/development#conversion-rate"
|
|
33208
|
+
}
|
|
33209
|
+
]),
|
|
32856
33210
|
" ",
|
|
32857
33211
|
"which is resilient to liquidity issues and price volatility, hence reducing the risk of liquidation. However, overtime, if left un-monitored, debt can increase enough to trigger a liquidation. But no worries, our continuous monitoring systems look for situations with reduced health factor and balance collateral/debt to bring it back to safe levels. With Troves, you can have a peaceful sleep."
|
|
32858
33212
|
] }),
|
|
32859
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
32860
|
-
|
|
32861
|
-
|
|
32862
|
-
|
|
32863
|
-
|
|
32864
|
-
|
|
32865
|
-
|
|
32866
|
-
|
|
32867
|
-
|
|
32868
|
-
|
|
33213
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
33214
|
+
"div",
|
|
33215
|
+
{
|
|
33216
|
+
style: {
|
|
33217
|
+
backgroundColor: "#222",
|
|
33218
|
+
padding: "10px",
|
|
33219
|
+
borderRadius: "8px",
|
|
33220
|
+
marginBottom: "20px",
|
|
33221
|
+
border: "1px solid #444"
|
|
33222
|
+
},
|
|
33223
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("p", { style: { fontSize: "13px", color: "#ccc" }, children: [
|
|
33224
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("strong", { children: "Withdrawals:" }),
|
|
33225
|
+
" Requests can take up to",
|
|
33226
|
+
" ",
|
|
33227
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("strong", { children: "1-2 hours" }),
|
|
33228
|
+
" to process as the vault unwinds and settles routing."
|
|
33229
|
+
] })
|
|
33230
|
+
}
|
|
33231
|
+
),
|
|
33232
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
33233
|
+
"div",
|
|
33234
|
+
{
|
|
33235
|
+
style: {
|
|
33236
|
+
backgroundColor: "#222",
|
|
33237
|
+
padding: "10px",
|
|
33238
|
+
borderRadius: "8px",
|
|
33239
|
+
marginBottom: "20px",
|
|
33240
|
+
border: "1px solid #444"
|
|
33241
|
+
},
|
|
33242
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("p", { style: { fontSize: "13px", color: "#ccc" }, children: [
|
|
33243
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("strong", { children: "Debt limits:" }),
|
|
33244
|
+
" Pools on Vesu have debt caps that are gradually increased over time. Until caps are raised, deposited LSTs remain in the vault, generating a shared net return for all depositors. There is no additional fee taken by Troves on LST APY, its only on added gain."
|
|
33245
|
+
] })
|
|
33246
|
+
}
|
|
33247
|
+
)
|
|
32869
33248
|
] });
|
|
32870
33249
|
}
|
|
32871
33250
|
function getDescription2(tokenSymbol, underlyingSymbol) {
|
|
@@ -32881,31 +33260,76 @@ function getVesuLegId(baseID, debtTokenSymbol, poolId) {
|
|
|
32881
33260
|
return `${baseID}_${debtTokenSymbol.toLowerCase()}_${poolId.slice(-4).toLowerCase()}`;
|
|
32882
33261
|
}
|
|
32883
33262
|
function addVesuLeaves(poolId, lstSymbol, underlyingSymbol, vaultSettings, commonAdapter) {
|
|
32884
|
-
const lstToken = Global.getDefaultTokens().find(
|
|
32885
|
-
|
|
33263
|
+
const lstToken = Global.getDefaultTokens().find(
|
|
33264
|
+
(token) => token.symbol === lstSymbol
|
|
33265
|
+
);
|
|
33266
|
+
const underlyingToken = Global.getDefaultTokens().find(
|
|
33267
|
+
(token) => token.symbol === underlyingSymbol
|
|
33268
|
+
);
|
|
32886
33269
|
const vesuAdapterLST = new VesuAdapter({
|
|
32887
33270
|
poolId,
|
|
32888
33271
|
collateral: lstToken,
|
|
32889
33272
|
debt: underlyingToken,
|
|
32890
33273
|
vaultAllocator: vaultSettings.vaultAllocator,
|
|
32891
|
-
id: getVesuLegId(
|
|
33274
|
+
id: getVesuLegId(
|
|
33275
|
+
"vesu_leg1" /* VESU_LEG1 */,
|
|
33276
|
+
underlyingToken.symbol,
|
|
33277
|
+
poolId.toString()
|
|
33278
|
+
)
|
|
32892
33279
|
});
|
|
32893
|
-
vaultSettings.adapters.push(
|
|
32894
|
-
|
|
32895
|
-
|
|
32896
|
-
|
|
33280
|
+
vaultSettings.adapters.push(
|
|
33281
|
+
...[
|
|
33282
|
+
{
|
|
33283
|
+
id: getVesuLegId(
|
|
33284
|
+
"vesu_leg1" /* VESU_LEG1 */,
|
|
33285
|
+
underlyingToken.symbol,
|
|
33286
|
+
poolId.toString()
|
|
33287
|
+
),
|
|
33288
|
+
adapter: vesuAdapterLST
|
|
33289
|
+
}
|
|
33290
|
+
]
|
|
33291
|
+
);
|
|
32897
33292
|
const { isV2, addr: poolAddr } = getVesuSingletonAddress(poolId);
|
|
32898
33293
|
const VESU_MULTIPLY = isV2 ? vesuAdapterLST.VESU_MULTIPLY : vesuAdapterLST.VESU_MULTIPLY_V1;
|
|
32899
|
-
const leafIdApprove = getVesuGenericLegId(
|
|
32900
|
-
|
|
32901
|
-
|
|
32902
|
-
|
|
32903
|
-
|
|
32904
|
-
|
|
32905
|
-
|
|
32906
|
-
|
|
32907
|
-
|
|
32908
|
-
|
|
33294
|
+
const leafIdApprove = getVesuGenericLegId(
|
|
33295
|
+
poolId.toString(),
|
|
33296
|
+
"multiple_approve" /* MULTIPLE_APPROVE */
|
|
33297
|
+
);
|
|
33298
|
+
vaultSettings.leafAdapters.push(
|
|
33299
|
+
commonAdapter.getApproveAdapter(lstToken.address, VESU_MULTIPLY, leafIdApprove).bind(commonAdapter)
|
|
33300
|
+
);
|
|
33301
|
+
const leafIdDelegationOn = getVesuGenericLegId(
|
|
33302
|
+
poolId.toString(),
|
|
33303
|
+
"switch_delegation_on" /* SWITCH_DELEGATION_ON */
|
|
33304
|
+
);
|
|
33305
|
+
vaultSettings.leafAdapters.push(
|
|
33306
|
+
vesuAdapterLST.getVesuModifyDelegationAdapter(leafIdDelegationOn, VESU_MULTIPLY).bind(vesuAdapterLST)
|
|
33307
|
+
);
|
|
33308
|
+
const leafIdDelegationOff = getVesuGenericLegId(
|
|
33309
|
+
poolId.toString(),
|
|
33310
|
+
"switch_delegation_off" /* SWITCH_DELEGATION_OFF */
|
|
33311
|
+
);
|
|
33312
|
+
vaultSettings.leafAdapters.push(
|
|
33313
|
+
vesuAdapterLST.getVesuModifyDelegationAdapter(leafIdDelegationOff, VESU_MULTIPLY).bind(vesuAdapterLST)
|
|
33314
|
+
);
|
|
33315
|
+
const multiplID = getVesuLegId(
|
|
33316
|
+
"multiply_vesu" /* MULTIPLY_VESU */,
|
|
33317
|
+
underlyingToken.symbol,
|
|
33318
|
+
poolId.toString()
|
|
33319
|
+
);
|
|
33320
|
+
vaultSettings.leafAdapters.push(
|
|
33321
|
+
vesuAdapterLST.getMultiplyAdapter(multiplID).bind(vesuAdapterLST)
|
|
33322
|
+
);
|
|
33323
|
+
vaultSettings.leafAdapters.push(
|
|
33324
|
+
commonAdapter.getApproveAdapter(
|
|
33325
|
+
lstToken.address,
|
|
33326
|
+
poolAddr,
|
|
33327
|
+
"approve_token1" /* APPROVE_TOKEN1 */
|
|
33328
|
+
).bind(commonAdapter)
|
|
33329
|
+
);
|
|
33330
|
+
vaultSettings.leafAdapters.push(
|
|
33331
|
+
vesuAdapterLST.getModifyPosition.bind(vesuAdapterLST)
|
|
33332
|
+
);
|
|
32909
33333
|
return vesuAdapterLST;
|
|
32910
33334
|
}
|
|
32911
33335
|
function getLooperSettings2(lstSymbol, underlyingSymbol, vaultSettings, defaultPoolId) {
|
|
@@ -32914,8 +33338,12 @@ function getLooperSettings2(lstSymbol, underlyingSymbol, vaultSettings, defaultP
|
|
|
32914
33338
|
if (!pool1.eq(defaultPoolId)) {
|
|
32915
33339
|
throw new Error(`Dont include default pool id in supported pool ids`);
|
|
32916
33340
|
}
|
|
32917
|
-
const lstToken = Global.getDefaultTokens().find(
|
|
32918
|
-
|
|
33341
|
+
const lstToken = Global.getDefaultTokens().find(
|
|
33342
|
+
(token) => token.symbol === lstSymbol
|
|
33343
|
+
);
|
|
33344
|
+
const underlyingToken = Global.getDefaultTokens().find(
|
|
33345
|
+
(token) => token.symbol === underlyingSymbol
|
|
33346
|
+
);
|
|
32919
33347
|
const commonAdapter = new CommonAdapter({
|
|
32920
33348
|
manager: vaultSettings.manager,
|
|
32921
33349
|
asset: lstToken.address,
|
|
@@ -32923,28 +33351,106 @@ function getLooperSettings2(lstSymbol, underlyingSymbol, vaultSettings, defaultP
|
|
|
32923
33351
|
vaultAddress: vaultSettings.vaultAddress,
|
|
32924
33352
|
vaultAllocator: vaultSettings.vaultAllocator
|
|
32925
33353
|
});
|
|
32926
|
-
vaultSettings.adapters.push(
|
|
32927
|
-
|
|
32928
|
-
|
|
32929
|
-
|
|
32930
|
-
|
|
32931
|
-
|
|
32932
|
-
|
|
33354
|
+
vaultSettings.adapters.push(
|
|
33355
|
+
...[
|
|
33356
|
+
{
|
|
33357
|
+
id: "common_adapter" /* COMMON */,
|
|
33358
|
+
adapter: commonAdapter
|
|
33359
|
+
}
|
|
33360
|
+
]
|
|
33361
|
+
);
|
|
33362
|
+
vaultSettings.borrowable_assets.map(
|
|
33363
|
+
(borrowableAsset) => addVesuLeaves(
|
|
33364
|
+
borrowableAsset.poolId,
|
|
33365
|
+
lstSymbol,
|
|
33366
|
+
underlyingSymbol,
|
|
33367
|
+
vaultSettings,
|
|
33368
|
+
commonAdapter
|
|
33369
|
+
)
|
|
33370
|
+
);
|
|
33371
|
+
vaultSettings.leafAdapters.push(
|
|
33372
|
+
commonAdapter.getApproveAdapter(
|
|
33373
|
+
lstToken.address,
|
|
33374
|
+
AVNU_EXCHANGE,
|
|
33375
|
+
"avnu_mul_approve_withdr" /* AVNU_MULTIPLY_APPROVE_WITHDRAW */
|
|
33376
|
+
).bind(commonAdapter)
|
|
33377
|
+
);
|
|
33378
|
+
const uniqueBorrowableAssets = [
|
|
33379
|
+
...new Set(
|
|
33380
|
+
vaultSettings.borrowable_assets.map(
|
|
33381
|
+
(borrowableAsset) => borrowableAsset.token.symbol
|
|
33382
|
+
)
|
|
33383
|
+
)
|
|
33384
|
+
];
|
|
32933
33385
|
for (let borrowableAssetSymbol of uniqueBorrowableAssets) {
|
|
32934
|
-
const borrowableAsset = Global.getDefaultTokens().find(
|
|
33386
|
+
const borrowableAsset = Global.getDefaultTokens().find(
|
|
33387
|
+
(token) => token.symbol === borrowableAssetSymbol
|
|
33388
|
+
);
|
|
32935
33389
|
const debtAsset = borrowableAsset;
|
|
32936
|
-
const approve_debt_token_id = getAvnuManageIDs(
|
|
32937
|
-
|
|
32938
|
-
|
|
32939
|
-
|
|
32940
|
-
|
|
32941
|
-
|
|
32942
|
-
|
|
32943
|
-
|
|
32944
|
-
|
|
32945
|
-
|
|
32946
|
-
|
|
32947
|
-
|
|
33390
|
+
const approve_debt_token_id = getAvnuManageIDs(
|
|
33391
|
+
"avnu_mul_approve_dep" /* AVNU_MULTIPLY_APPROVE_DEPOSIT */,
|
|
33392
|
+
debtAsset.symbol
|
|
33393
|
+
);
|
|
33394
|
+
const swap_debt_token_id = getAvnuManageIDs(
|
|
33395
|
+
"avnu_mul_swap_dep" /* AVNU_MULTIPLY_SWAP_DEPOSIT */,
|
|
33396
|
+
debtAsset.symbol
|
|
33397
|
+
);
|
|
33398
|
+
const swap_lst_token_id = getAvnuManageIDs(
|
|
33399
|
+
"avnu_mul_swap_withdr" /* AVNU_MULTIPLY_SWAP_WITHDRAW */,
|
|
33400
|
+
debtAsset.symbol
|
|
33401
|
+
);
|
|
33402
|
+
vaultSettings.leafAdapters.push(
|
|
33403
|
+
commonAdapter.getApproveAdapter(
|
|
33404
|
+
debtAsset.address,
|
|
33405
|
+
AVNU_EXCHANGE,
|
|
33406
|
+
approve_debt_token_id
|
|
33407
|
+
).bind(commonAdapter)
|
|
33408
|
+
);
|
|
33409
|
+
vaultSettings.leafAdapters.push(
|
|
33410
|
+
commonAdapter.getAvnuAdapter(
|
|
33411
|
+
debtAsset.address,
|
|
33412
|
+
lstToken.address,
|
|
33413
|
+
swap_debt_token_id,
|
|
33414
|
+
false
|
|
33415
|
+
).bind(commonAdapter)
|
|
33416
|
+
);
|
|
33417
|
+
vaultSettings.leafAdapters.push(
|
|
33418
|
+
commonAdapter.getAvnuAdapter(
|
|
33419
|
+
lstToken.address,
|
|
33420
|
+
debtAsset.address,
|
|
33421
|
+
swap_lst_token_id,
|
|
33422
|
+
false
|
|
33423
|
+
).bind(commonAdapter)
|
|
33424
|
+
);
|
|
33425
|
+
}
|
|
33426
|
+
vaultSettings.leafAdapters.push(
|
|
33427
|
+
commonAdapter.getApproveAdapter(
|
|
33428
|
+
lstToken.address,
|
|
33429
|
+
vaultSettings.vaultAddress,
|
|
33430
|
+
"approve_bring_liquidity" /* APPROVE_BRING_LIQUIDITY */
|
|
33431
|
+
).bind(commonAdapter)
|
|
33432
|
+
);
|
|
33433
|
+
vaultSettings.leafAdapters.push(
|
|
33434
|
+
commonAdapter.getBringLiquidityAdapter("bring_liquidity" /* BRING_LIQUIDITY */).bind(commonAdapter)
|
|
33435
|
+
);
|
|
33436
|
+
const STRKToken = Global.getDefaultTokens().find(
|
|
33437
|
+
(token) => token.symbol === "STRK"
|
|
33438
|
+
);
|
|
33439
|
+
vaultSettings.leafAdapters.push(
|
|
33440
|
+
commonAdapter.getApproveAdapter(
|
|
33441
|
+
STRKToken.address,
|
|
33442
|
+
AVNU_EXCHANGE,
|
|
33443
|
+
"approve_swap_token1" /* APPROVE_SWAP_TOKEN1 */
|
|
33444
|
+
).bind(commonAdapter)
|
|
33445
|
+
);
|
|
33446
|
+
vaultSettings.leafAdapters.push(
|
|
33447
|
+
commonAdapter.getAvnuAdapter(
|
|
33448
|
+
STRKToken.address,
|
|
33449
|
+
lstToken.address,
|
|
33450
|
+
"avnu_swap_rewards" /* AVNU_SWAP_REWARDS */,
|
|
33451
|
+
false
|
|
33452
|
+
).bind(commonAdapter)
|
|
33453
|
+
);
|
|
32948
33454
|
return vaultSettings;
|
|
32949
33455
|
}
|
|
32950
33456
|
var AUDIT_URL4 = "https://docs.troves.fi/p/security#starknet-vault-kit";
|
|
@@ -32963,7 +33469,8 @@ function getFAQs2(lstSymbol, underlyingSymbol) {
|
|
|
32963
33469
|
answer: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { children: [
|
|
32964
33470
|
"Currently, the LST is from ",
|
|
32965
33471
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("strong", { children: "Endur" }),
|
|
32966
|
-
" while
|
|
33472
|
+
" while",
|
|
33473
|
+
" ",
|
|
32967
33474
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("strong", { children: "Vesu" }),
|
|
32968
33475
|
" is used to collateralize the looped position."
|
|
32969
33476
|
] })
|
|
@@ -32995,23 +33502,48 @@ function getFAQs2(lstSymbol, underlyingSymbol) {
|
|
|
32995
33502
|
];
|
|
32996
33503
|
}
|
|
32997
33504
|
var _riskFactor4 = [
|
|
32998
|
-
{
|
|
32999
|
-
|
|
33000
|
-
|
|
33001
|
-
|
|
33002
|
-
|
|
33003
|
-
|
|
33004
|
-
|
|
33005
|
-
|
|
33006
|
-
|
|
33007
|
-
|
|
33505
|
+
{
|
|
33506
|
+
type: "Smart Contract Risk" /* SMART_CONTRACT_RISK */,
|
|
33507
|
+
value: 2 /* WELL_AUDITED */,
|
|
33508
|
+
weight: 25,
|
|
33509
|
+
reason: "Audited by Zellic"
|
|
33510
|
+
},
|
|
33511
|
+
{
|
|
33512
|
+
type: "Liquidation Risk" /* LIQUIDATION_RISK */,
|
|
33513
|
+
value: 1 /* VERY_LOW_PROBABILITY */,
|
|
33514
|
+
weight: 25,
|
|
33515
|
+
reason: "The collateral and debt are highly correlated"
|
|
33516
|
+
},
|
|
33517
|
+
{
|
|
33518
|
+
type: "Technical Risk" /* TECHNICAL_RISK */,
|
|
33519
|
+
value: 1 /* STABLE_INFRASTRUCTURE */,
|
|
33520
|
+
weight: 25,
|
|
33521
|
+
reason: "Liquidation can only happen if vault is left un-monitored for weeks, which is highly unlikely. We actively monitor all services on a daily basis."
|
|
33522
|
+
},
|
|
33523
|
+
{
|
|
33524
|
+
type: "Depeg Risk" /* DEPEG_RISK */,
|
|
33525
|
+
value: 2 /* GENERALLY_STABLE */,
|
|
33526
|
+
weight: 25,
|
|
33527
|
+
reason: "Generally stable pegged assets"
|
|
33528
|
+
}
|
|
33008
33529
|
];
|
|
33530
|
+
var btcBorrowableAssets = ["WBTC", "tBTC", "LBTC", "solvBTC"];
|
|
33009
33531
|
var hyperxSTRK = {
|
|
33010
|
-
vaultAddress: ContractAddr.from(
|
|
33011
|
-
|
|
33012
|
-
|
|
33013
|
-
|
|
33014
|
-
|
|
33532
|
+
vaultAddress: ContractAddr.from(
|
|
33533
|
+
"0x46c7a54c82b1fe374353859f554a40b8bd31d3e30f742901579e7b57b1b5960"
|
|
33534
|
+
),
|
|
33535
|
+
manager: ContractAddr.from(
|
|
33536
|
+
"0x5d499cd333757f461a0bedaca3dfc4d77320c773037e0aa299f22a6dbfdc03a"
|
|
33537
|
+
),
|
|
33538
|
+
vaultAllocator: ContractAddr.from(
|
|
33539
|
+
"0x511d07953a09bc7c505970891507c5a2486d2ea22752601a14db092186d7caa"
|
|
33540
|
+
),
|
|
33541
|
+
redeemRequestNFT: ContractAddr.from(
|
|
33542
|
+
"0x51e40b839dc0c2feca923f863072673b94abfa2483345be3b30b457a90d095"
|
|
33543
|
+
),
|
|
33544
|
+
aumOracle: ContractAddr.from(
|
|
33545
|
+
"0x48cf709870a1a0d453d37de108e0c41b8b89819ef54f95abc0e2e1f98bbe937"
|
|
33546
|
+
),
|
|
33015
33547
|
leafAdapters: [],
|
|
33016
33548
|
adapters: [],
|
|
33017
33549
|
targetHealthFactor: 1.1,
|
|
@@ -33022,35 +33554,63 @@ var hyperxSTRK = {
|
|
|
33022
33554
|
...Global.getDefaultTokens().filter((token) => token.symbol === "STRK").map((token) => ({ token, poolId: VesuPools.Re7STRK }))
|
|
33023
33555
|
// v2, new alt for Re7xSTRK
|
|
33024
33556
|
],
|
|
33025
|
-
underlyingToken: Global.getDefaultTokens().find(
|
|
33557
|
+
underlyingToken: Global.getDefaultTokens().find(
|
|
33558
|
+
(token) => token.symbol === "STRK"
|
|
33559
|
+
),
|
|
33026
33560
|
defaultPoolId: VesuPools.Re7xSTRK
|
|
33027
33561
|
};
|
|
33028
33562
|
var hyperxWBTC = {
|
|
33029
|
-
vaultAddress: ContractAddr.from(
|
|
33030
|
-
|
|
33031
|
-
|
|
33032
|
-
|
|
33033
|
-
|
|
33563
|
+
vaultAddress: ContractAddr.from(
|
|
33564
|
+
"0x2da9d0f96a46b453f55604313785dc866424240b1c6811d13bef594343db818"
|
|
33565
|
+
),
|
|
33566
|
+
manager: ContractAddr.from(
|
|
33567
|
+
"0x75866db44c81e6986f06035206ee9c7d15833ddb22d6a22c016cfb5c866a491"
|
|
33568
|
+
),
|
|
33569
|
+
vaultAllocator: ContractAddr.from(
|
|
33570
|
+
"0x57b5c1bb457b5e840a2714ae53ada87d77be2f3fd33a59b4fe709ef20c020c1"
|
|
33571
|
+
),
|
|
33572
|
+
redeemRequestNFT: ContractAddr.from(
|
|
33573
|
+
"0x7a5dc288325456f05e70e9616e16bc02ffbe448f4b89f80b47c0970b989c7c"
|
|
33574
|
+
),
|
|
33575
|
+
aumOracle: ContractAddr.from(
|
|
33576
|
+
"0x258f8a0ca0d21f542e48ad89d00e92dc4d9db4999084f50ef9c22dfb1e83023"
|
|
33577
|
+
),
|
|
33034
33578
|
leafAdapters: [],
|
|
33035
33579
|
adapters: [],
|
|
33036
33580
|
targetHealthFactor: 1.1,
|
|
33037
33581
|
minHealthFactor: 1.05,
|
|
33038
33582
|
borrowable_assets: [
|
|
33039
33583
|
// allow all BTC flavours borrowing on Re7xBTC pool
|
|
33040
|
-
...btcBorrowableAssets.map(
|
|
33584
|
+
...btcBorrowableAssets.map(
|
|
33585
|
+
(asset) => Global.getDefaultTokens().find((token) => token.symbol === asset)
|
|
33586
|
+
).map((token) => ({ token, poolId: VesuPools.Re7xBTC })),
|
|
33041
33587
|
// allow only WBTC borrowing on Prime pool
|
|
33042
33588
|
...Global.getDefaultTokens().filter((token) => token.symbol === "WBTC").map((token) => ({ token, poolId: VesuPools.Prime }))
|
|
33043
33589
|
],
|
|
33044
|
-
underlyingToken: Global.getDefaultTokens().find(
|
|
33590
|
+
underlyingToken: Global.getDefaultTokens().find(
|
|
33591
|
+
(token) => token.symbol === "WBTC"
|
|
33592
|
+
),
|
|
33045
33593
|
defaultPoolId: VesuPools.Re7xBTC,
|
|
33046
|
-
redemptionRouter: ContractAddr.from(
|
|
33594
|
+
redemptionRouter: ContractAddr.from(
|
|
33595
|
+
"0x6ea649f402898f69baf775c1afdd08522c071c640b9c4460192070ec2b96417"
|
|
33596
|
+
)
|
|
33047
33597
|
};
|
|
33048
33598
|
var hyperxtBTC = {
|
|
33049
|
-
vaultAddress: ContractAddr.from(
|
|
33050
|
-
|
|
33051
|
-
|
|
33052
|
-
|
|
33053
|
-
|
|
33599
|
+
vaultAddress: ContractAddr.from(
|
|
33600
|
+
"0x47d5f68477e5637ce0e56436c6b5eee5a354e6828995dae106b11a48679328"
|
|
33601
|
+
),
|
|
33602
|
+
manager: ContractAddr.from(
|
|
33603
|
+
"0xc4cc3e08029a0ae076f5fdfca70575abb78d23c5cd1c49a957f7e697885401"
|
|
33604
|
+
),
|
|
33605
|
+
vaultAllocator: ContractAddr.from(
|
|
33606
|
+
"0x50bbd4fe69f841ecb13b2619fe50ebfa4e8944671b5d0ebf7868fd80c61b31e"
|
|
33607
|
+
),
|
|
33608
|
+
redeemRequestNFT: ContractAddr.from(
|
|
33609
|
+
"0xeac9032f02057779816e38a6cb9185d12d86b3aacc9949b96b36de359c1e3"
|
|
33610
|
+
),
|
|
33611
|
+
aumOracle: ContractAddr.from(
|
|
33612
|
+
"0x7e0d05cb7ba3f7db77a36c21c21583b5a524c2e685c08c24b3554911fb4a039"
|
|
33613
|
+
),
|
|
33054
33614
|
leafAdapters: [],
|
|
33055
33615
|
adapters: [],
|
|
33056
33616
|
targetHealthFactor: 1.1,
|
|
@@ -33058,16 +33618,30 @@ var hyperxtBTC = {
|
|
|
33058
33618
|
borrowable_assets: [
|
|
33059
33619
|
...Global.getDefaultTokens().filter((token) => token.symbol === "tBTC" || token.symbol === "WBTC").map((token) => ({ token, poolId: VesuPools.Re7xBTC }))
|
|
33060
33620
|
],
|
|
33061
|
-
underlyingToken: Global.getDefaultTokens().find(
|
|
33621
|
+
underlyingToken: Global.getDefaultTokens().find(
|
|
33622
|
+
(token) => token.symbol === "tBTC"
|
|
33623
|
+
),
|
|
33062
33624
|
defaultPoolId: VesuPools.Re7xBTC,
|
|
33063
|
-
redemptionRouter: ContractAddr.from(
|
|
33625
|
+
redemptionRouter: ContractAddr.from(
|
|
33626
|
+
"0x3de9c409d1e357e25778fb7a3e2e2393666956846a5c2caa607296fa8e76b5d"
|
|
33627
|
+
)
|
|
33064
33628
|
};
|
|
33065
33629
|
var hyperxsBTC = {
|
|
33066
|
-
vaultAddress: ContractAddr.from(
|
|
33067
|
-
|
|
33068
|
-
|
|
33069
|
-
|
|
33070
|
-
|
|
33630
|
+
vaultAddress: ContractAddr.from(
|
|
33631
|
+
"0x437ef1e7d0f100b2e070b7a65cafec0b2be31b0290776da8b4112f5473d8d9"
|
|
33632
|
+
),
|
|
33633
|
+
manager: ContractAddr.from(
|
|
33634
|
+
"0xc9ac023090625b0be3f6532ca353f086746f9c09f939dbc1b2613f09e5f821"
|
|
33635
|
+
),
|
|
33636
|
+
vaultAllocator: ContractAddr.from(
|
|
33637
|
+
"0x60c2d856936b975459a5b4eb28b8672d91f757bd76cebb6241f8d670185dc01"
|
|
33638
|
+
),
|
|
33639
|
+
redeemRequestNFT: ContractAddr.from(
|
|
33640
|
+
"0x429e8ee8bc7ecd1ade72630d350a2e0f10f9a2507c45f188ba17fe8f2ab4cf3"
|
|
33641
|
+
),
|
|
33642
|
+
aumOracle: ContractAddr.from(
|
|
33643
|
+
"0x149298ade3e79ec6cbdac6cfad289c57504eaf54e590939136ed1ceca60c345"
|
|
33644
|
+
),
|
|
33071
33645
|
leafAdapters: [],
|
|
33072
33646
|
adapters: [],
|
|
33073
33647
|
targetHealthFactor: 1.1,
|
|
@@ -33075,15 +33649,27 @@ var hyperxsBTC = {
|
|
|
33075
33649
|
borrowable_assets: [
|
|
33076
33650
|
...Global.getDefaultTokens().filter((token) => token.symbol === "solvBTC").map((token) => ({ token, poolId: VesuPools.Re7xBTC }))
|
|
33077
33651
|
],
|
|
33078
|
-
underlyingToken: Global.getDefaultTokens().find(
|
|
33652
|
+
underlyingToken: Global.getDefaultTokens().find(
|
|
33653
|
+
(token) => token.symbol === "solvBTC"
|
|
33654
|
+
),
|
|
33079
33655
|
defaultPoolId: VesuPools.Re7xBTC
|
|
33080
33656
|
};
|
|
33081
33657
|
var hyperxLBTC = {
|
|
33082
|
-
vaultAddress: ContractAddr.from(
|
|
33083
|
-
|
|
33084
|
-
|
|
33085
|
-
|
|
33086
|
-
|
|
33658
|
+
vaultAddress: ContractAddr.from(
|
|
33659
|
+
"0x64cf24d4883fe569926419a0569ab34497c6956a1a308fa883257f7486d7030"
|
|
33660
|
+
),
|
|
33661
|
+
manager: ContractAddr.from(
|
|
33662
|
+
"0x203530a4022a99b8f4b406aaf33b0849d43ad7422c1d5cc14ff8c667abec6c0"
|
|
33663
|
+
),
|
|
33664
|
+
vaultAllocator: ContractAddr.from(
|
|
33665
|
+
"0x7dbc8ccd4eabce6ea6c19e0e5c9ccca3a93bd510303b9e071cbe25fc508546e"
|
|
33666
|
+
),
|
|
33667
|
+
redeemRequestNFT: ContractAddr.from(
|
|
33668
|
+
"0x5ee66a39af9aef3d0d48982b4a63e8bd2a5bad021916bd87fb0eae3a26800b8"
|
|
33669
|
+
),
|
|
33670
|
+
aumOracle: ContractAddr.from(
|
|
33671
|
+
"0x23d69e4391fa72d10e625e7575d8bddbb4aff96f04503f83fdde23123bf41d0"
|
|
33672
|
+
),
|
|
33087
33673
|
leafAdapters: [],
|
|
33088
33674
|
adapters: [],
|
|
33089
33675
|
targetHealthFactor: 1.1,
|
|
@@ -33091,7 +33677,9 @@ var hyperxLBTC = {
|
|
|
33091
33677
|
borrowable_assets: [
|
|
33092
33678
|
...Global.getDefaultTokens().filter((token) => token.symbol === "LBTC").map((token) => ({ token, poolId: VesuPools.Re7xBTC }))
|
|
33093
33679
|
],
|
|
33094
|
-
underlyingToken: Global.getDefaultTokens().find(
|
|
33680
|
+
underlyingToken: Global.getDefaultTokens().find(
|
|
33681
|
+
(token) => token.symbol === "LBTC"
|
|
33682
|
+
),
|
|
33095
33683
|
defaultPoolId: VesuPools.Re7xBTC
|
|
33096
33684
|
};
|
|
33097
33685
|
function getInvestmentSteps(lstSymbol, underlyingSymbol) {
|
|
@@ -33109,7 +33697,7 @@ function getMaxTVL(lstSymbol) {
|
|
|
33109
33697
|
xLBTC: 5,
|
|
33110
33698
|
xtBTC: 5,
|
|
33111
33699
|
xsBTC: 5,
|
|
33112
|
-
xSTRK:
|
|
33700
|
+
xSTRK: 7e6
|
|
33113
33701
|
};
|
|
33114
33702
|
const maxTVLValue = lstMaxTVLs[lstSymbol] || 0;
|
|
33115
33703
|
const token = Global.getDefaultTokens().find(
|
|
@@ -33178,15 +33766,19 @@ var HYPER_LST_SECURITY = {
|
|
|
33178
33766
|
};
|
|
33179
33767
|
var HYPER_LST_REDEMPTION_INFO = {
|
|
33180
33768
|
instantWithdrawalVault: "No" /* NO */,
|
|
33181
|
-
redemptionsInfo: [
|
|
33182
|
-
|
|
33183
|
-
|
|
33184
|
-
|
|
33185
|
-
|
|
33186
|
-
|
|
33187
|
-
|
|
33188
|
-
|
|
33189
|
-
|
|
33769
|
+
redemptionsInfo: [
|
|
33770
|
+
{
|
|
33771
|
+
title: "Typical Duration",
|
|
33772
|
+
description: "1-2 hours"
|
|
33773
|
+
}
|
|
33774
|
+
],
|
|
33775
|
+
alerts: [
|
|
33776
|
+
{
|
|
33777
|
+
type: "info",
|
|
33778
|
+
text: "In cases of low liquidity, high slippages, the redemptions can take longer time. Redemption times are estimates and may vary based on network conditions and liquidity requirements.",
|
|
33779
|
+
tab: "withdraw"
|
|
33780
|
+
}
|
|
33781
|
+
]
|
|
33190
33782
|
};
|
|
33191
33783
|
function getStrategySettings(lstSymbol, underlyingSymbol, settings, isPreview = false) {
|
|
33192
33784
|
return {
|
|
@@ -33201,9 +33793,7 @@ function getStrategySettings(lstSymbol, underlyingSymbol, settings, isPreview =
|
|
|
33201
33793
|
description: `Creates leveraged looping position on ${lstSymbol} by borrowing ${underlyingSymbol} to increase yield`
|
|
33202
33794
|
},
|
|
33203
33795
|
depositTokens: [
|
|
33204
|
-
Global.getDefaultTokens().find(
|
|
33205
|
-
(token) => token.symbol === lstSymbol
|
|
33206
|
-
)
|
|
33796
|
+
Global.getDefaultTokens().find((token) => token.symbol === lstSymbol)
|
|
33207
33797
|
],
|
|
33208
33798
|
additionalInfo: getLooperSettings2(
|
|
33209
33799
|
lstSymbol,
|
|
@@ -33213,10 +33803,7 @@ function getStrategySettings(lstSymbol, underlyingSymbol, settings, isPreview =
|
|
|
33213
33803
|
),
|
|
33214
33804
|
risk: {
|
|
33215
33805
|
riskFactor: _riskFactor4,
|
|
33216
|
-
netRisk: _riskFactor4.reduce(
|
|
33217
|
-
(acc, curr) => acc + curr.value * curr.weight,
|
|
33218
|
-
0
|
|
33219
|
-
) / _riskFactor4.reduce((acc, curr) => acc + curr.weight, 0),
|
|
33806
|
+
netRisk: _riskFactor4.reduce((acc, curr) => acc + curr.value * curr.weight, 0) / _riskFactor4.reduce((acc, curr) => acc + curr.weight, 0),
|
|
33220
33807
|
notARisks: getNoRiskTags(_riskFactor4)
|
|
33221
33808
|
},
|
|
33222
33809
|
auditUrl: AUDIT_URL4,
|
|
@@ -33231,16 +33818,19 @@ function getStrategySettings(lstSymbol, underlyingSymbol, settings, isPreview =
|
|
|
33231
33818
|
investmentSteps: getInvestmentSteps(lstSymbol, underlyingSymbol),
|
|
33232
33819
|
isPreview,
|
|
33233
33820
|
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.",
|
|
33821
|
+
realizedAPYMethodology: "The realizedAPY is based on past 14 days performance by the vault",
|
|
33234
33822
|
tags: lstSymbol.includes("BTC") ? ["BTC" /* BTC */, "Maxx" /* LEVERED */] : ["Maxx" /* LEVERED */],
|
|
33235
33823
|
security: HYPER_LST_SECURITY,
|
|
33236
33824
|
redemptionInfo: HYPER_LST_REDEMPTION_INFO,
|
|
33237
33825
|
usualTimeToEarnings: "2 weeks",
|
|
33238
33826
|
usualTimeToEarningsDescription: "Strategy returns depend on LST price on DEXes. Even though the true price of LST on Endur increases continuously, the DEX price may lag sometimes, and historically is seen to rebase at least once every 2 hours. This is when you realise your earnings.",
|
|
33239
|
-
points: [
|
|
33240
|
-
|
|
33241
|
-
|
|
33242
|
-
|
|
33243
|
-
|
|
33827
|
+
points: [
|
|
33828
|
+
{
|
|
33829
|
+
multiplier: 4,
|
|
33830
|
+
logo: "https://endur.fi/favicon.ico",
|
|
33831
|
+
toolTip: "This strategy holds xSTRK. Earn 3-4x Endur points on your xSTRK due to the leverage. Points can be found on endur.fi."
|
|
33832
|
+
}
|
|
33833
|
+
]
|
|
33244
33834
|
};
|
|
33245
33835
|
}
|
|
33246
33836
|
var HyperLSTStrategies = [
|
|
@@ -34079,6 +34669,7 @@ var deployer_default = Deployer;
|
|
|
34079
34669
|
Initializable,
|
|
34080
34670
|
InstantWithdrawalVault,
|
|
34081
34671
|
LSTAPRService,
|
|
34672
|
+
LSTPriceType,
|
|
34082
34673
|
MarginType,
|
|
34083
34674
|
MyNumber,
|
|
34084
34675
|
Network,
|