@strkfarm/sdk 1.0.16 → 1.0.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +18 -5
- package/dist/cli.mjs +18 -11
- package/dist/index.browser.global.js +122 -2349
- package/dist/index.browser.mjs +2592 -0
- package/dist/index.d.ts +91 -42
- package/dist/index.js +129 -20
- package/dist/index.mjs +126 -26
- package/package.json +15 -8
- package/src/global.ts +2 -0
- package/src/interfaces/common.ts +41 -2
- package/src/modules/index.ts +2 -1
- package/src/modules/pricer-from-api.ts +61 -0
- package/src/modules/pricer.ts +7 -19
- package/src/modules/pricerBase.ts +15 -0
- package/src/modules/zkLend.ts +1 -0
- package/src/node/pricer-redis.ts +1 -0
- package/src/strategies/vesu-rebalance.ts +43 -4
package/dist/cli.js
CHANGED
|
@@ -104,6 +104,7 @@ var FatalError = class extends Error {
|
|
|
104
104
|
var tokens = [{
|
|
105
105
|
name: "Starknet",
|
|
106
106
|
symbol: "STRK",
|
|
107
|
+
logo: "https://assets.coingecko.com/coins/images/26433/small/starknet.png",
|
|
107
108
|
address: "0x4718f5a0fc34cc1af16a1cdee98ffb20c31f5cd61d6ab07201858f4287c938d",
|
|
108
109
|
decimals: 18,
|
|
109
110
|
coingeckId: "starknet"
|
|
@@ -136,6 +137,7 @@ var Global = class {
|
|
|
136
137
|
symbol: token.symbol,
|
|
137
138
|
address: token.address,
|
|
138
139
|
decimals: token.decimals,
|
|
140
|
+
logo: token.logoUri,
|
|
139
141
|
coingeckId: token.extensions.coingeckoId
|
|
140
142
|
});
|
|
141
143
|
});
|
|
@@ -215,9 +217,6 @@ var ContractAddr = class _ContractAddr {
|
|
|
215
217
|
}
|
|
216
218
|
};
|
|
217
219
|
|
|
218
|
-
// src/modules/pricer.ts
|
|
219
|
-
var CoinMarketCap = require("coinmarketcap-api");
|
|
220
|
-
|
|
221
220
|
// src/modules/pragma.ts
|
|
222
221
|
var import_starknet2 = require("starknet");
|
|
223
222
|
|
|
@@ -274,6 +273,7 @@ var _ZkLend = class _ZkLend extends ILending {
|
|
|
274
273
|
name: pool.token.name,
|
|
275
274
|
symbol: pool.token.symbol,
|
|
276
275
|
address: savedTokenInfo?.address || "",
|
|
276
|
+
logo: "",
|
|
277
277
|
decimals: pool.token.decimals,
|
|
278
278
|
borrowFactor: Web3Number.fromWei(pool.borrow_factor.value, pool.borrow_factor.decimals),
|
|
279
279
|
collareralFactor
|
|
@@ -383,6 +383,9 @@ var _ZkLend = class _ZkLend extends ILending {
|
|
|
383
383
|
_ZkLend.POOLS_URL = "https://app.zklend.com/api/pools";
|
|
384
384
|
var ZkLend = _ZkLend;
|
|
385
385
|
|
|
386
|
+
// src/modules/pricer-from-api.ts
|
|
387
|
+
var import_axios4 = __toESM(require("axios"));
|
|
388
|
+
|
|
386
389
|
// src/interfaces/common.ts
|
|
387
390
|
var import_starknet3 = require("starknet");
|
|
388
391
|
|
|
@@ -391,16 +394,26 @@ var import_starknet4 = require("starknet");
|
|
|
391
394
|
|
|
392
395
|
// src/strategies/vesu-rebalance.ts
|
|
393
396
|
var import_starknet5 = require("starknet");
|
|
394
|
-
var
|
|
397
|
+
var import_axios5 = __toESM(require("axios"));
|
|
395
398
|
var _description = "Automatically diversify {{TOKEN}} holdings into different Vesu pools while reducing risk and maximizing yield. Defi spring STRK Rewards are auto-compounded as well.";
|
|
396
399
|
var _protocol = { name: "Vesu", logo: "https://static-assets-8zct.onrender.com/integrations/vesu/logo.png" };
|
|
400
|
+
var _riskFactor = [
|
|
401
|
+
{ type: "SMART_CONTRACT_RISK" /* SMART_CONTRACT_RISK */, value: 0.5, weight: 25 },
|
|
402
|
+
{ type: "TECHNICAL_RISK" /* TECHNICAL_RISK */, value: 0.5, weight: 25 },
|
|
403
|
+
{ type: "COUNTERPARTY_RISK" /* COUNTERPARTY_RISK */, value: 1, weight: 50 }
|
|
404
|
+
];
|
|
397
405
|
var VesuRebalanceStrategies = [{
|
|
398
406
|
name: "Vesu STRK",
|
|
399
407
|
description: _description.replace("{{TOKEN}}", "STRK"),
|
|
400
408
|
address: ContractAddr.from("0xeeb729d554ae486387147b13a9c8871bc7991d454e8b5ff570d4bf94de71e1"),
|
|
401
409
|
type: "ERC4626",
|
|
402
410
|
depositTokens: [Global.getDefaultTokens().find((t) => t.symbol === "STRK")],
|
|
403
|
-
protocols: [_protocol]
|
|
411
|
+
protocols: [_protocol],
|
|
412
|
+
maxTVL: Web3Number.fromWei("0", 18),
|
|
413
|
+
risk: {
|
|
414
|
+
riskFactor: _riskFactor,
|
|
415
|
+
netRisk: _riskFactor.reduce((acc, curr) => acc + curr.value * curr.weight, 0) / 100
|
|
416
|
+
}
|
|
404
417
|
}];
|
|
405
418
|
|
|
406
419
|
// src/notifs/telegram.ts
|
package/dist/cli.mjs
CHANGED
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
3
|
-
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
4
|
-
}) : x)(function(x) {
|
|
5
|
-
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
6
|
-
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
7
|
-
});
|
|
8
2
|
|
|
9
3
|
// src/cli.ts
|
|
10
4
|
import { Command } from "commander";
|
|
@@ -87,6 +81,7 @@ var FatalError = class extends Error {
|
|
|
87
81
|
var tokens = [{
|
|
88
82
|
name: "Starknet",
|
|
89
83
|
symbol: "STRK",
|
|
84
|
+
logo: "https://assets.coingecko.com/coins/images/26433/small/starknet.png",
|
|
90
85
|
address: "0x4718f5a0fc34cc1af16a1cdee98ffb20c31f5cd61d6ab07201858f4287c938d",
|
|
91
86
|
decimals: 18,
|
|
92
87
|
coingeckId: "starknet"
|
|
@@ -119,6 +114,7 @@ var Global = class {
|
|
|
119
114
|
symbol: token.symbol,
|
|
120
115
|
address: token.address,
|
|
121
116
|
decimals: token.decimals,
|
|
117
|
+
logo: token.logoUri,
|
|
122
118
|
coingeckId: token.extensions.coingeckoId
|
|
123
119
|
});
|
|
124
120
|
});
|
|
@@ -198,9 +194,6 @@ var ContractAddr = class _ContractAddr {
|
|
|
198
194
|
}
|
|
199
195
|
};
|
|
200
196
|
|
|
201
|
-
// src/modules/pricer.ts
|
|
202
|
-
var CoinMarketCap = __require("coinmarketcap-api");
|
|
203
|
-
|
|
204
197
|
// src/modules/pragma.ts
|
|
205
198
|
import { Contract } from "starknet";
|
|
206
199
|
|
|
@@ -257,6 +250,7 @@ var _ZkLend = class _ZkLend extends ILending {
|
|
|
257
250
|
name: pool.token.name,
|
|
258
251
|
symbol: pool.token.symbol,
|
|
259
252
|
address: savedTokenInfo?.address || "",
|
|
253
|
+
logo: "",
|
|
260
254
|
decimals: pool.token.decimals,
|
|
261
255
|
borrowFactor: Web3Number.fromWei(pool.borrow_factor.value, pool.borrow_factor.decimals),
|
|
262
256
|
collareralFactor
|
|
@@ -366,6 +360,9 @@ var _ZkLend = class _ZkLend extends ILending {
|
|
|
366
360
|
_ZkLend.POOLS_URL = "https://app.zklend.com/api/pools";
|
|
367
361
|
var ZkLend = _ZkLend;
|
|
368
362
|
|
|
363
|
+
// src/modules/pricer-from-api.ts
|
|
364
|
+
import axios4 from "axios";
|
|
365
|
+
|
|
369
366
|
// src/interfaces/common.ts
|
|
370
367
|
import { RpcProvider as RpcProvider2 } from "starknet";
|
|
371
368
|
|
|
@@ -374,16 +371,26 @@ import { Contract as Contract2, uint256 } from "starknet";
|
|
|
374
371
|
|
|
375
372
|
// src/strategies/vesu-rebalance.ts
|
|
376
373
|
import { CairoCustomEnum, Contract as Contract3, num as num2, uint256 as uint2562 } from "starknet";
|
|
377
|
-
import
|
|
374
|
+
import axios5 from "axios";
|
|
378
375
|
var _description = "Automatically diversify {{TOKEN}} holdings into different Vesu pools while reducing risk and maximizing yield. Defi spring STRK Rewards are auto-compounded as well.";
|
|
379
376
|
var _protocol = { name: "Vesu", logo: "https://static-assets-8zct.onrender.com/integrations/vesu/logo.png" };
|
|
377
|
+
var _riskFactor = [
|
|
378
|
+
{ type: "SMART_CONTRACT_RISK" /* SMART_CONTRACT_RISK */, value: 0.5, weight: 25 },
|
|
379
|
+
{ type: "TECHNICAL_RISK" /* TECHNICAL_RISK */, value: 0.5, weight: 25 },
|
|
380
|
+
{ type: "COUNTERPARTY_RISK" /* COUNTERPARTY_RISK */, value: 1, weight: 50 }
|
|
381
|
+
];
|
|
380
382
|
var VesuRebalanceStrategies = [{
|
|
381
383
|
name: "Vesu STRK",
|
|
382
384
|
description: _description.replace("{{TOKEN}}", "STRK"),
|
|
383
385
|
address: ContractAddr.from("0xeeb729d554ae486387147b13a9c8871bc7991d454e8b5ff570d4bf94de71e1"),
|
|
384
386
|
type: "ERC4626",
|
|
385
387
|
depositTokens: [Global.getDefaultTokens().find((t) => t.symbol === "STRK")],
|
|
386
|
-
protocols: [_protocol]
|
|
388
|
+
protocols: [_protocol],
|
|
389
|
+
maxTVL: Web3Number.fromWei("0", 18),
|
|
390
|
+
risk: {
|
|
391
|
+
riskFactor: _riskFactor,
|
|
392
|
+
netRisk: _riskFactor.reduce((acc, curr) => acc + curr.value * curr.weight, 0) / 100
|
|
393
|
+
}
|
|
387
394
|
}];
|
|
388
395
|
|
|
389
396
|
// src/notifs/telegram.ts
|