@strkfarm/sdk 1.0.62 → 1.0.64
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.browser.global.js +660 -372
- package/dist/index.browser.mjs +357 -69
- package/dist/index.d.ts +27 -3
- package/dist/index.js +358 -72
- package/dist/index.mjs +360 -74
- package/package.json +1 -1
- package/src/global.ts +19 -1
- package/src/interfaces/common.tsx +1 -0
- package/src/interfaces/risks.ts +175 -0
- package/src/modules/harvests.ts +4 -2
- package/src/notifs/telegram.ts +3 -3
- package/src/strategies/ekubo-cl-vault.tsx +201 -71
- package/src/strategies/universal-adapters/adapter-utils.ts +3 -1
- package/src/strategies/universal-adapters/common-adapter.ts +57 -1
- package/src/strategies/universal-adapters/vesu-adapter.ts +39 -0
- package/src/strategies/universal-strategy.tsx +78 -5
package/dist/index.browser.mjs
CHANGED
|
@@ -172,7 +172,7 @@ var defaultTokens = [{
|
|
|
172
172
|
name: "WBTC",
|
|
173
173
|
symbol: "WBTC",
|
|
174
174
|
logo: "https://assets.troves.fi/integrations/tokens/wbtc.svg",
|
|
175
|
-
address: ContractAddr.from("
|
|
175
|
+
address: ContractAddr.from("0x03fe2b97c1fd336e750087d68b9b867997fd64a2661ff3ca5a7c771641e8e7ac"),
|
|
176
176
|
decimals: 8,
|
|
177
177
|
coingeckId: void 0,
|
|
178
178
|
displayDecimals: 6,
|
|
@@ -188,6 +188,26 @@ var defaultTokens = [{
|
|
|
188
188
|
displayDecimals: 6,
|
|
189
189
|
priceCheckAmount: 1e-4
|
|
190
190
|
// 112000 * 0.0001 = $11.2
|
|
191
|
+
}, {
|
|
192
|
+
name: "solvBTC",
|
|
193
|
+
symbol: "solvBTC",
|
|
194
|
+
logo: "https://assets.strkfarm.com/integrations/tokens/solvbtc.svg",
|
|
195
|
+
address: ContractAddr.from("0x0593e034dda23eea82d2ba9a30960ed42cf4a01502cc2351dc9b9881f9931a68"),
|
|
196
|
+
decimals: 18,
|
|
197
|
+
coingeckId: void 0,
|
|
198
|
+
displayDecimals: 6,
|
|
199
|
+
priceCheckAmount: 1e-4
|
|
200
|
+
// 112000 * 0.0001 = $11.2
|
|
201
|
+
}, {
|
|
202
|
+
name: "LBTC",
|
|
203
|
+
symbol: "LBTC",
|
|
204
|
+
logo: "https://assets.strkfarm.com/integrations/tokens/lbtc.svg",
|
|
205
|
+
address: ContractAddr.from("0x036834a40984312f7f7de8d31e3f6305b325389eaeea5b1c0664b2fb936461a4"),
|
|
206
|
+
decimals: 8,
|
|
207
|
+
coingeckId: void 0,
|
|
208
|
+
displayDecimals: 6,
|
|
209
|
+
priceCheckAmount: 1e-4
|
|
210
|
+
// 112000 * 0.0001 = $11.2
|
|
191
211
|
}];
|
|
192
212
|
var tokens = defaultTokens;
|
|
193
213
|
var _Global = class _Global {
|
|
@@ -3841,11 +3861,12 @@ var EkuboHarvests = class extends Harvests {
|
|
|
3841
3861
|
return rewards.sort((a, b) => b.endDate.getTime() - a.endDate.getTime());
|
|
3842
3862
|
}
|
|
3843
3863
|
};
|
|
3864
|
+
var VESU_REWARDS_CONTRACT = ContractAddr.from("0x0387f3eb1d98632fbe3440a9f1385Aec9d87b6172491d3Dd81f1c35A7c61048F");
|
|
3844
3865
|
var VesuHarvests = class _VesuHarvests extends Harvests {
|
|
3845
3866
|
async getHarvests(addr) {
|
|
3846
3867
|
const result = await fetch(`https://api.vesu.xyz/users/${addr.address}/strk-rewards/calldata`);
|
|
3847
3868
|
const data = await result.json();
|
|
3848
|
-
const rewardsContract =
|
|
3869
|
+
const rewardsContract = VESU_REWARDS_CONTRACT;
|
|
3849
3870
|
const cls = await this.config.provider.getClassAt(rewardsContract.address);
|
|
3850
3871
|
const contract = new Contract4(cls.abi, rewardsContract.address, this.config.provider);
|
|
3851
3872
|
const _claimed_amount = await contract.call("amount_already_claimed", [addr.address]);
|
|
@@ -16210,14 +16231,31 @@ var _protocol2 = {
|
|
|
16210
16231
|
name: "Ekubo",
|
|
16211
16232
|
logo: "https://app.ekubo.org/favicon.ico"
|
|
16212
16233
|
};
|
|
16213
|
-
var
|
|
16214
|
-
{ type: "Smart Contract Risk" /* SMART_CONTRACT_RISK */, value:
|
|
16215
|
-
{ type: "Impermanent Loss Risk" /* IMPERMANENT_LOSS */, value:
|
|
16216
|
-
{ type: "Market Risk" /* MARKET_RISK */, value:
|
|
16234
|
+
var _corelatedPoolRiskFactors = [
|
|
16235
|
+
{ type: "Smart Contract Risk" /* SMART_CONTRACT_RISK */, value: 2 /* WELL_AUDITED */, weight: 34, reason: "Audited smart contracts" },
|
|
16236
|
+
{ type: "Impermanent Loss Risk" /* IMPERMANENT_LOSS */, value: 1 /* HIGHLY_CORRELATED */, weight: 33, reason: "Low risk due to co-related assets" },
|
|
16237
|
+
{ type: "Market Risk" /* MARKET_RISK */, value: 1 /* VERY_LOW_VOLATILITY */, weight: 33, reason: "Low risk due to co-related assets" }
|
|
16238
|
+
];
|
|
16239
|
+
var mediumVolatilityPoolRiskFactors = [
|
|
16240
|
+
{ type: "Smart Contract Risk" /* SMART_CONTRACT_RISK */, value: 2 /* WELL_AUDITED */, weight: 34, reason: "Audited smart contracts" },
|
|
16241
|
+
{ type: "Impermanent Loss Risk" /* IMPERMANENT_LOSS */, value: 3 /* NON_CORRELATED */, weight: 33, reason: "Low risk due to co-related assets" },
|
|
16242
|
+
{ type: "Market Risk" /* MARKET_RISK */, value: 3 /* MODERATE_VOLATILITY */, weight: 33, reason: "Low risk due to co-related assets" }
|
|
16217
16243
|
];
|
|
16218
|
-
var
|
|
16219
|
-
{ type: "Smart Contract Risk" /* SMART_CONTRACT_RISK */, value:
|
|
16244
|
+
var highVolatilityPoolRiskFactors = [
|
|
16245
|
+
{ type: "Smart Contract Risk" /* SMART_CONTRACT_RISK */, value: 2 /* WELL_AUDITED */, weight: 34, reason: "Audited smart contracts" },
|
|
16246
|
+
{ type: "Impermanent Loss Risk" /* IMPERMANENT_LOSS */, value: 3 /* NON_CORRELATED */, weight: 33, reason: "Low risk due to co-related assets" },
|
|
16247
|
+
{ type: "Market Risk" /* MARKET_RISK */, value: 4 /* HIGH_VOLATILITY */, weight: 33, reason: "Low risk due to co-related assets" }
|
|
16220
16248
|
];
|
|
16249
|
+
var mediumRisk = {
|
|
16250
|
+
riskFactor: mediumVolatilityPoolRiskFactors,
|
|
16251
|
+
netRisk: mediumVolatilityPoolRiskFactors.reduce((acc, curr) => acc + curr.value * curr.weight, 0) / mediumVolatilityPoolRiskFactors.reduce((acc, curr) => acc + curr.weight, 0),
|
|
16252
|
+
notARisks: getNoRiskTags(mediumVolatilityPoolRiskFactors)
|
|
16253
|
+
};
|
|
16254
|
+
var highRisk = {
|
|
16255
|
+
riskFactor: highVolatilityPoolRiskFactors,
|
|
16256
|
+
netRisk: highVolatilityPoolRiskFactors.reduce((acc, curr) => acc + curr.value * curr.weight, 0) / highVolatilityPoolRiskFactors.reduce((acc, curr) => acc + curr.weight, 0),
|
|
16257
|
+
notARisks: getNoRiskTags(highVolatilityPoolRiskFactors)
|
|
16258
|
+
};
|
|
16221
16259
|
var AUDIT_URL2 = "https://assets.troves.fi/strkfarm/audit_report_vesu_and_ekubo_strats.pdf";
|
|
16222
16260
|
var faqs2 = [
|
|
16223
16261
|
{
|
|
@@ -16232,6 +16270,10 @@ var faqs2 = [
|
|
|
16232
16270
|
question: "What happens during withdrawal?",
|
|
16233
16271
|
answer: "During withdrawal, you may receive either or both tokens depending on market conditions and prevailing prices."
|
|
16234
16272
|
},
|
|
16273
|
+
{
|
|
16274
|
+
question: "Are there any deposit/withdrawal fees?",
|
|
16275
|
+
answer: "No, there are no deposit/withdrawal fees. However, there is a performance fee varying between 10-20% of the fees and rewards generated. The exact fee is determined by the strategy and the APY shown is net of this fee."
|
|
16276
|
+
},
|
|
16235
16277
|
{
|
|
16236
16278
|
question: "Is the strategy audited?",
|
|
16237
16279
|
answer: /* @__PURE__ */ jsxs2("div", { children: [
|
|
@@ -16266,9 +16308,9 @@ var xSTRKSTRK = {
|
|
|
16266
16308
|
auditUrl: AUDIT_URL2,
|
|
16267
16309
|
maxTVL: Web3Number.fromWei("0", 18),
|
|
16268
16310
|
risk: {
|
|
16269
|
-
riskFactor:
|
|
16270
|
-
netRisk:
|
|
16271
|
-
notARisks: getNoRiskTags(
|
|
16311
|
+
riskFactor: _corelatedPoolRiskFactors,
|
|
16312
|
+
netRisk: _corelatedPoolRiskFactors.reduce((acc, curr) => acc + curr.value * curr.weight, 0) / _corelatedPoolRiskFactors.reduce((acc, curr) => acc + curr.weight, 0),
|
|
16313
|
+
notARisks: getNoRiskTags(_corelatedPoolRiskFactors)
|
|
16272
16314
|
},
|
|
16273
16315
|
apyMethodology: "APY based on 7-day historical performance, including fees and rewards.",
|
|
16274
16316
|
additionalInfo: {
|
|
@@ -16284,7 +16326,8 @@ var xSTRKSTRK = {
|
|
|
16284
16326
|
customShouldRebalance: async (currentPrice) => true,
|
|
16285
16327
|
minWaitHours: 24,
|
|
16286
16328
|
direction: "uponly"
|
|
16287
|
-
}
|
|
16329
|
+
},
|
|
16330
|
+
quoteAsset: Global.getDefaultTokens().find((t) => t.symbol === "STRK")
|
|
16288
16331
|
},
|
|
16289
16332
|
faqs: [
|
|
16290
16333
|
...faqs2,
|
|
@@ -16301,68 +16344,165 @@ var xSTRKSTRK = {
|
|
|
16301
16344
|
contractDetails: [],
|
|
16302
16345
|
investmentSteps: []
|
|
16303
16346
|
};
|
|
16304
|
-
var
|
|
16305
|
-
xSTRKSTRK,
|
|
16347
|
+
var ETHUSDCRe7Strategy = {
|
|
16348
|
+
...xSTRKSTRK,
|
|
16349
|
+
name: "Ekubo ETH/USDC",
|
|
16350
|
+
description: /* @__PURE__ */ jsx3(Fragment2, {}),
|
|
16351
|
+
address: ContractAddr.from(
|
|
16352
|
+
"0x160d8fa4569ef6a12e6bf47cb943d7b5ebba8a41a69a14c1d943050ba5ff947"
|
|
16353
|
+
),
|
|
16354
|
+
launchBlock: 1501761,
|
|
16355
|
+
// must be same order as poolKey token0 and token1
|
|
16356
|
+
depositTokens: [
|
|
16357
|
+
Global.getDefaultTokens().find((t) => t.symbol === "ETH"),
|
|
16358
|
+
Global.getDefaultTokens().find((t) => t.symbol === "USDC")
|
|
16359
|
+
],
|
|
16360
|
+
additionalInfo: {
|
|
16361
|
+
newBounds: "Managed by Re7",
|
|
16362
|
+
truePrice: 1,
|
|
16363
|
+
feeBps: 1e3,
|
|
16364
|
+
rebalanceConditions: {
|
|
16365
|
+
customShouldRebalance: async (currentPrice) => currentPrice > 0.99 && currentPrice < 1.01,
|
|
16366
|
+
minWaitHours: 6,
|
|
16367
|
+
direction: "any"
|
|
16368
|
+
},
|
|
16369
|
+
quoteAsset: Global.getDefaultTokens().find((t) => t.symbol === "USDC")
|
|
16370
|
+
},
|
|
16371
|
+
faqs: [
|
|
16372
|
+
...faqs2,
|
|
16373
|
+
{
|
|
16374
|
+
question: "Who is the curator of this strategy?",
|
|
16375
|
+
answer: /* @__PURE__ */ jsxs2("div", { children: [
|
|
16376
|
+
"Re7 Labs is the curator of this strategy. Re7 Labs is a well-known Web3 asset management firm. This strategy is completely managed by them, including ownership of the vault. Troves is developer of the smart contracts and maintains infrastructure to help users access these strategies. You can find more information about them on their website ",
|
|
16377
|
+
/* @__PURE__ */ jsx3("a", { href: "https://www.re7labs.xyz", style: { textDecoration: "underline", marginLeft: "2px" }, target: "_blank", children: "here" }),
|
|
16378
|
+
"."
|
|
16379
|
+
] })
|
|
16380
|
+
}
|
|
16381
|
+
],
|
|
16382
|
+
risk: highRisk,
|
|
16383
|
+
points: [],
|
|
16384
|
+
curator: { name: "Re7 Labs", logo: "https://www.re7labs.xyz/favicon.ico" }
|
|
16385
|
+
};
|
|
16386
|
+
var RE7Strategies = [
|
|
16387
|
+
ETHUSDCRe7Strategy,
|
|
16306
16388
|
{
|
|
16307
|
-
...
|
|
16389
|
+
...ETHUSDCRe7Strategy,
|
|
16308
16390
|
name: "Ekubo USDC/USDT",
|
|
16309
16391
|
description: /* @__PURE__ */ jsx3(Fragment2, {}),
|
|
16310
16392
|
address: ContractAddr.from(
|
|
16311
|
-
"
|
|
16393
|
+
"0x3a4f8debaf12af97bb911099bc011d63d6c208d4c5ba8e15d7f437785b0aaa2"
|
|
16312
16394
|
),
|
|
16313
|
-
launchBlock:
|
|
16395
|
+
launchBlock: 1501761,
|
|
16314
16396
|
// must be same order as poolKey token0 and token1
|
|
16315
16397
|
depositTokens: [
|
|
16316
16398
|
Global.getDefaultTokens().find((t) => t.symbol === "USDC"),
|
|
16317
16399
|
Global.getDefaultTokens().find((t) => t.symbol === "USDT")
|
|
16318
16400
|
],
|
|
16319
|
-
|
|
16320
|
-
newBounds: {
|
|
16321
|
-
lower: -1,
|
|
16322
|
-
upper: 1
|
|
16323
|
-
},
|
|
16324
|
-
truePrice: 1,
|
|
16325
|
-
feeBps: 1e3,
|
|
16326
|
-
rebalanceConditions: {
|
|
16327
|
-
customShouldRebalance: async (currentPrice) => currentPrice > 0.99 && currentPrice < 1.01,
|
|
16328
|
-
minWaitHours: 6,
|
|
16329
|
-
direction: "any"
|
|
16330
|
-
}
|
|
16331
|
-
}
|
|
16401
|
+
risk: xSTRKSTRK.risk
|
|
16332
16402
|
},
|
|
16333
16403
|
{
|
|
16334
|
-
...
|
|
16404
|
+
...ETHUSDCRe7Strategy,
|
|
16335
16405
|
name: "Ekubo STRK/USDC",
|
|
16336
16406
|
description: /* @__PURE__ */ jsx3(Fragment2, {}),
|
|
16337
16407
|
address: ContractAddr.from(
|
|
16338
|
-
"
|
|
16408
|
+
"0x351b36d0d9d8b40010658825adeeddb1397436cd41acd0ff6c6e23aaa8b5b30"
|
|
16339
16409
|
),
|
|
16340
|
-
launchBlock:
|
|
16410
|
+
launchBlock: 1501762,
|
|
16341
16411
|
// must be same order as poolKey token0 and token1
|
|
16342
16412
|
depositTokens: [
|
|
16343
16413
|
Global.getDefaultTokens().find((t) => t.symbol === "STRK"),
|
|
16344
16414
|
Global.getDefaultTokens().find((t) => t.symbol === "USDC")
|
|
16345
16415
|
],
|
|
16346
|
-
|
|
16347
|
-
|
|
16348
|
-
|
|
16349
|
-
|
|
16350
|
-
|
|
16351
|
-
|
|
16352
|
-
|
|
16353
|
-
|
|
16354
|
-
|
|
16355
|
-
|
|
16416
|
+
risk: highRisk
|
|
16417
|
+
},
|
|
16418
|
+
{
|
|
16419
|
+
...ETHUSDCRe7Strategy,
|
|
16420
|
+
name: "Ekubo STRK/ETH",
|
|
16421
|
+
description: /* @__PURE__ */ jsx3(Fragment2, {}),
|
|
16422
|
+
address: ContractAddr.from(
|
|
16423
|
+
"0x4ce3024b0ee879009112d7b0e073f8a87153dd35b029347d4247ffe48d28f51"
|
|
16424
|
+
),
|
|
16425
|
+
launchBlock: 1501763,
|
|
16426
|
+
// must be same order as poolKey token0 and token1
|
|
16427
|
+
depositTokens: [
|
|
16428
|
+
Global.getDefaultTokens().find((t) => t.symbol === "STRK"),
|
|
16429
|
+
Global.getDefaultTokens().find((t) => t.symbol === "ETH")
|
|
16430
|
+
],
|
|
16431
|
+
risk: highRisk
|
|
16432
|
+
},
|
|
16433
|
+
{
|
|
16434
|
+
...ETHUSDCRe7Strategy,
|
|
16435
|
+
name: "Ekubo WBTC/USDC",
|
|
16436
|
+
description: /* @__PURE__ */ jsx3(Fragment2, {}),
|
|
16437
|
+
address: ContractAddr.from(
|
|
16438
|
+
"0x2bcaef2eb7706875a5fdc6853dd961a0590f850bc3a031c59887189b5e84ba1"
|
|
16439
|
+
),
|
|
16440
|
+
launchBlock: 1501764,
|
|
16441
|
+
// must be same order as poolKey token0 and token1
|
|
16442
|
+
depositTokens: [
|
|
16443
|
+
Global.getDefaultTokens().find((t) => t.symbol === "WBTC"),
|
|
16444
|
+
Global.getDefaultTokens().find((t) => t.symbol === "USDC")
|
|
16445
|
+
],
|
|
16446
|
+
risk: mediumRisk
|
|
16447
|
+
},
|
|
16448
|
+
{
|
|
16449
|
+
...ETHUSDCRe7Strategy,
|
|
16450
|
+
name: "Ekubo tBTC/USDC",
|
|
16451
|
+
description: /* @__PURE__ */ jsx3(Fragment2, {}),
|
|
16452
|
+
address: ContractAddr.from(
|
|
16453
|
+
"0x4aad891a2d4432fba06b6558631bb13f6bbd7f6f33ab8c3111e344889ea4456"
|
|
16454
|
+
),
|
|
16455
|
+
launchBlock: 1501764,
|
|
16456
|
+
// must be same order as poolKey token0 and token1
|
|
16457
|
+
depositTokens: [
|
|
16458
|
+
Global.getDefaultTokens().find((t) => t.symbol === "tBTC"),
|
|
16459
|
+
Global.getDefaultTokens().find((t) => t.symbol === "USDC")
|
|
16460
|
+
],
|
|
16461
|
+
risk: mediumRisk
|
|
16462
|
+
},
|
|
16463
|
+
{
|
|
16464
|
+
...ETHUSDCRe7Strategy,
|
|
16465
|
+
name: "Ekubo WBTC/ETH",
|
|
16466
|
+
description: /* @__PURE__ */ jsx3(Fragment2, {}),
|
|
16467
|
+
address: ContractAddr.from(
|
|
16468
|
+
"0x1c9232b8186d9317652f05055615f18a120c2ad9e5ee96c39e031c257fb945b"
|
|
16469
|
+
),
|
|
16470
|
+
launchBlock: 1501765,
|
|
16471
|
+
// must be same order as poolKey token0 and token1
|
|
16472
|
+
depositTokens: [
|
|
16473
|
+
Global.getDefaultTokens().find((t) => t.symbol === "WBTC"),
|
|
16474
|
+
Global.getDefaultTokens().find((t) => t.symbol === "ETH")
|
|
16475
|
+
],
|
|
16476
|
+
risk: mediumRisk
|
|
16477
|
+
},
|
|
16478
|
+
{
|
|
16479
|
+
...ETHUSDCRe7Strategy,
|
|
16480
|
+
name: "Ekubo WBTC/STRK",
|
|
16481
|
+
description: /* @__PURE__ */ jsx3(Fragment2, {}),
|
|
16482
|
+
address: ContractAddr.from(
|
|
16483
|
+
"0x1248e385c23a929a015ec298a26560fa7745bbd6e41a886550e337b02714b1b"
|
|
16484
|
+
),
|
|
16485
|
+
launchBlock: 1501766,
|
|
16486
|
+
// must be same order as poolKey token0 and token1
|
|
16487
|
+
depositTokens: [
|
|
16488
|
+
Global.getDefaultTokens().find((t) => t.symbol === "WBTC"),
|
|
16489
|
+
Global.getDefaultTokens().find((t) => t.symbol === "STRK")
|
|
16490
|
+
],
|
|
16491
|
+
risk: highRisk
|
|
16356
16492
|
}
|
|
16357
16493
|
];
|
|
16494
|
+
var EkuboCLVaultStrategies = [
|
|
16495
|
+
xSTRKSTRK,
|
|
16496
|
+
...RE7Strategies
|
|
16497
|
+
];
|
|
16358
16498
|
EkuboCLVaultStrategies.forEach((s) => {
|
|
16359
16499
|
s.contractDetails = [
|
|
16360
16500
|
{
|
|
16361
16501
|
address: s.address,
|
|
16362
16502
|
name: "Vault",
|
|
16363
16503
|
sourceCodeUrl: "https://github.com/strkfarm/strkfarm-contracts/tree/main/src/strategies/cl_vault"
|
|
16364
|
-
}
|
|
16365
|
-
...COMMON_CONTRACTS
|
|
16504
|
+
}
|
|
16505
|
+
// ...COMMON_CONTRACTS
|
|
16366
16506
|
];
|
|
16367
16507
|
s.docs = "https://docs.troves.fi/p/ekubo-cl-vaults";
|
|
16368
16508
|
s.description = /* @__PURE__ */ jsxs2("div", { children: [
|
|
@@ -18333,7 +18473,7 @@ var endurProtocol = {
|
|
|
18333
18473
|
name: "Endur",
|
|
18334
18474
|
logo: "https://app.endur.fi/logo.png"
|
|
18335
18475
|
};
|
|
18336
|
-
var
|
|
18476
|
+
var _riskFactor2 = [
|
|
18337
18477
|
{ type: "Smart Contract Risk" /* SMART_CONTRACT_RISK */, value: 0.5, weight: 25, reason: "Audited by CSC" },
|
|
18338
18478
|
{ type: "Depeg Risk" /* DEPEG_RISK */, value: 0.25, weight: 25, reason: "Depending on prevailing market conditions and trading activity, xSTRK may lose its peg to the underlying asset." },
|
|
18339
18479
|
{ type: "Liquidation Risk" /* LIQUIDATION_RISK */, value: 0.1, weight: 10, reason: "Liquidation risk is low due to the nature of the Re7 Pool on Vesu" },
|
|
@@ -18408,9 +18548,9 @@ var SenseiStrategies = [
|
|
|
18408
18548
|
protocols: [endurProtocol, vesuProtocol],
|
|
18409
18549
|
maxTVL: new Web3Number("1500000", 18),
|
|
18410
18550
|
risk: {
|
|
18411
|
-
riskFactor:
|
|
18412
|
-
netRisk:
|
|
18413
|
-
notARisks: getNoRiskTags(
|
|
18551
|
+
riskFactor: _riskFactor2,
|
|
18552
|
+
netRisk: _riskFactor2.reduce((acc, curr) => acc + curr.value * curr.weight, 0) / _riskFactor2.reduce((acc, curr) => acc + curr.weight, 0),
|
|
18553
|
+
notARisks: getNoRiskTags(_riskFactor2)
|
|
18414
18554
|
},
|
|
18415
18555
|
additionalInfo: {
|
|
18416
18556
|
mainToken: Global.getDefaultTokens().find((t) => t.symbol === "STRK"),
|
|
@@ -18437,7 +18577,9 @@ var SenseiStrategies = [
|
|
|
18437
18577
|
import { hash, num as num6, shortString } from "starknet";
|
|
18438
18578
|
|
|
18439
18579
|
// src/strategies/universal-adapters/adapter-utils.ts
|
|
18440
|
-
var SIMPLE_SANITIZER = ContractAddr.from("
|
|
18580
|
+
var SIMPLE_SANITIZER = ContractAddr.from("0x5a2e3ceb3da368b983a8717898427ab7b6daf04014b70f321e777f9aad940b4");
|
|
18581
|
+
var PRICE_ROUTER = ContractAddr.from("0x05e83Fa38D791d2dba8E6f487758A9687FfEe191A6Cf8a6c5761ab0a110DB837");
|
|
18582
|
+
var AVNU_MIDDLEWARE = ContractAddr.from("0x4a7972ed3f5d1e74a6d6c4a8f467666953d081c8f2270390cc169d50d17cb0d");
|
|
18441
18583
|
function toBigInt(value) {
|
|
18442
18584
|
if (typeof value === "string") {
|
|
18443
18585
|
return BigInt(value);
|
|
@@ -18470,7 +18612,7 @@ var BaseAdapter = class extends CacheClass {
|
|
|
18470
18612
|
};
|
|
18471
18613
|
|
|
18472
18614
|
// src/strategies/universal-adapters/common-adapter.ts
|
|
18473
|
-
import { hash as hash2, uint256 as uint2566 } from "starknet";
|
|
18615
|
+
import { hash as hash2, num as num7, uint256 as uint2566 } from "starknet";
|
|
18474
18616
|
var CommonAdapter = class extends BaseAdapter {
|
|
18475
18617
|
constructor(config) {
|
|
18476
18618
|
super();
|
|
@@ -18581,10 +18723,70 @@ var CommonAdapter = class extends BaseAdapter {
|
|
|
18581
18723
|
};
|
|
18582
18724
|
};
|
|
18583
18725
|
}
|
|
18726
|
+
getAvnuAdapter(fromToken, toToken, id) {
|
|
18727
|
+
return () => ({
|
|
18728
|
+
leaf: this.constructSimpleLeafData({
|
|
18729
|
+
id,
|
|
18730
|
+
target: AVNU_MIDDLEWARE,
|
|
18731
|
+
method: "multi_route_swap",
|
|
18732
|
+
packedArguments: [
|
|
18733
|
+
fromToken.toBigInt(),
|
|
18734
|
+
toToken.toBigInt(),
|
|
18735
|
+
this.config.vaultAllocator.toBigInt()
|
|
18736
|
+
]
|
|
18737
|
+
}),
|
|
18738
|
+
callConstructor: this.getAvnuCall(fromToken, toToken).bind(this)
|
|
18739
|
+
});
|
|
18740
|
+
}
|
|
18741
|
+
getAvnuCall(fromToken, toToken) {
|
|
18742
|
+
return (params) => {
|
|
18743
|
+
return {
|
|
18744
|
+
sanitizer: SIMPLE_SANITIZER,
|
|
18745
|
+
call: {
|
|
18746
|
+
contractAddress: AVNU_MIDDLEWARE,
|
|
18747
|
+
selector: hash2.getSelectorFromName("multi_route_swap"),
|
|
18748
|
+
calldata: [
|
|
18749
|
+
fromToken.toBigInt(),
|
|
18750
|
+
// sell_token_address
|
|
18751
|
+
toBigInt(params.props.token_from_amount.low.toString()),
|
|
18752
|
+
// sell_token_amount low
|
|
18753
|
+
toBigInt(params.props.token_from_amount.high.toString()),
|
|
18754
|
+
// sell_token_amount high
|
|
18755
|
+
toToken.toBigInt(),
|
|
18756
|
+
// buy_token_address
|
|
18757
|
+
toBigInt(params.props.token_to_amount.low.toString()),
|
|
18758
|
+
// buy_token_amount low
|
|
18759
|
+
toBigInt(params.props.token_to_amount.high.toString()),
|
|
18760
|
+
// buy_token_amount high
|
|
18761
|
+
toBigInt(params.props.token_to_min_amount.low.toString()),
|
|
18762
|
+
// buy_token_min_amount low
|
|
18763
|
+
toBigInt(params.props.token_to_min_amount.high.toString()),
|
|
18764
|
+
// buy_token_min_amount high
|
|
18765
|
+
this.config.vaultAllocator.toBigInt(),
|
|
18766
|
+
// beneficiary
|
|
18767
|
+
toBigInt(0),
|
|
18768
|
+
// integrator_fee_amount_bps
|
|
18769
|
+
this.config.vaultAllocator.toBigInt(),
|
|
18770
|
+
// integrator_fee_recipient
|
|
18771
|
+
// unpack routes
|
|
18772
|
+
BigInt(params.props.routes.length),
|
|
18773
|
+
...params.props.routes.map((r) => [
|
|
18774
|
+
BigInt(num7.hexToDecimalString(r.token_from)),
|
|
18775
|
+
BigInt(num7.hexToDecimalString(r.token_to)),
|
|
18776
|
+
BigInt(num7.hexToDecimalString(r.exchange_address)),
|
|
18777
|
+
BigInt(r.percent),
|
|
18778
|
+
BigInt(r.additional_swap_params.length),
|
|
18779
|
+
...r.additional_swap_params.map((p) => BigInt(num7.hexToDecimalString(p)))
|
|
18780
|
+
]).flat()
|
|
18781
|
+
]
|
|
18782
|
+
}
|
|
18783
|
+
};
|
|
18784
|
+
};
|
|
18785
|
+
}
|
|
18584
18786
|
};
|
|
18585
18787
|
|
|
18586
18788
|
// src/strategies/universal-adapters/vesu-adapter.ts
|
|
18587
|
-
import { CairoCustomEnum as CairoCustomEnum2, Contract as Contract8, hash as hash3, RpcProvider as RpcProvider4, uint256 as uint2567 } from "starknet";
|
|
18789
|
+
import { CairoCustomEnum as CairoCustomEnum2, Contract as Contract8, hash as hash3, num as num8, RpcProvider as RpcProvider4, shortString as shortString3, uint256 as uint2567 } from "starknet";
|
|
18588
18790
|
|
|
18589
18791
|
// src/data/vesu-singleton.abi.json
|
|
18590
18792
|
var vesu_singleton_abi_default = [
|
|
@@ -20917,6 +21119,40 @@ var VesuAdapter = class _VesuAdapter extends BaseAdapter {
|
|
|
20917
21119
|
}
|
|
20918
21120
|
};
|
|
20919
21121
|
};
|
|
21122
|
+
this.getDefispringRewardsAdapter = (id) => {
|
|
21123
|
+
return () => {
|
|
21124
|
+
const packedArguments = [];
|
|
21125
|
+
const output = {
|
|
21126
|
+
id: BigInt(num8.getDecimalString(shortString3.encodeShortString(id))),
|
|
21127
|
+
readableId: id,
|
|
21128
|
+
data: [
|
|
21129
|
+
SIMPLE_SANITIZER.toBigInt(),
|
|
21130
|
+
// sanitizer address
|
|
21131
|
+
VESU_REWARDS_CONTRACT.toBigInt(),
|
|
21132
|
+
// contract
|
|
21133
|
+
toBigInt(hash3.getSelectorFromName("claim")),
|
|
21134
|
+
// method name
|
|
21135
|
+
BigInt(packedArguments.length),
|
|
21136
|
+
...packedArguments
|
|
21137
|
+
]
|
|
21138
|
+
};
|
|
21139
|
+
return { leaf: output, callConstructor: this.getDefiSpringClaimCall().bind(this) };
|
|
21140
|
+
};
|
|
21141
|
+
};
|
|
21142
|
+
this.getDefiSpringClaimCall = () => {
|
|
21143
|
+
return (params) => ({
|
|
21144
|
+
sanitizer: SIMPLE_SANITIZER,
|
|
21145
|
+
call: {
|
|
21146
|
+
contractAddress: VESU_REWARDS_CONTRACT,
|
|
21147
|
+
selector: hash3.getSelectorFromName("claim"),
|
|
21148
|
+
calldata: [
|
|
21149
|
+
BigInt(params.amount.toWei()),
|
|
21150
|
+
BigInt(params.proofs.length),
|
|
21151
|
+
...params.proofs.map((proof) => BigInt(num8.hexToDecimalString(proof)))
|
|
21152
|
+
]
|
|
21153
|
+
}
|
|
21154
|
+
});
|
|
21155
|
+
};
|
|
20920
21156
|
this.config = config;
|
|
20921
21157
|
}
|
|
20922
21158
|
static getDefaultModifyPositionCallParams(params) {
|
|
@@ -23546,7 +23782,7 @@ var UniversalStrategy = class _UniversalStrategy extends BaseStrategy {
|
|
|
23546
23782
|
const aumToken = vesuAum.plus(balance.amount);
|
|
23547
23783
|
logger.verbose(`${this.getTag()} Actual AUM: ${aumToken}`);
|
|
23548
23784
|
const netAPY = await this.netAPY();
|
|
23549
|
-
const defispringAPY = netAPY.splits.find((s) => s.id === "defispring")?.apy || 0;
|
|
23785
|
+
const defispringAPY = (netAPY.splits.find((s) => s.id === "defispring")?.apy || 0) * 0.8;
|
|
23550
23786
|
if (!defispringAPY) throw new Error("DefiSpring APY not found");
|
|
23551
23787
|
const timeDiff = Math.round(Date.now() / 1e3) - Number(lastReportTime);
|
|
23552
23788
|
const growthRate = timeDiff * defispringAPY / (365 * 24 * 60 * 60);
|
|
@@ -23789,6 +24025,51 @@ var UniversalStrategy = class _UniversalStrategy extends BaseStrategy {
|
|
|
23789
24025
|
const manageCall = this.getManageCall(["approve_bring_liquidity" /* APPROVE_BRING_LIQUIDITY */, "bring_liquidity" /* BRING_LIQUIDITY */], [manageCall1, manageCall2]);
|
|
23790
24026
|
return manageCall;
|
|
23791
24027
|
}
|
|
24028
|
+
async getHarvestCall() {
|
|
24029
|
+
const vesuHarvest = new VesuHarvests(this.config);
|
|
24030
|
+
const harvestInfo = await vesuHarvest.getUnHarvestedRewards(this.metadata.additionalInfo.vaultAllocator);
|
|
24031
|
+
if (harvestInfo.length != 1) {
|
|
24032
|
+
throw new Error(`Expected 1 harvest info, got ${harvestInfo.length}`);
|
|
24033
|
+
}
|
|
24034
|
+
const amount = harvestInfo[0].claim.amount;
|
|
24035
|
+
const actualReward = harvestInfo[0].actualReward;
|
|
24036
|
+
const proofs = harvestInfo[0].proof;
|
|
24037
|
+
if (actualReward.isZero()) {
|
|
24038
|
+
throw new Error(`Expected non-zero actual reward, got ${harvestInfo[0].actualReward}`);
|
|
24039
|
+
}
|
|
24040
|
+
const manage1Info = this.getProofs("defispring_rewards" /* DEFISPRING_REWARDS */);
|
|
24041
|
+
const manageCall1 = manage1Info.callConstructor({
|
|
24042
|
+
amount,
|
|
24043
|
+
proofs
|
|
24044
|
+
});
|
|
24045
|
+
const proofIds = ["defispring_rewards" /* DEFISPRING_REWARDS */];
|
|
24046
|
+
const manageCalls = [manageCall1];
|
|
24047
|
+
const STRK2 = Global.getDefaultTokens().find((t) => t.symbol === "STRK");
|
|
24048
|
+
if (this.asset().symbol != "STRK") {
|
|
24049
|
+
const manage2Info = this.getProofs("approve_swap_token1" /* APPROVE_SWAP_TOKEN1 */);
|
|
24050
|
+
const manageCall2 = manage2Info.callConstructor({
|
|
24051
|
+
amount: actualReward
|
|
24052
|
+
});
|
|
24053
|
+
const avnuModule = new AvnuWrapper();
|
|
24054
|
+
const quote = await avnuModule.getQuotes(
|
|
24055
|
+
STRK2.address.address,
|
|
24056
|
+
this.asset().address.address,
|
|
24057
|
+
actualReward.toWei(),
|
|
24058
|
+
this.address.address
|
|
24059
|
+
);
|
|
24060
|
+
const swapInfo = await avnuModule.getSwapInfo(quote, this.address.address, 0, this.address.address);
|
|
24061
|
+
const manage3Info = this.getProofs("avnu_swap_rewards" /* AVNU_SWAP_REWARDS */);
|
|
24062
|
+
const manageCall3 = manage3Info.callConstructor({
|
|
24063
|
+
props: swapInfo
|
|
24064
|
+
});
|
|
24065
|
+
proofIds.push("approve_swap_token1" /* APPROVE_SWAP_TOKEN1 */);
|
|
24066
|
+
proofIds.push("avnu_swap_rewards" /* AVNU_SWAP_REWARDS */);
|
|
24067
|
+
manageCalls.push(manageCall2);
|
|
24068
|
+
manageCalls.push(manageCall3);
|
|
24069
|
+
}
|
|
24070
|
+
const manageCall = this.getManageCall(proofIds, manageCalls);
|
|
24071
|
+
return { call: manageCall, reward: actualReward, tokenInfo: STRK2 };
|
|
24072
|
+
}
|
|
23792
24073
|
async getRebalanceCall(params) {
|
|
23793
24074
|
let callSet1 = this.getVesuModifyPositionCalls({
|
|
23794
24075
|
isLeg1: true,
|
|
@@ -23825,6 +24106,9 @@ var UNIVERSAL_MANAGE_IDS = /* @__PURE__ */ ((UNIVERSAL_MANAGE_IDS2) => {
|
|
|
23825
24106
|
UNIVERSAL_MANAGE_IDS2["APPROVE_TOKEN2"] = "approve_token2";
|
|
23826
24107
|
UNIVERSAL_MANAGE_IDS2["APPROVE_BRING_LIQUIDITY"] = "approve_bring_liquidity";
|
|
23827
24108
|
UNIVERSAL_MANAGE_IDS2["BRING_LIQUIDITY"] = "bring_liquidity";
|
|
24109
|
+
UNIVERSAL_MANAGE_IDS2["DEFISPRING_REWARDS"] = "defispring_rewards";
|
|
24110
|
+
UNIVERSAL_MANAGE_IDS2["APPROVE_SWAP_TOKEN1"] = "approve_swap_token1";
|
|
24111
|
+
UNIVERSAL_MANAGE_IDS2["AVNU_SWAP_REWARDS"] = "avnu_swap_rewards";
|
|
23828
24112
|
return UNIVERSAL_MANAGE_IDS2;
|
|
23829
24113
|
})(UNIVERSAL_MANAGE_IDS || {});
|
|
23830
24114
|
var UNIVERSAL_ADAPTERS = /* @__PURE__ */ ((UNIVERSAL_ADAPTERS2) => {
|
|
@@ -23874,9 +24158,13 @@ function getLooperSettings(token1Symbol, token2Symbol, vaultSettings, pool1, poo
|
|
|
23874
24158
|
vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(ETHToken.address, vesuAdapterETHUSDC.VESU_SINGLETON, "approve_token2" /* APPROVE_TOKEN2 */).bind(commonAdapter));
|
|
23875
24159
|
vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(USDCToken.address, vaultSettings.vaultAddress, "approve_bring_liquidity" /* APPROVE_BRING_LIQUIDITY */).bind(commonAdapter));
|
|
23876
24160
|
vaultSettings.leafAdapters.push(commonAdapter.getBringLiquidityAdapter("bring_liquidity" /* BRING_LIQUIDITY */).bind(commonAdapter));
|
|
24161
|
+
vaultSettings.leafAdapters.push(vesuAdapterUSDCETH.getDefispringRewardsAdapter("defispring_rewards" /* DEFISPRING_REWARDS */).bind(vesuAdapterUSDCETH));
|
|
24162
|
+
const STRKToken = Global.getDefaultTokens().find((token) => token.symbol === "STRK");
|
|
24163
|
+
vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(STRKToken.address, AVNU_MIDDLEWARE, "approve_swap_token1" /* APPROVE_SWAP_TOKEN1 */).bind(commonAdapter));
|
|
24164
|
+
vaultSettings.leafAdapters.push(commonAdapter.getAvnuAdapter(STRKToken.address, USDCToken.address, "avnu_swap_rewards" /* AVNU_SWAP_REWARDS */).bind(commonAdapter));
|
|
23877
24165
|
return vaultSettings;
|
|
23878
24166
|
}
|
|
23879
|
-
var
|
|
24167
|
+
var _riskFactor3 = [
|
|
23880
24168
|
{ type: "Smart Contract Risk" /* SMART_CONTRACT_RISK */, value: 0.5, weight: 25, reason: "Audited by Zellic" },
|
|
23881
24169
|
{ type: "Liquidation Risk" /* LIQUIDATION_RISK */, value: 1.5, weight: 50, reason: "Liquidation risk is mitigated by stable price feed on Starknet" },
|
|
23882
24170
|
{ type: "Technical Risk" /* TECHNICAL_RISK */, value: 1, weight: 50, reason: "Technical failures like risk monitoring failures" }
|
|
@@ -24080,9 +24368,9 @@ var UniversalStrategies = [
|
|
|
24080
24368
|
depositTokens: [Global.getDefaultTokens().find((token) => token.symbol === "USDC")],
|
|
24081
24369
|
additionalInfo: getLooperSettings("USDC", "ETH", usdcVaultSettings, VesuPools.Genesis, VesuPools.Genesis),
|
|
24082
24370
|
risk: {
|
|
24083
|
-
riskFactor:
|
|
24084
|
-
netRisk:
|
|
24085
|
-
notARisks: getNoRiskTags(
|
|
24371
|
+
riskFactor: _riskFactor3,
|
|
24372
|
+
netRisk: _riskFactor3.reduce((acc, curr) => acc + curr.value * curr.weight, 0) / _riskFactor3.reduce((acc, curr) => acc + curr.weight, 0),
|
|
24373
|
+
notARisks: getNoRiskTags(_riskFactor3)
|
|
24086
24374
|
},
|
|
24087
24375
|
protocols: [Protocols.VESU],
|
|
24088
24376
|
maxTVL: Web3Number.fromWei(0, 6),
|
|
@@ -24099,9 +24387,9 @@ var UniversalStrategies = [
|
|
|
24099
24387
|
depositTokens: [Global.getDefaultTokens().find((token) => token.symbol === "WBTC")],
|
|
24100
24388
|
additionalInfo: getLooperSettings("WBTC", "ETH", wbtcVaultSettings, VesuPools.Genesis, VesuPools.Genesis),
|
|
24101
24389
|
risk: {
|
|
24102
|
-
riskFactor:
|
|
24103
|
-
netRisk:
|
|
24104
|
-
notARisks: getNoRiskTags(
|
|
24390
|
+
riskFactor: _riskFactor3,
|
|
24391
|
+
netRisk: _riskFactor3.reduce((acc, curr) => acc + curr.value * curr.weight, 0) / _riskFactor3.reduce((acc, curr) => acc + curr.weight, 0),
|
|
24392
|
+
notARisks: getNoRiskTags(_riskFactor3)
|
|
24105
24393
|
},
|
|
24106
24394
|
protocols: [Protocols.VESU],
|
|
24107
24395
|
maxTVL: Web3Number.fromWei(0, 8),
|
|
@@ -24118,9 +24406,9 @@ var UniversalStrategies = [
|
|
|
24118
24406
|
depositTokens: [Global.getDefaultTokens().find((token) => token.symbol === "ETH")],
|
|
24119
24407
|
additionalInfo: getLooperSettings("ETH", "WBTC", ethVaultSettings, VesuPools.Genesis, VesuPools.Genesis),
|
|
24120
24408
|
risk: {
|
|
24121
|
-
riskFactor:
|
|
24122
|
-
netRisk:
|
|
24123
|
-
notARisks: getNoRiskTags(
|
|
24409
|
+
riskFactor: _riskFactor3,
|
|
24410
|
+
netRisk: _riskFactor3.reduce((acc, curr) => acc + curr.value * curr.weight, 0) / _riskFactor3.reduce((acc, curr) => acc + curr.weight, 0),
|
|
24411
|
+
notARisks: getNoRiskTags(_riskFactor3)
|
|
24124
24412
|
},
|
|
24125
24413
|
protocols: [Protocols.VESU],
|
|
24126
24414
|
maxTVL: Web3Number.fromWei(0, 18),
|
|
@@ -24137,9 +24425,9 @@ var UniversalStrategies = [
|
|
|
24137
24425
|
depositTokens: [Global.getDefaultTokens().find((token) => token.symbol === "STRK")],
|
|
24138
24426
|
additionalInfo: getLooperSettings("STRK", "ETH", strkVaultSettings, VesuPools.Genesis, VesuPools.Genesis),
|
|
24139
24427
|
risk: {
|
|
24140
|
-
riskFactor:
|
|
24141
|
-
netRisk:
|
|
24142
|
-
notARisks: getNoRiskTags(
|
|
24428
|
+
riskFactor: _riskFactor3,
|
|
24429
|
+
netRisk: _riskFactor3.reduce((acc, curr) => acc + curr.value * curr.weight, 0) / _riskFactor3.reduce((acc, curr) => acc + curr.weight, 0),
|
|
24430
|
+
notARisks: getNoRiskTags(_riskFactor3)
|
|
24143
24431
|
},
|
|
24144
24432
|
protocols: [Protocols.VESU],
|
|
24145
24433
|
maxTVL: Web3Number.fromWei(0, 18),
|
|
@@ -24156,9 +24444,9 @@ var UniversalStrategies = [
|
|
|
24156
24444
|
depositTokens: [Global.getDefaultTokens().find((token) => token.symbol === "USDT")],
|
|
24157
24445
|
additionalInfo: getLooperSettings("USDT", "ETH", usdtVaultSettings, VesuPools.Genesis, VesuPools.Genesis),
|
|
24158
24446
|
risk: {
|
|
24159
|
-
riskFactor:
|
|
24160
|
-
netRisk:
|
|
24161
|
-
notARisks: getNoRiskTags(
|
|
24447
|
+
riskFactor: _riskFactor3,
|
|
24448
|
+
netRisk: _riskFactor3.reduce((acc, curr) => acc + curr.value * curr.weight, 0) / _riskFactor3.reduce((acc, curr) => acc + curr.weight, 0),
|
|
24449
|
+
notARisks: getNoRiskTags(_riskFactor3)
|
|
24162
24450
|
},
|
|
24163
24451
|
protocols: [Protocols.VESU],
|
|
24164
24452
|
maxTVL: Web3Number.fromWei(0, 6),
|