@strkfarm/sdk 1.1.70 → 2.0.0-dev.1

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.
Files changed (53) hide show
  1. package/dist/cli.js +2 -2
  2. package/dist/cli.mjs +2 -2
  3. package/dist/index.browser.global.js +66861 -59746
  4. package/dist/index.browser.mjs +24970 -18579
  5. package/dist/index.d.ts +1969 -776
  6. package/dist/index.js +25264 -18850
  7. package/dist/index.mjs +25463 -19089
  8. package/package.json +80 -76
  9. package/src/data/extended-deposit.abi.json +3613 -0
  10. package/src/data/universal-vault.abi.json +135 -20
  11. package/src/dataTypes/address.ts +8 -1
  12. package/src/global.ts +240 -193
  13. package/src/interfaces/common.tsx +26 -2
  14. package/src/modules/ExtendedWrapperSDk/index.ts +62 -0
  15. package/src/modules/ExtendedWrapperSDk/types.ts +311 -0
  16. package/src/modules/ExtendedWrapperSDk/wrapper.ts +395 -0
  17. package/src/modules/avnu.ts +17 -4
  18. package/src/modules/ekubo-quoter.ts +98 -10
  19. package/src/modules/erc20.ts +67 -21
  20. package/src/modules/harvests.ts +16 -29
  21. package/src/modules/index.ts +5 -1
  22. package/src/modules/lst-apr.ts +36 -0
  23. package/src/modules/midas.ts +159 -0
  24. package/src/modules/pricer-from-api.ts +2 -2
  25. package/src/modules/pricer-lst.ts +1 -1
  26. package/src/modules/pricer.ts +3 -38
  27. package/src/modules/token-market-data.ts +202 -0
  28. package/src/node/deployer.ts +1 -36
  29. package/src/strategies/autoCompounderStrk.ts +1 -1
  30. package/src/strategies/base-strategy.ts +20 -3
  31. package/src/strategies/ekubo-cl-vault.tsx +123 -306
  32. package/src/strategies/index.ts +4 -1
  33. package/src/strategies/svk-strategy.ts +247 -0
  34. package/src/strategies/universal-adapters/adapter-optimizer.ts +65 -0
  35. package/src/strategies/universal-adapters/adapter-utils.ts +5 -1
  36. package/src/strategies/universal-adapters/avnu-adapter.ts +418 -0
  37. package/src/strategies/universal-adapters/baseAdapter.ts +181 -153
  38. package/src/strategies/universal-adapters/common-adapter.ts +98 -77
  39. package/src/strategies/universal-adapters/extended-adapter.ts +544 -0
  40. package/src/strategies/universal-adapters/index.ts +5 -1
  41. package/src/strategies/universal-adapters/unused-balance-adapter.ts +109 -0
  42. package/src/strategies/universal-adapters/vesu-adapter.ts +220 -218
  43. package/src/strategies/universal-adapters/vesu-multiply-adapter.ts +924 -0
  44. package/src/strategies/universal-adapters/vesu-supply-only-adapter.ts +58 -51
  45. package/src/strategies/universal-lst-muliplier-strategy.tsx +707 -774
  46. package/src/strategies/universal-strategy.tsx +1098 -1180
  47. package/src/strategies/vesu-extended-strategy/services/operationService.ts +28 -0
  48. package/src/strategies/vesu-extended-strategy/utils/config.runtime.ts +77 -0
  49. package/src/strategies/vesu-extended-strategy/utils/constants.ts +48 -0
  50. package/src/strategies/vesu-extended-strategy/utils/helper.ts +374 -0
  51. package/src/strategies/vesu-extended-strategy/vesu-extended-strategy.tsx +992 -0
  52. package/src/strategies/vesu-rebalance.tsx +16 -19
  53. package/src/utils/health-factor-math.ts +11 -5
@@ -7,11 +7,11 @@ import { VesuRebalanceSettings } from "./vesu-rebalance";
7
7
  import { assert, LeafData, logger, StandardMerkleTree } from "@/utils";
8
8
  import UniversalVaultAbi from '../data/universal-vault.abi.json';
9
9
  import ManagerAbi from '../data/vault-manager.abi.json';
10
- import { ApproveCallParams, AvnuSwapCallParams, BaseAdapter, CommonAdapter, FlashloanCallParams, GenerateCallFn, LeafAdapterFn, ManageCall, VesuAdapter, VesuDefiSpringRewardsCallParams, VesuModifyPositionCallParams, VesuPools } from "./universal-adapters";
10
+ import { ApproveCallParams, AvnuSwapCallParams, BaseAdapter, CommonAdapter, DepositParams, FlashloanCallParams, GenerateCallFn, LeafAdapterFn, ManageCall, WithdrawParams } from "./universal-adapters";
11
11
  import { Global } from "@/global";
12
12
  import { AvnuWrapper, ERC20 } from "@/modules";
13
13
  import { AVNU_MIDDLEWARE, VESU_SINGLETON } from "./universal-adapters/adapter-utils";
14
- import { HarvestInfo, VesuHarvests } from "@/modules/harvests";
14
+ import { VesuHarvests } from "@/modules/harvests";
15
15
 
16
16
  export interface UniversalManageCall {
17
17
  proofs: string[];
@@ -24,16 +24,13 @@ export interface UniversalStrategySettings {
24
24
  manager: ContractAddr,
25
25
  vaultAllocator: ContractAddr,
26
26
  redeemRequestNFT: ContractAddr,
27
- aumOracle: ContractAddr,
28
27
 
29
28
  // Individual merkle tree leaves
30
29
  leafAdapters: LeafAdapterFn<any>[],
31
30
 
32
31
  // Useful for returning adapter class objects that can compute
33
32
  // certain things for us (e.g. positions, hfs)
34
- adapters: {id: string, adapter: BaseAdapter}[],
35
- targetHealthFactor: number,
36
- minHealthFactor: number
33
+ adapters: {id: string, adapter: BaseAdapter<DepositParams, WithdrawParams>}[]
37
34
  }
38
35
 
39
36
  export enum AUMTypes {
@@ -41,787 +38,705 @@ export enum AUMTypes {
41
38
  DEFISPRING = 'defispring'
42
39
  }
43
40
 
44
- export class UniversalStrategy<
45
- S extends UniversalStrategySettings
46
- > extends BaseStrategy<
47
- SingleTokenInfo,
48
- SingleActionAmount
49
- > {
50
-
51
- /** Contract address of the strategy */
52
- readonly address: ContractAddr;
53
- /** Pricer instance for token price calculations */
54
- readonly pricer: PricerBase;
55
- /** Metadata containing strategy information */
56
- readonly metadata: IStrategyMetadata<S>;
57
- /** Contract instance for interacting with the strategy */
58
- readonly contract: Contract;
59
- readonly managerContract: Contract;
60
- merkleTree: StandardMerkleTree | undefined;
61
-
62
- constructor(
63
- config: IConfig,
64
- pricer: PricerBase,
65
- metadata: IStrategyMetadata<S>
66
- ) {
67
- super(config);
68
- this.pricer = pricer;
41
+ // export class UniversalStrategy<
42
+ // S extends UniversalStrategySettings
43
+ // > extends BaseStrategy<
44
+ // SingleTokenInfo,
45
+ // SingleActionAmount
46
+ // > {
47
+
48
+ // /** Contract address of the strategy */
49
+ // readonly address: ContractAddr;
50
+ // /** Pricer instance for token price calculations */
51
+ // readonly pricer: PricerBase;
52
+ // /** Metadata containing strategy information */
53
+ // readonly metadata: IStrategyMetadata<S>;
54
+ // /** Contract instance for interacting with the strategy */
55
+ // readonly contract: Contract;
56
+ // readonly managerContract: Contract;
57
+ // merkleTree: StandardMerkleTree | undefined;
58
+
59
+ // constructor(
60
+ // config: IConfig,
61
+ // pricer: PricerBase,
62
+ // metadata: IStrategyMetadata<S>
63
+ // ) {
64
+ // super(config);
65
+ // this.pricer = pricer;
69
66
 
70
- assert(
71
- metadata.depositTokens.length === 1,
72
- "VesuRebalance only supports 1 deposit token"
73
- );
74
- this.metadata = metadata;
75
- this.address = metadata.address;
67
+ // assert(
68
+ // metadata.depositTokens.length === 1,
69
+ // "VesuRebalance only supports 1 deposit token"
70
+ // );
71
+ // this.metadata = metadata;
72
+ // this.address = metadata.address;
76
73
 
77
- this.contract = new Contract({
78
- abi: UniversalVaultAbi,
79
- address: this.address.address,
80
- providerOrAccount: this.config.provider
81
- });
82
- this.managerContract = new Contract({
83
- abi: ManagerAbi,
84
- address: this.metadata.additionalInfo.manager.address,
85
- providerOrAccount: this.config.provider
86
- });
87
- }
88
-
89
- getMerkleTree() {
90
- if (this.merkleTree) return this.merkleTree;
91
- const leaves = this.metadata.additionalInfo.leafAdapters.map((adapter, index) => {
92
- return adapter()
93
- });
94
- const standardTree = StandardMerkleTree.of(leaves.map(l => l.leaf));
95
- this.merkleTree = standardTree;
96
- return standardTree;
97
- }
98
-
99
- getMerkleRoot() {
100
- return this.getMerkleTree().root;
101
- }
102
-
103
- getProofs<T>(id: string): { proofs: string[], callConstructor: GenerateCallFn<T> } {
104
- const tree = this.getMerkleTree();
105
- let proofs: string[] = [];
106
- for (const [i, v] of tree.entries()) {
107
- if (v.readableId == id) {
108
- proofs = tree.getProof(i);
109
- }
110
- }
111
- if (proofs.length === 0) {
112
- throw new Error(`Proof not found for ID: ${id}`);
113
- }
114
-
115
- // find leaf adapter
116
- const leafAdapter = this.metadata.additionalInfo.leafAdapters.find(adapter => adapter().leaf.readableId === id);
117
- if (!leafAdapter) {
118
- throw new Error(`Leaf adapter not found for ID: ${id}`);
119
- }
120
- const leafInfo = leafAdapter();
121
- return {
122
- proofs,
123
- callConstructor: leafInfo.callConstructor.bind(leafInfo),
124
- };
125
- }
126
-
127
- getAdapter(id: string): BaseAdapter {
128
- const adapter = this.metadata.additionalInfo.adapters.find(adapter => adapter.id === id);
129
- if (!adapter) {
130
- throw new Error(`Adapter not found for ID: ${id}`);
131
- }
132
- return adapter.adapter;
133
- }
134
-
135
- asset() {
136
- return this.metadata.depositTokens[0];
137
- }
138
-
139
- async depositCall(amountInfo: SingleActionAmount, receiver: ContractAddr): Promise<Call[]> {
140
- // Technically its not erc4626 abi, but we just need approve call
141
- // so, its ok to use it
142
- assert(
143
- amountInfo.tokenInfo.address.eq(this.asset().address),
144
- "Deposit token mismatch"
145
- );
146
- const assetContract = new Contract({
147
- abi: UniversalVaultAbi,
148
- address: this.asset().address.address,
149
- providerOrAccount: this.config.provider
150
- });
151
- const call1 = assetContract.populate("approve", [
152
- this.address.address,
153
- uint256.bnToUint256(amountInfo.amount.toWei())
154
- ]);
155
- const call2 = this.contract.populate("deposit", [
156
- uint256.bnToUint256(amountInfo.amount.toWei()),
157
- receiver.address
158
- ]);
159
- return [call1, call2];
160
- }
161
-
162
- async withdrawCall(amountInfo: SingleActionAmount, receiver: ContractAddr, owner: ContractAddr): Promise<Call[]> {
163
- assert(
164
- amountInfo.tokenInfo.address.eq(this.asset().address),
165
- "Withdraw token mismatch"
166
- );
167
- const shares = await this.contract.call('convert_to_shares', [uint256.bnToUint256(amountInfo.amount.toWei())]);
168
- const call = this.contract.populate("request_redeem", [
169
- uint256.bnToUint256(shares.toString()),
170
- receiver.address,
171
- owner.address
172
- ]);
173
- return [call];
174
- }
175
-
176
- /**
177
- * Calculates the Total Value Locked (TVL) for a specific user.
178
- * @param user - Address of the user
179
- * @returns Object containing the amount in token units and USD value
180
- */
181
- async getUserTVL(user: ContractAddr) {
182
- const shares = await this.contract.balanceOf(user.address);
183
- const assets = await this.contract.convert_to_assets(
184
- uint256.bnToUint256(shares)
185
- );
186
- const amount = Web3Number.fromWei(
187
- assets.toString(),
188
- this.metadata.depositTokens[0].decimals
189
- );
190
- let price = await this.pricer.getPrice(
191
- this.metadata.depositTokens[0].symbol
192
- );
193
- const usdValue = Number(amount.toFixed(6)) * price.price;
194
- return {
195
- tokenInfo: this.asset(),
196
- amount,
197
- usdValue
198
- };
199
- }
200
-
201
- async getVesuAPYs() {
202
- // get Vesu pools, positions and APYs
203
- const vesuAdapters = this.getVesuAdapters();
204
- const allVesuPools = await VesuAdapter.getVesuPools();
205
- const pools = vesuAdapters.map((vesuAdapter) => {
206
- return allVesuPools.pools.find(p => vesuAdapter.config.poolId.eqString(num.getHexString(p.id)));
207
- });
208
- logger.verbose(`${this.metadata.name}::netAPY: vesu-pools: ${JSON.stringify(pools)}`);
209
- if (pools.some(p => !p)) {
210
- throw new Error('Pool not found');
211
- };
212
- const positions = await this.getVesuPositions();
213
- logger.verbose(`${this.metadata.name}::netAPY: positions: ${JSON.stringify(positions)}`);
214
- const baseAPYs: number[] = [];
215
- const rewardAPYs: number[] = [];
216
-
217
-
218
- for (const [index, pool] of pools.entries()) {
219
- const vesuAdapter = vesuAdapters[index];
220
- const collateralAsset = pool.assets.find((a: any) => a.symbol.toLowerCase() === vesuAdapter.config.collateral.symbol.toLowerCase())?.stats!;
221
- const debtAsset = pool.assets.find((a: any) => a.symbol.toLowerCase() === vesuAdapter.config.debt.symbol.toLowerCase())?.stats!;
222
- const supplyApy = Number(collateralAsset.supplyApy.value || 0) / 1e18;
223
-
224
- // Use LST APR from Endur API instead of Vesu's lstApr
225
- const lstAPY = await this.getLSTAPR(vesuAdapter.config.collateral.address);
226
- logger.verbose(`${this.metadata.name}::netAPY: ${vesuAdapter.config.collateral.symbol} LST APR from Endur: ${lstAPY}`);
227
-
228
- baseAPYs.push(...[supplyApy + lstAPY, Number(debtAsset.borrowApr.value) / 1e18]);
229
- rewardAPYs.push(...[Number(collateralAsset.defiSpringSupplyApr?.value || "0") / 1e18, 0]);
230
- }
231
- logger.verbose(`${this.metadata.name}::netAPY: baseAPYs: ${JSON.stringify(baseAPYs)}`);
232
- logger.verbose(`${this.metadata.name}::netAPY: rewardAPYs: ${JSON.stringify(rewardAPYs)}`);
233
-
234
- // Else further compute will fail
235
- assert(baseAPYs.length == positions.length, 'APYs and positions length mismatch');
236
-
237
- return {
238
- baseAPYs,
239
- rewardAPYs,
240
- positions
241
- }
242
- }
243
-
244
- /**
245
- * Calculates the weighted average APY across all pools based on USD value.
246
- * @returns {Promise<number>} The weighted average APY across all pools
247
- */
248
- async netAPY(): Promise<{ net: number, splits: { apy: number, id: string }[] }> {
249
- if (this.metadata.isPreview) {
250
- return { net: 0, splits: [{
251
- apy: 0, id: 'base'
252
- }, {
253
- apy: 0, id: 'defispring'
254
- }] };
255
- }
256
-
257
- const { positions, baseAPYs, rewardAPYs } = await this.getVesuAPYs();
258
-
259
- const unusedBalanceAPY = await this.getUnusedBalanceAPY();
260
- baseAPYs.push(...[unusedBalanceAPY.apy]);
261
- rewardAPYs.push(0);
262
-
263
- // Compute APy using weights
264
- const weights = positions.map((p, index) => p.usdValue * (index % 2 == 0 ? 1 : -1));
265
- weights.push(unusedBalanceAPY.weight);
266
-
267
- const prevAUM = await this.getPrevAUM();
268
- const price = await this.pricer.getPrice(this.metadata.depositTokens[0].symbol);
269
- const prevAUMUSD = prevAUM.multipliedBy(price.price);
270
- return this.returnNetAPY(baseAPYs, rewardAPYs, weights, prevAUMUSD);
271
- }
272
-
273
- protected async returnNetAPY(baseAPYs: number[], rewardAPYs: number[], weights: number[], prevAUMUSD: Web3Number) {
274
- // If no positions, return 0
275
- if (weights.every(p => p == 0)) {
276
- return { net: 0, splits: [{
277
- apy: 0, id: 'base'
278
- }, {
279
- apy: 0, id: 'defispring'
280
- }]};
281
- }
282
-
283
- const baseAPY = this.computeAPY(baseAPYs, weights, prevAUMUSD);
284
- const rewardAPY = this.computeAPY(rewardAPYs, weights, prevAUMUSD);
285
- const netAPY = baseAPY + rewardAPY;
286
- logger.verbose(`${this.metadata.name}::netAPY: net: ${netAPY}, baseAPY: ${baseAPY}, rewardAPY: ${rewardAPY}`);
287
- return { net: netAPY, splits: [{
288
- apy: baseAPY, id: 'base'
289
- }, {
290
- apy: rewardAPY, id: 'defispring'
291
- }] };
292
- }
293
-
294
- protected async getUnusedBalanceAPY() {
295
- return {
296
- apy: 0, weight: 0
297
- }
298
- }
299
-
300
- private computeAPY(apys: number[], weights: number[], currentAUM: Web3Number) {
301
- assert(apys.length === weights.length, "APYs and weights length mismatch");
302
- const weightedSum = apys.reduce((acc, apy, i) => acc + apy * weights[i], 0);
303
- logger.verbose(`${this.getTag()} computeAPY: apys: ${JSON.stringify(apys)}, weights: ${JSON.stringify(weights)}, weightedSum: ${weightedSum}, currentAUM: ${currentAUM}`);
304
- return weightedSum / currentAUM.toNumber();
305
- }
306
-
307
- /**
308
- * Calculates the total TVL of the strategy.
309
- * @returns Object containing the total amount in token units and USD value
310
- */
311
- async getTVL() {
312
- const assets = await this.contract.total_assets();
313
- const amount = Web3Number.fromWei(
314
- assets.toString(),
315
- this.metadata.depositTokens[0].decimals
316
- );
317
- let price = await this.pricer.getPrice(
318
- this.metadata.depositTokens[0].symbol
319
- );
320
- const usdValue = Number(amount.toFixed(6)) * price.price;
321
- return {
322
- tokenInfo: this.asset(),
323
- amount,
324
- usdValue
325
- };
326
- }
327
-
328
- async getUnusedBalance(): Promise<SingleTokenInfo> {
329
- const balance = await (new ERC20(this.config)).balanceOf(this.asset().address, this.metadata.additionalInfo.vaultAllocator, this.asset().decimals);
330
- const price = await this.pricer.getPrice(this.metadata.depositTokens[0].symbol);
331
- const usdValue = Number(balance.toFixed(6)) * price.price;
332
- return {
333
- tokenInfo: this.asset(),
334
- amount: balance,
335
- usdValue
336
- };
337
- }
338
-
339
- protected async getVesuAUM(adapter: VesuAdapter) {
340
- const legAUM = await adapter.getPositions(this.config);
341
- const underlying = this.asset();
342
- let vesuAum = Web3Number.fromWei("0", underlying.decimals);
74
+ // this.contract = new Contract({
75
+ // abi: UniversalVaultAbi,
76
+ // address: this.address.address,
77
+ // providerOrAccount: this.config.provider
78
+ // });
79
+ // this.managerContract = new Contract({
80
+ // abi: ManagerAbi,
81
+ // address: this.metadata.additionalInfo.manager.address,
82
+ // providerOrAccount: this.config.provider
83
+ // });
84
+ // }
85
+
86
+ // getAllLeaves() {
87
+ // const leaves = this.metadata.additionalInfo.leafAdapters.map((adapter, index) => {
88
+ // return adapter()
89
+ // });
90
+ // const _leaves: LeafData[] = [];
91
+ // leaves.forEach((_l) => {
92
+ // _leaves.push(..._l.leaves);
93
+ // })
94
+ // return _leaves;
95
+
96
+ // }
97
+ // getMerkleTree() {
98
+ // if (this.merkleTree) return this.merkleTree;
99
+ // const _leaves = this.getAllLeaves();
100
+
101
+ // const standardTree = StandardMerkleTree.of(_leaves);
102
+ // this.merkleTree = standardTree;
103
+ // return standardTree;
104
+ // }
105
+
106
+ // getMerkleRoot() {
107
+ // return this.getMerkleTree().root;
108
+ // }
109
+
110
+ // getAdapter(id: string): BaseAdapter<DepositParams, WithdrawParams> {
111
+ // const adapter = this.metadata.additionalInfo.adapters.find(adapter => adapter.id === id);
112
+ // if (!adapter) {
113
+ // throw new Error(`Adapter not found for ID: ${id}`);
114
+ // }
115
+ // return adapter.adapter;
116
+ // }
117
+
118
+ // asset() {
119
+ // return this.metadata.depositTokens[0];
120
+ // }
121
+
122
+ // async depositCall(amountInfo: SingleActionAmount, receiver: ContractAddr): Promise<Call[]> {
123
+ // // Technically its not erc4626 abi, but we just need approve call
124
+ // // so, its ok to use it
125
+ // assert(
126
+ // amountInfo.tokenInfo.address.eq(this.asset().address),
127
+ // "Deposit token mismatch"
128
+ // );
129
+ // const assetContract = new Contract({
130
+ // abi: UniversalVaultAbi,
131
+ // address: this.asset().address.address,
132
+ // providerOrAccount: this.config.provider
133
+ // });
134
+ // const call1 = assetContract.populate("approve", [
135
+ // this.address.address,
136
+ // uint256.bnToUint256(amountInfo.amount.toWei())
137
+ // ]);
138
+ // const call2 = this.contract.populate("deposit", [
139
+ // uint256.bnToUint256(amountInfo.amount.toWei()),
140
+ // receiver.address
141
+ // ]);
142
+ // return [call1, call2];
143
+ // }
144
+
145
+ // async withdrawCall(amountInfo: SingleActionAmount, receiver: ContractAddr, owner: ContractAddr): Promise<Call[]> {
146
+ // assert(
147
+ // amountInfo.tokenInfo.address.eq(this.asset().address),
148
+ // "Withdraw token mismatch"
149
+ // );
150
+ // const shares = await this.contract.call('convert_to_shares', [uint256.bnToUint256(amountInfo.amount.toWei())]);
151
+ // const call = this.contract.populate("request_redeem", [
152
+ // uint256.bnToUint256(shares.toString()),
153
+ // receiver.address,
154
+ // owner.address
155
+ // ]);
156
+ // return [call];
157
+ // }
158
+
159
+ // /**
160
+ // * Calculates the Total Value Locked (TVL) for a specific user.
161
+ // * @param user - Address of the user
162
+ // * @returns Object containing the amount in token units and USD value
163
+ // */
164
+ // async getUserTVL(user: ContractAddr) {
165
+ // const shares = await this.contract.balance_of(user.address);
166
+ // const assets = await this.contract.convert_to_assets(
167
+ // uint256.bnToUint256(shares)
168
+ // );
169
+ // const amount = Web3Number.fromWei(
170
+ // assets.toString(),
171
+ // this.metadata.depositTokens[0].decimals
172
+ // );
173
+ // let price = await this.pricer.getPrice(
174
+ // this.metadata.depositTokens[0].symbol
175
+ // );
176
+ // const usdValue = Number(amount.toFixed(6)) * price.price;
177
+ // return {
178
+ // tokenInfo: this.asset(),
179
+ // amount,
180
+ // usdValue
181
+ // };
182
+ // }
183
+
184
+ // /**
185
+ // * Calculates the weighted average APY across all pools based on USD value.
186
+ // * @returns {Promise<number>} The weighted average APY across all pools
187
+ // */
188
+ // async netAPY(): Promise<{ net: number, splits: { apy: number, id: string }[] }> {
189
+ // if (this.metadata.isPreview) {
190
+ // return { net: 0, splits: [{
191
+ // apy: 0, id: 'base'
192
+ // }, {
193
+ // apy: 0, id: 'defispring'
194
+ // }] };
195
+ // }
343
196
 
344
- let tokenUnderlyingPrice = await this.pricer.getPrice(this.asset().symbol);
345
- logger.verbose(`${this.getTag()} tokenUnderlyingPrice: ${tokenUnderlyingPrice.price}`);
197
+ // const { positions, baseAPYs, rewardAPYs } = await this.getVesuAPYs();
198
+
199
+ // const unusedBalanceAPY = await this.getUnusedBalanceAPY();
200
+ // baseAPYs.push(...[unusedBalanceAPY.apy]);
201
+ // rewardAPYs.push(0);
202
+
203
+ // // Compute APy using weights
204
+ // const weights = positions.map((p, index) => p.usdValue * (index % 2 == 0 ? 1 : -1));
205
+ // weights.push(unusedBalanceAPY.weight);
206
+
207
+ // const prevAUM = await this.getPrevAUM();
208
+ // const price = await this.pricer.getPrice(this.metadata.depositTokens[0].symbol);
209
+ // const prevAUMUSD = prevAUM.multipliedBy(price.price);
210
+ // return this.returnNetAPY(baseAPYs, rewardAPYs, weights, prevAUMUSD);
211
+ // }
212
+
213
+ // protected async returnNetAPY(baseAPYs: number[], rewardAPYs: number[], weights: number[], prevAUMUSD: Web3Number) {
214
+ // // If no positions, return 0
215
+ // if (weights.every(p => p == 0)) {
216
+ // return { net: 0, splits: [{
217
+ // apy: 0, id: 'base'
218
+ // }, {
219
+ // apy: 0, id: 'defispring'
220
+ // }]};
221
+ // }
222
+
223
+ // const baseAPY = this.computeAPY(baseAPYs, weights, prevAUMUSD);
224
+ // const rewardAPY = this.computeAPY(rewardAPYs, weights, prevAUMUSD);
225
+ // const netAPY = baseAPY + rewardAPY;
226
+ // logger.verbose(`${this.metadata.name}::netAPY: net: ${netAPY}, baseAPY: ${baseAPY}, rewardAPY: ${rewardAPY}`);
227
+ // return { net: netAPY, splits: [{
228
+ // apy: baseAPY, id: 'base'
229
+ // }, {
230
+ // apy: rewardAPY, id: 'defispring'
231
+ // }] };
232
+ // }
233
+
234
+ // protected async getUnusedBalanceAPY() {
235
+ // return {
236
+ // apy: 0, weight: 0
237
+ // }
238
+ // }
239
+
240
+ // private computeAPY(apys: number[], weights: number[], currentAUM: Web3Number) {
241
+ // assert(apys.length === weights.length, "APYs and weights length mismatch");
242
+ // const weightedSum = apys.reduce((acc, apy, i) => acc + apy * weights[i], 0);
243
+ // logger.verbose(`${this.getTag()} computeAPY: apys: ${JSON.stringify(apys)}, weights: ${JSON.stringify(weights)}, weightedSum: ${weightedSum}, currentAUM: ${currentAUM}`);
244
+ // return weightedSum / currentAUM.toNumber();
245
+ // }
246
+
247
+ // /**
248
+ // * Calculates the total TVL of the strategy.
249
+ // * @returns Object containing the total amount in token units and USD value
250
+ // */
251
+ // async getTVL() {
252
+ // const assets = await this.contract.total_assets();
253
+ // const amount = Web3Number.fromWei(
254
+ // assets.toString(),
255
+ // this.metadata.depositTokens[0].decimals
256
+ // );
257
+ // let price = await this.pricer.getPrice(
258
+ // this.metadata.depositTokens[0].symbol
259
+ // );
260
+ // const usdValue = Number(amount.toFixed(6)) * price.price;
261
+ // return {
262
+ // tokenInfo: this.asset(),
263
+ // amount,
264
+ // usdValue
265
+ // };
266
+ // }
267
+
268
+ // async getUnusedBalance(): Promise<SingleTokenInfo> {
269
+ // const balance = await (new ERC20(this.config)).balanceOf(this.asset().address, this.metadata.additionalInfo.vaultAllocator, this.asset().decimals);
270
+ // const price = await this.pricer.getPrice(this.metadata.depositTokens[0].symbol);
271
+ // const usdValue = Number(balance.toFixed(6)) * price.price;
272
+ // return {
273
+ // tokenInfo: this.asset(),
274
+ // amount: balance,
275
+ // usdValue
276
+ // };
277
+ // }
278
+
279
+ // protected async getVesuAUM(adapter: VesuAdapter) {
280
+ // const legAUM = await adapter.getPositions(this.config);
281
+ // const underlying = this.asset();
282
+ // let vesuAum = Web3Number.fromWei("0", underlying.decimals);
346
283
 
347
- // handle collateral
348
- if (legAUM[0].token.address.eq(underlying.address)) {
349
- vesuAum = vesuAum.plus(legAUM[0].amount);
350
- } else {
351
- vesuAum = vesuAum.plus(legAUM[0].usdValue / tokenUnderlyingPrice.price);
352
- }
353
-
354
- // handle debt
355
- if (legAUM[1].token.address.eq(underlying.address)) {
356
- vesuAum = vesuAum.minus(legAUM[1].amount);
357
- } else {
358
- vesuAum = vesuAum.minus(legAUM[1].usdValue / tokenUnderlyingPrice.price);
359
- };
360
-
361
- logger.verbose(`${this.getTag()} Vesu AUM: ${vesuAum}, legCollateral: ${legAUM[0].amount.toNumber()}, legDebt: ${legAUM[1].amount.toNumber()}`);
362
- return vesuAum;
363
- }
364
-
365
- async getPrevAUM() {
366
- const currentAUM: bigint = await this.contract.call('aum', []) as bigint;
367
- const prevAum = Web3Number.fromWei(currentAUM.toString(), this.asset().decimals);
368
- logger.verbose(`${this.getTag()} Prev AUM: ${prevAum}`);
369
- return prevAum;
370
- }
371
-
372
- async getAUM(): Promise<{net: SingleTokenInfo, prevAum: Web3Number, splits: {id: string, aum: Web3Number}[]}> {
373
- const prevAum = await this.getPrevAUM();
374
- const token1Price = await this.pricer.getPrice(this.metadata.depositTokens[0].symbol);
375
-
376
- // calculate vesu aum
377
- const vesuAdapters = this.getVesuAdapters();
378
- let vesuAum = Web3Number.fromWei("0", this.asset().decimals);
379
- for (const adapter of vesuAdapters) {
380
- vesuAum = vesuAum.plus(await this.getVesuAUM(adapter));
381
- }
382
-
383
- // account unused balance as aum as well (from vault allocator)
384
- const balance = await this.getUnusedBalance();
385
- logger.verbose(`${this.getTag()} unused balance: ${balance.amount.toNumber()}`);
386
-
387
- // Initiate return values
388
- const zeroAmt = Web3Number.fromWei('0', this.asset().decimals);
389
- const net = {
390
- tokenInfo: this.asset(),
391
- amount: zeroAmt,
392
- usdValue: 0
393
- };
394
- const aumToken = vesuAum.plus(balance.amount);
395
- if (aumToken.isZero()) {
396
- return { net, splits: [{
397
- aum: zeroAmt, id: AUMTypes.FINALISED
398
- }, {
399
- aum: zeroAmt, id: AUMTypes.DEFISPRING
400
- }], prevAum};
401
- }
402
- logger.verbose(`${this.getTag()} Actual AUM: ${aumToken}`);
403
-
404
- // compute rewards contribution to AUM
405
- const rewardAssets = await this.getRewardsAUM(prevAum);
406
-
407
- // Sum up and return
408
- const newAUM = aumToken.plus(rewardAssets);
409
- logger.verbose(`${this.getTag()} New AUM: ${newAUM}`);
284
+ // let tokenUnderlyingPrice = await this.pricer.getPrice(this.asset().symbol);
285
+ // logger.verbose(`${this.getTag()} tokenUnderlyingPrice: ${tokenUnderlyingPrice.price}`);
410
286
 
411
- net.amount = newAUM;
412
- net.usdValue = newAUM.multipliedBy(token1Price.price).toNumber();
413
- const splits = [{
414
- id: AUMTypes.FINALISED,
415
- aum: aumToken
416
- }, {
417
- id: AUMTypes.DEFISPRING,
418
- aum: rewardAssets
419
- }];
420
- return { net, splits, prevAum };
421
- }
422
-
423
- // account for future rewards (e.g. defispring rewards)
424
- protected async getRewardsAUM(prevAum: Web3Number) {
425
- const lastReportTime = await this.contract.call('last_report_timestamp', []);
426
- // - calculate estimated growth from strk rewards
427
- const netAPY = await this.netAPY();
428
- // account only 80% of value
429
- const defispringAPY = (netAPY.splits.find(s => s.id === 'defispring')?.apy || 0) * 0.8;
430
- // if (!defispringAPY) throw new Error('DefiSpring APY not found');
431
-
432
- // compute rewards contribution to AUM
433
- const timeDiff = (Math.round(Date.now() / 1000) - Number(lastReportTime));
434
- const growthRate = timeDiff * defispringAPY / (365 * 24 * 60 * 60);
435
- const rewardAssets = prevAum.multipliedBy(growthRate);
436
- logger.verbose(`${this.getTag()} DefiSpring AUM time difference: ${timeDiff}`);
437
- logger.verbose(`${this.getTag()} Current AUM: ${prevAum.toString()}`);
438
- logger.verbose(`${this.getTag()} Net APY: ${JSON.stringify(netAPY)}`);
439
- logger.verbose(`${this.getTag()} rewards AUM: ${rewardAssets}`);
440
-
441
- return rewardAssets;
442
- }
443
-
444
- getVesuAdapters() {
445
- const vesuAdapter1 = this.getAdapter(UNIVERSAL_ADAPTERS.VESU_LEG1) as VesuAdapter;
446
- const vesuAdapter2 = this.getAdapter(UNIVERSAL_ADAPTERS.VESU_LEG2) as VesuAdapter;
447
- vesuAdapter1.pricer = this.pricer;
448
- vesuAdapter2.pricer = this.pricer;
449
- vesuAdapter1.networkConfig = this.config;
450
- vesuAdapter2.networkConfig = this.config;
287
+ // // handle collateral
288
+ // if (legAUM[0].token.address.eq(underlying.address)) {
289
+ // vesuAum = vesuAum.plus(legAUM[0].amount);
290
+ // } else {
291
+ // vesuAum = vesuAum.plus(legAUM[0].usdValue / tokenUnderlyingPrice.price);
292
+ // }
293
+
294
+ // // handle debt
295
+ // if (legAUM[1].token.address.eq(underlying.address)) {
296
+ // vesuAum = vesuAum.minus(legAUM[1].amount);
297
+ // } else {
298
+ // vesuAum = vesuAum.minus(legAUM[1].usdValue / tokenUnderlyingPrice.price);
299
+ // };
300
+
301
+ // logger.verbose(`${this.getTag()} Vesu AUM: ${vesuAum}, legCollateral: ${legAUM[0].amount.toNumber()}, legDebt: ${legAUM[1].amount.toNumber()}`);
302
+ // return vesuAum;
303
+ // }
304
+
305
+ // async getPrevAUM() {
306
+ // const currentAUM: bigint = await this.contract.call('aum', []) as bigint;
307
+ // const prevAum = Web3Number.fromWei(currentAUM.toString(), this.asset().decimals);
308
+ // logger.verbose(`${this.getTag()} Prev AUM: ${prevAum}`);
309
+ // return prevAum;
310
+ // }
311
+
312
+ // async getAUM(): Promise<{net: SingleTokenInfo, prevAum: Web3Number, splits: {id: string, aum: Web3Number}[]}> {
313
+ // const prevAum = await this.getPrevAUM();
314
+ // const token1Price = await this.pricer.getPrice(this.metadata.depositTokens[0].symbol);
315
+
316
+ // // calculate vesu aum
317
+ // const vesuAdapters = this.getVesuAdapters();
318
+ // let vesuAum = Web3Number.fromWei("0", this.asset().decimals);
319
+ // for (const adapter of vesuAdapters) {
320
+ // vesuAum = vesuAum.plus(await this.getVesuAUM(adapter));
321
+ // }
322
+
323
+ // // account unused balance as aum as well (from vault allocator)
324
+ // const balance = await this.getUnusedBalance();
325
+ // logger.verbose(`${this.getTag()} unused balance: ${balance.amount.toNumber()}`);
326
+
327
+ // // Initiate return values
328
+ // const zeroAmt = Web3Number.fromWei('0', this.asset().decimals);
329
+ // const net = {
330
+ // tokenInfo: this.asset(),
331
+ // amount: zeroAmt,
332
+ // usdValue: 0
333
+ // };
334
+ // const aumToken = vesuAum.plus(balance.amount);
335
+ // if (aumToken.isZero()) {
336
+ // return { net, splits: [{
337
+ // aum: zeroAmt, id: AUMTypes.FINALISED
338
+ // }, {
339
+ // aum: zeroAmt, id: AUMTypes.DEFISPRING
340
+ // }], prevAum};
341
+ // }
342
+ // logger.verbose(`${this.getTag()} Actual AUM: ${aumToken}`);
343
+
344
+ // // compute rewards contribution to AUM
345
+ // const rewardAssets = await this.getRewardsAUM(prevAum);
346
+
347
+ // // Sum up and return
348
+ // const newAUM = aumToken.plus(rewardAssets);
349
+ // logger.verbose(`${this.getTag()} New AUM: ${newAUM}`);
451
350
 
452
- return [vesuAdapter1, vesuAdapter2];
453
- }
454
-
455
- async getVesuPositions(blockNumber: BlockIdentifier = 'latest'): Promise<VaultPosition[]> {
456
- const adapters = this.getVesuAdapters();
457
- const positions: VaultPosition[] = [];
458
- for (const adapter of adapters) {
459
- positions.push(...await adapter.getPositions(this.config, blockNumber));
460
- }
461
- return positions;
462
- }
463
-
464
- async getVaultPositions(): Promise<VaultPosition[]> {
465
- const vesuPositions = await this.getVesuPositions();
466
- const unusedBalance = await this.getUnusedBalance();
467
- return [...vesuPositions, {
468
- amount: unusedBalance.amount,
469
- usdValue: unusedBalance.usdValue,
470
- token: this.asset(),
471
- remarks: "Unused Balance (may not include recent deposits)"
472
- }];
473
- }
474
-
475
- getSetManagerCall(strategist: ContractAddr, root = this.getMerkleRoot()) {
476
- return this.managerContract.populate('set_manage_root', [strategist.address, num.getHexString(root)]);
477
- }
351
+ // net.amount = newAUM;
352
+ // net.usdValue = newAUM.multipliedBy(token1Price.price).toNumber();
353
+ // const splits = [{
354
+ // id: AUMTypes.FINALISED,
355
+ // aum: aumToken
356
+ // }, {
357
+ // id: AUMTypes.DEFISPRING,
358
+ // aum: rewardAssets
359
+ // }];
360
+ // return { net, splits, prevAum };
361
+ // }
362
+
363
+ // // account for future rewards (e.g. defispring rewards)
364
+ // protected async getRewardsAUM(prevAum: Web3Number) {
365
+ // const lastReportTime = await this.contract.call('last_report_timestamp', []);
366
+ // // - calculate estimated growth from strk rewards
367
+ // const netAPY = await this.netAPY();
368
+ // // account only 80% of value
369
+ // const defispringAPY = (netAPY.splits.find(s => s.id === 'defispring')?.apy || 0) * 0.8;
370
+ // if (!defispringAPY) throw new Error('DefiSpring APY not found');
371
+
372
+ // // compute rewards contribution to AUM
373
+ // const timeDiff = (Math.round(Date.now() / 1000) - Number(lastReportTime));
374
+ // const growthRate = timeDiff * defispringAPY / (365 * 24 * 60 * 60);
375
+ // const rewardAssets = prevAum.multipliedBy(growthRate);
376
+ // logger.verbose(`${this.getTag()} DefiSpring AUM time difference: ${timeDiff}`);
377
+ // logger.verbose(`${this.getTag()} Current AUM: ${prevAum.toString()}`);
378
+ // logger.verbose(`${this.getTag()} Net APY: ${JSON.stringify(netAPY)}`);
379
+ // logger.verbose(`${this.getTag()} rewards AUM: ${rewardAssets}`);
380
+
381
+ // return rewardAssets;
382
+ // }
383
+
384
+
385
+
386
+ // async getVaultPositions(): Promise<VaultPosition[]> {
387
+ // const vesuPositions = await this.getVesuPositions();
388
+ // const unusedBalance = await this.getUnusedBalance();
389
+ // return [...vesuPositions, {
390
+ // amount: unusedBalance.amount,
391
+ // usdValue: unusedBalance.usdValue,
392
+ // token: this.asset(),
393
+ // remarks: "Unused Balance (may not include recent deposits)"
394
+ // }];
395
+ // }
396
+
397
+ // getSetManagerCall(strategist: ContractAddr, root = this.getMerkleRoot()) {
398
+ // return this.managerContract.populate('set_manage_root', [strategist.address, num.getHexString(root)]);
399
+ // }
478
400
 
479
- getManageCall(proofIds: string[], manageCalls: ManageCall[]) {
480
- assert(proofIds.length == manageCalls.length, 'Proof IDs and Manage Calls length mismatch');
481
- return this.managerContract.populate('manage_vault_with_merkle_verification', {
482
- proofs: proofIds.map(id => this.getProofs(id).proofs),
483
- decoder_and_sanitizers: manageCalls.map(call => call.sanitizer.address),
484
- targets: manageCalls.map(call => call.call.contractAddress.address),
485
- selectors: manageCalls.map(call => call.call.selector),
486
- calldatas: manageCalls.map(call => call.call.calldata), // Calldata[]
487
- });
488
- }
401
+ // getManageCall(proofIds: string[], manageCalls: ManageCall[]) {
402
+ // assert(proofIds.length == manageCalls.length, 'Proof IDs and Manage Calls length mismatch');
403
+ // return this.managerContract.populate('manage_vault_with_merkle_verification', {
404
+ // proofs: proofIds.map(id => this.getProofs(id).proofs),
405
+ // decoder_and_sanitizers: manageCalls.map(call => call.sanitizer.address),
406
+ // targets: manageCalls.map(call => call.call.contractAddress.address),
407
+ // selectors: manageCalls.map(call => call.call.selector),
408
+ // calldatas: manageCalls.map(call => call.call.calldata), // Calldata[]
409
+ // });
410
+ // }
489
411
 
490
- getVesuModifyPositionCalls(params: {
491
- isLeg1: boolean,
492
- isDeposit: boolean,
493
- depositAmount: Web3Number,
494
- debtAmount: Web3Number
495
- }): UniversalManageCall[] {
496
- assert(params.depositAmount.gt(0) || params.debtAmount.gt(0), 'Either deposit or debt amount must be greater than 0');
497
- // approve token
498
- const isToken1 = params.isLeg1 == params.isDeposit; // XOR
499
- const STEP1_ID = isToken1 ? UNIVERSAL_MANAGE_IDS.APPROVE_TOKEN1 :UNIVERSAL_MANAGE_IDS.APPROVE_TOKEN2;
500
- const manage4Info = this.getProofs<ApproveCallParams>(STEP1_ID);
501
- const approveAmount = params.isDeposit ? params.depositAmount : params.debtAmount;
502
- const manageCall4 = manage4Info.callConstructor({
503
- amount: approveAmount
504
- })
505
-
506
- // deposit and borrow or repay and withdraw
507
- const STEP2_ID = params.isLeg1 ? UNIVERSAL_MANAGE_IDS.VESU_LEG1 : UNIVERSAL_MANAGE_IDS.VESU_LEG2;
508
- const manage5Info = this.getProofs<VesuModifyPositionCallParams>(STEP2_ID);
509
- const manageCall5 = manage5Info.callConstructor(VesuAdapter.getDefaultModifyPositionCallParams({
510
- collateralAmount: params.depositAmount,
511
- isAddCollateral: params.isDeposit,
512
- debtAmount: params.debtAmount,
513
- isBorrow: params.isDeposit
514
- }))
515
-
516
- const output = [{
517
- proofs: manage5Info.proofs,
518
- manageCall: manageCall5,
519
- step: STEP2_ID
520
- }];
521
- if (approveAmount.gt(0)) {
522
- output.unshift({
523
- proofs: manage4Info.proofs,
524
- manageCall: manageCall4,
525
- step: STEP1_ID
526
- })
527
- }
528
- return output;
529
- }
530
-
531
- getTag() {
532
- return `${UniversalStrategy.name}:${this.metadata.name}`;
533
- }
534
-
535
- /**
536
- * Gets LST APR for the strategy's underlying asset from Endur API
537
- * @returns Promise<number> The LST APR (not divided by 1e18)
538
- */
539
- async getLSTAPR(address: ContractAddr): Promise<number> {
540
- return 0;
541
- }
542
-
543
- async getVesuHealthFactors(blockNumber: BlockIdentifier = 'latest') {
544
- return await Promise.all(this.getVesuAdapters().map(v => v.getHealthFactor(blockNumber)));
545
- }
546
-
547
- async computeRebalanceConditionAndReturnCalls(): Promise<Call[]> {
548
- const vesuAdapters = this.getVesuAdapters();
549
- const healthFactors = await this.getVesuHealthFactors();
550
- const leg1HealthFactor = healthFactors[0];
551
- const leg2HealthFactor = healthFactors[1];
552
- logger.verbose(`${this.getTag()}: HealthFactorLeg1: ${leg1HealthFactor}`);
553
- logger.verbose(`${this.getTag()}: HealthFactorLeg2: ${leg2HealthFactor}`);
554
-
555
- const minHf = this.metadata.additionalInfo.minHealthFactor;
556
- const isRebalanceNeeded1 = leg1HealthFactor < minHf;
557
- const isRebalanceNeeded2 = leg2HealthFactor < minHf;
558
- if (!isRebalanceNeeded1 && !isRebalanceNeeded2) {
559
- return [];
560
- }
412
+ // getVesuModifyPositionCalls(params: {
413
+ // isLeg1: boolean,
414
+ // isDeposit: boolean,
415
+ // depositAmount: Web3Number,
416
+ // debtAmount: Web3Number
417
+ // }): UniversalManageCall[] {
418
+ // assert(params.depositAmount.gt(0) || params.debtAmount.gt(0), 'Either deposit or debt amount must be greater than 0');
419
+ // // approve token
420
+ // const isToken1 = params.isLeg1 == params.isDeposit; // XOR
421
+ // const STEP1_ID = isToken1 ? UNIVERSAL_MANAGE_IDS.APPROVE_TOKEN1 :UNIVERSAL_MANAGE_IDS.APPROVE_TOKEN2;
422
+ // const manage4Info = this.getProofs<ApproveCallParams>(STEP1_ID);
423
+ // const approveAmount = params.isDeposit ? params.depositAmount : params.debtAmount;
424
+ // const manageCall4 = manage4Info.callConstructor({
425
+ // amount: approveAmount
426
+ // })
427
+
428
+ // // deposit and borrow or repay and withdraw
429
+ // const STEP2_ID = params.isLeg1 ? UNIVERSAL_MANAGE_IDS.VESU_LEG1 : UNIVERSAL_MANAGE_IDS.VESU_LEG2;
430
+ // const manage5Info = this.getProofs<VesuModifyPositionCallParams>(STEP2_ID);
431
+ // const manageCall5 = manage5Info.callConstructor(VesuAdapter.getDefaultModifyPositionCallParams({
432
+ // collateralAmount: params.depositAmount,
433
+ // isAddCollateral: params.isDeposit,
434
+ // debtAmount: params.debtAmount,
435
+ // isBorrow: params.isDeposit
436
+ // }))
437
+
438
+ // const output = [{
439
+ // proofs: manage5Info.proofs,
440
+ // manageCall: manageCall5,
441
+ // step: STEP2_ID
442
+ // }];
443
+ // if (approveAmount.gt(0)) {
444
+ // output.unshift({
445
+ // proofs: manage4Info.proofs,
446
+ // manageCall: manageCall4,
447
+ // step: STEP1_ID
448
+ // })
449
+ // }
450
+ // return output;
451
+ // }
452
+
453
+ // getTag() {
454
+ // return `${UniversalStrategy.name}:${this.metadata.name}`;
455
+ // }
456
+
457
+ // /**
458
+ // * Gets LST APR for the strategy's underlying asset from Endur API
459
+ // * @returns Promise<number> The LST APR (not divided by 1e18)
460
+ // */
461
+ // async getLSTAPR(address: ContractAddr): Promise<number> {
462
+ // return 0;
463
+ // }
464
+
465
+ // async getVesuHealthFactors(blockNumber: BlockIdentifier = 'latest') {
466
+ // return await Promise.all(this.getVesuAdapters().map(v => v.getHealthFactor(blockNumber)));
467
+ // }
468
+
469
+ // async computeRebalanceConditionAndReturnCalls(): Promise<Call[]> {
470
+ // const vesuAdapters = this.getVesuAdapters();
471
+ // const healthFactors = await this.getVesuHealthFactors();
472
+ // const leg1HealthFactor = healthFactors[0];
473
+ // const leg2HealthFactor = healthFactors[1];
474
+ // logger.verbose(`${this.getTag()}: HealthFactorLeg1: ${leg1HealthFactor}`);
475
+ // logger.verbose(`${this.getTag()}: HealthFactorLeg2: ${leg2HealthFactor}`);
476
+
477
+ // const minHf = this.metadata.additionalInfo.minHealthFactor;
478
+ // const isRebalanceNeeded1 = leg1HealthFactor < minHf;
479
+ // const isRebalanceNeeded2 = leg2HealthFactor < minHf;
480
+ // if (!isRebalanceNeeded1 && !isRebalanceNeeded2) {
481
+ // return [];
482
+ // }
561
483
 
562
- if (isRebalanceNeeded1) {
563
- const amount = await this.getLegRebalanceAmount(vesuAdapters[0], leg1HealthFactor, false);
564
- const leg2HF = await this.getNewHealthFactor(vesuAdapters[1], amount, true);
565
- assert(leg2HF > minHf, `Rebalance Leg1 failed: Leg2 HF after rebalance would be too low: ${leg2HF}`);
566
- return [await this.getRebalanceCall({
567
- isLeg1toLeg2: false,
568
- amount: amount
569
- })];
570
- } else {
571
- const amount = await this.getLegRebalanceAmount(vesuAdapters[1], leg2HealthFactor, true);
572
- const leg1HF = await this.getNewHealthFactor(vesuAdapters[0], amount, false);
573
- assert(leg1HF > minHf, `Rebalance Leg2 failed: Leg1 HF after rebalance would be too low: ${leg1HF}`);
574
- return [await this.getRebalanceCall({
575
- isLeg1toLeg2: true,
576
- amount: amount
577
- })];
578
- }
579
- }
580
-
581
- private async getNewHealthFactor(vesuAdapter: VesuAdapter, newAmount: Web3Number, isWithdraw: boolean) {
582
- const {
583
- collateralTokenAmount,
584
- collateralUSDAmount,
585
- collateralPrice,
586
- debtTokenAmount,
587
- debtUSDAmount,
588
- debtPrice,
589
- ltv
590
- } = await vesuAdapter.getAssetPrices();
591
-
592
- if (isWithdraw) {
593
- const newHF = ((collateralTokenAmount.toNumber() - newAmount.toNumber()) * collateralPrice * ltv) / debtUSDAmount;
594
- logger.verbose(`getNewHealthFactor:: HF: ${newHF}, amoutn: ${newAmount.toNumber()}, isDeposit`);
595
- return newHF;
596
- } else { // is borrow
597
- const newHF = (collateralUSDAmount * ltv) / ((debtTokenAmount.toNumber() + newAmount.toNumber()) * debtPrice);
598
- logger.verbose(`getNewHealthFactor:: HF: ${newHF}, amoutn: ${newAmount.toNumber()}, isRepay`);
599
- return newHF;
600
- }
601
- }
602
-
603
- /**
604
- *
605
- * @param vesuAdapter
606
- * @param currentHf
607
- * @param isDeposit if true, attempt by adding collateral, else by repaying
608
- * @returns
609
- */
610
- private async getLegRebalanceAmount(vesuAdapter: VesuAdapter, currentHf: number, isDeposit: boolean) {
611
- const {
612
- collateralTokenAmount,
613
- collateralUSDAmount,
614
- collateralPrice,
615
- debtTokenAmount,
616
- debtUSDAmount,
617
- debtPrice,
618
- ltv
619
- } = await vesuAdapter.getAssetPrices();
620
-
621
- // debt is zero, nothing to rebalance
622
- if(debtTokenAmount.isZero()) {
623
- return Web3Number.fromWei(0, 0);
624
- }
625
-
626
- assert(collateralPrice > 0 && debtPrice > 0, "getRebalanceAmount: Invalid price");
627
-
628
- // avoid calculating for too close
629
- const targetHF = this.metadata.additionalInfo.targetHealthFactor;
630
- if (currentHf > targetHF - 0.01)
631
- throw new Error("getLegRebalanceAmount: Current health factor is healthy");
632
-
633
- if (isDeposit) {
634
- // TargetHF = (collAmount + newAmount) * price * ltv / debtUSD
635
- const newAmount = targetHF * debtUSDAmount / (collateralPrice * ltv) - collateralTokenAmount.toNumber();
636
- logger.verbose(`${this.getTag()}:: getLegRebalanceAmount: addCollateral, currentHf: ${currentHf}, targetHF: ${targetHF}, collAmount: ${collateralTokenAmount.toString()}, collUSD: ${collateralUSDAmount}, collPrice: ${collateralPrice}, debtAmount: ${debtTokenAmount.toString()}, debtUSD: ${debtUSDAmount}, debtPrice: ${debtPrice}, ltv: ${ltv}, newAmount: ${newAmount}`);
637
- return new Web3Number(newAmount.toFixed(8), collateralTokenAmount.decimals);
638
- } else {
639
- // TargetHF = collUSD * ltv / (debtAmount - newAmount) * debtPrice
640
- const newAmount = debtTokenAmount.toNumber() - collateralUSDAmount * ltv / (targetHF * debtPrice);
641
- logger.verbose(`${this.getTag()}:: getLegRebalanceAmount: repayDebt, currentHf: ${currentHf}, targetHF: ${targetHF}, collAmount: ${collateralTokenAmount.toString()}, collUSD: ${collateralUSDAmount}, collPrice: ${collateralPrice}, debtAmount: ${debtTokenAmount.toString()}, debtUSD: ${debtUSDAmount}, debtPrice: ${debtPrice}, ltv: ${ltv}, newAmount: ${newAmount}`);
642
- return new Web3Number(newAmount.toFixed(8), debtTokenAmount.decimals);
643
- }
644
- }
645
-
646
- async getVesuModifyPositionCall(params: {
647
- isDeposit: boolean,
648
- leg1DepositAmount: Web3Number
649
- }) {
650
- const [vesuAdapter1, vesuAdapter2] = this.getVesuAdapters();
651
- const leg1LTV = await vesuAdapter1.getLTVConfig(this.config);
652
- const leg2LTV = await vesuAdapter2.getLTVConfig(this.config);
653
- logger.verbose(`${this.getTag()}: LTVLeg1: ${leg1LTV}`);
654
- logger.verbose(`${this.getTag()}: LTVLeg2: ${leg2LTV}`);
655
-
656
- const token1Price = await this.pricer.getPrice(vesuAdapter1.config.collateral.symbol);
657
- const token2Price = await this.pricer.getPrice(vesuAdapter2.config.collateral.symbol);
658
- logger.verbose(`${this.getTag()}: Price${vesuAdapter1.config.collateral.symbol}: ${token1Price.price}`);
659
- logger.verbose(`${this.getTag()}: Price${vesuAdapter2.config.collateral.symbol}: ${token2Price.price}`);
660
-
661
- const TARGET_HF = this.metadata.additionalInfo.targetHealthFactor;
662
-
663
- const k1 = token1Price.price * leg1LTV / token2Price.price / TARGET_HF;
664
- const k2 = token1Price.price * TARGET_HF / token2Price.price / leg2LTV;
665
-
666
- const borrow2Amount = new Web3Number(
667
- params.leg1DepositAmount.multipliedBy(k1.toFixed(6)).dividedBy(k2 - k1).toFixed(6),
668
- vesuAdapter2.config.debt.decimals
669
- );
670
- const borrow1Amount = new Web3Number(
671
- borrow2Amount.multipliedBy(k2).toFixed(6),
672
- vesuAdapter1.config.debt.decimals
673
- );
674
- logger.verbose(`${this.getTag()}:: leg1DepositAmount: ${params.leg1DepositAmount.toString()} ${vesuAdapter1.config.collateral.symbol}`);
675
- logger.verbose(`${this.getTag()}:: borrow1Amount: ${borrow1Amount.toString()} ${vesuAdapter1.config.debt.symbol}`);
676
- logger.verbose(`${this.getTag()}:: borrow2Amount: ${borrow2Amount.toString()} ${vesuAdapter2.config.debt.symbol}`);
677
-
678
- let callSet1 = this.getVesuModifyPositionCalls({
679
- isLeg1: true,
680
- isDeposit: params.isDeposit,
681
- depositAmount: params.leg1DepositAmount.plus(borrow2Amount),
682
- debtAmount: borrow1Amount
683
- });
684
-
685
- let callSet2 = this.getVesuModifyPositionCalls({
686
- isLeg1: false,
687
- isDeposit: params.isDeposit,
688
- depositAmount: borrow1Amount,
689
- debtAmount: borrow2Amount
690
- });
691
-
692
- if (!params.isDeposit) {
693
- let temp = callSet2;
694
- callSet2 = [...callSet1];
695
- callSet1 = [...temp];
696
- }
697
- const allActions = [...callSet1.map(i => i.manageCall), ...callSet2.map(i => i.manageCall)];
698
- const flashloanCalldata = CallData.compile([
699
- [...callSet1.map(i => i.proofs), ...callSet2.map(i => i.proofs)],
700
- allActions.map(i => i.sanitizer.address),
701
- allActions.map(i => i.call.contractAddress.address),
702
- allActions.map(i => i.call.selector),
703
- allActions.map(i => i.call.calldata)
704
- ])
705
-
706
- // flash loan
707
- const STEP1_ID = UNIVERSAL_MANAGE_IDS.FLASH_LOAN;
708
- const manage1Info = this.getProofs<FlashloanCallParams>(STEP1_ID);
709
- const manageCall1 = manage1Info.callConstructor({
710
- amount: borrow2Amount,
711
- data: flashloanCalldata.map(i => BigInt(i))
712
- })
713
- const manageCall = this.getManageCall([UNIVERSAL_MANAGE_IDS.FLASH_LOAN], [manageCall1]);
714
- return manageCall;
715
- }
716
-
717
- async getBringLiquidityCall(params: {
718
- amount: Web3Number
719
- }) {
720
- const manage1Info = this.getProofs<ApproveCallParams>(UNIVERSAL_MANAGE_IDS.APPROVE_BRING_LIQUIDITY);
721
- const manageCall1 = manage1Info.callConstructor({
722
- amount: params.amount
723
- });
724
- const manage2Info = this.getProofs<ApproveCallParams>(UNIVERSAL_MANAGE_IDS.BRING_LIQUIDITY);
725
- const manageCall2 = manage2Info.callConstructor({
726
- amount: params.amount
727
- });
728
- const manageCall = this.getManageCall([UNIVERSAL_MANAGE_IDS.APPROVE_BRING_LIQUIDITY, UNIVERSAL_MANAGE_IDS.BRING_LIQUIDITY], [manageCall1, manageCall2]);
729
- return manageCall;
730
- }
731
-
732
- async getPendingRewards(): Promise<HarvestInfo[]> {
733
- const vesuHarvest = new VesuHarvests(this.config);
734
- return await vesuHarvest.getUnHarvestedRewards(this.metadata.additionalInfo.vaultAllocator);
735
- }
736
-
737
- async getHarvestCall() {
738
- const harvestInfo = await this.getPendingRewards();
739
- if (harvestInfo.length == 0) {
740
- throw new Error(`No pending rewards found`);
741
- }
742
- if (harvestInfo.length != 1) {
743
- throw new Error(`Expected 1 harvest info, got ${harvestInfo.length}`);
744
- }
745
-
746
- const amount = harvestInfo[0].claim.amount;
747
- const actualReward = harvestInfo[0].actualReward;
748
- const proofs = harvestInfo[0].proof;
749
- if (actualReward.isZero()) {
750
- throw new Error(`Expected non-zero actual reward, got ${harvestInfo[0].actualReward}`);
751
- }
752
-
753
- const manage1Info = this.getProofs<VesuDefiSpringRewardsCallParams>(UNIVERSAL_MANAGE_IDS.DEFISPRING_REWARDS);
754
- const manageCall1 = manage1Info.callConstructor({
755
- amount,
756
- proofs
757
- });
758
- const proofIds: string[] = [UNIVERSAL_MANAGE_IDS.DEFISPRING_REWARDS];
759
- const manageCalls: ManageCall[] = [manageCall1];
760
-
761
- // swap rewards for underlying
762
- const STRK = Global.getDefaultTokens().find(t => t.symbol === 'STRK')!;
763
- if (this.asset().symbol != 'STRK') {
764
- // approve
765
- const manage2Info = this.getProofs<ApproveCallParams>(UNIVERSAL_MANAGE_IDS.APPROVE_SWAP_TOKEN1);
766
- const manageCall2 = manage2Info.callConstructor({
767
- amount: actualReward
768
- });
769
-
770
- // swap
771
- const avnuModule = new AvnuWrapper();
772
- const quote = await avnuModule.getQuotes(
773
- STRK.address.address,
774
- this.asset().address.address,
775
- actualReward.toWei(),
776
- this.address.address
777
- );
778
- const swapInfo = await avnuModule.getSwapInfo(quote, this.address.address, 0, this.address.address);
779
- const manage3Info = this.getProofs<AvnuSwapCallParams>(UNIVERSAL_MANAGE_IDS.AVNU_SWAP_REWARDS);
780
- const manageCall3 = manage3Info.callConstructor({
781
- props: swapInfo
782
- });
783
- proofIds.push(UNIVERSAL_MANAGE_IDS.APPROVE_SWAP_TOKEN1);
784
- proofIds.push(UNIVERSAL_MANAGE_IDS.AVNU_SWAP_REWARDS);
785
-
786
- manageCalls.push(manageCall2);
787
- manageCalls.push(manageCall3);
788
- }
789
-
790
- const manageCall = this.getManageCall(proofIds, manageCalls);
791
- return { call: manageCall, reward: actualReward, tokenInfo: STRK };
792
- }
793
-
794
- async getRebalanceCall(params: {
795
- isLeg1toLeg2: boolean,
796
- amount: Web3Number
797
- }) {
798
- let callSet1 = this.getVesuModifyPositionCalls({
799
- isLeg1: true,
800
- isDeposit: params.isLeg1toLeg2,
801
- depositAmount: Web3Number.fromWei(0, 0),
802
- debtAmount: params.amount
803
- });
804
-
805
- let callSet2 = this.getVesuModifyPositionCalls({
806
- isLeg1: false,
807
- isDeposit: params.isLeg1toLeg2,
808
- depositAmount: params.amount,
809
- debtAmount: Web3Number.fromWei(0, 0)
810
- });
811
-
812
- if (params.isLeg1toLeg2) {
813
- const manageCall = this.getManageCall([
814
- ...callSet1.map(i => i.step), ...callSet2.map(i => i.step)
815
- ], [...callSet1.map(i => i.manageCall), ...callSet2.map(i => i.manageCall)]);
816
- return manageCall;
817
- } else {
818
- const manageCall = this.getManageCall([
819
- ...callSet2.map(i => i.step), ...callSet1.map(i => i.step)
820
- ], [...callSet2.map(i => i.manageCall), ...callSet1.map(i => i.manageCall)]);
821
- return manageCall;
822
- }
823
- }
824
- }
484
+ // if (isRebalanceNeeded1) {
485
+ // const amount = await this.getLegRebalanceAmount(vesuAdapters[0], leg1HealthFactor, false);
486
+ // const leg2HF = await this.getNewHealthFactor(vesuAdapters[1], amount, true);
487
+ // assert(leg2HF > minHf, `Rebalance Leg1 failed: Leg2 HF after rebalance would be too low: ${leg2HF}`);
488
+ // return [await this.getRebalanceCall({
489
+ // isLeg1toLeg2: false,
490
+ // amount: amount
491
+ // })];
492
+ // } else {
493
+ // const amount = await this.getLegRebalanceAmount(vesuAdapters[1], leg2HealthFactor, true);
494
+ // const leg1HF = await this.getNewHealthFactor(vesuAdapters[0], amount, false);
495
+ // assert(leg1HF > minHf, `Rebalance Leg2 failed: Leg1 HF after rebalance would be too low: ${leg1HF}`);
496
+ // return [await this.getRebalanceCall({
497
+ // isLeg1toLeg2: true,
498
+ // amount: amount
499
+ // })];
500
+ // }
501
+ // }
502
+
503
+ // private async getNewHealthFactor(vesuAdapter: VesuAdapter, newAmount: Web3Number, isWithdraw: boolean) {
504
+ // const {
505
+ // collateralTokenAmount,
506
+ // collateralUSDAmount,
507
+ // collateralPrice,
508
+ // debtTokenAmount,
509
+ // debtUSDAmount,
510
+ // debtPrice,
511
+ // ltv
512
+ // } = await vesuAdapter.getAssetPrices();
513
+
514
+ // if (isWithdraw) {
515
+ // const newHF = ((collateralTokenAmount.toNumber() - newAmount.toNumber()) * collateralPrice * ltv) / debtUSDAmount;
516
+ // logger.verbose(`getNewHealthFactor:: HF: ${newHF}, amoutn: ${newAmount.toNumber()}, isDeposit`);
517
+ // return newHF;
518
+ // } else { // is borrow
519
+ // const newHF = (collateralUSDAmount * ltv) / ((debtTokenAmount.toNumber() + newAmount.toNumber()) * debtPrice);
520
+ // logger.verbose(`getNewHealthFactor:: HF: ${newHF}, amoutn: ${newAmount.toNumber()}, isRepay`);
521
+ // return newHF;
522
+ // }
523
+ // }
524
+
525
+ // /**
526
+ // *
527
+ // * @param vesuAdapter
528
+ // * @param currentHf
529
+ // * @param isDeposit if true, attempt by adding collateral, else by repaying
530
+ // * @returns
531
+ // */
532
+ // private async getLegRebalanceAmount(vesuAdapter: VesuAdapter, currentHf: number, isDeposit: boolean) {
533
+ // const {
534
+ // collateralTokenAmount,
535
+ // collateralUSDAmount,
536
+ // collateralPrice,
537
+ // debtTokenAmount,
538
+ // debtUSDAmount,
539
+ // debtPrice,
540
+ // ltv
541
+ // } = await vesuAdapter.getAssetPrices();
542
+
543
+ // // debt is zero, nothing to rebalance
544
+ // if(debtTokenAmount.isZero()) {
545
+ // return Web3Number.fromWei(0, 0);
546
+ // }
547
+
548
+ // assert(collateralPrice > 0 && debtPrice > 0, "getRebalanceAmount: Invalid price");
549
+
550
+ // // avoid calculating for too close
551
+ // const targetHF = this.metadata.additionalInfo.targetHealthFactor;
552
+ // if (currentHf > targetHF - 0.01)
553
+ // throw new Error("getLegRebalanceAmount: Current health factor is healthy");
554
+
555
+ // if (isDeposit) {
556
+ // // TargetHF = (collAmount + newAmount) * price * ltv / debtUSD
557
+ // const newAmount = targetHF * debtUSDAmount / (collateralPrice * ltv) - collateralTokenAmount.toNumber();
558
+ // logger.verbose(`${this.getTag()}:: getLegRebalanceAmount: addCollateral, currentHf: ${currentHf}, targetHF: ${targetHF}, collAmount: ${collateralTokenAmount.toString()}, collUSD: ${collateralUSDAmount}, collPrice: ${collateralPrice}, debtAmount: ${debtTokenAmount.toString()}, debtUSD: ${debtUSDAmount}, debtPrice: ${debtPrice}, ltv: ${ltv}, newAmount: ${newAmount}`);
559
+ // return new Web3Number(newAmount.toFixed(8), collateralTokenAmount.decimals);
560
+ // } else {
561
+ // // TargetHF = collUSD * ltv / (debtAmount - newAmount) * debtPrice
562
+ // const newAmount = debtTokenAmount.toNumber() - collateralUSDAmount * ltv / (targetHF * debtPrice);
563
+ // logger.verbose(`${this.getTag()}:: getLegRebalanceAmount: repayDebt, currentHf: ${currentHf}, targetHF: ${targetHF}, collAmount: ${collateralTokenAmount.toString()}, collUSD: ${collateralUSDAmount}, collPrice: ${collateralPrice}, debtAmount: ${debtTokenAmount.toString()}, debtUSD: ${debtUSDAmount}, debtPrice: ${debtPrice}, ltv: ${ltv}, newAmount: ${newAmount}`);
564
+ // return new Web3Number(newAmount.toFixed(8), debtTokenAmount.decimals);
565
+ // }
566
+ // }
567
+
568
+ // async getVesuModifyPositionCall(params: {
569
+ // isDeposit: boolean,
570
+ // leg1DepositAmount: Web3Number
571
+ // }) {
572
+ // const [vesuAdapter1, vesuAdapter2] = this.getVesuAdapters();
573
+ // const leg1LTV = await vesuAdapter1.getLTVConfig(this.config);
574
+ // const leg2LTV = await vesuAdapter2.getLTVConfig(this.config);
575
+ // logger.verbose(`${this.getTag()}: LTVLeg1: ${leg1LTV}`);
576
+ // logger.verbose(`${this.getTag()}: LTVLeg2: ${leg2LTV}`);
577
+
578
+ // const token1Price = await this.pricer.getPrice(vesuAdapter1.config.collateral.symbol);
579
+ // const token2Price = await this.pricer.getPrice(vesuAdapter2.config.collateral.symbol);
580
+ // logger.verbose(`${this.getTag()}: Price${vesuAdapter1.config.collateral.symbol}: ${token1Price.price}`);
581
+ // logger.verbose(`${this.getTag()}: Price${vesuAdapter2.config.collateral.symbol}: ${token2Price.price}`);
582
+
583
+ // const TARGET_HF = this.metadata.additionalInfo.targetHealthFactor;
584
+
585
+ // const k1 = token1Price.price * leg1LTV / token2Price.price / TARGET_HF;
586
+ // const k2 = token1Price.price * TARGET_HF / token2Price.price / leg2LTV;
587
+
588
+ // const borrow2Amount = new Web3Number(
589
+ // params.leg1DepositAmount.multipliedBy(k1.toFixed(6)).dividedBy(k2 - k1).toFixed(6),
590
+ // vesuAdapter2.config.debt.decimals
591
+ // );
592
+ // const borrow1Amount = new Web3Number(
593
+ // borrow2Amount.multipliedBy(k2).toFixed(6),
594
+ // vesuAdapter1.config.debt.decimals
595
+ // );
596
+ // logger.verbose(`${this.getTag()}:: leg1DepositAmount: ${params.leg1DepositAmount.toString()} ${vesuAdapter1.config.collateral.symbol}`);
597
+ // logger.verbose(`${this.getTag()}:: borrow1Amount: ${borrow1Amount.toString()} ${vesuAdapter1.config.debt.symbol}`);
598
+ // logger.verbose(`${this.getTag()}:: borrow2Amount: ${borrow2Amount.toString()} ${vesuAdapter2.config.debt.symbol}`);
599
+
600
+ // let callSet1 = this.getVesuModifyPositionCalls({
601
+ // isLeg1: true,
602
+ // isDeposit: params.isDeposit,
603
+ // depositAmount: params.leg1DepositAmount.plus(borrow2Amount),
604
+ // debtAmount: borrow1Amount
605
+ // });
606
+
607
+ // let callSet2 = this.getVesuModifyPositionCalls({
608
+ // isLeg1: false,
609
+ // isDeposit: params.isDeposit,
610
+ // depositAmount: borrow1Amount,
611
+ // debtAmount: borrow2Amount
612
+ // });
613
+
614
+ // if (!params.isDeposit) {
615
+ // let temp = callSet2;
616
+ // callSet2 = [...callSet1];
617
+ // callSet1 = [...temp];
618
+ // }
619
+ // const allActions = [...callSet1.map(i => i.manageCall), ...callSet2.map(i => i.manageCall)];
620
+ // const flashloanCalldata = CallData.compile([
621
+ // [...callSet1.map(i => i.proofs), ...callSet2.map(i => i.proofs)],
622
+ // allActions.map(i => i.sanitizer.address),
623
+ // allActions.map(i => i.call.contractAddress.address),
624
+ // allActions.map(i => i.call.selector),
625
+ // allActions.map(i => i.call.calldata)
626
+ // ])
627
+
628
+ // // flash loan
629
+ // const STEP1_ID = UNIVERSAL_MANAGE_IDS.FLASH_LOAN;
630
+ // const manage1Info = this.getProofs<FlashloanCallParams>(STEP1_ID);
631
+ // const manageCall1 = manage1Info.callConstructor({
632
+ // amount: borrow2Amount,
633
+ // data: flashloanCalldata.map(i => BigInt(i))
634
+ // })
635
+ // const manageCall = this.getManageCall([UNIVERSAL_MANAGE_IDS.FLASH_LOAN], [manageCall1]);
636
+ // return manageCall;
637
+ // }
638
+
639
+ // async getBringLiquidityCall(params: {
640
+ // amount: Web3Number
641
+ // }) {
642
+ // const manage1Info = this.getProofs<ApproveCallParams>(UNIVERSAL_MANAGE_IDS.APPROVE_BRING_LIQUIDITY);
643
+ // const manageCall1 = manage1Info.callConstructor({
644
+ // amount: params.amount
645
+ // });
646
+ // const manage2Info = this.getProofs<ApproveCallParams>(UNIVERSAL_MANAGE_IDS.BRING_LIQUIDITY);
647
+ // const manageCall2 = manage2Info.callConstructor({
648
+ // amount: params.amount
649
+ // });
650
+ // const manageCall = this.getManageCall([UNIVERSAL_MANAGE_IDS.APPROVE_BRING_LIQUIDITY, UNIVERSAL_MANAGE_IDS.BRING_LIQUIDITY], [manageCall1, manageCall2]);
651
+ // return manageCall;
652
+ // }
653
+
654
+ // async getHarvestCall() {
655
+ // const vesuHarvest = new VesuHarvests(this.config);
656
+ // const harvestInfo = await vesuHarvest.getUnHarvestedRewards(this.metadata.additionalInfo.vaultAllocator);
657
+ // if (harvestInfo.length != 1) {
658
+ // throw new Error(`Expected 1 harvest info, got ${harvestInfo.length}`);
659
+ // }
660
+
661
+ // const amount = harvestInfo[0].claim.amount;
662
+ // const actualReward = harvestInfo[0].actualReward;
663
+ // const proofs = harvestInfo[0].proof;
664
+ // if (actualReward.isZero()) {
665
+ // throw new Error(`Expected non-zero actual reward, got ${harvestInfo[0].actualReward}`);
666
+ // }
667
+
668
+ // const manage1Info = this.getProofs<VesuDefiSpringRewardsCallParams>(UNIVERSAL_MANAGE_IDS.DEFISPRING_REWARDS);
669
+ // const manageCall1 = manage1Info.callConstructor({
670
+ // amount,
671
+ // proofs
672
+ // });
673
+ // const proofIds: string[] = [UNIVERSAL_MANAGE_IDS.DEFISPRING_REWARDS];
674
+ // const manageCalls: ManageCall[] = [manageCall1];
675
+
676
+ // // swap rewards for underlying
677
+ // const STRK = Global.getDefaultTokens().find(t => t.symbol === 'STRK')!;
678
+ // if (this.asset().symbol != 'STRK') {
679
+ // // approve
680
+ // const manage2Info = this.getProofs<ApproveCallParams>(UNIVERSAL_MANAGE_IDS.APPROVE_SWAP_TOKEN1);
681
+ // const manageCall2 = manage2Info.callConstructor({
682
+ // amount: actualReward
683
+ // });
684
+
685
+ // // swap
686
+ // const avnuModule = new AvnuWrapper();
687
+ // const quote = await avnuModule.getQuotes(
688
+ // STRK.address.address,
689
+ // this.asset().address.address,
690
+ // actualReward.toWei(),
691
+ // this.address.address
692
+ // );
693
+ // const swapInfo = await avnuModule.getSwapInfo(quote, this.address.address, 0, this.address.address);
694
+ // const manage3Info = this.getProofs<AvnuSwapCallParams>(UNIVERSAL_MANAGE_IDS.AVNU_SWAP_REWARDS);
695
+ // const manageCall3 = manage3Info.callConstructor({
696
+ // props: swapInfo
697
+ // });
698
+ // proofIds.push(UNIVERSAL_MANAGE_IDS.APPROVE_SWAP_TOKEN1);
699
+ // proofIds.push(UNIVERSAL_MANAGE_IDS.AVNU_SWAP_REWARDS);
700
+
701
+ // manageCalls.push(manageCall2);
702
+ // manageCalls.push(manageCall3);
703
+ // }
704
+
705
+ // const manageCall = this.getManageCall(proofIds, manageCalls);
706
+ // return { call: manageCall, reward: actualReward, tokenInfo: STRK };
707
+ // }
708
+
709
+ // async getRebalanceCall(params: {
710
+ // isLeg1toLeg2: boolean,
711
+ // amount: Web3Number
712
+ // }) {
713
+ // let callSet1 = this.getVesuModifyPositionCalls({
714
+ // isLeg1: true,
715
+ // isDeposit: params.isLeg1toLeg2,
716
+ // depositAmount: Web3Number.fromWei(0, 0),
717
+ // debtAmount: params.amount
718
+ // });
719
+
720
+ // let callSet2 = this.getVesuModifyPositionCalls({
721
+ // isLeg1: false,
722
+ // isDeposit: params.isLeg1toLeg2,
723
+ // depositAmount: params.amount,
724
+ // debtAmount: Web3Number.fromWei(0, 0)
725
+ // });
726
+
727
+ // if (params.isLeg1toLeg2) {
728
+ // const manageCall = this.getManageCall([
729
+ // ...callSet1.map(i => i.step), ...callSet2.map(i => i.step)
730
+ // ], [...callSet1.map(i => i.manageCall), ...callSet2.map(i => i.manageCall)]);
731
+ // return manageCall;
732
+ // } else {
733
+ // const manageCall = this.getManageCall([
734
+ // ...callSet2.map(i => i.step), ...callSet1.map(i => i.step)
735
+ // ], [...callSet2.map(i => i.manageCall), ...callSet1.map(i => i.manageCall)]);
736
+ // return manageCall;
737
+ // }
738
+ // }
739
+ // }
825
740
 
826
741
 
827
742
  // useful to map readble names to proofs and calls
@@ -842,414 +757,417 @@ export enum UNIVERSAL_MANAGE_IDS {
842
757
  AVNU_SWAP_REWARDS = 'avnu_swap_rewards'
843
758
  }
844
759
 
845
- export enum UNIVERSAL_ADAPTERS {
846
- COMMON = 'common_adapter',
847
- VESU_LEG1 = 'vesu_leg1_adapter',
848
- VESU_LEG2 = 'vesu_leg2_adapter'
849
- }
850
-
851
- function getLooperSettings(
852
- token1Symbol: string,
853
- token2Symbol: string,
854
- vaultSettings: UniversalStrategySettings,
855
- pool1: ContractAddr,
856
- pool2: ContractAddr,
857
- ) {
858
- const USDCToken = Global.getDefaultTokens().find(token => token.symbol === token1Symbol)!;
859
- const ETHToken = Global.getDefaultTokens().find(token => token.symbol === token2Symbol)!;
860
-
861
- const commonAdapter = new CommonAdapter({
862
- manager: vaultSettings.manager,
863
- asset: USDCToken.address,
864
- id: UNIVERSAL_MANAGE_IDS.FLASH_LOAN,
865
- vaultAddress: vaultSettings.vaultAddress,
866
- vaultAllocator: vaultSettings.vaultAllocator,
867
- })
868
- const vesuAdapterUSDCETH = new VesuAdapter({
869
- poolId: pool1,
870
- collateral: USDCToken,
871
- debt: ETHToken,
872
- vaultAllocator: vaultSettings.vaultAllocator,
873
- id: UNIVERSAL_MANAGE_IDS.VESU_LEG1
874
- })
875
- const vesuAdapterETHUSDC = new VesuAdapter({
876
- poolId: pool2,
877
- collateral: ETHToken,
878
- debt: USDCToken,
879
- vaultAllocator: vaultSettings.vaultAllocator,
880
- id: UNIVERSAL_MANAGE_IDS.VESU_LEG2
881
- })
882
- vaultSettings.adapters.push(...[{
883
- id: UNIVERSAL_ADAPTERS.COMMON,
884
- adapter: commonAdapter
885
- }, {
886
- id: UNIVERSAL_ADAPTERS.VESU_LEG1,
887
- adapter: vesuAdapterUSDCETH
888
- }, {
889
- id: UNIVERSAL_ADAPTERS.VESU_LEG2,
890
- adapter: vesuAdapterETHUSDC
891
- }])
892
-
893
- // vesu looping
894
- vaultSettings.leafAdapters.push(commonAdapter.getFlashloanAdapter.bind(commonAdapter));
895
- vaultSettings.leafAdapters.push(vesuAdapterUSDCETH.getModifyPosition.bind(vesuAdapterUSDCETH));
896
- vaultSettings.leafAdapters.push(vesuAdapterETHUSDC.getModifyPosition.bind(vesuAdapterETHUSDC));
897
- vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(USDCToken.address, VESU_SINGLETON, UNIVERSAL_MANAGE_IDS.APPROVE_TOKEN1).bind(commonAdapter));
898
- vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(ETHToken.address, VESU_SINGLETON, UNIVERSAL_MANAGE_IDS.APPROVE_TOKEN2).bind(commonAdapter));
760
+ // export enum UNIVERSAL_ADAPTERS {
761
+ // COMMON = 'common_adapter',
762
+ // VESU_LEG1 = 'vesu_leg1_adapter',
763
+ // VESU_LEG2 = 'vesu_leg2_adapter'
764
+ // }
765
+
766
+ // function getLooperSettings(
767
+ // token1Symbol: string,
768
+ // token2Symbol: string,
769
+ // vaultSettings: UniversalStrategySettings,
770
+ // pool1: ContractAddr,
771
+ // pool2: ContractAddr,
772
+ // ) {
773
+ // const USDCToken = Global.getDefaultTokens().find(token => token.symbol === token1Symbol)!;
774
+ // const ETHToken = Global.getDefaultTokens().find(token => token.symbol === token2Symbol)!;
775
+
776
+ // const commonAdapter = new CommonAdapter({
777
+ // manager: vaultSettings.manager,
778
+ // asset: USDCToken.address,
779
+ // id: UNIVERSAL_MANAGE_IDS.FLASH_LOAN,
780
+ // vaultAddress: vaultSettings.vaultAddress,
781
+ // vaultAllocator: vaultSettings.vaultAllocator,
782
+ // })
783
+ // const vesuAdapterUSDCETH = new VesuAdapter({
784
+ // poolId: pool1,
785
+ // collateral: USDCToken,
786
+ // debt: ETHToken,
787
+ // vaultAllocator: vaultSettings.vaultAllocator,
788
+ // id: UNIVERSAL_MANAGE_IDS.VESU_LEG1
789
+ // })
790
+ // const vesuAdapterETHUSDC = new VesuAdapter({
791
+ // poolId: pool2,
792
+ // collateral: ETHToken,
793
+ // debt: USDCToken,
794
+ // vaultAllocator: vaultSettings.vaultAllocator,
795
+ // id: UNIVERSAL_MANAGE_IDS.VESU_LEG2
796
+ // })
797
+ // vaultSettings.adapters.push(...[{
798
+ // id: UNIVERSAL_ADAPTERS.COMMON,
799
+ // adapter: commonAdapter
800
+ // }, {
801
+ // id: UNIVERSAL_ADAPTERS.VESU_LEG1,
802
+ // adapter: vesuAdapterUSDCETH
803
+ // }, {
804
+ // id: UNIVERSAL_ADAPTERS.VESU_LEG2,
805
+ // adapter: vesuAdapterETHUSDC
806
+ // }])
807
+
808
+ // // vesu looping
809
+ // vaultSettings.leafAdapters.push(commonAdapter.getFlashloanAdapter.bind(commonAdapter));
810
+ // vaultSettings.leafAdapters.push(vesuAdapterUSDCETH.getModifyPosition.bind(vesuAdapterUSDCETH));
811
+ // vaultSettings.leafAdapters.push(vesuAdapterETHUSDC.getModifyPosition.bind(vesuAdapterETHUSDC));
812
+ // vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(USDCToken.address, VESU_SINGLETON, UNIVERSAL_MANAGE_IDS.APPROVE_TOKEN1).bind(commonAdapter));
813
+ // vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(ETHToken.address, VESU_SINGLETON, UNIVERSAL_MANAGE_IDS.APPROVE_TOKEN2).bind(commonAdapter));
899
814
 
900
- // to bridge liquidity back to vault (used by bring_liquidity)
901
- vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(USDCToken.address, vaultSettings.vaultAddress, UNIVERSAL_MANAGE_IDS.APPROVE_BRING_LIQUIDITY).bind(commonAdapter));
902
- vaultSettings.leafAdapters.push(commonAdapter.getBringLiquidityAdapter(UNIVERSAL_MANAGE_IDS.BRING_LIQUIDITY).bind(commonAdapter));
815
+ // // to bridge liquidity back to vault (used by bring_liquidity)
816
+ // vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(USDCToken.address, vaultSettings.vaultAddress, UNIVERSAL_MANAGE_IDS.APPROVE_BRING_LIQUIDITY).bind(commonAdapter));
817
+ // vaultSettings.leafAdapters.push(commonAdapter.getBringLiquidityAdapter(UNIVERSAL_MANAGE_IDS.BRING_LIQUIDITY).bind(commonAdapter));
903
818
 
904
- // claim rewards
905
- vaultSettings.leafAdapters.push(vesuAdapterUSDCETH.getDefispringRewardsAdapter(UNIVERSAL_MANAGE_IDS.DEFISPRING_REWARDS).bind(vesuAdapterUSDCETH));
906
-
907
- // avnu swap
908
- const STRKToken = Global.getDefaultTokens().find(token => token.symbol === 'STRK')!;
909
- vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(STRKToken.address, AVNU_MIDDLEWARE, UNIVERSAL_MANAGE_IDS.APPROVE_SWAP_TOKEN1).bind(commonAdapter));
910
- vaultSettings.leafAdapters.push(commonAdapter.getAvnuAdapter(STRKToken.address, USDCToken.address, UNIVERSAL_MANAGE_IDS.AVNU_SWAP_REWARDS, true).bind(commonAdapter));
911
- return vaultSettings;
912
- }
913
-
914
- const _riskFactor: RiskFactor[] = [
915
- { type: RiskType.SMART_CONTRACT_RISK, value: 0.5, weight: 25, reason: "Audited by Zellic" },
916
- { type: RiskType.LIQUIDATION_RISK, value: 1.5, weight: 50, reason: "Liquidation risk is mitigated by stable price feed on Starknet" },
917
- { type: RiskType.TECHNICAL_RISK, value: 1, weight: 50, reason: "Technical failures like risk monitoring failures" }
918
- ];
919
-
920
- const usdcVaultSettings: UniversalStrategySettings = {
921
- vaultAddress: ContractAddr.from('0x7e6498cf6a1bfc7e6fc89f1831865e2dacb9756def4ec4b031a9138788a3b5e'),
922
- manager: ContractAddr.from('0xf41a2b1f498a7f9629db0b8519259e66e964260a23d20003f3e42bb1997a07'),
923
- vaultAllocator: ContractAddr.from('0x228cca1005d3f2b55cbaba27cb291dacf1b9a92d1d6b1638195fbd3d0c1e3ba'),
924
- redeemRequestNFT: ContractAddr.from('0x906d03590010868cbf7590ad47043959d7af8e782089a605d9b22567b64fda'),
925
- aumOracle: ContractAddr.from("0x6faf45ed185dec13ef723c9ead4266cab98d06f2cb237e331b1fa5c2aa79afe"),
926
- leafAdapters: [],
927
- adapters: [],
928
- targetHealthFactor: 1.25,
929
- minHealthFactor: 1.15
930
- }
931
-
932
- const wbtcVaultSettings: UniversalStrategySettings = {
933
- vaultAddress: ContractAddr.from('0x5a4c1651b913aa2ea7afd9024911603152a19058624c3e425405370d62bf80c'),
934
- manager: ContractAddr.from('0xef8a664ffcfe46a6af550766d27c28937bf1b77fb4ab54d8553e92bca5ba34'),
935
- vaultAllocator: ContractAddr.from('0x1e01c25f0d9494570226ad28a7fa856c0640505e809c366a9fab4903320e735'),
936
- redeemRequestNFT: ContractAddr.from('0x4fec59a12f8424281c1e65a80b5de51b4e754625c60cddfcd00d46941ec37b2'),
937
- aumOracle: ContractAddr.from("0x2edf4edbed3f839e7f07dcd913e92299898ff4cf0ba532f8c572c66c5b331b2"),
938
- leafAdapters: [],
939
- adapters: [],
940
- targetHealthFactor: 1.20,
941
- minHealthFactor: 1.15
942
- }
943
-
944
- const ethVaultSettings: UniversalStrategySettings = {
945
- vaultAddress: ContractAddr.from('0x446c22d4d3f5cb52b4950ba832ba1df99464c6673a37c092b1d9622650dbd8'),
946
- manager: ContractAddr.from('0x494888b37206616bd09d759dcda61e5118470b9aa7f58fb84f21c778a7b8f97'),
947
- vaultAllocator: ContractAddr.from('0x4acc0ad6bea58cb578d60ff7c31f06f44369a7a9a7bbfffe4701f143e427bd'),
948
- redeemRequestNFT: ContractAddr.from('0x2e6cd71e5060a254d4db00655e420db7bf89da7755bb0d5f922e2f00c76ac49'),
949
- aumOracle: ContractAddr.from("0x4b747f2e75c057bed9aa2ce46fbdc2159dc684c15bd32d4f95983a6ecf39a05"),
950
- leafAdapters: [],
951
- adapters: [],
952
- targetHealthFactor: 1.25,
953
- minHealthFactor: 1.21
954
- }
955
-
956
- const strkVaultSettings: UniversalStrategySettings = {
957
- vaultAddress: ContractAddr.from('0x55d012f57e58c96e0a5c7ebbe55853989d01e6538b15a95e7178aca4af05c21'),
958
- manager: ContractAddr.from('0xcc6a5153ca56293405506eb20826a379d982cd738008ef7e808454d318fb81'),
959
- vaultAllocator: ContractAddr.from('0xf29d2f82e896c0ed74c9eff220af34ac148e8b99846d1ace9fbb02c9191d01'),
960
- redeemRequestNFT: ContractAddr.from('0x46902423bd632c428376b84fcee9cac5dbe016214e93a8103bcbde6e1de656b'),
961
- aumOracle: ContractAddr.from("0x6d7dbfad4bb51715da211468389a623da00c0625f8f6efbea822ee5ac5231f4"),
962
- leafAdapters: [],
963
- adapters: [],
964
- targetHealthFactor: 1.20,
965
- minHealthFactor: 1.15
966
- }
967
-
968
- const usdtVaultSettings: UniversalStrategySettings = {
969
- vaultAddress: ContractAddr.from('0x1c4933d1880c6778585e597154eaca7b428579d72f3aae425ad2e4d26c6bb3'),
970
- manager: ContractAddr.from('0x39bb9843503799b552b7ed84b31c06e4ff10c0537edcddfbf01fe944b864029'),
971
- vaultAllocator: ContractAddr.from('0x56437d18c43727ac971f6c7086031cad7d9d6ccb340f4f3785a74cc791c931a'),
972
- redeemRequestNFT: ContractAddr.from('0x5af0c2a657eaa8e23ed78e855dac0c51e4f69e2cf91a18c472041a1f75bb41f'),
973
- aumOracle: ContractAddr.from("0x7018f8040c8066a4ab929e6760ae52dd43b6a3a289172f514750a61fcc565cc"),
974
- leafAdapters: [],
975
- adapters: [],
976
- targetHealthFactor: 1.25,
977
- minHealthFactor: 1.15
978
- }
979
-
980
- type AllowedSources = 'vesu' | 'endur' | 'extended';
981
- export default function MetaVaultDescription(allowedSources: AllowedSources[]) {
982
- const logos: any = {
983
- vesu: Protocols.VESU.logo,
984
- endur: Protocols.ENDUR.logo,
985
- extended: Protocols.EXTENDED.logo,
986
- ekubo: "https://dummyimage.com/64x64/ffffff/000000&text=K",
987
- };
988
- const _sources = [
989
- { key: "vesu", name: "Vesu", status: "Live", description: "Integrated liquidity venue used for automated routing to capture the best available yield." },
990
- { key: "endur", name: "Endur", status: "Coming soon", description: "Planned integration to tap into STRK staking–backed yields via our LST pipeline." },
991
- { key: "extended", name: "Extended", status: "Coming soon", description: "Expanding coverage to additional money markets and vaults across the ecosystem." },
992
- // { key: "ekubo", name: "Ekubo", status: "Coming soon", description: "Concentrated liquidity strategies targeted for optimized fee APR harvesting." },
993
- ];
994
- const sources = _sources.filter(s => allowedSources.includes(s.key as any));
995
-
996
- const containerStyle = {
997
- maxWidth: "800px",
998
- margin: "0 auto",
999
- backgroundColor: "#111",
1000
- color: "#eee",
1001
- fontFamily: "Arial, sans-serif",
1002
- borderRadius: "12px",
1003
- };
1004
-
1005
- const cardStyle = {
1006
- border: "1px solid #333",
1007
- borderRadius: "10px",
1008
- padding: "12px",
1009
- marginBottom: "12px",
1010
- backgroundColor: "#1a1a1a",
1011
- };
1012
-
1013
- const logoStyle = {
1014
- width: "24px",
1015
- height: "24px",
1016
- borderRadius: "8px",
1017
- border: "1px solid #444",
1018
- backgroundColor: "#222",
1019
- };
1020
-
1021
- return (
1022
- <div style={containerStyle}>
1023
- <h1 style={{ fontSize: "18px", marginBottom: "10px" }}>Meta Vault — Automated Yield Router</h1>
1024
- <p style={{ fontSize: "14px", lineHeight: "1.5", marginBottom: "16px" }}>
1025
- This Evergreen vault is a tokenized Meta Vault, auto-compounding strategy that continuously allocates your deposited
1026
- asset to the best available yield source in the ecosystem. Depositors receive vault shares that
1027
- represent a proportional claim on the underlying assets and accrued yield. Allocation shifts are
1028
- handled programmatically based on on-chain signals and risk filters, minimizing idle capital and
1029
- maximizing net APY.
1030
- </p>
1031
-
1032
- <div style={{ backgroundColor: "#222", padding: "10px", borderRadius: "8px", marginBottom: "20px", border: "1px solid #444" }}>
1033
- <p style={{ fontSize: "13px", color: "#ccc" }}>
1034
- <strong>Withdrawals:</strong> Requests can take up to <strong>1-2 hours</strong> to process as the vault unwinds and settles routing.
1035
- </p>
1036
- </div>
1037
-
1038
- <h2 style={{ fontSize: "18px", marginBottom: "10px" }}>Supported Yield Sources</h2>
1039
- {sources.map((s) => (
1040
- <div key={s.key} style={cardStyle}>
1041
- <div style={{ display: "flex", gap: "10px", alignItems: "flex-start" }}>
1042
- <img src={logos[s.key]} alt={`${s.name} logo`} style={logoStyle} />
1043
- <div style={{ flex: 1 }}>
1044
- <div style={{ display: "flex", justifyContent: "space-between", alignItems: "center" }}>
1045
- <h3 style={{ fontSize: "15px", margin: 0 }}>{s.name}</h3>
1046
- <StatusBadge status={s.status} />
1047
- </div>
1048
- {/* <p style={{ fontSize: "13px", color: "#ccc", marginTop: "4px" }}>{s.description}</p> */}
1049
- </div>
1050
- </div>
1051
- </div>
1052
- ))}
1053
- </div>
1054
- );
1055
- }
1056
-
1057
- function StatusBadge({ status }: { status: string }) {
1058
- const isSoon = String(status).toLowerCase() !== "live";
1059
- const badgeStyle = {
1060
- fontSize: "12px",
1061
- padding: "2px 6px",
1062
- borderRadius: "12px",
1063
- border: "1px solid",
1064
- color: isSoon ? "rgb(196 196 195)" : "#6aff7d",
1065
- borderColor: isSoon ? "#484848" : "#6aff7d",
1066
- backgroundColor: isSoon ? "#424242" : "#002b1a",
1067
- };
1068
- return <span style={badgeStyle}>{status}</span>;
1069
- }
1070
-
1071
- function getDescription(tokenSymbol: string, allowedSources: AllowedSources[]) {
1072
- return MetaVaultDescription(allowedSources);
1073
- }
1074
-
1075
- function getFAQs(): FAQ[] {
1076
- return [
1077
- {
1078
- question: "What is the Meta Vault?",
1079
- answer:
1080
- "The Meta Vault is a tokenized strategy that automatically allocates your deposited assets to the best available yield source in the ecosystem. It optimizes returns while minimizing idle capital.",
1081
- },
1082
- {
1083
- question: "How does yield allocation work?",
1084
- answer:
1085
- "The vault continuously monitors supported protocols and routes liquidity to the source offering the highest net yield after accounting for fees, slippage, and gas costs. Reallocations are performed automatically.",
1086
- },
1087
- {
1088
- question: "Which yield sources are supported?",
1089
- answer: (
1090
- <span>
1091
- Currently, <strong>Vesu</strong> is live. Future integrations may include{" "}
1092
- <strong>Endur</strong>, <strong>Extended</strong>, and{" "}
1093
- <strong>Ekubo</strong> (all coming soon).
1094
- </span>
1095
- ),
1096
- },
1097
- {
1098
- question: "What do I receive when I deposit?",
1099
- answer:
1100
- "Depositors receive vault tokens representing their proportional share of the vault. These tokens entitle holders to both the principal and accrued yield.",
1101
- },
1102
- {
1103
- question: "How long do withdrawals take?",
1104
- answer:
1105
- "Withdrawals may take up to 1-2 hours to process, as the vault unwinds and settles liquidity routing across integrated protocols.",
1106
- },
1107
- {
1108
- question: "Is the Meta Vault non-custodial?",
1109
- answer:
1110
- "Yes. The Meta Vault operates entirely on-chain. Users always maintain control of their vault tokens, and the strategy is fully transparent.",
1111
- },
1112
- {
1113
- question: "How is risk managed?",
1114
- answer:
1115
- "Integrations are supported with active risk monitoring like liquidation risk. Only vetted protocols are included to balance yield with safety. However, usual Defi risks like smart contract risk, extreme volatile market risk, etc. are still present.",
1116
- },
1117
- {
1118
- question: "Are there any fees?",
1119
- answer:
1120
- "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.",
1121
- },
1122
- ];
1123
- }
1124
-
1125
- export function getContractDetails(settings: UniversalStrategySettings): {address: ContractAddr, name: string}[] {
1126
- return [
819
+ // // claim rewards
820
+ // vaultSettings.leafAdapters.push(vesuAdapterUSDCETH.getDefispringRewardsAdapter(UNIVERSAL_MANAGE_IDS.DEFISPRING_REWARDS).bind(vesuAdapterUSDCETH));
821
+
822
+ // // avnu swap
823
+ // const STRKToken = Global.getDefaultTokens().find(token => token.symbol === 'STRK')!;
824
+ // vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(STRKToken.address, AVNU_MIDDLEWARE, UNIVERSAL_MANAGE_IDS.APPROVE_SWAP_TOKEN1).bind(commonAdapter));
825
+ // vaultSettings.leafAdapters.push(commonAdapter.getAvnuAdapter(STRKToken.address, USDCToken.address, UNIVERSAL_MANAGE_IDS.AVNU_SWAP_REWARDS, true).bind(commonAdapter));
826
+ // return vaultSettings;
827
+ // }
828
+
829
+ // const _riskFactor: RiskFactor[] = [
830
+ // { type: RiskType.SMART_CONTRACT_RISK, value: 0.5, weight: 25, reason: "Audited by Zellic" },
831
+ // { type: RiskType.LIQUIDATION_RISK, value: 1.5, weight: 50, reason: "Liquidation risk is mitigated by stable price feed on Starknet" },
832
+ // { type: RiskType.TECHNICAL_RISK, value: 1, weight: 50, reason: "Technical failures like risk monitoring failures" }
833
+ // ];
834
+
835
+ // const usdcVaultSettings: UniversalStrategySettings = {
836
+ // vaultAddress: ContractAddr.from('0x7e6498cf6a1bfc7e6fc89f1831865e2dacb9756def4ec4b031a9138788a3b5e'),
837
+ // manager: ContractAddr.from('0xf41a2b1f498a7f9629db0b8519259e66e964260a23d20003f3e42bb1997a07'),
838
+ // vaultAllocator: ContractAddr.from('0x228cca1005d3f2b55cbaba27cb291dacf1b9a92d1d6b1638195fbd3d0c1e3ba'),
839
+ // redeemRequestNFT: ContractAddr.from('0x906d03590010868cbf7590ad47043959d7af8e782089a605d9b22567b64fda'),
840
+ // aumOracle: ContractAddr.from("0x6faf45ed185dec13ef723c9ead4266cab98d06f2cb237e331b1fa5c2aa79afe"),
841
+ // leafAdapters: [],
842
+ // adapters: [],
843
+ // targetHealthFactor: 1.3,
844
+ // minHealthFactor: 1.25
845
+ // }
846
+
847
+ // const wbtcVaultSettings: UniversalStrategySettings = {
848
+ // vaultAddress: ContractAddr.from('0x5a4c1651b913aa2ea7afd9024911603152a19058624c3e425405370d62bf80c'),
849
+ // manager: ContractAddr.from('0xef8a664ffcfe46a6af550766d27c28937bf1b77fb4ab54d8553e92bca5ba34'),
850
+ // vaultAllocator: ContractAddr.from('0x1e01c25f0d9494570226ad28a7fa856c0640505e809c366a9fab4903320e735'),
851
+ // redeemRequestNFT: ContractAddr.from('0x4fec59a12f8424281c1e65a80b5de51b4e754625c60cddfcd00d46941ec37b2'),
852
+ // aumOracle: ContractAddr.from("0x2edf4edbed3f839e7f07dcd913e92299898ff4cf0ba532f8c572c66c5b331b2"),
853
+ // leafAdapters: [],
854
+ // adapters: [],
855
+ // targetHealthFactor: 1.3,
856
+ // minHealthFactor: 1.25
857
+ // }
858
+
859
+ // const ethVaultSettings: UniversalStrategySettings = {
860
+ // vaultAddress: ContractAddr.from('0x446c22d4d3f5cb52b4950ba832ba1df99464c6673a37c092b1d9622650dbd8'),
861
+ // manager: ContractAddr.from('0x494888b37206616bd09d759dcda61e5118470b9aa7f58fb84f21c778a7b8f97'),
862
+ // vaultAllocator: ContractAddr.from('0x4acc0ad6bea58cb578d60ff7c31f06f44369a7a9a7bbfffe4701f143e427bd'),
863
+ // redeemRequestNFT: ContractAddr.from('0x2e6cd71e5060a254d4db00655e420db7bf89da7755bb0d5f922e2f00c76ac49'),
864
+ // aumOracle: ContractAddr.from("0x4b747f2e75c057bed9aa2ce46fbdc2159dc684c15bd32d4f95983a6ecf39a05"),
865
+ // leafAdapters: [],
866
+ // adapters: [],
867
+ // targetHealthFactor: 1.3,
868
+ // minHealthFactor: 1.25
869
+ // }
870
+
871
+ // const strkVaultSettings: UniversalStrategySettings = {
872
+ // vaultAddress: ContractAddr.from('0x55d012f57e58c96e0a5c7ebbe55853989d01e6538b15a95e7178aca4af05c21'),
873
+ // manager: ContractAddr.from('0xcc6a5153ca56293405506eb20826a379d982cd738008ef7e808454d318fb81'),
874
+ // vaultAllocator: ContractAddr.from('0xf29d2f82e896c0ed74c9eff220af34ac148e8b99846d1ace9fbb02c9191d01'),
875
+ // redeemRequestNFT: ContractAddr.from('0x46902423bd632c428376b84fcee9cac5dbe016214e93a8103bcbde6e1de656b'),
876
+ // aumOracle: ContractAddr.from("0x6d7dbfad4bb51715da211468389a623da00c0625f8f6efbea822ee5ac5231f4"),
877
+ // leafAdapters: [],
878
+ // adapters: [],
879
+ // targetHealthFactor: 1.3,
880
+ // minHealthFactor: 1.25
881
+ // }
882
+
883
+ // const usdtVaultSettings: UniversalStrategySettings = {
884
+ // vaultAddress: ContractAddr.from('0x1c4933d1880c6778585e597154eaca7b428579d72f3aae425ad2e4d26c6bb3'),
885
+ // manager: ContractAddr.from('0x39bb9843503799b552b7ed84b31c06e4ff10c0537edcddfbf01fe944b864029'),
886
+ // vaultAllocator: ContractAddr.from('0x56437d18c43727ac971f6c7086031cad7d9d6ccb340f4f3785a74cc791c931a'),
887
+ // redeemRequestNFT: ContractAddr.from('0x5af0c2a657eaa8e23ed78e855dac0c51e4f69e2cf91a18c472041a1f75bb41f'),
888
+ // aumOracle: ContractAddr.from("0x7018f8040c8066a4ab929e6760ae52dd43b6a3a289172f514750a61fcc565cc"),
889
+ // leafAdapters: [],
890
+ // adapters: [],
891
+ // targetHealthFactor: 1.3,
892
+ // minHealthFactor: 1.25
893
+ // }
894
+
895
+ // type AllowedSources = 'vesu' | 'endur' | 'extended';
896
+ // export default function MetaVaultDescription(allowedSources: AllowedSources[]) {
897
+ // const logos: any = {
898
+ // vesu: Protocols.VESU.logo,
899
+ // endur: Protocols.ENDUR.logo,
900
+ // extended: Protocols.EXTENDED.logo,
901
+ // ekubo: "https://dummyimage.com/64x64/ffffff/000000&text=K",
902
+ // };
903
+ // const _sources = [
904
+ // { key: "vesu", name: "Vesu", status: "Live", description: "Integrated liquidity venue used for automated routing to capture the best available yield." },
905
+ // { key: "endur", name: "Endur", status: "Coming soon", description: "Planned integration to tap into STRK staking–backed yields via our LST pipeline." },
906
+ // { key: "extended", name: "Extended", status: "Coming soon", description: "Expanding coverage to additional money markets and vaults across the ecosystem." },
907
+ // // { key: "ekubo", name: "Ekubo", status: "Coming soon", description: "Concentrated liquidity strategies targeted for optimized fee APR harvesting." },
908
+ // ];
909
+ // const sources = _sources.filter(s => allowedSources.includes(s.key as any));
910
+
911
+ // const containerStyle = {
912
+ // maxWidth: "800px",
913
+ // margin: "0 auto",
914
+ // backgroundColor: "#111",
915
+ // color: "#eee",
916
+ // fontFamily: "Arial, sans-serif",
917
+ // borderRadius: "12px",
918
+ // };
919
+
920
+ // const cardStyle = {
921
+ // border: "1px solid #333",
922
+ // borderRadius: "10px",
923
+ // padding: "12px",
924
+ // marginBottom: "12px",
925
+ // backgroundColor: "#1a1a1a",
926
+ // };
927
+
928
+ // const logoStyle = {
929
+ // width: "24px",
930
+ // height: "24px",
931
+ // borderRadius: "8px",
932
+ // border: "1px solid #444",
933
+ // backgroundColor: "#222",
934
+ // };
935
+
936
+ // return (
937
+ // <div style={containerStyle}>
938
+ // <h1 style={{ fontSize: "18px", marginBottom: "10px" }}>Meta Vault — Automated Yield Router</h1>
939
+ // <p style={{ fontSize: "14px", lineHeight: "1.5", marginBottom: "16px" }}>
940
+ // This Evergreen vault is a tokenized Meta Vault, auto-compounding strategy that continuously allocates your deposited
941
+ // asset to the best available yield source in the ecosystem. Depositors receive vault shares that
942
+ // represent a proportional claim on the underlying assets and accrued yield. Allocation shifts are
943
+ // handled programmatically based on on-chain signals and risk filters, minimizing idle capital and
944
+ // maximizing net APY.
945
+ // </p>
946
+
947
+ // <div style={{ backgroundColor: "#222", padding: "10px", borderRadius: "8px", marginBottom: "20px", border: "1px solid #444" }}>
948
+ // <p style={{ fontSize: "13px", color: "#ccc" }}>
949
+ // <strong>Withdrawals:</strong> Requests can take up to <strong>1-2 hours</strong> to process as the vault unwinds and settles routing.
950
+ // </p>
951
+ // </div>
952
+
953
+ // <h2 style={{ fontSize: "18px", marginBottom: "10px" }}>Supported Yield Sources</h2>
954
+ // {sources.map((s) => (
955
+ // <div key={s.key} style={cardStyle}>
956
+ // <div style={{ display: "flex", gap: "10px", alignItems: "flex-start" }}>
957
+ // <img src={logos[s.key]} alt={`${s.name} logo`} style={logoStyle} />
958
+ // <div style={{ flex: 1 }}>
959
+ // <div style={{ display: "flex", justifyContent: "space-between", alignItems: "center" }}>
960
+ // <h3 style={{ fontSize: "15px", margin: 0 }}>{s.name}</h3>
961
+ // <StatusBadge status={s.status} />
962
+ // </div>
963
+ // {/* <p style={{ fontSize: "13px", color: "#ccc", marginTop: "4px" }}>{s.description}</p> */}
964
+ // </div>
965
+ // </div>
966
+ // </div>
967
+ // ))}
968
+ // </div>
969
+ // );
970
+ // }
971
+
972
+ // function StatusBadge({ status }: { status: string }) {
973
+ // const isSoon = String(status).toLowerCase() !== "live";
974
+ // const badgeStyle = {
975
+ // fontSize: "12px",
976
+ // padding: "2px 6px",
977
+ // borderRadius: "12px",
978
+ // border: "1px solid",
979
+ // color: isSoon ? "rgb(196 196 195)" : "#6aff7d",
980
+ // borderColor: isSoon ? "#484848" : "#6aff7d",
981
+ // backgroundColor: isSoon ? "#424242" : "#002b1a",
982
+ // };
983
+ // return <span style={badgeStyle}>{status}</span>;
984
+ // }
985
+
986
+ // function getDescription(tokenSymbol: string, allowedSources: AllowedSources[]) {
987
+ // return MetaVaultDescription(allowedSources);
988
+ // }
989
+
990
+ // function getFAQs(): FAQ[] {
991
+ // return [
992
+ // {
993
+ // question: "What is the Meta Vault?",
994
+ // answer:
995
+ // "The Meta Vault is a tokenized strategy that automatically allocates your deposited assets to the best available yield source in the ecosystem. It optimizes returns while minimizing idle capital.",
996
+ // },
997
+ // {
998
+ // question: "How does yield allocation work?",
999
+ // answer:
1000
+ // "The vault continuously monitors supported protocols and routes liquidity to the source offering the highest net yield after accounting for fees, slippage, and gas costs. Reallocations are performed automatically.",
1001
+ // },
1002
+ // {
1003
+ // question: "Which yield sources are supported?",
1004
+ // answer: (
1005
+ // <span>
1006
+ // Currently, <strong>Vesu</strong> is live. Future integrations may include{" "}
1007
+ // <strong>Endur</strong>, <strong>Extended</strong>, and{" "}
1008
+ // <strong>Ekubo</strong> (all coming soon).
1009
+ // </span>
1010
+ // ),
1011
+ // },
1012
+ // {
1013
+ // question: "What do I receive when I deposit?",
1014
+ // answer:
1015
+ // "Depositors receive vault tokens representing their proportional share of the vault. These tokens entitle holders to both the principal and accrued yield.",
1016
+ // },
1017
+ // {
1018
+ // question: "How long do withdrawals take?",
1019
+ // answer:
1020
+ // "Withdrawals may take up to 1-2 hours to process, as the vault unwinds and settles liquidity routing across integrated protocols.",
1021
+ // },
1022
+ // {
1023
+ // question: "Is the Meta Vault non-custodial?",
1024
+ // answer:
1025
+ // "Yes. The Meta Vault operates entirely on-chain. Users always maintain control of their vault tokens, and the strategy is fully transparent.",
1026
+ // },
1027
+ // {
1028
+ // question: "How is risk managed?",
1029
+ // answer:
1030
+ // "Integrations are supported with active risk monitoring like liquidation risk. Only vetted protocols are included to balance yield with safety. However, usual Defi risks like smart contract risk, extreme volatile market risk, etc. are still present.",
1031
+ // },
1032
+ // {
1033
+ // question: "Are there any fees?",
1034
+ // answer:
1035
+ // "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.",
1036
+ // },
1037
+ // ];
1038
+ // }
1039
+
1040
+ export function getContractDetails(settings: UniversalStrategySettings & { aumOracle?: ContractAddr }): {address: ContractAddr, name: string}[] {
1041
+ const contracts = [
1127
1042
  { address: settings.vaultAddress, name: "Vault" },
1128
1043
  { address: settings.manager, name: "Vault Manager" },
1129
1044
  { address: settings.vaultAllocator, name: "Vault Allocator" },
1130
1045
  { address: settings.redeemRequestNFT, name: "Redeem Request NFT" },
1131
- // { address: settings.aumOracle, name: "AUM Oracle" },
1132
1046
  ];
1047
+ if (settings.aumOracle) {
1048
+ contracts.push({ address: settings.aumOracle, name: "AUM Oracle" });
1049
+ }
1050
+ return contracts;
1133
1051
  }
1134
1052
 
1135
- const investmentSteps: string[] = [
1136
- "Deposit funds into the vault",
1137
- "Vault manager allocates funds to optimal yield sources",
1138
- "Vault manager reports asset under management (AUM) regularly to the vault",
1139
- "Request withdrawal and vault manager processes it in 1-2 hours"
1140
- ]
1141
-
1142
- const AUDIT_URL = 'https://docs.troves.fi/p/security#starknet-vault-kit'
1143
- export const UniversalStrategies: IStrategyMetadata<UniversalStrategySettings>[] =
1144
- [
1145
- {
1146
- name: "USDC.e Evergreen",
1147
- description: getDescription('USDC.e', ['vesu', 'extended']),
1148
- address: ContractAddr.from('0x7e6498cf6a1bfc7e6fc89f1831865e2dacb9756def4ec4b031a9138788a3b5e'),
1149
- launchBlock: 0,
1150
- type: 'ERC4626',
1151
- depositTokens: [Global.getDefaultTokens().find(token => token.symbol === 'USDC.e')!],
1152
- additionalInfo: getLooperSettings('USDC.e', 'ETH', usdcVaultSettings, VesuPools.Genesis, VesuPools.Genesis),
1153
- risk: {
1154
- riskFactor: _riskFactor,
1155
- netRisk:
1156
- _riskFactor.reduce((acc, curr) => acc + curr.value * curr.weight, 0) /
1157
- _riskFactor.reduce((acc, curr) => acc + curr.weight, 0),
1158
- notARisks: getNoRiskTags(_riskFactor)
1159
- },
1160
- auditUrl: AUDIT_URL,
1161
- protocols: [Protocols.VESU],
1162
- maxTVL: Web3Number.fromWei(0, 6),
1163
- contractDetails: getContractDetails(usdcVaultSettings),
1164
- faqs: getFAQs(),
1165
- investmentSteps: investmentSteps,
1166
- },
1167
- {
1168
- name: "WBTC Evergreen",
1169
- description: getDescription('WBTC', ['vesu', 'endur', 'extended']),
1170
- address: ContractAddr.from('0x5a4c1651b913aa2ea7afd9024911603152a19058624c3e425405370d62bf80c'),
1171
- launchBlock: 0,
1172
- type: 'ERC4626',
1173
- depositTokens: [Global.getDefaultTokens().find(token => token.symbol === 'WBTC')!],
1174
- additionalInfo: getLooperSettings('WBTC', 'ETH', wbtcVaultSettings, VesuPools.Genesis, VesuPools.Genesis),
1175
- risk: {
1176
- riskFactor: _riskFactor,
1177
- netRisk:
1178
- _riskFactor.reduce((acc, curr) => acc + curr.value * curr.weight, 0) /
1179
- _riskFactor.reduce((acc, curr) => acc + curr.weight, 0),
1180
- notARisks: getNoRiskTags(_riskFactor)
1181
- },
1182
- protocols: [Protocols.VESU],
1183
- maxTVL: Web3Number.fromWei(0, 8),
1184
- contractDetails: getContractDetails(wbtcVaultSettings),
1185
- faqs: getFAQs(),
1186
- investmentSteps: investmentSteps,
1187
- auditUrl: AUDIT_URL,
1188
- },
1189
- {
1190
- name: "ETH Evergreen",
1191
- description: getDescription('ETH', ['vesu', 'extended']),
1192
- address: ContractAddr.from('0x446c22d4d3f5cb52b4950ba832ba1df99464c6673a37c092b1d9622650dbd8'),
1193
- launchBlock: 0,
1194
- type: 'ERC4626',
1195
- depositTokens: [Global.getDefaultTokens().find(token => token.symbol === 'ETH')!],
1196
- additionalInfo: getLooperSettings('ETH', 'WBTC', ethVaultSettings, VesuPools.Genesis, VesuPools.Genesis),
1197
- risk: {
1198
- riskFactor: _riskFactor,
1199
- netRisk:
1200
- _riskFactor.reduce((acc, curr) => acc + curr.value * curr.weight, 0) /
1201
- _riskFactor.reduce((acc, curr) => acc + curr.weight, 0),
1202
- notARisks: getNoRiskTags(_riskFactor)
1203
- },
1204
- protocols: [Protocols.VESU],
1205
- maxTVL: Web3Number.fromWei(0, 18),
1206
- contractDetails: getContractDetails(ethVaultSettings),
1207
- faqs: getFAQs(),
1208
- investmentSteps: investmentSteps,
1209
- auditUrl: AUDIT_URL,
1210
- },
1211
- {
1212
- name: "STRK Evergreen",
1213
- description: getDescription('STRK', ['vesu', 'endur', 'extended']),
1214
- address: ContractAddr.from('0x55d012f57e58c96e0a5c7ebbe55853989d01e6538b15a95e7178aca4af05c21'),
1215
- launchBlock: 0,
1216
- type: 'ERC4626',
1217
- depositTokens: [Global.getDefaultTokens().find(token => token.symbol === 'STRK')!],
1218
- additionalInfo: getLooperSettings('STRK', 'ETH', strkVaultSettings, VesuPools.Genesis, VesuPools.Genesis),
1219
- risk: {
1220
- riskFactor: _riskFactor,
1221
- netRisk:
1222
- _riskFactor.reduce((acc, curr) => acc + curr.value * curr.weight, 0) /
1223
- _riskFactor.reduce((acc, curr) => acc + curr.weight, 0),
1224
- notARisks: getNoRiskTags(_riskFactor)
1225
- },
1226
- protocols: [Protocols.VESU],
1227
- maxTVL: Web3Number.fromWei(0, 18),
1228
- contractDetails: getContractDetails(strkVaultSettings),
1229
- faqs: getFAQs(),
1230
- investmentSteps: investmentSteps,
1231
- auditUrl: AUDIT_URL,
1232
- },
1233
- {
1234
- name: "USDT Evergreen",
1235
- description: getDescription('USDT', ['vesu']),
1236
- address: ContractAddr.from('0x1c4933d1880c6778585e597154eaca7b428579d72f3aae425ad2e4d26c6bb3'),
1237
- launchBlock: 0,
1238
- type: 'ERC4626',
1239
- depositTokens: [Global.getDefaultTokens().find(token => token.symbol === 'USDT')!],
1240
- additionalInfo: getLooperSettings('USDT', 'ETH', usdtVaultSettings, VesuPools.Genesis, VesuPools.Genesis),
1241
- risk: {
1242
- riskFactor: _riskFactor,
1243
- netRisk:
1244
- _riskFactor.reduce((acc, curr) => acc + curr.value * curr.weight, 0) /
1245
- _riskFactor.reduce((acc, curr) => acc + curr.weight, 0),
1246
- notARisks: getNoRiskTags(_riskFactor)
1247
- },
1248
- protocols: [Protocols.VESU],
1249
- maxTVL: Web3Number.fromWei(0, 6),
1250
- contractDetails: getContractDetails(usdtVaultSettings),
1251
- faqs: getFAQs(),
1252
- investmentSteps: investmentSteps,
1253
- auditUrl: AUDIT_URL,
1254
- }
1255
- ]
1053
+ // const investmentSteps: string[] = [
1054
+ // "Deposit funds into the vault",
1055
+ // "Vault manager allocates funds to optimal yield sources",
1056
+ // "Vault manager reports asset under management (AUM) regularly to the vault",
1057
+ // "Request withdrawal and vault manager processes it in 1-2 hours"
1058
+ // ]
1059
+
1060
+ // const AUDIT_URL = 'https://docs.troves.fi/p/security#starknet-vault-kit'
1061
+ // export const UniversalStrategies: IStrategyMetadata<UniversalStrategySettings>[] =
1062
+ // [
1063
+ // {
1064
+ // name: "USDC Evergreen",
1065
+ // description: getDescription('USDC', ['vesu', 'extended']),
1066
+ // address: ContractAddr.from('0x7e6498cf6a1bfc7e6fc89f1831865e2dacb9756def4ec4b031a9138788a3b5e'),
1067
+ // launchBlock: 0,
1068
+ // type: 'ERC4626',
1069
+ // depositTokens: [Global.getDefaultTokens().find(token => token.symbol === 'USDC')!],
1070
+ // additionalInfo: getLooperSettings('USDC', 'ETH', usdcVaultSettings, VesuPools.Genesis, VesuPools.Genesis),
1071
+ // risk: {
1072
+ // riskFactor: _riskFactor,
1073
+ // netRisk:
1074
+ // _riskFactor.reduce((acc, curr) => acc + curr.value * curr.weight, 0) /
1075
+ // _riskFactor.reduce((acc, curr) => acc + curr.weight, 0),
1076
+ // notARisks: getNoRiskTags(_riskFactor)
1077
+ // },
1078
+ // auditUrl: AUDIT_URL,
1079
+ // protocols: [Protocols.VESU],
1080
+ // maxTVL: Web3Number.fromWei(0, 6),
1081
+ // contractDetails: getContractDetails(usdcVaultSettings),
1082
+ // faqs: getFAQs(),
1083
+ // investmentSteps: investmentSteps,
1084
+ // },
1085
+ // {
1086
+ // name: "WBTC Evergreen",
1087
+ // description: getDescription('WBTC', ['vesu', 'endur', 'extended']),
1088
+ // address: ContractAddr.from('0x5a4c1651b913aa2ea7afd9024911603152a19058624c3e425405370d62bf80c'),
1089
+ // launchBlock: 0,
1090
+ // type: 'ERC4626',
1091
+ // depositTokens: [Global.getDefaultTokens().find(token => token.symbol === 'WBTC')!],
1092
+ // additionalInfo: getLooperSettings('WBTC', 'ETH', wbtcVaultSettings, VesuPools.Genesis, VesuPools.Genesis),
1093
+ // risk: {
1094
+ // riskFactor: _riskFactor,
1095
+ // netRisk:
1096
+ // _riskFactor.reduce((acc, curr) => acc + curr.value * curr.weight, 0) /
1097
+ // _riskFactor.reduce((acc, curr) => acc + curr.weight, 0),
1098
+ // notARisks: getNoRiskTags(_riskFactor)
1099
+ // },
1100
+ // protocols: [Protocols.VESU],
1101
+ // maxTVL: Web3Number.fromWei(0, 8),
1102
+ // contractDetails: getContractDetails(wbtcVaultSettings),
1103
+ // faqs: getFAQs(),
1104
+ // investmentSteps: investmentSteps,
1105
+ // auditUrl: AUDIT_URL,
1106
+ // },
1107
+ // {
1108
+ // name: "ETH Evergreen",
1109
+ // description: getDescription('ETH', ['vesu', 'extended']),
1110
+ // address: ContractAddr.from('0x446c22d4d3f5cb52b4950ba832ba1df99464c6673a37c092b1d9622650dbd8'),
1111
+ // launchBlock: 0,
1112
+ // type: 'ERC4626',
1113
+ // depositTokens: [Global.getDefaultTokens().find(token => token.symbol === 'ETH')!],
1114
+ // additionalInfo: getLooperSettings('ETH', 'WBTC', ethVaultSettings, VesuPools.Genesis, VesuPools.Genesis),
1115
+ // risk: {
1116
+ // riskFactor: _riskFactor,
1117
+ // netRisk:
1118
+ // _riskFactor.reduce((acc, curr) => acc + curr.value * curr.weight, 0) /
1119
+ // _riskFactor.reduce((acc, curr) => acc + curr.weight, 0),
1120
+ // notARisks: getNoRiskTags(_riskFactor)
1121
+ // },
1122
+ // protocols: [Protocols.VESU],
1123
+ // maxTVL: Web3Number.fromWei(0, 18),
1124
+ // contractDetails: getContractDetails(ethVaultSettings),
1125
+ // faqs: getFAQs(),
1126
+ // investmentSteps: investmentSteps,
1127
+ // auditUrl: AUDIT_URL,
1128
+ // },
1129
+ // {
1130
+ // name: "STRK Evergreen",
1131
+ // description: getDescription('STRK', ['vesu', 'endur', 'extended']),
1132
+ // address: ContractAddr.from('0x55d012f57e58c96e0a5c7ebbe55853989d01e6538b15a95e7178aca4af05c21'),
1133
+ // launchBlock: 0,
1134
+ // type: 'ERC4626',
1135
+ // depositTokens: [Global.getDefaultTokens().find(token => token.symbol === 'STRK')!],
1136
+ // additionalInfo: getLooperSettings('STRK', 'ETH', strkVaultSettings, VesuPools.Genesis, VesuPools.Genesis),
1137
+ // risk: {
1138
+ // riskFactor: _riskFactor,
1139
+ // netRisk:
1140
+ // _riskFactor.reduce((acc, curr) => acc + curr.value * curr.weight, 0) /
1141
+ // _riskFactor.reduce((acc, curr) => acc + curr.weight, 0),
1142
+ // notARisks: getNoRiskTags(_riskFactor)
1143
+ // },
1144
+ // protocols: [Protocols.VESU],
1145
+ // maxTVL: Web3Number.fromWei(0, 18),
1146
+ // contractDetails: getContractDetails(strkVaultSettings),
1147
+ // faqs: getFAQs(),
1148
+ // investmentSteps: investmentSteps,
1149
+ // auditUrl: AUDIT_URL,
1150
+ // },
1151
+ // {
1152
+ // name: "USDT Evergreen",
1153
+ // description: getDescription('USDT', ['vesu']),
1154
+ // address: ContractAddr.from('0x1c4933d1880c6778585e597154eaca7b428579d72f3aae425ad2e4d26c6bb3'),
1155
+ // launchBlock: 0,
1156
+ // type: 'ERC4626',
1157
+ // depositTokens: [Global.getDefaultTokens().find(token => token.symbol === 'USDT')!],
1158
+ // additionalInfo: getLooperSettings('USDT', 'ETH', usdtVaultSettings, VesuPools.Genesis, VesuPools.Genesis),
1159
+ // risk: {
1160
+ // riskFactor: _riskFactor,
1161
+ // netRisk:
1162
+ // _riskFactor.reduce((acc, curr) => acc + curr.value * curr.weight, 0) /
1163
+ // _riskFactor.reduce((acc, curr) => acc + curr.weight, 0),
1164
+ // notARisks: getNoRiskTags(_riskFactor)
1165
+ // },
1166
+ // protocols: [Protocols.VESU],
1167
+ // maxTVL: Web3Number.fromWei(0, 6),
1168
+ // contractDetails: getContractDetails(usdtVaultSettings),
1169
+ // faqs: getFAQs(),
1170
+ // investmentSteps: investmentSteps,
1171
+ // auditUrl: AUDIT_URL,
1172
+ // }
1173
+ // ]