@strkfarm/sdk 2.0.0-staging.70 → 2.0.0-staging.72
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 +26212 -26154
- package/dist/index.browser.mjs +323 -267
- package/dist/index.d.ts +15 -2
- package/dist/index.js +385 -326
- package/dist/index.mjs +356 -298
- package/package.json +1 -1
- package/src/global.ts +37 -11
- package/src/interfaces/common.tsx +15 -0
- package/src/modules/ekubo-pricer.ts +2 -1
- package/src/modules/pricer.ts +27 -15
- package/src/modules/zkLend.ts +3 -2
- package/src/strategies/ekubo-cl-vault.tsx +3 -0
- package/src/strategies/universal-lst-muliplier-strategy.tsx +3 -0
- package/src/strategies/universal-strategy.tsx +3 -0
- package/src/strategies/yoloVault.ts +5 -0
package/dist/index.js
CHANGED
|
@@ -84,6 +84,7 @@ __export(index_exports, {
|
|
|
84
84
|
StrategyType: () => StrategyType,
|
|
85
85
|
TelegramGroupNotif: () => TelegramGroupNotif,
|
|
86
86
|
TelegramNotif: () => TelegramNotif,
|
|
87
|
+
TokenIndexingType: () => TokenIndexingType,
|
|
87
88
|
UNIVERSAL_ADAPTERS: () => UNIVERSAL_ADAPTERS,
|
|
88
89
|
UNIVERSAL_MANAGE_IDS: () => UNIVERSAL_MANAGE_IDS,
|
|
89
90
|
UniversalLstMultiplierStrategy: () => UniversalLstMultiplierStrategy,
|
|
@@ -145,12 +146,275 @@ var import_axios3 = __toESM(require("axios"));
|
|
|
145
146
|
// src/global.ts
|
|
146
147
|
var import_axios = __toESM(require("axios"));
|
|
147
148
|
|
|
149
|
+
// src/utils/logger.node.ts
|
|
150
|
+
var import_winston = __toESM(require("winston"));
|
|
151
|
+
var colors = {
|
|
152
|
+
error: "red",
|
|
153
|
+
warn: "yellow",
|
|
154
|
+
info: "blue",
|
|
155
|
+
verbose: "white",
|
|
156
|
+
debug: "white"
|
|
157
|
+
};
|
|
158
|
+
import_winston.default.addColors(colors);
|
|
159
|
+
var logLevel = (process.env.LOG_LEVEL || process.env.SDK_LOG_LEVEL || "debug").toLowerCase();
|
|
160
|
+
var logger = import_winston.default.createLogger({
|
|
161
|
+
level: logLevel,
|
|
162
|
+
// Set the minimum logging level from environment variable
|
|
163
|
+
format: import_winston.format.combine(
|
|
164
|
+
import_winston.format.colorize({ all: true }),
|
|
165
|
+
// Apply custom colors
|
|
166
|
+
import_winston.format.timestamp({ format: "YYYY-MM-DD HH:mm:ss" }),
|
|
167
|
+
// Add timestamp to log messages
|
|
168
|
+
import_winston.format.printf(({ timestamp, level, message, ...meta }) => {
|
|
169
|
+
let msg = `${timestamp} ${level}: ${message}`;
|
|
170
|
+
if (meta && meta[/* @__PURE__ */ Symbol.for("splat")]) {
|
|
171
|
+
const splat = meta[/* @__PURE__ */ Symbol.for("splat")];
|
|
172
|
+
if (Array.isArray(splat)) {
|
|
173
|
+
for (const arg of splat) {
|
|
174
|
+
if (arg instanceof Error) {
|
|
175
|
+
msg += `
|
|
176
|
+
${arg.stack}`;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
return msg;
|
|
182
|
+
})
|
|
183
|
+
),
|
|
184
|
+
transports: [
|
|
185
|
+
new import_winston.default.transports.Console()
|
|
186
|
+
// Output logs to the console
|
|
187
|
+
]
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
// src/interfaces/lending.ts
|
|
191
|
+
var MarginType = /* @__PURE__ */ ((MarginType2) => {
|
|
192
|
+
MarginType2["SHARED"] = "shared";
|
|
193
|
+
MarginType2["NONE"] = "none";
|
|
194
|
+
return MarginType2;
|
|
195
|
+
})(MarginType || {});
|
|
196
|
+
var ILending = class {
|
|
197
|
+
constructor(config, metadata) {
|
|
198
|
+
this.tokens = [];
|
|
199
|
+
this.initialised = false;
|
|
200
|
+
this.metadata = metadata;
|
|
201
|
+
this.config = config;
|
|
202
|
+
this.init();
|
|
203
|
+
}
|
|
204
|
+
/** Wait for initialisation */
|
|
205
|
+
waitForInitilisation() {
|
|
206
|
+
return new Promise((resolve, reject) => {
|
|
207
|
+
const interval = setInterval(() => {
|
|
208
|
+
logger.verbose(`Waiting for ${this.metadata.name} to initialise`);
|
|
209
|
+
if (this.initialised) {
|
|
210
|
+
logger.verbose(`${this.metadata.name} initialised`);
|
|
211
|
+
clearInterval(interval);
|
|
212
|
+
resolve();
|
|
213
|
+
}
|
|
214
|
+
}, 1e3);
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
// src/interfaces/common.tsx
|
|
220
|
+
var import_starknet = require("starknet");
|
|
221
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
222
|
+
var RiskType = /* @__PURE__ */ ((RiskType2) => {
|
|
223
|
+
RiskType2["MARKET_RISK"] = "Market Risk";
|
|
224
|
+
RiskType2["IMPERMANENT_LOSS"] = "Impermanent Loss Risk";
|
|
225
|
+
RiskType2["LIQUIDATION_RISK"] = "Liquidation Risk";
|
|
226
|
+
RiskType2["LOW_LIQUIDITY_RISK"] = "Low Liquidity Risk";
|
|
227
|
+
RiskType2["SMART_CONTRACT_RISK"] = "Smart Contract Risk";
|
|
228
|
+
RiskType2["ORACLE_RISK"] = "Oracle Risk";
|
|
229
|
+
RiskType2["TECHNICAL_RISK"] = "Technical Risk";
|
|
230
|
+
RiskType2["COUNTERPARTY_RISK"] = "Counterparty Risk";
|
|
231
|
+
RiskType2["DEPEG_RISK"] = "Depeg Risk";
|
|
232
|
+
return RiskType2;
|
|
233
|
+
})(RiskType || {});
|
|
234
|
+
var TokenIndexingType = /* @__PURE__ */ ((TokenIndexingType2) => {
|
|
235
|
+
TokenIndexingType2["PEGGED"] = "pegged";
|
|
236
|
+
TokenIndexingType2["INDEXER"] = "indexer";
|
|
237
|
+
TokenIndexingType2["LST_SCRIPT"] = "lstScript";
|
|
238
|
+
TokenIndexingType2["IGNORE"] = "ignore";
|
|
239
|
+
return TokenIndexingType2;
|
|
240
|
+
})(TokenIndexingType || {});
|
|
241
|
+
var Network = /* @__PURE__ */ ((Network2) => {
|
|
242
|
+
Network2["mainnet"] = "mainnet";
|
|
243
|
+
Network2["sepolia"] = "sepolia";
|
|
244
|
+
Network2["devnet"] = "devnet";
|
|
245
|
+
return Network2;
|
|
246
|
+
})(Network || {});
|
|
247
|
+
var StrategyTag = /* @__PURE__ */ ((StrategyTag3) => {
|
|
248
|
+
StrategyTag3["META_VAULT"] = "Meta Vaults";
|
|
249
|
+
StrategyTag3["LEVERED"] = "Maxx";
|
|
250
|
+
StrategyTag3["AUTOMATED_LP"] = "Ekubo";
|
|
251
|
+
StrategyTag3["BTC"] = "BTC";
|
|
252
|
+
return StrategyTag3;
|
|
253
|
+
})(StrategyTag || {});
|
|
254
|
+
var VaultType = /* @__PURE__ */ ((VaultType2) => {
|
|
255
|
+
VaultType2["LOOPING"] = "Looping";
|
|
256
|
+
VaultType2["META_VAULT"] = "Meta Vault";
|
|
257
|
+
VaultType2["DELTA_NEUTRAL"] = "Delta Neutral";
|
|
258
|
+
VaultType2["AUTOMATED_LP"] = "Automated LP";
|
|
259
|
+
VaultType2["TVA"] = "Troves Value Averaging";
|
|
260
|
+
return VaultType2;
|
|
261
|
+
})(VaultType || {});
|
|
262
|
+
var AuditStatus = /* @__PURE__ */ ((AuditStatus2) => {
|
|
263
|
+
AuditStatus2["AUDITED"] = "Audited";
|
|
264
|
+
AuditStatus2["NOT_AUDITED"] = "Not Audited";
|
|
265
|
+
return AuditStatus2;
|
|
266
|
+
})(AuditStatus || {});
|
|
267
|
+
var SourceCodeType = /* @__PURE__ */ ((SourceCodeType2) => {
|
|
268
|
+
SourceCodeType2["OPEN_SOURCE"] = "Open Source";
|
|
269
|
+
SourceCodeType2["CLOSED_SOURCE"] = "Closed Source";
|
|
270
|
+
return SourceCodeType2;
|
|
271
|
+
})(SourceCodeType || {});
|
|
272
|
+
var AccessControlType = /* @__PURE__ */ ((AccessControlType2) => {
|
|
273
|
+
AccessControlType2["MULTISIG_ACCOUNT"] = "Multisig Account";
|
|
274
|
+
AccessControlType2["STANDARD_ACCOUNT"] = "Standard Account";
|
|
275
|
+
AccessControlType2["ROLE_BASED_ACCESS"] = "Role Based Access";
|
|
276
|
+
return AccessControlType2;
|
|
277
|
+
})(AccessControlType || {});
|
|
278
|
+
var InstantWithdrawalVault = /* @__PURE__ */ ((InstantWithdrawalVault2) => {
|
|
279
|
+
InstantWithdrawalVault2["YES"] = "Yes";
|
|
280
|
+
InstantWithdrawalVault2["NO"] = "No";
|
|
281
|
+
return InstantWithdrawalVault2;
|
|
282
|
+
})(InstantWithdrawalVault || {});
|
|
283
|
+
var FlowChartColors = /* @__PURE__ */ ((FlowChartColors2) => {
|
|
284
|
+
FlowChartColors2["Green"] = "purple";
|
|
285
|
+
FlowChartColors2["Blue"] = "#35484f";
|
|
286
|
+
FlowChartColors2["Purple"] = "#6e53dc";
|
|
287
|
+
return FlowChartColors2;
|
|
288
|
+
})(FlowChartColors || {});
|
|
289
|
+
var StrategyLiveStatus = /* @__PURE__ */ ((StrategyLiveStatus2) => {
|
|
290
|
+
StrategyLiveStatus2["ACTIVE"] = "Active";
|
|
291
|
+
StrategyLiveStatus2["NEW"] = "New";
|
|
292
|
+
StrategyLiveStatus2["COMING_SOON"] = "Coming Soon";
|
|
293
|
+
StrategyLiveStatus2["DEPRECATED"] = "Deprecated";
|
|
294
|
+
StrategyLiveStatus2["RETIRED"] = "Retired";
|
|
295
|
+
StrategyLiveStatus2["HOT"] = "Hot & New \u{1F525}";
|
|
296
|
+
return StrategyLiveStatus2;
|
|
297
|
+
})(StrategyLiveStatus || {});
|
|
298
|
+
function getMainnetConfig(rpcUrl = "https://starknet-mainnet.public.blastapi.io", blockIdentifier = import_starknet.BlockTag.LATEST) {
|
|
299
|
+
return {
|
|
300
|
+
provider: new import_starknet.RpcProvider({
|
|
301
|
+
nodeUrl: rpcUrl,
|
|
302
|
+
blockIdentifier
|
|
303
|
+
// specVersion
|
|
304
|
+
}),
|
|
305
|
+
stage: "production",
|
|
306
|
+
network: "mainnet" /* mainnet */
|
|
307
|
+
};
|
|
308
|
+
}
|
|
309
|
+
var getStrategyTagDesciption = (tag) => {
|
|
310
|
+
switch (tag) {
|
|
311
|
+
case "Meta Vaults" /* META_VAULT */:
|
|
312
|
+
return "A meta vault is a vault that auto allocates funds to multiple vaults based on optimal yield opportunities";
|
|
313
|
+
case "Maxx" /* LEVERED */:
|
|
314
|
+
return "Looping vaults on Endur LSTs with leveraged borrowing of STRK or BTC to increase yield (2-4x higher yield than simply staking)";
|
|
315
|
+
case "Ekubo" /* AUTOMATED_LP */:
|
|
316
|
+
return "Automated LP vaults on Ekubo that rebalance position automatically, ensuring you earn fees efficiently";
|
|
317
|
+
case "BTC" /* BTC */:
|
|
318
|
+
return "BTC linked vaults";
|
|
319
|
+
}
|
|
320
|
+
};
|
|
321
|
+
var getAllStrategyTags = () => {
|
|
322
|
+
return Object.values(StrategyTag);
|
|
323
|
+
};
|
|
324
|
+
var getRiskExplaination = (riskType) => {
|
|
325
|
+
switch (riskType) {
|
|
326
|
+
case "Market Risk" /* MARKET_RISK */:
|
|
327
|
+
return "The risk of the market moving against the position.";
|
|
328
|
+
case "Impermanent Loss Risk" /* IMPERMANENT_LOSS */:
|
|
329
|
+
return "The temporary loss of value experienced by liquidity providers in AMMs when asset prices diverge compared to simply holding them.";
|
|
330
|
+
case "Liquidation Risk" /* LIQUIDATION_RISK */:
|
|
331
|
+
return "The risk of losing funds due to the position being liquidated.";
|
|
332
|
+
case "Low Liquidity Risk" /* LOW_LIQUIDITY_RISK */:
|
|
333
|
+
return "The risk of low liquidity in the pool, which can lead to high slippages or reduced in-abilities to quickly exit the position.";
|
|
334
|
+
case "Oracle Risk" /* ORACLE_RISK */:
|
|
335
|
+
return "The risk of the oracle being manipulated or incorrect.";
|
|
336
|
+
case "Smart Contract Risk" /* SMART_CONTRACT_RISK */:
|
|
337
|
+
return "The risk of the smart contract being vulnerable to attacks.";
|
|
338
|
+
case "Technical Risk" /* TECHNICAL_RISK */:
|
|
339
|
+
return "The risk of technical issues e.g. backend failure.";
|
|
340
|
+
case "Counterparty Risk" /* COUNTERPARTY_RISK */:
|
|
341
|
+
return "The risk of the counterparty defaulting e.g. bad debt on lending platforms.";
|
|
342
|
+
case "Depeg Risk" /* DEPEG_RISK */:
|
|
343
|
+
return "The risk of a token losing its peg to the underlying asset, leading to potential losses for holders.";
|
|
344
|
+
}
|
|
345
|
+
};
|
|
346
|
+
var getRiskColor = (risk) => {
|
|
347
|
+
const value = risk.value;
|
|
348
|
+
if (value <= 2) return "light_green_2";
|
|
349
|
+
if (value < 3) return "yellow";
|
|
350
|
+
return "red";
|
|
351
|
+
};
|
|
352
|
+
var getNoRiskTags = (risks) => {
|
|
353
|
+
const noRisks1 = risks.filter((risk) => risk.value === 0).map((risk) => risk.type);
|
|
354
|
+
const noRisks2 = Object.values(RiskType).filter(
|
|
355
|
+
(risk) => !risks.map((risk2) => risk2.type).includes(risk)
|
|
356
|
+
);
|
|
357
|
+
const mergedUnique = [.../* @__PURE__ */ new Set([...noRisks1, ...noRisks2])];
|
|
358
|
+
return mergedUnique;
|
|
359
|
+
};
|
|
360
|
+
function highlightTextWithLinks(put, highlights) {
|
|
361
|
+
const escapeRegExp = (text) => text.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");
|
|
362
|
+
const pattern = new RegExp(
|
|
363
|
+
`(${highlights.map((m) => escapeRegExp(m.highlight)).join("|")})`,
|
|
364
|
+
"gi"
|
|
365
|
+
);
|
|
366
|
+
const parts = put.split(pattern);
|
|
367
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: parts.map((part, i) => {
|
|
368
|
+
const match = highlights.find((m) => m.highlight.toLowerCase() === part.toLowerCase());
|
|
369
|
+
return match ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", { href: match.link, target: "_blank", style: { color: "white", background: "rgba(255, 255, 255, 0.04)" }, children: part }, i) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: part }, i);
|
|
370
|
+
}) });
|
|
371
|
+
}
|
|
372
|
+
var VesuProtocol = {
|
|
373
|
+
name: "Vesu",
|
|
374
|
+
logo: "https://static-assets-8zct.onrender.com/integrations/vesu/logo.png"
|
|
375
|
+
};
|
|
376
|
+
var EndurProtocol = {
|
|
377
|
+
name: "Endur",
|
|
378
|
+
logo: "http://endur.fi/logo.png"
|
|
379
|
+
};
|
|
380
|
+
var ExtendedProtocol = {
|
|
381
|
+
name: "Extended",
|
|
382
|
+
logo: "https://static-assets-8zct.onrender.com/integrations/extended/extended.svg"
|
|
383
|
+
};
|
|
384
|
+
var Protocols = {
|
|
385
|
+
VESU: VesuProtocol,
|
|
386
|
+
ENDUR: EndurProtocol,
|
|
387
|
+
EXTENDED: ExtendedProtocol
|
|
388
|
+
};
|
|
389
|
+
var UnwrapLabsCurator = {
|
|
390
|
+
name: "Unwrap Labs",
|
|
391
|
+
logo: "https://assets.troves.fi/integrations/unwraplabs/white.png"
|
|
392
|
+
};
|
|
393
|
+
|
|
394
|
+
// src/interfaces/initializable.ts
|
|
395
|
+
var Initializable = class {
|
|
396
|
+
constructor() {
|
|
397
|
+
this.initialized = false;
|
|
398
|
+
}
|
|
399
|
+
async waitForInitilisation() {
|
|
400
|
+
return new Promise((resolve, reject) => {
|
|
401
|
+
const interval = setInterval(() => {
|
|
402
|
+
if (this.initialized) {
|
|
403
|
+
console.log("Initialised");
|
|
404
|
+
clearInterval(interval);
|
|
405
|
+
resolve();
|
|
406
|
+
}
|
|
407
|
+
}, 1e3);
|
|
408
|
+
});
|
|
409
|
+
}
|
|
410
|
+
};
|
|
411
|
+
|
|
148
412
|
// src/dataTypes/bignumber.node.ts
|
|
149
413
|
var import_util = __toESM(require("util"));
|
|
150
414
|
|
|
151
415
|
// src/dataTypes/_bignumber.ts
|
|
152
416
|
var import_bignumber = __toESM(require("bignumber.js"));
|
|
153
|
-
var
|
|
417
|
+
var import_starknet2 = require("starknet");
|
|
154
418
|
var _Web3Number = class extends import_bignumber.default {
|
|
155
419
|
constructor(value, decimals) {
|
|
156
420
|
super(value);
|
|
@@ -226,21 +490,21 @@ var _Web3Number = class extends import_bignumber.default {
|
|
|
226
490
|
};
|
|
227
491
|
}
|
|
228
492
|
toUint256() {
|
|
229
|
-
return
|
|
493
|
+
return import_starknet2.uint256.bnToUint256(this.toWei());
|
|
230
494
|
}
|
|
231
495
|
};
|
|
232
496
|
import_bignumber.default.config({ DECIMAL_PLACES: 18, ROUNDING_MODE: import_bignumber.default.ROUND_DOWN });
|
|
233
497
|
_Web3Number.config({ DECIMAL_PLACES: 18, ROUNDING_MODE: import_bignumber.default.ROUND_DOWN });
|
|
234
498
|
|
|
235
499
|
// src/dataTypes/bignumber.node.ts
|
|
236
|
-
var
|
|
500
|
+
var import_starknet3 = require("starknet");
|
|
237
501
|
var Web3Number = class _Web3Number2 extends _Web3Number {
|
|
238
502
|
static fromWei(weiNumber, decimals) {
|
|
239
503
|
const bn = new _Web3Number2(weiNumber, decimals).dividedBy(10 ** decimals);
|
|
240
504
|
return new _Web3Number2(bn.toString(), decimals);
|
|
241
505
|
}
|
|
242
506
|
static fromUint256(uint256Value) {
|
|
243
|
-
return this.fromWei(
|
|
507
|
+
return this.fromWei(import_starknet3.uint256.uint256ToBN(uint256Value).toString(), 18);
|
|
244
508
|
}
|
|
245
509
|
[import_util.default.inspect.custom](depth, opts) {
|
|
246
510
|
return this.toString();
|
|
@@ -254,7 +518,7 @@ var Web3Number = class _Web3Number2 extends _Web3Number {
|
|
|
254
518
|
};
|
|
255
519
|
|
|
256
520
|
// src/dataTypes/address.ts
|
|
257
|
-
var
|
|
521
|
+
var import_starknet4 = require("starknet");
|
|
258
522
|
var ContractAddr = class _ContractAddr {
|
|
259
523
|
constructor(address) {
|
|
260
524
|
this.address = _ContractAddr.standardise(address);
|
|
@@ -273,7 +537,7 @@ var ContractAddr = class _ContractAddr {
|
|
|
273
537
|
if (!address) {
|
|
274
538
|
_a = "0";
|
|
275
539
|
}
|
|
276
|
-
const a =
|
|
540
|
+
const a = import_starknet4.num.getHexString(import_starknet4.num.getDecimalString(_a.toString()));
|
|
277
541
|
return a;
|
|
278
542
|
}
|
|
279
543
|
static eqString(a, b) {
|
|
@@ -283,7 +547,7 @@ var ContractAddr = class _ContractAddr {
|
|
|
283
547
|
return this.address;
|
|
284
548
|
}
|
|
285
549
|
toBigInt() {
|
|
286
|
-
return
|
|
550
|
+
return import_starknet4.num.toBigInt(this.address);
|
|
287
551
|
}
|
|
288
552
|
};
|
|
289
553
|
|
|
@@ -407,47 +671,6 @@ var MyNumber = class _MyNumber {
|
|
|
407
671
|
}
|
|
408
672
|
};
|
|
409
673
|
|
|
410
|
-
// src/utils/logger.node.ts
|
|
411
|
-
var import_winston = __toESM(require("winston"));
|
|
412
|
-
var colors = {
|
|
413
|
-
error: "red",
|
|
414
|
-
warn: "yellow",
|
|
415
|
-
info: "blue",
|
|
416
|
-
verbose: "white",
|
|
417
|
-
debug: "white"
|
|
418
|
-
};
|
|
419
|
-
import_winston.default.addColors(colors);
|
|
420
|
-
var logLevel = (process.env.LOG_LEVEL || process.env.SDK_LOG_LEVEL || "debug").toLowerCase();
|
|
421
|
-
var logger = import_winston.default.createLogger({
|
|
422
|
-
level: logLevel,
|
|
423
|
-
// Set the minimum logging level from environment variable
|
|
424
|
-
format: import_winston.format.combine(
|
|
425
|
-
import_winston.format.colorize({ all: true }),
|
|
426
|
-
// Apply custom colors
|
|
427
|
-
import_winston.format.timestamp({ format: "YYYY-MM-DD HH:mm:ss" }),
|
|
428
|
-
// Add timestamp to log messages
|
|
429
|
-
import_winston.format.printf(({ timestamp, level, message, ...meta }) => {
|
|
430
|
-
let msg = `${timestamp} ${level}: ${message}`;
|
|
431
|
-
if (meta && meta[/* @__PURE__ */ Symbol.for("splat")]) {
|
|
432
|
-
const splat = meta[/* @__PURE__ */ Symbol.for("splat")];
|
|
433
|
-
if (Array.isArray(splat)) {
|
|
434
|
-
for (const arg of splat) {
|
|
435
|
-
if (arg instanceof Error) {
|
|
436
|
-
msg += `
|
|
437
|
-
${arg.stack}`;
|
|
438
|
-
}
|
|
439
|
-
}
|
|
440
|
-
}
|
|
441
|
-
}
|
|
442
|
-
return msg;
|
|
443
|
-
})
|
|
444
|
-
),
|
|
445
|
-
transports: [
|
|
446
|
-
new import_winston.default.transports.Console()
|
|
447
|
-
// Output logs to the console
|
|
448
|
-
]
|
|
449
|
-
});
|
|
450
|
-
|
|
451
674
|
// src/global.ts
|
|
452
675
|
var FatalError = class extends Error {
|
|
453
676
|
constructor(message, err) {
|
|
@@ -466,7 +689,9 @@ var defaultTokens = [{
|
|
|
466
689
|
decimals: 18,
|
|
467
690
|
coingeckId: "starknet",
|
|
468
691
|
displayDecimals: 2,
|
|
469
|
-
priceCheckAmount:
|
|
692
|
+
priceCheckAmount: 5e3,
|
|
693
|
+
priceMethod: "Avnu",
|
|
694
|
+
indexingType: "indexer" /* INDEXER */
|
|
470
695
|
}, {
|
|
471
696
|
name: "xSTRK",
|
|
472
697
|
symbol: "xSTRK",
|
|
@@ -474,8 +699,10 @@ var defaultTokens = [{
|
|
|
474
699
|
address: ContractAddr.from("0x028d709c875c0ceac3dce7065bec5328186dc89fe254527084d1689910954b0a"),
|
|
475
700
|
decimals: 18,
|
|
476
701
|
coingeckId: void 0,
|
|
477
|
-
priceCheckAmount:
|
|
478
|
-
displayDecimals: 2
|
|
702
|
+
priceCheckAmount: 5e3,
|
|
703
|
+
displayDecimals: 2,
|
|
704
|
+
priceMethod: "Avnu",
|
|
705
|
+
indexingType: "lstScript" /* LST_SCRIPT */
|
|
479
706
|
}, {
|
|
480
707
|
name: "ETH",
|
|
481
708
|
symbol: "ETH",
|
|
@@ -484,7 +711,8 @@ var defaultTokens = [{
|
|
|
484
711
|
decimals: 18,
|
|
485
712
|
coingeckId: void 0,
|
|
486
713
|
priceCheckAmount: 0.1,
|
|
487
|
-
displayDecimals: 6
|
|
714
|
+
displayDecimals: 6,
|
|
715
|
+
indexingType: "indexer" /* INDEXER */
|
|
488
716
|
}, {
|
|
489
717
|
name: "USDC.e",
|
|
490
718
|
symbol: "USDC.e",
|
|
@@ -493,7 +721,9 @@ var defaultTokens = [{
|
|
|
493
721
|
decimals: 6,
|
|
494
722
|
coingeckId: void 0,
|
|
495
723
|
displayDecimals: 2,
|
|
496
|
-
priceCheckAmount: 1e3
|
|
724
|
+
priceCheckAmount: 1e3,
|
|
725
|
+
priceProxySymbol: "USDC",
|
|
726
|
+
indexingType: "pegged" /* PEGGED */
|
|
497
727
|
}, {
|
|
498
728
|
name: "USDC",
|
|
499
729
|
symbol: "USDC",
|
|
@@ -502,7 +732,8 @@ var defaultTokens = [{
|
|
|
502
732
|
decimals: 6,
|
|
503
733
|
coingeckId: void 0,
|
|
504
734
|
displayDecimals: 2,
|
|
505
|
-
priceCheckAmount: 1e3
|
|
735
|
+
priceCheckAmount: 1e3,
|
|
736
|
+
indexingType: "indexer" /* INDEXER */
|
|
506
737
|
}, {
|
|
507
738
|
name: "USDT",
|
|
508
739
|
symbol: "USDT",
|
|
@@ -511,7 +742,8 @@ var defaultTokens = [{
|
|
|
511
742
|
decimals: 6,
|
|
512
743
|
coingeckId: void 0,
|
|
513
744
|
priceCheckAmount: 1e3,
|
|
514
|
-
displayDecimals: 2
|
|
745
|
+
displayDecimals: 2,
|
|
746
|
+
indexingType: "indexer" /* INDEXER */
|
|
515
747
|
}, {
|
|
516
748
|
name: "WBTC",
|
|
517
749
|
symbol: "WBTC",
|
|
@@ -520,8 +752,9 @@ var defaultTokens = [{
|
|
|
520
752
|
decimals: 8,
|
|
521
753
|
coingeckId: void 0,
|
|
522
754
|
displayDecimals: 6,
|
|
523
|
-
priceCheckAmount: 1e-3
|
|
755
|
+
priceCheckAmount: 1e-3,
|
|
524
756
|
// 112000 * 0.0001 = $110.2
|
|
757
|
+
indexingType: "indexer" /* INDEXER */
|
|
525
758
|
}, {
|
|
526
759
|
name: "tBTC",
|
|
527
760
|
symbol: "tBTC",
|
|
@@ -530,8 +763,10 @@ var defaultTokens = [{
|
|
|
530
763
|
decimals: 18,
|
|
531
764
|
coingeckId: void 0,
|
|
532
765
|
displayDecimals: 6,
|
|
533
|
-
priceCheckAmount: 1e-3
|
|
766
|
+
priceCheckAmount: 1e-3,
|
|
534
767
|
// 112000 * 0.0001 = $110.2
|
|
768
|
+
priceProxySymbol: "WBTC",
|
|
769
|
+
indexingType: "pegged" /* PEGGED */
|
|
535
770
|
}, {
|
|
536
771
|
name: "solvBTC",
|
|
537
772
|
symbol: "solvBTC",
|
|
@@ -541,8 +776,9 @@ var defaultTokens = [{
|
|
|
541
776
|
coingeckId: void 0,
|
|
542
777
|
priceProxySymbol: "WBTC",
|
|
543
778
|
displayDecimals: 6,
|
|
544
|
-
priceCheckAmount: 1e-4
|
|
779
|
+
priceCheckAmount: 1e-4,
|
|
545
780
|
// 112000 * 0.0001 = $11.2
|
|
781
|
+
indexingType: "pegged" /* PEGGED */
|
|
546
782
|
}, {
|
|
547
783
|
name: "LBTC",
|
|
548
784
|
symbol: "LBTC",
|
|
@@ -552,8 +788,9 @@ var defaultTokens = [{
|
|
|
552
788
|
coingeckId: void 0,
|
|
553
789
|
displayDecimals: 6,
|
|
554
790
|
priceProxySymbol: "WBTC",
|
|
555
|
-
priceCheckAmount: 1e-4
|
|
791
|
+
priceCheckAmount: 1e-4,
|
|
556
792
|
// 112000 * 0.0001 = $11.2
|
|
793
|
+
indexingType: "pegged" /* PEGGED */
|
|
557
794
|
}, {
|
|
558
795
|
name: "xWBTC",
|
|
559
796
|
symbol: "xWBTC",
|
|
@@ -562,9 +799,10 @@ var defaultTokens = [{
|
|
|
562
799
|
decimals: 8,
|
|
563
800
|
coingeckId: void 0,
|
|
564
801
|
displayDecimals: 6,
|
|
565
|
-
|
|
566
|
-
priceCheckAmount: 1e-3
|
|
802
|
+
priceCheckAmount: 1e-3,
|
|
567
803
|
// 112000 * 0.0001 = $110.2
|
|
804
|
+
priceMethod: "Avnu",
|
|
805
|
+
indexingType: "lstScript" /* LST_SCRIPT */
|
|
568
806
|
}, {
|
|
569
807
|
name: "xsBTC",
|
|
570
808
|
symbol: "xsBTC",
|
|
@@ -573,11 +811,11 @@ var defaultTokens = [{
|
|
|
573
811
|
decimals: 18,
|
|
574
812
|
coingeckId: void 0,
|
|
575
813
|
displayDecimals: 6,
|
|
576
|
-
|
|
577
|
-
priceCheckAmount: 1e-4
|
|
814
|
+
priceCheckAmount: 1e-4,
|
|
578
815
|
// 112000 * 0.0001 = $11.2
|
|
816
|
+
priceMethod: "Avnu",
|
|
817
|
+
indexingType: "lstScript" /* LST_SCRIPT */
|
|
579
818
|
}, {
|
|
580
|
-
// todo upgrade proxy tokens once feeds are available
|
|
581
819
|
name: "xtBTC",
|
|
582
820
|
symbol: "xtBTC",
|
|
583
821
|
logo: "https://assets.strkfarm.com/integrations/tokens/xtbtc.svg",
|
|
@@ -587,7 +825,8 @@ var defaultTokens = [{
|
|
|
587
825
|
displayDecimals: 6,
|
|
588
826
|
priceCheckAmount: 1e-3,
|
|
589
827
|
// 112000 * 0.0001 = $110.2
|
|
590
|
-
|
|
828
|
+
priceMethod: "Avnu",
|
|
829
|
+
indexingType: "lstScript" /* LST_SCRIPT */
|
|
591
830
|
}, {
|
|
592
831
|
name: "xLBTC",
|
|
593
832
|
symbol: "xLBTC",
|
|
@@ -596,9 +835,10 @@ var defaultTokens = [{
|
|
|
596
835
|
decimals: 8,
|
|
597
836
|
coingeckId: void 0,
|
|
598
837
|
displayDecimals: 6,
|
|
599
|
-
|
|
600
|
-
priceCheckAmount: 1e-4
|
|
838
|
+
priceCheckAmount: 1e-4,
|
|
601
839
|
// 112000 * 0.0001 = $11.2
|
|
840
|
+
priceMethod: "Avnu",
|
|
841
|
+
indexingType: "lstScript" /* LST_SCRIPT */
|
|
602
842
|
}, {
|
|
603
843
|
name: "mRe7BTC",
|
|
604
844
|
symbol: "mRe7BTC",
|
|
@@ -609,7 +849,8 @@ var defaultTokens = [{
|
|
|
609
849
|
displayDecimals: 6,
|
|
610
850
|
priceCheckAmount: 1e-4,
|
|
611
851
|
// 112000 * 0.0001 = $11.2
|
|
612
|
-
dontPrice: true
|
|
852
|
+
dontPrice: true,
|
|
853
|
+
indexingType: "ignore" /* IGNORE */
|
|
613
854
|
}, {
|
|
614
855
|
name: "mRe7YIELD",
|
|
615
856
|
symbol: "mRe7YIELD",
|
|
@@ -619,7 +860,8 @@ var defaultTokens = [{
|
|
|
619
860
|
coingeckId: void 0,
|
|
620
861
|
displayDecimals: 2,
|
|
621
862
|
priceCheckAmount: 100,
|
|
622
|
-
dontPrice: true
|
|
863
|
+
dontPrice: true,
|
|
864
|
+
indexingType: "ignore" /* IGNORE */
|
|
623
865
|
}, {
|
|
624
866
|
name: "fyeWBTC",
|
|
625
867
|
symbol: "fyeWBTC",
|
|
@@ -630,7 +872,8 @@ var defaultTokens = [{
|
|
|
630
872
|
displayDecimals: 6,
|
|
631
873
|
priceCheckAmount: 1e-3,
|
|
632
874
|
// 112000 * 0.0001 = $110.2
|
|
633
|
-
dontPrice: true
|
|
875
|
+
dontPrice: true,
|
|
876
|
+
indexingType: "ignore" /* IGNORE */
|
|
634
877
|
}, {
|
|
635
878
|
name: "fyETH",
|
|
636
879
|
symbol: "fyETH",
|
|
@@ -640,7 +883,8 @@ var defaultTokens = [{
|
|
|
640
883
|
coingeckId: void 0,
|
|
641
884
|
displayDecimals: 4,
|
|
642
885
|
priceCheckAmount: 0.1,
|
|
643
|
-
dontPrice: true
|
|
886
|
+
dontPrice: true,
|
|
887
|
+
indexingType: "ignore" /* IGNORE */
|
|
644
888
|
}, {
|
|
645
889
|
name: "fyeUSDC",
|
|
646
890
|
symbol: "fyeUSDC",
|
|
@@ -650,7 +894,8 @@ var defaultTokens = [{
|
|
|
650
894
|
coingeckId: void 0,
|
|
651
895
|
displayDecimals: 2,
|
|
652
896
|
priceCheckAmount: 100,
|
|
653
|
-
dontPrice: true
|
|
897
|
+
dontPrice: true,
|
|
898
|
+
indexingType: "ignore" /* IGNORE */
|
|
654
899
|
}, {
|
|
655
900
|
name: "strkBTC",
|
|
656
901
|
symbol: "strkBTC",
|
|
@@ -661,7 +906,9 @@ var defaultTokens = [{
|
|
|
661
906
|
displayDecimals: 6,
|
|
662
907
|
priceCheckAmount: 1e-3,
|
|
663
908
|
// 112000 * 0.0001 = $110.2
|
|
664
|
-
|
|
909
|
+
priceMethod: "Avnu",
|
|
910
|
+
priceProxySymbol: "WBTC",
|
|
911
|
+
indexingType: "pegged" /* PEGGED */
|
|
665
912
|
}, {
|
|
666
913
|
name: "xstrkBTC",
|
|
667
914
|
symbol: "xstrkBTC",
|
|
@@ -671,7 +918,8 @@ var defaultTokens = [{
|
|
|
671
918
|
coingeckId: void 0,
|
|
672
919
|
displayDecimals: 6,
|
|
673
920
|
priceCheckAmount: 1e-3,
|
|
674
|
-
|
|
921
|
+
priceMethod: "Avnu",
|
|
922
|
+
indexingType: "lstScript" /* LST_SCRIPT */
|
|
675
923
|
}];
|
|
676
924
|
var tokens = defaultTokens;
|
|
677
925
|
var _Global = class _Global {
|
|
@@ -704,7 +952,8 @@ var _Global = class _Global {
|
|
|
704
952
|
decimals: token.decimals,
|
|
705
953
|
logo: token.logoUri,
|
|
706
954
|
coingeckId: token.extensions.coingeckoId,
|
|
707
|
-
displayDecimals: 2
|
|
955
|
+
displayDecimals: 2,
|
|
956
|
+
indexingType: "ignore" /* IGNORE */
|
|
708
957
|
});
|
|
709
958
|
});
|
|
710
959
|
console.log(tokens);
|
|
@@ -769,7 +1018,7 @@ var PricerBase = class {
|
|
|
769
1018
|
};
|
|
770
1019
|
|
|
771
1020
|
// src/modules/avnu.ts
|
|
772
|
-
var
|
|
1021
|
+
var import_starknet7 = require("starknet");
|
|
773
1022
|
var import_avnu_sdk = require("@avnu/avnu-sdk");
|
|
774
1023
|
|
|
775
1024
|
// src/utils/oz-merkle.ts
|
|
@@ -777,8 +1026,8 @@ var import_bytes = require("@ericnordelo/strk-merkle-tree/dist/bytes");
|
|
|
777
1026
|
var import_core = require("@ericnordelo/strk-merkle-tree/dist/core");
|
|
778
1027
|
var import_hashes = require("@ericnordelo/strk-merkle-tree/dist/hashes");
|
|
779
1028
|
var import_merkletree = require("@ericnordelo/strk-merkle-tree/dist/merkletree");
|
|
780
|
-
var
|
|
781
|
-
var
|
|
1029
|
+
var import_starknet5 = require("starknet");
|
|
1030
|
+
var import_starknet6 = require("@scure/starknet");
|
|
782
1031
|
function hash_leaf(leaf) {
|
|
783
1032
|
if (leaf.data.length < 1) {
|
|
784
1033
|
throw new Error("Invalid leaf data");
|
|
@@ -788,10 +1037,10 @@ function hash_leaf(leaf) {
|
|
|
788
1037
|
for (let i = 1; i < leaf.data.length; i++) {
|
|
789
1038
|
value = pedersen_hash(value, leaf.data[i]);
|
|
790
1039
|
}
|
|
791
|
-
return `0x${
|
|
1040
|
+
return `0x${import_starknet5.num.toHexString(value).replace(/^0x/, "").padStart(64, "0")}`;
|
|
792
1041
|
}
|
|
793
1042
|
function pedersen_hash(a, b) {
|
|
794
|
-
return BigInt((0,
|
|
1043
|
+
return BigInt((0, import_starknet6.pedersen)(a, b).toString());
|
|
795
1044
|
}
|
|
796
1045
|
var StandardMerkleTree = class _StandardMerkleTree extends import_merkletree.MerkleTreeImpl {
|
|
797
1046
|
constructor(tree, values, leafEncoding) {
|
|
@@ -915,10 +1164,10 @@ var AvnuWrapper = class _AvnuWrapper {
|
|
|
915
1164
|
const _minAmount = minAmount || (quote.buyAmount * 95n / 100n).toString();
|
|
916
1165
|
const swapInfo = {
|
|
917
1166
|
token_from_address: quote.sellTokenAddress,
|
|
918
|
-
token_from_amount:
|
|
1167
|
+
token_from_amount: import_starknet7.uint256.bnToUint256(quote.sellAmount),
|
|
919
1168
|
token_to_address: quote.buyTokenAddress,
|
|
920
|
-
token_to_amount:
|
|
921
|
-
token_to_min_amount:
|
|
1169
|
+
token_to_amount: import_starknet7.uint256.bnToUint256(_minAmount),
|
|
1170
|
+
token_to_min_amount: import_starknet7.uint256.bnToUint256(_minAmount),
|
|
922
1171
|
beneficiary: taker,
|
|
923
1172
|
integrator_fee_amount_bps: integratorFeeBps,
|
|
924
1173
|
integrator_fee_recipient: integratorFeeRecipient,
|
|
@@ -929,10 +1178,10 @@ var AvnuWrapper = class _AvnuWrapper {
|
|
|
929
1178
|
static buildZeroSwap(tokenToSell, beneficiary, tokenToBuy = tokenToSell) {
|
|
930
1179
|
return {
|
|
931
1180
|
token_from_address: tokenToSell.address,
|
|
932
|
-
token_from_amount:
|
|
1181
|
+
token_from_amount: import_starknet7.uint256.bnToUint256(0),
|
|
933
1182
|
token_to_address: tokenToBuy.address,
|
|
934
|
-
token_to_amount:
|
|
935
|
-
token_to_min_amount:
|
|
1183
|
+
token_to_amount: import_starknet7.uint256.bnToUint256(0),
|
|
1184
|
+
token_to_min_amount: import_starknet7.uint256.bnToUint256(0),
|
|
936
1185
|
beneficiary,
|
|
937
1186
|
integrator_fee_amount_bps: 0,
|
|
938
1187
|
integrator_fee_recipient: beneficiary,
|
|
@@ -1155,21 +1404,14 @@ var Pricer = class extends PricerBase {
|
|
|
1155
1404
|
}
|
|
1156
1405
|
}
|
|
1157
1406
|
async _getPrice(token) {
|
|
1158
|
-
const
|
|
1159
|
-
|
|
1160
|
-
logger.verbose(`Fetching price of ${token.symbol} using pinned ${pinned}`);
|
|
1161
|
-
try {
|
|
1162
|
-
return await this._tryPriceMethod(token, pinned);
|
|
1163
|
-
} catch (error) {
|
|
1164
|
-
console.warn(`${pinned}: pinned price failed [${token.symbol}]: `, error.message);
|
|
1165
|
-
delete this.methodToUse[token.symbol];
|
|
1166
|
-
}
|
|
1167
|
-
}
|
|
1168
|
-
for (const method of PRICE_METHOD_PRIORITY) {
|
|
1407
|
+
const methodsToTry = this._getMethodsToTry(token);
|
|
1408
|
+
for (const method of methodsToTry) {
|
|
1169
1409
|
logger.verbose(`Fetching price of ${token.symbol} using ${method}`);
|
|
1170
1410
|
try {
|
|
1171
1411
|
const result = await this._tryPriceMethod(token, method);
|
|
1172
|
-
|
|
1412
|
+
if (!token.priceMethod) {
|
|
1413
|
+
this.methodToUse[token.symbol] = method;
|
|
1414
|
+
}
|
|
1173
1415
|
return result;
|
|
1174
1416
|
} catch (error) {
|
|
1175
1417
|
console.warn(`${method}: price err [${token.symbol}]: `, error.message);
|
|
@@ -1177,6 +1419,22 @@ var Pricer = class extends PricerBase {
|
|
|
1177
1419
|
}
|
|
1178
1420
|
throw new FatalError(`Price not found for ${token.symbol}`);
|
|
1179
1421
|
}
|
|
1422
|
+
_getMethodsToTry(token) {
|
|
1423
|
+
const methods = [];
|
|
1424
|
+
if (token.priceMethod) {
|
|
1425
|
+
methods.push(token.priceMethod);
|
|
1426
|
+
}
|
|
1427
|
+
const pinned = this.methodToUse[token.symbol];
|
|
1428
|
+
if (pinned && pinned !== token.priceMethod) {
|
|
1429
|
+
methods.push(pinned);
|
|
1430
|
+
}
|
|
1431
|
+
for (const method of PRICE_METHOD_PRIORITY) {
|
|
1432
|
+
if (!methods.includes(method)) {
|
|
1433
|
+
methods.push(method);
|
|
1434
|
+
}
|
|
1435
|
+
}
|
|
1436
|
+
return methods;
|
|
1437
|
+
}
|
|
1180
1438
|
async _tryPriceMethod(token, method) {
|
|
1181
1439
|
switch (method) {
|
|
1182
1440
|
case "AvnuApi":
|
|
@@ -1245,7 +1503,7 @@ var Pricer = class extends PricerBase {
|
|
|
1245
1503
|
};
|
|
1246
1504
|
|
|
1247
1505
|
// src/modules/pragma.ts
|
|
1248
|
-
var
|
|
1506
|
+
var import_starknet8 = require("starknet");
|
|
1249
1507
|
|
|
1250
1508
|
// src/data/pragma.abi.json
|
|
1251
1509
|
var pragma_abi_default = [
|
|
@@ -1350,7 +1608,7 @@ var Pragma = class extends PricerBase {
|
|
|
1350
1608
|
constructor(config, tokens2) {
|
|
1351
1609
|
super(config, tokens2);
|
|
1352
1610
|
this.contractAddr = "0x023fb3afbff2c0e3399f896dcf7400acf1a161941cfb386e34a123f228c62832";
|
|
1353
|
-
this.contract = new
|
|
1611
|
+
this.contract = new import_starknet8.Contract({
|
|
1354
1612
|
abi: pragma_abi_default,
|
|
1355
1613
|
address: this.contractAddr,
|
|
1356
1614
|
providerOrAccount: config.provider
|
|
@@ -1378,43 +1636,14 @@ var Pragma = class extends PricerBase {
|
|
|
1378
1636
|
var import_axios4 = __toESM(require("axios"));
|
|
1379
1637
|
|
|
1380
1638
|
// src/dataTypes/bignumber.browser.ts
|
|
1381
|
-
var
|
|
1639
|
+
var import_starknet9 = require("starknet");
|
|
1382
1640
|
var Web3Number2 = class _Web3Number2 extends _Web3Number {
|
|
1383
1641
|
static fromWei(weiNumber, decimals) {
|
|
1384
1642
|
const bn = new _Web3Number2(weiNumber, decimals).dividedBy(10 ** decimals);
|
|
1385
1643
|
return new _Web3Number2(bn.toString(), decimals);
|
|
1386
1644
|
}
|
|
1387
1645
|
static fromUint256(uint256Value) {
|
|
1388
|
-
return this.fromWei(
|
|
1389
|
-
}
|
|
1390
|
-
};
|
|
1391
|
-
|
|
1392
|
-
// src/interfaces/lending.ts
|
|
1393
|
-
var MarginType = /* @__PURE__ */ ((MarginType2) => {
|
|
1394
|
-
MarginType2["SHARED"] = "shared";
|
|
1395
|
-
MarginType2["NONE"] = "none";
|
|
1396
|
-
return MarginType2;
|
|
1397
|
-
})(MarginType || {});
|
|
1398
|
-
var ILending = class {
|
|
1399
|
-
constructor(config, metadata) {
|
|
1400
|
-
this.tokens = [];
|
|
1401
|
-
this.initialised = false;
|
|
1402
|
-
this.metadata = metadata;
|
|
1403
|
-
this.config = config;
|
|
1404
|
-
this.init();
|
|
1405
|
-
}
|
|
1406
|
-
/** Wait for initialisation */
|
|
1407
|
-
waitForInitilisation() {
|
|
1408
|
-
return new Promise((resolve, reject) => {
|
|
1409
|
-
const interval = setInterval(() => {
|
|
1410
|
-
logger.verbose(`Waiting for ${this.metadata.name} to initialise`);
|
|
1411
|
-
if (this.initialised) {
|
|
1412
|
-
logger.verbose(`${this.metadata.name} initialised`);
|
|
1413
|
-
clearInterval(interval);
|
|
1414
|
-
resolve();
|
|
1415
|
-
}
|
|
1416
|
-
}, 1e3);
|
|
1417
|
-
});
|
|
1646
|
+
return this.fromWei(import_starknet9.uint256.uint256ToBN(uint256Value).toString(), 18);
|
|
1418
1647
|
}
|
|
1419
1648
|
};
|
|
1420
1649
|
|
|
@@ -1448,7 +1677,8 @@ var _ZkLend = class _ZkLend extends ILending {
|
|
|
1448
1677
|
decimals: pool.token.decimals,
|
|
1449
1678
|
borrowFactor: Web3Number2.fromWei(pool.borrow_factor.value, pool.borrow_factor.decimals),
|
|
1450
1679
|
collareralFactor,
|
|
1451
|
-
displayDecimals: 2
|
|
1680
|
+
displayDecimals: 2,
|
|
1681
|
+
indexingType: "ignore" /* IGNORE */
|
|
1452
1682
|
};
|
|
1453
1683
|
this.tokens.push(token);
|
|
1454
1684
|
});
|
|
@@ -1576,7 +1806,7 @@ var apolloClient = new import_client.ApolloClient({
|
|
|
1576
1806
|
var import_client2 = require("@apollo/client");
|
|
1577
1807
|
|
|
1578
1808
|
// src/modules/ekubo-pricer.ts
|
|
1579
|
-
var
|
|
1809
|
+
var import_starknet10 = require("starknet");
|
|
1580
1810
|
|
|
1581
1811
|
// src/data/ekubo-price-fethcer.abi.json
|
|
1582
1812
|
var ekubo_price_fethcer_abi_default = [
|
|
@@ -1850,9 +2080,10 @@ var EkuboPricer = class extends PricerBase {
|
|
|
1850
2080
|
constructor(config, tokens2) {
|
|
1851
2081
|
super(config, tokens2);
|
|
1852
2082
|
this.EKUBO_PRICE_FETCHER_ADDRESS = "0x04946fb4ad5237d97bbb1256eba2080c4fe1de156da6a7f83e3b4823bb6d7da1";
|
|
1853
|
-
|
|
2083
|
+
// Updating to new USDC_ADDRESS
|
|
2084
|
+
this.USDC_ADDRESS = "0x033068F6539f8e6e6b131e6B2B814e6c34A5224bC66947c47DaB9dFeE93b35fb";
|
|
1854
2085
|
this.USDC_DECIMALS = 6;
|
|
1855
|
-
this.contract = new
|
|
2086
|
+
this.contract = new import_starknet10.Contract({
|
|
1856
2087
|
abi: ekubo_price_fethcer_abi_default,
|
|
1857
2088
|
address: this.EKUBO_PRICE_FETCHER_ADDRESS,
|
|
1858
2089
|
providerOrAccount: config.provider
|
|
@@ -2063,7 +2294,7 @@ var PricerFromApi = class extends PricerBase {
|
|
|
2063
2294
|
};
|
|
2064
2295
|
|
|
2065
2296
|
// src/modules/erc20.ts
|
|
2066
|
-
var
|
|
2297
|
+
var import_starknet11 = require("starknet");
|
|
2067
2298
|
|
|
2068
2299
|
// src/data/erc20.abi.json
|
|
2069
2300
|
var erc20_abi_default = [
|
|
@@ -3190,14 +3421,14 @@ var erc20_abi_default = [
|
|
|
3190
3421
|
];
|
|
3191
3422
|
|
|
3192
3423
|
// src/modules/erc20.ts
|
|
3193
|
-
var
|
|
3424
|
+
var import_starknet12 = require("starknet");
|
|
3194
3425
|
var ERC20 = class {
|
|
3195
3426
|
constructor(config) {
|
|
3196
3427
|
this.config = config;
|
|
3197
3428
|
}
|
|
3198
3429
|
contract(addr) {
|
|
3199
3430
|
const _addr = typeof addr === "string" ? addr : addr.address;
|
|
3200
|
-
return new
|
|
3431
|
+
return new import_starknet11.Contract({ abi: erc20_abi_default, address: _addr, providerOrAccount: this.config.provider });
|
|
3201
3432
|
}
|
|
3202
3433
|
async balanceOf(token, address, tokenDecimals) {
|
|
3203
3434
|
const contract = this.contract(token);
|
|
@@ -3211,7 +3442,7 @@ var ERC20 = class {
|
|
|
3211
3442
|
}
|
|
3212
3443
|
approve(token, spender, amount) {
|
|
3213
3444
|
const contract = this.contract(token);
|
|
3214
|
-
const amountUint256 =
|
|
3445
|
+
const amountUint256 = import_starknet12.uint256.bnToUint256(amount.toWei());
|
|
3215
3446
|
const approveCall = contract.populate("approve", [
|
|
3216
3447
|
spender.toString(),
|
|
3217
3448
|
amountUint256.low.toString(),
|
|
@@ -3285,192 +3516,6 @@ var EkuboQuoter = class {
|
|
|
3285
3516
|
}
|
|
3286
3517
|
};
|
|
3287
3518
|
|
|
3288
|
-
// src/interfaces/common.tsx
|
|
3289
|
-
var import_starknet12 = require("starknet");
|
|
3290
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
3291
|
-
var RiskType = /* @__PURE__ */ ((RiskType2) => {
|
|
3292
|
-
RiskType2["MARKET_RISK"] = "Market Risk";
|
|
3293
|
-
RiskType2["IMPERMANENT_LOSS"] = "Impermanent Loss Risk";
|
|
3294
|
-
RiskType2["LIQUIDATION_RISK"] = "Liquidation Risk";
|
|
3295
|
-
RiskType2["LOW_LIQUIDITY_RISK"] = "Low Liquidity Risk";
|
|
3296
|
-
RiskType2["SMART_CONTRACT_RISK"] = "Smart Contract Risk";
|
|
3297
|
-
RiskType2["ORACLE_RISK"] = "Oracle Risk";
|
|
3298
|
-
RiskType2["TECHNICAL_RISK"] = "Technical Risk";
|
|
3299
|
-
RiskType2["COUNTERPARTY_RISK"] = "Counterparty Risk";
|
|
3300
|
-
RiskType2["DEPEG_RISK"] = "Depeg Risk";
|
|
3301
|
-
return RiskType2;
|
|
3302
|
-
})(RiskType || {});
|
|
3303
|
-
var Network = /* @__PURE__ */ ((Network2) => {
|
|
3304
|
-
Network2["mainnet"] = "mainnet";
|
|
3305
|
-
Network2["sepolia"] = "sepolia";
|
|
3306
|
-
Network2["devnet"] = "devnet";
|
|
3307
|
-
return Network2;
|
|
3308
|
-
})(Network || {});
|
|
3309
|
-
var StrategyTag = /* @__PURE__ */ ((StrategyTag3) => {
|
|
3310
|
-
StrategyTag3["META_VAULT"] = "Meta Vaults";
|
|
3311
|
-
StrategyTag3["LEVERED"] = "Maxx";
|
|
3312
|
-
StrategyTag3["AUTOMATED_LP"] = "Ekubo";
|
|
3313
|
-
StrategyTag3["BTC"] = "BTC";
|
|
3314
|
-
return StrategyTag3;
|
|
3315
|
-
})(StrategyTag || {});
|
|
3316
|
-
var VaultType = /* @__PURE__ */ ((VaultType2) => {
|
|
3317
|
-
VaultType2["LOOPING"] = "Looping";
|
|
3318
|
-
VaultType2["META_VAULT"] = "Meta Vault";
|
|
3319
|
-
VaultType2["DELTA_NEUTRAL"] = "Delta Neutral";
|
|
3320
|
-
VaultType2["AUTOMATED_LP"] = "Automated LP";
|
|
3321
|
-
VaultType2["TVA"] = "Troves Value Averaging";
|
|
3322
|
-
return VaultType2;
|
|
3323
|
-
})(VaultType || {});
|
|
3324
|
-
var AuditStatus = /* @__PURE__ */ ((AuditStatus2) => {
|
|
3325
|
-
AuditStatus2["AUDITED"] = "Audited";
|
|
3326
|
-
AuditStatus2["NOT_AUDITED"] = "Not Audited";
|
|
3327
|
-
return AuditStatus2;
|
|
3328
|
-
})(AuditStatus || {});
|
|
3329
|
-
var SourceCodeType = /* @__PURE__ */ ((SourceCodeType2) => {
|
|
3330
|
-
SourceCodeType2["OPEN_SOURCE"] = "Open Source";
|
|
3331
|
-
SourceCodeType2["CLOSED_SOURCE"] = "Closed Source";
|
|
3332
|
-
return SourceCodeType2;
|
|
3333
|
-
})(SourceCodeType || {});
|
|
3334
|
-
var AccessControlType = /* @__PURE__ */ ((AccessControlType2) => {
|
|
3335
|
-
AccessControlType2["MULTISIG_ACCOUNT"] = "Multisig Account";
|
|
3336
|
-
AccessControlType2["STANDARD_ACCOUNT"] = "Standard Account";
|
|
3337
|
-
AccessControlType2["ROLE_BASED_ACCESS"] = "Role Based Access";
|
|
3338
|
-
return AccessControlType2;
|
|
3339
|
-
})(AccessControlType || {});
|
|
3340
|
-
var InstantWithdrawalVault = /* @__PURE__ */ ((InstantWithdrawalVault2) => {
|
|
3341
|
-
InstantWithdrawalVault2["YES"] = "Yes";
|
|
3342
|
-
InstantWithdrawalVault2["NO"] = "No";
|
|
3343
|
-
return InstantWithdrawalVault2;
|
|
3344
|
-
})(InstantWithdrawalVault || {});
|
|
3345
|
-
var FlowChartColors = /* @__PURE__ */ ((FlowChartColors2) => {
|
|
3346
|
-
FlowChartColors2["Green"] = "purple";
|
|
3347
|
-
FlowChartColors2["Blue"] = "#35484f";
|
|
3348
|
-
FlowChartColors2["Purple"] = "#6e53dc";
|
|
3349
|
-
return FlowChartColors2;
|
|
3350
|
-
})(FlowChartColors || {});
|
|
3351
|
-
var StrategyLiveStatus = /* @__PURE__ */ ((StrategyLiveStatus2) => {
|
|
3352
|
-
StrategyLiveStatus2["ACTIVE"] = "Active";
|
|
3353
|
-
StrategyLiveStatus2["NEW"] = "New";
|
|
3354
|
-
StrategyLiveStatus2["COMING_SOON"] = "Coming Soon";
|
|
3355
|
-
StrategyLiveStatus2["DEPRECATED"] = "Deprecated";
|
|
3356
|
-
StrategyLiveStatus2["RETIRED"] = "Retired";
|
|
3357
|
-
StrategyLiveStatus2["HOT"] = "Hot & New \u{1F525}";
|
|
3358
|
-
return StrategyLiveStatus2;
|
|
3359
|
-
})(StrategyLiveStatus || {});
|
|
3360
|
-
function getMainnetConfig(rpcUrl = "https://starknet-mainnet.public.blastapi.io", blockIdentifier = import_starknet12.BlockTag.LATEST) {
|
|
3361
|
-
return {
|
|
3362
|
-
provider: new import_starknet12.RpcProvider({
|
|
3363
|
-
nodeUrl: rpcUrl,
|
|
3364
|
-
blockIdentifier
|
|
3365
|
-
// specVersion
|
|
3366
|
-
}),
|
|
3367
|
-
stage: "production",
|
|
3368
|
-
network: "mainnet" /* mainnet */
|
|
3369
|
-
};
|
|
3370
|
-
}
|
|
3371
|
-
var getStrategyTagDesciption = (tag) => {
|
|
3372
|
-
switch (tag) {
|
|
3373
|
-
case "Meta Vaults" /* META_VAULT */:
|
|
3374
|
-
return "A meta vault is a vault that auto allocates funds to multiple vaults based on optimal yield opportunities";
|
|
3375
|
-
case "Maxx" /* LEVERED */:
|
|
3376
|
-
return "Looping vaults on Endur LSTs with leveraged borrowing of STRK or BTC to increase yield (2-4x higher yield than simply staking)";
|
|
3377
|
-
case "Ekubo" /* AUTOMATED_LP */:
|
|
3378
|
-
return "Automated LP vaults on Ekubo that rebalance position automatically, ensuring you earn fees efficiently";
|
|
3379
|
-
case "BTC" /* BTC */:
|
|
3380
|
-
return "BTC linked vaults";
|
|
3381
|
-
}
|
|
3382
|
-
};
|
|
3383
|
-
var getAllStrategyTags = () => {
|
|
3384
|
-
return Object.values(StrategyTag);
|
|
3385
|
-
};
|
|
3386
|
-
var getRiskExplaination = (riskType) => {
|
|
3387
|
-
switch (riskType) {
|
|
3388
|
-
case "Market Risk" /* MARKET_RISK */:
|
|
3389
|
-
return "The risk of the market moving against the position.";
|
|
3390
|
-
case "Impermanent Loss Risk" /* IMPERMANENT_LOSS */:
|
|
3391
|
-
return "The temporary loss of value experienced by liquidity providers in AMMs when asset prices diverge compared to simply holding them.";
|
|
3392
|
-
case "Liquidation Risk" /* LIQUIDATION_RISK */:
|
|
3393
|
-
return "The risk of losing funds due to the position being liquidated.";
|
|
3394
|
-
case "Low Liquidity Risk" /* LOW_LIQUIDITY_RISK */:
|
|
3395
|
-
return "The risk of low liquidity in the pool, which can lead to high slippages or reduced in-abilities to quickly exit the position.";
|
|
3396
|
-
case "Oracle Risk" /* ORACLE_RISK */:
|
|
3397
|
-
return "The risk of the oracle being manipulated or incorrect.";
|
|
3398
|
-
case "Smart Contract Risk" /* SMART_CONTRACT_RISK */:
|
|
3399
|
-
return "The risk of the smart contract being vulnerable to attacks.";
|
|
3400
|
-
case "Technical Risk" /* TECHNICAL_RISK */:
|
|
3401
|
-
return "The risk of technical issues e.g. backend failure.";
|
|
3402
|
-
case "Counterparty Risk" /* COUNTERPARTY_RISK */:
|
|
3403
|
-
return "The risk of the counterparty defaulting e.g. bad debt on lending platforms.";
|
|
3404
|
-
case "Depeg Risk" /* DEPEG_RISK */:
|
|
3405
|
-
return "The risk of a token losing its peg to the underlying asset, leading to potential losses for holders.";
|
|
3406
|
-
}
|
|
3407
|
-
};
|
|
3408
|
-
var getRiskColor = (risk) => {
|
|
3409
|
-
const value = risk.value;
|
|
3410
|
-
if (value <= 2) return "light_green_2";
|
|
3411
|
-
if (value < 3) return "yellow";
|
|
3412
|
-
return "red";
|
|
3413
|
-
};
|
|
3414
|
-
var getNoRiskTags = (risks) => {
|
|
3415
|
-
const noRisks1 = risks.filter((risk) => risk.value === 0).map((risk) => risk.type);
|
|
3416
|
-
const noRisks2 = Object.values(RiskType).filter(
|
|
3417
|
-
(risk) => !risks.map((risk2) => risk2.type).includes(risk)
|
|
3418
|
-
);
|
|
3419
|
-
const mergedUnique = [.../* @__PURE__ */ new Set([...noRisks1, ...noRisks2])];
|
|
3420
|
-
return mergedUnique;
|
|
3421
|
-
};
|
|
3422
|
-
function highlightTextWithLinks(put, highlights) {
|
|
3423
|
-
const escapeRegExp = (text) => text.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");
|
|
3424
|
-
const pattern = new RegExp(
|
|
3425
|
-
`(${highlights.map((m) => escapeRegExp(m.highlight)).join("|")})`,
|
|
3426
|
-
"gi"
|
|
3427
|
-
);
|
|
3428
|
-
const parts = put.split(pattern);
|
|
3429
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: parts.map((part, i) => {
|
|
3430
|
-
const match = highlights.find((m) => m.highlight.toLowerCase() === part.toLowerCase());
|
|
3431
|
-
return match ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", { href: match.link, target: "_blank", style: { color: "white", background: "rgba(255, 255, 255, 0.04)" }, children: part }, i) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: part }, i);
|
|
3432
|
-
}) });
|
|
3433
|
-
}
|
|
3434
|
-
var VesuProtocol = {
|
|
3435
|
-
name: "Vesu",
|
|
3436
|
-
logo: "https://static-assets-8zct.onrender.com/integrations/vesu/logo.png"
|
|
3437
|
-
};
|
|
3438
|
-
var EndurProtocol = {
|
|
3439
|
-
name: "Endur",
|
|
3440
|
-
logo: "http://endur.fi/logo.png"
|
|
3441
|
-
};
|
|
3442
|
-
var ExtendedProtocol = {
|
|
3443
|
-
name: "Extended",
|
|
3444
|
-
logo: "https://static-assets-8zct.onrender.com/integrations/extended/extended.svg"
|
|
3445
|
-
};
|
|
3446
|
-
var Protocols = {
|
|
3447
|
-
VESU: VesuProtocol,
|
|
3448
|
-
ENDUR: EndurProtocol,
|
|
3449
|
-
EXTENDED: ExtendedProtocol
|
|
3450
|
-
};
|
|
3451
|
-
var UnwrapLabsCurator = {
|
|
3452
|
-
name: "Unwrap Labs",
|
|
3453
|
-
logo: "https://assets.troves.fi/integrations/unwraplabs/white.png"
|
|
3454
|
-
};
|
|
3455
|
-
|
|
3456
|
-
// src/interfaces/initializable.ts
|
|
3457
|
-
var Initializable = class {
|
|
3458
|
-
constructor() {
|
|
3459
|
-
this.initialized = false;
|
|
3460
|
-
}
|
|
3461
|
-
async waitForInitilisation() {
|
|
3462
|
-
return new Promise((resolve, reject) => {
|
|
3463
|
-
const interval = setInterval(() => {
|
|
3464
|
-
if (this.initialized) {
|
|
3465
|
-
console.log("Initialised");
|
|
3466
|
-
clearInterval(interval);
|
|
3467
|
-
resolve();
|
|
3468
|
-
}
|
|
3469
|
-
}, 1e3);
|
|
3470
|
-
});
|
|
3471
|
-
}
|
|
3472
|
-
};
|
|
3473
|
-
|
|
3474
3519
|
// src/strategies/autoCompounderStrk.ts
|
|
3475
3520
|
var import_starknet13 = require("starknet");
|
|
3476
3521
|
var AutoCompounderSTRK = class {
|
|
@@ -18234,6 +18279,9 @@ var xSTRKSTRK = {
|
|
|
18234
18279
|
},
|
|
18235
18280
|
apyMethodology: "APY based on 30-day historical performance, including fees and rewards.",
|
|
18236
18281
|
realizedApyMethodology: "The realizedAPY is based on past 14 days performance by the vault",
|
|
18282
|
+
feeBps: {
|
|
18283
|
+
performanceFeeBps: 1e3
|
|
18284
|
+
},
|
|
18237
18285
|
additionalInfo: {
|
|
18238
18286
|
newBounds: {
|
|
18239
18287
|
lower: -1,
|
|
@@ -29640,7 +29688,8 @@ var vesuPrimeUSDC = {
|
|
|
29640
29688
|
name: "Vesu Prime USDC",
|
|
29641
29689
|
decimals: 18,
|
|
29642
29690
|
logo: usdc.logo,
|
|
29643
|
-
displayDecimals: 2
|
|
29691
|
+
displayDecimals: 2,
|
|
29692
|
+
indexingType: "ignore" /* IGNORE */
|
|
29644
29693
|
};
|
|
29645
29694
|
var strk = Global.getDefaultTokens().find((t) => t.symbol === "STRK");
|
|
29646
29695
|
function getYoloVaultErc4626Config(mainToken, secondaryToken) {
|
|
@@ -29786,6 +29835,9 @@ var YoloVaultStrategies = yoloVaultsConfig.map((yoloConfig) => {
|
|
|
29786
29835
|
notARisks: getNoRiskTags(yoloRiskFactors)
|
|
29787
29836
|
},
|
|
29788
29837
|
apyMethodology: "Not a primary yield strategy. Funds earn yield when idle, but the main return comes from BTC price appreciation and your conviction to hold. This vault simply helps you accumulate more BTC.",
|
|
29838
|
+
feeBps: {
|
|
29839
|
+
performanceFeeBps: 1e3
|
|
29840
|
+
},
|
|
29789
29841
|
additionalInfo: {
|
|
29790
29842
|
mainToken: yoloConfig.mainToken,
|
|
29791
29843
|
secondaryToken: yoloConfig.secondaryToken,
|
|
@@ -33415,6 +33467,9 @@ var createUniversalStrategy = (params) => {
|
|
|
33415
33467
|
auditUrl: AUDIT_URL3,
|
|
33416
33468
|
protocols: [Protocols.VESU],
|
|
33417
33469
|
realizedApyMethodology: "The realizedAPY is based on past 14 days performance by the vault",
|
|
33470
|
+
feeBps: {
|
|
33471
|
+
performanceFeeBps: 1e3
|
|
33472
|
+
},
|
|
33418
33473
|
curator: UnwrapLabsCurator,
|
|
33419
33474
|
settings: createUniversalSettings(params.tokenSymbol),
|
|
33420
33475
|
contractDetails: getContractDetails(params.vaultSettings),
|
|
@@ -35133,6 +35188,9 @@ function getStrategySettings(lstSymbol, underlyingSymbol, settings, isPreview =
|
|
|
35133
35188
|
isPreview,
|
|
35134
35189
|
apyMethodology: "Current annualized APY in terms of base asset of the LST. There is no additional fee taken by Troves on LST APY. We charge a 10% performance fee on the additional gain which is already accounted in the APY shown.",
|
|
35135
35190
|
realizedApyMethodology: "The realizedAPY is based on past 14 days performance by the vault",
|
|
35191
|
+
feeBps: {
|
|
35192
|
+
performanceFeeBps: 1e3
|
|
35193
|
+
},
|
|
35136
35194
|
tags: lstSymbol.includes("BTC") ? ["BTC" /* BTC */, "Maxx" /* LEVERED */] : ["Maxx" /* LEVERED */],
|
|
35137
35195
|
security: HYPER_LST_SECURITY,
|
|
35138
35196
|
redemptionInfo: HYPER_LST_REDEMPTION_INFO,
|
|
@@ -36034,6 +36092,7 @@ var deployer_default = Deployer;
|
|
|
36034
36092
|
StrategyType,
|
|
36035
36093
|
TelegramGroupNotif,
|
|
36036
36094
|
TelegramNotif,
|
|
36095
|
+
TokenIndexingType,
|
|
36037
36096
|
UNIVERSAL_ADAPTERS,
|
|
36038
36097
|
UNIVERSAL_MANAGE_IDS,
|
|
36039
36098
|
UniversalLstMultiplierStrategy,
|