@sonarwatch/portfolio-plugins 0.12.170 → 0.12.171
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +4 -0
- package/package.json +1 -1
- package/src/Cache.d.ts +2 -1
- package/src/Cache.js +3 -3
- package/src/Cache.js.map +1 -1
- package/src/TokenPriceMap.d.ts +8 -0
- package/src/TokenPriceMap.js +21 -0
- package/src/TokenPriceMap.js.map +1 -0
- package/src/index.js +16 -0
- package/src/index.js.map +1 -1
- package/src/plugins/adrastea/constants.d.ts +9 -0
- package/src/plugins/adrastea/constants.js +19 -0
- package/src/plugins/adrastea/constants.js.map +1 -0
- package/src/plugins/adrastea/index.d.ts +6 -0
- package/src/plugins/adrastea/index.js +13 -0
- package/src/plugins/adrastea/index.js.map +1 -0
- package/src/plugins/adrastea/positionsFetcher.js +61 -0
- package/src/plugins/adrastea/positionsFetcher.js.map +1 -0
- package/src/plugins/adrastea/positionsJob.d.ts +3 -0
- package/src/plugins/adrastea/positionsJob.js +53 -0
- package/src/plugins/adrastea/positionsJob.js.map +1 -0
- package/src/plugins/adrastea/structs.d.ts +45 -0
- package/src/plugins/adrastea/structs.js +44 -0
- package/src/plugins/adrastea/structs.js.map +1 -0
- package/src/plugins/adrastea/types.d.ts +4 -0
- package/src/plugins/adrastea/types.js +3 -0
- package/src/plugins/adrastea/types.js.map +1 -0
- package/src/plugins/banx/stakingFetcher.js +11 -15
- package/src/plugins/banx/stakingFetcher.js.map +1 -1
- package/src/plugins/bluemove/constants.d.ts +7 -0
- package/src/plugins/bluemove/constants.js +17 -0
- package/src/plugins/bluemove/constants.js.map +1 -0
- package/src/plugins/bluemove/index.d.ts +6 -0
- package/src/plugins/bluemove/index.js +12 -0
- package/src/plugins/bluemove/index.js.map +1 -0
- package/src/plugins/bluemove/poolsJob.d.ts +3 -0
- package/src/plugins/bluemove/poolsJob.js +97 -0
- package/src/plugins/bluemove/poolsJob.js.map +1 -0
- package/src/plugins/bluemove/types.d.ts +21 -0
- package/src/plugins/bluemove/types.js +3 -0
- package/src/plugins/bluemove/types.js.map +1 -0
- package/src/plugins/cetus/clmmsFetcher.js +3 -3
- package/src/plugins/cetus/clmmsFetcher.js.map +1 -1
- package/src/plugins/cetus/constants.d.ts +4 -0
- package/src/plugins/cetus/constants.js +5 -1
- package/src/plugins/cetus/constants.js.map +1 -1
- package/src/plugins/cetus/dcaFetcher.js +77 -0
- package/src/plugins/cetus/dcaFetcher.js.map +1 -0
- package/src/plugins/cetus/farmsFetcher.js +2 -4
- package/src/plugins/cetus/farmsFetcher.js.map +1 -1
- package/src/plugins/cetus/index.js +8 -1
- package/src/plugins/cetus/index.js.map +1 -1
- package/src/plugins/cetus/limitFetcher.d.ts +3 -0
- package/src/plugins/cetus/limitFetcher.js +66 -0
- package/src/plugins/cetus/limitFetcher.js.map +1 -0
- package/src/plugins/cetus/types.d.ts +32 -0
- package/src/plugins/deepbook/constants.d.ts +3 -0
- package/src/plugins/deepbook/constants.js +4 -1
- package/src/plugins/deepbook/constants.js.map +1 -1
- package/src/plugins/deepbook/helpers.d.ts +4 -0
- package/src/plugins/deepbook/helpers.js +142 -0
- package/src/plugins/deepbook/helpers.js.map +1 -0
- package/src/plugins/deepbook/index.js +7 -2
- package/src/plugins/deepbook/index.js.map +1 -1
- package/src/plugins/deepbook/ordersFetcher.d.ts +3 -0
- package/src/plugins/deepbook/ordersFetcher.js +74 -0
- package/src/plugins/deepbook/ordersFetcher.js.map +1 -0
- package/src/plugins/deepbook/poolsJob.d.ts +3 -0
- package/src/plugins/deepbook/poolsJob.js +30 -0
- package/src/plugins/deepbook/poolsJob.js.map +1 -0
- package/src/plugins/deepbook/types.d.ts +12 -0
- package/src/plugins/deepbook/types.js +3 -0
- package/src/plugins/deepbook/types.js.map +1 -0
- package/src/plugins/flowx/stakingPoolFetcher.js +1 -1
- package/src/plugins/flowx/stakingPoolFetcher.js.map +1 -1
- package/src/plugins/flowx/stakingPoolV3Fetcher.js +1 -1
- package/src/plugins/flowx/stakingPoolV3Fetcher.js.map +1 -1
- package/src/plugins/foo/constants.d.ts +1 -1
- package/src/plugins/foo/constants.js +2 -2
- package/src/plugins/foo/constants.js.map +1 -1
- package/src/plugins/foo/index.js +2 -2
- package/src/plugins/foo/index.js.map +1 -1
- package/src/plugins/foo/marketsJob.js +3 -3
- package/src/plugins/foo/marketsJob.js.map +1 -1
- package/src/plugins/foo/positionsEthereumFetcher.d.ts +3 -0
- package/src/plugins/foo/positionsEthereumFetcher.js +33 -0
- package/src/plugins/foo/positionsEthereumFetcher.js.map +1 -0
- package/src/plugins/foo/positionsSolanaFetcher.js +10 -26
- package/src/plugins/foo/positionsSolanaFetcher.js.map +1 -1
- package/src/plugins/foo/positionsSuiFetcher.d.ts +3 -0
- package/src/plugins/foo/positionsSuiFetcher.js +46 -0
- package/src/plugins/foo/positionsSuiFetcher.js.map +1 -0
- package/src/plugins/foo/types.d.ts +5 -0
- package/src/plugins/foo/types.js +3 -0
- package/src/plugins/foo/types.js.map +1 -0
- package/src/plugins/francium/constants.d.ts +19 -0
- package/src/plugins/francium/constants.js +839 -0
- package/src/plugins/francium/constants.js.map +1 -0
- package/src/plugins/francium/helpers.d.ts +14 -0
- package/src/plugins/francium/helpers.js +85 -0
- package/src/plugins/francium/helpers.js.map +1 -0
- package/src/plugins/francium/index.d.ts +6 -0
- package/src/plugins/francium/index.js +13 -0
- package/src/plugins/francium/index.js.map +1 -0
- package/src/plugins/francium/lendingFetcher.d.ts +3 -0
- package/src/plugins/francium/lendingFetcher.js +70 -0
- package/src/plugins/francium/lendingFetcher.js.map +1 -0
- package/src/plugins/francium/lendingPoolJob.d.ts +3 -0
- package/src/plugins/francium/lendingPoolJob.js +49 -0
- package/src/plugins/francium/lendingPoolJob.js.map +1 -0
- package/src/plugins/francium/structs.d.ts +59 -0
- package/src/plugins/francium/structs.js +49 -0
- package/src/plugins/francium/structs.js.map +1 -0
- package/src/plugins/francium/tokens.d.ts +9 -0
- package/src/plugins/francium/tokens.js +524 -0
- package/src/plugins/francium/tokens.js.map +1 -0
- package/src/plugins/francium/types.d.ts +16 -0
- package/src/plugins/francium/types.js +3 -0
- package/src/plugins/francium/types.js.map +1 -0
- package/src/plugins/kamino/lendsFetcher.js +64 -167
- package/src/plugins/kamino/lendsFetcher.js.map +1 -1
- package/src/plugins/kriya/farmsFetcher.js +23 -48
- package/src/plugins/kriya/farmsFetcher.js.map +1 -1
- package/src/plugins/kriya/leverageVaultsFetcher.js +5 -5
- package/src/plugins/kriya/leverageVaultsFetcher.js.map +1 -1
- package/src/plugins/meteora/farmsFetcher.js +19 -68
- package/src/plugins/meteora/farmsFetcher.js.map +1 -1
- package/src/plugins/nxfinance/positionsFetcher.js +32 -80
- package/src/plugins/nxfinance/positionsFetcher.js.map +1 -1
- package/src/plugins/quarry/positionsFetcher.js +1 -1
- package/src/plugins/quarry/positionsFetcher.js.map +1 -1
- package/src/plugins/raydium/farmsFetcher.js +30 -74
- package/src/plugins/raydium/farmsFetcher.js.map +1 -1
- package/src/plugins/raydium/helpers.d.ts +3 -2
- package/src/plugins/raydium/helpers.js +5 -7
- package/src/plugins/raydium/helpers.js.map +1 -1
- package/src/plugins/raydium/index.js +1 -2
- package/src/plugins/raydium/index.js.map +1 -1
- package/src/plugins/raydium/lpTokensJob.js +1 -1
- package/src/plugins/raydium/lpTokensJob.js.map +1 -1
- package/src/plugins/stabble/constants.d.ts +8 -0
- package/src/plugins/stabble/constants.js +27 -0
- package/src/plugins/stabble/constants.js.map +1 -0
- package/src/plugins/stabble/filters.d.ts +3 -0
- package/src/plugins/stabble/filters.js +20 -0
- package/src/plugins/stabble/filters.js.map +1 -0
- package/src/plugins/stabble/index.d.ts +6 -0
- package/src/plugins/stabble/index.js +12 -0
- package/src/plugins/stabble/index.js.map +1 -0
- package/src/plugins/stabble/poolsJob.d.ts +3 -0
- package/src/plugins/stabble/poolsJob.js +84 -0
- package/src/plugins/stabble/poolsJob.js.map +1 -0
- package/src/plugins/stabble/stableIdl.d.ts +40 -0
- package/src/plugins/stabble/stableIdl.js +104 -0
- package/src/plugins/stabble/stableIdl.js.map +1 -0
- package/src/plugins/stabble/types.d.ts +40 -0
- package/src/plugins/stabble/types.js +3 -0
- package/src/plugins/stabble/types.js.map +1 -0
- package/src/plugins/stabble/weightedIdl.d.ts +40 -0
- package/src/plugins/stabble/weightedIdl.js +96 -0
- package/src/plugins/stabble/weightedIdl.js.map +1 -0
- package/src/utils/bitcoin/getBalance.js +1 -0
- package/src/utils/bitcoin/getBalance.js.map +1 -1
- package/src/utils/elementbuilder/AssetBuilder.d.ts +11 -0
- package/src/utils/elementbuilder/AssetBuilder.js +28 -0
- package/src/utils/elementbuilder/AssetBuilder.js.map +1 -0
- package/src/utils/elementbuilder/ElementBorrowlendBuilder.d.ts +27 -0
- package/src/utils/elementbuilder/ElementBorrowlendBuilder.js +110 -0
- package/src/utils/elementbuilder/ElementBorrowlendBuilder.js.map +1 -0
- package/src/utils/elementbuilder/ElementBuilder.d.ts +12 -0
- package/src/utils/elementbuilder/ElementBuilder.js +13 -0
- package/src/utils/elementbuilder/ElementBuilder.js.map +1 -0
- package/src/utils/elementbuilder/ElementLiquidityBuilder.d.ts +12 -0
- package/src/utils/elementbuilder/ElementLiquidityBuilder.js +42 -0
- package/src/utils/elementbuilder/ElementLiquidityBuilder.js.map +1 -0
- package/src/utils/elementbuilder/ElementMultipleBuilder.d.ts +13 -0
- package/src/utils/elementbuilder/ElementMultipleBuilder.js +40 -0
- package/src/utils/elementbuilder/ElementMultipleBuilder.js.map +1 -0
- package/src/utils/elementbuilder/ElementParams.d.ts +7 -0
- package/src/utils/elementbuilder/ElementParams.js +3 -0
- package/src/utils/elementbuilder/ElementParams.js.map +1 -0
- package/src/utils/elementbuilder/ElementRegistry.d.ts +17 -0
- package/src/utils/elementbuilder/ElementRegistry.js +49 -0
- package/src/utils/elementbuilder/ElementRegistry.js.map +1 -0
- package/src/utils/elementbuilder/LiquidityBuilder.d.ts +15 -0
- package/src/utils/elementbuilder/LiquidityBuilder.js +52 -0
- package/src/utils/elementbuilder/LiquidityBuilder.js.map +1 -0
- package/src/utils/elementbuilder/PortfolioAssetParams.d.ts +7 -0
- package/src/utils/elementbuilder/PortfolioAssetParams.js +3 -0
- package/src/utils/elementbuilder/PortfolioAssetParams.js.map +1 -0
- package/src/plugins/foo/positionsFetcher.js +0 -49
- package/src/plugins/foo/positionsFetcher.js.map +0 -1
- package/src/plugins/raydium/stakingFetcher.js +0 -50
- package/src/plugins/raydium/stakingFetcher.js.map +0 -1
- /package/src/plugins/{foo → adrastea}/positionsFetcher.d.ts +0 -0
- /package/src/plugins/{raydium/stakingFetcher.d.ts → cetus/dcaFetcher.d.ts} +0 -0
@@ -17,10 +17,10 @@ const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
|
17
17
|
const constants_1 = require("./constants");
|
18
18
|
const clients_1 = require("../../utils/clients");
|
19
19
|
const klend_1 = require("./structs/klend");
|
20
|
-
const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetToken"));
|
21
20
|
const solana_1 = require("../../utils/solana");
|
22
21
|
const pdas_1 = require("./helpers/pdas");
|
23
22
|
const common_1 = require("./helpers/common");
|
23
|
+
const ElementRegistry_1 = require("../../utils/elementbuilder/ElementRegistry");
|
24
24
|
const zeroAdressValue = '11111111111111111111111111111111';
|
25
25
|
const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
26
26
|
const client = (0, clients_1.getClientSolana)();
|
@@ -57,11 +57,7 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
57
57
|
});
|
58
58
|
if (!reserves)
|
59
59
|
return [];
|
60
|
-
const
|
61
|
-
const tokensPrices = yield cache.getTokenPrices(tokenAddresses, networkId);
|
62
|
-
const tokenPriceById = new Map();
|
63
|
-
tokensPrices.forEach((tP) => (tP ? tokenPriceById.set(tP.address, tP) : []));
|
64
|
-
const elements = [];
|
60
|
+
const elementRegistry = new ElementRegistry_1.ElementRegistry(portfolio_core_1.NetworkId.solana, constants_1.platformId);
|
65
61
|
// *************
|
66
62
|
// KLend : https://app.kamino.finance/lending
|
67
63
|
// *************
|
@@ -70,13 +66,10 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
70
66
|
if (!lendingAccount)
|
71
67
|
continue;
|
72
68
|
const lendingConfig = constants_1.lendingConfigs.get(lendingAccount.lendingMarket.toString());
|
73
|
-
const
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
const rewardAssets = [];
|
78
|
-
const suppliedLtvs = [];
|
79
|
-
const borrowedWeights = [];
|
69
|
+
const element = elementRegistry.addElementBorrowlend({
|
70
|
+
label: 'Lending',
|
71
|
+
name: lendingConfig === null || lendingConfig === void 0 ? void 0 : lendingConfig.name,
|
72
|
+
});
|
80
73
|
for (const deposit of lendingAccount.deposits) {
|
81
74
|
if (deposit.depositReserve.toString() === zeroAdressValue ||
|
82
75
|
deposit.depositedAmount.isLessThanOrEqualTo(0))
|
@@ -85,15 +78,15 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
85
78
|
const reserve = reserves[deposit.depositReserve.toString()];
|
86
79
|
if (!reserve)
|
87
80
|
continue;
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
81
|
+
element.addSuppliedAsset({
|
82
|
+
address: reserve.liquidity.mintPubkey,
|
83
|
+
amount: amountRaw
|
84
|
+
.dividedBy(new bignumber_js_1.default(10).pow(reserve.liquidity.mintDecimals))
|
85
|
+
.dividedBy(reserve.exchangeRate),
|
86
|
+
alreadyShifted: true,
|
87
|
+
});
|
88
|
+
element.addSuppliedLtv(reserve.config.liquidationThresholdPct / 100);
|
89
|
+
element.addSuppliedYield([
|
97
90
|
{ apr: reserve.supplyApr, apy: (0, portfolio_core_1.aprToApy)(reserve.supplyApr) },
|
98
91
|
]);
|
99
92
|
}
|
@@ -109,46 +102,16 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
109
102
|
const amountRaw = (0, common_1.sfToValue)(borrow.borrowedAmountSf
|
110
103
|
.multipliedBy(cumulativeBorrowRate)
|
111
104
|
.dividedBy(obligationCumulativeBorrowRate));
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
borrowedYields.push([
|
105
|
+
element.addBorrowedAsset({
|
106
|
+
address: reserve.liquidity.mintPubkey,
|
107
|
+
amount: amountRaw.dividedBy(new bignumber_js_1.default(10).pow(reserve.liquidity.mintDecimals)),
|
108
|
+
alreadyShifted: true,
|
109
|
+
});
|
110
|
+
element.addBorrowedWeight(Number(reserve.config.borrowFactorPct) / 100);
|
111
|
+
element.addBorrowedYield([
|
120
112
|
{ apr: -reserve.borrowApr, apy: -(0, portfolio_core_1.aprToApy)(reserve.borrowApr) },
|
121
113
|
]);
|
122
114
|
}
|
123
|
-
if (suppliedAssets.length !== 0 || borrowedAssets.length !== 0) {
|
124
|
-
const { borrowedValue, suppliedValue, value, healthRatio, rewardValue, } = (0, portfolio_core_1.getElementLendingValues)({
|
125
|
-
suppliedAssets,
|
126
|
-
borrowedAssets,
|
127
|
-
rewardAssets,
|
128
|
-
suppliedLtvs,
|
129
|
-
borrowedWeights,
|
130
|
-
});
|
131
|
-
elements.push({
|
132
|
-
type: portfolio_core_1.PortfolioElementType.borrowlend,
|
133
|
-
networkId,
|
134
|
-
platformId: constants_1.platformId,
|
135
|
-
label: 'Lending',
|
136
|
-
name: lendingConfig === null || lendingConfig === void 0 ? void 0 : lendingConfig.name,
|
137
|
-
value,
|
138
|
-
data: {
|
139
|
-
borrowedAssets,
|
140
|
-
borrowedValue,
|
141
|
-
borrowedYields,
|
142
|
-
suppliedAssets,
|
143
|
-
suppliedValue,
|
144
|
-
suppliedYields,
|
145
|
-
healthRatio,
|
146
|
-
rewardAssets,
|
147
|
-
rewardValue,
|
148
|
-
value,
|
149
|
-
},
|
150
|
-
});
|
151
|
-
}
|
152
115
|
}
|
153
116
|
}
|
154
117
|
// ******
|
@@ -163,13 +126,10 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
163
126
|
? `Multiply ${lendingConfig.name}`
|
164
127
|
: 'Multiply';
|
165
128
|
const elevationGroup = elevationGroups.get(multiplyAccount.elevationGroup);
|
166
|
-
const
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
const rewardAssets = [];
|
171
|
-
const suppliedLtvs = [];
|
172
|
-
const borrowedWeights = [];
|
129
|
+
const element = elementRegistry.addElementBorrowlend({
|
130
|
+
label: 'Lending',
|
131
|
+
name,
|
132
|
+
});
|
173
133
|
for (const deposit of multiplyAccount.deposits) {
|
174
134
|
if (deposit.depositReserve.toString() === zeroAdressValue ||
|
175
135
|
deposit.depositedAmount.isLessThanOrEqualTo(0))
|
@@ -178,19 +138,19 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
178
138
|
const reserve = reserves[deposit.depositReserve.toString()];
|
179
139
|
if (!reserve)
|
180
140
|
continue;
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
141
|
+
element.addSuppliedAsset({
|
142
|
+
address: reserve.liquidity.mintPubkey,
|
143
|
+
amount: amountRaw
|
144
|
+
.dividedBy(new bignumber_js_1.default(10).pow(reserve.liquidity.mintDecimals))
|
145
|
+
.dividedBy(reserve.exchangeRate),
|
146
|
+
alreadyShifted: true,
|
147
|
+
});
|
188
148
|
if (elevationGroup)
|
189
|
-
|
149
|
+
element.addSuppliedLtv(elevationGroup.liquidationThresholdPct / 100);
|
190
150
|
else {
|
191
|
-
|
151
|
+
element.addSuppliedLtv(0);
|
192
152
|
}
|
193
|
-
|
153
|
+
element.addSuppliedYield([
|
194
154
|
{ apr: reserve.supplyApr, apy: (0, portfolio_core_1.aprToApy)(reserve.supplyApr) },
|
195
155
|
]);
|
196
156
|
}
|
@@ -202,46 +162,16 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
202
162
|
const reserve = reserves[borrow.borrowReserve.toString()];
|
203
163
|
if (!reserve)
|
204
164
|
continue;
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
borrowedYields.push([
|
165
|
+
element.addBorrowedAsset({
|
166
|
+
address: reserve.liquidity.mintPubkey,
|
167
|
+
amount: amountRaw.dividedBy(new bignumber_js_1.default(10).pow(reserve.liquidity.mintDecimals)),
|
168
|
+
alreadyShifted: true,
|
169
|
+
});
|
170
|
+
element.addBorrowedWeight(Number(reserve.config.borrowFactorPct) / 100);
|
171
|
+
element.addBorrowedYield([
|
213
172
|
{ apr: -reserve.borrowApr, apy: -(0, portfolio_core_1.aprToApy)(reserve.borrowApr) },
|
214
173
|
]);
|
215
174
|
}
|
216
|
-
if (suppliedAssets.length !== 0 || borrowedAssets.length !== 0) {
|
217
|
-
const { borrowedValue, suppliedValue, value, rewardValue, healthRatio, } = (0, portfolio_core_1.getElementLendingValues)({
|
218
|
-
suppliedAssets,
|
219
|
-
borrowedAssets,
|
220
|
-
rewardAssets,
|
221
|
-
suppliedLtvs,
|
222
|
-
borrowedWeights,
|
223
|
-
});
|
224
|
-
elements.push({
|
225
|
-
type: portfolio_core_1.PortfolioElementType.borrowlend,
|
226
|
-
networkId,
|
227
|
-
platformId: constants_1.platformId,
|
228
|
-
label: 'Lending',
|
229
|
-
name,
|
230
|
-
value,
|
231
|
-
data: {
|
232
|
-
borrowedAssets,
|
233
|
-
borrowedValue,
|
234
|
-
borrowedYields,
|
235
|
-
suppliedAssets,
|
236
|
-
suppliedValue,
|
237
|
-
suppliedYields,
|
238
|
-
healthRatio,
|
239
|
-
rewardAssets,
|
240
|
-
rewardValue,
|
241
|
-
value,
|
242
|
-
},
|
243
|
-
});
|
244
|
-
}
|
245
175
|
}
|
246
176
|
// ******
|
247
177
|
// Leverage : https://app.kamino.finance/lending/leverage
|
@@ -249,13 +179,10 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
249
179
|
for (const leverageAccount of leverageAccounts) {
|
250
180
|
if (!leverageAccount)
|
251
181
|
continue;
|
252
|
-
const
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
const rewardAssets = [];
|
257
|
-
const suppliedLtvs = [];
|
258
|
-
const borrowedWeights = [];
|
182
|
+
const element = elementRegistry.addElementBorrowlend({
|
183
|
+
label: 'Lending',
|
184
|
+
name: 'Leverage',
|
185
|
+
});
|
259
186
|
for (const deposit of leverageAccount.deposits) {
|
260
187
|
if (deposit.depositReserve.toString() === zeroAdressValue ||
|
261
188
|
deposit.depositedAmount.isLessThanOrEqualTo(0))
|
@@ -264,15 +191,15 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
264
191
|
const reserve = reserves[deposit.depositReserve.toString()];
|
265
192
|
if (!reserve)
|
266
193
|
continue;
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
194
|
+
element.addSuppliedAsset({
|
195
|
+
address: reserve.liquidity.mintPubkey,
|
196
|
+
amount: amountRaw
|
197
|
+
.dividedBy(new bignumber_js_1.default(10).pow(reserve.liquidity.mintDecimals))
|
198
|
+
.dividedBy(reserve.exchangeRate),
|
199
|
+
alreadyShifted: true,
|
200
|
+
});
|
201
|
+
element.addSuppliedLtv(reserve.config.liquidationThresholdPct / 100);
|
202
|
+
element.addSuppliedYield([
|
276
203
|
{ apr: reserve.supplyApr, apy: (0, portfolio_core_1.aprToApy)(reserve.supplyApr) },
|
277
204
|
]);
|
278
205
|
}
|
@@ -284,48 +211,18 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
284
211
|
const reserve = reserves[borrow.borrowReserve.toString()];
|
285
212
|
if (!reserve)
|
286
213
|
continue;
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
borrowedYields.push([
|
214
|
+
element.addBorrowedAsset({
|
215
|
+
address: reserve.liquidity.mintPubkey,
|
216
|
+
amount: amountRaw.dividedBy(new bignumber_js_1.default(10).pow(reserve.liquidity.mintDecimals)),
|
217
|
+
alreadyShifted: true,
|
218
|
+
});
|
219
|
+
element.addBorrowedWeight(Number(reserve.config.borrowFactorPct) / 100);
|
220
|
+
element.addBorrowedYield([
|
295
221
|
{ apr: -reserve.borrowApr, apy: -(0, portfolio_core_1.aprToApy)(reserve.borrowApr) },
|
296
222
|
]);
|
297
223
|
}
|
298
|
-
if (suppliedAssets.length !== 0 || borrowedAssets.length !== 0) {
|
299
|
-
const { borrowedValue, suppliedValue, value, rewardValue } = (0, portfolio_core_1.getElementLendingValues)({
|
300
|
-
suppliedAssets,
|
301
|
-
borrowedAssets,
|
302
|
-
rewardAssets,
|
303
|
-
suppliedLtvs,
|
304
|
-
borrowedWeights,
|
305
|
-
});
|
306
|
-
elements.push({
|
307
|
-
type: portfolio_core_1.PortfolioElementType.borrowlend,
|
308
|
-
networkId,
|
309
|
-
platformId: constants_1.platformId,
|
310
|
-
label: 'Lending',
|
311
|
-
name: 'Leverage',
|
312
|
-
value,
|
313
|
-
data: {
|
314
|
-
borrowedAssets,
|
315
|
-
borrowedValue,
|
316
|
-
borrowedYields,
|
317
|
-
suppliedAssets,
|
318
|
-
suppliedValue,
|
319
|
-
suppliedYields,
|
320
|
-
healthRatio: null,
|
321
|
-
rewardAssets,
|
322
|
-
rewardValue,
|
323
|
-
value,
|
324
|
-
},
|
325
|
-
});
|
326
|
-
}
|
327
224
|
}
|
328
|
-
return
|
225
|
+
return elementRegistry.dump(cache);
|
329
226
|
});
|
330
227
|
const fetcher = {
|
331
228
|
id: `${constants_1.platformId}-deposits`,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"lendsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/kamino/lendsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;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nE,cAAc,CAAC,IAAI,CAAC;gBAClB,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,EAAE,CAAC,IAAA,yBAAQ,EAAC,OAAO,CAAC,SAAS,CAAC,EAAE;aAC/D,CAAC,CAAC;QACL,CAAC;QAED,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC/D,MAAM,EAAE,aAAa,EAAE,aAAa,EAAE,KAAK,EAAE,WAAW,EAAE,GACxD,IAAA,wCAAuB,EAAC;gBACtB,cAAc;gBACd,cAAc;gBACd,YAAY;gBACZ,YAAY;gBACZ,eAAe;aAChB,CAAC,CAAC;YAEL,QAAQ,CAAC,IAAI,CAAC;gBACZ,IAAI,EAAE,qCAAoB,CAAC,UAAU;gBACrC,SAAS;gBACT,UAAU,EAAV,sBAAU;gBACV,KAAK,EAAE,SAAS;gBAChB,IAAI,EAAE,UAAU;gBAChB,KAAK;gBACL,IAAI,EAAE;oBACJ,cAAc;oBACd,aAAa;oBACb,cAAc;oBACd,cAAc;oBACd,aAAa;oBACb,cAAc;oBACd,WAAW,EAAE,IAAI;oBACjB,YAAY;oBACZ,WAAW;oBACX,KAAK;iBACN;aACF,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,WAAW;IAC5B,SAAS,EAAE,0BAAS,CAAC,MAAM;IAC3B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|
1
|
+
{"version":3,"file":"lendsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/kamino/lendsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAAiE;AACjE,gEAAqC;AACrC,2CAMqB;AAGrB,iDAAsD;AACtD,2CAAmE;AAEnE,+CAAmE;AACnE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BAAgB,CAAC,SAAS,CACjD,MAAM,CAAC,uBAAuB,CAAC,MAAM,CACtC,CAAC;YACF,MAAM,OAAO,GAAG,QAAQ,CAAC,MAAM,CAAC,aAAa,CAAC,QAAQ,EAAE,CAAC,CAAC;YAC1D,IAAI,CAAC,OAAO;gBAAE,SAAS;YAEvB,OAAO,CAAC,gBAAgB,CAAC;gBACvB,OAAO,EAAE,OAAO,CAAC,SAAS,CAAC,UAAU;gBACrC,MAAM,EAAE,SAAS,CAAC,SAAS,CACzB,IAAI,sBAAS,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,SAAS,CAAC,YAAY,CAAC,CACtD;gBACD,cAAc,EAAE,IAAI;aACrB,CAAC,CAAC;YACH,OAAO,CAAC,iBAAiB,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,eAAe,CAAC,GAAG,GAAG,CAAC,CAAC;YACxE,OAAO,CAAC,gBAAgB,CAAC;gBACvB,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,EAAE,CAAC,IAAA,yBAAQ,EAAC,OAAO,CAAC,SAAS,CAAC,EAAE;aAC/D,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,OAAO,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACrC,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,WAAW;IAC5B,SAAS,EAAE,0BAAS,CAAC,MAAM;IAC3B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|
@@ -17,7 +17,8 @@ const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
|
17
17
|
const constants_1 = require("./constants");
|
18
18
|
const clients_1 = require("../../utils/clients");
|
19
19
|
const getOwnedObjects_1 = require("../../utils/sui/getOwnedObjects");
|
20
|
-
const
|
20
|
+
const ElementRegistry_1 = require("../../utils/elementbuilder/ElementRegistry");
|
21
|
+
const arrayToMap_1 = require("../../utils/misc/arrayToMap");
|
21
22
|
const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
22
23
|
var _a, _b;
|
23
24
|
const client = (0, clients_1.getClientSui)();
|
@@ -32,16 +33,11 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
32
33
|
});
|
33
34
|
if (!farmsInfos)
|
34
35
|
return [];
|
35
|
-
const farmById =
|
36
|
-
const
|
37
|
-
|
38
|
-
|
39
|
-
mints.add(farm.tokenXType);
|
40
|
-
mints.add(farm.tokenYType);
|
36
|
+
const farmById = (0, arrayToMap_1.arrayToMap)(farmsInfos, 'farmId');
|
37
|
+
const elementRegistry = new ElementRegistry_1.ElementRegistry(portfolio_core_1.NetworkId.sui, constants_1.platformId);
|
38
|
+
const element = elementRegistry.addElementLiquidity({
|
39
|
+
label: 'Farming',
|
41
40
|
});
|
42
|
-
const tokenPriceById = yield cache.getTokenPricesAsMap(Array.from(mints), portfolio_core_1.NetworkId.sui);
|
43
|
-
const liquidities = [];
|
44
|
-
let totalValue = 0;
|
45
41
|
for (const object of farmsObjects) {
|
46
42
|
if (!((_b = (_a = object.data) === null || _a === void 0 ? void 0 : _a.content) === null || _b === void 0 ? void 0 : _b.fields))
|
47
43
|
continue;
|
@@ -49,51 +45,30 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
49
45
|
const farmInfo = farmById.get(position.farm_id);
|
50
46
|
if (!farmInfo)
|
51
47
|
continue;
|
52
|
-
const [tokenPriceX, tokenPriceY] = [
|
53
|
-
tokenPriceById.get((0, portfolio_core_1.formatMoveTokenAddress)(farmInfo.tokenXType)),
|
54
|
-
tokenPriceById.get((0, portfolio_core_1.formatMoveTokenAddress)(farmInfo.tokenYType)),
|
55
|
-
];
|
56
48
|
const shares = new bignumber_js_1.default(position.stake_amount).dividedBy(new bignumber_js_1.default(farmInfo.lspSupply));
|
57
49
|
const tokenAmountX = new bignumber_js_1.default(farmInfo.tokenXReserve)
|
58
50
|
.times(shares)
|
59
|
-
.dividedBy(Math.pow(10, farmInfo.tokenX.decimals))
|
60
|
-
.toNumber();
|
51
|
+
.dividedBy(Math.pow(10, farmInfo.tokenX.decimals));
|
61
52
|
const tokenAmountY = new bignumber_js_1.default(farmInfo.tokenYReserve)
|
62
53
|
.times(shares)
|
63
|
-
.dividedBy(Math.pow(10, farmInfo.tokenY.decimals))
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
apr: (0, portfolio_core_1.apyToApr)(farmInfo.apy / 100),
|
79
|
-
},
|
80
|
-
],
|
54
|
+
.dividedBy(Math.pow(10, farmInfo.tokenY.decimals));
|
55
|
+
const liquidity = element.addLiquidity();
|
56
|
+
liquidity.addAsset({
|
57
|
+
address: farmInfo.tokenXType,
|
58
|
+
amount: tokenAmountX,
|
59
|
+
alreadyShifted: true,
|
60
|
+
});
|
61
|
+
liquidity.addAsset({
|
62
|
+
address: farmInfo.tokenYType,
|
63
|
+
amount: tokenAmountY,
|
64
|
+
alreadyShifted: true,
|
65
|
+
});
|
66
|
+
liquidity.addYield({
|
67
|
+
apy: farmInfo.apy / 100,
|
68
|
+
apr: (0, portfolio_core_1.apyToApr)(farmInfo.apy / 100),
|
81
69
|
});
|
82
70
|
}
|
83
|
-
|
84
|
-
return [];
|
85
|
-
return [
|
86
|
-
{
|
87
|
-
type: 'liquidity',
|
88
|
-
data: {
|
89
|
-
liquidities,
|
90
|
-
},
|
91
|
-
label: 'Farming',
|
92
|
-
networkId: portfolio_core_1.NetworkId.sui,
|
93
|
-
platformId: constants_1.platformId,
|
94
|
-
value: totalValue,
|
95
|
-
},
|
96
|
-
];
|
71
|
+
return elementRegistry.dump(cache);
|
97
72
|
});
|
98
73
|
const fetcher = {
|
99
74
|
id: `${constants_1.platformId}-farms`,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"farmsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/kriya/farmsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+
|
1
|
+
{"version":3,"file":"farmsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/kriya/farmsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAAiE;AACjE,gEAAqC;AAGrC,2CAAuE;AACvE,iDAAmD;AACnD,qEAAkE;AAElE,gFAA6E;AAC7E,4DAAyD;AAEzD,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;;IACtE,MAAM,MAAM,GAAG,IAAA,sBAAY,GAAE,CAAC;IAE9B,MAAM,YAAY,GAAG,MAAM,IAAA,iCAAe,EAAoB,MAAM,EAAE,KAAK,EAAE;QAC3E,MAAM,EAAE,EAAE,OAAO,EAAE,0BAAc,EAAE;KACpC,CAAC,CAAC;IACH,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAEzC,MAAM,UAAU,GAAG,MAAM,KAAK,CAAC,OAAO,CAAa,wBAAY,EAAE;QAC/D,MAAM,EAAE,sBAAU;QAClB,SAAS,EAAE,0BAAS,CAAC,GAAG;KACzB,CAAC,CAAC;IACH,IAAI,CAAC,UAAU;QAAE,OAAO,EAAE,CAAC;IAE3B,MAAM,QAAQ,GAA0B,IAAA,uBAAU,EAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;IAEzE,MAAM,eAAe,GAAG,IAAI,iCAAe,CAAC,0BAAS,CAAC,GAAG,EAAE,sBAAU,CAAC,CAAC;IACvE,MAAM,OAAO,GAAG,eAAe,CAAC,mBAAmB,CAAC;QAClD,KAAK,EAAE,SAAS;KACjB,CAAC,CAAC;IAEH,KAAK,MAAM,MAAM,IAAI,YAAY,EAAE,CAAC;QAClC,IAAI,CAAC,CAAA,MAAA,MAAA,MAAM,CAAC,IAA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G,CAAC;SAClC,CAAC,CAAC;IACL,CAAC;IAED,OAAO,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACrC,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,QAAQ;IACzB,SAAS,EAAE,0BAAS,CAAC,GAAG;IACxB,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|
@@ -44,10 +44,10 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
44
44
|
const vault = leverageVaults.find((v) => { var _a, _b; return v.farmId === ((_b = (_a = pos.data) === null || _a === void 0 ? void 0 : _a.content) === null || _b === void 0 ? void 0 : _b.fields.farm_id); });
|
45
45
|
if (!vault)
|
46
46
|
return;
|
47
|
-
mints.add(
|
48
|
-
mints.add(
|
47
|
+
mints.add(vault.coinA);
|
48
|
+
mints.add(vault.coinB);
|
49
49
|
});
|
50
|
-
const tokenPrices = yield cache.getTokenPricesAsMap(
|
50
|
+
const tokenPrices = yield cache.getTokenPricesAsMap(mints, portfolio_core_1.NetworkId.sui);
|
51
51
|
if (!tokenPrices)
|
52
52
|
return [];
|
53
53
|
const elements = [];
|
@@ -59,8 +59,8 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
59
59
|
const vault = leverageVaults.find((v) => { var _a, _b; return v.farmId === ((_b = (_a = pos.data) === null || _a === void 0 ? void 0 : _a.content) === null || _b === void 0 ? void 0 : _b.fields.farm_id); });
|
60
60
|
if (!vault)
|
61
61
|
return;
|
62
|
-
const tokenPriceA = tokenPrices.get(
|
63
|
-
const tokenPriceB = tokenPrices.get(
|
62
|
+
const tokenPriceA = tokenPrices.get(vault.coinA);
|
63
|
+
const tokenPriceB = tokenPrices.get(vault.coinB);
|
64
64
|
if (!tokenPriceA || !tokenPriceB)
|
65
65
|
return;
|
66
66
|
const sharesPercentage = new bignumber_js_1.default(posContent.fields.rewards_stake_receipt.fields.shares).dividedBy(vault.lpSupply);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"leverageVaultsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/kriya/leverageVaultsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+
|
1
|
+
{"version":3,"file":"leverageVaultsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/kriya/leverageVaultsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAOoC;AACpC,gEAAqC;AAGrC,2CAAgE;AAChE,iDAAmD;AAEnD,qGAA6E;AAC7E,qEAAkE;AAClE,kEAA+D;AAE/D,MAAM,kBAAkB,GAAG,IAAI,6BAAa,CAC1C,iCAAqB,EACrB;IACE,MAAM,EAAE,sBAAU;IAClB,SAAS,EAAE,0BAAS,CAAC,GAAG;CACzB,CACF,CAAC;AAEF,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,MAAM,GAAG,IAAA,sBAAY,GAAE,CAAC;IAE9B,MAAM,cAAc,GAAG,MAAM,kBAAkB,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAE/D,MAAM,QAAQ,GAAG,MAAM,IAAA,iCAAe,EACpC,MAAM,EACN,KAAK,EACL;QACE,MAAM,EAAE;YACN,QAAQ,EAAE,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;gBACnC,UAAU,EAAE,CAAC,CAAC,oBAAoB;aACnC,CAAC,CAAC;SACJ;KACF,CACF,CAAC;IAEF,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAErC,MAAM,KAAK,GAAG,IAAI,GAAG,EAAU,CAAC;IAEhC,QAAQ,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;;QACvB,MAAM,UAAU,GAAG,MAAA,GAAG,CAAC,IAAI,0CAAE,OAAO,CAAC;QACrC,I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