@strkfarm/sdk 1.1.8 → 1.1.10
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/cli.js +1 -1
- package/dist/cli.mjs +1 -1
- package/dist/index.browser.global.js +1241 -74
- package/dist/index.browser.mjs +1396 -227
- package/dist/index.d.ts +169 -30
- package/dist/index.js +1412 -239
- package/dist/index.mjs +1397 -228
- package/package.json +1 -1
- package/src/data/vesu-multiple.abi.json +475 -0
- package/src/dataTypes/_bignumber.ts +13 -0
- package/src/interfaces/common.tsx +2 -1
- package/src/modules/ekubo-quoter.ts +127 -0
- package/src/modules/index.ts +1 -0
- package/src/strategies/ekubo-cl-vault.tsx +25 -11
- package/src/strategies/index.ts +2 -1
- package/src/strategies/universal-adapters/adapter-utils.ts +3 -0
- package/src/strategies/universal-adapters/baseAdapter.ts +3 -3
- package/src/strategies/universal-adapters/vesu-adapter.ts +244 -3
- package/src/strategies/universal-lst-muliplier-strategy.tsx +497 -0
- package/src/strategies/universal-strategy.tsx +142 -60
- package/src/utils/index.ts +3 -1
- package/src/utils/logger.node.ts +1 -1
|
@@ -20191,7 +20191,7 @@ ${r2}}` : "}", l2;
|
|
|
20191
20191
|
toHexString: () => toHexString2,
|
|
20192
20192
|
toStorageKey: () => toStorageKey2
|
|
20193
20193
|
});
|
|
20194
|
-
var
|
|
20194
|
+
var import_utils58 = require_utils2();
|
|
20195
20195
|
function isHex3(hex) {
|
|
20196
20196
|
return /^0x[0-9a-f]*$/i.test(hex);
|
|
20197
20197
|
}
|
|
@@ -20264,7 +20264,7 @@ ${r2}}` : "}", l2;
|
|
|
20264
20264
|
if (adaptedValue.length % 2 !== 0) {
|
|
20265
20265
|
adaptedValue = `0${adaptedValue}`;
|
|
20266
20266
|
}
|
|
20267
|
-
return (0,
|
|
20267
|
+
return (0, import_utils58.hexToBytes)(adaptedValue);
|
|
20268
20268
|
}
|
|
20269
20269
|
function addPercent2(number2, percent) {
|
|
20270
20270
|
const bigIntNum = BigInt(number2);
|
|
@@ -20283,14 +20283,14 @@ ${r2}}` : "}", l2;
|
|
|
20283
20283
|
keccakBn: () => keccakBn2,
|
|
20284
20284
|
starknetKeccak: () => starknetKeccak2
|
|
20285
20285
|
});
|
|
20286
|
-
var
|
|
20286
|
+
var import_starknet24 = require_lib3();
|
|
20287
20287
|
function keccakBn2(value) {
|
|
20288
20288
|
const hexWithoutPrefix = removeHexPrefix2(toHex3(BigInt(value)));
|
|
20289
20289
|
const evenHex = hexWithoutPrefix.length % 2 === 0 ? hexWithoutPrefix : `0${hexWithoutPrefix}`;
|
|
20290
|
-
return addHexPrefix2((0,
|
|
20290
|
+
return addHexPrefix2((0, import_starknet24.keccak)(hexToBytes4(addHexPrefix2(evenHex))).toString(16));
|
|
20291
20291
|
}
|
|
20292
20292
|
function keccakHex2(str) {
|
|
20293
|
-
return addHexPrefix2((0,
|
|
20293
|
+
return addHexPrefix2((0, import_starknet24.keccak)(utf8ToArray2(str)).toString(16));
|
|
20294
20294
|
}
|
|
20295
20295
|
function starknetKeccak2(str) {
|
|
20296
20296
|
const hash2 = BigInt(keccakHex2(str));
|
|
@@ -22302,7 +22302,7 @@ ${r2}}` : "}", l2;
|
|
|
22302
22302
|
hashDAMode: () => hashDAMode2,
|
|
22303
22303
|
hashFeeField: () => hashFeeField
|
|
22304
22304
|
});
|
|
22305
|
-
var
|
|
22305
|
+
var import_starknet25 = require_lib3();
|
|
22306
22306
|
var AToBI2 = (array) => array.map((it) => BigInt(it));
|
|
22307
22307
|
var DATA_AVAILABILITY_MODE_BITS2 = 32n;
|
|
22308
22308
|
var MAX_AMOUNT_BITS2 = 64n;
|
|
@@ -22316,7 +22316,7 @@ ${r2}}` : "}", l2;
|
|
|
22316
22316
|
function hashFeeField(tip, bounds) {
|
|
22317
22317
|
const L1Bound = (L1_GAS_NAME2 << RESOURCE_VALUE_OFFSET2) + (BigInt(bounds.l1_gas.max_amount) << MAX_PRICE_PER_UNIT_BITS2) + BigInt(bounds.l1_gas.max_price_per_unit);
|
|
22318
22318
|
const L2Bound = (L2_GAS_NAME2 << RESOURCE_VALUE_OFFSET2) + (BigInt(bounds.l2_gas.max_amount) << MAX_PRICE_PER_UNIT_BITS2) + BigInt(bounds.l2_gas.max_price_per_unit);
|
|
22319
|
-
return (0,
|
|
22319
|
+
return (0, import_starknet25.poseidonHashMany)([BigInt(tip), L1Bound, L2Bound]);
|
|
22320
22320
|
}
|
|
22321
22321
|
function calculateTransactionHashCommon22(txHashPrefix, version4, senderAddress, chainId, nonce, tip, paymasterData, nonceDataAvailabilityMode, feeDataAvailabilityMode, resourceBounds, additionalData = []) {
|
|
22322
22322
|
const feeFieldHash = hashFeeField(tip, resourceBounds);
|
|
@@ -22326,13 +22326,13 @@ ${r2}}` : "}", l2;
|
|
|
22326
22326
|
version4,
|
|
22327
22327
|
senderAddress,
|
|
22328
22328
|
feeFieldHash,
|
|
22329
|
-
(0,
|
|
22329
|
+
(0, import_starknet25.poseidonHashMany)(AToBI2(paymasterData)),
|
|
22330
22330
|
chainId,
|
|
22331
22331
|
nonce,
|
|
22332
22332
|
dAModeHash,
|
|
22333
22333
|
...AToBI2(additionalData)
|
|
22334
22334
|
]);
|
|
22335
|
-
return toHex3((0,
|
|
22335
|
+
return toHex3((0, import_starknet25.poseidonHashMany)(dataToHash));
|
|
22336
22336
|
}
|
|
22337
22337
|
function calculateDeployAccountTransactionHash22(contractAddress, classHash, compiledConstructorCalldata, salt, version4, chainId, nonce, nonceDataAvailabilityMode, feeDataAvailabilityMode, resourceBounds, tip, paymasterData) {
|
|
22338
22338
|
return calculateTransactionHashCommon22(
|
|
@@ -22346,7 +22346,7 @@ ${r2}}` : "}", l2;
|
|
|
22346
22346
|
nonceDataAvailabilityMode,
|
|
22347
22347
|
feeDataAvailabilityMode,
|
|
22348
22348
|
resourceBounds,
|
|
22349
|
-
[(0,
|
|
22349
|
+
[(0, import_starknet25.poseidonHashMany)(AToBI2(compiledConstructorCalldata)), classHash, salt]
|
|
22350
22350
|
);
|
|
22351
22351
|
}
|
|
22352
22352
|
function calculateDeclareTransactionHash22(classHash, compiledClassHash, senderAddress, version4, chainId, nonce, accountDeploymentData, nonceDataAvailabilityMode, feeDataAvailabilityMode, resourceBounds, tip, paymasterData) {
|
|
@@ -22361,7 +22361,7 @@ ${r2}}` : "}", l2;
|
|
|
22361
22361
|
nonceDataAvailabilityMode,
|
|
22362
22362
|
feeDataAvailabilityMode,
|
|
22363
22363
|
resourceBounds,
|
|
22364
|
-
[(0,
|
|
22364
|
+
[(0, import_starknet25.poseidonHashMany)(AToBI2(accountDeploymentData)), classHash, compiledClassHash]
|
|
22365
22365
|
);
|
|
22366
22366
|
}
|
|
22367
22367
|
function calculateInvokeTransactionHash3(senderAddress, version4, compiledCalldata, chainId, nonce, accountDeploymentData, nonceDataAvailabilityMode, feeDataAvailabilityMode, resourceBounds, tip, paymasterData) {
|
|
@@ -22376,7 +22376,7 @@ ${r2}}` : "}", l2;
|
|
|
22376
22376
|
nonceDataAvailabilityMode,
|
|
22377
22377
|
feeDataAvailabilityMode,
|
|
22378
22378
|
resourceBounds,
|
|
22379
|
-
[(0,
|
|
22379
|
+
[(0, import_starknet25.poseidonHashMany)(AToBI2(accountDeploymentData)), (0, import_starknet25.poseidonHashMany)(AToBI2(compiledCalldata))]
|
|
22380
22380
|
);
|
|
22381
22381
|
}
|
|
22382
22382
|
function isV3InvokeTx2(args) {
|
|
@@ -28650,9 +28650,11 @@ ${r2}}` : "}", l2;
|
|
|
28650
28650
|
ERC20: () => ERC20,
|
|
28651
28651
|
EkuboCLVault: () => EkuboCLVault,
|
|
28652
28652
|
EkuboCLVaultStrategies: () => EkuboCLVaultStrategies,
|
|
28653
|
+
EkuboQuoter: () => EkuboQuoter,
|
|
28653
28654
|
FatalError: () => FatalError,
|
|
28654
28655
|
FlowChartColors: () => FlowChartColors,
|
|
28655
28656
|
Global: () => Global,
|
|
28657
|
+
HyperLSTStrategies: () => HyperLSTStrategies,
|
|
28656
28658
|
ILending: () => ILending,
|
|
28657
28659
|
Initializable: () => Initializable,
|
|
28658
28660
|
MarginType: () => MarginType,
|
|
@@ -28666,6 +28668,7 @@ ${r2}}` : "}", l2;
|
|
|
28666
28668
|
SenseiVault: () => SenseiVault,
|
|
28667
28669
|
UNIVERSAL_ADAPTERS: () => UNIVERSAL_ADAPTERS,
|
|
28668
28670
|
UNIVERSAL_MANAGE_IDS: () => UNIVERSAL_MANAGE_IDS,
|
|
28671
|
+
UniversalLstMultiplierStrategy: () => UniversalLstMultiplierStrategy,
|
|
28669
28672
|
UniversalStrategies: () => UniversalStrategies,
|
|
28670
28673
|
UniversalStrategy: () => UniversalStrategy,
|
|
28671
28674
|
VesuAdapter: () => VesuAdapter,
|
|
@@ -28676,6 +28679,7 @@ ${r2}}` : "}", l2;
|
|
|
28676
28679
|
VesuRebalanceStrategies: () => VesuRebalanceStrategies,
|
|
28677
28680
|
Web3Number: () => Web3Number,
|
|
28678
28681
|
ZkLend: () => ZkLend,
|
|
28682
|
+
getContractDetails: () => getContractDetails,
|
|
28679
28683
|
getMainnetConfig: () => getMainnetConfig,
|
|
28680
28684
|
getNoRiskTags: () => getNoRiskTags,
|
|
28681
28685
|
getRiskColor: () => getRiskColor,
|
|
@@ -31264,6 +31268,17 @@ ${r2}}` : "}", l2;
|
|
|
31264
31268
|
const answer = _value.greaterThanOrEqualTo(_valueMe) ? _value : _valueMe;
|
|
31265
31269
|
return this.construct(answer.toString(), this.decimals);
|
|
31266
31270
|
}
|
|
31271
|
+
abs() {
|
|
31272
|
+
console.warn(`abs: this: ${this}`);
|
|
31273
|
+
return this.construct(Math.abs(this.toNumber()).toFixed(12), this.decimals);
|
|
31274
|
+
}
|
|
31275
|
+
toI129() {
|
|
31276
|
+
const sign2 = this.isNegative() ? 1 : 0;
|
|
31277
|
+
return {
|
|
31278
|
+
mag: BigInt(this.toWei()) * (this.isNegative() ? -1n : 1n),
|
|
31279
|
+
sign: sign2
|
|
31280
|
+
};
|
|
31281
|
+
}
|
|
31267
31282
|
};
|
|
31268
31283
|
import_bignumber.default.config({ DECIMAL_PLACES: 18, ROUNDING_MODE: import_bignumber.default.ROUND_DOWN });
|
|
31269
31284
|
_Web3Number.config({ DECIMAL_PLACES: 18, ROUNDING_MODE: import_bignumber.default.ROUND_DOWN });
|
|
@@ -53738,6 +53753,60 @@ ${JSON.stringify(data, null, 2)}`;
|
|
|
53738
53753
|
}
|
|
53739
53754
|
};
|
|
53740
53755
|
|
|
53756
|
+
// src/modules/ekubo-quoter.ts
|
|
53757
|
+
var EkuboQuoter = class {
|
|
53758
|
+
// e.g. ETH/USDC'
|
|
53759
|
+
constructor(config3) {
|
|
53760
|
+
this.config = config3;
|
|
53761
|
+
this.ENDPOINT = "https://quoter-mainnet-api.ekubo.org/{{AMOUNT}}/{{TOKEN_FROM_ADDRESS}}/{{TOKEN_TO_ADDRESS}}";
|
|
53762
|
+
}
|
|
53763
|
+
/**
|
|
53764
|
+
*
|
|
53765
|
+
* @param fromToken
|
|
53766
|
+
* @param toToken
|
|
53767
|
+
* @param amount Can be negative too, which would mean to get exact amount out
|
|
53768
|
+
* @returns
|
|
53769
|
+
*/
|
|
53770
|
+
async getQuote(fromToken, toToken, amount) {
|
|
53771
|
+
let _fromToken = amount.gt(0) ? fromToken : toToken;
|
|
53772
|
+
let _toToken = amount.gt(0) ? toToken : fromToken;
|
|
53773
|
+
const quote = await axios_default.get(this.ENDPOINT.replace("{{AMOUNT}}", amount.toWei()).replace("{{TOKEN_FROM_ADDRESS}}", _fromToken).replace("{{TOKEN_TO_ADDRESS}}", _toToken));
|
|
53774
|
+
console.log(`Ekubo quote from ${_fromToken} to ${_toToken} for ${amount.toString()}: ${JSON.stringify(quote.data)}`);
|
|
53775
|
+
return quote.data;
|
|
53776
|
+
}
|
|
53777
|
+
/**
|
|
53778
|
+
* Formats Ekubo response for Vesu multiple use
|
|
53779
|
+
* @param quote
|
|
53780
|
+
* @param fromTokenInfo
|
|
53781
|
+
* @returns
|
|
53782
|
+
*/
|
|
53783
|
+
getVesuMultiplyQuote(quote, fromTokenInfo, toTokenInfo) {
|
|
53784
|
+
return quote.splits.map((split2) => {
|
|
53785
|
+
const isNegativeAmount = BigInt(split2.amount_specified) < 0n;
|
|
53786
|
+
const token = isNegativeAmount ? toTokenInfo : fromTokenInfo;
|
|
53787
|
+
return {
|
|
53788
|
+
route: split2.route.map((_route) => ({
|
|
53789
|
+
pool_key: {
|
|
53790
|
+
token0: ContractAddr.from(_route.pool_key.token0),
|
|
53791
|
+
token1: ContractAddr.from(_route.pool_key.token1),
|
|
53792
|
+
fee: _route.pool_key.fee,
|
|
53793
|
+
tick_spacing: _route.pool_key.tick_spacing.toString(),
|
|
53794
|
+
extension: _route.pool_key.extension
|
|
53795
|
+
},
|
|
53796
|
+
sqrt_ratio_limit: Web3Number.fromWei(_route.sqrt_ratio_limit, 18),
|
|
53797
|
+
// just for use, any decimal works
|
|
53798
|
+
skip_ahead: Web3Number.fromWei(_route.skip_ahead, 0)
|
|
53799
|
+
// no decimal for this
|
|
53800
|
+
})),
|
|
53801
|
+
token_amount: {
|
|
53802
|
+
token: token.address,
|
|
53803
|
+
amount: Web3Number.fromWei(split2.amount_specified, token.decimals)
|
|
53804
|
+
}
|
|
53805
|
+
};
|
|
53806
|
+
});
|
|
53807
|
+
}
|
|
53808
|
+
};
|
|
53809
|
+
|
|
53741
53810
|
// src/interfaces/common.tsx
|
|
53742
53811
|
var import_jsx_runtime = __toESM(require_jsx_runtime());
|
|
53743
53812
|
var RiskType = /* @__PURE__ */ ((RiskType2) => {
|
|
@@ -67867,20 +67936,27 @@ ${JSON.stringify(data, null, 2)}`;
|
|
|
67867
67936
|
name: "Ekubo",
|
|
67868
67937
|
logo: "https://app.ekubo.org/favicon.ico"
|
|
67869
67938
|
};
|
|
67870
|
-
var
|
|
67939
|
+
var _lstPoolRiskFactors = [
|
|
67871
67940
|
{ type: "Smart Contract Risk" /* SMART_CONTRACT_RISK */, value: 2 /* WELL_AUDITED */, weight: 34, reason: "Audited smart contracts" },
|
|
67872
67941
|
{ type: "Impermanent Loss Risk" /* IMPERMANENT_LOSS */, value: 1 /* HIGHLY_CORRELATED */, weight: 33, reason: "Low risk due to co-related assets" },
|
|
67873
|
-
{ type: "Market Risk" /* MARKET_RISK */, value: 1 /* VERY_LOW_VOLATILITY */, weight: 33, reason: "Low risk due to co-related assets" }
|
|
67942
|
+
{ type: "Market Risk" /* MARKET_RISK */, value: 1 /* VERY_LOW_VOLATILITY */, weight: 33, reason: "Low risk due to co-related assets" },
|
|
67943
|
+
{ type: "Depeg Risk" /* DEPEG_RISK */, value: 2 /* GENERALLY_STABLE */, weight: 33, reason: "Generally stable pegged assets" }
|
|
67944
|
+
];
|
|
67945
|
+
var _stableCoinPoolRiskFactors = [
|
|
67946
|
+
{ type: "Smart Contract Risk" /* SMART_CONTRACT_RISK */, value: 1 /* BATTLE_TESTED */, weight: 34, reason: "Audited smart contracts" },
|
|
67947
|
+
{ type: "Impermanent Loss Risk" /* IMPERMANENT_LOSS */, value: 1 /* HIGHLY_CORRELATED */, weight: 33, reason: "Low risk due to co-related assets" },
|
|
67948
|
+
{ type: "Market Risk" /* MARKET_RISK */, value: 1 /* VERY_LOW_VOLATILITY */, weight: 33, reason: "Low risk due to co-related assets" },
|
|
67949
|
+
{ type: "Depeg Risk" /* DEPEG_RISK */, value: 1 /* HIGHLY_STABLE */, weight: 33, reason: "Highly stable assets" }
|
|
67874
67950
|
];
|
|
67875
67951
|
var mediumVolatilityPoolRiskFactors = [
|
|
67876
67952
|
{ type: "Smart Contract Risk" /* SMART_CONTRACT_RISK */, value: 2 /* WELL_AUDITED */, weight: 34, reason: "Audited smart contracts" },
|
|
67877
|
-
{ type: "Impermanent Loss Risk" /* IMPERMANENT_LOSS */, value: 3 /* NON_CORRELATED */, weight: 33, reason: "
|
|
67878
|
-
{ type: "Market Risk" /* MARKET_RISK */, value: 3 /* MODERATE_VOLATILITY */, weight: 33, reason: "
|
|
67953
|
+
{ type: "Impermanent Loss Risk" /* IMPERMANENT_LOSS */, value: 3 /* NON_CORRELATED */, weight: 33, reason: "Assets are not correlated, often volatile" },
|
|
67954
|
+
{ type: "Market Risk" /* MARKET_RISK */, value: 3 /* MODERATE_VOLATILITY */, weight: 33, reason: "Assets are not correlated, relative volatile can be moderate sometimes" }
|
|
67879
67955
|
];
|
|
67880
67956
|
var highVolatilityPoolRiskFactors = [
|
|
67881
67957
|
{ type: "Smart Contract Risk" /* SMART_CONTRACT_RISK */, value: 2 /* WELL_AUDITED */, weight: 34, reason: "Audited smart contracts" },
|
|
67882
|
-
{ type: "Impermanent Loss Risk" /* IMPERMANENT_LOSS */, value: 3 /* NON_CORRELATED */, weight: 33, reason: "
|
|
67883
|
-
{ type: "Market Risk" /* MARKET_RISK */, value: 4 /* HIGH_VOLATILITY */, weight: 33, reason: "
|
|
67958
|
+
{ type: "Impermanent Loss Risk" /* IMPERMANENT_LOSS */, value: 3 /* NON_CORRELATED */, weight: 33, reason: "Assets are not correlated, often volatile" },
|
|
67959
|
+
{ type: "Market Risk" /* MARKET_RISK */, value: 4 /* HIGH_VOLATILITY */, weight: 33, reason: "Assets are not correlated, relative volatile is often high" }
|
|
67884
67960
|
];
|
|
67885
67961
|
var mediumRisk = {
|
|
67886
67962
|
riskFactor: mediumVolatilityPoolRiskFactors,
|
|
@@ -67953,9 +68029,9 @@ ${JSON.stringify(data, null, 2)}`;
|
|
|
67953
68029
|
auditUrl: AUDIT_URL2,
|
|
67954
68030
|
maxTVL: Web3Number.fromWei("0", 18),
|
|
67955
68031
|
risk: {
|
|
67956
|
-
riskFactor:
|
|
67957
|
-
netRisk:
|
|
67958
|
-
notARisks: getNoRiskTags(
|
|
68032
|
+
riskFactor: _lstPoolRiskFactors,
|
|
68033
|
+
netRisk: _lstPoolRiskFactors.reduce((acc, curr) => acc + curr.value * curr.weight, 0) / _lstPoolRiskFactors.reduce((acc, curr) => acc + curr.weight, 0),
|
|
68034
|
+
notARisks: getNoRiskTags(_lstPoolRiskFactors)
|
|
67959
68035
|
},
|
|
67960
68036
|
apyMethodology: "APY based on 30-day historical performance, including fees and rewards.",
|
|
67961
68037
|
additionalInfo: {
|
|
@@ -68110,7 +68186,11 @@ ${JSON.stringify(data, null, 2)}`;
|
|
|
68110
68186
|
Global.getDefaultTokens().find((t) => t.symbol === "USDC"),
|
|
68111
68187
|
Global.getDefaultTokens().find((t) => t.symbol === "USDT")
|
|
68112
68188
|
],
|
|
68113
|
-
risk:
|
|
68189
|
+
risk: {
|
|
68190
|
+
riskFactor: _stableCoinPoolRiskFactors,
|
|
68191
|
+
netRisk: _stableCoinPoolRiskFactors.reduce((acc, curr) => acc + curr.value * curr.weight, 0) / _stableCoinPoolRiskFactors.reduce((acc, curr) => acc + curr.weight, 0),
|
|
68192
|
+
notARisks: getNoRiskTags(_stableCoinPoolRiskFactors)
|
|
68193
|
+
}
|
|
68114
68194
|
},
|
|
68115
68195
|
{
|
|
68116
68196
|
...ETHUSDCRe7Strategy,
|
|
@@ -70288,6 +70368,7 @@ ${JSON.stringify(data, null, 2)}`;
|
|
|
70288
70368
|
|
|
70289
70369
|
// src/strategies/universal-adapters/adapter-utils.ts
|
|
70290
70370
|
var SIMPLE_SANITIZER = ContractAddr.from("0x5a2e3ceb3da368b983a8717898427ab7b6daf04014b70f321e777f9aad940b4");
|
|
70371
|
+
var SIMPLE_SANITIZER_V2 = ContractAddr.from("0x5643d54da70a471cd2b6fa37f52ea7a13cc3f3910689a839f8490a663d2208a");
|
|
70291
70372
|
var PRICE_ROUTER = ContractAddr.from("0x05e83Fa38D791d2dba8E6f487758A9687FfEe191A6Cf8a6c5761ab0a110DB837");
|
|
70292
70373
|
var AVNU_MIDDLEWARE = ContractAddr.from("0x4a7972ed3f5d1e74a6d6c4a8f467666953d081c8f2270390cc169d50d17cb0d");
|
|
70293
70374
|
function toBigInt3(value) {
|
|
@@ -70302,13 +70383,13 @@ ${JSON.stringify(data, null, 2)}`;
|
|
|
70302
70383
|
|
|
70303
70384
|
// src/strategies/universal-adapters/baseAdapter.ts
|
|
70304
70385
|
var BaseAdapter = class extends CacheClass {
|
|
70305
|
-
constructSimpleLeafData(params) {
|
|
70386
|
+
constructSimpleLeafData(params, sanitizer = SIMPLE_SANITIZER) {
|
|
70306
70387
|
const { id, target, method, packedArguments } = params;
|
|
70307
70388
|
return {
|
|
70308
70389
|
id: BigInt(num_exports.getDecimalString(shortString_exports.encodeShortString(id))),
|
|
70309
70390
|
readableId: id,
|
|
70310
70391
|
data: [
|
|
70311
|
-
|
|
70392
|
+
sanitizer.toBigInt(),
|
|
70312
70393
|
// sanitizer address
|
|
70313
70394
|
target.toBigInt(),
|
|
70314
70395
|
// contract
|
|
@@ -72743,6 +72824,483 @@ ${JSON.stringify(data, null, 2)}`;
|
|
|
72743
72824
|
}
|
|
72744
72825
|
];
|
|
72745
72826
|
|
|
72827
|
+
// src/data/vesu-multiple.abi.json
|
|
72828
|
+
var vesu_multiple_abi_default = [
|
|
72829
|
+
{
|
|
72830
|
+
type: "impl",
|
|
72831
|
+
name: "LockerImpl",
|
|
72832
|
+
interface_name: "ekubo::interfaces::core::ILocker"
|
|
72833
|
+
},
|
|
72834
|
+
{
|
|
72835
|
+
type: "struct",
|
|
72836
|
+
name: "core::array::Span::<core::felt252>",
|
|
72837
|
+
members: [
|
|
72838
|
+
{
|
|
72839
|
+
name: "snapshot",
|
|
72840
|
+
type: "@core::array::Array::<core::felt252>"
|
|
72841
|
+
}
|
|
72842
|
+
]
|
|
72843
|
+
},
|
|
72844
|
+
{
|
|
72845
|
+
type: "interface",
|
|
72846
|
+
name: "ekubo::interfaces::core::ILocker",
|
|
72847
|
+
items: [
|
|
72848
|
+
{
|
|
72849
|
+
type: "function",
|
|
72850
|
+
name: "locked",
|
|
72851
|
+
inputs: [
|
|
72852
|
+
{
|
|
72853
|
+
name: "id",
|
|
72854
|
+
type: "core::integer::u32"
|
|
72855
|
+
},
|
|
72856
|
+
{
|
|
72857
|
+
name: "data",
|
|
72858
|
+
type: "core::array::Span::<core::felt252>"
|
|
72859
|
+
}
|
|
72860
|
+
],
|
|
72861
|
+
outputs: [
|
|
72862
|
+
{
|
|
72863
|
+
type: "core::array::Span::<core::felt252>"
|
|
72864
|
+
}
|
|
72865
|
+
],
|
|
72866
|
+
state_mutability: "external"
|
|
72867
|
+
}
|
|
72868
|
+
]
|
|
72869
|
+
},
|
|
72870
|
+
{
|
|
72871
|
+
type: "impl",
|
|
72872
|
+
name: "MultiplyImpl",
|
|
72873
|
+
interface_name: "vesu_periphery::multiply::IMultiply"
|
|
72874
|
+
},
|
|
72875
|
+
{
|
|
72876
|
+
type: "struct",
|
|
72877
|
+
name: "ekubo::types::keys::PoolKey",
|
|
72878
|
+
members: [
|
|
72879
|
+
{
|
|
72880
|
+
name: "token0",
|
|
72881
|
+
type: "core::starknet::contract_address::ContractAddress"
|
|
72882
|
+
},
|
|
72883
|
+
{
|
|
72884
|
+
name: "token1",
|
|
72885
|
+
type: "core::starknet::contract_address::ContractAddress"
|
|
72886
|
+
},
|
|
72887
|
+
{
|
|
72888
|
+
name: "fee",
|
|
72889
|
+
type: "core::integer::u128"
|
|
72890
|
+
},
|
|
72891
|
+
{
|
|
72892
|
+
name: "tick_spacing",
|
|
72893
|
+
type: "core::integer::u128"
|
|
72894
|
+
},
|
|
72895
|
+
{
|
|
72896
|
+
name: "extension",
|
|
72897
|
+
type: "core::starknet::contract_address::ContractAddress"
|
|
72898
|
+
}
|
|
72899
|
+
]
|
|
72900
|
+
},
|
|
72901
|
+
{
|
|
72902
|
+
type: "struct",
|
|
72903
|
+
name: "core::integer::u256",
|
|
72904
|
+
members: [
|
|
72905
|
+
{
|
|
72906
|
+
name: "low",
|
|
72907
|
+
type: "core::integer::u128"
|
|
72908
|
+
},
|
|
72909
|
+
{
|
|
72910
|
+
name: "high",
|
|
72911
|
+
type: "core::integer::u128"
|
|
72912
|
+
}
|
|
72913
|
+
]
|
|
72914
|
+
},
|
|
72915
|
+
{
|
|
72916
|
+
type: "struct",
|
|
72917
|
+
name: "vesu_periphery::swap::RouteNode",
|
|
72918
|
+
members: [
|
|
72919
|
+
{
|
|
72920
|
+
name: "pool_key",
|
|
72921
|
+
type: "ekubo::types::keys::PoolKey"
|
|
72922
|
+
},
|
|
72923
|
+
{
|
|
72924
|
+
name: "sqrt_ratio_limit",
|
|
72925
|
+
type: "core::integer::u256"
|
|
72926
|
+
},
|
|
72927
|
+
{
|
|
72928
|
+
name: "skip_ahead",
|
|
72929
|
+
type: "core::integer::u128"
|
|
72930
|
+
}
|
|
72931
|
+
]
|
|
72932
|
+
},
|
|
72933
|
+
{
|
|
72934
|
+
type: "enum",
|
|
72935
|
+
name: "core::bool",
|
|
72936
|
+
variants: [
|
|
72937
|
+
{
|
|
72938
|
+
name: "False",
|
|
72939
|
+
type: "()"
|
|
72940
|
+
},
|
|
72941
|
+
{
|
|
72942
|
+
name: "True",
|
|
72943
|
+
type: "()"
|
|
72944
|
+
}
|
|
72945
|
+
]
|
|
72946
|
+
},
|
|
72947
|
+
{
|
|
72948
|
+
type: "struct",
|
|
72949
|
+
name: "ekubo::types::i129::i129",
|
|
72950
|
+
members: [
|
|
72951
|
+
{
|
|
72952
|
+
name: "mag",
|
|
72953
|
+
type: "core::integer::u128"
|
|
72954
|
+
},
|
|
72955
|
+
{
|
|
72956
|
+
name: "sign",
|
|
72957
|
+
type: "core::bool"
|
|
72958
|
+
}
|
|
72959
|
+
]
|
|
72960
|
+
},
|
|
72961
|
+
{
|
|
72962
|
+
type: "struct",
|
|
72963
|
+
name: "vesu_periphery::swap::TokenAmount",
|
|
72964
|
+
members: [
|
|
72965
|
+
{
|
|
72966
|
+
name: "token",
|
|
72967
|
+
type: "core::starknet::contract_address::ContractAddress"
|
|
72968
|
+
},
|
|
72969
|
+
{
|
|
72970
|
+
name: "amount",
|
|
72971
|
+
type: "ekubo::types::i129::i129"
|
|
72972
|
+
}
|
|
72973
|
+
]
|
|
72974
|
+
},
|
|
72975
|
+
{
|
|
72976
|
+
type: "struct",
|
|
72977
|
+
name: "vesu_periphery::swap::Swap",
|
|
72978
|
+
members: [
|
|
72979
|
+
{
|
|
72980
|
+
name: "route",
|
|
72981
|
+
type: "core::array::Array::<vesu_periphery::swap::RouteNode>"
|
|
72982
|
+
},
|
|
72983
|
+
{
|
|
72984
|
+
name: "token_amount",
|
|
72985
|
+
type: "vesu_periphery::swap::TokenAmount"
|
|
72986
|
+
}
|
|
72987
|
+
]
|
|
72988
|
+
},
|
|
72989
|
+
{
|
|
72990
|
+
type: "struct",
|
|
72991
|
+
name: "vesu_periphery::multiply::IncreaseLeverParams",
|
|
72992
|
+
members: [
|
|
72993
|
+
{
|
|
72994
|
+
name: "pool_id",
|
|
72995
|
+
type: "core::felt252"
|
|
72996
|
+
},
|
|
72997
|
+
{
|
|
72998
|
+
name: "collateral_asset",
|
|
72999
|
+
type: "core::starknet::contract_address::ContractAddress"
|
|
73000
|
+
},
|
|
73001
|
+
{
|
|
73002
|
+
name: "debt_asset",
|
|
73003
|
+
type: "core::starknet::contract_address::ContractAddress"
|
|
73004
|
+
},
|
|
73005
|
+
{
|
|
73006
|
+
name: "user",
|
|
73007
|
+
type: "core::starknet::contract_address::ContractAddress"
|
|
73008
|
+
},
|
|
73009
|
+
{
|
|
73010
|
+
name: "add_margin",
|
|
73011
|
+
type: "core::integer::u128"
|
|
73012
|
+
},
|
|
73013
|
+
{
|
|
73014
|
+
name: "margin_swap",
|
|
73015
|
+
type: "core::array::Array::<vesu_periphery::swap::Swap>"
|
|
73016
|
+
},
|
|
73017
|
+
{
|
|
73018
|
+
name: "margin_swap_limit_amount",
|
|
73019
|
+
type: "core::integer::u128"
|
|
73020
|
+
},
|
|
73021
|
+
{
|
|
73022
|
+
name: "lever_swap",
|
|
73023
|
+
type: "core::array::Array::<vesu_periphery::swap::Swap>"
|
|
73024
|
+
},
|
|
73025
|
+
{
|
|
73026
|
+
name: "lever_swap_limit_amount",
|
|
73027
|
+
type: "core::integer::u128"
|
|
73028
|
+
}
|
|
73029
|
+
]
|
|
73030
|
+
},
|
|
73031
|
+
{
|
|
73032
|
+
type: "struct",
|
|
73033
|
+
name: "vesu_periphery::multiply::DecreaseLeverParams",
|
|
73034
|
+
members: [
|
|
73035
|
+
{
|
|
73036
|
+
name: "pool_id",
|
|
73037
|
+
type: "core::felt252"
|
|
73038
|
+
},
|
|
73039
|
+
{
|
|
73040
|
+
name: "collateral_asset",
|
|
73041
|
+
type: "core::starknet::contract_address::ContractAddress"
|
|
73042
|
+
},
|
|
73043
|
+
{
|
|
73044
|
+
name: "debt_asset",
|
|
73045
|
+
type: "core::starknet::contract_address::ContractAddress"
|
|
73046
|
+
},
|
|
73047
|
+
{
|
|
73048
|
+
name: "user",
|
|
73049
|
+
type: "core::starknet::contract_address::ContractAddress"
|
|
73050
|
+
},
|
|
73051
|
+
{
|
|
73052
|
+
name: "sub_margin",
|
|
73053
|
+
type: "core::integer::u128"
|
|
73054
|
+
},
|
|
73055
|
+
{
|
|
73056
|
+
name: "recipient",
|
|
73057
|
+
type: "core::starknet::contract_address::ContractAddress"
|
|
73058
|
+
},
|
|
73059
|
+
{
|
|
73060
|
+
name: "lever_swap",
|
|
73061
|
+
type: "core::array::Array::<vesu_periphery::swap::Swap>"
|
|
73062
|
+
},
|
|
73063
|
+
{
|
|
73064
|
+
name: "lever_swap_limit_amount",
|
|
73065
|
+
type: "core::integer::u128"
|
|
73066
|
+
},
|
|
73067
|
+
{
|
|
73068
|
+
name: "lever_swap_weights",
|
|
73069
|
+
type: "core::array::Array::<core::integer::u128>"
|
|
73070
|
+
},
|
|
73071
|
+
{
|
|
73072
|
+
name: "withdraw_swap",
|
|
73073
|
+
type: "core::array::Array::<vesu_periphery::swap::Swap>"
|
|
73074
|
+
},
|
|
73075
|
+
{
|
|
73076
|
+
name: "withdraw_swap_limit_amount",
|
|
73077
|
+
type: "core::integer::u128"
|
|
73078
|
+
},
|
|
73079
|
+
{
|
|
73080
|
+
name: "withdraw_swap_weights",
|
|
73081
|
+
type: "core::array::Array::<core::integer::u128>"
|
|
73082
|
+
},
|
|
73083
|
+
{
|
|
73084
|
+
name: "close_position",
|
|
73085
|
+
type: "core::bool"
|
|
73086
|
+
}
|
|
73087
|
+
]
|
|
73088
|
+
},
|
|
73089
|
+
{
|
|
73090
|
+
type: "enum",
|
|
73091
|
+
name: "vesu_periphery::multiply::ModifyLeverAction",
|
|
73092
|
+
variants: [
|
|
73093
|
+
{
|
|
73094
|
+
name: "IncreaseLever",
|
|
73095
|
+
type: "vesu_periphery::multiply::IncreaseLeverParams"
|
|
73096
|
+
},
|
|
73097
|
+
{
|
|
73098
|
+
name: "DecreaseLever",
|
|
73099
|
+
type: "vesu_periphery::multiply::DecreaseLeverParams"
|
|
73100
|
+
}
|
|
73101
|
+
]
|
|
73102
|
+
},
|
|
73103
|
+
{
|
|
73104
|
+
type: "struct",
|
|
73105
|
+
name: "vesu_periphery::multiply::ModifyLeverParams",
|
|
73106
|
+
members: [
|
|
73107
|
+
{
|
|
73108
|
+
name: "action",
|
|
73109
|
+
type: "vesu_periphery::multiply::ModifyLeverAction"
|
|
73110
|
+
}
|
|
73111
|
+
]
|
|
73112
|
+
},
|
|
73113
|
+
{
|
|
73114
|
+
type: "struct",
|
|
73115
|
+
name: "alexandria_math::i257::i257",
|
|
73116
|
+
members: [
|
|
73117
|
+
{
|
|
73118
|
+
name: "abs",
|
|
73119
|
+
type: "core::integer::u256"
|
|
73120
|
+
},
|
|
73121
|
+
{
|
|
73122
|
+
name: "is_negative",
|
|
73123
|
+
type: "core::bool"
|
|
73124
|
+
}
|
|
73125
|
+
]
|
|
73126
|
+
},
|
|
73127
|
+
{
|
|
73128
|
+
type: "struct",
|
|
73129
|
+
name: "vesu_periphery::multiply::ModifyLeverResponse",
|
|
73130
|
+
members: [
|
|
73131
|
+
{
|
|
73132
|
+
name: "collateral_delta",
|
|
73133
|
+
type: "alexandria_math::i257::i257"
|
|
73134
|
+
},
|
|
73135
|
+
{
|
|
73136
|
+
name: "debt_delta",
|
|
73137
|
+
type: "alexandria_math::i257::i257"
|
|
73138
|
+
},
|
|
73139
|
+
{
|
|
73140
|
+
name: "margin_delta",
|
|
73141
|
+
type: "alexandria_math::i257::i257"
|
|
73142
|
+
}
|
|
73143
|
+
]
|
|
73144
|
+
},
|
|
73145
|
+
{
|
|
73146
|
+
type: "interface",
|
|
73147
|
+
name: "vesu_periphery::multiply::IMultiply",
|
|
73148
|
+
items: [
|
|
73149
|
+
{
|
|
73150
|
+
type: "function",
|
|
73151
|
+
name: "modify_lever",
|
|
73152
|
+
inputs: [
|
|
73153
|
+
{
|
|
73154
|
+
name: "modify_lever_params",
|
|
73155
|
+
type: "vesu_periphery::multiply::ModifyLeverParams"
|
|
73156
|
+
}
|
|
73157
|
+
],
|
|
73158
|
+
outputs: [
|
|
73159
|
+
{
|
|
73160
|
+
type: "vesu_periphery::multiply::ModifyLeverResponse"
|
|
73161
|
+
}
|
|
73162
|
+
],
|
|
73163
|
+
state_mutability: "external"
|
|
73164
|
+
}
|
|
73165
|
+
]
|
|
73166
|
+
},
|
|
73167
|
+
{
|
|
73168
|
+
type: "struct",
|
|
73169
|
+
name: "ekubo::interfaces::core::ICoreDispatcher",
|
|
73170
|
+
members: [
|
|
73171
|
+
{
|
|
73172
|
+
name: "contract_address",
|
|
73173
|
+
type: "core::starknet::contract_address::ContractAddress"
|
|
73174
|
+
}
|
|
73175
|
+
]
|
|
73176
|
+
},
|
|
73177
|
+
{
|
|
73178
|
+
type: "struct",
|
|
73179
|
+
name: "vesu::singleton::ISingletonDispatcher",
|
|
73180
|
+
members: [
|
|
73181
|
+
{
|
|
73182
|
+
name: "contract_address",
|
|
73183
|
+
type: "core::starknet::contract_address::ContractAddress"
|
|
73184
|
+
}
|
|
73185
|
+
]
|
|
73186
|
+
},
|
|
73187
|
+
{
|
|
73188
|
+
type: "constructor",
|
|
73189
|
+
name: "constructor",
|
|
73190
|
+
inputs: [
|
|
73191
|
+
{
|
|
73192
|
+
name: "core",
|
|
73193
|
+
type: "ekubo::interfaces::core::ICoreDispatcher"
|
|
73194
|
+
},
|
|
73195
|
+
{
|
|
73196
|
+
name: "singleton",
|
|
73197
|
+
type: "vesu::singleton::ISingletonDispatcher"
|
|
73198
|
+
}
|
|
73199
|
+
]
|
|
73200
|
+
},
|
|
73201
|
+
{
|
|
73202
|
+
type: "event",
|
|
73203
|
+
name: "vesu_periphery::multiply::Multiply::IncreaseLever",
|
|
73204
|
+
kind: "struct",
|
|
73205
|
+
members: [
|
|
73206
|
+
{
|
|
73207
|
+
name: "pool_id",
|
|
73208
|
+
type: "core::felt252",
|
|
73209
|
+
kind: "key"
|
|
73210
|
+
},
|
|
73211
|
+
{
|
|
73212
|
+
name: "collateral_asset",
|
|
73213
|
+
type: "core::starknet::contract_address::ContractAddress",
|
|
73214
|
+
kind: "key"
|
|
73215
|
+
},
|
|
73216
|
+
{
|
|
73217
|
+
name: "debt_asset",
|
|
73218
|
+
type: "core::starknet::contract_address::ContractAddress",
|
|
73219
|
+
kind: "key"
|
|
73220
|
+
},
|
|
73221
|
+
{
|
|
73222
|
+
name: "user",
|
|
73223
|
+
type: "core::starknet::contract_address::ContractAddress",
|
|
73224
|
+
kind: "key"
|
|
73225
|
+
},
|
|
73226
|
+
{
|
|
73227
|
+
name: "margin",
|
|
73228
|
+
type: "core::integer::u256",
|
|
73229
|
+
kind: "data"
|
|
73230
|
+
},
|
|
73231
|
+
{
|
|
73232
|
+
name: "collateral_delta",
|
|
73233
|
+
type: "core::integer::u256",
|
|
73234
|
+
kind: "data"
|
|
73235
|
+
},
|
|
73236
|
+
{
|
|
73237
|
+
name: "debt_delta",
|
|
73238
|
+
type: "core::integer::u256",
|
|
73239
|
+
kind: "data"
|
|
73240
|
+
}
|
|
73241
|
+
]
|
|
73242
|
+
},
|
|
73243
|
+
{
|
|
73244
|
+
type: "event",
|
|
73245
|
+
name: "vesu_periphery::multiply::Multiply::DecreaseLever",
|
|
73246
|
+
kind: "struct",
|
|
73247
|
+
members: [
|
|
73248
|
+
{
|
|
73249
|
+
name: "pool_id",
|
|
73250
|
+
type: "core::felt252",
|
|
73251
|
+
kind: "key"
|
|
73252
|
+
},
|
|
73253
|
+
{
|
|
73254
|
+
name: "collateral_asset",
|
|
73255
|
+
type: "core::starknet::contract_address::ContractAddress",
|
|
73256
|
+
kind: "key"
|
|
73257
|
+
},
|
|
73258
|
+
{
|
|
73259
|
+
name: "debt_asset",
|
|
73260
|
+
type: "core::starknet::contract_address::ContractAddress",
|
|
73261
|
+
kind: "key"
|
|
73262
|
+
},
|
|
73263
|
+
{
|
|
73264
|
+
name: "user",
|
|
73265
|
+
type: "core::starknet::contract_address::ContractAddress",
|
|
73266
|
+
kind: "key"
|
|
73267
|
+
},
|
|
73268
|
+
{
|
|
73269
|
+
name: "margin",
|
|
73270
|
+
type: "core::integer::u256",
|
|
73271
|
+
kind: "data"
|
|
73272
|
+
},
|
|
73273
|
+
{
|
|
73274
|
+
name: "collateral_delta",
|
|
73275
|
+
type: "core::integer::u256",
|
|
73276
|
+
kind: "data"
|
|
73277
|
+
},
|
|
73278
|
+
{
|
|
73279
|
+
name: "debt_delta",
|
|
73280
|
+
type: "core::integer::u256",
|
|
73281
|
+
kind: "data"
|
|
73282
|
+
}
|
|
73283
|
+
]
|
|
73284
|
+
},
|
|
73285
|
+
{
|
|
73286
|
+
type: "event",
|
|
73287
|
+
name: "vesu_periphery::multiply::Multiply::Event",
|
|
73288
|
+
kind: "enum",
|
|
73289
|
+
variants: [
|
|
73290
|
+
{
|
|
73291
|
+
name: "IncreaseLever",
|
|
73292
|
+
type: "vesu_periphery::multiply::Multiply::IncreaseLever",
|
|
73293
|
+
kind: "nested"
|
|
73294
|
+
},
|
|
73295
|
+
{
|
|
73296
|
+
name: "DecreaseLever",
|
|
73297
|
+
type: "vesu_periphery::multiply::Multiply::DecreaseLever",
|
|
73298
|
+
kind: "nested"
|
|
73299
|
+
}
|
|
73300
|
+
]
|
|
73301
|
+
}
|
|
73302
|
+
];
|
|
73303
|
+
|
|
72746
73304
|
// src/strategies/universal-adapters/vesu-adapter.ts
|
|
72747
73305
|
var VesuAmountType = /* @__PURE__ */ ((VesuAmountType2) => {
|
|
72748
73306
|
VesuAmountType2[VesuAmountType2["Delta"] = 0] = "Delta";
|
|
@@ -72754,13 +73312,115 @@ ${JSON.stringify(data, null, 2)}`;
|
|
|
72754
73312
|
VesuAmountDenomination2[VesuAmountDenomination2["Assets"] = 1] = "Assets";
|
|
72755
73313
|
return VesuAmountDenomination2;
|
|
72756
73314
|
})(VesuAmountDenomination || {});
|
|
73315
|
+
function getVesuMultiplyParams(isIncrease, params) {
|
|
73316
|
+
if (isIncrease) {
|
|
73317
|
+
const _params2 = params;
|
|
73318
|
+
return {
|
|
73319
|
+
action: new CairoCustomEnum({ IncreaseLever: {
|
|
73320
|
+
pool_id: _params2.pool_id.toBigInt(),
|
|
73321
|
+
collateral_asset: _params2.collateral_asset.toBigInt(),
|
|
73322
|
+
debt_asset: _params2.debt_asset.toBigInt(),
|
|
73323
|
+
user: _params2.user.toBigInt(),
|
|
73324
|
+
add_margin: BigInt(_params2.add_margin.toWei()),
|
|
73325
|
+
margin_swap: _params2.margin_swap.map((swap) => ({
|
|
73326
|
+
route: swap.route.map((route) => ({
|
|
73327
|
+
pool_key: {
|
|
73328
|
+
token0: route.pool_key.token0.toBigInt(),
|
|
73329
|
+
token1: route.pool_key.token1.toBigInt(),
|
|
73330
|
+
fee: route.pool_key.fee,
|
|
73331
|
+
tick_spacing: route.pool_key.tick_spacing,
|
|
73332
|
+
extension: BigInt(num_exports.hexToDecimalString(route.pool_key.extension))
|
|
73333
|
+
},
|
|
73334
|
+
sqrt_ratio_limit: uint256_exports.bnToUint256(route.sqrt_ratio_limit.toWei()),
|
|
73335
|
+
skip_ahead: BigInt(100)
|
|
73336
|
+
})),
|
|
73337
|
+
token_amount: {
|
|
73338
|
+
token: swap.token_amount.token.toBigInt(),
|
|
73339
|
+
amount: swap.token_amount.amount.toI129()
|
|
73340
|
+
}
|
|
73341
|
+
})),
|
|
73342
|
+
margin_swap_limit_amount: BigInt(_params2.margin_swap_limit_amount.toWei()),
|
|
73343
|
+
lever_swap: _params2.lever_swap.map((swap) => ({
|
|
73344
|
+
route: swap.route.map((route) => ({
|
|
73345
|
+
pool_key: {
|
|
73346
|
+
token0: route.pool_key.token0.toBigInt(),
|
|
73347
|
+
token1: route.pool_key.token1.toBigInt(),
|
|
73348
|
+
fee: route.pool_key.fee,
|
|
73349
|
+
tick_spacing: route.pool_key.tick_spacing,
|
|
73350
|
+
extension: BigInt(num_exports.hexToDecimalString(route.pool_key.extension))
|
|
73351
|
+
},
|
|
73352
|
+
sqrt_ratio_limit: uint256_exports.bnToUint256(route.sqrt_ratio_limit.toWei()),
|
|
73353
|
+
skip_ahead: BigInt(100)
|
|
73354
|
+
})),
|
|
73355
|
+
token_amount: {
|
|
73356
|
+
token: swap.token_amount.token.toBigInt(),
|
|
73357
|
+
amount: swap.token_amount.amount.toI129()
|
|
73358
|
+
}
|
|
73359
|
+
})),
|
|
73360
|
+
lever_swap_limit_amount: BigInt(_params2.lever_swap_limit_amount.toWei())
|
|
73361
|
+
} })
|
|
73362
|
+
};
|
|
73363
|
+
}
|
|
73364
|
+
const _params = params;
|
|
73365
|
+
return {
|
|
73366
|
+
action: new CairoCustomEnum({ DecreaseLever: {
|
|
73367
|
+
pool_id: _params.pool_id.toBigInt(),
|
|
73368
|
+
collateral_asset: _params.collateral_asset.toBigInt(),
|
|
73369
|
+
debt_asset: _params.debt_asset.toBigInt(),
|
|
73370
|
+
user: _params.user.toBigInt(),
|
|
73371
|
+
sub_margin: BigInt(_params.sub_margin.toWei()),
|
|
73372
|
+
recipient: _params.recipient.toBigInt(),
|
|
73373
|
+
lever_swap: _params.lever_swap.map((swap) => ({
|
|
73374
|
+
route: swap.route.map((route) => ({
|
|
73375
|
+
pool_key: {
|
|
73376
|
+
token0: route.pool_key.token0.toBigInt(),
|
|
73377
|
+
token1: route.pool_key.token1.toBigInt(),
|
|
73378
|
+
fee: route.pool_key.fee,
|
|
73379
|
+
tick_spacing: route.pool_key.tick_spacing,
|
|
73380
|
+
extension: ContractAddr.from(route.pool_key.extension).toBigInt()
|
|
73381
|
+
},
|
|
73382
|
+
sqrt_ratio_limit: uint256_exports.bnToUint256(route.sqrt_ratio_limit.toWei()),
|
|
73383
|
+
skip_ahead: BigInt(route.skip_ahead.toWei())
|
|
73384
|
+
})),
|
|
73385
|
+
token_amount: {
|
|
73386
|
+
token: swap.token_amount.token.toBigInt(),
|
|
73387
|
+
amount: swap.token_amount.amount.toI129()
|
|
73388
|
+
}
|
|
73389
|
+
})),
|
|
73390
|
+
lever_swap_limit_amount: BigInt(_params.lever_swap_limit_amount.toWei()),
|
|
73391
|
+
lever_swap_weights: _params.lever_swap_weights.map((weight) => BigInt(weight.toWei())),
|
|
73392
|
+
withdraw_swap: _params.withdraw_swap.map((swap) => ({
|
|
73393
|
+
route: swap.route.map((route) => ({
|
|
73394
|
+
pool_key: {
|
|
73395
|
+
token0: route.pool_key.token0.toBigInt(),
|
|
73396
|
+
token1: route.pool_key.token1.toBigInt(),
|
|
73397
|
+
fee: route.pool_key.fee,
|
|
73398
|
+
tick_spacing: route.pool_key.tick_spacing,
|
|
73399
|
+
extension: ContractAddr.from(route.pool_key.extension).toBigInt()
|
|
73400
|
+
},
|
|
73401
|
+
sqrt_ratio_limit: uint256_exports.bnToUint256(route.sqrt_ratio_limit.toWei()),
|
|
73402
|
+
skip_ahead: BigInt(route.skip_ahead.toWei())
|
|
73403
|
+
})),
|
|
73404
|
+
token_amount: {
|
|
73405
|
+
token: swap.token_amount.token.toBigInt(),
|
|
73406
|
+
amount: swap.token_amount.amount.toI129()
|
|
73407
|
+
}
|
|
73408
|
+
})),
|
|
73409
|
+
withdraw_swap_limit_amount: BigInt(_params.withdraw_swap_limit_amount.toWei()),
|
|
73410
|
+
withdraw_swap_weights: _params.withdraw_swap_weights.map((weight) => BigInt(weight.toWei())),
|
|
73411
|
+
close_position: _params.close_position
|
|
73412
|
+
} })
|
|
73413
|
+
};
|
|
73414
|
+
}
|
|
72757
73415
|
var VesuPools = {
|
|
72758
|
-
Genesis: ContractAddr.from("0x4dc4f0ca6ea4961e4c8373265bfd5317678f4fe374d76f3fd7135f57763bf28")
|
|
73416
|
+
Genesis: ContractAddr.from("0x4dc4f0ca6ea4961e4c8373265bfd5317678f4fe374d76f3fd7135f57763bf28"),
|
|
73417
|
+
Re7xSTRK: ContractAddr.from("0x052fb52363939c3aa848f8f4ac28f0a51379f8d1b971d8444de25fbd77d8f161")
|
|
72759
73418
|
};
|
|
72760
73419
|
var VesuAdapter = class _VesuAdapter extends BaseAdapter {
|
|
72761
73420
|
constructor(config3) {
|
|
72762
73421
|
super();
|
|
72763
73422
|
this.VESU_SINGLETON = ContractAddr.from("0x000d8d6dfec4d33bfb6895de9f3852143a17c6f92fd2a21da3d6924d34870160");
|
|
73423
|
+
this.VESU_MULTIPLY = ContractAddr.from("0x3630f1f8e5b8f5c4c4ae9b6620f8a570ae55cddebc0276c37550e7c118edf67");
|
|
72764
73424
|
this.getModifyPosition = () => {
|
|
72765
73425
|
const positionData = [0n];
|
|
72766
73426
|
const packedArguments = [
|
|
@@ -72825,6 +73485,88 @@ ${JSON.stringify(data, null, 2)}`;
|
|
|
72825
73485
|
}
|
|
72826
73486
|
};
|
|
72827
73487
|
};
|
|
73488
|
+
this.getMultiplyAdapter = () => {
|
|
73489
|
+
const packedArguments = [
|
|
73490
|
+
toBigInt3(this.config.poolId.toString()),
|
|
73491
|
+
// pool id
|
|
73492
|
+
toBigInt3(this.config.collateral.address.toString()),
|
|
73493
|
+
// collateral
|
|
73494
|
+
toBigInt3(this.config.debt.address.toString()),
|
|
73495
|
+
// debt
|
|
73496
|
+
toBigInt3(this.config.vaultAllocator.toString())
|
|
73497
|
+
// vault allocator
|
|
73498
|
+
];
|
|
73499
|
+
const output = this.constructSimpleLeafData({
|
|
73500
|
+
id: this.config.id,
|
|
73501
|
+
target: this.VESU_MULTIPLY,
|
|
73502
|
+
method: "modify_lever",
|
|
73503
|
+
packedArguments
|
|
73504
|
+
}, SIMPLE_SANITIZER_V2);
|
|
73505
|
+
return { leaf: output, callConstructor: this.getMultiplyCall.bind(this) };
|
|
73506
|
+
};
|
|
73507
|
+
this.getMultiplyCall = (params) => {
|
|
73508
|
+
const isIncrease = params.isIncrease;
|
|
73509
|
+
const multiplyParams = isIncrease ? params.increaseParams : params.decreaseParams;
|
|
73510
|
+
if (!multiplyParams) {
|
|
73511
|
+
throw new Error("Multiply params are not provided");
|
|
73512
|
+
}
|
|
73513
|
+
const multiplyContract = new Contract({ abi: vesu_multiple_abi_default, address: this.VESU_MULTIPLY.toString(), providerOrAccount: new RpcProvider2({ nodeUrl: "" }) });
|
|
73514
|
+
const call = multiplyContract.populate("modify_lever", {
|
|
73515
|
+
modify_lever_params: getVesuMultiplyParams(isIncrease, {
|
|
73516
|
+
...multiplyParams,
|
|
73517
|
+
user: this.config.vaultAllocator,
|
|
73518
|
+
pool_id: this.config.poolId,
|
|
73519
|
+
collateral_asset: this.config.collateral.address,
|
|
73520
|
+
debt_asset: this.config.debt.address,
|
|
73521
|
+
recipient: this.config.vaultAllocator
|
|
73522
|
+
})
|
|
73523
|
+
});
|
|
73524
|
+
return {
|
|
73525
|
+
sanitizer: SIMPLE_SANITIZER_V2,
|
|
73526
|
+
call: {
|
|
73527
|
+
contractAddress: this.VESU_MULTIPLY,
|
|
73528
|
+
selector: hash_exports.getSelectorFromName("modify_lever"),
|
|
73529
|
+
calldata: [
|
|
73530
|
+
...call.calldata
|
|
73531
|
+
]
|
|
73532
|
+
}
|
|
73533
|
+
};
|
|
73534
|
+
};
|
|
73535
|
+
this.getVesuModifyDelegationAdapter = (id) => {
|
|
73536
|
+
return () => {
|
|
73537
|
+
const packedArguments = [
|
|
73538
|
+
toBigInt3(this.config.poolId.toString()),
|
|
73539
|
+
// pool id
|
|
73540
|
+
toBigInt3(this.VESU_MULTIPLY.toString())
|
|
73541
|
+
// vault allocator
|
|
73542
|
+
];
|
|
73543
|
+
const output = this.constructSimpleLeafData({
|
|
73544
|
+
id,
|
|
73545
|
+
target: this.VESU_SINGLETON,
|
|
73546
|
+
method: "modify_delegation",
|
|
73547
|
+
packedArguments
|
|
73548
|
+
}, SIMPLE_SANITIZER_V2);
|
|
73549
|
+
return { leaf: output, callConstructor: this.getVesuModifyDelegationCall.bind(this) };
|
|
73550
|
+
};
|
|
73551
|
+
};
|
|
73552
|
+
this.getVesuModifyDelegationCall = (params) => {
|
|
73553
|
+
const singletonContract = new Contract({ abi: vesu_singleton_abi_default, address: this.VESU_SINGLETON.toString(), providerOrAccount: new RpcProvider2({ nodeUrl: "" }) });
|
|
73554
|
+
const call = singletonContract.populate("modify_delegation", {
|
|
73555
|
+
pool_id: this.config.poolId.toBigInt(),
|
|
73556
|
+
delegatee: this.VESU_MULTIPLY.toBigInt(),
|
|
73557
|
+
delegation: params.delegation
|
|
73558
|
+
});
|
|
73559
|
+
return {
|
|
73560
|
+
sanitizer: SIMPLE_SANITIZER_V2,
|
|
73561
|
+
call: {
|
|
73562
|
+
contractAddress: this.VESU_SINGLETON,
|
|
73563
|
+
selector: hash_exports.getSelectorFromName("modify_delegation"),
|
|
73564
|
+
calldata: [
|
|
73565
|
+
...call.calldata
|
|
73566
|
+
]
|
|
73567
|
+
}
|
|
73568
|
+
};
|
|
73569
|
+
};
|
|
72828
73570
|
this.getDefispringRewardsAdapter = (id) => {
|
|
72829
73571
|
return () => {
|
|
72830
73572
|
const packedArguments = [];
|
|
@@ -75245,10 +75987,10 @@ ${JSON.stringify(data, null, 2)}`;
|
|
|
75245
75987
|
|
|
75246
75988
|
// src/strategies/universal-strategy.tsx
|
|
75247
75989
|
var import_jsx_runtime4 = __toESM(require_jsx_runtime());
|
|
75248
|
-
var AUMTypes = /* @__PURE__ */ ((
|
|
75249
|
-
|
|
75250
|
-
|
|
75251
|
-
return
|
|
75990
|
+
var AUMTypes = /* @__PURE__ */ ((AUMTypes3) => {
|
|
75991
|
+
AUMTypes3["FINALISED"] = "finalised";
|
|
75992
|
+
AUMTypes3["DEFISPRING"] = "defispring";
|
|
75993
|
+
return AUMTypes3;
|
|
75252
75994
|
})(AUMTypes || {});
|
|
75253
75995
|
var UniversalStrategy = class _UniversalStrategy extends BaseStrategy {
|
|
75254
75996
|
constructor(config3, pricer, metadata) {
|
|
@@ -75376,24 +76118,42 @@ ${JSON.stringify(data, null, 2)}`;
|
|
|
75376
76118
|
* @returns {Promise<number>} The weighted average APY across all pools
|
|
75377
76119
|
*/
|
|
75378
76120
|
async netAPY() {
|
|
75379
|
-
|
|
75380
|
-
|
|
75381
|
-
|
|
75382
|
-
|
|
75383
|
-
|
|
76121
|
+
if (this.metadata.isPreview) {
|
|
76122
|
+
return { net: 0, splits: [{
|
|
76123
|
+
apy: 0,
|
|
76124
|
+
id: "base"
|
|
76125
|
+
}, {
|
|
76126
|
+
apy: 0,
|
|
76127
|
+
id: "defispring"
|
|
76128
|
+
}] };
|
|
76129
|
+
}
|
|
76130
|
+
const prevAUM = await this.getPrevAUM();
|
|
76131
|
+
const vesuAdapters = this.getVesuAdapters();
|
|
76132
|
+
const allVesuPools = await VesuAdapter.getVesuPools();
|
|
76133
|
+
const pools = vesuAdapters.map((vesuAdapter) => {
|
|
76134
|
+
return allVesuPools.pools.find((p) => vesuAdapter.config.poolId.eqString(num_exports.getHexString(p.id)));
|
|
76135
|
+
});
|
|
76136
|
+
logger2.verbose(`${this.metadata.name}::netAPY: vesu-pools: ${JSON.stringify(pools)}`);
|
|
76137
|
+
if (pools.some((p) => !p)) {
|
|
75384
76138
|
throw new Error("Pool not found");
|
|
75385
76139
|
}
|
|
75386
76140
|
;
|
|
75387
|
-
const
|
|
75388
|
-
const debtAsset1 = pool1.assets.find((a) => a.symbol === vesuAdapter1.config.debt.symbol)?.stats;
|
|
75389
|
-
const collateralAsset2 = pool2.assets.find((a) => a.symbol === vesuAdapter2.config.collateral.symbol)?.stats;
|
|
75390
|
-
const debtAsset2 = pool2.assets.find((a) => a.symbol === vesuAdapter2.config.debt.symbol)?.stats;
|
|
75391
|
-
const collateral1APY = Number(collateralAsset1.supplyApy.value) / 1e18;
|
|
75392
|
-
const debt1APY = Number(debtAsset1.borrowApr.value) / 1e18;
|
|
75393
|
-
const collateral2APY = Number(collateralAsset2.supplyApy.value) / 1e18;
|
|
75394
|
-
const debt2APY = Number(debtAsset2.borrowApr.value) / 1e18;
|
|
75395
|
-
const positions = await this.getVaultPositions();
|
|
76141
|
+
const positions = await this.getVesuPositions();
|
|
75396
76142
|
logger2.verbose(`${this.metadata.name}::netAPY: positions: ${JSON.stringify(positions)}`);
|
|
76143
|
+
const baseAPYs = [];
|
|
76144
|
+
const rewardAPYs = [];
|
|
76145
|
+
for (const [index, pool] of pools.entries()) {
|
|
76146
|
+
const vesuAdapter = vesuAdapters[index];
|
|
76147
|
+
const collateralAsset = pool.assets.find((a) => a.symbol === vesuAdapter.config.collateral.symbol)?.stats;
|
|
76148
|
+
const debtAsset = pool.assets.find((a) => a.symbol === vesuAdapter.config.debt.symbol)?.stats;
|
|
76149
|
+
const supplyApy = Number(collateralAsset.supplyApy.value || 0) / 1e18;
|
|
76150
|
+
const lstAPY = Number(collateralAsset.lstApr?.value || 0) / 1e18;
|
|
76151
|
+
baseAPYs.push(...[supplyApy + lstAPY, Number(debtAsset.borrowApr.value) / 1e18]);
|
|
76152
|
+
rewardAPYs.push(...[Number(collateralAsset.defiSpringSupplyApr.value || "0") / 1e18, 0]);
|
|
76153
|
+
}
|
|
76154
|
+
logger2.verbose(`${this.metadata.name}::netAPY: baseAPYs: ${JSON.stringify(baseAPYs)}`);
|
|
76155
|
+
logger2.verbose(`${this.metadata.name}::netAPY: rewardAPYs: ${JSON.stringify(rewardAPYs)}`);
|
|
76156
|
+
assert3(baseAPYs.length == positions.length, "APYs and positions length mismatch");
|
|
75397
76157
|
if (positions.every((p) => p.amount.isZero())) {
|
|
75398
76158
|
return { net: 0, splits: [{
|
|
75399
76159
|
apy: 0,
|
|
@@ -75404,11 +76164,10 @@ ${JSON.stringify(data, null, 2)}`;
|
|
|
75404
76164
|
}] };
|
|
75405
76165
|
}
|
|
75406
76166
|
const weights = positions.map((p, index) => p.usdValue * (index % 2 == 0 ? 1 : -1));
|
|
75407
|
-
const
|
|
75408
|
-
|
|
75409
|
-
const
|
|
75410
|
-
const
|
|
75411
|
-
const rewardAPY = this.computeAPY(rewardAPYs, weights);
|
|
76167
|
+
const price = await this.pricer.getPrice(this.metadata.depositTokens[0].symbol);
|
|
76168
|
+
const prevAUMUSD = prevAUM.multipliedBy(price.price);
|
|
76169
|
+
const baseAPY = this.computeAPY(baseAPYs, weights, prevAUMUSD);
|
|
76170
|
+
const rewardAPY = this.computeAPY(rewardAPYs, weights, prevAUMUSD);
|
|
75412
76171
|
const netAPY = baseAPY + rewardAPY;
|
|
75413
76172
|
logger2.verbose(`${this.metadata.name}::netAPY: net: ${netAPY}, baseAPY: ${baseAPY}, rewardAPY: ${rewardAPY}`);
|
|
75414
76173
|
return { net: netAPY, splits: [{
|
|
@@ -75419,11 +76178,11 @@ ${JSON.stringify(data, null, 2)}`;
|
|
|
75419
76178
|
id: "defispring"
|
|
75420
76179
|
}] };
|
|
75421
76180
|
}
|
|
75422
|
-
computeAPY(apys, weights) {
|
|
76181
|
+
computeAPY(apys, weights, currentAUM) {
|
|
75423
76182
|
assert3(apys.length === weights.length, "APYs and weights length mismatch");
|
|
75424
76183
|
const weightedSum = apys.reduce((acc, apy, i) => acc + apy * weights[i], 0);
|
|
75425
|
-
|
|
75426
|
-
return weightedSum /
|
|
76184
|
+
logger2.verbose(`${this.getTag()} computeAPY: apys: ${JSON.stringify(apys)}, weights: ${JSON.stringify(weights)}, weightedSum: ${weightedSum}, currentAUM: ${currentAUM}`);
|
|
76185
|
+
return weightedSum / currentAUM.toNumber();
|
|
75427
76186
|
}
|
|
75428
76187
|
/**
|
|
75429
76188
|
* Calculates the total TVL of the strategy.
|
|
@@ -75455,24 +76214,48 @@ ${JSON.stringify(data, null, 2)}`;
|
|
|
75455
76214
|
usdValue
|
|
75456
76215
|
};
|
|
75457
76216
|
}
|
|
75458
|
-
async
|
|
76217
|
+
async getVesuAUM(adapter) {
|
|
76218
|
+
const legAUM = await adapter.getPositions(this.config);
|
|
76219
|
+
const underlying = this.asset();
|
|
76220
|
+
let vesuAum = Web3Number.fromWei("0", underlying.decimals);
|
|
76221
|
+
if (legAUM[0].token.address.eq(underlying.address)) {
|
|
76222
|
+
vesuAum = vesuAum.plus(legAUM[0].amount);
|
|
76223
|
+
} else {
|
|
76224
|
+
const tokenPrice = await this.pricer.getPrice(legAUM[1].token.symbol);
|
|
76225
|
+
vesuAum = vesuAum.plus(legAUM[1].usdValue / tokenPrice.price);
|
|
76226
|
+
}
|
|
76227
|
+
if (legAUM[1].token.address.eq(underlying.address)) {
|
|
76228
|
+
vesuAum = vesuAum.minus(legAUM[1].amount);
|
|
76229
|
+
} else {
|
|
76230
|
+
const tokenPrice = await this.pricer.getPrice(legAUM[1].token.symbol);
|
|
76231
|
+
vesuAum = vesuAum.minus(legAUM[1].usdValue / tokenPrice.price);
|
|
76232
|
+
}
|
|
76233
|
+
;
|
|
76234
|
+
logger2.verbose(`${this.getTag()} Vesu AUM: ${vesuAum}, legCollateral: ${legAUM[0].amount.toNumber()}, legDebt: ${legAUM[1].amount.toNumber()}`);
|
|
76235
|
+
return vesuAum;
|
|
76236
|
+
}
|
|
76237
|
+
async getPrevAUM() {
|
|
75459
76238
|
const currentAUM = await this.contract.call("aum", []);
|
|
75460
|
-
const
|
|
76239
|
+
const prevAum = Web3Number.fromWei(currentAUM.toString(), this.asset().decimals);
|
|
76240
|
+
logger2.verbose(`${this.getTag()} Prev AUM: ${prevAum}`);
|
|
76241
|
+
return prevAum;
|
|
76242
|
+
}
|
|
76243
|
+
async getAUM() {
|
|
76244
|
+
const prevAum = await this.getPrevAUM();
|
|
75461
76245
|
const token1Price = await this.pricer.getPrice(this.metadata.depositTokens[0].symbol);
|
|
75462
|
-
const
|
|
75463
|
-
|
|
75464
|
-
const
|
|
76246
|
+
const vesuAdapters = this.getVesuAdapters();
|
|
76247
|
+
let vesuAum = Web3Number.fromWei("0", this.asset().decimals);
|
|
76248
|
+
for (const adapter of vesuAdapters) {
|
|
76249
|
+
vesuAum = vesuAum.plus(await this.getVesuAUM(adapter));
|
|
76250
|
+
}
|
|
75465
76251
|
const balance = await this.getUnusedBalance();
|
|
75466
76252
|
logger2.verbose(`${this.getTag()} unused balance: ${balance.amount.toNumber()}`);
|
|
75467
|
-
const vesuAum = leg1AUM[0].amount.plus(leg2AUM[0].usdValue / token1Price.price).minus(leg1AUM[1].usdValue / token1Price.price).minus(leg2AUM[1].amount);
|
|
75468
|
-
logger2.verbose(`${this.getTag()} Vesu AUM: leg1: ${leg1AUM[0].amount.toNumber()}, ${leg1AUM[1].amount.toNumber()}, leg2: ${leg2AUM[0].amount.toNumber()}, ${leg2AUM[1].amount.toNumber()}`);
|
|
75469
76253
|
const zeroAmt = Web3Number.fromWei("0", this.asset().decimals);
|
|
75470
76254
|
const net = {
|
|
75471
76255
|
tokenInfo: this.asset(),
|
|
75472
76256
|
amount: zeroAmt,
|
|
75473
76257
|
usdValue: 0
|
|
75474
76258
|
};
|
|
75475
|
-
const prevAum = Web3Number.fromWei(currentAUM.toString(), this.asset().decimals);
|
|
75476
76259
|
if (vesuAum.isZero()) {
|
|
75477
76260
|
return { net, splits: [{
|
|
75478
76261
|
aum: zeroAmt,
|
|
@@ -75484,16 +76267,7 @@ ${JSON.stringify(data, null, 2)}`;
|
|
|
75484
76267
|
}
|
|
75485
76268
|
const aumToken = vesuAum.plus(balance.amount);
|
|
75486
76269
|
logger2.verbose(`${this.getTag()} Actual AUM: ${aumToken}`);
|
|
75487
|
-
const
|
|
75488
|
-
const defispringAPY = (netAPY.splits.find((s) => s.id === "defispring")?.apy || 0) * 0.8;
|
|
75489
|
-
if (!defispringAPY) throw new Error("DefiSpring APY not found");
|
|
75490
|
-
const timeDiff = Math.round(Date.now() / 1e3) - Number(lastReportTime);
|
|
75491
|
-
const growthRate = timeDiff * defispringAPY / (365 * 24 * 60 * 60);
|
|
75492
|
-
const rewardAssets = prevAum.multipliedBy(growthRate);
|
|
75493
|
-
logger2.verbose(`${this.getTag()} DefiSpring AUM time difference: ${timeDiff}`);
|
|
75494
|
-
logger2.verbose(`${this.getTag()} Current AUM: ${currentAUM}`);
|
|
75495
|
-
logger2.verbose(`${this.getTag()} Net APY: ${JSON.stringify(netAPY)}`);
|
|
75496
|
-
logger2.verbose(`${this.getTag()} rewards AUM: ${rewardAssets}`);
|
|
76270
|
+
const rewardAssets = await this.getRewardsAUM(prevAum);
|
|
75497
76271
|
const newAUM = aumToken.plus(rewardAssets);
|
|
75498
76272
|
logger2.verbose(`${this.getTag()} New AUM: ${newAUM}`);
|
|
75499
76273
|
net.amount = newAUM;
|
|
@@ -75507,6 +76281,21 @@ ${JSON.stringify(data, null, 2)}`;
|
|
|
75507
76281
|
}];
|
|
75508
76282
|
return { net, splits, prevAum };
|
|
75509
76283
|
}
|
|
76284
|
+
// account for future rewards (e.g. defispring rewards)
|
|
76285
|
+
async getRewardsAUM(prevAum) {
|
|
76286
|
+
const lastReportTime = await this.contract.call("last_report_timestamp", []);
|
|
76287
|
+
const netAPY = await this.netAPY();
|
|
76288
|
+
const defispringAPY = (netAPY.splits.find((s) => s.id === "defispring")?.apy || 0) * 0.8;
|
|
76289
|
+
if (!defispringAPY) throw new Error("DefiSpring APY not found");
|
|
76290
|
+
const timeDiff = Math.round(Date.now() / 1e3) - Number(lastReportTime);
|
|
76291
|
+
const growthRate = timeDiff * defispringAPY / (365 * 24 * 60 * 60);
|
|
76292
|
+
const rewardAssets = prevAum.multipliedBy(growthRate);
|
|
76293
|
+
logger2.verbose(`${this.getTag()} DefiSpring AUM time difference: ${timeDiff}`);
|
|
76294
|
+
logger2.verbose(`${this.getTag()} Current AUM: ${prevAum.toString()}`);
|
|
76295
|
+
logger2.verbose(`${this.getTag()} Net APY: ${JSON.stringify(netAPY)}`);
|
|
76296
|
+
logger2.verbose(`${this.getTag()} rewards AUM: ${rewardAssets}`);
|
|
76297
|
+
return rewardAssets;
|
|
76298
|
+
}
|
|
75510
76299
|
getVesuAdapters() {
|
|
75511
76300
|
const vesuAdapter1 = this.getAdapter("vesu_leg1_adapter" /* VESU_LEG1 */);
|
|
75512
76301
|
const vesuAdapter2 = this.getAdapter("vesu_leg2_adapter" /* VESU_LEG2 */);
|
|
@@ -75516,11 +76305,23 @@ ${JSON.stringify(data, null, 2)}`;
|
|
|
75516
76305
|
vesuAdapter2.networkConfig = this.config;
|
|
75517
76306
|
return [vesuAdapter1, vesuAdapter2];
|
|
75518
76307
|
}
|
|
76308
|
+
async getVesuPositions() {
|
|
76309
|
+
const adapters = this.getVesuAdapters();
|
|
76310
|
+
const positions = [];
|
|
76311
|
+
for (const adapter of adapters) {
|
|
76312
|
+
positions.push(...await adapter.getPositions(this.config));
|
|
76313
|
+
}
|
|
76314
|
+
return positions;
|
|
76315
|
+
}
|
|
75519
76316
|
async getVaultPositions() {
|
|
75520
|
-
const
|
|
75521
|
-
const
|
|
75522
|
-
|
|
75523
|
-
|
|
76317
|
+
const vesuPositions = await this.getVesuPositions();
|
|
76318
|
+
const unusedBalance = await this.getUnusedBalance();
|
|
76319
|
+
return [...vesuPositions, {
|
|
76320
|
+
amount: unusedBalance.amount,
|
|
76321
|
+
usdValue: unusedBalance.usdValue,
|
|
76322
|
+
token: this.asset(),
|
|
76323
|
+
remarks: "Unused Balance"
|
|
76324
|
+
}];
|
|
75524
76325
|
}
|
|
75525
76326
|
getSetManagerCall(strategist, root = this.getMerkleRoot()) {
|
|
75526
76327
|
return this.managerContract.populate("set_manage_root", [strategist.address, num_exports.getHexString(root)]);
|
|
@@ -75658,7 +76459,7 @@ ${JSON.stringify(data, null, 2)}`;
|
|
|
75658
76459
|
return new Web3Number(newAmount.toFixed(8), debtTokenAmount.decimals);
|
|
75659
76460
|
}
|
|
75660
76461
|
}
|
|
75661
|
-
async
|
|
76462
|
+
async getVesuModifyPositionCall(params) {
|
|
75662
76463
|
const [vesuAdapter1, vesuAdapter2] = this.getVesuAdapters();
|
|
75663
76464
|
const leg1LTV = await vesuAdapter1.getLTVConfig(this.config);
|
|
75664
76465
|
const leg2LTV = await vesuAdapter2.getLTVConfig(this.config);
|
|
@@ -76158,6 +76959,372 @@ ${JSON.stringify(data, null, 2)}`;
|
|
|
76158
76959
|
investmentSteps
|
|
76159
76960
|
}
|
|
76160
76961
|
];
|
|
76962
|
+
|
|
76963
|
+
// src/strategies/universal-lst-muliplier-strategy.tsx
|
|
76964
|
+
var import_jsx_runtime5 = __toESM(require_jsx_runtime());
|
|
76965
|
+
var UniversalLstMultiplierStrategy = class extends UniversalStrategy {
|
|
76966
|
+
constructor(config3, pricer, metadata) {
|
|
76967
|
+
super(config3, pricer, metadata);
|
|
76968
|
+
this.quoteAmountToFetchPrice = new Web3Number(1, 18);
|
|
76969
|
+
const STRKToken = Global.getDefaultTokens().find((token) => token.symbol === "STRK");
|
|
76970
|
+
const underlyingToken = this.getLSTUnderlyingTokenInfo();
|
|
76971
|
+
if (underlyingToken.address.eq(STRKToken.address)) {
|
|
76972
|
+
this.quoteAmountToFetchPrice = new Web3Number(100, 18);
|
|
76973
|
+
} else {
|
|
76974
|
+
this.quoteAmountToFetchPrice = new Web3Number(0.01, this.asset().decimals);
|
|
76975
|
+
}
|
|
76976
|
+
}
|
|
76977
|
+
// only one leg is used
|
|
76978
|
+
// todo support lending assets of underlying as well
|
|
76979
|
+
getVesuAdapters() {
|
|
76980
|
+
const vesuAdapter1 = this.getAdapter("vesu_leg1_adapter" /* VESU_LEG1 */);
|
|
76981
|
+
vesuAdapter1.pricer = this.pricer;
|
|
76982
|
+
vesuAdapter1.networkConfig = this.config;
|
|
76983
|
+
return [vesuAdapter1];
|
|
76984
|
+
}
|
|
76985
|
+
// not applicable for this strategy
|
|
76986
|
+
// No rewards on collateral or borrowing of LST assets
|
|
76987
|
+
async getRewardsAUM(prevAum) {
|
|
76988
|
+
return Web3Number.fromWei("0", this.asset().decimals);
|
|
76989
|
+
}
|
|
76990
|
+
async getLSTDexPrice() {
|
|
76991
|
+
const ekuboQuoter = new EkuboQuoter(this.config);
|
|
76992
|
+
const lstTokenInfo = this.asset();
|
|
76993
|
+
const lstUnderlyingTokenInfo = this.getLSTUnderlyingTokenInfo();
|
|
76994
|
+
const quote = await ekuboQuoter.getQuote(
|
|
76995
|
+
lstTokenInfo.address.address,
|
|
76996
|
+
lstUnderlyingTokenInfo.address.address,
|
|
76997
|
+
this.quoteAmountToFetchPrice
|
|
76998
|
+
);
|
|
76999
|
+
const outputAmount = Web3Number.fromWei(quote.total_calculated, lstUnderlyingTokenInfo.decimals);
|
|
77000
|
+
const price = outputAmount.toNumber() / this.quoteAmountToFetchPrice.toNumber();
|
|
77001
|
+
logger2.verbose(`${this.getTag()}:: LST Dex Price: ${price}`);
|
|
77002
|
+
return price;
|
|
77003
|
+
}
|
|
77004
|
+
/**
|
|
77005
|
+
* Uses vesu's multiple call to create leverage on LST
|
|
77006
|
+
* Deposit amount is in LST
|
|
77007
|
+
* @param params
|
|
77008
|
+
*/
|
|
77009
|
+
async getVesuMultiplyCall(params) {
|
|
77010
|
+
const [vesuAdapter1] = this.getVesuAdapters();
|
|
77011
|
+
const legLTV = await vesuAdapter1.getLTVConfig(this.config);
|
|
77012
|
+
const existingPositions = await vesuAdapter1.getPositions(this.config);
|
|
77013
|
+
const collateralisation = await vesuAdapter1.getCollateralization(this.config);
|
|
77014
|
+
const existingCollateralInfo = existingPositions[0];
|
|
77015
|
+
const existingDebtInfo = existingPositions[1];
|
|
77016
|
+
logger2.debug(`${this.getTag()}::getVesuMultiplyCall existingCollateralInfo: ${JSON.stringify(existingCollateralInfo)},
|
|
77017
|
+
existingDebtInfo: ${JSON.stringify(existingDebtInfo)}, collateralisation: ${JSON.stringify(collateralisation)}`);
|
|
77018
|
+
const collateralPrice = collateralisation[0].usdValue > 0 ? collateralisation[0].usdValue / existingCollateralInfo.amount.toNumber() : 1;
|
|
77019
|
+
const debtPrice = collateralisation[1].usdValue > 0 ? collateralisation[1].usdValue / existingDebtInfo.amount.toNumber() : 1;
|
|
77020
|
+
logger2.debug(`${this.getTag()}::getVesuMultiplyCall collateralPrice: ${collateralPrice}, debtPrice: ${debtPrice}`);
|
|
77021
|
+
const addedCollateral = params.leg1DepositAmount.multipliedBy(params.isDeposit ? 1 : -1);
|
|
77022
|
+
const DEXPrice = await this.getLSTDexPrice();
|
|
77023
|
+
logger2.verbose(`${this.getTag()}::getVesuMultiplyCall addedCollateral: ${addedCollateral}`);
|
|
77024
|
+
const numeratorPart1 = existingCollateralInfo.amount.plus(addedCollateral).multipliedBy(collateralPrice).multipliedBy(legLTV);
|
|
77025
|
+
const numeratorPart2 = existingDebtInfo.amount.multipliedBy(debtPrice).multipliedBy(this.metadata.additionalInfo.targetHealthFactor);
|
|
77026
|
+
const denominatorPart = this.metadata.additionalInfo.targetHealthFactor - legLTV / DEXPrice;
|
|
77027
|
+
const x_debt_usd = numeratorPart1.minus(numeratorPart2).dividedBy(denominatorPart);
|
|
77028
|
+
logger2.verbose(`${this.getTag()}::getVesuMultiplyCall x_debt_usd: ${x_debt_usd}`);
|
|
77029
|
+
logger2.debug(`${this.getTag()}::getVesuMultiplyCall numeratorPart1: ${numeratorPart1}, numeratorPart2: ${numeratorPart2}, denominatorPart: ${denominatorPart}`);
|
|
77030
|
+
const debtAmount = x_debt_usd.dividedBy(debtPrice);
|
|
77031
|
+
const marginAmount = addedCollateral;
|
|
77032
|
+
logger2.verbose(`${this.getTag()}::getVesuMultiplyCall debtAmount: ${debtAmount}, marginAmount: ${marginAmount}`);
|
|
77033
|
+
return this.getModifyLeverCall({
|
|
77034
|
+
marginAmount,
|
|
77035
|
+
debtAmount,
|
|
77036
|
+
isIncrease: debtAmount.greaterThan(0)
|
|
77037
|
+
});
|
|
77038
|
+
}
|
|
77039
|
+
getLSTUnderlyingTokenInfo() {
|
|
77040
|
+
const [vesuAdapter1] = this.getVesuAdapters();
|
|
77041
|
+
return vesuAdapter1.config.debt;
|
|
77042
|
+
}
|
|
77043
|
+
async getLSTExchangeRate() {
|
|
77044
|
+
const [vesuAdapter1] = this.getVesuAdapters();
|
|
77045
|
+
const lstTokenInfo = vesuAdapter1.config.collateral;
|
|
77046
|
+
const lstABI = new Contract({
|
|
77047
|
+
abi: erc4626_abi_default,
|
|
77048
|
+
address: lstTokenInfo.address.address,
|
|
77049
|
+
providerOrAccount: this.config.provider
|
|
77050
|
+
});
|
|
77051
|
+
const price = await lstABI.call("convert_to_assets", [uint256_exports.bnToUint256(new Web3Number(1, lstTokenInfo.decimals).toWei())]);
|
|
77052
|
+
const exchangeRate = Number(uint256_exports.uint256ToBN(price).toString()) / Math.pow(10, lstTokenInfo.decimals);
|
|
77053
|
+
logger2.verbose(`${this.getTag()}:: LST Exchange Rate: ${exchangeRate}`);
|
|
77054
|
+
return exchangeRate;
|
|
77055
|
+
}
|
|
77056
|
+
/**
|
|
77057
|
+
*
|
|
77058
|
+
* @param params marginAmount is in LST, debtAmount is in underlying
|
|
77059
|
+
*/
|
|
77060
|
+
async getModifyLeverCall(params) {
|
|
77061
|
+
assert3(!params.marginAmount.isZero() || !params.debtAmount.isZero(), "Deposit/debt must be non-0");
|
|
77062
|
+
const [vesuAdapter1] = this.getVesuAdapters();
|
|
77063
|
+
const lstTokenInfo = this.asset();
|
|
77064
|
+
const lstUnderlyingTokenInfo = vesuAdapter1.config.debt;
|
|
77065
|
+
const proofsIDs = [];
|
|
77066
|
+
const manageCalls = [];
|
|
77067
|
+
if (params.marginAmount.greaterThan(0)) {
|
|
77068
|
+
const STEP1_ID = "approve_token1" /* APPROVE_TOKEN1 */;
|
|
77069
|
+
const manage1Info = this.getProofs(STEP1_ID);
|
|
77070
|
+
const depositAmount = params.marginAmount;
|
|
77071
|
+
const manageCall1 = manage1Info.callConstructor({
|
|
77072
|
+
amount: depositAmount
|
|
77073
|
+
});
|
|
77074
|
+
proofsIDs.push(STEP1_ID);
|
|
77075
|
+
manageCalls.push(manageCall1);
|
|
77076
|
+
}
|
|
77077
|
+
const ekuboQuoter = new EkuboQuoter(this.config);
|
|
77078
|
+
const lstPrice = await this.getLSTExchangeRate();
|
|
77079
|
+
const marginSwap = [];
|
|
77080
|
+
const MAX_SLIPPAGE = 0.01;
|
|
77081
|
+
const fromToken = params.isIncrease ? lstUnderlyingTokenInfo : lstTokenInfo;
|
|
77082
|
+
const toToken = params.isIncrease ? lstTokenInfo : lstUnderlyingTokenInfo;
|
|
77083
|
+
const leverSwapQuote = await ekuboQuoter.getQuote(
|
|
77084
|
+
fromToken.address.address,
|
|
77085
|
+
toToken.address.address,
|
|
77086
|
+
params.debtAmount
|
|
77087
|
+
// negative for exact amount out
|
|
77088
|
+
);
|
|
77089
|
+
assert3(leverSwapQuote.price_impact < MAX_SLIPPAGE, "getIncreaseLeverCall: Price impact is too high [Debt swap]");
|
|
77090
|
+
const leverSwap = ekuboQuoter.getVesuMultiplyQuote(leverSwapQuote, fromToken, toToken);
|
|
77091
|
+
const minExpectedDebt = params.debtAmount.dividedBy(lstPrice).multipliedBy(1 - MAX_SLIPPAGE);
|
|
77092
|
+
const maxUsedCollateral = params.debtAmount.abs().dividedBy(lstPrice).multipliedBy(1 + MAX_SLIPPAGE);
|
|
77093
|
+
const STEP2_ID = "switch_delegation_on" /* SWITCH_DELEGATION_ON */;
|
|
77094
|
+
const manage2Info = this.getProofs(STEP2_ID);
|
|
77095
|
+
const manageCall2 = manage2Info.callConstructor({
|
|
77096
|
+
delegation: true
|
|
77097
|
+
});
|
|
77098
|
+
const STEP3_ID = "multiply_vesu" /* MULTIPLY_VESU */;
|
|
77099
|
+
const manage3Info = this.getProofs(STEP3_ID);
|
|
77100
|
+
const multiplyParams = params.isIncrease ? {
|
|
77101
|
+
isIncrease: true,
|
|
77102
|
+
increaseParams: {
|
|
77103
|
+
add_margin: params.marginAmount,
|
|
77104
|
+
margin_swap: marginSwap,
|
|
77105
|
+
margin_swap_limit_amount: Web3Number.fromWei(0, this.asset().decimals),
|
|
77106
|
+
lever_swap: leverSwap,
|
|
77107
|
+
lever_swap_limit_amount: minExpectedDebt
|
|
77108
|
+
}
|
|
77109
|
+
} : {
|
|
77110
|
+
isIncrease: false,
|
|
77111
|
+
decreaseParams: {
|
|
77112
|
+
sub_margin: params.marginAmount.multipliedBy(-1),
|
|
77113
|
+
lever_swap: leverSwap,
|
|
77114
|
+
lever_swap_limit_amount: maxUsedCollateral,
|
|
77115
|
+
// only required for close position
|
|
77116
|
+
lever_swap_weights: [],
|
|
77117
|
+
// no need to swap collateral to anything, and any residuals return our contract anyways.
|
|
77118
|
+
withdraw_swap: [],
|
|
77119
|
+
withdraw_swap_limit_amount: Web3Number.fromWei(0, this.asset().decimals),
|
|
77120
|
+
withdraw_swap_weights: [],
|
|
77121
|
+
close_position: false
|
|
77122
|
+
}
|
|
77123
|
+
};
|
|
77124
|
+
const manageCall3 = manage3Info.callConstructor(multiplyParams);
|
|
77125
|
+
const STEP4_ID = "switch_delegation_off" /* SWITCH_DELEGATION_OFF */;
|
|
77126
|
+
const manage4Info = this.getProofs(STEP4_ID);
|
|
77127
|
+
const manageCall4 = manage4Info.callConstructor({
|
|
77128
|
+
delegation: false
|
|
77129
|
+
});
|
|
77130
|
+
proofsIDs.push(STEP2_ID, STEP3_ID, STEP4_ID);
|
|
77131
|
+
manageCalls.push(manageCall2, manageCall3, manageCall4);
|
|
77132
|
+
return [this.getManageCall(proofsIDs, manageCalls)];
|
|
77133
|
+
}
|
|
77134
|
+
};
|
|
77135
|
+
function VaultDescription() {
|
|
77136
|
+
const containerStyle = {
|
|
77137
|
+
maxWidth: "800px",
|
|
77138
|
+
margin: "0 auto",
|
|
77139
|
+
backgroundColor: "#111",
|
|
77140
|
+
color: "#eee",
|
|
77141
|
+
fontFamily: "Arial, sans-serif",
|
|
77142
|
+
borderRadius: "12px"
|
|
77143
|
+
};
|
|
77144
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: containerStyle, children: [
|
|
77145
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("h1", { style: { fontSize: "18px", marginBottom: "10px" }, children: "Meta Vault \u2014 Automated Yield Router" }),
|
|
77146
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { style: { fontSize: "14px", lineHeight: "1.5", marginBottom: "16px" }, children: "This Levered Endur LST vault is a tokenized leveraged Vault, auto-compounding strategy that continuously allocates your deposited asset to the best available yield source in the ecosystem. Depositors receive vault shares that represent a proportional claim on the underlying assets and accrued yield. Allocation shifts are handled programmatically based on on-chain signals and risk filters, minimizing idle capital and maximizing net APY." }),
|
|
77147
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: { backgroundColor: "#222", padding: "10px", borderRadius: "8px", marginBottom: "20px", border: "1px solid #444" }, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("p", { style: { fontSize: "13px", color: "#ccc" }, children: [
|
|
77148
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("strong", { children: "Withdrawals:" }),
|
|
77149
|
+
" Requests can take up to ",
|
|
77150
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("strong", { children: "1-2 hours" }),
|
|
77151
|
+
" to process as the vault unwinds and settles routing."
|
|
77152
|
+
] }) })
|
|
77153
|
+
] });
|
|
77154
|
+
}
|
|
77155
|
+
function getDescription2(tokenSymbol) {
|
|
77156
|
+
return VaultDescription();
|
|
77157
|
+
}
|
|
77158
|
+
function getLooperSettings2(lstSymbol, underlyingSymbol, vaultSettings, pool1) {
|
|
77159
|
+
vaultSettings.leafAdapters = [];
|
|
77160
|
+
const lstToken = Global.getDefaultTokens().find((token) => token.symbol === lstSymbol);
|
|
77161
|
+
const underlyingToken = Global.getDefaultTokens().find((token) => token.symbol === underlyingSymbol);
|
|
77162
|
+
const vesuAdapterLST = new VesuAdapter({
|
|
77163
|
+
poolId: pool1,
|
|
77164
|
+
collateral: lstToken,
|
|
77165
|
+
debt: underlyingToken,
|
|
77166
|
+
vaultAllocator: vaultSettings.vaultAllocator,
|
|
77167
|
+
id: "multiply_vesu" /* MULTIPLY_VESU */
|
|
77168
|
+
});
|
|
77169
|
+
const commonAdapter = new CommonAdapter({
|
|
77170
|
+
manager: vaultSettings.manager,
|
|
77171
|
+
asset: lstToken.address,
|
|
77172
|
+
id: "",
|
|
77173
|
+
vaultAddress: vaultSettings.vaultAddress,
|
|
77174
|
+
vaultAllocator: vaultSettings.vaultAllocator
|
|
77175
|
+
});
|
|
77176
|
+
vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(lstToken.address, vesuAdapterLST.VESU_MULTIPLY, "approve_token1" /* APPROVE_TOKEN1 */).bind(commonAdapter));
|
|
77177
|
+
vaultSettings.leafAdapters.push(vesuAdapterLST.getMultiplyAdapter.bind(vesuAdapterLST));
|
|
77178
|
+
vaultSettings.leafAdapters.push(vesuAdapterLST.getVesuModifyDelegationAdapter("switch_delegation_on" /* SWITCH_DELEGATION_ON */).bind(vesuAdapterLST));
|
|
77179
|
+
vaultSettings.leafAdapters.push(vesuAdapterLST.getVesuModifyDelegationAdapter("switch_delegation_off" /* SWITCH_DELEGATION_OFF */).bind(vesuAdapterLST));
|
|
77180
|
+
vaultSettings.adapters.push(...[{
|
|
77181
|
+
id: "vesu_leg1_adapter" /* VESU_LEG1 */,
|
|
77182
|
+
adapter: vesuAdapterLST
|
|
77183
|
+
}, {
|
|
77184
|
+
id: "common_adapter" /* COMMON */,
|
|
77185
|
+
adapter: commonAdapter
|
|
77186
|
+
}]);
|
|
77187
|
+
vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(lstToken.address, vaultSettings.vaultAddress, "approve_bring_liquidity" /* APPROVE_BRING_LIQUIDITY */).bind(commonAdapter));
|
|
77188
|
+
vaultSettings.leafAdapters.push(commonAdapter.getBringLiquidityAdapter("bring_liquidity" /* BRING_LIQUIDITY */).bind(commonAdapter));
|
|
77189
|
+
vaultSettings.leafAdapters.push(vesuAdapterLST.getDefispringRewardsAdapter("defispring_rewards" /* DEFISPRING_REWARDS */).bind(vesuAdapterLST));
|
|
77190
|
+
const STRKToken = Global.getDefaultTokens().find((token) => token.symbol === "STRK");
|
|
77191
|
+
vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(STRKToken.address, AVNU_MIDDLEWARE, "approve_swap_token1" /* APPROVE_SWAP_TOKEN1 */).bind(commonAdapter));
|
|
77192
|
+
vaultSettings.leafAdapters.push(commonAdapter.getAvnuAdapter(STRKToken.address, lstToken.address, "avnu_swap_rewards" /* AVNU_SWAP_REWARDS */).bind(commonAdapter));
|
|
77193
|
+
return vaultSettings;
|
|
77194
|
+
}
|
|
77195
|
+
function getFAQs2(lstSymbol, underlyingSymbol) {
|
|
77196
|
+
return [
|
|
77197
|
+
{
|
|
77198
|
+
question: `What is the Hyper ${lstSymbol} Vault?`,
|
|
77199
|
+
answer: `The Hyper ${lstSymbol} Vault is a tokenized strategy that automatically loops your ${underlyingSymbol} or ${lstSymbol} to create up to 4x leverage to hence yield in a very low risk manner.`
|
|
77200
|
+
},
|
|
77201
|
+
{
|
|
77202
|
+
question: "How does yield allocation work?",
|
|
77203
|
+
answer: `The strategy uses deposited ${lstSymbol} to collateralize it on Vesu, borrow more ${underlyingSymbol} to loop further. Instead of manually doing this, using flash loan, this leverage is created in a single gas efficient step. Our continuous monitoring systems gauge current yield and available liquidity in real time to make sure yield is optimal. For instance, if the looping becomes in-efficient in future, the strategy will rebalance to reduce leverage or simply hold ${lstSymbol} to continue earning yield.`
|
|
77204
|
+
},
|
|
77205
|
+
{
|
|
77206
|
+
question: "Which protocols/dApp are used??",
|
|
77207
|
+
answer: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { children: [
|
|
77208
|
+
"Currently, the LST is from ",
|
|
77209
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("strong", { children: "Endur" }),
|
|
77210
|
+
" while ",
|
|
77211
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("strong", { children: "Vesu" }),
|
|
77212
|
+
" is used to collateralize the looped position."
|
|
77213
|
+
] })
|
|
77214
|
+
},
|
|
77215
|
+
{
|
|
77216
|
+
question: "Can I get liquidated?",
|
|
77217
|
+
answer: "The strategy uses highly correlated assets which drastically reduces 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."
|
|
77218
|
+
},
|
|
77219
|
+
{
|
|
77220
|
+
question: "What do I receive when I deposit?",
|
|
77221
|
+
answer: "Depositors receive vault tokens representing their proportional share of the vault. These tokens entitle holders to both the principal and accrued yield."
|
|
77222
|
+
},
|
|
77223
|
+
{
|
|
77224
|
+
question: "How long do withdrawals take?",
|
|
77225
|
+
answer: "Withdrawals may take up to 1-2 hours to process, as the vault unwinds and settles liquidity routing across integrated protocols. In case of large withdrawals, to avoid slippage, we may slowly unwind the position, which could make the withdrawals longer."
|
|
77226
|
+
},
|
|
77227
|
+
{
|
|
77228
|
+
question: "Is the Hyper xSTRK Vault non-custodial?",
|
|
77229
|
+
answer: "Yes. The Hyper xSTRK Vault operates entirely on-chain. Users always maintain control of their vault tokens, and the strategy is fully transparent."
|
|
77230
|
+
},
|
|
77231
|
+
{
|
|
77232
|
+
question: "Is the Vault audited?",
|
|
77233
|
+
answer: "Yes. The Hyper xSTRK Vault is audited by Zellic. Look for safety icon beside the strategy name for more details."
|
|
77234
|
+
},
|
|
77235
|
+
{
|
|
77236
|
+
question: "Are there any fees?",
|
|
77237
|
+
answer: "Troves charges a performance of 10% on the yield generated. The APY shown is net of this fee. This fee is only applied to the profits earned, ensuring that users retain their initial capital."
|
|
77238
|
+
}
|
|
77239
|
+
];
|
|
77240
|
+
}
|
|
77241
|
+
var _riskFactor4 = [
|
|
77242
|
+
{ type: "Smart Contract Risk" /* SMART_CONTRACT_RISK */, value: 2 /* WELL_AUDITED */, weight: 25, reason: "Audited by Zellic" },
|
|
77243
|
+
{ type: "Liquidation Risk" /* LIQUIDATION_RISK */, value: 1 /* VERY_LOW_PROBABILITY */, weight: 50, reason: "The collateral and debt are highly correlated" },
|
|
77244
|
+
{ type: "Technical Risk" /* TECHNICAL_RISK */, value: 1 /* STABLE_INFRASTRUCTURE */, weight: 50, 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." }
|
|
77245
|
+
];
|
|
77246
|
+
var hyperxSTRK = {
|
|
77247
|
+
vaultAddress: ContractAddr.from("0x46c7a54c82b1fe374353859f554a40b8bd31d3e30f742901579e7b57b1b5960"),
|
|
77248
|
+
manager: ContractAddr.from("0x5d499cd333757f461a0bedaca3dfc4d77320c773037e0aa299f22a6dbfdc03a"),
|
|
77249
|
+
vaultAllocator: ContractAddr.from("0x511d07953a09bc7c505970891507c5a2486d2ea22752601a14db092186d7caa"),
|
|
77250
|
+
redeemRequestNFT: ContractAddr.from("0x51e40b839dc0c2feca923f863072673b94abfa2483345be3b30b457a90d095"),
|
|
77251
|
+
aumOracle: ContractAddr.from("0x48cf709870a1a0d453d37de108e0c41b8b89819ef54f95abc0e2e1f98bbe937"),
|
|
77252
|
+
leafAdapters: [],
|
|
77253
|
+
adapters: [],
|
|
77254
|
+
targetHealthFactor: 1.1,
|
|
77255
|
+
minHealthFactor: 1.05
|
|
77256
|
+
};
|
|
77257
|
+
var hyperxWBTC = {
|
|
77258
|
+
vaultAddress: ContractAddr.from("0x2da9d0f96a46b453f55604313785dc866424240b1c6811d13bef594343db818"),
|
|
77259
|
+
manager: ContractAddr.from("0x75866db44c81e6986f06035206ee9c7d15833ddb22d6a22c016cfb5c866a491"),
|
|
77260
|
+
vaultAllocator: ContractAddr.from("0x57b5c1bb457b5e840a2714ae53ada87d77be2f3fd33a59b4fe709ef20c020c1"),
|
|
77261
|
+
redeemRequestNFT: ContractAddr.from("0x7a5dc288325456f05e70e9616e16bc02ffbe448f4b89f80b47c0970b989c7c"),
|
|
77262
|
+
aumOracle: ContractAddr.from(""),
|
|
77263
|
+
leafAdapters: [],
|
|
77264
|
+
adapters: [],
|
|
77265
|
+
targetHealthFactor: 1.1,
|
|
77266
|
+
minHealthFactor: 1.05
|
|
77267
|
+
};
|
|
77268
|
+
var hyperxtBTC = {
|
|
77269
|
+
vaultAddress: ContractAddr.from("0x47d5f68477e5637ce0e56436c6b5eee5a354e6828995dae106b11a48679328"),
|
|
77270
|
+
manager: ContractAddr.from("0xc4cc3e08029a0ae076f5fdfca70575abb78d23c5cd1c49a957f7e697885401"),
|
|
77271
|
+
vaultAllocator: ContractAddr.from("0x50bbd4fe69f841ecb13b2619fe50ebfa4e8944671b5d0ebf7868fd80c61b31e"),
|
|
77272
|
+
redeemRequestNFT: ContractAddr.from("0xeac9032f02057779816e38a6cb9185d12d86b3aacc9949b96b36de359c1e3"),
|
|
77273
|
+
aumOracle: ContractAddr.from(""),
|
|
77274
|
+
leafAdapters: [],
|
|
77275
|
+
adapters: [],
|
|
77276
|
+
targetHealthFactor: 1.1,
|
|
77277
|
+
minHealthFactor: 1.05
|
|
77278
|
+
};
|
|
77279
|
+
var hyperxsBTC = {
|
|
77280
|
+
vaultAddress: ContractAddr.from("0x437ef1e7d0f100b2e070b7a65cafec0b2be31b0290776da8b4112f5473d8d9"),
|
|
77281
|
+
manager: ContractAddr.from("0xc9ac023090625b0be3f6532ca353f086746f9c09f939dbc1b2613f09e5f821"),
|
|
77282
|
+
vaultAllocator: ContractAddr.from("0x60c2d856936b975459a5b4eb28b8672d91f757bd76cebb6241f8d670185dc01"),
|
|
77283
|
+
redeemRequestNFT: ContractAddr.from("0x429e8ee8bc7ecd1ade72630d350a2e0f10f9a2507c45f188ba17fe8f2ab4cf3"),
|
|
77284
|
+
aumOracle: ContractAddr.from(""),
|
|
77285
|
+
leafAdapters: [],
|
|
77286
|
+
adapters: [],
|
|
77287
|
+
targetHealthFactor: 1.1,
|
|
77288
|
+
minHealthFactor: 1.05
|
|
77289
|
+
};
|
|
77290
|
+
function getInvestmentSteps(lstSymbol, underlyingSymbol) {
|
|
77291
|
+
return [
|
|
77292
|
+
`Deposit ${underlyingSymbol} into the vault`,
|
|
77293
|
+
`The vault manager loops the ${underlyingSymbol} to buy ${lstSymbol}`,
|
|
77294
|
+
`The vault manager collateralizes the ${lstSymbol} on Vesu`,
|
|
77295
|
+
`The vault manager borrows more ${underlyingSymbol} to loop further`,
|
|
77296
|
+
`Claim BTCFi STRK rewards weekly to swap to ${lstSymbol} and reinvest`,
|
|
77297
|
+
`If required, adjust leverage or re-allocate assets within LST pool on Vesu to optimize yield`
|
|
77298
|
+
];
|
|
77299
|
+
}
|
|
77300
|
+
function getStrategySettings(lstSymbol, underlyingSymbol, addresses, isPreview = false) {
|
|
77301
|
+
return {
|
|
77302
|
+
name: `Hyper ${lstSymbol}`,
|
|
77303
|
+
description: getDescription2(lstSymbol),
|
|
77304
|
+
address: addresses.vaultAddress,
|
|
77305
|
+
launchBlock: 0,
|
|
77306
|
+
type: "Other",
|
|
77307
|
+
depositTokens: [Global.getDefaultTokens().find((token) => token.symbol === lstSymbol)],
|
|
77308
|
+
additionalInfo: getLooperSettings2(lstSymbol, underlyingSymbol, addresses, VesuPools.Re7xSTRK),
|
|
77309
|
+
risk: {
|
|
77310
|
+
riskFactor: _riskFactor4,
|
|
77311
|
+
netRisk: _riskFactor4.reduce((acc, curr) => acc + curr.value * curr.weight, 0) / _riskFactor4.reduce((acc, curr) => acc + curr.weight, 0),
|
|
77312
|
+
notARisks: getNoRiskTags(_riskFactor4)
|
|
77313
|
+
},
|
|
77314
|
+
protocols: [Protocols.ENDUR, Protocols.VESU],
|
|
77315
|
+
maxTVL: Web3Number.fromWei(0, 18),
|
|
77316
|
+
contractDetails: getContractDetails(addresses),
|
|
77317
|
+
faqs: getFAQs2(lstSymbol, underlyingSymbol),
|
|
77318
|
+
investmentSteps: getInvestmentSteps(lstSymbol, underlyingSymbol),
|
|
77319
|
+
isPreview
|
|
77320
|
+
};
|
|
77321
|
+
}
|
|
77322
|
+
var HyperLSTStrategies = [
|
|
77323
|
+
getStrategySettings("xSTRK", "STRK", hyperxSTRK, false),
|
|
77324
|
+
getStrategySettings("xWBTC", "WBTC", hyperxWBTC, true),
|
|
77325
|
+
getStrategySettings("xtBTC", "tBTC", hyperxtBTC, true),
|
|
77326
|
+
getStrategySettings("xsBTC", "solvBTC", hyperxsBTC, true)
|
|
77327
|
+
];
|
|
76161
77328
|
return __toCommonJS(index_browser_exports);
|
|
76162
77329
|
})();
|
|
76163
77330
|
/*! Bundled license information:
|