@strkfarm/sdk 2.0.0-staging.23 → 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 +846 -322
- package/dist/index.browser.mjs +770 -246
- package/dist/index.d.ts +1 -0
- package/dist/index.js +770 -246
- package/dist/index.mjs +770 -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/universal-lst-muliplier-strategy.tsx +1317 -576
- package/src/strategies/universal-strategy.tsx +1 -1
package/dist/index.browser.mjs
CHANGED
|
@@ -17966,6 +17966,7 @@ var xSTRKSTRK = {
|
|
|
17966
17966
|
notARisks: getNoRiskTags(_lstPoolRiskFactors)
|
|
17967
17967
|
},
|
|
17968
17968
|
apyMethodology: "APY based on 30-day historical performance, including fees and rewards.",
|
|
17969
|
+
realizedAPYMethodology: "The realizedAPY is based on past 14 days performance by the vault",
|
|
17969
17970
|
additionalInfo: {
|
|
17970
17971
|
newBounds: {
|
|
17971
17972
|
lower: -1,
|
|
@@ -18118,6 +18119,7 @@ var createLSTStrategy = (params) => ({
|
|
|
18118
18119
|
),
|
|
18119
18120
|
Global.getDefaultTokens().find((t) => t.symbol === params.depositToken1Symbol)
|
|
18120
18121
|
],
|
|
18122
|
+
realizedAPYMethodology: "The realizedAPY is based on past 14 days performance by the vault",
|
|
18121
18123
|
additionalInfo: {
|
|
18122
18124
|
...xSTRKSTRK.additionalInfo,
|
|
18123
18125
|
quoteAsset: Global.getDefaultTokens().find(
|
|
@@ -31804,7 +31806,6 @@ function MetaVaultDescription(allowedSources) {
|
|
|
31804
31806
|
const containerStyle = {
|
|
31805
31807
|
maxWidth: "800px",
|
|
31806
31808
|
margin: "0 auto",
|
|
31807
|
-
backgroundColor: "#111",
|
|
31808
31809
|
color: "#eee",
|
|
31809
31810
|
fontFamily: "Arial, sans-serif",
|
|
31810
31811
|
borderRadius: "12px"
|
|
@@ -31997,6 +31998,7 @@ var createUniversalStrategy = (params) => ({
|
|
|
31997
31998
|
risk: getUniversalRisk(),
|
|
31998
31999
|
auditUrl: AUDIT_URL3,
|
|
31999
32000
|
protocols: [Protocols.VESU],
|
|
32001
|
+
realizedAPYMethodology: "The realizedAPY is based on past 14 days performance by the vault",
|
|
32000
32002
|
curator: {
|
|
32001
32003
|
name: "Unwrap Labs",
|
|
32002
32004
|
logo: "https://assets.troves.fi/integrations/unwraplabs/white.png"
|
|
@@ -32107,23 +32109,36 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
32107
32109
|
constructor(config, pricer, metadata) {
|
|
32108
32110
|
super(config, pricer, metadata);
|
|
32109
32111
|
this.quoteAmountToFetchPrice = new Web3Number(1, 18);
|
|
32110
|
-
const STRKToken = Global.getDefaultTokens().find(
|
|
32112
|
+
const STRKToken = Global.getDefaultTokens().find(
|
|
32113
|
+
(token) => token.symbol === "STRK"
|
|
32114
|
+
);
|
|
32111
32115
|
const underlyingToken = this.getLSTUnderlyingTokenInfo();
|
|
32112
32116
|
if (underlyingToken.address.eq(STRKToken.address)) {
|
|
32113
32117
|
this.quoteAmountToFetchPrice = new Web3Number(100, 18);
|
|
32114
32118
|
} else {
|
|
32115
|
-
this.quoteAmountToFetchPrice = new Web3Number(
|
|
32119
|
+
this.quoteAmountToFetchPrice = new Web3Number(
|
|
32120
|
+
0.01,
|
|
32121
|
+
this.asset().decimals
|
|
32122
|
+
);
|
|
32116
32123
|
}
|
|
32117
32124
|
}
|
|
32118
32125
|
asset() {
|
|
32119
|
-
return this.getVesuSameTokenAdapter(
|
|
32126
|
+
return this.getVesuSameTokenAdapter(
|
|
32127
|
+
this.metadata.additionalInfo.defaultPoolId
|
|
32128
|
+
).config.collateral;
|
|
32120
32129
|
}
|
|
32121
32130
|
getTag() {
|
|
32122
32131
|
return `${_UniversalLstMultiplierStrategy.name}:${this.metadata.name}`;
|
|
32123
32132
|
}
|
|
32124
32133
|
// Vesu adapter with LST and base token match
|
|
32125
32134
|
getVesuSameTokenAdapter(poolId) {
|
|
32126
|
-
const baseAdapter = this.getAdapter(
|
|
32135
|
+
const baseAdapter = this.getAdapter(
|
|
32136
|
+
getVesuLegId(
|
|
32137
|
+
"vesu_leg1" /* VESU_LEG1 */,
|
|
32138
|
+
this.metadata.additionalInfo.underlyingToken.symbol,
|
|
32139
|
+
poolId.toString()
|
|
32140
|
+
)
|
|
32141
|
+
);
|
|
32127
32142
|
baseAdapter.networkConfig = this.config;
|
|
32128
32143
|
baseAdapter.pricer = this.pricer;
|
|
32129
32144
|
return baseAdapter;
|
|
@@ -32166,27 +32181,43 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
32166
32181
|
lstUnderlyingTokenInfo.address.address,
|
|
32167
32182
|
this.quoteAmountToFetchPrice
|
|
32168
32183
|
);
|
|
32169
|
-
const outputAmount = Web3Number.fromWei(
|
|
32184
|
+
const outputAmount = Web3Number.fromWei(
|
|
32185
|
+
quote.total_calculated,
|
|
32186
|
+
lstUnderlyingTokenInfo.decimals
|
|
32187
|
+
);
|
|
32170
32188
|
const price = outputAmount.toNumber() / this.quoteAmountToFetchPrice.toNumber();
|
|
32171
32189
|
logger.verbose(`${this.getTag()}:: LST Dex Price: ${price}`);
|
|
32172
32190
|
return price;
|
|
32173
32191
|
}
|
|
32174
32192
|
async getAvnuSwapMultiplyCall(params) {
|
|
32175
|
-
assert(
|
|
32176
|
-
|
|
32193
|
+
assert(
|
|
32194
|
+
params.isDeposit,
|
|
32195
|
+
"Only deposit is supported in getAvnuSwapMultiplyCall"
|
|
32196
|
+
);
|
|
32197
|
+
const maxBorrowableAmounts = await this.getMaxBorrowableAmount({
|
|
32198
|
+
isAPYComputation: false
|
|
32199
|
+
});
|
|
32177
32200
|
const allVesuAdapters = this.getVesuAdapters();
|
|
32178
32201
|
let remainingAmount = params.leg1DepositAmount;
|
|
32179
32202
|
const lstExRate = await this.getLSTExchangeRate();
|
|
32180
|
-
const baseAssetPrice = await this.pricer.getPrice(
|
|
32203
|
+
const baseAssetPrice = await this.pricer.getPrice(
|
|
32204
|
+
this.getLSTUnderlyingTokenInfo().symbol
|
|
32205
|
+
);
|
|
32181
32206
|
const lstPrice = baseAssetPrice.price * lstExRate;
|
|
32182
32207
|
for (let i = 0; i < maxBorrowableAmounts.maxBorrowables.length; i++) {
|
|
32183
32208
|
const maxBorrowable = maxBorrowableAmounts.maxBorrowables[i];
|
|
32184
|
-
const vesuAdapter = allVesuAdapters.find(
|
|
32209
|
+
const vesuAdapter = allVesuAdapters.find(
|
|
32210
|
+
(adapter) => adapter.config.debt.address.eq(maxBorrowable.borrowableAsset.address)
|
|
32211
|
+
);
|
|
32185
32212
|
if (!vesuAdapter) {
|
|
32186
|
-
throw new Error(
|
|
32213
|
+
throw new Error(
|
|
32214
|
+
`${this.getTag()}::getAvnuSwapMultiplyCall: vesuAdapter not found for borrowable asset: ${maxBorrowable.borrowableAsset.symbol}`
|
|
32215
|
+
);
|
|
32187
32216
|
}
|
|
32188
32217
|
const maxLTV = await vesuAdapter.getLTVConfig(this.config);
|
|
32189
|
-
const debtPrice = await this.pricer.getPrice(
|
|
32218
|
+
const debtPrice = await this.pricer.getPrice(
|
|
32219
|
+
maxBorrowable.borrowableAsset.symbol
|
|
32220
|
+
);
|
|
32190
32221
|
const maxAmountToDeposit = HealthFactorMath.getMinCollateralRequiredOnLooping(
|
|
32191
32222
|
maxBorrowable.amount,
|
|
32192
32223
|
debtPrice.price,
|
|
@@ -32196,7 +32227,9 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
32196
32227
|
this.asset()
|
|
32197
32228
|
);
|
|
32198
32229
|
const amountToDeposit = remainingAmount.minimum(maxAmountToDeposit);
|
|
32199
|
-
logger.verbose(
|
|
32230
|
+
logger.verbose(
|
|
32231
|
+
`${this.getTag()}::getAvnuSwapMultiplyCall::${vesuAdapter.config.debt.symbol}:: remainingAmount: ${remainingAmount}, amountToDeposit: ${amountToDeposit}, depositAmount: ${amountToDeposit}, maxBorrowable: ${maxBorrowable.amount}`
|
|
32232
|
+
);
|
|
32200
32233
|
const call = await this._getAvnuDepositSwapLegCall({
|
|
32201
32234
|
isDeposit: params.isDeposit,
|
|
32202
32235
|
// adjust decimals of debt asset
|
|
@@ -32208,36 +32241,60 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
32208
32241
|
remainingAmount = remainingAmount.minus(amountToDeposit);
|
|
32209
32242
|
return { call, vesuAdapter };
|
|
32210
32243
|
}
|
|
32211
|
-
throw new Error(
|
|
32244
|
+
throw new Error(
|
|
32245
|
+
`${this.getTag()}::getAvnuSwapMultiplyCall: no calls found`
|
|
32246
|
+
);
|
|
32212
32247
|
}
|
|
32213
32248
|
async _getAvnuDepositSwapLegCall(params) {
|
|
32214
32249
|
const { vesuAdapter } = params;
|
|
32215
|
-
logger.verbose(
|
|
32216
|
-
|
|
32250
|
+
logger.verbose(
|
|
32251
|
+
`${this.getTag()}::_getAvnuDepositSwapLegCall params: ${JSON.stringify(params)}`
|
|
32252
|
+
);
|
|
32253
|
+
assert(
|
|
32254
|
+
params.isDeposit,
|
|
32255
|
+
"Only deposit is supported in _getAvnuDepositSwapLegCall"
|
|
32256
|
+
);
|
|
32217
32257
|
const legLTV = await vesuAdapter.getLTVConfig(this.config);
|
|
32218
|
-
logger.verbose(
|
|
32258
|
+
logger.verbose(
|
|
32259
|
+
`${this.getTag()}::_getAvnuDepositSwapLegCall legLTV: ${legLTV}`
|
|
32260
|
+
);
|
|
32219
32261
|
const existingPositions = await vesuAdapter.getPositions(this.config);
|
|
32220
|
-
const collateralisation = await vesuAdapter.getCollateralization(
|
|
32262
|
+
const collateralisation = await vesuAdapter.getCollateralization(
|
|
32263
|
+
this.config
|
|
32264
|
+
);
|
|
32221
32265
|
const existingCollateralInfo = existingPositions[0];
|
|
32222
32266
|
const existingDebtInfo = existingPositions[1];
|
|
32223
32267
|
logger.debug(`${this.getTag()}::_getAvnuDepositSwapLegCall existingCollateralInfo: ${JSON.stringify(existingCollateralInfo)},
|
|
32224
32268
|
existingDebtInfo: ${JSON.stringify(existingDebtInfo)}, collateralisation: ${JSON.stringify(collateralisation)}`);
|
|
32225
32269
|
const collateralPrice = collateralisation[0].usdValue > 0 ? collateralisation[0].usdValue / existingCollateralInfo.amount.toNumber() : 1;
|
|
32226
32270
|
const debtPrice = collateralisation[1].usdValue > 0 ? collateralisation[1].usdValue / existingDebtInfo.amount.toNumber() : 1;
|
|
32227
|
-
logger.debug(
|
|
32271
|
+
logger.debug(
|
|
32272
|
+
`${this.getTag()}::_getAvnuDepositSwapLegCall collateralPrice: ${collateralPrice}, debtPrice: ${debtPrice}`
|
|
32273
|
+
);
|
|
32228
32274
|
const debtTokenInfo = vesuAdapter.config.debt;
|
|
32229
32275
|
let newDepositAmount = params.leg1DepositAmount;
|
|
32230
|
-
const totalCollateral = existingCollateralInfo.amount.plus(
|
|
32231
|
-
|
|
32276
|
+
const totalCollateral = existingCollateralInfo.amount.plus(
|
|
32277
|
+
params.leg1DepositAmount
|
|
32278
|
+
);
|
|
32279
|
+
logger.verbose(
|
|
32280
|
+
`${this.getTag()}::_getAvnuDepositSwapLegCall totalCollateral: ${totalCollateral}`
|
|
32281
|
+
);
|
|
32232
32282
|
const totalDebtAmount = new Web3Number(
|
|
32233
32283
|
totalCollateral.multipliedBy(collateralPrice).multipliedBy(legLTV).dividedBy(debtPrice).dividedBy(params.minHF).toString(),
|
|
32234
32284
|
debtTokenInfo.decimals
|
|
32235
32285
|
);
|
|
32236
32286
|
let debtAmount = totalDebtAmount.minus(existingDebtInfo.amount);
|
|
32237
|
-
logger.verbose(
|
|
32238
|
-
|
|
32287
|
+
logger.verbose(
|
|
32288
|
+
`${this.getTag()}::_getAvnuDepositSwapLegCall totalDebtAmount: ${totalDebtAmount}, initial computed debt: ${debtAmount}`
|
|
32289
|
+
);
|
|
32290
|
+
const maxBorrowable = await this.getMaxBorrowableAmountByVesuAdapter(
|
|
32291
|
+
vesuAdapter,
|
|
32292
|
+
false
|
|
32293
|
+
);
|
|
32239
32294
|
if (debtAmount.gt(0) && maxBorrowable.amount.eq(0)) {
|
|
32240
|
-
logger.verbose(
|
|
32295
|
+
logger.verbose(
|
|
32296
|
+
`${this.getTag()}::_getAvnuDepositSwapLegCall maxBorrowable is 0, skipping`
|
|
32297
|
+
);
|
|
32241
32298
|
return void 0;
|
|
32242
32299
|
} else if (debtAmount.gt(0) && maxBorrowable.amount.gt(0)) {
|
|
32243
32300
|
debtAmount = maxBorrowable.amount.minimum(debtAmount);
|
|
@@ -32250,16 +32307,24 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
32250
32307
|
collateralPrice,
|
|
32251
32308
|
this.asset()
|
|
32252
32309
|
);
|
|
32253
|
-
newDepositAmount = totalCollateralRequired.minus(
|
|
32310
|
+
newDepositAmount = totalCollateralRequired.minus(
|
|
32311
|
+
existingCollateralInfo.amount
|
|
32312
|
+
);
|
|
32254
32313
|
if (newDepositAmount.lt(0)) {
|
|
32255
|
-
throw new Error(
|
|
32314
|
+
throw new Error(
|
|
32315
|
+
`${this.getTag()}::_getAvnuDepositSwapLegCall newDepositAmount is less than 0, newDepositAmount: ${newDepositAmount}, totalCollateralRequired: ${totalCollateralRequired}, existingCollateralInfo.amount: ${existingCollateralInfo.amount}`
|
|
32316
|
+
);
|
|
32256
32317
|
}
|
|
32257
32318
|
if (newDebtUSDValue.toNumber() < 100) {
|
|
32258
|
-
logger.verbose(
|
|
32319
|
+
logger.verbose(
|
|
32320
|
+
`${this.getTag()}::_getAvnuDepositSwapLegCall newDebtUSDValue is less than 100, skipping`
|
|
32321
|
+
);
|
|
32259
32322
|
return void 0;
|
|
32260
32323
|
}
|
|
32261
32324
|
}
|
|
32262
|
-
logger.verbose(
|
|
32325
|
+
logger.verbose(
|
|
32326
|
+
`${this.getTag()}::_getAvnuDepositSwapLegCall debtAmount: ${debtAmount}`
|
|
32327
|
+
);
|
|
32263
32328
|
if (debtAmount.lt(0)) {
|
|
32264
32329
|
const lstDEXPrice = await this.getLSTDexPrice();
|
|
32265
32330
|
const debtAmountInLST = debtAmount.abs().dividedBy(lstDEXPrice);
|
|
@@ -32268,7 +32333,10 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
32268
32333
|
leg1DepositAmount: debtAmountInLST,
|
|
32269
32334
|
poolId: vesuAdapter.config.poolId
|
|
32270
32335
|
});
|
|
32271
|
-
assert(
|
|
32336
|
+
assert(
|
|
32337
|
+
calls.length == 1,
|
|
32338
|
+
`Expected 1 call for unwind, got ${calls.length}`
|
|
32339
|
+
);
|
|
32272
32340
|
return calls[0];
|
|
32273
32341
|
}
|
|
32274
32342
|
const STEP0 = "approve_token1" /* APPROVE_TOKEN1 */;
|
|
@@ -32276,18 +32344,27 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
32276
32344
|
const manageCall0 = manage0Info.callConstructor({
|
|
32277
32345
|
amount: newDepositAmount
|
|
32278
32346
|
});
|
|
32279
|
-
const STEP1 = getVesuLegId(
|
|
32347
|
+
const STEP1 = getVesuLegId(
|
|
32348
|
+
"vesu_leg1" /* VESU_LEG1 */,
|
|
32349
|
+
vesuAdapter.config.debt.symbol,
|
|
32350
|
+
vesuAdapter.config.poolId.toString()
|
|
32351
|
+
);
|
|
32280
32352
|
const manage1Info = this.getProofs(STEP1);
|
|
32281
|
-
const manageCall1 = manage1Info.callConstructor(
|
|
32282
|
-
|
|
32283
|
-
|
|
32284
|
-
|
|
32285
|
-
|
|
32286
|
-
|
|
32353
|
+
const manageCall1 = manage1Info.callConstructor(
|
|
32354
|
+
VesuAdapter.getDefaultModifyPositionCallParams({
|
|
32355
|
+
collateralAmount: newDepositAmount,
|
|
32356
|
+
isAddCollateral: params.isDeposit,
|
|
32357
|
+
debtAmount,
|
|
32358
|
+
isBorrow: params.isDeposit
|
|
32359
|
+
})
|
|
32360
|
+
);
|
|
32287
32361
|
const proofIds = [STEP0, STEP1];
|
|
32288
32362
|
const manageCalls = [manageCall0, manageCall1];
|
|
32289
32363
|
if (debtAmount.gt(0)) {
|
|
32290
|
-
const STEP2 = getAvnuManageIDs(
|
|
32364
|
+
const STEP2 = getAvnuManageIDs(
|
|
32365
|
+
"avnu_mul_approve_dep" /* AVNU_MULTIPLY_APPROVE_DEPOSIT */,
|
|
32366
|
+
vesuAdapter.config.debt.symbol
|
|
32367
|
+
);
|
|
32291
32368
|
const manage2Info = this.getProofs(STEP2);
|
|
32292
32369
|
const manageCall2 = manage2Info.callConstructor({
|
|
32293
32370
|
amount: debtAmount
|
|
@@ -32303,7 +32380,9 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
32303
32380
|
);
|
|
32304
32381
|
const minAmount = await this._getMinOutputAmountLSTBuy(debtAmount);
|
|
32305
32382
|
const minAmountWei = minAmount.toWei();
|
|
32306
|
-
logger.verbose(
|
|
32383
|
+
logger.verbose(
|
|
32384
|
+
`${this.getTag()}::_getAvnuDepositSwapLegCall minAmount: ${minAmount}`
|
|
32385
|
+
);
|
|
32307
32386
|
const swapInfo = await avnuModule.getSwapInfo(
|
|
32308
32387
|
quote,
|
|
32309
32388
|
this.metadata.additionalInfo.vaultAllocator.address,
|
|
@@ -32311,8 +32390,13 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
32311
32390
|
this.address.address,
|
|
32312
32391
|
minAmountWei
|
|
32313
32392
|
);
|
|
32314
|
-
logger.verbose(
|
|
32315
|
-
|
|
32393
|
+
logger.verbose(
|
|
32394
|
+
`${this.getTag()}::_getAvnuDepositSwapLegCall swapInfo: ${JSON.stringify(swapInfo)}`
|
|
32395
|
+
);
|
|
32396
|
+
const STEP3 = getAvnuManageIDs(
|
|
32397
|
+
"avnu_mul_swap_dep" /* AVNU_MULTIPLY_SWAP_DEPOSIT */,
|
|
32398
|
+
vesuAdapter.config.debt.symbol
|
|
32399
|
+
);
|
|
32316
32400
|
const manage3Info = this.getProofs(STEP3);
|
|
32317
32401
|
const manageCall3 = manage3Info.callConstructor({
|
|
32318
32402
|
props: swapInfo
|
|
@@ -32322,22 +32406,32 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
32322
32406
|
manageCalls.push(manageCall2, manageCall3);
|
|
32323
32407
|
const newCollateral = minAmount.plus(totalCollateral);
|
|
32324
32408
|
const newHF = newCollateral.multipliedBy(collateralPrice).multipliedBy(legLTV).dividedBy(totalDebtAmount).dividedBy(debtPrice).toNumber();
|
|
32325
|
-
logger.verbose(
|
|
32409
|
+
logger.verbose(
|
|
32410
|
+
`${this.getTag()}::_getAvnuDepositSwapLegCall newHF: ${newHF}`
|
|
32411
|
+
);
|
|
32326
32412
|
if (newHF > this.metadata.additionalInfo.minHealthFactor && newHF < this.metadata.additionalInfo.targetHealthFactor + 0.05) {
|
|
32327
|
-
logger.verbose(
|
|
32413
|
+
logger.verbose(
|
|
32414
|
+
`${this.getTag()}::_getAvnuDepositSwapLegCall newHF is above min and below target + 0.05, adding collateral on vesu`
|
|
32415
|
+
);
|
|
32328
32416
|
const STEP4 = "approve_token1" /* APPROVE_TOKEN1 */;
|
|
32329
32417
|
const manage4Info = this.getProofs(STEP4);
|
|
32330
32418
|
const manageCall4 = manage4Info.callConstructor({
|
|
32331
32419
|
amount: minAmount
|
|
32332
32420
|
});
|
|
32333
|
-
const STEP5 = getVesuLegId(
|
|
32421
|
+
const STEP5 = getVesuLegId(
|
|
32422
|
+
"vesu_leg1" /* VESU_LEG1 */,
|
|
32423
|
+
vesuAdapter.config.debt.symbol,
|
|
32424
|
+
vesuAdapter.config.poolId.toString()
|
|
32425
|
+
);
|
|
32334
32426
|
const manage5Info = this.getProofs(STEP5);
|
|
32335
|
-
const manageCall5 = manage5Info.callConstructor(
|
|
32336
|
-
|
|
32337
|
-
|
|
32338
|
-
|
|
32339
|
-
|
|
32340
|
-
|
|
32427
|
+
const manageCall5 = manage5Info.callConstructor(
|
|
32428
|
+
VesuAdapter.getDefaultModifyPositionCallParams({
|
|
32429
|
+
collateralAmount: minAmount,
|
|
32430
|
+
isAddCollateral: true,
|
|
32431
|
+
debtAmount: Web3Number.fromWei("0", this.asset().decimals),
|
|
32432
|
+
isBorrow: params.isDeposit
|
|
32433
|
+
})
|
|
32434
|
+
);
|
|
32341
32435
|
proofIds.push(STEP4, STEP5);
|
|
32342
32436
|
manageCalls.push(manageCall4, manageCall5);
|
|
32343
32437
|
}
|
|
@@ -32345,11 +32439,13 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
32345
32439
|
const manageCall = this.getManageCall(proofIds, manageCalls);
|
|
32346
32440
|
return manageCall;
|
|
32347
32441
|
}
|
|
32348
|
-
// todo unwind or not deposit when the yield is bad.
|
|
32442
|
+
// todo unwind or not deposit when the yield is bad.
|
|
32349
32443
|
async getLSTMultiplierRebalanceCall() {
|
|
32350
32444
|
let shouldRebalance = false;
|
|
32351
32445
|
const calls = [];
|
|
32352
|
-
const allVesuAdapters = this.getVesuAdapters().filter(
|
|
32446
|
+
const allVesuAdapters = this.getVesuAdapters().filter(
|
|
32447
|
+
(vesuAdapter) => vesuAdapter.config.debt.symbol === "LBTC"
|
|
32448
|
+
);
|
|
32353
32449
|
for (const vesuAdapter of allVesuAdapters) {
|
|
32354
32450
|
const call = await this._getLSTMultiplierRebalanceCall(vesuAdapter);
|
|
32355
32451
|
if (call.shouldRebalance && call.manageCall) {
|
|
@@ -32361,18 +32457,27 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
32361
32457
|
}
|
|
32362
32458
|
async _getLSTMultiplierRebalanceCall(vesuAdapter) {
|
|
32363
32459
|
const positions = await vesuAdapter.getPositions(this.config);
|
|
32364
|
-
assert(
|
|
32460
|
+
assert(
|
|
32461
|
+
positions.length == 2,
|
|
32462
|
+
"Rebalance call is only supported for 2 positions"
|
|
32463
|
+
);
|
|
32365
32464
|
const existingCollateralInfo = positions[0];
|
|
32366
32465
|
const existingDebtInfo = positions[1];
|
|
32367
32466
|
const unusedBalance = await this.getUnusedBalance();
|
|
32368
32467
|
const healthFactor = await vesuAdapter.getHealthFactor();
|
|
32369
|
-
const collateralisation = await vesuAdapter.getCollateralization(
|
|
32468
|
+
const collateralisation = await vesuAdapter.getCollateralization(
|
|
32469
|
+
this.config
|
|
32470
|
+
);
|
|
32370
32471
|
logger.debug(`${this.getTag()}::getVesuMultiplyCall::${vesuAdapter.config.debt.symbol} existingCollateralInfo: ${JSON.stringify(existingCollateralInfo)},
|
|
32371
32472
|
existingDebtInfo: ${JSON.stringify(existingDebtInfo)}, collateralisation: ${JSON.stringify(collateralisation)}`);
|
|
32372
32473
|
const collateralPrice = collateralisation[0].usdValue > 0 ? collateralisation[0].usdValue / existingCollateralInfo.amount.toNumber() : 1;
|
|
32373
32474
|
const debtPrice = collateralisation[1].usdValue > 0 ? collateralisation[1].usdValue / existingDebtInfo.amount.toNumber() : 1;
|
|
32374
|
-
logger.debug(
|
|
32375
|
-
|
|
32475
|
+
logger.debug(
|
|
32476
|
+
`${this.getTag()}::getVesuMultiplyCall collateralPrice: ${collateralPrice}, debtPrice: ${debtPrice}`
|
|
32477
|
+
);
|
|
32478
|
+
logger.debug(
|
|
32479
|
+
`${this.getTag()}::getVesuMultiplyCall healthFactor: ${healthFactor}`
|
|
32480
|
+
);
|
|
32376
32481
|
const isHFTooLow = healthFactor < this.metadata.additionalInfo.minHealthFactor;
|
|
32377
32482
|
const isHFTooHigh = healthFactor > this.metadata.additionalInfo.targetHealthFactor + 0.05;
|
|
32378
32483
|
if (isHFTooLow || isHFTooHigh || 1) {
|
|
@@ -32380,7 +32485,7 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
32380
32485
|
isDeposit: true,
|
|
32381
32486
|
leg1DepositAmount: unusedBalance.amount,
|
|
32382
32487
|
minHF: 1.02,
|
|
32383
|
-
// todo, shouldnt use this 1.02 HF, if there isn;t more looping left.
|
|
32488
|
+
// todo, shouldnt use this 1.02 HF, if there isn;t more looping left.
|
|
32384
32489
|
vesuAdapter
|
|
32385
32490
|
});
|
|
32386
32491
|
return { shouldRebalance: true, manageCall };
|
|
@@ -32391,29 +32496,44 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
32391
32496
|
async getVesuAUM(adapter, priceType = "AVNU_PRICE" /* AVNU_PRICE */) {
|
|
32392
32497
|
const legAUM = await adapter.getPositions(this.config);
|
|
32393
32498
|
const underlying = this.asset();
|
|
32394
|
-
assert(
|
|
32499
|
+
assert(
|
|
32500
|
+
underlying.symbol.startsWith("x"),
|
|
32501
|
+
"Underlying is not an LST of Endur"
|
|
32502
|
+
);
|
|
32395
32503
|
let vesuAum = Web3Number.fromWei("0", underlying.decimals);
|
|
32396
32504
|
let tokenUnderlyingPrice;
|
|
32397
32505
|
if (priceType === "ENDUR_PRICE" /* ENDUR_PRICE */) {
|
|
32398
32506
|
tokenUnderlyingPrice = await this.getLSTExchangeRate();
|
|
32399
32507
|
if (tokenUnderlyingPrice === 0) {
|
|
32400
|
-
throw new Error(
|
|
32508
|
+
throw new Error(
|
|
32509
|
+
`${this.getTag()}::getVesuAUM: tokenUnderlyingPrice (Endur) is 0`
|
|
32510
|
+
);
|
|
32401
32511
|
}
|
|
32402
32512
|
const avnuRate = await this.getLSTAvnuRate();
|
|
32403
32513
|
if (avnuRate === 0) {
|
|
32404
|
-
throw new Error(
|
|
32514
|
+
throw new Error(
|
|
32515
|
+
`${this.getTag()}::getVesuAUM: tokenUnderlyingPrice (Avnu) is 0`
|
|
32516
|
+
);
|
|
32405
32517
|
}
|
|
32406
32518
|
const diff = Math.abs(tokenUnderlyingPrice - avnuRate) / tokenUnderlyingPrice;
|
|
32407
32519
|
if (diff > 0.02) {
|
|
32408
|
-
throw new Error(
|
|
32520
|
+
throw new Error(
|
|
32521
|
+
`${this.getTag()}::getVesuAUM: Endur and Avnu prices differ by more than 2% (Endur: ${tokenUnderlyingPrice}, Avnu: ${avnuRate})`
|
|
32522
|
+
);
|
|
32409
32523
|
}
|
|
32410
|
-
logger.verbose(
|
|
32524
|
+
logger.verbose(
|
|
32525
|
+
`${this.getTag()} tokenUnderlyingPrice (Endur): ${tokenUnderlyingPrice}, avnuRate: ${avnuRate}, diff: ${diff}`
|
|
32526
|
+
);
|
|
32411
32527
|
} else {
|
|
32412
32528
|
tokenUnderlyingPrice = await this.getLSTAvnuRate();
|
|
32413
32529
|
if (tokenUnderlyingPrice === 0) {
|
|
32414
|
-
throw new Error(
|
|
32530
|
+
throw new Error(
|
|
32531
|
+
`${this.getTag()}::getVesuAUM: tokenUnderlyingPrice (Avnu) is 0`
|
|
32532
|
+
);
|
|
32415
32533
|
}
|
|
32416
|
-
logger.verbose(
|
|
32534
|
+
logger.verbose(
|
|
32535
|
+
`${this.getTag()} tokenUnderlyingPrice (Avnu): ${tokenUnderlyingPrice}`
|
|
32536
|
+
);
|
|
32417
32537
|
}
|
|
32418
32538
|
if (legAUM[0].token.address.eq(underlying.address)) {
|
|
32419
32539
|
vesuAum = vesuAum.plus(legAUM[0].amount);
|
|
@@ -32425,9 +32545,10 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
32425
32545
|
} else {
|
|
32426
32546
|
vesuAum = vesuAum.minus(legAUM[1].amount.dividedBy(tokenUnderlyingPrice));
|
|
32427
32547
|
}
|
|
32428
|
-
;
|
|
32429
32548
|
const priceTypeLabel = priceType === "ENDUR_PRICE" /* ENDUR_PRICE */ ? "Endur Price" : "Avnu Price";
|
|
32430
|
-
logger.verbose(
|
|
32549
|
+
logger.verbose(
|
|
32550
|
+
`${this.getTag()} Vesu AUM (${priceTypeLabel}): ${vesuAum}, legCollateral: ${legAUM[0].amount.toNumber()}, legDebt: ${legAUM[1].amount.toNumber()}`
|
|
32551
|
+
);
|
|
32431
32552
|
return vesuAum;
|
|
32432
32553
|
}
|
|
32433
32554
|
async getTVLUnrealized() {
|
|
@@ -32458,11 +32579,11 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
32458
32579
|
return minOutputAmount;
|
|
32459
32580
|
}
|
|
32460
32581
|
// todo add a function to findout max borrowable amount without fucking yield
|
|
32461
|
-
// if the current net yield < LST yield, add a function to calculate how much to unwind.
|
|
32582
|
+
// if the current net yield < LST yield, add a function to calculate how much to unwind.
|
|
32462
32583
|
/**
|
|
32463
32584
|
* Uses vesu's multiple call to create leverage on LST
|
|
32464
32585
|
* Deposit amount is in LST
|
|
32465
|
-
* @param params
|
|
32586
|
+
* @param params
|
|
32466
32587
|
*/
|
|
32467
32588
|
async getVesuMultiplyCall(params) {
|
|
32468
32589
|
const maxEkuboPriceImpact = params.maxEkuboPriceImpact || 0.01;
|
|
@@ -32471,32 +32592,54 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
32471
32592
|
logger.verbose(`${this.getTag()}::getVesuMultiplyCall legLTV: ${legLTV}`);
|
|
32472
32593
|
if (!params.isDeposit) {
|
|
32473
32594
|
const unusedBalance = await this.getUnusedBalance();
|
|
32474
|
-
logger.verbose(
|
|
32595
|
+
logger.verbose(
|
|
32596
|
+
`${this.getTag()}::getVesuMultiplyCall unusedBalance: ${unusedBalance.amount.toString()}, required: ${params.leg1DepositAmount.toString()}`
|
|
32597
|
+
);
|
|
32475
32598
|
}
|
|
32476
32599
|
const existingPositions = await vesuAdapter1.getPositions(this.config);
|
|
32477
|
-
const collateralisation = await vesuAdapter1.getCollateralization(
|
|
32600
|
+
const collateralisation = await vesuAdapter1.getCollateralization(
|
|
32601
|
+
this.config
|
|
32602
|
+
);
|
|
32478
32603
|
const existingCollateralInfo = existingPositions[0];
|
|
32479
32604
|
const existingDebtInfo = existingPositions[1];
|
|
32480
32605
|
logger.debug(`${this.getTag()}::getVesuMultiplyCall existingCollateralInfo: ${JSON.stringify(existingCollateralInfo)},
|
|
32481
32606
|
existingDebtInfo: ${JSON.stringify(existingDebtInfo)}, collateralisation: ${JSON.stringify(collateralisation)}`);
|
|
32482
32607
|
const collateralPrice = collateralisation[0].usdValue > 0 ? collateralisation[0].usdValue / existingCollateralInfo.amount.toNumber() : 1;
|
|
32483
32608
|
const debtPrice = collateralisation[1].usdValue > 0 ? collateralisation[1].usdValue / existingDebtInfo.amount.toNumber() : 1;
|
|
32484
|
-
logger.debug(
|
|
32609
|
+
logger.debug(
|
|
32610
|
+
`${this.getTag()}::getVesuMultiplyCall collateralPrice: ${collateralPrice}, debtPrice: ${debtPrice}`
|
|
32611
|
+
);
|
|
32485
32612
|
const dexPrice = await this.getLSTDexPrice();
|
|
32486
|
-
const addedCollateral = params.leg1DepositAmount.multipliedBy(
|
|
32487
|
-
|
|
32613
|
+
const addedCollateral = params.leg1DepositAmount.multipliedBy(
|
|
32614
|
+
params.isDeposit ? 1 : -1
|
|
32615
|
+
);
|
|
32616
|
+
logger.verbose(
|
|
32617
|
+
`${this.getTag()}::getVesuMultiplyCall addedCollateral: ${addedCollateral}`
|
|
32618
|
+
);
|
|
32488
32619
|
const numeratorPart1 = existingCollateralInfo.amount.plus(addedCollateral).multipliedBy(collateralPrice).multipliedBy(legLTV);
|
|
32489
|
-
logger.verbose(
|
|
32620
|
+
logger.verbose(
|
|
32621
|
+
`${this.getTag()}::getVesuMultiplyCall numeratorPart1: ${numeratorPart1}`
|
|
32622
|
+
);
|
|
32490
32623
|
const numeratorPart2 = existingDebtInfo.amount.multipliedBy(debtPrice).multipliedBy(this.metadata.additionalInfo.targetHealthFactor);
|
|
32491
|
-
logger.verbose(
|
|
32624
|
+
logger.verbose(
|
|
32625
|
+
`${this.getTag()}::getVesuMultiplyCall numeratorPart2: ${numeratorPart2}`
|
|
32626
|
+
);
|
|
32492
32627
|
const denominatorPart = this.metadata.additionalInfo.targetHealthFactor - legLTV / dexPrice;
|
|
32493
|
-
logger.verbose(
|
|
32628
|
+
logger.verbose(
|
|
32629
|
+
`${this.getTag()}::getVesuMultiplyCall denominatorPart: ${denominatorPart}`
|
|
32630
|
+
);
|
|
32494
32631
|
const x_debt_usd = numeratorPart1.minus(numeratorPart2).dividedBy(denominatorPart);
|
|
32495
|
-
logger.verbose(
|
|
32496
|
-
|
|
32632
|
+
logger.verbose(
|
|
32633
|
+
`${this.getTag()}::getVesuMultiplyCall x_debt_usd: ${x_debt_usd}`
|
|
32634
|
+
);
|
|
32635
|
+
logger.debug(
|
|
32636
|
+
`${this.getTag()}::getVesuMultiplyCall numeratorPart1: ${numeratorPart1}, numeratorPart2: ${numeratorPart2}, denominatorPart: ${denominatorPart}`
|
|
32637
|
+
);
|
|
32497
32638
|
let debtAmount = x_debt_usd.dividedBy(debtPrice);
|
|
32498
32639
|
const marginAmount = addedCollateral;
|
|
32499
|
-
logger.verbose(
|
|
32640
|
+
logger.verbose(
|
|
32641
|
+
`${this.getTag()}::getVesuMultiplyCall debtAmount: ${debtAmount}, marginAmount: ${marginAmount}`
|
|
32642
|
+
);
|
|
32500
32643
|
if (marginAmount.lt(0) && debtAmount.gt(0)) {
|
|
32501
32644
|
debtAmount = Web3Number.fromWei(0, this.asset().decimals);
|
|
32502
32645
|
}
|
|
@@ -32510,31 +32653,49 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
32510
32653
|
});
|
|
32511
32654
|
}
|
|
32512
32655
|
getLSTUnderlyingTokenInfo() {
|
|
32513
|
-
const vesuAdapter1 = this.getVesuSameTokenAdapter(
|
|
32656
|
+
const vesuAdapter1 = this.getVesuSameTokenAdapter(
|
|
32657
|
+
this.metadata.additionalInfo.defaultPoolId
|
|
32658
|
+
);
|
|
32514
32659
|
return vesuAdapter1.config.debt;
|
|
32515
32660
|
}
|
|
32516
32661
|
async getMaxBorrowableAmount(params = { isAPYComputation: false }) {
|
|
32517
32662
|
const vesuAdapters = this.getVesuAdapters();
|
|
32518
|
-
let netMaxBorrowableAmount = Web3Number.fromWei(
|
|
32663
|
+
let netMaxBorrowableAmount = Web3Number.fromWei(
|
|
32664
|
+
"0",
|
|
32665
|
+
this.getLSTUnderlyingTokenInfo().decimals
|
|
32666
|
+
);
|
|
32519
32667
|
const maxBorrowables = [];
|
|
32520
32668
|
for (const vesuAdapter of vesuAdapters) {
|
|
32521
|
-
const output = await this.getMaxBorrowableAmountByVesuAdapter(
|
|
32669
|
+
const output = await this.getMaxBorrowableAmountByVesuAdapter(
|
|
32670
|
+
vesuAdapter,
|
|
32671
|
+
params.isAPYComputation
|
|
32672
|
+
);
|
|
32522
32673
|
const ltv = await vesuAdapter.getLTVConfig(this.config);
|
|
32523
32674
|
maxBorrowables.push({ ...output, ltv });
|
|
32524
32675
|
}
|
|
32525
32676
|
maxBorrowables.sort((a, b) => b.amount.toNumber() - a.amount.toNumber());
|
|
32526
|
-
netMaxBorrowableAmount = maxBorrowables.reduce(
|
|
32677
|
+
netMaxBorrowableAmount = maxBorrowables.reduce(
|
|
32678
|
+
(acc, curr) => acc.plus(curr.amount),
|
|
32679
|
+
Web3Number.fromWei("0", this.getLSTUnderlyingTokenInfo().decimals)
|
|
32680
|
+
);
|
|
32527
32681
|
return { netMaxBorrowableAmount, maxBorrowables };
|
|
32528
32682
|
}
|
|
32529
|
-
// recursively, using binary search computes max swappable.
|
|
32683
|
+
// recursively, using binary search computes max swappable.
|
|
32530
32684
|
// @dev assumes 1 token of from == 1 token of to
|
|
32531
32685
|
async getMaxSwappableWithMaxSlippage(fromToken, toToken, maxSlippage, maxAmount) {
|
|
32532
32686
|
const output = await findMaxInputWithSlippage({
|
|
32533
32687
|
apiGetOutput: async (inputAmount) => {
|
|
32534
32688
|
const ekuboQuoter = new EkuboQuoter(this.config);
|
|
32535
32689
|
await new Promise((resolve) => setTimeout(resolve, 1e3));
|
|
32536
|
-
const quote = await ekuboQuoter.getQuote(
|
|
32537
|
-
|
|
32690
|
+
const quote = await ekuboQuoter.getQuote(
|
|
32691
|
+
fromToken.address.address,
|
|
32692
|
+
toToken.address.address,
|
|
32693
|
+
new Web3Number(inputAmount.toFixed(9), fromToken.decimals)
|
|
32694
|
+
);
|
|
32695
|
+
return Web3Number.fromWei(
|
|
32696
|
+
quote.total_calculated.toString(),
|
|
32697
|
+
toToken.decimals
|
|
32698
|
+
).toNumber();
|
|
32538
32699
|
},
|
|
32539
32700
|
maxInput: maxAmount.toNumber(),
|
|
32540
32701
|
maxSlippagePercent: maxSlippage,
|
|
@@ -32544,38 +32705,84 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
32544
32705
|
return new Web3Number(output.optimalInput, fromToken.decimals);
|
|
32545
32706
|
}
|
|
32546
32707
|
async getMaxBorrowableAmountByVesuAdapter(vesuAdapter, isAPYComputation) {
|
|
32547
|
-
const lstAPY = await this.getLSTAPR(
|
|
32708
|
+
const lstAPY = await this.getLSTAPR(
|
|
32709
|
+
this.getLSTUnderlyingTokenInfo().address
|
|
32710
|
+
);
|
|
32548
32711
|
const maxInterestRate = lstAPY * 0.8;
|
|
32549
|
-
const { maxDebtToHave: maxBorrowableAmount, currentDebt } = await vesuAdapter.getMaxBorrowableByInterestRate(
|
|
32712
|
+
const { maxDebtToHave: maxBorrowableAmount, currentDebt } = await vesuAdapter.getMaxBorrowableByInterestRate(
|
|
32713
|
+
this.config,
|
|
32714
|
+
vesuAdapter.config.debt,
|
|
32715
|
+
maxInterestRate
|
|
32716
|
+
);
|
|
32550
32717
|
const debtCap = await vesuAdapter.getDebtCap(this.config);
|
|
32551
32718
|
if (currentDebt.gte(debtCap)) {
|
|
32552
|
-
return {
|
|
32719
|
+
return {
|
|
32720
|
+
amount: Web3Number.fromWei("0", vesuAdapter.config.debt.decimals),
|
|
32721
|
+
dexSwappableAmount: Web3Number.fromWei(
|
|
32722
|
+
"0",
|
|
32723
|
+
vesuAdapter.config.debt.decimals
|
|
32724
|
+
),
|
|
32725
|
+
maxBorrowableAmount: Web3Number.fromWei(
|
|
32726
|
+
"0",
|
|
32727
|
+
vesuAdapter.config.debt.decimals
|
|
32728
|
+
),
|
|
32729
|
+
borrowableAsset: vesuAdapter.config.debt
|
|
32730
|
+
};
|
|
32553
32731
|
}
|
|
32554
32732
|
const availableToBorrow = debtCap.minus(currentDebt);
|
|
32555
32733
|
const maxBorrowable = maxBorrowableAmount.minimum(availableToBorrow).multipliedBy(0.999);
|
|
32556
|
-
if (vesuAdapter.config.debt.address.eq(
|
|
32557
|
-
|
|
32734
|
+
if (vesuAdapter.config.debt.address.eq(
|
|
32735
|
+
this.getLSTUnderlyingTokenInfo().address
|
|
32736
|
+
) || isAPYComputation) {
|
|
32737
|
+
return {
|
|
32738
|
+
amount: maxBorrowable,
|
|
32739
|
+
dexSwappableAmount: maxBorrowable,
|
|
32740
|
+
maxBorrowableAmount: maxBorrowable,
|
|
32741
|
+
borrowableAsset: vesuAdapter.config.debt
|
|
32742
|
+
};
|
|
32558
32743
|
}
|
|
32559
32744
|
try {
|
|
32560
|
-
const maxSwappable = await this.getMaxSwappableWithMaxSlippage(
|
|
32561
|
-
|
|
32745
|
+
const maxSwappable = await this.getMaxSwappableWithMaxSlippage(
|
|
32746
|
+
vesuAdapter.config.debt,
|
|
32747
|
+
this.getLSTUnderlyingTokenInfo(),
|
|
32748
|
+
2e-4,
|
|
32749
|
+
maxBorrowable
|
|
32750
|
+
);
|
|
32751
|
+
return {
|
|
32752
|
+
amount: maxBorrowable.minimum(maxSwappable),
|
|
32753
|
+
dexSwappableAmount: maxSwappable,
|
|
32754
|
+
maxBorrowableAmount: maxBorrowable,
|
|
32755
|
+
borrowableAsset: vesuAdapter.config.debt
|
|
32756
|
+
};
|
|
32562
32757
|
} catch (error) {
|
|
32563
32758
|
logger.warn(`${this.getTag()}: Failed to get max swappable: ${error}`);
|
|
32564
|
-
const maxSwappable = Web3Number.fromWei(
|
|
32565
|
-
|
|
32759
|
+
const maxSwappable = Web3Number.fromWei(
|
|
32760
|
+
"0",
|
|
32761
|
+
vesuAdapter.config.debt.decimals
|
|
32762
|
+
);
|
|
32763
|
+
return {
|
|
32764
|
+
amount: maxBorrowable.minimum(maxSwappable),
|
|
32765
|
+
dexSwappableAmount: maxSwappable,
|
|
32766
|
+
maxBorrowableAmount: maxBorrowable,
|
|
32767
|
+
borrowableAsset: vesuAdapter.config.debt
|
|
32768
|
+
};
|
|
32566
32769
|
}
|
|
32567
32770
|
}
|
|
32568
32771
|
// todo how much to unwind to get back healthy APY zone again
|
|
32569
32772
|
// if net APY < LST APR + 0.5%, we need to unwind to get back to LST APR + 1% atleast or 0 vesu position
|
|
32570
|
-
// For xSTRK, simply deposit in Vesu if looping is not viable
|
|
32773
|
+
// For xSTRK, simply deposit in Vesu if looping is not viable
|
|
32571
32774
|
/**
|
|
32572
32775
|
* Gets LST APR for the strategy's underlying asset from Endur API
|
|
32573
32776
|
* @returns Promise<number> The LST APR (not divided by 1e18)
|
|
32574
32777
|
*/
|
|
32575
32778
|
async getLSTAPR(_address) {
|
|
32576
32779
|
try {
|
|
32577
|
-
const vesuAdapter1 = this.getVesuSameTokenAdapter(
|
|
32578
|
-
|
|
32780
|
+
const vesuAdapter1 = this.getVesuSameTokenAdapter(
|
|
32781
|
+
this.metadata.additionalInfo.defaultPoolId
|
|
32782
|
+
);
|
|
32783
|
+
const apr = await LSTAPRService.getLSTAPR(
|
|
32784
|
+
vesuAdapter1.config.debt.address
|
|
32785
|
+
);
|
|
32579
32786
|
if (!apr) {
|
|
32580
32787
|
throw new Error("Failed to get LST APR");
|
|
32581
32788
|
}
|
|
@@ -32588,19 +32795,37 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
32588
32795
|
// todo undo this
|
|
32589
32796
|
async netAPY() {
|
|
32590
32797
|
const unusedBalance = await this.getUnusedBalance();
|
|
32591
|
-
const maxNewDeposits = await this.maxNewDeposits({
|
|
32592
|
-
|
|
32798
|
+
const maxNewDeposits = await this.maxNewDeposits({
|
|
32799
|
+
isAPYComputation: true
|
|
32800
|
+
});
|
|
32801
|
+
const lstAPY = await this.getLSTAPR(
|
|
32802
|
+
this.getLSTUnderlyingTokenInfo().address
|
|
32803
|
+
);
|
|
32593
32804
|
if (maxNewDeposits * 1.5 < unusedBalance.amount.toNumber()) {
|
|
32594
|
-
logger.verbose(
|
|
32805
|
+
logger.verbose(
|
|
32806
|
+
`${this.getTag()}::netAPY: unused balance is > max servicable from loan, lstAPY: ${lstAPY}`
|
|
32807
|
+
);
|
|
32595
32808
|
const output = await super.netAPY();
|
|
32596
32809
|
output.splits.push({ apy: lstAPY, id: "lst_apy" });
|
|
32597
32810
|
return output;
|
|
32598
32811
|
} else {
|
|
32599
|
-
logger.verbose(
|
|
32812
|
+
logger.verbose(
|
|
32813
|
+
`${this.getTag()}::netAPY: we can take more deposits, use theoretical max APY`
|
|
32814
|
+
);
|
|
32600
32815
|
const { positions, baseAPYs, rewardAPYs } = await this.getVesuAPYs();
|
|
32601
|
-
const weights = positions.map(
|
|
32816
|
+
const weights = positions.map(
|
|
32817
|
+
(p, index) => p.usdValue * (index % 2 == 0 ? 1 : -1)
|
|
32818
|
+
);
|
|
32602
32819
|
const aum = weights.reduce((acc, curr) => acc + curr, 0);
|
|
32603
|
-
const output = await this.returnNetAPY(
|
|
32820
|
+
const output = await this.returnNetAPY(
|
|
32821
|
+
baseAPYs,
|
|
32822
|
+
rewardAPYs,
|
|
32823
|
+
weights,
|
|
32824
|
+
new Web3Number(
|
|
32825
|
+
aum.toFixed(9),
|
|
32826
|
+
this.getLSTUnderlyingTokenInfo().decimals
|
|
32827
|
+
)
|
|
32828
|
+
);
|
|
32604
32829
|
output.splits.push({ apy: lstAPY, id: "lst_apy" });
|
|
32605
32830
|
return output;
|
|
32606
32831
|
}
|
|
@@ -32610,9 +32835,13 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
32610
32835
|
let numerator = 0;
|
|
32611
32836
|
let ltv = void 0;
|
|
32612
32837
|
for (let adapter of this.getVesuAdapters()) {
|
|
32613
|
-
const maxBorrowableAmountInfo = maxBorrowableAmounts.maxBorrowables.find(
|
|
32838
|
+
const maxBorrowableAmountInfo = maxBorrowableAmounts.maxBorrowables.find(
|
|
32839
|
+
(b) => b.borrowableAsset.address.eq(adapter.config.debt.address)
|
|
32840
|
+
);
|
|
32614
32841
|
if (!maxBorrowableAmountInfo || !maxBorrowableAmountInfo?.amount) {
|
|
32615
|
-
throw new Error(
|
|
32842
|
+
throw new Error(
|
|
32843
|
+
`Max borrowable amount not found for adapter: ${adapter.config.debt.symbol}`
|
|
32844
|
+
);
|
|
32616
32845
|
}
|
|
32617
32846
|
numerator += this.metadata.additionalInfo.targetHealthFactor * maxBorrowableAmountInfo.amount.toNumber() / maxBorrowableAmountInfo.ltv;
|
|
32618
32847
|
}
|
|
@@ -32621,7 +32850,9 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
32621
32850
|
// todo revisit cases where 0th adapters is used
|
|
32622
32851
|
async getUnusedBalanceAPY() {
|
|
32623
32852
|
const unusedBalance = await this.getUnusedBalance();
|
|
32624
|
-
const vesuAdapter = this.getVesuSameTokenAdapter(
|
|
32853
|
+
const vesuAdapter = this.getVesuSameTokenAdapter(
|
|
32854
|
+
this.metadata.additionalInfo.defaultPoolId
|
|
32855
|
+
);
|
|
32625
32856
|
const underlying = vesuAdapter.config.debt;
|
|
32626
32857
|
const lstAPY = await this.getLSTAPR(underlying.address);
|
|
32627
32858
|
return {
|
|
@@ -32630,11 +32861,16 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
32630
32861
|
};
|
|
32631
32862
|
}
|
|
32632
32863
|
async getLSTAvnuRate() {
|
|
32633
|
-
const vesuAdapter1 = this.getVesuSameTokenAdapter(
|
|
32864
|
+
const vesuAdapter1 = this.getVesuSameTokenAdapter(
|
|
32865
|
+
this.metadata.additionalInfo.defaultPoolId
|
|
32866
|
+
);
|
|
32634
32867
|
const lstTokenInfo = vesuAdapter1.config.collateral;
|
|
32635
32868
|
const underlyingTokenInfo = vesuAdapter1.config.debt;
|
|
32636
32869
|
const avnuModule = new AvnuWrapper();
|
|
32637
|
-
const sellAmount = lstTokenInfo.priceCheckAmount ? new Web3Number(
|
|
32870
|
+
const sellAmount = lstTokenInfo.priceCheckAmount ? new Web3Number(
|
|
32871
|
+
lstTokenInfo.priceCheckAmount,
|
|
32872
|
+
underlyingTokenInfo.decimals
|
|
32873
|
+
) : new Web3Number(1, underlyingTokenInfo.decimals);
|
|
32638
32874
|
const quote = await avnuModule.getQuotes(
|
|
32639
32875
|
underlyingTokenInfo.address.address,
|
|
32640
32876
|
lstTokenInfo.address.address,
|
|
@@ -32648,40 +32884,56 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
32648
32884
|
).toNumber();
|
|
32649
32885
|
assert(lstAmountNumber > 0, "Avnu LST amount is zero");
|
|
32650
32886
|
const exchangeRate = underlyingAmountNumber / lstAmountNumber;
|
|
32651
|
-
logger.verbose(
|
|
32887
|
+
logger.verbose(
|
|
32888
|
+
`${this.getTag()}:: LST Avnu Exchange Rate: ${exchangeRate}`
|
|
32889
|
+
);
|
|
32652
32890
|
return exchangeRate;
|
|
32653
32891
|
}
|
|
32654
32892
|
async getLSTExchangeRate() {
|
|
32655
|
-
const vesuAdapter1 = this.getVesuSameTokenAdapter(
|
|
32893
|
+
const vesuAdapter1 = this.getVesuSameTokenAdapter(
|
|
32894
|
+
this.metadata.additionalInfo.defaultPoolId
|
|
32895
|
+
);
|
|
32656
32896
|
const lstTokenInfo = vesuAdapter1.config.collateral;
|
|
32657
32897
|
const lstABI = new Contract11({
|
|
32658
32898
|
abi: erc4626_abi_default,
|
|
32659
32899
|
address: lstTokenInfo.address.address,
|
|
32660
32900
|
providerOrAccount: this.config.provider
|
|
32661
32901
|
});
|
|
32662
|
-
const price = await lstABI.call("convert_to_assets", [
|
|
32902
|
+
const price = await lstABI.call("convert_to_assets", [
|
|
32903
|
+
uint25610.bnToUint256(new Web3Number(1, lstTokenInfo.decimals).toWei())
|
|
32904
|
+
]);
|
|
32663
32905
|
const exchangeRate = Number(uint25610.uint256ToBN(price).toString()) / Math.pow(10, lstTokenInfo.decimals);
|
|
32664
32906
|
logger.verbose(`${this.getTag()}:: LST Exchange Rate: ${exchangeRate}`);
|
|
32665
32907
|
return exchangeRate;
|
|
32666
32908
|
}
|
|
32667
32909
|
/**
|
|
32668
|
-
*
|
|
32910
|
+
*
|
|
32669
32911
|
* @param params marginAmount is in LST, debtAmount is in underlying
|
|
32670
32912
|
*/
|
|
32671
32913
|
async getModifyLeverCall(params) {
|
|
32672
|
-
logger.verbose(
|
|
32673
|
-
|
|
32914
|
+
logger.verbose(
|
|
32915
|
+
`${this.getTag()}::getModifyLeverCall marginAmount: ${params.marginAmount}, debtAmount: ${params.debtAmount}, lstDexPriceInUnderlying: ${params.lstDexPriceInUnderlying}, isIncrease: ${params.isIncrease}`
|
|
32916
|
+
);
|
|
32917
|
+
assert(
|
|
32918
|
+
!params.marginAmount.isZero() || !params.debtAmount.isZero(),
|
|
32919
|
+
"Deposit/debt must be non-0"
|
|
32920
|
+
);
|
|
32674
32921
|
const vesuAdapter1 = this.getVesuSameTokenAdapter(params.poolId);
|
|
32675
32922
|
const lstTokenInfo = this.asset();
|
|
32676
32923
|
const lstUnderlyingTokenInfo = vesuAdapter1.config.debt;
|
|
32677
32924
|
const maxAmounts = lstTokenInfo.symbol == "xSTRK" ? 5e5 : 0.5;
|
|
32678
32925
|
if (params.marginAmount.greaterThan(maxAmounts)) {
|
|
32679
|
-
throw new Error(
|
|
32926
|
+
throw new Error(
|
|
32927
|
+
`Margin amount is greater than max amount: ${params.marginAmount.toNumber()} > ${maxAmounts}`
|
|
32928
|
+
);
|
|
32680
32929
|
}
|
|
32681
32930
|
const proofsIDs = [];
|
|
32682
32931
|
const manageCalls = [];
|
|
32683
32932
|
if (params.marginAmount.greaterThan(0)) {
|
|
32684
|
-
const STEP1_ID = getVesuGenericLegId(
|
|
32933
|
+
const STEP1_ID = getVesuGenericLegId(
|
|
32934
|
+
params.poolId.toString(),
|
|
32935
|
+
"multiple_approve" /* MULTIPLE_APPROVE */
|
|
32936
|
+
);
|
|
32685
32937
|
const manage1Info = this.getProofs(STEP1_ID);
|
|
32686
32938
|
const depositAmount = params.marginAmount;
|
|
32687
32939
|
const manageCall1 = manage1Info.callConstructor({
|
|
@@ -32702,31 +32954,56 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
32702
32954
|
params.debtAmount
|
|
32703
32955
|
// negative for exact amount out
|
|
32704
32956
|
);
|
|
32705
|
-
logger.verbose(
|
|
32706
|
-
|
|
32707
|
-
|
|
32708
|
-
|
|
32957
|
+
logger.verbose(
|
|
32958
|
+
`${this.getTag()}::getModifyLeverCall leverSwapQuote: ${JSON.stringify(leverSwapQuote)}`
|
|
32959
|
+
);
|
|
32960
|
+
assert(
|
|
32961
|
+
leverSwapQuote.price_impact <= params.maxEkuboPriceImpact,
|
|
32962
|
+
"getIncreaseLeverCall: Price impact is too high [Debt swap]"
|
|
32963
|
+
);
|
|
32964
|
+
const leverSwap = ekuboQuoter.getVesuMultiplyQuote(
|
|
32965
|
+
leverSwapQuote,
|
|
32966
|
+
fromToken,
|
|
32967
|
+
toToken
|
|
32968
|
+
);
|
|
32969
|
+
logger.verbose(
|
|
32970
|
+
`${this.getTag()}::getModifyLeverCall leverSwap: ${JSON.stringify(leverSwap)}`
|
|
32971
|
+
);
|
|
32709
32972
|
let minLSTReceived = params.debtAmount.dividedBy(lstDexPriceInUnderlying).multipliedBy(1 - MAX_SLIPPAGE);
|
|
32710
32973
|
const minLSTReceivedAsPerTruePrice = params.debtAmount.dividedBy(lstTrueExchangeRate);
|
|
32711
32974
|
minLSTReceived = minLSTReceivedAsPerTruePrice;
|
|
32712
|
-
logger.verbose(
|
|
32975
|
+
logger.verbose(
|
|
32976
|
+
`${this.getTag()}::getModifyLeverCall minLSTReceivedAsPerTruePrice: ${minLSTReceivedAsPerTruePrice}, minLSTReceived: ${minLSTReceived}`
|
|
32977
|
+
);
|
|
32713
32978
|
let maxUsedCollateral = params.debtAmount.abs().dividedBy(lstDexPriceInUnderlying).multipliedBy(1 + MAX_SLIPPAGE);
|
|
32714
32979
|
const maxUsedCollateralInLST = params.debtAmount.abs().dividedBy(lstTrueExchangeRate).multipliedBy(1.005);
|
|
32715
|
-
logger.verbose(
|
|
32980
|
+
logger.verbose(
|
|
32981
|
+
`${this.getTag()}::getModifyLeverCall maxUsedCollateralInLST: ${maxUsedCollateralInLST}, maxUsedCollateral: ${maxUsedCollateral}`
|
|
32982
|
+
);
|
|
32716
32983
|
maxUsedCollateral = maxUsedCollateralInLST;
|
|
32717
|
-
const STEP2_ID = getVesuGenericLegId(
|
|
32984
|
+
const STEP2_ID = getVesuGenericLegId(
|
|
32985
|
+
params.poolId.toString(),
|
|
32986
|
+
"switch_delegation_on" /* SWITCH_DELEGATION_ON */
|
|
32987
|
+
);
|
|
32718
32988
|
const manage2Info = this.getProofs(STEP2_ID);
|
|
32719
32989
|
const manageCall2 = manage2Info.callConstructor({
|
|
32720
32990
|
delegation: true
|
|
32721
32991
|
});
|
|
32722
|
-
const STEP3_ID = getVesuLegId(
|
|
32992
|
+
const STEP3_ID = getVesuLegId(
|
|
32993
|
+
"multiply_vesu" /* MULTIPLY_VESU */,
|
|
32994
|
+
vesuAdapter1.config.debt.symbol,
|
|
32995
|
+
vesuAdapter1.config.poolId.toString()
|
|
32996
|
+
);
|
|
32723
32997
|
const manage3Info = this.getProofs(STEP3_ID);
|
|
32724
32998
|
const multiplyParams = params.isIncrease ? {
|
|
32725
32999
|
isIncrease: true,
|
|
32726
33000
|
increaseParams: {
|
|
32727
33001
|
add_margin: params.marginAmount,
|
|
32728
33002
|
margin_swap: [],
|
|
32729
|
-
margin_swap_limit_amount: Web3Number.fromWei(
|
|
33003
|
+
margin_swap_limit_amount: Web3Number.fromWei(
|
|
33004
|
+
0,
|
|
33005
|
+
this.asset().decimals
|
|
33006
|
+
),
|
|
32730
33007
|
lever_swap: leverSwap,
|
|
32731
33008
|
lever_swap_limit_amount: minLSTReceived
|
|
32732
33009
|
}
|
|
@@ -32738,15 +33015,21 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
32738
33015
|
lever_swap_limit_amount: maxUsedCollateral,
|
|
32739
33016
|
// only required for close position
|
|
32740
33017
|
lever_swap_weights: [],
|
|
32741
|
-
// no need to swap collateral to anything, and any residuals return our contract anyways.
|
|
33018
|
+
// no need to swap collateral to anything, and any residuals return our contract anyways.
|
|
32742
33019
|
withdraw_swap: [],
|
|
32743
|
-
withdraw_swap_limit_amount: Web3Number.fromWei(
|
|
33020
|
+
withdraw_swap_limit_amount: Web3Number.fromWei(
|
|
33021
|
+
0,
|
|
33022
|
+
this.asset().decimals
|
|
33023
|
+
),
|
|
32744
33024
|
withdraw_swap_weights: [],
|
|
32745
33025
|
close_position: false
|
|
32746
33026
|
}
|
|
32747
33027
|
};
|
|
32748
33028
|
const manageCall3 = manage3Info.callConstructor(multiplyParams);
|
|
32749
|
-
const STEP4_ID = getVesuGenericLegId(
|
|
33029
|
+
const STEP4_ID = getVesuGenericLegId(
|
|
33030
|
+
params.poolId.toString(),
|
|
33031
|
+
"switch_delegation_off" /* SWITCH_DELEGATION_OFF */
|
|
33032
|
+
);
|
|
32750
33033
|
const manage4Info = this.getProofs(STEP4_ID);
|
|
32751
33034
|
const manageCall4 = manage4Info.callConstructor({
|
|
32752
33035
|
delegation: false
|
|
@@ -32760,7 +33043,6 @@ function VaultDescription(lstSymbol, underlyingSymbol) {
|
|
|
32760
33043
|
const containerStyle = {
|
|
32761
33044
|
maxWidth: "800px",
|
|
32762
33045
|
margin: "0 auto",
|
|
32763
|
-
backgroundColor: "#111",
|
|
32764
33046
|
color: "#eee",
|
|
32765
33047
|
fontFamily: "Arial, sans-serif",
|
|
32766
33048
|
borderRadius: "12px"
|
|
@@ -32783,21 +33065,52 @@ function VaultDescription(lstSymbol, underlyingSymbol) {
|
|
|
32783
33065
|
" to create leverage. Depositors receive vault shares that represent a proportional claim on the underlying assets and accrued yield."
|
|
32784
33066
|
] }),
|
|
32785
33067
|
/* @__PURE__ */ jsxs4("p", { style: { fontSize: "14px", lineHeight: "1.5", marginBottom: "16px" }, children: [
|
|
32786
|
-
"This vault uses Vesu for lending and borrowing. The oracle used by this pool is a
|
|
32787
|
-
|
|
33068
|
+
"This vault uses Vesu for lending and borrowing. The oracle used by this pool is a",
|
|
33069
|
+
" ",
|
|
33070
|
+
highlightTextWithLinks("conversion rate oracle", [
|
|
33071
|
+
{
|
|
33072
|
+
highlight: "conversion rate oracle",
|
|
33073
|
+
link: "https://docs.pragma.build/starknet/development#conversion-rate"
|
|
33074
|
+
}
|
|
33075
|
+
]),
|
|
32788
33076
|
" ",
|
|
32789
33077
|
"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."
|
|
32790
33078
|
] }),
|
|
32791
|
-
/* @__PURE__ */ jsx5(
|
|
32792
|
-
|
|
32793
|
-
|
|
32794
|
-
|
|
32795
|
-
|
|
32796
|
-
|
|
32797
|
-
|
|
32798
|
-
|
|
32799
|
-
|
|
32800
|
-
|
|
33079
|
+
/* @__PURE__ */ jsx5(
|
|
33080
|
+
"div",
|
|
33081
|
+
{
|
|
33082
|
+
style: {
|
|
33083
|
+
backgroundColor: "#222",
|
|
33084
|
+
padding: "10px",
|
|
33085
|
+
borderRadius: "8px",
|
|
33086
|
+
marginBottom: "20px",
|
|
33087
|
+
border: "1px solid #444"
|
|
33088
|
+
},
|
|
33089
|
+
children: /* @__PURE__ */ jsxs4("p", { style: { fontSize: "13px", color: "#ccc" }, children: [
|
|
33090
|
+
/* @__PURE__ */ jsx5("strong", { children: "Withdrawals:" }),
|
|
33091
|
+
" Requests can take up to",
|
|
33092
|
+
" ",
|
|
33093
|
+
/* @__PURE__ */ jsx5("strong", { children: "1-2 hours" }),
|
|
33094
|
+
" to process as the vault unwinds and settles routing."
|
|
33095
|
+
] })
|
|
33096
|
+
}
|
|
33097
|
+
),
|
|
33098
|
+
/* @__PURE__ */ jsx5(
|
|
33099
|
+
"div",
|
|
33100
|
+
{
|
|
33101
|
+
style: {
|
|
33102
|
+
backgroundColor: "#222",
|
|
33103
|
+
padding: "10px",
|
|
33104
|
+
borderRadius: "8px",
|
|
33105
|
+
marginBottom: "20px",
|
|
33106
|
+
border: "1px solid #444"
|
|
33107
|
+
},
|
|
33108
|
+
children: /* @__PURE__ */ jsxs4("p", { style: { fontSize: "13px", color: "#ccc" }, children: [
|
|
33109
|
+
/* @__PURE__ */ jsx5("strong", { children: "Debt limits:" }),
|
|
33110
|
+
" 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."
|
|
33111
|
+
] })
|
|
33112
|
+
}
|
|
33113
|
+
)
|
|
32801
33114
|
] });
|
|
32802
33115
|
}
|
|
32803
33116
|
function getDescription2(tokenSymbol, underlyingSymbol) {
|
|
@@ -32813,31 +33126,76 @@ function getVesuLegId(baseID, debtTokenSymbol, poolId) {
|
|
|
32813
33126
|
return `${baseID}_${debtTokenSymbol.toLowerCase()}_${poolId.slice(-4).toLowerCase()}`;
|
|
32814
33127
|
}
|
|
32815
33128
|
function addVesuLeaves(poolId, lstSymbol, underlyingSymbol, vaultSettings, commonAdapter) {
|
|
32816
|
-
const lstToken = Global.getDefaultTokens().find(
|
|
32817
|
-
|
|
33129
|
+
const lstToken = Global.getDefaultTokens().find(
|
|
33130
|
+
(token) => token.symbol === lstSymbol
|
|
33131
|
+
);
|
|
33132
|
+
const underlyingToken = Global.getDefaultTokens().find(
|
|
33133
|
+
(token) => token.symbol === underlyingSymbol
|
|
33134
|
+
);
|
|
32818
33135
|
const vesuAdapterLST = new VesuAdapter({
|
|
32819
33136
|
poolId,
|
|
32820
33137
|
collateral: lstToken,
|
|
32821
33138
|
debt: underlyingToken,
|
|
32822
33139
|
vaultAllocator: vaultSettings.vaultAllocator,
|
|
32823
|
-
id: getVesuLegId(
|
|
33140
|
+
id: getVesuLegId(
|
|
33141
|
+
"vesu_leg1" /* VESU_LEG1 */,
|
|
33142
|
+
underlyingToken.symbol,
|
|
33143
|
+
poolId.toString()
|
|
33144
|
+
)
|
|
32824
33145
|
});
|
|
32825
|
-
vaultSettings.adapters.push(
|
|
32826
|
-
|
|
32827
|
-
|
|
32828
|
-
|
|
33146
|
+
vaultSettings.adapters.push(
|
|
33147
|
+
...[
|
|
33148
|
+
{
|
|
33149
|
+
id: getVesuLegId(
|
|
33150
|
+
"vesu_leg1" /* VESU_LEG1 */,
|
|
33151
|
+
underlyingToken.symbol,
|
|
33152
|
+
poolId.toString()
|
|
33153
|
+
),
|
|
33154
|
+
adapter: vesuAdapterLST
|
|
33155
|
+
}
|
|
33156
|
+
]
|
|
33157
|
+
);
|
|
32829
33158
|
const { isV2, addr: poolAddr } = getVesuSingletonAddress(poolId);
|
|
32830
33159
|
const VESU_MULTIPLY = isV2 ? vesuAdapterLST.VESU_MULTIPLY : vesuAdapterLST.VESU_MULTIPLY_V1;
|
|
32831
|
-
const leafIdApprove = getVesuGenericLegId(
|
|
32832
|
-
|
|
32833
|
-
|
|
32834
|
-
|
|
32835
|
-
|
|
32836
|
-
|
|
32837
|
-
|
|
32838
|
-
|
|
32839
|
-
|
|
32840
|
-
|
|
33160
|
+
const leafIdApprove = getVesuGenericLegId(
|
|
33161
|
+
poolId.toString(),
|
|
33162
|
+
"multiple_approve" /* MULTIPLE_APPROVE */
|
|
33163
|
+
);
|
|
33164
|
+
vaultSettings.leafAdapters.push(
|
|
33165
|
+
commonAdapter.getApproveAdapter(lstToken.address, VESU_MULTIPLY, leafIdApprove).bind(commonAdapter)
|
|
33166
|
+
);
|
|
33167
|
+
const leafIdDelegationOn = getVesuGenericLegId(
|
|
33168
|
+
poolId.toString(),
|
|
33169
|
+
"switch_delegation_on" /* SWITCH_DELEGATION_ON */
|
|
33170
|
+
);
|
|
33171
|
+
vaultSettings.leafAdapters.push(
|
|
33172
|
+
vesuAdapterLST.getVesuModifyDelegationAdapter(leafIdDelegationOn, VESU_MULTIPLY).bind(vesuAdapterLST)
|
|
33173
|
+
);
|
|
33174
|
+
const leafIdDelegationOff = getVesuGenericLegId(
|
|
33175
|
+
poolId.toString(),
|
|
33176
|
+
"switch_delegation_off" /* SWITCH_DELEGATION_OFF */
|
|
33177
|
+
);
|
|
33178
|
+
vaultSettings.leafAdapters.push(
|
|
33179
|
+
vesuAdapterLST.getVesuModifyDelegationAdapter(leafIdDelegationOff, VESU_MULTIPLY).bind(vesuAdapterLST)
|
|
33180
|
+
);
|
|
33181
|
+
const multiplID = getVesuLegId(
|
|
33182
|
+
"multiply_vesu" /* MULTIPLY_VESU */,
|
|
33183
|
+
underlyingToken.symbol,
|
|
33184
|
+
poolId.toString()
|
|
33185
|
+
);
|
|
33186
|
+
vaultSettings.leafAdapters.push(
|
|
33187
|
+
vesuAdapterLST.getMultiplyAdapter(multiplID).bind(vesuAdapterLST)
|
|
33188
|
+
);
|
|
33189
|
+
vaultSettings.leafAdapters.push(
|
|
33190
|
+
commonAdapter.getApproveAdapter(
|
|
33191
|
+
lstToken.address,
|
|
33192
|
+
poolAddr,
|
|
33193
|
+
"approve_token1" /* APPROVE_TOKEN1 */
|
|
33194
|
+
).bind(commonAdapter)
|
|
33195
|
+
);
|
|
33196
|
+
vaultSettings.leafAdapters.push(
|
|
33197
|
+
vesuAdapterLST.getModifyPosition.bind(vesuAdapterLST)
|
|
33198
|
+
);
|
|
32841
33199
|
return vesuAdapterLST;
|
|
32842
33200
|
}
|
|
32843
33201
|
function getLooperSettings2(lstSymbol, underlyingSymbol, vaultSettings, defaultPoolId) {
|
|
@@ -32846,8 +33204,12 @@ function getLooperSettings2(lstSymbol, underlyingSymbol, vaultSettings, defaultP
|
|
|
32846
33204
|
if (!pool1.eq(defaultPoolId)) {
|
|
32847
33205
|
throw new Error(`Dont include default pool id in supported pool ids`);
|
|
32848
33206
|
}
|
|
32849
|
-
const lstToken = Global.getDefaultTokens().find(
|
|
32850
|
-
|
|
33207
|
+
const lstToken = Global.getDefaultTokens().find(
|
|
33208
|
+
(token) => token.symbol === lstSymbol
|
|
33209
|
+
);
|
|
33210
|
+
const underlyingToken = Global.getDefaultTokens().find(
|
|
33211
|
+
(token) => token.symbol === underlyingSymbol
|
|
33212
|
+
);
|
|
32851
33213
|
const commonAdapter = new CommonAdapter({
|
|
32852
33214
|
manager: vaultSettings.manager,
|
|
32853
33215
|
asset: lstToken.address,
|
|
@@ -32855,28 +33217,106 @@ function getLooperSettings2(lstSymbol, underlyingSymbol, vaultSettings, defaultP
|
|
|
32855
33217
|
vaultAddress: vaultSettings.vaultAddress,
|
|
32856
33218
|
vaultAllocator: vaultSettings.vaultAllocator
|
|
32857
33219
|
});
|
|
32858
|
-
vaultSettings.adapters.push(
|
|
32859
|
-
|
|
32860
|
-
|
|
32861
|
-
|
|
32862
|
-
|
|
32863
|
-
|
|
32864
|
-
|
|
33220
|
+
vaultSettings.adapters.push(
|
|
33221
|
+
...[
|
|
33222
|
+
{
|
|
33223
|
+
id: "common_adapter" /* COMMON */,
|
|
33224
|
+
adapter: commonAdapter
|
|
33225
|
+
}
|
|
33226
|
+
]
|
|
33227
|
+
);
|
|
33228
|
+
vaultSettings.borrowable_assets.map(
|
|
33229
|
+
(borrowableAsset) => addVesuLeaves(
|
|
33230
|
+
borrowableAsset.poolId,
|
|
33231
|
+
lstSymbol,
|
|
33232
|
+
underlyingSymbol,
|
|
33233
|
+
vaultSettings,
|
|
33234
|
+
commonAdapter
|
|
33235
|
+
)
|
|
33236
|
+
);
|
|
33237
|
+
vaultSettings.leafAdapters.push(
|
|
33238
|
+
commonAdapter.getApproveAdapter(
|
|
33239
|
+
lstToken.address,
|
|
33240
|
+
AVNU_EXCHANGE,
|
|
33241
|
+
"avnu_mul_approve_withdr" /* AVNU_MULTIPLY_APPROVE_WITHDRAW */
|
|
33242
|
+
).bind(commonAdapter)
|
|
33243
|
+
);
|
|
33244
|
+
const uniqueBorrowableAssets = [
|
|
33245
|
+
...new Set(
|
|
33246
|
+
vaultSettings.borrowable_assets.map(
|
|
33247
|
+
(borrowableAsset) => borrowableAsset.token.symbol
|
|
33248
|
+
)
|
|
33249
|
+
)
|
|
33250
|
+
];
|
|
32865
33251
|
for (let borrowableAssetSymbol of uniqueBorrowableAssets) {
|
|
32866
|
-
const borrowableAsset = Global.getDefaultTokens().find(
|
|
33252
|
+
const borrowableAsset = Global.getDefaultTokens().find(
|
|
33253
|
+
(token) => token.symbol === borrowableAssetSymbol
|
|
33254
|
+
);
|
|
32867
33255
|
const debtAsset = borrowableAsset;
|
|
32868
|
-
const approve_debt_token_id = getAvnuManageIDs(
|
|
32869
|
-
|
|
32870
|
-
|
|
32871
|
-
|
|
32872
|
-
|
|
32873
|
-
|
|
32874
|
-
|
|
32875
|
-
|
|
32876
|
-
|
|
32877
|
-
|
|
32878
|
-
|
|
32879
|
-
|
|
33256
|
+
const approve_debt_token_id = getAvnuManageIDs(
|
|
33257
|
+
"avnu_mul_approve_dep" /* AVNU_MULTIPLY_APPROVE_DEPOSIT */,
|
|
33258
|
+
debtAsset.symbol
|
|
33259
|
+
);
|
|
33260
|
+
const swap_debt_token_id = getAvnuManageIDs(
|
|
33261
|
+
"avnu_mul_swap_dep" /* AVNU_MULTIPLY_SWAP_DEPOSIT */,
|
|
33262
|
+
debtAsset.symbol
|
|
33263
|
+
);
|
|
33264
|
+
const swap_lst_token_id = getAvnuManageIDs(
|
|
33265
|
+
"avnu_mul_swap_withdr" /* AVNU_MULTIPLY_SWAP_WITHDRAW */,
|
|
33266
|
+
debtAsset.symbol
|
|
33267
|
+
);
|
|
33268
|
+
vaultSettings.leafAdapters.push(
|
|
33269
|
+
commonAdapter.getApproveAdapter(
|
|
33270
|
+
debtAsset.address,
|
|
33271
|
+
AVNU_EXCHANGE,
|
|
33272
|
+
approve_debt_token_id
|
|
33273
|
+
).bind(commonAdapter)
|
|
33274
|
+
);
|
|
33275
|
+
vaultSettings.leafAdapters.push(
|
|
33276
|
+
commonAdapter.getAvnuAdapter(
|
|
33277
|
+
debtAsset.address,
|
|
33278
|
+
lstToken.address,
|
|
33279
|
+
swap_debt_token_id,
|
|
33280
|
+
false
|
|
33281
|
+
).bind(commonAdapter)
|
|
33282
|
+
);
|
|
33283
|
+
vaultSettings.leafAdapters.push(
|
|
33284
|
+
commonAdapter.getAvnuAdapter(
|
|
33285
|
+
lstToken.address,
|
|
33286
|
+
debtAsset.address,
|
|
33287
|
+
swap_lst_token_id,
|
|
33288
|
+
false
|
|
33289
|
+
).bind(commonAdapter)
|
|
33290
|
+
);
|
|
33291
|
+
}
|
|
33292
|
+
vaultSettings.leafAdapters.push(
|
|
33293
|
+
commonAdapter.getApproveAdapter(
|
|
33294
|
+
lstToken.address,
|
|
33295
|
+
vaultSettings.vaultAddress,
|
|
33296
|
+
"approve_bring_liquidity" /* APPROVE_BRING_LIQUIDITY */
|
|
33297
|
+
).bind(commonAdapter)
|
|
33298
|
+
);
|
|
33299
|
+
vaultSettings.leafAdapters.push(
|
|
33300
|
+
commonAdapter.getBringLiquidityAdapter("bring_liquidity" /* BRING_LIQUIDITY */).bind(commonAdapter)
|
|
33301
|
+
);
|
|
33302
|
+
const STRKToken = Global.getDefaultTokens().find(
|
|
33303
|
+
(token) => token.symbol === "STRK"
|
|
33304
|
+
);
|
|
33305
|
+
vaultSettings.leafAdapters.push(
|
|
33306
|
+
commonAdapter.getApproveAdapter(
|
|
33307
|
+
STRKToken.address,
|
|
33308
|
+
AVNU_EXCHANGE,
|
|
33309
|
+
"approve_swap_token1" /* APPROVE_SWAP_TOKEN1 */
|
|
33310
|
+
).bind(commonAdapter)
|
|
33311
|
+
);
|
|
33312
|
+
vaultSettings.leafAdapters.push(
|
|
33313
|
+
commonAdapter.getAvnuAdapter(
|
|
33314
|
+
STRKToken.address,
|
|
33315
|
+
lstToken.address,
|
|
33316
|
+
"avnu_swap_rewards" /* AVNU_SWAP_REWARDS */,
|
|
33317
|
+
false
|
|
33318
|
+
).bind(commonAdapter)
|
|
33319
|
+
);
|
|
32880
33320
|
return vaultSettings;
|
|
32881
33321
|
}
|
|
32882
33322
|
var AUDIT_URL4 = "https://docs.troves.fi/p/security#starknet-vault-kit";
|
|
@@ -32895,7 +33335,8 @@ function getFAQs2(lstSymbol, underlyingSymbol) {
|
|
|
32895
33335
|
answer: /* @__PURE__ */ jsxs4("span", { children: [
|
|
32896
33336
|
"Currently, the LST is from ",
|
|
32897
33337
|
/* @__PURE__ */ jsx5("strong", { children: "Endur" }),
|
|
32898
|
-
" while
|
|
33338
|
+
" while",
|
|
33339
|
+
" ",
|
|
32899
33340
|
/* @__PURE__ */ jsx5("strong", { children: "Vesu" }),
|
|
32900
33341
|
" is used to collateralize the looped position."
|
|
32901
33342
|
] })
|
|
@@ -32927,23 +33368,48 @@ function getFAQs2(lstSymbol, underlyingSymbol) {
|
|
|
32927
33368
|
];
|
|
32928
33369
|
}
|
|
32929
33370
|
var _riskFactor4 = [
|
|
32930
|
-
{
|
|
32931
|
-
|
|
32932
|
-
|
|
32933
|
-
|
|
32934
|
-
|
|
32935
|
-
|
|
32936
|
-
|
|
32937
|
-
|
|
32938
|
-
|
|
32939
|
-
|
|
33371
|
+
{
|
|
33372
|
+
type: "Smart Contract Risk" /* SMART_CONTRACT_RISK */,
|
|
33373
|
+
value: 2 /* WELL_AUDITED */,
|
|
33374
|
+
weight: 25,
|
|
33375
|
+
reason: "Audited by Zellic"
|
|
33376
|
+
},
|
|
33377
|
+
{
|
|
33378
|
+
type: "Liquidation Risk" /* LIQUIDATION_RISK */,
|
|
33379
|
+
value: 1 /* VERY_LOW_PROBABILITY */,
|
|
33380
|
+
weight: 25,
|
|
33381
|
+
reason: "The collateral and debt are highly correlated"
|
|
33382
|
+
},
|
|
33383
|
+
{
|
|
33384
|
+
type: "Technical Risk" /* TECHNICAL_RISK */,
|
|
33385
|
+
value: 1 /* STABLE_INFRASTRUCTURE */,
|
|
33386
|
+
weight: 25,
|
|
33387
|
+
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."
|
|
33388
|
+
},
|
|
33389
|
+
{
|
|
33390
|
+
type: "Depeg Risk" /* DEPEG_RISK */,
|
|
33391
|
+
value: 2 /* GENERALLY_STABLE */,
|
|
33392
|
+
weight: 25,
|
|
33393
|
+
reason: "Generally stable pegged assets"
|
|
33394
|
+
}
|
|
32940
33395
|
];
|
|
33396
|
+
var btcBorrowableAssets = ["WBTC", "tBTC", "LBTC", "solvBTC"];
|
|
32941
33397
|
var hyperxSTRK = {
|
|
32942
|
-
vaultAddress: ContractAddr.from(
|
|
32943
|
-
|
|
32944
|
-
|
|
32945
|
-
|
|
32946
|
-
|
|
33398
|
+
vaultAddress: ContractAddr.from(
|
|
33399
|
+
"0x46c7a54c82b1fe374353859f554a40b8bd31d3e30f742901579e7b57b1b5960"
|
|
33400
|
+
),
|
|
33401
|
+
manager: ContractAddr.from(
|
|
33402
|
+
"0x5d499cd333757f461a0bedaca3dfc4d77320c773037e0aa299f22a6dbfdc03a"
|
|
33403
|
+
),
|
|
33404
|
+
vaultAllocator: ContractAddr.from(
|
|
33405
|
+
"0x511d07953a09bc7c505970891507c5a2486d2ea22752601a14db092186d7caa"
|
|
33406
|
+
),
|
|
33407
|
+
redeemRequestNFT: ContractAddr.from(
|
|
33408
|
+
"0x51e40b839dc0c2feca923f863072673b94abfa2483345be3b30b457a90d095"
|
|
33409
|
+
),
|
|
33410
|
+
aumOracle: ContractAddr.from(
|
|
33411
|
+
"0x48cf709870a1a0d453d37de108e0c41b8b89819ef54f95abc0e2e1f98bbe937"
|
|
33412
|
+
),
|
|
32947
33413
|
leafAdapters: [],
|
|
32948
33414
|
adapters: [],
|
|
32949
33415
|
targetHealthFactor: 1.1,
|
|
@@ -32954,35 +33420,63 @@ var hyperxSTRK = {
|
|
|
32954
33420
|
...Global.getDefaultTokens().filter((token) => token.symbol === "STRK").map((token) => ({ token, poolId: VesuPools.Re7STRK }))
|
|
32955
33421
|
// v2, new alt for Re7xSTRK
|
|
32956
33422
|
],
|
|
32957
|
-
underlyingToken: Global.getDefaultTokens().find(
|
|
33423
|
+
underlyingToken: Global.getDefaultTokens().find(
|
|
33424
|
+
(token) => token.symbol === "STRK"
|
|
33425
|
+
),
|
|
32958
33426
|
defaultPoolId: VesuPools.Re7xSTRK
|
|
32959
33427
|
};
|
|
32960
33428
|
var hyperxWBTC = {
|
|
32961
|
-
vaultAddress: ContractAddr.from(
|
|
32962
|
-
|
|
32963
|
-
|
|
32964
|
-
|
|
32965
|
-
|
|
33429
|
+
vaultAddress: ContractAddr.from(
|
|
33430
|
+
"0x2da9d0f96a46b453f55604313785dc866424240b1c6811d13bef594343db818"
|
|
33431
|
+
),
|
|
33432
|
+
manager: ContractAddr.from(
|
|
33433
|
+
"0x75866db44c81e6986f06035206ee9c7d15833ddb22d6a22c016cfb5c866a491"
|
|
33434
|
+
),
|
|
33435
|
+
vaultAllocator: ContractAddr.from(
|
|
33436
|
+
"0x57b5c1bb457b5e840a2714ae53ada87d77be2f3fd33a59b4fe709ef20c020c1"
|
|
33437
|
+
),
|
|
33438
|
+
redeemRequestNFT: ContractAddr.from(
|
|
33439
|
+
"0x7a5dc288325456f05e70e9616e16bc02ffbe448f4b89f80b47c0970b989c7c"
|
|
33440
|
+
),
|
|
33441
|
+
aumOracle: ContractAddr.from(
|
|
33442
|
+
"0x258f8a0ca0d21f542e48ad89d00e92dc4d9db4999084f50ef9c22dfb1e83023"
|
|
33443
|
+
),
|
|
32966
33444
|
leafAdapters: [],
|
|
32967
33445
|
adapters: [],
|
|
32968
33446
|
targetHealthFactor: 1.1,
|
|
32969
33447
|
minHealthFactor: 1.05,
|
|
32970
33448
|
borrowable_assets: [
|
|
32971
33449
|
// allow all BTC flavours borrowing on Re7xBTC pool
|
|
32972
|
-
...btcBorrowableAssets.map(
|
|
33450
|
+
...btcBorrowableAssets.map(
|
|
33451
|
+
(asset) => Global.getDefaultTokens().find((token) => token.symbol === asset)
|
|
33452
|
+
).map((token) => ({ token, poolId: VesuPools.Re7xBTC })),
|
|
32973
33453
|
// allow only WBTC borrowing on Prime pool
|
|
32974
33454
|
...Global.getDefaultTokens().filter((token) => token.symbol === "WBTC").map((token) => ({ token, poolId: VesuPools.Prime }))
|
|
32975
33455
|
],
|
|
32976
|
-
underlyingToken: Global.getDefaultTokens().find(
|
|
33456
|
+
underlyingToken: Global.getDefaultTokens().find(
|
|
33457
|
+
(token) => token.symbol === "WBTC"
|
|
33458
|
+
),
|
|
32977
33459
|
defaultPoolId: VesuPools.Re7xBTC,
|
|
32978
|
-
redemptionRouter: ContractAddr.from(
|
|
33460
|
+
redemptionRouter: ContractAddr.from(
|
|
33461
|
+
"0x6ea649f402898f69baf775c1afdd08522c071c640b9c4460192070ec2b96417"
|
|
33462
|
+
)
|
|
32979
33463
|
};
|
|
32980
33464
|
var hyperxtBTC = {
|
|
32981
|
-
vaultAddress: ContractAddr.from(
|
|
32982
|
-
|
|
32983
|
-
|
|
32984
|
-
|
|
32985
|
-
|
|
33465
|
+
vaultAddress: ContractAddr.from(
|
|
33466
|
+
"0x47d5f68477e5637ce0e56436c6b5eee5a354e6828995dae106b11a48679328"
|
|
33467
|
+
),
|
|
33468
|
+
manager: ContractAddr.from(
|
|
33469
|
+
"0xc4cc3e08029a0ae076f5fdfca70575abb78d23c5cd1c49a957f7e697885401"
|
|
33470
|
+
),
|
|
33471
|
+
vaultAllocator: ContractAddr.from(
|
|
33472
|
+
"0x50bbd4fe69f841ecb13b2619fe50ebfa4e8944671b5d0ebf7868fd80c61b31e"
|
|
33473
|
+
),
|
|
33474
|
+
redeemRequestNFT: ContractAddr.from(
|
|
33475
|
+
"0xeac9032f02057779816e38a6cb9185d12d86b3aacc9949b96b36de359c1e3"
|
|
33476
|
+
),
|
|
33477
|
+
aumOracle: ContractAddr.from(
|
|
33478
|
+
"0x7e0d05cb7ba3f7db77a36c21c21583b5a524c2e685c08c24b3554911fb4a039"
|
|
33479
|
+
),
|
|
32986
33480
|
leafAdapters: [],
|
|
32987
33481
|
adapters: [],
|
|
32988
33482
|
targetHealthFactor: 1.1,
|
|
@@ -32990,16 +33484,30 @@ var hyperxtBTC = {
|
|
|
32990
33484
|
borrowable_assets: [
|
|
32991
33485
|
...Global.getDefaultTokens().filter((token) => token.symbol === "tBTC" || token.symbol === "WBTC").map((token) => ({ token, poolId: VesuPools.Re7xBTC }))
|
|
32992
33486
|
],
|
|
32993
|
-
underlyingToken: Global.getDefaultTokens().find(
|
|
33487
|
+
underlyingToken: Global.getDefaultTokens().find(
|
|
33488
|
+
(token) => token.symbol === "tBTC"
|
|
33489
|
+
),
|
|
32994
33490
|
defaultPoolId: VesuPools.Re7xBTC,
|
|
32995
|
-
redemptionRouter: ContractAddr.from(
|
|
33491
|
+
redemptionRouter: ContractAddr.from(
|
|
33492
|
+
"0x3de9c409d1e357e25778fb7a3e2e2393666956846a5c2caa607296fa8e76b5d"
|
|
33493
|
+
)
|
|
32996
33494
|
};
|
|
32997
33495
|
var hyperxsBTC = {
|
|
32998
|
-
vaultAddress: ContractAddr.from(
|
|
32999
|
-
|
|
33000
|
-
|
|
33001
|
-
|
|
33002
|
-
|
|
33496
|
+
vaultAddress: ContractAddr.from(
|
|
33497
|
+
"0x437ef1e7d0f100b2e070b7a65cafec0b2be31b0290776da8b4112f5473d8d9"
|
|
33498
|
+
),
|
|
33499
|
+
manager: ContractAddr.from(
|
|
33500
|
+
"0xc9ac023090625b0be3f6532ca353f086746f9c09f939dbc1b2613f09e5f821"
|
|
33501
|
+
),
|
|
33502
|
+
vaultAllocator: ContractAddr.from(
|
|
33503
|
+
"0x60c2d856936b975459a5b4eb28b8672d91f757bd76cebb6241f8d670185dc01"
|
|
33504
|
+
),
|
|
33505
|
+
redeemRequestNFT: ContractAddr.from(
|
|
33506
|
+
"0x429e8ee8bc7ecd1ade72630d350a2e0f10f9a2507c45f188ba17fe8f2ab4cf3"
|
|
33507
|
+
),
|
|
33508
|
+
aumOracle: ContractAddr.from(
|
|
33509
|
+
"0x149298ade3e79ec6cbdac6cfad289c57504eaf54e590939136ed1ceca60c345"
|
|
33510
|
+
),
|
|
33003
33511
|
leafAdapters: [],
|
|
33004
33512
|
adapters: [],
|
|
33005
33513
|
targetHealthFactor: 1.1,
|
|
@@ -33007,15 +33515,27 @@ var hyperxsBTC = {
|
|
|
33007
33515
|
borrowable_assets: [
|
|
33008
33516
|
...Global.getDefaultTokens().filter((token) => token.symbol === "solvBTC").map((token) => ({ token, poolId: VesuPools.Re7xBTC }))
|
|
33009
33517
|
],
|
|
33010
|
-
underlyingToken: Global.getDefaultTokens().find(
|
|
33518
|
+
underlyingToken: Global.getDefaultTokens().find(
|
|
33519
|
+
(token) => token.symbol === "solvBTC"
|
|
33520
|
+
),
|
|
33011
33521
|
defaultPoolId: VesuPools.Re7xBTC
|
|
33012
33522
|
};
|
|
33013
33523
|
var hyperxLBTC = {
|
|
33014
|
-
vaultAddress: ContractAddr.from(
|
|
33015
|
-
|
|
33016
|
-
|
|
33017
|
-
|
|
33018
|
-
|
|
33524
|
+
vaultAddress: ContractAddr.from(
|
|
33525
|
+
"0x64cf24d4883fe569926419a0569ab34497c6956a1a308fa883257f7486d7030"
|
|
33526
|
+
),
|
|
33527
|
+
manager: ContractAddr.from(
|
|
33528
|
+
"0x203530a4022a99b8f4b406aaf33b0849d43ad7422c1d5cc14ff8c667abec6c0"
|
|
33529
|
+
),
|
|
33530
|
+
vaultAllocator: ContractAddr.from(
|
|
33531
|
+
"0x7dbc8ccd4eabce6ea6c19e0e5c9ccca3a93bd510303b9e071cbe25fc508546e"
|
|
33532
|
+
),
|
|
33533
|
+
redeemRequestNFT: ContractAddr.from(
|
|
33534
|
+
"0x5ee66a39af9aef3d0d48982b4a63e8bd2a5bad021916bd87fb0eae3a26800b8"
|
|
33535
|
+
),
|
|
33536
|
+
aumOracle: ContractAddr.from(
|
|
33537
|
+
"0x23d69e4391fa72d10e625e7575d8bddbb4aff96f04503f83fdde23123bf41d0"
|
|
33538
|
+
),
|
|
33019
33539
|
leafAdapters: [],
|
|
33020
33540
|
adapters: [],
|
|
33021
33541
|
targetHealthFactor: 1.1,
|
|
@@ -33023,7 +33543,9 @@ var hyperxLBTC = {
|
|
|
33023
33543
|
borrowable_assets: [
|
|
33024
33544
|
...Global.getDefaultTokens().filter((token) => token.symbol === "LBTC").map((token) => ({ token, poolId: VesuPools.Re7xBTC }))
|
|
33025
33545
|
],
|
|
33026
|
-
underlyingToken: Global.getDefaultTokens().find(
|
|
33546
|
+
underlyingToken: Global.getDefaultTokens().find(
|
|
33547
|
+
(token) => token.symbol === "LBTC"
|
|
33548
|
+
),
|
|
33027
33549
|
defaultPoolId: VesuPools.Re7xBTC
|
|
33028
33550
|
};
|
|
33029
33551
|
function getInvestmentSteps(lstSymbol, underlyingSymbol) {
|
|
@@ -33041,7 +33563,7 @@ function getMaxTVL(lstSymbol) {
|
|
|
33041
33563
|
xLBTC: 5,
|
|
33042
33564
|
xtBTC: 5,
|
|
33043
33565
|
xsBTC: 5,
|
|
33044
|
-
xSTRK:
|
|
33566
|
+
xSTRK: 7e6
|
|
33045
33567
|
};
|
|
33046
33568
|
const maxTVLValue = lstMaxTVLs[lstSymbol] || 0;
|
|
33047
33569
|
const token = Global.getDefaultTokens().find(
|
|
@@ -33110,15 +33632,19 @@ var HYPER_LST_SECURITY = {
|
|
|
33110
33632
|
};
|
|
33111
33633
|
var HYPER_LST_REDEMPTION_INFO = {
|
|
33112
33634
|
instantWithdrawalVault: "No" /* NO */,
|
|
33113
|
-
redemptionsInfo: [
|
|
33114
|
-
|
|
33115
|
-
|
|
33116
|
-
|
|
33117
|
-
|
|
33118
|
-
|
|
33119
|
-
|
|
33120
|
-
|
|
33121
|
-
|
|
33635
|
+
redemptionsInfo: [
|
|
33636
|
+
{
|
|
33637
|
+
title: "Typical Duration",
|
|
33638
|
+
description: "1-2 hours"
|
|
33639
|
+
}
|
|
33640
|
+
],
|
|
33641
|
+
alerts: [
|
|
33642
|
+
{
|
|
33643
|
+
type: "info",
|
|
33644
|
+
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.",
|
|
33645
|
+
tab: "withdraw"
|
|
33646
|
+
}
|
|
33647
|
+
]
|
|
33122
33648
|
};
|
|
33123
33649
|
function getStrategySettings(lstSymbol, underlyingSymbol, settings, isPreview = false) {
|
|
33124
33650
|
return {
|
|
@@ -33133,9 +33659,7 @@ function getStrategySettings(lstSymbol, underlyingSymbol, settings, isPreview =
|
|
|
33133
33659
|
description: `Creates leveraged looping position on ${lstSymbol} by borrowing ${underlyingSymbol} to increase yield`
|
|
33134
33660
|
},
|
|
33135
33661
|
depositTokens: [
|
|
33136
|
-
Global.getDefaultTokens().find(
|
|
33137
|
-
(token) => token.symbol === lstSymbol
|
|
33138
|
-
)
|
|
33662
|
+
Global.getDefaultTokens().find((token) => token.symbol === lstSymbol)
|
|
33139
33663
|
],
|
|
33140
33664
|
additionalInfo: getLooperSettings2(
|
|
33141
33665
|
lstSymbol,
|
|
@@ -33145,10 +33669,7 @@ function getStrategySettings(lstSymbol, underlyingSymbol, settings, isPreview =
|
|
|
33145
33669
|
),
|
|
33146
33670
|
risk: {
|
|
33147
33671
|
riskFactor: _riskFactor4,
|
|
33148
|
-
netRisk: _riskFactor4.reduce(
|
|
33149
|
-
(acc, curr) => acc + curr.value * curr.weight,
|
|
33150
|
-
0
|
|
33151
|
-
) / _riskFactor4.reduce((acc, curr) => acc + curr.weight, 0),
|
|
33672
|
+
netRisk: _riskFactor4.reduce((acc, curr) => acc + curr.value * curr.weight, 0) / _riskFactor4.reduce((acc, curr) => acc + curr.weight, 0),
|
|
33152
33673
|
notARisks: getNoRiskTags(_riskFactor4)
|
|
33153
33674
|
},
|
|
33154
33675
|
auditUrl: AUDIT_URL4,
|
|
@@ -33163,16 +33684,19 @@ function getStrategySettings(lstSymbol, underlyingSymbol, settings, isPreview =
|
|
|
33163
33684
|
investmentSteps: getInvestmentSteps(lstSymbol, underlyingSymbol),
|
|
33164
33685
|
isPreview,
|
|
33165
33686
|
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.",
|
|
33687
|
+
realizedAPYMethodology: "The realizedAPY is based on past 14 days performance by the vault",
|
|
33166
33688
|
tags: lstSymbol.includes("BTC") ? ["BTC" /* BTC */, "Maxx" /* LEVERED */] : ["Maxx" /* LEVERED */],
|
|
33167
33689
|
security: HYPER_LST_SECURITY,
|
|
33168
33690
|
redemptionInfo: HYPER_LST_REDEMPTION_INFO,
|
|
33169
33691
|
usualTimeToEarnings: "2 weeks",
|
|
33170
33692
|
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.",
|
|
33171
|
-
points: [
|
|
33172
|
-
|
|
33173
|
-
|
|
33174
|
-
|
|
33175
|
-
|
|
33693
|
+
points: [
|
|
33694
|
+
{
|
|
33695
|
+
multiplier: 4,
|
|
33696
|
+
logo: "https://endur.fi/favicon.ico",
|
|
33697
|
+
toolTip: "This strategy holds xSTRK. Earn 3-4x Endur points on your xSTRK due to the leverage. Points can be found on endur.fi."
|
|
33698
|
+
}
|
|
33699
|
+
]
|
|
33176
33700
|
};
|
|
33177
33701
|
}
|
|
33178
33702
|
var HyperLSTStrategies = [
|