@strkfarm/sdk 1.1.29 → 1.1.32
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 +239 -54
- package/dist/index.browser.mjs +239 -54
- package/dist/index.d.ts +14 -5
- package/dist/index.js +247 -60
- package/dist/index.mjs +245 -60
- package/package.json +1 -1
- package/src/strategies/universal-adapters/adapter-utils.ts +2 -0
- package/src/strategies/universal-adapters/common-adapter.ts +6 -6
- package/src/strategies/universal-adapters/vesu-adapter.ts +29 -21
- package/src/strategies/universal-lst-muliplier-strategy.tsx +234 -23
- package/src/strategies/universal-strategy.tsx +2 -2
|
@@ -3,10 +3,10 @@ import { AUMTypes, getContractDetails, UNIVERSAL_ADAPTERS, UNIVERSAL_MANAGE_IDS,
|
|
|
3
3
|
import { PricerBase } from "@/modules/pricerBase";
|
|
4
4
|
import { ContractAddr, Web3Number } from "@/dataTypes";
|
|
5
5
|
import { Global } from "@/global";
|
|
6
|
-
import { ApproveCallParams, CommonAdapter, getVesuSingletonAddress, ManageCall, Swap, VesuAdapter, VesuModifyDelegationCallParams, VesuMultiplyCallParams, VesuPools } from "./universal-adapters";
|
|
7
|
-
import {
|
|
6
|
+
import { ApproveCallParams, AvnuSwapCallParams, CommonAdapter, getVesuSingletonAddress, ManageCall, Swap, VesuAdapter, VesuModifyDelegationCallParams, VesuModifyPositionCallParams, VesuMultiplyCallParams, VesuPools } from "./universal-adapters";
|
|
7
|
+
import { AVNU_EXCHANGE } from "./universal-adapters/adapter-utils";
|
|
8
8
|
import { DepegRiskLevel, LiquidationRiskLevel, SmartContractRiskLevel, TechnicalRiskLevel } from "@/interfaces/risks";
|
|
9
|
-
import { EkuboQuoter, ERC20, LSTAPRService, PricerLST } from "@/modules";
|
|
9
|
+
import { AvnuWrapper, EkuboQuoter, ERC20, LSTAPRService, PricerLST } from "@/modules";
|
|
10
10
|
import { assert, logger } from "@/utils";
|
|
11
11
|
import { SingleTokenInfo } from "./base-strategy";
|
|
12
12
|
import { Call, Contract, uint256 } from "starknet";
|
|
@@ -81,9 +81,204 @@ export class UniversalLstMultiplierStrategy extends UniversalStrategy<UniversalS
|
|
|
81
81
|
isDeposit: boolean,
|
|
82
82
|
leg1DepositAmount: Web3Number
|
|
83
83
|
}) {
|
|
84
|
-
|
|
84
|
+
// TODO use a varibale for 1.02
|
|
85
|
+
return this._getAvnuDepositSwapLegCall({
|
|
86
|
+
...params,
|
|
87
|
+
minHF: 1.02
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
private async _getAvnuDepositSwapLegCall(params: {
|
|
92
|
+
isDeposit: boolean,
|
|
93
|
+
leg1DepositAmount: Web3Number,
|
|
94
|
+
minHF: number // e.g. 1.01
|
|
95
|
+
}) {
|
|
96
|
+
logger.verbose(`${this.getTag()}::_getAvnuDepositSwapLegCall params: ${JSON.stringify(params)}`);
|
|
97
|
+
assert(params.isDeposit, 'Only deposit is supported in _getAvnuDepositSwapLegCall')
|
|
98
|
+
// add collateral
|
|
99
|
+
// borrow STRK (e.g.)
|
|
100
|
+
// approve and swap strk
|
|
101
|
+
// add collateral again
|
|
102
|
+
|
|
103
|
+
const [vesuAdapter1] = this.getVesuAdapters();
|
|
104
|
+
const legLTV = await vesuAdapter1.getLTVConfig(this.config);
|
|
105
|
+
logger.verbose(`${this.getTag()}::_getAvnuDepositSwapLegCall legLTV: ${legLTV}`);
|
|
106
|
+
const existingPositions = await vesuAdapter1.getPositions(this.config);
|
|
107
|
+
const collateralisation = await vesuAdapter1.getCollateralization(this.config);
|
|
108
|
+
const existingCollateralInfo = existingPositions[0];
|
|
109
|
+
const existingDebtInfo = existingPositions[1];
|
|
110
|
+
logger.debug(`${this.getTag()}::_getAvnuDepositSwapLegCall existingCollateralInfo: ${JSON.stringify(existingCollateralInfo)},
|
|
111
|
+
existingDebtInfo: ${JSON.stringify(existingDebtInfo)}, collateralisation: ${JSON.stringify(collateralisation)}`);
|
|
112
|
+
|
|
113
|
+
// - Prices as seen by Vesu contracts, ideal for HF math
|
|
114
|
+
// Price 1 is ok as fallback bcz that would relatively price the
|
|
115
|
+
// collateral and debt as equal.
|
|
116
|
+
const collateralPrice = collateralisation[0].usdValue > 0 ? collateralisation[0].usdValue / existingCollateralInfo.amount.toNumber() : 1;
|
|
117
|
+
const debtPrice = collateralisation[1].usdValue > 0 ? collateralisation[1].usdValue / existingDebtInfo.amount.toNumber() : 1;
|
|
118
|
+
logger.debug(`${this.getTag()}::_getAvnuDepositSwapLegCall collateralPrice: ${collateralPrice}, debtPrice: ${debtPrice}`);
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
const totalCollateral = existingCollateralInfo.amount.plus(params.leg1DepositAmount);
|
|
122
|
+
logger.verbose(`${this.getTag()}::_getAvnuDepositSwapLegCall totalCollateral: ${totalCollateral}`);
|
|
123
|
+
const totalDebtAmount = totalCollateral.multipliedBy(collateralPrice).multipliedBy(legLTV).dividedBy(debtPrice).dividedBy(params.minHF);
|
|
124
|
+
logger.verbose(`${this.getTag()}::_getAvnuDepositSwapLegCall totalDebtAmount: ${totalDebtAmount}`);
|
|
125
|
+
const debtAmount = totalDebtAmount.minus(existingDebtInfo.amount);
|
|
126
|
+
if (debtAmount.lt(0)) {
|
|
127
|
+
// this is to unwind the position to optimal HF.
|
|
128
|
+
const lstDEXPrice = await this.getLSTDexPrice();
|
|
129
|
+
const debtAmountInLST = debtAmount.abs().dividedBy(lstDEXPrice);
|
|
130
|
+
const calls = await this.getVesuMultiplyCall({
|
|
131
|
+
isDeposit: false,
|
|
132
|
+
leg1DepositAmount: debtAmountInLST
|
|
133
|
+
})
|
|
134
|
+
assert(calls.length == 1, 'Expected 1 call for unwind');
|
|
135
|
+
return calls[0];
|
|
136
|
+
}
|
|
137
|
+
logger.verbose(`${this.getTag()}::_getAvnuDepositSwapLegCall debtAmount: ${debtAmount}`);
|
|
138
|
+
const STEP0 = UNIVERSAL_MANAGE_IDS.APPROVE_TOKEN1;
|
|
139
|
+
const manage0Info = this.getProofs<ApproveCallParams>(STEP0);
|
|
140
|
+
const manageCall0 = manage0Info.callConstructor({
|
|
141
|
+
amount: params.leg1DepositAmount
|
|
142
|
+
});
|
|
143
|
+
const STEP1 = UNIVERSAL_MANAGE_IDS.VESU_LEG1;
|
|
144
|
+
const manage1Info = this.getProofs<VesuModifyPositionCallParams>(STEP1);
|
|
145
|
+
const manageCall1 = manage1Info.callConstructor(VesuAdapter.getDefaultModifyPositionCallParams({
|
|
146
|
+
collateralAmount: params.leg1DepositAmount,
|
|
147
|
+
isAddCollateral: params.isDeposit,
|
|
148
|
+
debtAmount: debtAmount,
|
|
149
|
+
isBorrow: params.isDeposit
|
|
150
|
+
}));
|
|
151
|
+
|
|
152
|
+
const proofIds: string[] = [STEP0, STEP1];
|
|
153
|
+
const manageCalls: ManageCall[] = [manageCall0, manageCall1];
|
|
154
|
+
|
|
155
|
+
// approve and swap to LST using avnu
|
|
156
|
+
// todo add non-zero check
|
|
157
|
+
if (debtAmount.gt(0)) {
|
|
158
|
+
const STEP2 = LST_MULTIPLIER_MANAGE_IDS.AVNU_MULTIPLY_APPROVE_DEPOSIT;
|
|
159
|
+
const manage2Info = this.getProofs<ApproveCallParams>(STEP2);
|
|
160
|
+
const manageCall2 = manage2Info.callConstructor({
|
|
161
|
+
amount: debtAmount
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
const debtTokenInfo = vesuAdapter1.config.debt;
|
|
165
|
+
const lstTokenInfo = this.asset();
|
|
166
|
+
const avnuModule = new AvnuWrapper();
|
|
167
|
+
const quote = await avnuModule.getQuotes(
|
|
168
|
+
debtTokenInfo.address.address,
|
|
169
|
+
lstTokenInfo.address.address,
|
|
170
|
+
debtAmount.toWei(),
|
|
171
|
+
this.metadata.additionalInfo.vaultAllocator.address
|
|
172
|
+
);
|
|
173
|
+
const minAmount = await this._getMinOutputAmountLSTBuy(debtAmount);
|
|
174
|
+
const minAmountWei = (minAmount).toWei();
|
|
175
|
+
logger.verbose(`${this.getTag()}::_getAvnuDepositSwapLegCall minAmount: ${minAmount}`);
|
|
176
|
+
const swapInfo = await avnuModule.getSwapInfo(
|
|
177
|
+
quote,
|
|
178
|
+
this.metadata.additionalInfo.vaultAllocator.address,
|
|
179
|
+
0,
|
|
180
|
+
this.address.address,
|
|
181
|
+
minAmountWei
|
|
182
|
+
);
|
|
183
|
+
logger.verbose(`${this.getTag()}::_getAvnuDepositSwapLegCall swapInfo: ${JSON.stringify(swapInfo)}`);
|
|
184
|
+
const STEP3 = LST_MULTIPLIER_MANAGE_IDS.AVNU_MULTIPLY_SWAP_DEPOSIT;
|
|
185
|
+
const manage3Info = this.getProofs<AvnuSwapCallParams>(STEP3);
|
|
186
|
+
const manageCall3 = manage3Info.callConstructor({
|
|
187
|
+
props: swapInfo
|
|
188
|
+
});
|
|
189
|
+
proofIds.push(STEP2);
|
|
190
|
+
proofIds.push(STEP3);
|
|
191
|
+
manageCalls.push(manageCall2, manageCall3);
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
// if the created debt, when added is collateral will put the total HF above min, but below (target + 0.05),
|
|
195
|
+
// then lets close the looping cycle by adding this as collateral.
|
|
196
|
+
const newCollateral = minAmount.plus(totalCollateral);
|
|
197
|
+
const newHF = newCollateral.multipliedBy(collateralPrice).multipliedBy(legLTV).dividedBy(totalDebtAmount).dividedBy(debtPrice).toNumber();
|
|
198
|
+
logger.verbose(`${this.getTag()}::_getAvnuDepositSwapLegCall newHF: ${newHF}`);
|
|
199
|
+
if (newHF > this.metadata.additionalInfo.minHealthFactor && newHF < this.metadata.additionalInfo.targetHealthFactor + 0.05) {
|
|
200
|
+
logger.verbose(`${this.getTag()}::_getAvnuDepositSwapLegCall newHF is above min and below target + 0.05, adding collateral on vesu`);
|
|
201
|
+
// approve and add collateral on vesu (modify position)
|
|
202
|
+
const STEP4 = UNIVERSAL_MANAGE_IDS.APPROVE_TOKEN1;
|
|
203
|
+
const manage4Info = this.getProofs<ApproveCallParams>(STEP4);
|
|
204
|
+
const manageCall4 = manage4Info.callConstructor({
|
|
205
|
+
amount: minAmount
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
const STEP5 = UNIVERSAL_MANAGE_IDS.VESU_LEG1;
|
|
209
|
+
const manage5Info = this.getProofs<VesuModifyPositionCallParams>(STEP5);
|
|
210
|
+
const manageCall5 = manage5Info.callConstructor(VesuAdapter.getDefaultModifyPositionCallParams({
|
|
211
|
+
collateralAmount: minAmount,
|
|
212
|
+
isAddCollateral: true,
|
|
213
|
+
debtAmount: Web3Number.fromWei('0', this.asset().decimals),
|
|
214
|
+
isBorrow: params.isDeposit
|
|
215
|
+
}));
|
|
216
|
+
proofIds.push(STEP4, STEP5);
|
|
217
|
+
manageCalls.push(manageCall4, manageCall5);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
const manageCall = this.getManageCall(proofIds, manageCalls);
|
|
222
|
+
return manageCall;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
// todo unwind or not deposit when the yield is bad.
|
|
226
|
+
|
|
227
|
+
async getLSTMultiplierRebalanceCall(): Promise<{ shouldRebalance: boolean, manageCall: Call | undefined }> {
|
|
228
|
+
const positions = await this.getVaultPositions();
|
|
229
|
+
assert(positions.length == 3, 'Rebalance call is only supported for 3 positions');
|
|
230
|
+
const existingCollateralInfo = positions[0];
|
|
231
|
+
const existingDebtInfo = positions[1];
|
|
232
|
+
const unusedBalance = positions[2];
|
|
233
|
+
const [healthFactor] = await this.getVesuHealthFactors();
|
|
234
|
+
|
|
235
|
+
const [vesuAdapter1] = this.getVesuAdapters();
|
|
236
|
+
const legLTV = await vesuAdapter1.getLTVConfig(this.config);
|
|
237
|
+
const collateralisation = await vesuAdapter1.getCollateralization(this.config);
|
|
238
|
+
logger.debug(`${this.getTag()}::getVesuMultiplyCall existingCollateralInfo: ${JSON.stringify(existingCollateralInfo)},
|
|
239
|
+
existingDebtInfo: ${JSON.stringify(existingDebtInfo)}, collateralisation: ${JSON.stringify(collateralisation)}`);
|
|
240
|
+
|
|
241
|
+
// - Prices as seen by Vesu contracts, ideal for HF math
|
|
242
|
+
// Price 1 is ok as fallback bcz that would relatively price the
|
|
243
|
+
// collateral and debt as equal.
|
|
244
|
+
const collateralPrice = collateralisation[0].usdValue > 0 ? collateralisation[0].usdValue / existingCollateralInfo.amount.toNumber() : 1;
|
|
245
|
+
const debtPrice = collateralisation[1].usdValue > 0 ? collateralisation[1].usdValue / existingDebtInfo.amount.toNumber() : 1;
|
|
246
|
+
logger.debug(`${this.getTag()}::getVesuMultiplyCall collateralPrice: ${collateralPrice}, debtPrice: ${debtPrice}`);
|
|
247
|
+
|
|
248
|
+
const isHFTooLow = healthFactor < this.metadata.additionalInfo.minHealthFactor;
|
|
249
|
+
const isHFTooHigh = healthFactor > this.metadata.additionalInfo.targetHealthFactor + 0.05;
|
|
250
|
+
if (isHFTooLow || isHFTooHigh) {
|
|
251
|
+
// use unused collateral to target more.
|
|
252
|
+
const manageCall = await this._getAvnuDepositSwapLegCall({
|
|
253
|
+
isDeposit: true,
|
|
254
|
+
leg1DepositAmount: unusedBalance.amount,
|
|
255
|
+
minHF: 1.02 // todo, shouldnt use this 1.02 HF, if there isn;t more looping left.
|
|
256
|
+
})
|
|
257
|
+
return { shouldRebalance: true, manageCall };
|
|
258
|
+
} else {
|
|
259
|
+
// do nothing
|
|
260
|
+
return { shouldRebalance: false, manageCall: undefined };
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
//
|
|
265
|
+
private async _getMinOutputAmountLSTBuy(amountInUnderlying: Web3Number) {
|
|
266
|
+
const lstTruePrice = await this.getLSTExchangeRate();
|
|
267
|
+
// during buy, the purchase should always be <= true LST price.
|
|
268
|
+
const minOutputAmount = amountInUnderlying.dividedBy(lstTruePrice);
|
|
269
|
+
return minOutputAmount;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
private async _getMinOutputAmountLSTSell(amountInLST: Web3Number) {
|
|
273
|
+
const lstTruePrice = await this.getLSTExchangeRate();
|
|
274
|
+
// during sell, the purchase should always be > 0.995 * true LST price.
|
|
275
|
+
const minOutputAmount = amountInLST.multipliedBy(lstTruePrice).multipliedBy(0.995);
|
|
276
|
+
return minOutputAmount;
|
|
85
277
|
}
|
|
86
278
|
|
|
279
|
+
// todo add a function to findout max borrowable amount without fucking yield
|
|
280
|
+
// if the current net yield < LST yield, add a function to calculate how much to unwind.
|
|
281
|
+
|
|
87
282
|
/**
|
|
88
283
|
* Uses vesu's multiple call to create leverage on LST
|
|
89
284
|
* Deposit amount is in LST
|
|
@@ -166,7 +361,11 @@ export class UniversalLstMultiplierStrategy extends UniversalStrategy<UniversalS
|
|
|
166
361
|
async getLSTAPR(_address: ContractAddr): Promise<number> {
|
|
167
362
|
try {
|
|
168
363
|
const vesuAdapter1 = this.getVesuAdapters()[0];
|
|
169
|
-
|
|
364
|
+
const apr = await LSTAPRService.getLSTAPR(vesuAdapter1.config.debt.address);
|
|
365
|
+
if (!apr) {
|
|
366
|
+
throw new Error('Failed to get LST APR');
|
|
367
|
+
}
|
|
368
|
+
return apr;
|
|
170
369
|
} catch (error) {
|
|
171
370
|
logger.warn(`${this.getTag()}: Failed to get LST APR: ${error}`);
|
|
172
371
|
return 0;
|
|
@@ -178,7 +377,9 @@ export class UniversalLstMultiplierStrategy extends UniversalStrategy<UniversalS
|
|
|
178
377
|
const { net, splits } = await super.netAPY();
|
|
179
378
|
let _net = net;
|
|
180
379
|
if (this.asset().symbol == 'xWBTC') {
|
|
181
|
-
|
|
380
|
+
const debtToken = this.getVesuAdapters()[0].config.debt;
|
|
381
|
+
const lstAPY = await this.getLSTAPR(debtToken.address);
|
|
382
|
+
_net = lstAPY * 5;
|
|
182
383
|
}
|
|
183
384
|
return {
|
|
184
385
|
net: _net,
|
|
@@ -240,7 +441,7 @@ export class UniversalLstMultiplierStrategy extends UniversalStrategy<UniversalS
|
|
|
240
441
|
|
|
241
442
|
// approve token
|
|
242
443
|
if (params.marginAmount.greaterThan(0)) {
|
|
243
|
-
const STEP1_ID =
|
|
444
|
+
const STEP1_ID = LST_MULTIPLIER_MANAGE_IDS.MULTIPLE_APPROVE;
|
|
244
445
|
const manage1Info = this.getProofs<ApproveCallParams>(STEP1_ID);
|
|
245
446
|
const depositAmount = params.marginAmount;
|
|
246
447
|
const manageCall1 = manage1Info.callConstructor({
|
|
@@ -369,6 +570,12 @@ export default function VaultDescription(
|
|
|
369
570
|
<p style={{ fontSize: "13px", color: "#ccc" }}>
|
|
370
571
|
<strong>Withdrawals:</strong> Requests can take up to <strong>1-2 hours</strong> to process as the vault unwinds and settles routing.
|
|
371
572
|
</p>
|
|
573
|
+
<p style={{ fontSize: "13px", color: "#ccc" }}>
|
|
574
|
+
<strong>Debt limits:</strong> 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.
|
|
575
|
+
</p>
|
|
576
|
+
<p style={{ fontSize: "13px", color: "#ccc" }}>
|
|
577
|
+
<strong>APY assumptions:</strong> APY shown is the max possible value given current LST and borrowing rates. True APY will be subject to the actual leverage, based on above point. More insights on exact APY will be added soon.
|
|
578
|
+
</p>
|
|
372
579
|
</div>
|
|
373
580
|
</div>
|
|
374
581
|
);
|
|
@@ -380,6 +587,7 @@ function getDescription(tokenSymbol: string, underlyingSymbol: string) {
|
|
|
380
587
|
}
|
|
381
588
|
|
|
382
589
|
enum LST_MULTIPLIER_MANAGE_IDS {
|
|
590
|
+
MULTIPLE_APPROVE = 'multiple_approve',
|
|
383
591
|
MULTIPLY_VESU = 'multiply_vesu',
|
|
384
592
|
SWITCH_DELEGATION_ON = 'switch_delegation_on',
|
|
385
593
|
SWITCH_DELEGATION_OFF = 'switch_delegation_off',
|
|
@@ -405,7 +613,7 @@ function getLooperSettings(
|
|
|
405
613
|
collateral: lstToken,
|
|
406
614
|
debt: underlyingToken,
|
|
407
615
|
vaultAllocator: vaultSettings.vaultAllocator,
|
|
408
|
-
id:
|
|
616
|
+
id: UNIVERSAL_MANAGE_IDS.VESU_LEG1
|
|
409
617
|
})
|
|
410
618
|
|
|
411
619
|
const commonAdapter = new CommonAdapter({
|
|
@@ -417,10 +625,10 @@ function getLooperSettings(
|
|
|
417
625
|
})
|
|
418
626
|
|
|
419
627
|
// vesu looping
|
|
420
|
-
const { isV2 } = getVesuSingletonAddress(pool1);
|
|
628
|
+
const { isV2, addr:poolAddr } = getVesuSingletonAddress(pool1);
|
|
421
629
|
const VESU_MULTIPLY = isV2 ? vesuAdapterLST.VESU_MULTIPLY : vesuAdapterLST.VESU_MULTIPLY_V1;
|
|
422
|
-
vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(lstToken.address, VESU_MULTIPLY,
|
|
423
|
-
vaultSettings.leafAdapters.push(vesuAdapterLST.getMultiplyAdapter.bind(vesuAdapterLST));
|
|
630
|
+
vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(lstToken.address, VESU_MULTIPLY, LST_MULTIPLIER_MANAGE_IDS.MULTIPLE_APPROVE).bind(commonAdapter));
|
|
631
|
+
vaultSettings.leafAdapters.push(vesuAdapterLST.getMultiplyAdapter(LST_MULTIPLIER_MANAGE_IDS.MULTIPLY_VESU).bind(vesuAdapterLST));
|
|
424
632
|
vaultSettings.leafAdapters.push(vesuAdapterLST.getVesuModifyDelegationAdapter(LST_MULTIPLIER_MANAGE_IDS.SWITCH_DELEGATION_ON).bind(vesuAdapterLST));
|
|
425
633
|
vaultSettings.leafAdapters.push(vesuAdapterLST.getVesuModifyDelegationAdapter(LST_MULTIPLIER_MANAGE_IDS.SWITCH_DELEGATION_OFF).bind(vesuAdapterLST));
|
|
426
634
|
|
|
@@ -435,10 +643,13 @@ function getLooperSettings(
|
|
|
435
643
|
}])
|
|
436
644
|
|
|
437
645
|
// avnu multiply
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
646
|
+
vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(underlyingToken.address, AVNU_EXCHANGE, LST_MULTIPLIER_MANAGE_IDS.AVNU_MULTIPLY_APPROVE_DEPOSIT).bind(commonAdapter));
|
|
647
|
+
vaultSettings.leafAdapters.push(commonAdapter.getAvnuAdapter(underlyingToken.address, lstToken.address, LST_MULTIPLIER_MANAGE_IDS.AVNU_MULTIPLY_SWAP_DEPOSIT, false).bind(commonAdapter));
|
|
648
|
+
vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(lstToken.address, AVNU_EXCHANGE, LST_MULTIPLIER_MANAGE_IDS.AVNU_MULTIPLY_APPROVE_WITHDRAW).bind(commonAdapter));
|
|
649
|
+
vaultSettings.leafAdapters.push(commonAdapter.getAvnuAdapter(lstToken.address, underlyingToken.address, LST_MULTIPLIER_MANAGE_IDS.AVNU_MULTIPLY_SWAP_WITHDRAW, false).bind(commonAdapter));
|
|
650
|
+
// approve LST to add collateral
|
|
651
|
+
vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(lstToken.address, poolAddr, UNIVERSAL_MANAGE_IDS.APPROVE_TOKEN1).bind(commonAdapter));
|
|
652
|
+
vaultSettings.leafAdapters.push(vesuAdapterLST.getModifyPosition.bind(vesuAdapterLST));
|
|
442
653
|
|
|
443
654
|
// to bridge liquidity back to vault (used by bring_liquidity)
|
|
444
655
|
vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(lstToken.address, vaultSettings.vaultAddress, UNIVERSAL_MANAGE_IDS.APPROVE_BRING_LIQUIDITY).bind(commonAdapter));
|
|
@@ -449,8 +660,8 @@ function getLooperSettings(
|
|
|
449
660
|
|
|
450
661
|
// avnu swap for claims rewards
|
|
451
662
|
const STRKToken = Global.getDefaultTokens().find(token => token.symbol === 'STRK')!;
|
|
452
|
-
vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(STRKToken.address,
|
|
453
|
-
vaultSettings.leafAdapters.push(commonAdapter.getAvnuAdapter(STRKToken.address, lstToken.address, UNIVERSAL_MANAGE_IDS.AVNU_SWAP_REWARDS).bind(commonAdapter));
|
|
663
|
+
vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(STRKToken.address, AVNU_EXCHANGE, UNIVERSAL_MANAGE_IDS.APPROVE_SWAP_TOKEN1).bind(commonAdapter));
|
|
664
|
+
vaultSettings.leafAdapters.push(commonAdapter.getAvnuAdapter(STRKToken.address, lstToken.address, UNIVERSAL_MANAGE_IDS.AVNU_SWAP_REWARDS, false).bind(commonAdapter));
|
|
454
665
|
return vaultSettings;
|
|
455
666
|
}
|
|
456
667
|
|
|
@@ -564,11 +775,11 @@ const hyperxsBTC: UniversalStrategySettings = {
|
|
|
564
775
|
}
|
|
565
776
|
|
|
566
777
|
const hyperxLBTC: UniversalStrategySettings = {
|
|
567
|
-
vaultAddress: ContractAddr.from('
|
|
568
|
-
manager: ContractAddr.from('
|
|
569
|
-
vaultAllocator: ContractAddr.from('
|
|
570
|
-
redeemRequestNFT: ContractAddr.from('
|
|
571
|
-
aumOracle: ContractAddr.from('
|
|
778
|
+
vaultAddress: ContractAddr.from('0x64cf24d4883fe569926419a0569ab34497c6956a1a308fa883257f7486d7030'),
|
|
779
|
+
manager: ContractAddr.from('0x203530a4022a99b8f4b406aaf33b0849d43ad7422c1d5cc14ff8c667abec6c0'),
|
|
780
|
+
vaultAllocator: ContractAddr.from('0x7dbc8ccd4eabce6ea6c19e0e5c9ccca3a93bd510303b9e071cbe25fc508546e'),
|
|
781
|
+
redeemRequestNFT: ContractAddr.from('0x5ee66a39af9aef3d0d48982b4a63e8bd2a5bad021916bd87fb0eae3a26800b8'),
|
|
782
|
+
aumOracle: ContractAddr.from('0x23d69e4391fa72d10e625e7575d8bddbb4aff96f04503f83fdde23123bf41d0'),
|
|
572
783
|
leafAdapters: [],
|
|
573
784
|
adapters: [],
|
|
574
785
|
targetHealthFactor: 1.1,
|
|
@@ -577,7 +788,7 @@ const hyperxLBTC: UniversalStrategySettings = {
|
|
|
577
788
|
|
|
578
789
|
function getInvestmentSteps(lstSymbol: string, underlyingSymbol: string) {
|
|
579
790
|
return [
|
|
580
|
-
`Deposit ${
|
|
791
|
+
`Deposit ${lstSymbol} into the vault`,
|
|
581
792
|
`The vault manager loops the ${underlyingSymbol} to buy ${lstSymbol}`,
|
|
582
793
|
`The vault manager collateralizes the ${lstSymbol} on Vesu`,
|
|
583
794
|
`The vault manager borrows more ${underlyingSymbol} to loop further`,
|
|
@@ -9,7 +9,7 @@ import UniversalVaultAbi from '../data/universal-vault.abi.json';
|
|
|
9
9
|
import ManagerAbi from '../data/vault-manager.abi.json';
|
|
10
10
|
import { ApproveCallParams, AvnuSwapCallParams, BaseAdapter, CommonAdapter, FlashloanCallParams, GenerateCallFn, LeafAdapterFn, ManageCall, VesuAdapter, VesuDefiSpringRewardsCallParams, VesuModifyPositionCallParams, VesuPools } from "./universal-adapters";
|
|
11
11
|
import { Global } from "@/global";
|
|
12
|
-
import { AvnuWrapper, ERC20
|
|
12
|
+
import { AvnuWrapper, ERC20 } from "@/modules";
|
|
13
13
|
import { AVNU_MIDDLEWARE, VESU_SINGLETON } from "./universal-adapters/adapter-utils";
|
|
14
14
|
import { VesuHarvests } from "@/modules/harvests";
|
|
15
15
|
|
|
@@ -886,7 +886,7 @@ function getLooperSettings(
|
|
|
886
886
|
// avnu swap
|
|
887
887
|
const STRKToken = Global.getDefaultTokens().find(token => token.symbol === 'STRK')!;
|
|
888
888
|
vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(STRKToken.address, AVNU_MIDDLEWARE, UNIVERSAL_MANAGE_IDS.APPROVE_SWAP_TOKEN1).bind(commonAdapter));
|
|
889
|
-
vaultSettings.leafAdapters.push(commonAdapter.getAvnuAdapter(STRKToken.address, USDCToken.address, UNIVERSAL_MANAGE_IDS.AVNU_SWAP_REWARDS).bind(commonAdapter));
|
|
889
|
+
vaultSettings.leafAdapters.push(commonAdapter.getAvnuAdapter(STRKToken.address, USDCToken.address, UNIVERSAL_MANAGE_IDS.AVNU_SWAP_REWARDS, true).bind(commonAdapter));
|
|
890
890
|
return vaultSettings;
|
|
891
891
|
}
|
|
892
892
|
|