@sonarwatch/portfolio-plugins 0.11.112 → 0.11.114
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +8 -0
- package/package.json +2 -2
- package/src/index.js +4 -0
- package/src/index.js.map +1 -1
- package/src/plugins/flexlend/helpers.js +1 -3
- package/src/plugins/flexlend/helpers.js.map +1 -1
- package/src/plugins/liquiditypools-sei/fetcher.js +4 -1
- package/src/plugins/liquiditypools-sei/fetcher.js.map +1 -1
- package/src/plugins/solend/obligationsFetcher.js +7 -3
- package/src/plugins/solend/obligationsFetcher.js.map +1 -1
- package/src/plugins/suilend/constants.d.ts +8 -0
- package/src/plugins/suilend/constants.js +18 -0
- package/src/plugins/suilend/constants.js.map +1 -0
- package/src/plugins/suilend/index.d.ts +6 -0
- package/src/plugins/suilend/index.js +13 -0
- package/src/plugins/suilend/index.js.map +1 -0
- package/src/plugins/suilend/marketsJob.d.ts +3 -0
- package/src/plugins/suilend/marketsJob.js +45 -0
- package/src/plugins/suilend/marketsJob.js.map +1 -0
- package/src/plugins/suilend/obligationsFetcher.d.ts +3 -0
- package/src/plugins/suilend/obligationsFetcher.js +149 -0
- package/src/plugins/suilend/obligationsFetcher.js.map +1 -0
- package/src/plugins/suilend/types.d.ts +137 -0
- package/src/plugins/suilend/types.js +3 -0
- package/src/plugins/suilend/types.js.map +1 -0
package/CHANGELOG.md
CHANGED
@@ -2,6 +2,14 @@
|
|
2
2
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
4
4
|
|
5
|
+
## [0.11.114](https://github.com/sonarwatch/portfolio/compare/plugins-0.11.113...plugins-0.11.114) (2024-03-12)
|
6
|
+
|
7
|
+
|
8
|
+
|
9
|
+
## [0.11.113](https://github.com/sonarwatch/portfolio/compare/plugins-0.11.112...plugins-0.11.113) (2024-03-11)
|
10
|
+
|
11
|
+
|
12
|
+
|
5
13
|
## [0.11.112](https://github.com/sonarwatch/portfolio/compare/plugins-0.11.111...plugins-0.11.112) (2024-03-11)
|
6
14
|
|
7
15
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@sonarwatch/portfolio-plugins",
|
3
|
-
"version": "0.11.
|
3
|
+
"version": "0.11.114",
|
4
4
|
"type": "commonjs",
|
5
5
|
"generators": "./generators.json",
|
6
6
|
"dependencies": {
|
@@ -41,7 +41,7 @@
|
|
41
41
|
"web3-v1": "npm:web3@^1.5.0"
|
42
42
|
},
|
43
43
|
"peerDependencies": {
|
44
|
-
"@sonarwatch/portfolio-core": "0.11.
|
44
|
+
"@sonarwatch/portfolio-core": "0.11.114"
|
45
45
|
},
|
46
46
|
"main": "./src/index.js",
|
47
47
|
"types": "./src/index.d.ts"
|
package/src/index.js
CHANGED
@@ -90,6 +90,7 @@ const genesysgo_1 = require("./plugins/genesysgo");
|
|
90
90
|
const aurory_1 = require("./plugins/aurory");
|
91
91
|
const x_staking_solana_1 = require("./plugins/x-staking-solana");
|
92
92
|
const spl_staking_1 = require("./plugins/spl-staking");
|
93
|
+
const suilend_1 = require("./plugins/suilend");
|
93
94
|
const getFetchersByAddressSystem_1 = require("./utils/misc/getFetchersByAddressSystem");
|
94
95
|
var getFetchersByAddressSystem_2 = require("./utils/misc/getFetchersByAddressSystem");
|
95
96
|
Object.defineProperty(exports, "getFetchersByAddressSystem", { enumerable: true, get: function () { return getFetchersByAddressSystem_2.getFetchersByAddressSystem; } });
|
@@ -175,6 +176,7 @@ exports.platforms = [
|
|
175
176
|
...aurory_1.platforms,
|
176
177
|
...x_staking_solana_1.platforms,
|
177
178
|
...spl_staking_1.platforms,
|
179
|
+
...suilend_1.platforms,
|
178
180
|
];
|
179
181
|
// JOBS //
|
180
182
|
exports.jobs = [
|
@@ -242,6 +244,7 @@ exports.jobs = [
|
|
242
244
|
...aurory_1.jobs,
|
243
245
|
...x_staking_solana_1.jobs,
|
244
246
|
...spl_staking_1.jobs,
|
247
|
+
...suilend_1.jobs,
|
245
248
|
];
|
246
249
|
// FETCHERS //
|
247
250
|
exports.fetchers = [
|
@@ -311,6 +314,7 @@ exports.fetchers = [
|
|
311
314
|
...aurory_1.fetchers,
|
312
315
|
...x_staking_solana_1.fetchers,
|
313
316
|
...spl_staking_1.fetchers,
|
317
|
+
...suilend_1.fetchers,
|
314
318
|
];
|
315
319
|
exports.fetchersByAddressSystem = (0, getFetchersByAddressSystem_1.getFetchersByAddressSystem)(exports.fetchers);
|
316
320
|
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/plugins/src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAGA,sEAA8C;AAC9C,6CAI0B;AAC1B,yDAIgC;AAChC,iDAG4B;AAC5B,iDAI4B;AAC5B,2CAGyB;AACzB,6CAI0B;AAC1B,+CAI2B;AAC3B,yCAIwB;AACxB,+CAI2B;AAC3B,2CAIyB;AACzB,6CAI0B;AAC1B,2CAIyB;AACzB,6CAG0B;AAC1B,6CAI0B;AAC1B,yCAIwB;AACxB,2DAGiC;AACjC,6CAI0B;AAC1B,2CAIyB;AACzB,2CAIyB;AACzB,qDAA6D;AAC7D,qEAIsC;AACtC,uDAI+B;AAC/B,mDAG6B;AAC7B,qDAG8B;AAC9B,uDAG+B;AAC/B,2CAIyB;AACzB,6CAI0B;AAC1B,6CAG0B;AAC1B,yCAIwB;AACxB,+CAI2B;AAC3B,uDAG+B;AAC/B,yCAGwB;AACxB,2CAIyB;AACzB,iDAI4B;AAC5B,iDAI4B;AAC5B,6CAI0B;AAC1B,+CAI2B;AAC3B,qDAG8B;AAC9B,iDAI4B;AAC5B,iDAI4B;AAC5B,mDAG6B;AAC7B,6CAI0B;AAC1B,2CAIyB;AACzB,iDAI4B;AAC5B,iDAI4B;AAC5B,+CAI2B;AAC3B,yCAIwB;AACxB,2CAIyB;AACzB,mDAI6B;AAC7B,2CAIyB;AACzB,2CAIyB;AACzB,sCAIsB;AACtB,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iB;IACpB,GAAG,oBAAiB;IACpB,GAAG,kBAAe;IAClB,GAAG,mBAAgB;IACnB,GAAG,oBAAiB;IACpB,GAAG,oBAAiB;IACpB,GAAG,qBAAkB;IACrB,GAAG,kBAAe;IAClB,GAAG,iBAAc;IACjB,GAAG,oBAAiB;IACpB,GAAG,oBAAiB;IACpB,GAAG,gBAAa;IAChB,GAAG,iBAAc;IACjB,GAAG,qBAAkB;IACrB,GAAG,iBAAc;IACjB,GAAG,iBAAc;IACjB,GAAG,eAAgB;IACnB,GAAG,mBAAgB;IACnB,GAAG,oBAAiB;IACpB,GAAG,gBAAa;IAChB,GAAG,qBAAkB;IACrB,GAAG,sBAAmB;IACtB,GAAG,iBAAc;IACjB,GAAG,iBAAc;IACjB,GAAG,gBAAa;IAChB,GAAG,mBAAgB;IACnB,GAAG,mBAAgB;IACnB,GAAG,iBAAc;IACjB,GAAG,iBAAc;IACjB,GAAG,uBAAoB;IACvB,GAAG,0BAAuB;IAC1B,GAAG,iBAAc;IACjB,GAAG,gBAAa;IAChB,GAAG,qBAAkB;IACrB,GAAG,kBAAe;IAClB,GAAG,4BAAuB;IAC1B,GAAG,uBAAmB;
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/plugins/src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAGA,sEAA8C;AAC9C,6CAI0B;AAC1B,yDAIgC;AAChC,iDAG4B;AAC5B,iDAI4B;AAC5B,2CAGyB;AACzB,6CAI0B;AAC1B,+CAI2B;AAC3B,yCAIwB;AACxB,+CAI2B;AAC3B,2CAIyB;AACzB,6CAI0B;AAC1B,2CAIyB;AACzB,6CAG0B;AAC1B,6CAI0B;AAC1B,yCAIwB;AACxB,2DAGiC;AACjC,6CAI0B;AAC1B,2CAIyB;AACzB,2CAIyB;AACzB,qDAA6D;AAC7D,qEAIsC;AACtC,uDAI+B;AAC/B,mDAG6B;AAC7B,qDAG8B;AAC9B,uDAG+B;AAC/B,2CAIyB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AkB;IACrB,GAAG,kBAAe;CACnB,CAAC;AACW,QAAA,uBAAuB,GAAG,IAAA,uDAA0B,EAAC,gBAAQ,CAAC,CAAC"}
|
@@ -4,9 +4,7 @@ exports.getDerivedAccount = void 0;
|
|
4
4
|
const web3_js_1 = require("@solana/web3.js");
|
5
5
|
const constants_1 = require("./constants");
|
6
6
|
function getDerivedAccount(owner) {
|
7
|
-
|
8
|
-
const [pda, bump] = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from('flexlend', 'utf8'), new web3_js_1.PublicKey(owner).toBuffer()], constants_1.flexProgramId);
|
9
|
-
return pda.toString();
|
7
|
+
return web3_js_1.PublicKey.findProgramAddressSync([Buffer.from('flexlend', 'utf8'), new web3_js_1.PublicKey(owner).toBuffer()], constants_1.flexProgramId)[0].toString();
|
10
8
|
}
|
11
9
|
exports.getDerivedAccount = getDerivedAccount;
|
12
10
|
//# sourceMappingURL=helpers.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/flexlend/helpers.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAC5C,2CAA4C;AAE5C,SAAgB,iBAAiB,CAAC,KAAa;IAC7C,
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/flexlend/helpers.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAC5C,2CAA4C;AAE5C,SAAgB,iBAAiB,CAAC,KAAa;IAC7C,OAAO,mBAAS,CAAC,sBAAsB,CACrC,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,EAAE,IAAI,mBAAS,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE,CAAC,EAClE,yBAAa,CACd,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;AAClB,CAAC;AALD,8CAKC"}
|
@@ -28,6 +28,9 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
28
28
|
});
|
29
29
|
if (!platformsContracts)
|
30
30
|
return [];
|
31
|
+
const tokenPriceById = yield cache.getTokenPricesAsMap(platformsContracts
|
32
|
+
.map((platformContracts) => platformContracts.contracts)
|
33
|
+
.flat(), portfolio_core_1.NetworkId.sei);
|
31
34
|
platformsContracts.forEach((platform) => {
|
32
35
|
if (platform) {
|
33
36
|
contractsByPlatform.set(platform.id, platform.contracts);
|
@@ -40,7 +43,7 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
40
43
|
continue;
|
41
44
|
const liquidities = [];
|
42
45
|
for (const contract of contracts) {
|
43
|
-
const tokenPrice =
|
46
|
+
const tokenPrice = tokenPriceById.get(contract);
|
44
47
|
if (!tokenPrice)
|
45
48
|
continue;
|
46
49
|
const balance = (yield cosmWasmClient.queryContractSmart(contract, (0, getQueryBalanceByOwner_1.default)(owner)));
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"fetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/liquiditypools-sei/fetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAMoC;AACpC,uCAAiD;AACjD,gEAAqC;AAGrC,2CAAuC;AACvC,6DAA+D;AAE/D,uGAA+E;AAC/E,oGAA4E;AAG5E,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,cAAc,GAAG,MAAM,IAAA,wBAAiB,EAAC,IAAA,0BAAc,EAAC,0BAAS,CAAC,GAAG,CAAC,CAAC,CAAC;IAE9E,MAAM,mBAAmB,GAA0B,IAAI,GAAG,EAAE,CAAC;IAC7D,MAAM,kBAAkB,GAAG,MAAM,KAAK,CAAC,WAAW,CAAoB;QACpE,MAAM,EAAE,oBAAQ;QAChB,SAAS,EAAE,0BAAS,CAAC,GAAG;KACzB,CAAC,CAAC;IACH,IAAI,CAAC,kBAAkB;QAAE,OAAO,EAAE,CAAC;
|
1
|
+
{"version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C,IAAI,CAAC;YACZ,IAAI,EAAE,qCAAoB,CAAC,SAAS;YACpC,SAAS,EAAE,0BAAS,CAAC,GAAG;YACxB,UAAU,EAAE,QAAQ;YACpB,KAAK,EAAE,eAAe;YACtB,KAAK,EAAE,IAAA,+BAAc,EAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;YACtD,IAAI,EAAE;gBACJ,WAAW;aACZ;SACF,CAAC,CAAC;IACL,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,oBAAQ;IACZ,SAAS,EAAE,0BAAS,CAAC,GAAG;IACxB,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|
@@ -24,6 +24,7 @@ const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/token
|
|
24
24
|
const runInBatch_1 = __importDefault(require("../../utils/misc/runInBatch"));
|
25
25
|
const constants_2 = require("../flexlend/constants");
|
26
26
|
const helpers_2 = require("../../utils/solana/pyth/helpers");
|
27
|
+
const helpers_3 = require("../flexlend/helpers");
|
27
28
|
const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
28
29
|
const client = (0, clients_1.getClientSolana)();
|
29
30
|
const obligationAddresses = [];
|
@@ -51,10 +52,13 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
51
52
|
}
|
52
53
|
// Flexlend, only support the main pool on Solend
|
53
54
|
const marketSeed = constants_1.mainMarket.slice(0, 16);
|
55
|
+
const flexSeed = (0, helpers_3.getDerivedAccount)(owner).slice(0, 16);
|
54
56
|
const ownerSeed = owner.slice(0, 16);
|
55
|
-
const
|
56
|
-
const
|
57
|
-
|
57
|
+
const oldObligationSeed = ownerSeed + marketSeed;
|
58
|
+
const obligationSeed = flexSeed + marketSeed;
|
59
|
+
const oldFlexlendObligAddress = yield web3_js_1.PublicKey.createWithSeed(constants_2.AUTOMATION_PUBLIC_KEY, oldObligationSeed, constants_1.pid);
|
60
|
+
const newFlexlendObligAddress = yield web3_js_1.PublicKey.createWithSeed(new web3_js_1.PublicKey(owner), obligationSeed, constants_1.pid);
|
61
|
+
obligationAddresses.push(...[oldFlexlendObligAddress, newFlexlendObligAddress]);
|
58
62
|
const obligations = yield (0, solana_1.getParsedMultipleAccountsInfo)(client, structs_1.obligationStruct, obligationAddresses);
|
59
63
|
if (obligations.length === 0)
|
60
64
|
return [];
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"obligationsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/solend/obligationsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DASoC;AACpC,gEAAqC;AACrC,6CAA4C;AAG5C,2CAOqB;AACrB,uCAA6D;AAE7D,+CAAmE;AACnE,iDAAsD;AACtD,uCAA6C;AAC7C,qGAA6E;AAC7E,6EAAqD;AACrD,qDAA8D;AAC9D,6DAA+D;
|
1
|
+
{"version":3,"file":"obligationsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/solend/obligationsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DASoC;AACpC,gEAAqC;AACrC,6CAA4C;AAG5C,2CAOqB;AACrB,uCAA6D;AAE7D,+CAAmE;AACnE,iDAAsD;AACtD,uCAA6C;AAC7C,qGAA6E;AAC7E,6EAAqD;AACrD,qDAA8D;AAC9D,6DAA+D;AAC/D,iDAAwD;AAExD,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,MAAM,GAAG,IAAA,yBAAe,GAAE,CAAC;IACjC,MAAM,mBAAmB,GAAG,EAAE,CAAC;IAE/B,MAAM,OAAO,GAAG,MAAM,KAAK,CAAC,WAAW,CAAa;QAClD,MAAM,EAAE,yBAAa;QACrB,SAAS,EAAE,0BAAS,CAAC,MAAM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U,cAAc;IAC/B,SAAS,EAAE,0BAAS,CAAC,MAAM;IAC3B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import { Platform } from '@sonarwatch/portfolio-core';
|
2
|
+
export declare const platformId = "suilend";
|
3
|
+
export declare const platform: Platform;
|
4
|
+
export declare const packageId = "0xf95b06141ed4a174f239417323bde3f209b972f5930d8521ea38a52aff3a6ddf";
|
5
|
+
export declare const obligationType = "0xf95b06141ed4a174f239417323bde3f209b972f5930d8521ea38a52aff3a6ddf::obligation::Obligation";
|
6
|
+
export declare const mainMarket = "0x84030d26d85eaa7035084a057f2f11f701b7e2e4eda87551becbc7c97505ece1";
|
7
|
+
export declare const obligationOwnerCapType = "0xf95b06141ed4a174f239417323bde3f209b972f5930d8521ea38a52aff3a6ddf::lending_market::ObligationOwnerCap<0xf95b06141ed4a174f239417323bde3f209b972f5930d8521ea38a52aff3a6ddf";
|
8
|
+
export declare const poolsKey = "poolsInfo";
|
@@ -0,0 +1,18 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.poolsKey = exports.obligationOwnerCapType = exports.mainMarket = exports.obligationType = exports.packageId = exports.platform = exports.platformId = void 0;
|
4
|
+
exports.platformId = 'suilend';
|
5
|
+
exports.platform = {
|
6
|
+
id: exports.platformId,
|
7
|
+
name: 'Suilend',
|
8
|
+
image: 'https://sonar.watch/img/platforms/suilend.png',
|
9
|
+
defiLlamaId: 'suilend', // from https://defillama.com/docs/api
|
10
|
+
website: 'https://www.suilend.fi/',
|
11
|
+
twitter: 'https://twitter.com/suilendprotocol',
|
12
|
+
};
|
13
|
+
exports.packageId = '0xf95b06141ed4a174f239417323bde3f209b972f5930d8521ea38a52aff3a6ddf';
|
14
|
+
exports.obligationType = `${exports.packageId}::obligation::Obligation`;
|
15
|
+
exports.mainMarket = '0x84030d26d85eaa7035084a057f2f11f701b7e2e4eda87551becbc7c97505ece1';
|
16
|
+
exports.obligationOwnerCapType = `${exports.packageId}::lending_market::ObligationOwnerCap<${exports.packageId}`;
|
17
|
+
exports.poolsKey = 'poolsInfo';
|
18
|
+
//# sourceMappingURL=constants.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/suilend/constants.ts"],"names":[],"mappings":";;;AAEa,QAAA,UAAU,GAAG,SAAS,CAAC;AACvB,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,SAAS;IACf,KAAK,EAAE,+CAA+C;IACtD,WAAW,EAAE,SAAS,EAAE,sCAAsC;IAC9D,OAAO,EAAE,yBAAyB;IAClC,OAAO,EAAE,qCAAqC;CAC/C,CAAC;AAEW,QAAA,SAAS,GACpB,oEAAoE,CAAC;AAE1D,QAAA,cAAc,GAAG,GAAG,iBAAS,0BAA0B,CAAC;AACxD,QAAA,UAAU,GACrB,oEAAoE,CAAC;AAE1D,QAAA,sBAAsB,GAAG,GAAG,iBAAS,wCAAwC,iBAAS,EAAE,CAAC;AACzF,QAAA,QAAQ,GAAG,WAAW,CAAC"}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
exports.fetchers = exports.jobs = exports.platforms = void 0;
|
7
|
+
const constants_1 = require("./constants");
|
8
|
+
const obligationsFetcher_1 = __importDefault(require("./obligationsFetcher"));
|
9
|
+
const marketsJob_1 = __importDefault(require("./marketsJob"));
|
10
|
+
exports.platforms = [constants_1.platform];
|
11
|
+
exports.jobs = [marketsJob_1.default];
|
12
|
+
exports.fetchers = [obligationsFetcher_1.default];
|
13
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/suilend/index.ts"],"names":[],"mappings":";;;;;;AAGA,2CAAuC;AACvC,8EAAsD;AACtD,8DAAsC;AAEzB,QAAA,SAAS,GAAe,CAAC,oBAAQ,CAAC,CAAC;AACnC,QAAA,IAAI,GAAU,CAAC,oBAAU,CAAC,CAAC;AAC3B,QAAA,QAAQ,GAAc,CAAC,4BAAkB,CAAC,CAAC"}
|
@@ -0,0 +1,45 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
|
+
});
|
10
|
+
};
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
+
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
13
|
+
const clients_1 = require("../../utils/clients");
|
14
|
+
const multiGetObjects_1 = require("../../utils/sui/multiGetObjects");
|
15
|
+
const constants_1 = require("./constants");
|
16
|
+
const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
17
|
+
const client = (0, clients_1.getClientSui)();
|
18
|
+
const objects = yield (0, multiGetObjects_1.multiGetObjects)(client, [constants_1.mainMarket]);
|
19
|
+
const poolsRewardsInfo = [];
|
20
|
+
for (const object of objects) {
|
21
|
+
if (!object.data || !object.data.content)
|
22
|
+
continue;
|
23
|
+
const { fields } = object.data.content;
|
24
|
+
const { reserves } = fields;
|
25
|
+
for (const reserve of reserves) {
|
26
|
+
const poolsRewards = reserve.fields.deposits_pool_reward_manager.fields.pool_rewards;
|
27
|
+
for (const poolReward of poolsRewards)
|
28
|
+
poolsRewardsInfo.push({
|
29
|
+
poolId: poolReward.fields.id.id,
|
30
|
+
rewardMint: poolReward.fields.coin_type.fields.name,
|
31
|
+
});
|
32
|
+
}
|
33
|
+
}
|
34
|
+
yield cache.setItem(constants_1.poolsKey, poolsRewardsInfo, {
|
35
|
+
prefix: constants_1.platformId,
|
36
|
+
networkId: portfolio_core_1.NetworkId.sui,
|
37
|
+
});
|
38
|
+
});
|
39
|
+
const job = {
|
40
|
+
id: `${constants_1.platformId}-markets`,
|
41
|
+
executor,
|
42
|
+
label: 'normal',
|
43
|
+
};
|
44
|
+
exports.default = job;
|
45
|
+
//# sourceMappingURL=marketsJob.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"marketsJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/suilend/marketsJob.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+DAAuD;AAGvD,iDAAmD;AACnD,qEAAkE;AAClE,2CAA+D;AAG/D,MAAM,QAAQ,GAAgB,CAAO,KAAY,EAAE,EAAE;IACnD,MAAM,MAAM,GAAG,IAAA,sBAAY,GAAE,CAAC;IAC9B,MAAM,OAAO,GAAG,MAAM,IAAA,iCAAe,EAAgB,MAAM,EAAE,CAAC,sBAAU,CAAC,CAAC,CAAC;IAE3E,MAAM,gBAAgB,GAAiB,EAAE,CAAC;IAC1C,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC7B,IAAI,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO;YAAE,SAAS;QACnD,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC;QACvC,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,CAAC;QAE5B,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;YAC/B,MAAM,YAAY,GAChB,OAAO,CAAC,MAAM,CAAC,4BAA4B,CAAC,MAAM,CAAC,YAAY,CAAC;YAClE,KAAK,MAAM,UAAU,IAAI,YAAY;gBACnC,gBAAgB,CAAC,IAAI,CAAC;oBACpB,MAAM,EAAE,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE;oBAC/B,UAAU,EAAE,UAAU,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI;iBACpD,CAAC,CAAC;QACP,CAAC;IACH,CAAC;IAED,MAAM,KAAK,CAAC,OAAO,CAAC,oBAAQ,EAAE,gBAAgB,EAAE;QAC9C,MAAM,EAAE,sBAAU;QAClB,SAAS,EAAE,0BAAS,CAAC,GAAG;KACzB,CAAC,CAAC;AACL,CAAC,CAAA,CAAC;AAEF,MAAM,GAAG,GAAQ;IACf,EAAE,EAAE,GAAG,sBAAU,UAAU;IAC3B,QAAQ;IACR,KAAK,EAAE,QAAQ;CAChB,CAAC;AACF,kBAAe,GAAG,CAAC"}
|
@@ -0,0 +1,149 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
|
+
});
|
10
|
+
};
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
13
|
+
};
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
15
|
+
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
16
|
+
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
17
|
+
const constants_1 = require("./constants");
|
18
|
+
const clients_1 = require("../../utils/clients");
|
19
|
+
const getOwnedObjects_1 = require("../../utils/sui/getOwnedObjects");
|
20
|
+
const multiGetObjects_1 = require("../../utils/sui/multiGetObjects");
|
21
|
+
const tokenPriceToAssetTokens_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetTokens"));
|
22
|
+
const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
23
|
+
const client = (0, clients_1.getClientSui)();
|
24
|
+
const suilendObjects = yield (0, getOwnedObjects_1.getOwnedObjects)(client, owner, {
|
25
|
+
filter: { Package: constants_1.packageId },
|
26
|
+
});
|
27
|
+
const mints = new Set();
|
28
|
+
const rewardsInfo = yield cache.getItem(constants_1.poolsKey, {
|
29
|
+
prefix: constants_1.platformId,
|
30
|
+
networkId: portfolio_core_1.NetworkId.sui,
|
31
|
+
});
|
32
|
+
const rewardInfoById = new Map();
|
33
|
+
if (rewardsInfo)
|
34
|
+
rewardsInfo.forEach((rI) => {
|
35
|
+
rewardInfoById.set(rI.poolId, rI.rewardMint);
|
36
|
+
mints.add(rI.rewardMint);
|
37
|
+
});
|
38
|
+
const obligationsId = [];
|
39
|
+
for (const object of suilendObjects) {
|
40
|
+
const { data } = object;
|
41
|
+
if (!data || !data.content)
|
42
|
+
continue;
|
43
|
+
const { type } = data.content;
|
44
|
+
if (!type || !type.startsWith(constants_1.obligationOwnerCapType))
|
45
|
+
continue;
|
46
|
+
const fields = data.content.fields;
|
47
|
+
if (fields.obligation_id)
|
48
|
+
obligationsId.push(fields.obligation_id);
|
49
|
+
}
|
50
|
+
const obligationsObjects = yield (0, multiGetObjects_1.multiGetObjects)(client, obligationsId);
|
51
|
+
const borrowedAssets = [];
|
52
|
+
const borrowedYields = [];
|
53
|
+
const suppliedAssets = [];
|
54
|
+
const suppliedYields = [];
|
55
|
+
const rewardAssets = [];
|
56
|
+
obligationsObjects.forEach((obj) => {
|
57
|
+
if (obj.data && obj.data.content) {
|
58
|
+
obj.data.content.fields.deposits.forEach((dep) => mints.add(dep.fields.coin_type.fields.name));
|
59
|
+
obj.data.content.fields.borrows.forEach((bor) => mints.add(bor.fields.coin_type.fields.name));
|
60
|
+
}
|
61
|
+
});
|
62
|
+
const tokenPriceById = yield cache.getTokenPricesAsMap(Array.from(mints), portfolio_core_1.NetworkId.sui);
|
63
|
+
for (const obligation of obligationsObjects) {
|
64
|
+
const { data } = obligation;
|
65
|
+
if (!data || !data.content)
|
66
|
+
continue;
|
67
|
+
const { deposits, borrows, user_reward_managers: rewardManagers, } = data.content.fields;
|
68
|
+
for (const deposit of deposits) {
|
69
|
+
const { fields } = deposit;
|
70
|
+
const tokenPrice = tokenPriceById.get((0, portfolio_core_1.formatTokenAddress)(fields.coin_type.fields.name, portfolio_core_1.NetworkId.sui));
|
71
|
+
if (!tokenPrice)
|
72
|
+
continue;
|
73
|
+
const amount = new bignumber_js_1.default(fields.deposited_ctoken_amount).dividedBy(Math.pow(10, tokenPrice.decimals));
|
74
|
+
const price = new bignumber_js_1.default(fields.market_value.fields.value)
|
75
|
+
.dividedBy(Math.pow(10, 18))
|
76
|
+
.dividedBy(amount);
|
77
|
+
suppliedAssets.push(...(0, tokenPriceToAssetTokens_1.default)(tokenPrice.address, amount.toNumber(), portfolio_core_1.NetworkId.sui, tokenPrice, price.toNumber()));
|
78
|
+
}
|
79
|
+
for (const borrow of borrows) {
|
80
|
+
const { fields } = borrow;
|
81
|
+
const tokenPrice = tokenPriceById.get((0, portfolio_core_1.formatTokenAddress)(fields.coin_type.fields.name, portfolio_core_1.NetworkId.sui));
|
82
|
+
if (!tokenPrice)
|
83
|
+
continue;
|
84
|
+
const amount = new bignumber_js_1.default(fields.borrowed_amount.fields.value).dividedBy(Math.pow(10, 24));
|
85
|
+
if (amount.isZero())
|
86
|
+
continue;
|
87
|
+
const price = new bignumber_js_1.default(fields.market_value.fields.value)
|
88
|
+
.dividedBy(Math.pow(10, 18))
|
89
|
+
.dividedBy(amount);
|
90
|
+
borrowedAssets.push(...(0, tokenPriceToAssetTokens_1.default)(tokenPrice.address, amount.toNumber(), portfolio_core_1.NetworkId.sui, tokenPrice, price.toNumber()));
|
91
|
+
}
|
92
|
+
const rewardAmountByMint = new Map();
|
93
|
+
for (const rewardManager of rewardManagers) {
|
94
|
+
for (const reward of rewardManager.fields.rewards) {
|
95
|
+
const rewardMint = rewardInfoById.get(reward.fields.pool_reward_id);
|
96
|
+
if (!rewardMint)
|
97
|
+
continue;
|
98
|
+
const amount = new bignumber_js_1.default(rewardManager.fields.share)
|
99
|
+
.times(new bignumber_js_1.default(reward.fields.cumulative_rewards_per_share.fields.value))
|
100
|
+
.dividedBy(Math.pow(10, 18));
|
101
|
+
if (amount.isZero())
|
102
|
+
continue;
|
103
|
+
const previousAmount = rewardAmountByMint.get(rewardMint);
|
104
|
+
if (previousAmount) {
|
105
|
+
rewardAmountByMint.set(rewardMint, previousAmount.plus(amount));
|
106
|
+
}
|
107
|
+
else {
|
108
|
+
rewardAmountByMint.set(rewardMint, amount);
|
109
|
+
}
|
110
|
+
}
|
111
|
+
}
|
112
|
+
rewardAmountByMint.forEach((amount, mint) => {
|
113
|
+
const tokenPrice = tokenPriceById.get((0, portfolio_core_1.formatTokenAddress)(mint, portfolio_core_1.NetworkId.sui));
|
114
|
+
if (tokenPrice)
|
115
|
+
rewardAssets.push(...(0, tokenPriceToAssetTokens_1.default)(tokenPrice.address, amount.dividedBy(Math.pow(10, tokenPrice.decimals)).toNumber(), portfolio_core_1.NetworkId.sui, tokenPrice));
|
116
|
+
});
|
117
|
+
}
|
118
|
+
if (suppliedAssets.length === 0 && borrowedAssets.length === 0)
|
119
|
+
return [];
|
120
|
+
const { borrowedValue, suppliedValue, value, healthRatio, rewardValue } = (0, portfolio_core_1.getElementLendingValues)(suppliedAssets, borrowedAssets, rewardAssets);
|
121
|
+
const element = {
|
122
|
+
type: portfolio_core_1.PortfolioElementType.borrowlend,
|
123
|
+
networkId: portfolio_core_1.NetworkId.sui,
|
124
|
+
platformId: constants_1.platformId,
|
125
|
+
label: 'Lending',
|
126
|
+
value,
|
127
|
+
data: {
|
128
|
+
borrowedAssets,
|
129
|
+
borrowedValue,
|
130
|
+
borrowedYields,
|
131
|
+
suppliedAssets,
|
132
|
+
suppliedValue,
|
133
|
+
suppliedYields,
|
134
|
+
collateralRatio: null,
|
135
|
+
healthRatio,
|
136
|
+
rewardAssets,
|
137
|
+
rewardValue,
|
138
|
+
value,
|
139
|
+
},
|
140
|
+
};
|
141
|
+
return [element];
|
142
|
+
});
|
143
|
+
const fetcher = {
|
144
|
+
id: `${constants_1.platformId}-obligations`,
|
145
|
+
networkId: portfolio_core_1.NetworkId.sui,
|
146
|
+
executor,
|
147
|
+
};
|
148
|
+
exports.default = fetcher;
|
149
|
+
//# sourceMappingURL=obligationsFetcher.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"obligationsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/suilend/obligationsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAQoC;AACpC,gEAAqC;AAGrC,2CAKqB;AACrB,iDAAmD;AACnD,qEAAkE;AAElE,qEAAkE;AAClE,uGAA+E;AAE/E,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,MAAM,GAAG,IAAA,sBAAY,GAAE,CAAC;IAE9B,MAAM,cAAc,GAAG,MAAM,IAAA,iCAAe,EAAC,MAAM,EAAE,KAAK,EAAE;QAC1D,MAAM,EAAE,EAAE,OAAO,EAAE,qBAAS,EAAE;KAC/B,CAAC,CAAC;IAEH,MAAM,KAAK,GAAgB,IAAI,GAAG,EAAE,CAAC;IACrC,MAAM,WAAW,GAAG,MAAM,KAAK,CAAC,OAAO,CAAe,oBAAQ,EAAE;QAC9D,MAAM,EAAE,sBAAU;QAClB,SAAS,EAAE,0BA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AY,CAAC,IAAI,CACf,GAAG,IAAA,iCAAuB,EACxB,UAAU,CAAC,OAAO,EAClB,MAAM,CAAC,SAAS,CAAC,SAAA,EAAE,EAAI,UAAU,CAAC,QAAQ,CAAA,CAAC,CAAC,QAAQ,EAAE,EACtD,0BAAS,CAAC,GAAG,EACb,UAAU,CACX,CACF,CAAC;QACN,CAAC,CAAC,CAAC;IACL,CAAC;IAED,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAE1E,MAAM,EAAE,aAAa,EAAE,aAAa,EAAE,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,GACrE,IAAA,wCAAuB,EAAC,cAAc,EAAE,cAAc,EAAE,YAAY,CAAC,CAAC;IAExE,MAAM,OAAO,GAAqB;QAChC,IAAI,EAAE,qCAAoB,CAAC,UAAU;QACrC,SAAS,EAAE,0BAAS,CAAC,GAAG;QACxB,UAAU,EAAV,sBAAU;QACV,KAAK,EAAE,SAAS;QAChB,KAAK;QACL,IAAI,EAAE;YACJ,cAAc;YACd,aAAa;YACb,cAAc;YACd,cAAc;YACd,aAAa;YACb,cAAc;YACd,eAAe,EAAE,IAAI;YACrB,WAAW;YACX,YAAY;YACZ,WAAW;YACX,KAAK;SACN;KACF,CAAC;IACF,OAAO,CAAC,OAAO,CAAC,CAAC;AACnB,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,cAAc;IAC/B,SAAS,EAAE,0BAAS,CAAC,GAAG;IACxB,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|
@@ -0,0 +1,137 @@
|
|
1
|
+
import { ParsedData } from '../../utils/sui/types';
|
2
|
+
export type ObligationCapFields = {
|
3
|
+
id: ID;
|
4
|
+
obligation_id: string;
|
5
|
+
};
|
6
|
+
export type Obligation = {
|
7
|
+
id: ID;
|
8
|
+
lending_market_id: string;
|
9
|
+
deposits: ParsedData<Deposit>[];
|
10
|
+
borrows: ParsedData<Borrow>[];
|
11
|
+
deposited_value_usd: ParsedData<Value>;
|
12
|
+
allowed_borrow_value_usd: ParsedData<Value>;
|
13
|
+
unhealthy_borrow_value_usd: ParsedData<Value>;
|
14
|
+
super_unhealthy_borrow_value_usd: ParsedData<Value>;
|
15
|
+
unweighted_borrowed_value_usd: ParsedData<Value>;
|
16
|
+
weighted_borrowed_value_usd: ParsedData<Value>;
|
17
|
+
weighted_borrowed_value_upper_bound_usd: ParsedData<Value>;
|
18
|
+
borrowing_isolated_asset: boolean;
|
19
|
+
user_reward_managers: ParsedData<UserRewardManager>[];
|
20
|
+
bad_debt_usd: ParsedData<Value>;
|
21
|
+
closable: boolean;
|
22
|
+
};
|
23
|
+
export type Deposit = {
|
24
|
+
attributed_borrow_value: ParsedData<Value>;
|
25
|
+
coin_type: ParsedData<Name>;
|
26
|
+
deposited_ctoken_amount: string;
|
27
|
+
market_value: ParsedData<Value>;
|
28
|
+
user_reward_manager_index: string;
|
29
|
+
reserve_array_index: string;
|
30
|
+
};
|
31
|
+
export type Borrow = {
|
32
|
+
coin_type: ParsedData<Name>;
|
33
|
+
borrowed_amount: ParsedData<Value>;
|
34
|
+
cumulative_borrow_rate: ParsedData<Value>;
|
35
|
+
market_value: ParsedData<Value>;
|
36
|
+
user_reward_manager_index: string;
|
37
|
+
reserve_array_index: string;
|
38
|
+
};
|
39
|
+
export type UserRewardManager = {
|
40
|
+
last_update_time_ms: string;
|
41
|
+
pool_reward_manager_id: string;
|
42
|
+
rewards: ParsedData<Reward>[];
|
43
|
+
share: string;
|
44
|
+
};
|
45
|
+
export type Reward = {
|
46
|
+
cumulative_rewards_per_share: ParsedData<Value>;
|
47
|
+
earned_rewards: ParsedData<Value>;
|
48
|
+
pool_reward_id: string;
|
49
|
+
};
|
50
|
+
export type LendingMarket = {
|
51
|
+
id: ID;
|
52
|
+
version: string;
|
53
|
+
reserves: ParsedData<Reserve>[];
|
54
|
+
};
|
55
|
+
export type Reserve = {
|
56
|
+
id: ID;
|
57
|
+
array_index: string;
|
58
|
+
attributed_borrow_value: ParsedData<Value>;
|
59
|
+
available_amount: string;
|
60
|
+
borrowed_amount: ParsedData<Value>;
|
61
|
+
borrows_pool_reward_manager: ParsedData<SPoolRewardManager>;
|
62
|
+
coin_type: ParsedData<Name>;
|
63
|
+
config: ParsedData<Config>;
|
64
|
+
ctoken_supply: string;
|
65
|
+
cumulative_borrow_rate: ParsedData<Value>;
|
66
|
+
deposits_pool_reward_manager: ParsedData<SPoolRewardManager>;
|
67
|
+
interest_last_update_timestamp_s: string;
|
68
|
+
lending_market_id: string;
|
69
|
+
mint_decimals: number;
|
70
|
+
price: ParsedData<Value>;
|
71
|
+
price_identifier: ParsedData<PriceIdentifier>;
|
72
|
+
price_last_update_timestamp_s: string;
|
73
|
+
smoothed_price: ParsedData<Value>;
|
74
|
+
unclaimed_spread_fees: ParsedData<Value>;
|
75
|
+
};
|
76
|
+
export type SPoolRewardManager = {
|
77
|
+
id: ID;
|
78
|
+
last_update_time_ms: string;
|
79
|
+
pool_rewards: ParsedData<PoolReward>[];
|
80
|
+
total_shares: string;
|
81
|
+
};
|
82
|
+
export type PoolReward = {
|
83
|
+
id: ID;
|
84
|
+
additional_fields: ParsedData<AdditionalFields>;
|
85
|
+
allocated_rewards: ParsedData<Value>;
|
86
|
+
coin_type: ParsedData<Name>;
|
87
|
+
cumulative_rewards_per_share: ParsedData<Value>;
|
88
|
+
end_time_ms: string;
|
89
|
+
num_user_reward_managers: string;
|
90
|
+
pool_reward_manager_id: string;
|
91
|
+
start_time_ms: string;
|
92
|
+
total_rewards: string;
|
93
|
+
};
|
94
|
+
export type AdditionalFields = {
|
95
|
+
id: ID;
|
96
|
+
size: string;
|
97
|
+
};
|
98
|
+
export type Config = {
|
99
|
+
element: ParsedData<Element>;
|
100
|
+
};
|
101
|
+
export type Element = {
|
102
|
+
additional_fields: ParsedData<AdditionalFields>;
|
103
|
+
borrow_fee_bps: string;
|
104
|
+
borrow_limit: string;
|
105
|
+
borrow_limit_usd: string;
|
106
|
+
borrow_weight_bps: string;
|
107
|
+
close_attributed_borrow_limit_usd: string;
|
108
|
+
close_ltv_pct: number;
|
109
|
+
deposit_limit: string;
|
110
|
+
deposit_limit_usd: string;
|
111
|
+
interest_rate_aprs: string[];
|
112
|
+
interest_rate_utils: number[];
|
113
|
+
isolated: boolean;
|
114
|
+
liquidation_bonus_bps: string;
|
115
|
+
max_close_ltv_pct: number;
|
116
|
+
max_liquidation_bonus_bps: string;
|
117
|
+
open_attributed_borrow_limit_usd: string;
|
118
|
+
open_ltv_pct: number;
|
119
|
+
protocol_liquidation_fee_bps: string;
|
120
|
+
spread_fee_bps: string;
|
121
|
+
};
|
122
|
+
export type PriceIdentifier = {
|
123
|
+
bytes: number[];
|
124
|
+
};
|
125
|
+
export type Value = {
|
126
|
+
value: string;
|
127
|
+
};
|
128
|
+
export type Name = {
|
129
|
+
name: string;
|
130
|
+
};
|
131
|
+
export type ID = {
|
132
|
+
id: string;
|
133
|
+
};
|
134
|
+
export type RewardInfo = {
|
135
|
+
poolId: string;
|
136
|
+
rewardMint: string;
|
137
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/suilend/types.ts"],"names":[],"mappings":""}
|