@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.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(
|
|
@@ -30944,6 +30946,13 @@ var vault_manager_abi_default = [
|
|
|
30944
30946
|
}
|
|
30945
30947
|
];
|
|
30946
30948
|
|
|
30949
|
+
// src/strategies/types.ts
|
|
30950
|
+
var LSTPriceType = /* @__PURE__ */ ((LSTPriceType2) => {
|
|
30951
|
+
LSTPriceType2["ENDUR_PRICE"] = "ENDUR_PRICE";
|
|
30952
|
+
LSTPriceType2["AVNU_PRICE"] = "AVNU_PRICE";
|
|
30953
|
+
return LSTPriceType2;
|
|
30954
|
+
})(LSTPriceType || {});
|
|
30955
|
+
|
|
30947
30956
|
// src/strategies/universal-strategy.tsx
|
|
30948
30957
|
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
30949
30958
|
var AUMTypes = /* @__PURE__ */ ((AUMTypes3) => {
|
|
@@ -31252,7 +31261,7 @@ var UniversalStrategy = class _UniversalStrategy extends BaseStrategy {
|
|
|
31252
31261
|
usdValue
|
|
31253
31262
|
};
|
|
31254
31263
|
}
|
|
31255
|
-
async getVesuAUM(adapter) {
|
|
31264
|
+
async getVesuAUM(adapter, _priceType) {
|
|
31256
31265
|
const legAUM = await adapter.getPositions(this.config);
|
|
31257
31266
|
const underlying = this.asset();
|
|
31258
31267
|
let vesuAum = Web3Number.fromWei("0", underlying.decimals);
|
|
@@ -31278,13 +31287,15 @@ var UniversalStrategy = class _UniversalStrategy extends BaseStrategy {
|
|
|
31278
31287
|
logger.verbose(`${this.getTag()} Prev AUM: ${prevAum}`);
|
|
31279
31288
|
return prevAum;
|
|
31280
31289
|
}
|
|
31281
|
-
async getAUM() {
|
|
31290
|
+
async getAUM(unrealizedAUM) {
|
|
31282
31291
|
const prevAum = await this.getPrevAUM();
|
|
31283
31292
|
const token1Price = await this.pricer.getPrice(this.metadata.depositTokens[0].symbol);
|
|
31284
31293
|
const vesuAdapters = this.getVesuAdapters();
|
|
31285
31294
|
let vesuAum = Web3Number.fromWei("0", this.asset().decimals);
|
|
31286
31295
|
for (const adapter of vesuAdapters) {
|
|
31287
|
-
|
|
31296
|
+
const priceType = unrealizedAUM ? "ENDUR_PRICE" /* ENDUR_PRICE */ : "AVNU_PRICE" /* AVNU_PRICE */;
|
|
31297
|
+
const aumValue = await this.getVesuAUM(adapter, priceType);
|
|
31298
|
+
vesuAum = vesuAum.plus(aumValue);
|
|
31288
31299
|
}
|
|
31289
31300
|
const balance = await this.getUnusedBalance();
|
|
31290
31301
|
logger.verbose(`${this.getTag()} unused balance: ${balance.amount.toNumber()}`);
|
|
@@ -31795,7 +31806,6 @@ function MetaVaultDescription(allowedSources) {
|
|
|
31795
31806
|
const containerStyle = {
|
|
31796
31807
|
maxWidth: "800px",
|
|
31797
31808
|
margin: "0 auto",
|
|
31798
|
-
backgroundColor: "#111",
|
|
31799
31809
|
color: "#eee",
|
|
31800
31810
|
fontFamily: "Arial, sans-serif",
|
|
31801
31811
|
borderRadius: "12px"
|
|
@@ -31988,6 +31998,7 @@ var createUniversalStrategy = (params) => ({
|
|
|
31988
31998
|
risk: getUniversalRisk(),
|
|
31989
31999
|
auditUrl: AUDIT_URL3,
|
|
31990
32000
|
protocols: [Protocols.VESU],
|
|
32001
|
+
realizedAPYMethodology: "The realizedAPY is based on past 14 days performance by the vault",
|
|
31991
32002
|
curator: {
|
|
31992
32003
|
name: "Unwrap Labs",
|
|
31993
32004
|
logo: "https://assets.troves.fi/integrations/unwraplabs/white.png"
|
|
@@ -32098,23 +32109,36 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
32098
32109
|
constructor(config, pricer, metadata) {
|
|
32099
32110
|
super(config, pricer, metadata);
|
|
32100
32111
|
this.quoteAmountToFetchPrice = new Web3Number(1, 18);
|
|
32101
|
-
const STRKToken = Global.getDefaultTokens().find(
|
|
32112
|
+
const STRKToken = Global.getDefaultTokens().find(
|
|
32113
|
+
(token) => token.symbol === "STRK"
|
|
32114
|
+
);
|
|
32102
32115
|
const underlyingToken = this.getLSTUnderlyingTokenInfo();
|
|
32103
32116
|
if (underlyingToken.address.eq(STRKToken.address)) {
|
|
32104
32117
|
this.quoteAmountToFetchPrice = new Web3Number(100, 18);
|
|
32105
32118
|
} else {
|
|
32106
|
-
this.quoteAmountToFetchPrice = new Web3Number(
|
|
32119
|
+
this.quoteAmountToFetchPrice = new Web3Number(
|
|
32120
|
+
0.01,
|
|
32121
|
+
this.asset().decimals
|
|
32122
|
+
);
|
|
32107
32123
|
}
|
|
32108
32124
|
}
|
|
32109
32125
|
asset() {
|
|
32110
|
-
return this.getVesuSameTokenAdapter(
|
|
32126
|
+
return this.getVesuSameTokenAdapter(
|
|
32127
|
+
this.metadata.additionalInfo.defaultPoolId
|
|
32128
|
+
).config.collateral;
|
|
32111
32129
|
}
|
|
32112
32130
|
getTag() {
|
|
32113
32131
|
return `${_UniversalLstMultiplierStrategy.name}:${this.metadata.name}`;
|
|
32114
32132
|
}
|
|
32115
32133
|
// Vesu adapter with LST and base token match
|
|
32116
32134
|
getVesuSameTokenAdapter(poolId) {
|
|
32117
|
-
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
|
+
);
|
|
32118
32142
|
baseAdapter.networkConfig = this.config;
|
|
32119
32143
|
baseAdapter.pricer = this.pricer;
|
|
32120
32144
|
return baseAdapter;
|
|
@@ -32157,27 +32181,43 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
32157
32181
|
lstUnderlyingTokenInfo.address.address,
|
|
32158
32182
|
this.quoteAmountToFetchPrice
|
|
32159
32183
|
);
|
|
32160
|
-
const outputAmount = Web3Number.fromWei(
|
|
32184
|
+
const outputAmount = Web3Number.fromWei(
|
|
32185
|
+
quote.total_calculated,
|
|
32186
|
+
lstUnderlyingTokenInfo.decimals
|
|
32187
|
+
);
|
|
32161
32188
|
const price = outputAmount.toNumber() / this.quoteAmountToFetchPrice.toNumber();
|
|
32162
32189
|
logger.verbose(`${this.getTag()}:: LST Dex Price: ${price}`);
|
|
32163
32190
|
return price;
|
|
32164
32191
|
}
|
|
32165
32192
|
async getAvnuSwapMultiplyCall(params) {
|
|
32166
|
-
assert(
|
|
32167
|
-
|
|
32193
|
+
assert(
|
|
32194
|
+
params.isDeposit,
|
|
32195
|
+
"Only deposit is supported in getAvnuSwapMultiplyCall"
|
|
32196
|
+
);
|
|
32197
|
+
const maxBorrowableAmounts = await this.getMaxBorrowableAmount({
|
|
32198
|
+
isAPYComputation: false
|
|
32199
|
+
});
|
|
32168
32200
|
const allVesuAdapters = this.getVesuAdapters();
|
|
32169
32201
|
let remainingAmount = params.leg1DepositAmount;
|
|
32170
32202
|
const lstExRate = await this.getLSTExchangeRate();
|
|
32171
|
-
const baseAssetPrice = await this.pricer.getPrice(
|
|
32203
|
+
const baseAssetPrice = await this.pricer.getPrice(
|
|
32204
|
+
this.getLSTUnderlyingTokenInfo().symbol
|
|
32205
|
+
);
|
|
32172
32206
|
const lstPrice = baseAssetPrice.price * lstExRate;
|
|
32173
32207
|
for (let i = 0; i < maxBorrowableAmounts.maxBorrowables.length; i++) {
|
|
32174
32208
|
const maxBorrowable = maxBorrowableAmounts.maxBorrowables[i];
|
|
32175
|
-
const vesuAdapter = allVesuAdapters.find(
|
|
32209
|
+
const vesuAdapter = allVesuAdapters.find(
|
|
32210
|
+
(adapter) => adapter.config.debt.address.eq(maxBorrowable.borrowableAsset.address)
|
|
32211
|
+
);
|
|
32176
32212
|
if (!vesuAdapter) {
|
|
32177
|
-
throw new Error(
|
|
32213
|
+
throw new Error(
|
|
32214
|
+
`${this.getTag()}::getAvnuSwapMultiplyCall: vesuAdapter not found for borrowable asset: ${maxBorrowable.borrowableAsset.symbol}`
|
|
32215
|
+
);
|
|
32178
32216
|
}
|
|
32179
32217
|
const maxLTV = await vesuAdapter.getLTVConfig(this.config);
|
|
32180
|
-
const debtPrice = await this.pricer.getPrice(
|
|
32218
|
+
const debtPrice = await this.pricer.getPrice(
|
|
32219
|
+
maxBorrowable.borrowableAsset.symbol
|
|
32220
|
+
);
|
|
32181
32221
|
const maxAmountToDeposit = HealthFactorMath.getMinCollateralRequiredOnLooping(
|
|
32182
32222
|
maxBorrowable.amount,
|
|
32183
32223
|
debtPrice.price,
|
|
@@ -32187,7 +32227,9 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
32187
32227
|
this.asset()
|
|
32188
32228
|
);
|
|
32189
32229
|
const amountToDeposit = remainingAmount.minimum(maxAmountToDeposit);
|
|
32190
|
-
logger.verbose(
|
|
32230
|
+
logger.verbose(
|
|
32231
|
+
`${this.getTag()}::getAvnuSwapMultiplyCall::${vesuAdapter.config.debt.symbol}:: remainingAmount: ${remainingAmount}, amountToDeposit: ${amountToDeposit}, depositAmount: ${amountToDeposit}, maxBorrowable: ${maxBorrowable.amount}`
|
|
32232
|
+
);
|
|
32191
32233
|
const call = await this._getAvnuDepositSwapLegCall({
|
|
32192
32234
|
isDeposit: params.isDeposit,
|
|
32193
32235
|
// adjust decimals of debt asset
|
|
@@ -32199,36 +32241,60 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
32199
32241
|
remainingAmount = remainingAmount.minus(amountToDeposit);
|
|
32200
32242
|
return { call, vesuAdapter };
|
|
32201
32243
|
}
|
|
32202
|
-
throw new Error(
|
|
32244
|
+
throw new Error(
|
|
32245
|
+
`${this.getTag()}::getAvnuSwapMultiplyCall: no calls found`
|
|
32246
|
+
);
|
|
32203
32247
|
}
|
|
32204
32248
|
async _getAvnuDepositSwapLegCall(params) {
|
|
32205
32249
|
const { vesuAdapter } = params;
|
|
32206
|
-
logger.verbose(
|
|
32207
|
-
|
|
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
|
+
);
|
|
32208
32257
|
const legLTV = await vesuAdapter.getLTVConfig(this.config);
|
|
32209
|
-
logger.verbose(
|
|
32258
|
+
logger.verbose(
|
|
32259
|
+
`${this.getTag()}::_getAvnuDepositSwapLegCall legLTV: ${legLTV}`
|
|
32260
|
+
);
|
|
32210
32261
|
const existingPositions = await vesuAdapter.getPositions(this.config);
|
|
32211
|
-
const collateralisation = await vesuAdapter.getCollateralization(
|
|
32262
|
+
const collateralisation = await vesuAdapter.getCollateralization(
|
|
32263
|
+
this.config
|
|
32264
|
+
);
|
|
32212
32265
|
const existingCollateralInfo = existingPositions[0];
|
|
32213
32266
|
const existingDebtInfo = existingPositions[1];
|
|
32214
32267
|
logger.debug(`${this.getTag()}::_getAvnuDepositSwapLegCall existingCollateralInfo: ${JSON.stringify(existingCollateralInfo)},
|
|
32215
32268
|
existingDebtInfo: ${JSON.stringify(existingDebtInfo)}, collateralisation: ${JSON.stringify(collateralisation)}`);
|
|
32216
32269
|
const collateralPrice = collateralisation[0].usdValue > 0 ? collateralisation[0].usdValue / existingCollateralInfo.amount.toNumber() : 1;
|
|
32217
32270
|
const debtPrice = collateralisation[1].usdValue > 0 ? collateralisation[1].usdValue / existingDebtInfo.amount.toNumber() : 1;
|
|
32218
|
-
logger.debug(
|
|
32271
|
+
logger.debug(
|
|
32272
|
+
`${this.getTag()}::_getAvnuDepositSwapLegCall collateralPrice: ${collateralPrice}, debtPrice: ${debtPrice}`
|
|
32273
|
+
);
|
|
32219
32274
|
const debtTokenInfo = vesuAdapter.config.debt;
|
|
32220
32275
|
let newDepositAmount = params.leg1DepositAmount;
|
|
32221
|
-
const totalCollateral = existingCollateralInfo.amount.plus(
|
|
32222
|
-
|
|
32276
|
+
const totalCollateral = existingCollateralInfo.amount.plus(
|
|
32277
|
+
params.leg1DepositAmount
|
|
32278
|
+
);
|
|
32279
|
+
logger.verbose(
|
|
32280
|
+
`${this.getTag()}::_getAvnuDepositSwapLegCall totalCollateral: ${totalCollateral}`
|
|
32281
|
+
);
|
|
32223
32282
|
const totalDebtAmount = new Web3Number(
|
|
32224
32283
|
totalCollateral.multipliedBy(collateralPrice).multipliedBy(legLTV).dividedBy(debtPrice).dividedBy(params.minHF).toString(),
|
|
32225
32284
|
debtTokenInfo.decimals
|
|
32226
32285
|
);
|
|
32227
32286
|
let debtAmount = totalDebtAmount.minus(existingDebtInfo.amount);
|
|
32228
|
-
logger.verbose(
|
|
32229
|
-
|
|
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
|
+
);
|
|
32230
32294
|
if (debtAmount.gt(0) && maxBorrowable.amount.eq(0)) {
|
|
32231
|
-
logger.verbose(
|
|
32295
|
+
logger.verbose(
|
|
32296
|
+
`${this.getTag()}::_getAvnuDepositSwapLegCall maxBorrowable is 0, skipping`
|
|
32297
|
+
);
|
|
32232
32298
|
return void 0;
|
|
32233
32299
|
} else if (debtAmount.gt(0) && maxBorrowable.amount.gt(0)) {
|
|
32234
32300
|
debtAmount = maxBorrowable.amount.minimum(debtAmount);
|
|
@@ -32241,16 +32307,24 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
32241
32307
|
collateralPrice,
|
|
32242
32308
|
this.asset()
|
|
32243
32309
|
);
|
|
32244
|
-
newDepositAmount = totalCollateralRequired.minus(
|
|
32310
|
+
newDepositAmount = totalCollateralRequired.minus(
|
|
32311
|
+
existingCollateralInfo.amount
|
|
32312
|
+
);
|
|
32245
32313
|
if (newDepositAmount.lt(0)) {
|
|
32246
|
-
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
|
+
);
|
|
32247
32317
|
}
|
|
32248
32318
|
if (newDebtUSDValue.toNumber() < 100) {
|
|
32249
|
-
logger.verbose(
|
|
32319
|
+
logger.verbose(
|
|
32320
|
+
`${this.getTag()}::_getAvnuDepositSwapLegCall newDebtUSDValue is less than 100, skipping`
|
|
32321
|
+
);
|
|
32250
32322
|
return void 0;
|
|
32251
32323
|
}
|
|
32252
32324
|
}
|
|
32253
|
-
logger.verbose(
|
|
32325
|
+
logger.verbose(
|
|
32326
|
+
`${this.getTag()}::_getAvnuDepositSwapLegCall debtAmount: ${debtAmount}`
|
|
32327
|
+
);
|
|
32254
32328
|
if (debtAmount.lt(0)) {
|
|
32255
32329
|
const lstDEXPrice = await this.getLSTDexPrice();
|
|
32256
32330
|
const debtAmountInLST = debtAmount.abs().dividedBy(lstDEXPrice);
|
|
@@ -32259,28 +32333,38 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
32259
32333
|
leg1DepositAmount: debtAmountInLST,
|
|
32260
32334
|
poolId: vesuAdapter.config.poolId
|
|
32261
32335
|
});
|
|
32262
|
-
assert(
|
|
32336
|
+
assert(
|
|
32337
|
+
calls.length == 1,
|
|
32338
|
+
`Expected 1 call for unwind, got ${calls.length}`
|
|
32339
|
+
);
|
|
32263
32340
|
return calls[0];
|
|
32264
32341
|
}
|
|
32265
|
-
console.log(`debtAmount`, debtAmount.toWei(), params.leg1DepositAmount.toWei());
|
|
32266
32342
|
const STEP0 = "approve_token1" /* APPROVE_TOKEN1 */;
|
|
32267
32343
|
const manage0Info = this.getProofs(STEP0);
|
|
32268
32344
|
const manageCall0 = manage0Info.callConstructor({
|
|
32269
32345
|
amount: newDepositAmount
|
|
32270
32346
|
});
|
|
32271
|
-
const STEP1 = getVesuLegId(
|
|
32347
|
+
const STEP1 = getVesuLegId(
|
|
32348
|
+
"vesu_leg1" /* VESU_LEG1 */,
|
|
32349
|
+
vesuAdapter.config.debt.symbol,
|
|
32350
|
+
vesuAdapter.config.poolId.toString()
|
|
32351
|
+
);
|
|
32272
32352
|
const manage1Info = this.getProofs(STEP1);
|
|
32273
|
-
const manageCall1 = manage1Info.callConstructor(
|
|
32274
|
-
|
|
32275
|
-
|
|
32276
|
-
|
|
32277
|
-
|
|
32278
|
-
|
|
32279
|
-
|
|
32353
|
+
const manageCall1 = manage1Info.callConstructor(
|
|
32354
|
+
VesuAdapter.getDefaultModifyPositionCallParams({
|
|
32355
|
+
collateralAmount: newDepositAmount,
|
|
32356
|
+
isAddCollateral: params.isDeposit,
|
|
32357
|
+
debtAmount,
|
|
32358
|
+
isBorrow: params.isDeposit
|
|
32359
|
+
})
|
|
32360
|
+
);
|
|
32280
32361
|
const proofIds = [STEP0, STEP1];
|
|
32281
32362
|
const manageCalls = [manageCall0, manageCall1];
|
|
32282
32363
|
if (debtAmount.gt(0)) {
|
|
32283
|
-
const STEP2 = getAvnuManageIDs(
|
|
32364
|
+
const STEP2 = getAvnuManageIDs(
|
|
32365
|
+
"avnu_mul_approve_dep" /* AVNU_MULTIPLY_APPROVE_DEPOSIT */,
|
|
32366
|
+
vesuAdapter.config.debt.symbol
|
|
32367
|
+
);
|
|
32284
32368
|
const manage2Info = this.getProofs(STEP2);
|
|
32285
32369
|
const manageCall2 = manage2Info.callConstructor({
|
|
32286
32370
|
amount: debtAmount
|
|
@@ -32296,7 +32380,9 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
32296
32380
|
);
|
|
32297
32381
|
const minAmount = await this._getMinOutputAmountLSTBuy(debtAmount);
|
|
32298
32382
|
const minAmountWei = minAmount.toWei();
|
|
32299
|
-
logger.verbose(
|
|
32383
|
+
logger.verbose(
|
|
32384
|
+
`${this.getTag()}::_getAvnuDepositSwapLegCall minAmount: ${minAmount}`
|
|
32385
|
+
);
|
|
32300
32386
|
const swapInfo = await avnuModule.getSwapInfo(
|
|
32301
32387
|
quote,
|
|
32302
32388
|
this.metadata.additionalInfo.vaultAllocator.address,
|
|
@@ -32304,8 +32390,13 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
32304
32390
|
this.address.address,
|
|
32305
32391
|
minAmountWei
|
|
32306
32392
|
);
|
|
32307
|
-
logger.verbose(
|
|
32308
|
-
|
|
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
|
+
);
|
|
32309
32400
|
const manage3Info = this.getProofs(STEP3);
|
|
32310
32401
|
const manageCall3 = manage3Info.callConstructor({
|
|
32311
32402
|
props: swapInfo
|
|
@@ -32315,22 +32406,32 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
32315
32406
|
manageCalls.push(manageCall2, manageCall3);
|
|
32316
32407
|
const newCollateral = minAmount.plus(totalCollateral);
|
|
32317
32408
|
const newHF = newCollateral.multipliedBy(collateralPrice).multipliedBy(legLTV).dividedBy(totalDebtAmount).dividedBy(debtPrice).toNumber();
|
|
32318
|
-
logger.verbose(
|
|
32409
|
+
logger.verbose(
|
|
32410
|
+
`${this.getTag()}::_getAvnuDepositSwapLegCall newHF: ${newHF}`
|
|
32411
|
+
);
|
|
32319
32412
|
if (newHF > this.metadata.additionalInfo.minHealthFactor && newHF < this.metadata.additionalInfo.targetHealthFactor + 0.05) {
|
|
32320
|
-
logger.verbose(
|
|
32413
|
+
logger.verbose(
|
|
32414
|
+
`${this.getTag()}::_getAvnuDepositSwapLegCall newHF is above min and below target + 0.05, adding collateral on vesu`
|
|
32415
|
+
);
|
|
32321
32416
|
const STEP4 = "approve_token1" /* APPROVE_TOKEN1 */;
|
|
32322
32417
|
const manage4Info = this.getProofs(STEP4);
|
|
32323
32418
|
const manageCall4 = manage4Info.callConstructor({
|
|
32324
32419
|
amount: minAmount
|
|
32325
32420
|
});
|
|
32326
|
-
const STEP5 = getVesuLegId(
|
|
32421
|
+
const STEP5 = getVesuLegId(
|
|
32422
|
+
"vesu_leg1" /* VESU_LEG1 */,
|
|
32423
|
+
vesuAdapter.config.debt.symbol,
|
|
32424
|
+
vesuAdapter.config.poolId.toString()
|
|
32425
|
+
);
|
|
32327
32426
|
const manage5Info = this.getProofs(STEP5);
|
|
32328
|
-
const manageCall5 = manage5Info.callConstructor(
|
|
32329
|
-
|
|
32330
|
-
|
|
32331
|
-
|
|
32332
|
-
|
|
32333
|
-
|
|
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
|
+
);
|
|
32334
32435
|
proofIds.push(STEP4, STEP5);
|
|
32335
32436
|
manageCalls.push(manageCall4, manageCall5);
|
|
32336
32437
|
}
|
|
@@ -32338,11 +32439,13 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
32338
32439
|
const manageCall = this.getManageCall(proofIds, manageCalls);
|
|
32339
32440
|
return manageCall;
|
|
32340
32441
|
}
|
|
32341
|
-
// todo unwind or not deposit when the yield is bad.
|
|
32442
|
+
// todo unwind or not deposit when the yield is bad.
|
|
32342
32443
|
async getLSTMultiplierRebalanceCall() {
|
|
32343
32444
|
let shouldRebalance = false;
|
|
32344
32445
|
const calls = [];
|
|
32345
|
-
const allVesuAdapters = this.getVesuAdapters().filter(
|
|
32446
|
+
const allVesuAdapters = this.getVesuAdapters().filter(
|
|
32447
|
+
(vesuAdapter) => vesuAdapter.config.debt.symbol === "LBTC"
|
|
32448
|
+
);
|
|
32346
32449
|
for (const vesuAdapter of allVesuAdapters) {
|
|
32347
32450
|
const call = await this._getLSTMultiplierRebalanceCall(vesuAdapter);
|
|
32348
32451
|
if (call.shouldRebalance && call.manageCall) {
|
|
@@ -32354,18 +32457,27 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
32354
32457
|
}
|
|
32355
32458
|
async _getLSTMultiplierRebalanceCall(vesuAdapter) {
|
|
32356
32459
|
const positions = await vesuAdapter.getPositions(this.config);
|
|
32357
|
-
assert(
|
|
32460
|
+
assert(
|
|
32461
|
+
positions.length == 2,
|
|
32462
|
+
"Rebalance call is only supported for 2 positions"
|
|
32463
|
+
);
|
|
32358
32464
|
const existingCollateralInfo = positions[0];
|
|
32359
32465
|
const existingDebtInfo = positions[1];
|
|
32360
32466
|
const unusedBalance = await this.getUnusedBalance();
|
|
32361
32467
|
const healthFactor = await vesuAdapter.getHealthFactor();
|
|
32362
|
-
const collateralisation = await vesuAdapter.getCollateralization(
|
|
32468
|
+
const collateralisation = await vesuAdapter.getCollateralization(
|
|
32469
|
+
this.config
|
|
32470
|
+
);
|
|
32363
32471
|
logger.debug(`${this.getTag()}::getVesuMultiplyCall::${vesuAdapter.config.debt.symbol} existingCollateralInfo: ${JSON.stringify(existingCollateralInfo)},
|
|
32364
32472
|
existingDebtInfo: ${JSON.stringify(existingDebtInfo)}, collateralisation: ${JSON.stringify(collateralisation)}`);
|
|
32365
32473
|
const collateralPrice = collateralisation[0].usdValue > 0 ? collateralisation[0].usdValue / existingCollateralInfo.amount.toNumber() : 1;
|
|
32366
32474
|
const debtPrice = collateralisation[1].usdValue > 0 ? collateralisation[1].usdValue / existingDebtInfo.amount.toNumber() : 1;
|
|
32367
|
-
logger.debug(
|
|
32368
|
-
|
|
32475
|
+
logger.debug(
|
|
32476
|
+
`${this.getTag()}::getVesuMultiplyCall collateralPrice: ${collateralPrice}, debtPrice: ${debtPrice}`
|
|
32477
|
+
);
|
|
32478
|
+
logger.debug(
|
|
32479
|
+
`${this.getTag()}::getVesuMultiplyCall healthFactor: ${healthFactor}`
|
|
32480
|
+
);
|
|
32369
32481
|
const isHFTooLow = healthFactor < this.metadata.additionalInfo.minHealthFactor;
|
|
32370
32482
|
const isHFTooHigh = healthFactor > this.metadata.additionalInfo.targetHealthFactor + 0.05;
|
|
32371
32483
|
if (isHFTooLow || isHFTooHigh || 1) {
|
|
@@ -32373,7 +32485,7 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
32373
32485
|
isDeposit: true,
|
|
32374
32486
|
leg1DepositAmount: unusedBalance.amount,
|
|
32375
32487
|
minHF: 1.02,
|
|
32376
|
-
// 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.
|
|
32377
32489
|
vesuAdapter
|
|
32378
32490
|
});
|
|
32379
32491
|
return { shouldRebalance: true, manageCall };
|
|
@@ -32381,14 +32493,48 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
32381
32493
|
return { shouldRebalance: false, manageCall: void 0 };
|
|
32382
32494
|
}
|
|
32383
32495
|
}
|
|
32384
|
-
async getVesuAUM(adapter) {
|
|
32496
|
+
async getVesuAUM(adapter, priceType = "AVNU_PRICE" /* AVNU_PRICE */) {
|
|
32385
32497
|
const legAUM = await adapter.getPositions(this.config);
|
|
32386
32498
|
const underlying = this.asset();
|
|
32387
|
-
assert(
|
|
32499
|
+
assert(
|
|
32500
|
+
underlying.symbol.startsWith("x"),
|
|
32501
|
+
"Underlying is not an LST of Endur"
|
|
32502
|
+
);
|
|
32388
32503
|
let vesuAum = Web3Number.fromWei("0", underlying.decimals);
|
|
32389
|
-
let tokenUnderlyingPrice
|
|
32390
|
-
|
|
32391
|
-
|
|
32504
|
+
let tokenUnderlyingPrice;
|
|
32505
|
+
if (priceType === "ENDUR_PRICE" /* ENDUR_PRICE */) {
|
|
32506
|
+
tokenUnderlyingPrice = await this.getLSTExchangeRate();
|
|
32507
|
+
if (tokenUnderlyingPrice === 0) {
|
|
32508
|
+
throw new Error(
|
|
32509
|
+
`${this.getTag()}::getVesuAUM: tokenUnderlyingPrice (Endur) is 0`
|
|
32510
|
+
);
|
|
32511
|
+
}
|
|
32512
|
+
const avnuRate = await this.getLSTAvnuRate();
|
|
32513
|
+
if (avnuRate === 0) {
|
|
32514
|
+
throw new Error(
|
|
32515
|
+
`${this.getTag()}::getVesuAUM: tokenUnderlyingPrice (Avnu) is 0`
|
|
32516
|
+
);
|
|
32517
|
+
}
|
|
32518
|
+
const diff = Math.abs(tokenUnderlyingPrice - avnuRate) / tokenUnderlyingPrice;
|
|
32519
|
+
if (diff > 0.02) {
|
|
32520
|
+
throw new Error(
|
|
32521
|
+
`${this.getTag()}::getVesuAUM: Endur and Avnu prices differ by more than 2% (Endur: ${tokenUnderlyingPrice}, Avnu: ${avnuRate})`
|
|
32522
|
+
);
|
|
32523
|
+
}
|
|
32524
|
+
logger.verbose(
|
|
32525
|
+
`${this.getTag()} tokenUnderlyingPrice (Endur): ${tokenUnderlyingPrice}, avnuRate: ${avnuRate}, diff: ${diff}`
|
|
32526
|
+
);
|
|
32527
|
+
} else {
|
|
32528
|
+
tokenUnderlyingPrice = await this.getLSTAvnuRate();
|
|
32529
|
+
if (tokenUnderlyingPrice === 0) {
|
|
32530
|
+
throw new Error(
|
|
32531
|
+
`${this.getTag()}::getVesuAUM: tokenUnderlyingPrice (Avnu) is 0`
|
|
32532
|
+
);
|
|
32533
|
+
}
|
|
32534
|
+
logger.verbose(
|
|
32535
|
+
`${this.getTag()} tokenUnderlyingPrice (Avnu): ${tokenUnderlyingPrice}`
|
|
32536
|
+
);
|
|
32537
|
+
}
|
|
32392
32538
|
if (legAUM[0].token.address.eq(underlying.address)) {
|
|
32393
32539
|
vesuAum = vesuAum.plus(legAUM[0].amount);
|
|
32394
32540
|
} else {
|
|
@@ -32399,10 +32545,28 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
32399
32545
|
} else {
|
|
32400
32546
|
vesuAum = vesuAum.minus(legAUM[1].amount.dividedBy(tokenUnderlyingPrice));
|
|
32401
32547
|
}
|
|
32402
|
-
;
|
|
32403
|
-
logger.verbose(
|
|
32548
|
+
const priceTypeLabel = priceType === "ENDUR_PRICE" /* ENDUR_PRICE */ ? "Endur Price" : "Avnu Price";
|
|
32549
|
+
logger.verbose(
|
|
32550
|
+
`${this.getTag()} Vesu AUM (${priceTypeLabel}): ${vesuAum}, legCollateral: ${legAUM[0].amount.toNumber()}, legDebt: ${legAUM[1].amount.toNumber()}`
|
|
32551
|
+
);
|
|
32404
32552
|
return vesuAum;
|
|
32405
32553
|
}
|
|
32554
|
+
async getTVLUnrealized() {
|
|
32555
|
+
return await this.getAUM(true);
|
|
32556
|
+
}
|
|
32557
|
+
async getUserUnrealizedGains(user) {
|
|
32558
|
+
const tvl = await this.getTVL();
|
|
32559
|
+
const unrealizedTVL = await this.getTVLUnrealized();
|
|
32560
|
+
const unrealizedDiff = unrealizedTVL.net.amount.minus(tvl.amount);
|
|
32561
|
+
const userTVL = await this.getUserTVL(user);
|
|
32562
|
+
const userShare = userTVL.amount.dividedBy(tvl.amount);
|
|
32563
|
+
const unrealizedGains = unrealizedDiff.multipliedBy(userShare);
|
|
32564
|
+
return {
|
|
32565
|
+
unrealizedGains,
|
|
32566
|
+
userShare: userShare.toNumber(),
|
|
32567
|
+
tokenInfo: this.asset()
|
|
32568
|
+
};
|
|
32569
|
+
}
|
|
32406
32570
|
//
|
|
32407
32571
|
async _getMinOutputAmountLSTBuy(amountInUnderlying) {
|
|
32408
32572
|
const lstTruePrice = await this.getLSTExchangeRate();
|
|
@@ -32415,11 +32579,11 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
32415
32579
|
return minOutputAmount;
|
|
32416
32580
|
}
|
|
32417
32581
|
// todo add a function to findout max borrowable amount without fucking yield
|
|
32418
|
-
// 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.
|
|
32419
32583
|
/**
|
|
32420
32584
|
* Uses vesu's multiple call to create leverage on LST
|
|
32421
32585
|
* Deposit amount is in LST
|
|
32422
|
-
* @param params
|
|
32586
|
+
* @param params
|
|
32423
32587
|
*/
|
|
32424
32588
|
async getVesuMultiplyCall(params) {
|
|
32425
32589
|
const maxEkuboPriceImpact = params.maxEkuboPriceImpact || 0.01;
|
|
@@ -32428,32 +32592,54 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
32428
32592
|
logger.verbose(`${this.getTag()}::getVesuMultiplyCall legLTV: ${legLTV}`);
|
|
32429
32593
|
if (!params.isDeposit) {
|
|
32430
32594
|
const unusedBalance = await this.getUnusedBalance();
|
|
32431
|
-
logger.verbose(
|
|
32595
|
+
logger.verbose(
|
|
32596
|
+
`${this.getTag()}::getVesuMultiplyCall unusedBalance: ${unusedBalance.amount.toString()}, required: ${params.leg1DepositAmount.toString()}`
|
|
32597
|
+
);
|
|
32432
32598
|
}
|
|
32433
32599
|
const existingPositions = await vesuAdapter1.getPositions(this.config);
|
|
32434
|
-
const collateralisation = await vesuAdapter1.getCollateralization(
|
|
32600
|
+
const collateralisation = await vesuAdapter1.getCollateralization(
|
|
32601
|
+
this.config
|
|
32602
|
+
);
|
|
32435
32603
|
const existingCollateralInfo = existingPositions[0];
|
|
32436
32604
|
const existingDebtInfo = existingPositions[1];
|
|
32437
32605
|
logger.debug(`${this.getTag()}::getVesuMultiplyCall existingCollateralInfo: ${JSON.stringify(existingCollateralInfo)},
|
|
32438
32606
|
existingDebtInfo: ${JSON.stringify(existingDebtInfo)}, collateralisation: ${JSON.stringify(collateralisation)}`);
|
|
32439
32607
|
const collateralPrice = collateralisation[0].usdValue > 0 ? collateralisation[0].usdValue / existingCollateralInfo.amount.toNumber() : 1;
|
|
32440
32608
|
const debtPrice = collateralisation[1].usdValue > 0 ? collateralisation[1].usdValue / existingDebtInfo.amount.toNumber() : 1;
|
|
32441
|
-
logger.debug(
|
|
32609
|
+
logger.debug(
|
|
32610
|
+
`${this.getTag()}::getVesuMultiplyCall collateralPrice: ${collateralPrice}, debtPrice: ${debtPrice}`
|
|
32611
|
+
);
|
|
32442
32612
|
const dexPrice = await this.getLSTDexPrice();
|
|
32443
|
-
const addedCollateral = params.leg1DepositAmount.multipliedBy(
|
|
32444
|
-
|
|
32613
|
+
const addedCollateral = params.leg1DepositAmount.multipliedBy(
|
|
32614
|
+
params.isDeposit ? 1 : -1
|
|
32615
|
+
);
|
|
32616
|
+
logger.verbose(
|
|
32617
|
+
`${this.getTag()}::getVesuMultiplyCall addedCollateral: ${addedCollateral}`
|
|
32618
|
+
);
|
|
32445
32619
|
const numeratorPart1 = existingCollateralInfo.amount.plus(addedCollateral).multipliedBy(collateralPrice).multipliedBy(legLTV);
|
|
32446
|
-
logger.verbose(
|
|
32620
|
+
logger.verbose(
|
|
32621
|
+
`${this.getTag()}::getVesuMultiplyCall numeratorPart1: ${numeratorPart1}`
|
|
32622
|
+
);
|
|
32447
32623
|
const numeratorPart2 = existingDebtInfo.amount.multipliedBy(debtPrice).multipliedBy(this.metadata.additionalInfo.targetHealthFactor);
|
|
32448
|
-
logger.verbose(
|
|
32624
|
+
logger.verbose(
|
|
32625
|
+
`${this.getTag()}::getVesuMultiplyCall numeratorPart2: ${numeratorPart2}`
|
|
32626
|
+
);
|
|
32449
32627
|
const denominatorPart = this.metadata.additionalInfo.targetHealthFactor - legLTV / dexPrice;
|
|
32450
|
-
logger.verbose(
|
|
32628
|
+
logger.verbose(
|
|
32629
|
+
`${this.getTag()}::getVesuMultiplyCall denominatorPart: ${denominatorPart}`
|
|
32630
|
+
);
|
|
32451
32631
|
const x_debt_usd = numeratorPart1.minus(numeratorPart2).dividedBy(denominatorPart);
|
|
32452
|
-
logger.verbose(
|
|
32453
|
-
|
|
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
|
+
);
|
|
32454
32638
|
let debtAmount = x_debt_usd.dividedBy(debtPrice);
|
|
32455
32639
|
const marginAmount = addedCollateral;
|
|
32456
|
-
logger.verbose(
|
|
32640
|
+
logger.verbose(
|
|
32641
|
+
`${this.getTag()}::getVesuMultiplyCall debtAmount: ${debtAmount}, marginAmount: ${marginAmount}`
|
|
32642
|
+
);
|
|
32457
32643
|
if (marginAmount.lt(0) && debtAmount.gt(0)) {
|
|
32458
32644
|
debtAmount = Web3Number.fromWei(0, this.asset().decimals);
|
|
32459
32645
|
}
|
|
@@ -32467,31 +32653,49 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
32467
32653
|
});
|
|
32468
32654
|
}
|
|
32469
32655
|
getLSTUnderlyingTokenInfo() {
|
|
32470
|
-
const vesuAdapter1 = this.getVesuSameTokenAdapter(
|
|
32656
|
+
const vesuAdapter1 = this.getVesuSameTokenAdapter(
|
|
32657
|
+
this.metadata.additionalInfo.defaultPoolId
|
|
32658
|
+
);
|
|
32471
32659
|
return vesuAdapter1.config.debt;
|
|
32472
32660
|
}
|
|
32473
32661
|
async getMaxBorrowableAmount(params = { isAPYComputation: false }) {
|
|
32474
32662
|
const vesuAdapters = this.getVesuAdapters();
|
|
32475
|
-
let netMaxBorrowableAmount = Web3Number.fromWei(
|
|
32663
|
+
let netMaxBorrowableAmount = Web3Number.fromWei(
|
|
32664
|
+
"0",
|
|
32665
|
+
this.getLSTUnderlyingTokenInfo().decimals
|
|
32666
|
+
);
|
|
32476
32667
|
const maxBorrowables = [];
|
|
32477
32668
|
for (const vesuAdapter of vesuAdapters) {
|
|
32478
|
-
const output = await this.getMaxBorrowableAmountByVesuAdapter(
|
|
32669
|
+
const output = await this.getMaxBorrowableAmountByVesuAdapter(
|
|
32670
|
+
vesuAdapter,
|
|
32671
|
+
params.isAPYComputation
|
|
32672
|
+
);
|
|
32479
32673
|
const ltv = await vesuAdapter.getLTVConfig(this.config);
|
|
32480
32674
|
maxBorrowables.push({ ...output, ltv });
|
|
32481
32675
|
}
|
|
32482
32676
|
maxBorrowables.sort((a, b) => b.amount.toNumber() - a.amount.toNumber());
|
|
32483
|
-
netMaxBorrowableAmount = maxBorrowables.reduce(
|
|
32677
|
+
netMaxBorrowableAmount = maxBorrowables.reduce(
|
|
32678
|
+
(acc, curr) => acc.plus(curr.amount),
|
|
32679
|
+
Web3Number.fromWei("0", this.getLSTUnderlyingTokenInfo().decimals)
|
|
32680
|
+
);
|
|
32484
32681
|
return { netMaxBorrowableAmount, maxBorrowables };
|
|
32485
32682
|
}
|
|
32486
|
-
// recursively, using binary search computes max swappable.
|
|
32683
|
+
// recursively, using binary search computes max swappable.
|
|
32487
32684
|
// @dev assumes 1 token of from == 1 token of to
|
|
32488
32685
|
async getMaxSwappableWithMaxSlippage(fromToken, toToken, maxSlippage, maxAmount) {
|
|
32489
32686
|
const output = await findMaxInputWithSlippage({
|
|
32490
32687
|
apiGetOutput: async (inputAmount) => {
|
|
32491
32688
|
const ekuboQuoter = new EkuboQuoter(this.config);
|
|
32492
32689
|
await new Promise((resolve) => setTimeout(resolve, 1e3));
|
|
32493
|
-
const quote = await ekuboQuoter.getQuote(
|
|
32494
|
-
|
|
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();
|
|
32495
32699
|
},
|
|
32496
32700
|
maxInput: maxAmount.toNumber(),
|
|
32497
32701
|
maxSlippagePercent: maxSlippage,
|
|
@@ -32501,38 +32705,84 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
32501
32705
|
return new Web3Number(output.optimalInput, fromToken.decimals);
|
|
32502
32706
|
}
|
|
32503
32707
|
async getMaxBorrowableAmountByVesuAdapter(vesuAdapter, isAPYComputation) {
|
|
32504
|
-
const lstAPY = await this.getLSTAPR(
|
|
32708
|
+
const lstAPY = await this.getLSTAPR(
|
|
32709
|
+
this.getLSTUnderlyingTokenInfo().address
|
|
32710
|
+
);
|
|
32505
32711
|
const maxInterestRate = lstAPY * 0.8;
|
|
32506
|
-
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
|
+
);
|
|
32507
32717
|
const debtCap = await vesuAdapter.getDebtCap(this.config);
|
|
32508
32718
|
if (currentDebt.gte(debtCap)) {
|
|
32509
|
-
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
|
+
};
|
|
32510
32731
|
}
|
|
32511
32732
|
const availableToBorrow = debtCap.minus(currentDebt);
|
|
32512
32733
|
const maxBorrowable = maxBorrowableAmount.minimum(availableToBorrow).multipliedBy(0.999);
|
|
32513
|
-
if (vesuAdapter.config.debt.address.eq(
|
|
32514
|
-
|
|
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
|
+
};
|
|
32515
32743
|
}
|
|
32516
32744
|
try {
|
|
32517
|
-
const maxSwappable = await this.getMaxSwappableWithMaxSlippage(
|
|
32518
|
-
|
|
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
|
+
};
|
|
32519
32757
|
} catch (error) {
|
|
32520
32758
|
logger.warn(`${this.getTag()}: Failed to get max swappable: ${error}`);
|
|
32521
|
-
const maxSwappable = Web3Number.fromWei(
|
|
32522
|
-
|
|
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
|
+
};
|
|
32523
32769
|
}
|
|
32524
32770
|
}
|
|
32525
32771
|
// todo how much to unwind to get back healthy APY zone again
|
|
32526
32772
|
// if net APY < LST APR + 0.5%, we need to unwind to get back to LST APR + 1% atleast or 0 vesu position
|
|
32527
|
-
// For xSTRK, simply deposit in Vesu if looping is not viable
|
|
32773
|
+
// For xSTRK, simply deposit in Vesu if looping is not viable
|
|
32528
32774
|
/**
|
|
32529
32775
|
* Gets LST APR for the strategy's underlying asset from Endur API
|
|
32530
32776
|
* @returns Promise<number> The LST APR (not divided by 1e18)
|
|
32531
32777
|
*/
|
|
32532
32778
|
async getLSTAPR(_address) {
|
|
32533
32779
|
try {
|
|
32534
|
-
const vesuAdapter1 = this.getVesuSameTokenAdapter(
|
|
32535
|
-
|
|
32780
|
+
const vesuAdapter1 = this.getVesuSameTokenAdapter(
|
|
32781
|
+
this.metadata.additionalInfo.defaultPoolId
|
|
32782
|
+
);
|
|
32783
|
+
const apr = await LSTAPRService.getLSTAPR(
|
|
32784
|
+
vesuAdapter1.config.debt.address
|
|
32785
|
+
);
|
|
32536
32786
|
if (!apr) {
|
|
32537
32787
|
throw new Error("Failed to get LST APR");
|
|
32538
32788
|
}
|
|
@@ -32545,19 +32795,37 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
32545
32795
|
// todo undo this
|
|
32546
32796
|
async netAPY() {
|
|
32547
32797
|
const unusedBalance = await this.getUnusedBalance();
|
|
32548
|
-
const maxNewDeposits = await this.maxNewDeposits({
|
|
32549
|
-
|
|
32798
|
+
const maxNewDeposits = await this.maxNewDeposits({
|
|
32799
|
+
isAPYComputation: true
|
|
32800
|
+
});
|
|
32801
|
+
const lstAPY = await this.getLSTAPR(
|
|
32802
|
+
this.getLSTUnderlyingTokenInfo().address
|
|
32803
|
+
);
|
|
32550
32804
|
if (maxNewDeposits * 1.5 < unusedBalance.amount.toNumber()) {
|
|
32551
|
-
logger.verbose(
|
|
32805
|
+
logger.verbose(
|
|
32806
|
+
`${this.getTag()}::netAPY: unused balance is > max servicable from loan, lstAPY: ${lstAPY}`
|
|
32807
|
+
);
|
|
32552
32808
|
const output = await super.netAPY();
|
|
32553
32809
|
output.splits.push({ apy: lstAPY, id: "lst_apy" });
|
|
32554
32810
|
return output;
|
|
32555
32811
|
} else {
|
|
32556
|
-
logger.verbose(
|
|
32812
|
+
logger.verbose(
|
|
32813
|
+
`${this.getTag()}::netAPY: we can take more deposits, use theoretical max APY`
|
|
32814
|
+
);
|
|
32557
32815
|
const { positions, baseAPYs, rewardAPYs } = await this.getVesuAPYs();
|
|
32558
|
-
const weights = positions.map(
|
|
32816
|
+
const weights = positions.map(
|
|
32817
|
+
(p, index) => p.usdValue * (index % 2 == 0 ? 1 : -1)
|
|
32818
|
+
);
|
|
32559
32819
|
const aum = weights.reduce((acc, curr) => acc + curr, 0);
|
|
32560
|
-
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
|
+
);
|
|
32561
32829
|
output.splits.push({ apy: lstAPY, id: "lst_apy" });
|
|
32562
32830
|
return output;
|
|
32563
32831
|
}
|
|
@@ -32567,9 +32835,13 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
32567
32835
|
let numerator = 0;
|
|
32568
32836
|
let ltv = void 0;
|
|
32569
32837
|
for (let adapter of this.getVesuAdapters()) {
|
|
32570
|
-
const maxBorrowableAmountInfo = maxBorrowableAmounts.maxBorrowables.find(
|
|
32838
|
+
const maxBorrowableAmountInfo = maxBorrowableAmounts.maxBorrowables.find(
|
|
32839
|
+
(b) => b.borrowableAsset.address.eq(adapter.config.debt.address)
|
|
32840
|
+
);
|
|
32571
32841
|
if (!maxBorrowableAmountInfo || !maxBorrowableAmountInfo?.amount) {
|
|
32572
|
-
throw new Error(
|
|
32842
|
+
throw new Error(
|
|
32843
|
+
`Max borrowable amount not found for adapter: ${adapter.config.debt.symbol}`
|
|
32844
|
+
);
|
|
32573
32845
|
}
|
|
32574
32846
|
numerator += this.metadata.additionalInfo.targetHealthFactor * maxBorrowableAmountInfo.amount.toNumber() / maxBorrowableAmountInfo.ltv;
|
|
32575
32847
|
}
|
|
@@ -32578,7 +32850,9 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
32578
32850
|
// todo revisit cases where 0th adapters is used
|
|
32579
32851
|
async getUnusedBalanceAPY() {
|
|
32580
32852
|
const unusedBalance = await this.getUnusedBalance();
|
|
32581
|
-
const vesuAdapter = this.getVesuSameTokenAdapter(
|
|
32853
|
+
const vesuAdapter = this.getVesuSameTokenAdapter(
|
|
32854
|
+
this.metadata.additionalInfo.defaultPoolId
|
|
32855
|
+
);
|
|
32582
32856
|
const underlying = vesuAdapter.config.debt;
|
|
32583
32857
|
const lstAPY = await this.getLSTAPR(underlying.address);
|
|
32584
32858
|
return {
|
|
@@ -32586,37 +32860,80 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
32586
32860
|
weight: unusedBalance.usdValue
|
|
32587
32861
|
};
|
|
32588
32862
|
}
|
|
32863
|
+
async getLSTAvnuRate() {
|
|
32864
|
+
const vesuAdapter1 = this.getVesuSameTokenAdapter(
|
|
32865
|
+
this.metadata.additionalInfo.defaultPoolId
|
|
32866
|
+
);
|
|
32867
|
+
const lstTokenInfo = vesuAdapter1.config.collateral;
|
|
32868
|
+
const underlyingTokenInfo = vesuAdapter1.config.debt;
|
|
32869
|
+
const avnuModule = new AvnuWrapper();
|
|
32870
|
+
const sellAmount = lstTokenInfo.priceCheckAmount ? new Web3Number(
|
|
32871
|
+
lstTokenInfo.priceCheckAmount,
|
|
32872
|
+
underlyingTokenInfo.decimals
|
|
32873
|
+
) : new Web3Number(1, underlyingTokenInfo.decimals);
|
|
32874
|
+
const quote = await avnuModule.getQuotes(
|
|
32875
|
+
underlyingTokenInfo.address.address,
|
|
32876
|
+
lstTokenInfo.address.address,
|
|
32877
|
+
sellAmount.toWei(),
|
|
32878
|
+
this.metadata.additionalInfo.vaultAllocator.address
|
|
32879
|
+
);
|
|
32880
|
+
const underlyingAmountNumber = sellAmount.toNumber();
|
|
32881
|
+
const lstAmountNumber = Web3Number.fromWei(
|
|
32882
|
+
quote.buyAmount.toString(),
|
|
32883
|
+
lstTokenInfo.decimals
|
|
32884
|
+
).toNumber();
|
|
32885
|
+
assert(lstAmountNumber > 0, "Avnu LST amount is zero");
|
|
32886
|
+
const exchangeRate = underlyingAmountNumber / lstAmountNumber;
|
|
32887
|
+
logger.verbose(
|
|
32888
|
+
`${this.getTag()}:: LST Avnu Exchange Rate: ${exchangeRate}`
|
|
32889
|
+
);
|
|
32890
|
+
return exchangeRate;
|
|
32891
|
+
}
|
|
32589
32892
|
async getLSTExchangeRate() {
|
|
32590
|
-
const vesuAdapter1 = this.getVesuSameTokenAdapter(
|
|
32893
|
+
const vesuAdapter1 = this.getVesuSameTokenAdapter(
|
|
32894
|
+
this.metadata.additionalInfo.defaultPoolId
|
|
32895
|
+
);
|
|
32591
32896
|
const lstTokenInfo = vesuAdapter1.config.collateral;
|
|
32592
32897
|
const lstABI = new Contract11({
|
|
32593
32898
|
abi: erc4626_abi_default,
|
|
32594
32899
|
address: lstTokenInfo.address.address,
|
|
32595
32900
|
providerOrAccount: this.config.provider
|
|
32596
32901
|
});
|
|
32597
|
-
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
|
+
]);
|
|
32598
32905
|
const exchangeRate = Number(uint25610.uint256ToBN(price).toString()) / Math.pow(10, lstTokenInfo.decimals);
|
|
32599
32906
|
logger.verbose(`${this.getTag()}:: LST Exchange Rate: ${exchangeRate}`);
|
|
32600
32907
|
return exchangeRate;
|
|
32601
32908
|
}
|
|
32602
32909
|
/**
|
|
32603
|
-
*
|
|
32910
|
+
*
|
|
32604
32911
|
* @param params marginAmount is in LST, debtAmount is in underlying
|
|
32605
32912
|
*/
|
|
32606
32913
|
async getModifyLeverCall(params) {
|
|
32607
|
-
logger.verbose(
|
|
32608
|
-
|
|
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
|
+
);
|
|
32609
32921
|
const vesuAdapter1 = this.getVesuSameTokenAdapter(params.poolId);
|
|
32610
32922
|
const lstTokenInfo = this.asset();
|
|
32611
32923
|
const lstUnderlyingTokenInfo = vesuAdapter1.config.debt;
|
|
32612
32924
|
const maxAmounts = lstTokenInfo.symbol == "xSTRK" ? 5e5 : 0.5;
|
|
32613
32925
|
if (params.marginAmount.greaterThan(maxAmounts)) {
|
|
32614
|
-
throw new Error(
|
|
32926
|
+
throw new Error(
|
|
32927
|
+
`Margin amount is greater than max amount: ${params.marginAmount.toNumber()} > ${maxAmounts}`
|
|
32928
|
+
);
|
|
32615
32929
|
}
|
|
32616
32930
|
const proofsIDs = [];
|
|
32617
32931
|
const manageCalls = [];
|
|
32618
32932
|
if (params.marginAmount.greaterThan(0)) {
|
|
32619
|
-
const STEP1_ID = getVesuGenericLegId(
|
|
32933
|
+
const STEP1_ID = getVesuGenericLegId(
|
|
32934
|
+
params.poolId.toString(),
|
|
32935
|
+
"multiple_approve" /* MULTIPLE_APPROVE */
|
|
32936
|
+
);
|
|
32620
32937
|
const manage1Info = this.getProofs(STEP1_ID);
|
|
32621
32938
|
const depositAmount = params.marginAmount;
|
|
32622
32939
|
const manageCall1 = manage1Info.callConstructor({
|
|
@@ -32637,31 +32954,56 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
32637
32954
|
params.debtAmount
|
|
32638
32955
|
// negative for exact amount out
|
|
32639
32956
|
);
|
|
32640
|
-
logger.verbose(
|
|
32641
|
-
|
|
32642
|
-
|
|
32643
|
-
|
|
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
|
+
);
|
|
32644
32972
|
let minLSTReceived = params.debtAmount.dividedBy(lstDexPriceInUnderlying).multipliedBy(1 - MAX_SLIPPAGE);
|
|
32645
32973
|
const minLSTReceivedAsPerTruePrice = params.debtAmount.dividedBy(lstTrueExchangeRate);
|
|
32646
32974
|
minLSTReceived = minLSTReceivedAsPerTruePrice;
|
|
32647
|
-
logger.verbose(
|
|
32975
|
+
logger.verbose(
|
|
32976
|
+
`${this.getTag()}::getModifyLeverCall minLSTReceivedAsPerTruePrice: ${minLSTReceivedAsPerTruePrice}, minLSTReceived: ${minLSTReceived}`
|
|
32977
|
+
);
|
|
32648
32978
|
let maxUsedCollateral = params.debtAmount.abs().dividedBy(lstDexPriceInUnderlying).multipliedBy(1 + MAX_SLIPPAGE);
|
|
32649
32979
|
const maxUsedCollateralInLST = params.debtAmount.abs().dividedBy(lstTrueExchangeRate).multipliedBy(1.005);
|
|
32650
|
-
logger.verbose(
|
|
32980
|
+
logger.verbose(
|
|
32981
|
+
`${this.getTag()}::getModifyLeverCall maxUsedCollateralInLST: ${maxUsedCollateralInLST}, maxUsedCollateral: ${maxUsedCollateral}`
|
|
32982
|
+
);
|
|
32651
32983
|
maxUsedCollateral = maxUsedCollateralInLST;
|
|
32652
|
-
const STEP2_ID = getVesuGenericLegId(
|
|
32984
|
+
const STEP2_ID = getVesuGenericLegId(
|
|
32985
|
+
params.poolId.toString(),
|
|
32986
|
+
"switch_delegation_on" /* SWITCH_DELEGATION_ON */
|
|
32987
|
+
);
|
|
32653
32988
|
const manage2Info = this.getProofs(STEP2_ID);
|
|
32654
32989
|
const manageCall2 = manage2Info.callConstructor({
|
|
32655
32990
|
delegation: true
|
|
32656
32991
|
});
|
|
32657
|
-
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
|
+
);
|
|
32658
32997
|
const manage3Info = this.getProofs(STEP3_ID);
|
|
32659
32998
|
const multiplyParams = params.isIncrease ? {
|
|
32660
32999
|
isIncrease: true,
|
|
32661
33000
|
increaseParams: {
|
|
32662
33001
|
add_margin: params.marginAmount,
|
|
32663
33002
|
margin_swap: [],
|
|
32664
|
-
margin_swap_limit_amount: Web3Number.fromWei(
|
|
33003
|
+
margin_swap_limit_amount: Web3Number.fromWei(
|
|
33004
|
+
0,
|
|
33005
|
+
this.asset().decimals
|
|
33006
|
+
),
|
|
32665
33007
|
lever_swap: leverSwap,
|
|
32666
33008
|
lever_swap_limit_amount: minLSTReceived
|
|
32667
33009
|
}
|
|
@@ -32673,15 +33015,21 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
32673
33015
|
lever_swap_limit_amount: maxUsedCollateral,
|
|
32674
33016
|
// only required for close position
|
|
32675
33017
|
lever_swap_weights: [],
|
|
32676
|
-
// 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.
|
|
32677
33019
|
withdraw_swap: [],
|
|
32678
|
-
withdraw_swap_limit_amount: Web3Number.fromWei(
|
|
33020
|
+
withdraw_swap_limit_amount: Web3Number.fromWei(
|
|
33021
|
+
0,
|
|
33022
|
+
this.asset().decimals
|
|
33023
|
+
),
|
|
32679
33024
|
withdraw_swap_weights: [],
|
|
32680
33025
|
close_position: false
|
|
32681
33026
|
}
|
|
32682
33027
|
};
|
|
32683
33028
|
const manageCall3 = manage3Info.callConstructor(multiplyParams);
|
|
32684
|
-
const STEP4_ID = getVesuGenericLegId(
|
|
33029
|
+
const STEP4_ID = getVesuGenericLegId(
|
|
33030
|
+
params.poolId.toString(),
|
|
33031
|
+
"switch_delegation_off" /* SWITCH_DELEGATION_OFF */
|
|
33032
|
+
);
|
|
32685
33033
|
const manage4Info = this.getProofs(STEP4_ID);
|
|
32686
33034
|
const manageCall4 = manage4Info.callConstructor({
|
|
32687
33035
|
delegation: false
|
|
@@ -32695,7 +33043,6 @@ function VaultDescription(lstSymbol, underlyingSymbol) {
|
|
|
32695
33043
|
const containerStyle = {
|
|
32696
33044
|
maxWidth: "800px",
|
|
32697
33045
|
margin: "0 auto",
|
|
32698
|
-
backgroundColor: "#111",
|
|
32699
33046
|
color: "#eee",
|
|
32700
33047
|
fontFamily: "Arial, sans-serif",
|
|
32701
33048
|
borderRadius: "12px"
|
|
@@ -32718,21 +33065,52 @@ function VaultDescription(lstSymbol, underlyingSymbol) {
|
|
|
32718
33065
|
" to create leverage. Depositors receive vault shares that represent a proportional claim on the underlying assets and accrued yield."
|
|
32719
33066
|
] }),
|
|
32720
33067
|
/* @__PURE__ */ jsxs4("p", { style: { fontSize: "14px", lineHeight: "1.5", marginBottom: "16px" }, children: [
|
|
32721
|
-
"This vault uses Vesu for lending and borrowing. The oracle used by this pool is a
|
|
32722
|
-
|
|
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
|
+
]),
|
|
32723
33076
|
" ",
|
|
32724
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."
|
|
32725
33078
|
] }),
|
|
32726
|
-
/* @__PURE__ */ jsx5(
|
|
32727
|
-
|
|
32728
|
-
|
|
32729
|
-
|
|
32730
|
-
|
|
32731
|
-
|
|
32732
|
-
|
|
32733
|
-
|
|
32734
|
-
|
|
32735
|
-
|
|
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
|
+
)
|
|
32736
33114
|
] });
|
|
32737
33115
|
}
|
|
32738
33116
|
function getDescription2(tokenSymbol, underlyingSymbol) {
|
|
@@ -32748,31 +33126,76 @@ function getVesuLegId(baseID, debtTokenSymbol, poolId) {
|
|
|
32748
33126
|
return `${baseID}_${debtTokenSymbol.toLowerCase()}_${poolId.slice(-4).toLowerCase()}`;
|
|
32749
33127
|
}
|
|
32750
33128
|
function addVesuLeaves(poolId, lstSymbol, underlyingSymbol, vaultSettings, commonAdapter) {
|
|
32751
|
-
const lstToken = Global.getDefaultTokens().find(
|
|
32752
|
-
|
|
33129
|
+
const lstToken = Global.getDefaultTokens().find(
|
|
33130
|
+
(token) => token.symbol === lstSymbol
|
|
33131
|
+
);
|
|
33132
|
+
const underlyingToken = Global.getDefaultTokens().find(
|
|
33133
|
+
(token) => token.symbol === underlyingSymbol
|
|
33134
|
+
);
|
|
32753
33135
|
const vesuAdapterLST = new VesuAdapter({
|
|
32754
33136
|
poolId,
|
|
32755
33137
|
collateral: lstToken,
|
|
32756
33138
|
debt: underlyingToken,
|
|
32757
33139
|
vaultAllocator: vaultSettings.vaultAllocator,
|
|
32758
|
-
id: getVesuLegId(
|
|
33140
|
+
id: getVesuLegId(
|
|
33141
|
+
"vesu_leg1" /* VESU_LEG1 */,
|
|
33142
|
+
underlyingToken.symbol,
|
|
33143
|
+
poolId.toString()
|
|
33144
|
+
)
|
|
32759
33145
|
});
|
|
32760
|
-
vaultSettings.adapters.push(
|
|
32761
|
-
|
|
32762
|
-
|
|
32763
|
-
|
|
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
|
+
);
|
|
32764
33158
|
const { isV2, addr: poolAddr } = getVesuSingletonAddress(poolId);
|
|
32765
33159
|
const VESU_MULTIPLY = isV2 ? vesuAdapterLST.VESU_MULTIPLY : vesuAdapterLST.VESU_MULTIPLY_V1;
|
|
32766
|
-
const leafIdApprove = getVesuGenericLegId(
|
|
32767
|
-
|
|
32768
|
-
|
|
32769
|
-
|
|
32770
|
-
|
|
32771
|
-
|
|
32772
|
-
|
|
32773
|
-
|
|
32774
|
-
|
|
32775
|
-
|
|
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
|
+
);
|
|
32776
33199
|
return vesuAdapterLST;
|
|
32777
33200
|
}
|
|
32778
33201
|
function getLooperSettings2(lstSymbol, underlyingSymbol, vaultSettings, defaultPoolId) {
|
|
@@ -32781,8 +33204,12 @@ function getLooperSettings2(lstSymbol, underlyingSymbol, vaultSettings, defaultP
|
|
|
32781
33204
|
if (!pool1.eq(defaultPoolId)) {
|
|
32782
33205
|
throw new Error(`Dont include default pool id in supported pool ids`);
|
|
32783
33206
|
}
|
|
32784
|
-
const lstToken = Global.getDefaultTokens().find(
|
|
32785
|
-
|
|
33207
|
+
const lstToken = Global.getDefaultTokens().find(
|
|
33208
|
+
(token) => token.symbol === lstSymbol
|
|
33209
|
+
);
|
|
33210
|
+
const underlyingToken = Global.getDefaultTokens().find(
|
|
33211
|
+
(token) => token.symbol === underlyingSymbol
|
|
33212
|
+
);
|
|
32786
33213
|
const commonAdapter = new CommonAdapter({
|
|
32787
33214
|
manager: vaultSettings.manager,
|
|
32788
33215
|
asset: lstToken.address,
|
|
@@ -32790,28 +33217,106 @@ function getLooperSettings2(lstSymbol, underlyingSymbol, vaultSettings, defaultP
|
|
|
32790
33217
|
vaultAddress: vaultSettings.vaultAddress,
|
|
32791
33218
|
vaultAllocator: vaultSettings.vaultAllocator
|
|
32792
33219
|
});
|
|
32793
|
-
vaultSettings.adapters.push(
|
|
32794
|
-
|
|
32795
|
-
|
|
32796
|
-
|
|
32797
|
-
|
|
32798
|
-
|
|
32799
|
-
|
|
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
|
+
];
|
|
32800
33251
|
for (let borrowableAssetSymbol of uniqueBorrowableAssets) {
|
|
32801
|
-
const borrowableAsset = Global.getDefaultTokens().find(
|
|
33252
|
+
const borrowableAsset = Global.getDefaultTokens().find(
|
|
33253
|
+
(token) => token.symbol === borrowableAssetSymbol
|
|
33254
|
+
);
|
|
32802
33255
|
const debtAsset = borrowableAsset;
|
|
32803
|
-
const approve_debt_token_id = getAvnuManageIDs(
|
|
32804
|
-
|
|
32805
|
-
|
|
32806
|
-
|
|
32807
|
-
|
|
32808
|
-
|
|
32809
|
-
|
|
32810
|
-
|
|
32811
|
-
|
|
32812
|
-
|
|
32813
|
-
|
|
32814
|
-
|
|
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
|
+
);
|
|
32815
33320
|
return vaultSettings;
|
|
32816
33321
|
}
|
|
32817
33322
|
var AUDIT_URL4 = "https://docs.troves.fi/p/security#starknet-vault-kit";
|
|
@@ -32830,7 +33335,8 @@ function getFAQs2(lstSymbol, underlyingSymbol) {
|
|
|
32830
33335
|
answer: /* @__PURE__ */ jsxs4("span", { children: [
|
|
32831
33336
|
"Currently, the LST is from ",
|
|
32832
33337
|
/* @__PURE__ */ jsx5("strong", { children: "Endur" }),
|
|
32833
|
-
" while
|
|
33338
|
+
" while",
|
|
33339
|
+
" ",
|
|
32834
33340
|
/* @__PURE__ */ jsx5("strong", { children: "Vesu" }),
|
|
32835
33341
|
" is used to collateralize the looped position."
|
|
32836
33342
|
] })
|
|
@@ -32862,23 +33368,48 @@ function getFAQs2(lstSymbol, underlyingSymbol) {
|
|
|
32862
33368
|
];
|
|
32863
33369
|
}
|
|
32864
33370
|
var _riskFactor4 = [
|
|
32865
|
-
{
|
|
32866
|
-
|
|
32867
|
-
|
|
32868
|
-
|
|
32869
|
-
|
|
32870
|
-
|
|
32871
|
-
|
|
32872
|
-
|
|
32873
|
-
|
|
32874
|
-
|
|
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
|
+
}
|
|
32875
33395
|
];
|
|
33396
|
+
var btcBorrowableAssets = ["WBTC", "tBTC", "LBTC", "solvBTC"];
|
|
32876
33397
|
var hyperxSTRK = {
|
|
32877
|
-
vaultAddress: ContractAddr.from(
|
|
32878
|
-
|
|
32879
|
-
|
|
32880
|
-
|
|
32881
|
-
|
|
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
|
+
),
|
|
32882
33413
|
leafAdapters: [],
|
|
32883
33414
|
adapters: [],
|
|
32884
33415
|
targetHealthFactor: 1.1,
|
|
@@ -32889,35 +33420,63 @@ var hyperxSTRK = {
|
|
|
32889
33420
|
...Global.getDefaultTokens().filter((token) => token.symbol === "STRK").map((token) => ({ token, poolId: VesuPools.Re7STRK }))
|
|
32890
33421
|
// v2, new alt for Re7xSTRK
|
|
32891
33422
|
],
|
|
32892
|
-
underlyingToken: Global.getDefaultTokens().find(
|
|
33423
|
+
underlyingToken: Global.getDefaultTokens().find(
|
|
33424
|
+
(token) => token.symbol === "STRK"
|
|
33425
|
+
),
|
|
32893
33426
|
defaultPoolId: VesuPools.Re7xSTRK
|
|
32894
33427
|
};
|
|
32895
33428
|
var hyperxWBTC = {
|
|
32896
|
-
vaultAddress: ContractAddr.from(
|
|
32897
|
-
|
|
32898
|
-
|
|
32899
|
-
|
|
32900
|
-
|
|
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
|
+
),
|
|
32901
33444
|
leafAdapters: [],
|
|
32902
33445
|
adapters: [],
|
|
32903
33446
|
targetHealthFactor: 1.1,
|
|
32904
33447
|
minHealthFactor: 1.05,
|
|
32905
33448
|
borrowable_assets: [
|
|
32906
33449
|
// allow all BTC flavours borrowing on Re7xBTC pool
|
|
32907
|
-
...btcBorrowableAssets.map(
|
|
33450
|
+
...btcBorrowableAssets.map(
|
|
33451
|
+
(asset) => Global.getDefaultTokens().find((token) => token.symbol === asset)
|
|
33452
|
+
).map((token) => ({ token, poolId: VesuPools.Re7xBTC })),
|
|
32908
33453
|
// allow only WBTC borrowing on Prime pool
|
|
32909
33454
|
...Global.getDefaultTokens().filter((token) => token.symbol === "WBTC").map((token) => ({ token, poolId: VesuPools.Prime }))
|
|
32910
33455
|
],
|
|
32911
|
-
underlyingToken: Global.getDefaultTokens().find(
|
|
33456
|
+
underlyingToken: Global.getDefaultTokens().find(
|
|
33457
|
+
(token) => token.symbol === "WBTC"
|
|
33458
|
+
),
|
|
32912
33459
|
defaultPoolId: VesuPools.Re7xBTC,
|
|
32913
|
-
redemptionRouter: ContractAddr.from(
|
|
33460
|
+
redemptionRouter: ContractAddr.from(
|
|
33461
|
+
"0x6ea649f402898f69baf775c1afdd08522c071c640b9c4460192070ec2b96417"
|
|
33462
|
+
)
|
|
32914
33463
|
};
|
|
32915
33464
|
var hyperxtBTC = {
|
|
32916
|
-
vaultAddress: ContractAddr.from(
|
|
32917
|
-
|
|
32918
|
-
|
|
32919
|
-
|
|
32920
|
-
|
|
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
|
+
),
|
|
32921
33480
|
leafAdapters: [],
|
|
32922
33481
|
adapters: [],
|
|
32923
33482
|
targetHealthFactor: 1.1,
|
|
@@ -32925,16 +33484,30 @@ var hyperxtBTC = {
|
|
|
32925
33484
|
borrowable_assets: [
|
|
32926
33485
|
...Global.getDefaultTokens().filter((token) => token.symbol === "tBTC" || token.symbol === "WBTC").map((token) => ({ token, poolId: VesuPools.Re7xBTC }))
|
|
32927
33486
|
],
|
|
32928
|
-
underlyingToken: Global.getDefaultTokens().find(
|
|
33487
|
+
underlyingToken: Global.getDefaultTokens().find(
|
|
33488
|
+
(token) => token.symbol === "tBTC"
|
|
33489
|
+
),
|
|
32929
33490
|
defaultPoolId: VesuPools.Re7xBTC,
|
|
32930
|
-
redemptionRouter: ContractAddr.from(
|
|
33491
|
+
redemptionRouter: ContractAddr.from(
|
|
33492
|
+
"0x3de9c409d1e357e25778fb7a3e2e2393666956846a5c2caa607296fa8e76b5d"
|
|
33493
|
+
)
|
|
32931
33494
|
};
|
|
32932
33495
|
var hyperxsBTC = {
|
|
32933
|
-
vaultAddress: ContractAddr.from(
|
|
32934
|
-
|
|
32935
|
-
|
|
32936
|
-
|
|
32937
|
-
|
|
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
|
+
),
|
|
32938
33511
|
leafAdapters: [],
|
|
32939
33512
|
adapters: [],
|
|
32940
33513
|
targetHealthFactor: 1.1,
|
|
@@ -32942,15 +33515,27 @@ var hyperxsBTC = {
|
|
|
32942
33515
|
borrowable_assets: [
|
|
32943
33516
|
...Global.getDefaultTokens().filter((token) => token.symbol === "solvBTC").map((token) => ({ token, poolId: VesuPools.Re7xBTC }))
|
|
32944
33517
|
],
|
|
32945
|
-
underlyingToken: Global.getDefaultTokens().find(
|
|
33518
|
+
underlyingToken: Global.getDefaultTokens().find(
|
|
33519
|
+
(token) => token.symbol === "solvBTC"
|
|
33520
|
+
),
|
|
32946
33521
|
defaultPoolId: VesuPools.Re7xBTC
|
|
32947
33522
|
};
|
|
32948
33523
|
var hyperxLBTC = {
|
|
32949
|
-
vaultAddress: ContractAddr.from(
|
|
32950
|
-
|
|
32951
|
-
|
|
32952
|
-
|
|
32953
|
-
|
|
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
|
+
),
|
|
32954
33539
|
leafAdapters: [],
|
|
32955
33540
|
adapters: [],
|
|
32956
33541
|
targetHealthFactor: 1.1,
|
|
@@ -32958,7 +33543,9 @@ var hyperxLBTC = {
|
|
|
32958
33543
|
borrowable_assets: [
|
|
32959
33544
|
...Global.getDefaultTokens().filter((token) => token.symbol === "LBTC").map((token) => ({ token, poolId: VesuPools.Re7xBTC }))
|
|
32960
33545
|
],
|
|
32961
|
-
underlyingToken: Global.getDefaultTokens().find(
|
|
33546
|
+
underlyingToken: Global.getDefaultTokens().find(
|
|
33547
|
+
(token) => token.symbol === "LBTC"
|
|
33548
|
+
),
|
|
32962
33549
|
defaultPoolId: VesuPools.Re7xBTC
|
|
32963
33550
|
};
|
|
32964
33551
|
function getInvestmentSteps(lstSymbol, underlyingSymbol) {
|
|
@@ -32976,7 +33563,7 @@ function getMaxTVL(lstSymbol) {
|
|
|
32976
33563
|
xLBTC: 5,
|
|
32977
33564
|
xtBTC: 5,
|
|
32978
33565
|
xsBTC: 5,
|
|
32979
|
-
xSTRK:
|
|
33566
|
+
xSTRK: 7e6
|
|
32980
33567
|
};
|
|
32981
33568
|
const maxTVLValue = lstMaxTVLs[lstSymbol] || 0;
|
|
32982
33569
|
const token = Global.getDefaultTokens().find(
|
|
@@ -33045,15 +33632,19 @@ var HYPER_LST_SECURITY = {
|
|
|
33045
33632
|
};
|
|
33046
33633
|
var HYPER_LST_REDEMPTION_INFO = {
|
|
33047
33634
|
instantWithdrawalVault: "No" /* NO */,
|
|
33048
|
-
redemptionsInfo: [
|
|
33049
|
-
|
|
33050
|
-
|
|
33051
|
-
|
|
33052
|
-
|
|
33053
|
-
|
|
33054
|
-
|
|
33055
|
-
|
|
33056
|
-
|
|
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
|
+
]
|
|
33057
33648
|
};
|
|
33058
33649
|
function getStrategySettings(lstSymbol, underlyingSymbol, settings, isPreview = false) {
|
|
33059
33650
|
return {
|
|
@@ -33068,9 +33659,7 @@ function getStrategySettings(lstSymbol, underlyingSymbol, settings, isPreview =
|
|
|
33068
33659
|
description: `Creates leveraged looping position on ${lstSymbol} by borrowing ${underlyingSymbol} to increase yield`
|
|
33069
33660
|
},
|
|
33070
33661
|
depositTokens: [
|
|
33071
|
-
Global.getDefaultTokens().find(
|
|
33072
|
-
(token) => token.symbol === lstSymbol
|
|
33073
|
-
)
|
|
33662
|
+
Global.getDefaultTokens().find((token) => token.symbol === lstSymbol)
|
|
33074
33663
|
],
|
|
33075
33664
|
additionalInfo: getLooperSettings2(
|
|
33076
33665
|
lstSymbol,
|
|
@@ -33080,10 +33669,7 @@ function getStrategySettings(lstSymbol, underlyingSymbol, settings, isPreview =
|
|
|
33080
33669
|
),
|
|
33081
33670
|
risk: {
|
|
33082
33671
|
riskFactor: _riskFactor4,
|
|
33083
|
-
netRisk: _riskFactor4.reduce(
|
|
33084
|
-
(acc, curr) => acc + curr.value * curr.weight,
|
|
33085
|
-
0
|
|
33086
|
-
) / _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),
|
|
33087
33673
|
notARisks: getNoRiskTags(_riskFactor4)
|
|
33088
33674
|
},
|
|
33089
33675
|
auditUrl: AUDIT_URL4,
|
|
@@ -33098,16 +33684,19 @@ function getStrategySettings(lstSymbol, underlyingSymbol, settings, isPreview =
|
|
|
33098
33684
|
investmentSteps: getInvestmentSteps(lstSymbol, underlyingSymbol),
|
|
33099
33685
|
isPreview,
|
|
33100
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",
|
|
33101
33688
|
tags: lstSymbol.includes("BTC") ? ["BTC" /* BTC */, "Maxx" /* LEVERED */] : ["Maxx" /* LEVERED */],
|
|
33102
33689
|
security: HYPER_LST_SECURITY,
|
|
33103
33690
|
redemptionInfo: HYPER_LST_REDEMPTION_INFO,
|
|
33104
33691
|
usualTimeToEarnings: "2 weeks",
|
|
33105
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.",
|
|
33106
|
-
points: [
|
|
33107
|
-
|
|
33108
|
-
|
|
33109
|
-
|
|
33110
|
-
|
|
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
|
+
]
|
|
33111
33700
|
};
|
|
33112
33701
|
}
|
|
33113
33702
|
var HyperLSTStrategies = [
|
|
@@ -33357,6 +33946,7 @@ export {
|
|
|
33357
33946
|
Initializable,
|
|
33358
33947
|
InstantWithdrawalVault,
|
|
33359
33948
|
LSTAPRService,
|
|
33949
|
+
LSTPriceType,
|
|
33360
33950
|
MarginType,
|
|
33361
33951
|
MyNumber,
|
|
33362
33952
|
Network,
|