@sonarwatch/portfolio-plugins 0.14.153 → 0.14.154
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/CHANGELOG.md
CHANGED
@@ -2,6 +2,10 @@
|
|
2
2
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
4
4
|
|
5
|
+
## [0.14.154](https://github.com/sonarwatch/portfolio/compare/plugins-0.14.153...plugins-0.14.154) (2025-03-25)
|
6
|
+
|
7
|
+
|
8
|
+
|
5
9
|
## [0.14.153](https://github.com/sonarwatch/portfolio/compare/plugins-0.14.152...plugins-0.14.153) (2025-03-25)
|
6
10
|
|
7
11
|
|
package/package.json
CHANGED
@@ -33,6 +33,8 @@ const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
|
33
33
|
dataSize: 355,
|
34
34
|
},
|
35
35
|
]);
|
36
|
+
const tokenPriceById = yield cache.getTokenPricesAsMap(pools.map((p) => p.mint.toString()), portfolio_core_1.NetworkId.solana);
|
37
|
+
const items = [];
|
36
38
|
yield cache.setItem(constants_1.lendingPoolsCacheKey, pools.map((pool) => {
|
37
39
|
const utilization = pool.depositedFunds.isGreaterThan(0)
|
38
40
|
? new bignumber_js_1.default(pool.borrowedFunds)
|
@@ -44,12 +46,43 @@ const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
|
44
46
|
.dividedBy(Math.pow(2, 60))
|
45
47
|
.multipliedBy((0, helpers_1.rateFactor)(utilization));
|
46
48
|
const supplyApy = borrowApy.multipliedBy(utilization);
|
49
|
+
const tokenPrice = tokenPriceById.get(pool.mint.toString());
|
50
|
+
if (tokenPrice) {
|
51
|
+
const blRate = {
|
52
|
+
borrowedAmount: pool.borrowedFunds
|
53
|
+
.dividedBy(Math.pow(10, tokenPrice.decimals))
|
54
|
+
.toNumber(),
|
55
|
+
depositedAmount: pool.depositedFunds
|
56
|
+
.dividedBy(Math.pow(10, tokenPrice.decimals))
|
57
|
+
.toNumber(),
|
58
|
+
borrowYield: {
|
59
|
+
apr: (0, portfolio_core_1.apyToApr)(borrowApy.toNumber()),
|
60
|
+
apy: borrowApy.toNumber(),
|
61
|
+
},
|
62
|
+
depositYield: {
|
63
|
+
apr: (0, portfolio_core_1.apyToApr)(supplyApy.toNumber()),
|
64
|
+
apy: supplyApy.toNumber(),
|
65
|
+
},
|
66
|
+
utilizationRatio: utilization,
|
67
|
+
platformId: constants_1.platformId,
|
68
|
+
tokenAddress: pool.mint.toString(),
|
69
|
+
ref: pool.pubkey.toString(),
|
70
|
+
};
|
71
|
+
items.push({
|
72
|
+
key: `${pool.pubkey.toString()}-${pool.mint.toString()}`,
|
73
|
+
value: blRate,
|
74
|
+
});
|
75
|
+
}
|
47
76
|
return Object.assign(Object.assign({}, pool), { supplyApy,
|
48
77
|
borrowApy });
|
49
78
|
}), {
|
50
79
|
prefix: constants_1.platformId,
|
51
80
|
networkId: portfolio_core_1.NetworkId.solana,
|
52
81
|
});
|
82
|
+
yield cache.setItems(items, {
|
83
|
+
prefix: portfolio_core_1.borrowLendRatesPrefix,
|
84
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
85
|
+
});
|
53
86
|
});
|
54
87
|
const job = {
|
55
88
|
id: `${constants_1.platformId}-lending-pools`,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"lendingPoolsJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/defituna/lendingPoolsJob.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,gEAAqC;AACrC,+
|
1
|
+
{"version":3,"file":"lendingPoolsJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/defituna/lendingPoolsJob.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,gEAAqC;AACrC,+DAKoC;AAGpC,2CAAgF;AAChF,+CAA8D;AAC9D,iDAAsD;AACtD,uCAAwC;AACxC,uCAAuC;AAEvC,MAAM,eAAe,GAAG,QAAQ,CAAC;AA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CAAC,MAAM;KAC5B,CAAC,CAAC;AACL,CAAC,CAAA,CAAC;AAEF,MAAM,GAAG,GAAQ;IACf,EAAE,EAAE,GAAG,sBAAU,gBAAgB;IACjC,QAAQ;IACR,MAAM,EAAE,CAAC,QAAQ,CAAC;CACnB,CAAC;AAEF,kBAAe,GAAG,CAAC"}
|
@@ -59,7 +59,7 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
59
59
|
new bn_js_1.default(ledger.interest_repaid.array.reverse()).toNumber(),
|
60
60
|
});
|
61
61
|
element.addBorrowedWeight((0, helpers_1.bytesToNumberLE)(new Uint8Array(account.weight_matrix[i][0].array)));
|
62
|
-
const apy = (0, helpers_1.bytesToNumberLE)(new Uint8Array(ledger.apy.array)) /
|
62
|
+
const apy = (0, helpers_1.bytesToNumberLE)(new Uint8Array(ledger.apy.array)) / 1000000;
|
63
63
|
element.addBorrowedYield([
|
64
64
|
{
|
65
65
|
apy,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"loansFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/loopscale/loansFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAAiE;AACjE,6CAA4C;AAC5C,kDAAuB;AAEvB,2CAA6D;AAE7D,iDAAsD;AACtD,gFAA6E;AAC7E,kEAA+D;AAC/D,uCAAuC;AACvC,uCAA4C;AAE5C,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,UAAU,GAAG,IAAA,yBAAe,GAAE,CAAC;IACrC,MAAM,QAAQ,GAAG,MAAM,qBAAS,CAAC,KAAK,CACpC,UAAU,EACV,oBAAU,EACV,8BAAkB,CACnB;SACE,SAAS,CAAC,sBAAsB,EAAE,CAAC,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;SACvE,SAAS,CAAC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