@sonarwatch/portfolio-plugins 0.14.152 → 0.14.153
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 +2232 -2228
- package/README.md +3 -3
- package/package.json +1 -1
- package/src/plugins/balancer/helpers/pools.js +21 -21
- package/src/plugins/drift/spotMarketsJob.js +0 -1
- package/src/plugins/drift/spotMarketsJob.js.map +1 -1
- package/src/plugins/ensofi/index.js +2 -1
- package/src/plugins/ensofi/index.js.map +1 -1
- package/src/plugins/ensofi/solanaLoansJob.d.ts +3 -0
- package/src/plugins/ensofi/solanaLoansJob.js +63 -0
- package/src/plugins/ensofi/solanaLoansJob.js.map +1 -0
- package/src/plugins/ensofi/structs.js +2 -2
- package/src/plugins/ensofi/structs.js.map +1 -1
- package/src/plugins/kamino/reservesJob.js +35 -0
- package/src/plugins/kamino/reservesJob.js.map +1 -1
- package/src/plugins/loopscale/constants.d.ts +2 -3
- package/src/plugins/loopscale/constants.js +3 -4
- package/src/plugins/loopscale/constants.js.map +1 -1
- package/src/plugins/loopscale/helpers.d.ts +6 -33
- package/src/plugins/loopscale/helpers.js +39 -142
- package/src/plugins/loopscale/helpers.js.map +1 -1
- package/src/plugins/loopscale/index.js +10 -3
- package/src/plugins/loopscale/index.js.map +1 -1
- package/src/plugins/loopscale/lendFetcher.js +57 -0
- package/src/plugins/loopscale/lendFetcher.js.map +1 -0
- package/src/plugins/loopscale/lendVaultsFetcher.d.ts +6 -0
- package/src/plugins/loopscale/lendVaultsFetcher.js +68 -0
- package/src/plugins/loopscale/lendVaultsFetcher.js.map +1 -0
- package/src/plugins/loopscale/loansFetcher.d.ts +3 -0
- package/src/plugins/loopscale/loansFetcher.js +79 -0
- package/src/plugins/loopscale/loansFetcher.js.map +1 -0
- package/src/plugins/loopscale/structs.d.ts +116 -86
- package/src/plugins/loopscale/structs.js +101 -79
- package/src/plugins/loopscale/structs.js.map +1 -1
- package/src/plugins/loopscale/types.d.ts +6 -0
- package/src/plugins/loopscale/types.js +3 -0
- package/src/plugins/loopscale/types.js.map +1 -0
- package/src/plugins/loopscale/vaultsJob.d.ts +3 -0
- package/src/plugins/loopscale/vaultsJob.js +121 -0
- package/src/plugins/loopscale/vaultsJob.js.map +1 -0
- package/src/plugins/lulo/depositsFetcher.js +9 -29
- package/src/plugins/lulo/depositsFetcher.js.map +1 -1
- package/src/plugins/marginfi/banksJob.js +6 -2
- package/src/plugins/marginfi/banksJob.js.map +1 -1
- package/src/plugins/marginfi/constants.d.ts +5 -3
- package/src/plugins/marginfi/constants.js +8 -7
- package/src/plugins/marginfi/constants.js.map +1 -1
- package/src/plugins/marginfi/depositsFetcher.js +50 -27
- package/src/plugins/marginfi/depositsFetcher.js.map +1 -1
- package/src/plugins/marginfi/getMarginFiAccounts.d.ts +6 -0
- package/src/plugins/marginfi/getMarginFiAccounts.js +44 -0
- package/src/plugins/marginfi/getMarginFiAccounts.js.map +1 -0
- package/src/plugins/marginfi/helpers.d.ts +0 -5
- package/src/plugins/marginfi/helpers.js +1 -81
- package/src/plugins/marginfi/helpers.js.map +1 -1
- package/src/plugins/marginfi/structs/MarginfiAccount.d.ts +5 -0
- package/src/plugins/marginfi/structs/MarginfiAccount.js.map +1 -1
- package/src/plugins/suilend/helpers.js +2 -0
- package/src/plugins/suilend/helpers.js.map +1 -1
- package/src/plugins/sushiswap/helpers.js +24 -24
- package/src/plugins/uniswap-v2/helpers.js +22 -22
- package/src/utils/misc/getLendingMarketAprs.d.ts +3 -1
- package/src/utils/misc/getLendingMarketAprs.js +24 -1
- package/src/utils/misc/getLendingMarketAprs.js.map +1 -1
- package/src/utils/sei/constants.js +8 -8
- package/src/utils/sei/getQueryBalanceByOwner.js +4 -4
- package/src/plugins/loopscale/filters.d.ts +0 -9
- package/src/plugins/loopscale/filters.js +0 -62
- package/src/plugins/loopscale/filters.js.map +0 -1
- package/src/plugins/loopscale/positionsFetcher.js +0 -119
- package/src/plugins/loopscale/positionsFetcher.js.map +0 -1
- package/src/plugins/marginfi/filters.d.ts +0 -5
- package/src/plugins/marginfi/filters.js +0 -45
- package/src/plugins/marginfi/filters.js.map +0 -1
- /package/src/plugins/loopscale/{positionsFetcher.d.ts → lendFetcher.d.ts} +0 -0
@@ -1,96 +1,118 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
3
|
+
exports.loanStruct = exports.collateralDataStruct = exports.strategyStruct = exports.ledgerStruct = exports.vaultStakeStruct = exports.vaultStruct = exports.podBoolStruct = exports.podU64CBPSStruct = exports.podU64Struct = exports.podU32CBPSStruct = exports.podU128Struct = exports.podDecimalStruct = exports.durationStruct = exports.podU32Struct = void 0;
|
4
4
|
const beet_1 = require("@metaplex-foundation/beet");
|
5
5
|
const beet_solana_1 = require("@metaplex-foundation/beet-solana");
|
6
6
|
const solana_1 = require("../../utils/solana");
|
7
|
-
exports.
|
8
|
-
|
9
|
-
['
|
10
|
-
['
|
11
|
-
['type', beet_1.u32],
|
7
|
+
exports.podU32Struct = new beet_1.BeetStruct([['array', (0, beet_1.uniformFixedSizeArray)(beet_1.u8, 4)]], (args) => args);
|
8
|
+
exports.durationStruct = new beet_1.BeetStruct([
|
9
|
+
['duration', exports.podU32Struct],
|
10
|
+
['duration_type', beet_1.u8],
|
12
11
|
], (args) => args);
|
13
|
-
exports.
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
['
|
21
|
-
['
|
22
|
-
['
|
23
|
-
['
|
24
|
-
['
|
25
|
-
['
|
12
|
+
exports.podDecimalStruct = new beet_1.BeetStruct([['array', (0, beet_1.uniformFixedSizeArray)(beet_1.u8, 24)]], (args) => args);
|
13
|
+
exports.podU128Struct = new beet_1.BeetStruct([['array', (0, beet_1.uniformFixedSizeArray)(beet_1.u8, 16)]], (args) => args);
|
14
|
+
exports.podU32CBPSStruct = new beet_1.BeetStruct([['array', (0, beet_1.uniformFixedSizeArray)(beet_1.u8, 4)]], (args) => args);
|
15
|
+
exports.podU64Struct = new beet_1.BeetStruct([['array', (0, beet_1.uniformFixedSizeArray)(beet_1.u8, 8)]], (args) => args);
|
16
|
+
exports.podU64CBPSStruct = new beet_1.BeetStruct([['array', (0, beet_1.uniformFixedSizeArray)(beet_1.u8, 8)]], (args) => args);
|
17
|
+
exports.podBoolStruct = new beet_1.BeetStruct([['value', beet_1.u8]], (args) => args);
|
18
|
+
exports.vaultStruct = new beet_1.BeetStruct([
|
19
|
+
['accountDiscriminator', (0, beet_1.uniformFixedSizeArray)(beet_1.u8, 8)],
|
20
|
+
['manager', beet_solana_1.publicKey],
|
21
|
+
['nonce', beet_solana_1.publicKey],
|
22
|
+
['bump', beet_1.u8],
|
23
|
+
['lp_supply', exports.podU64Struct],
|
24
|
+
['lp_mint', beet_solana_1.publicKey],
|
25
|
+
['principal_mint', beet_solana_1.publicKey],
|
26
|
+
['cumulative_principal_deposited', exports.podU64Struct],
|
27
|
+
['deposits_enabled', exports.podBoolStruct],
|
28
|
+
['max_early_unstake_fee', exports.podU64CBPSStruct],
|
26
29
|
], (args) => args);
|
27
|
-
exports.
|
28
|
-
['
|
29
|
-
['
|
30
|
-
['num_escrowed', solana_1.u64],
|
30
|
+
exports.vaultStakeStruct = new beet_1.BeetStruct([
|
31
|
+
['accountDiscriminator', (0, beet_1.uniformFixedSizeArray)(beet_1.u8, 8)],
|
32
|
+
['vault', beet_solana_1.publicKey],
|
31
33
|
['nonce', beet_solana_1.publicKey],
|
32
|
-
['
|
33
|
-
['
|
34
|
-
['
|
34
|
+
['bump', beet_1.u8],
|
35
|
+
['user', beet_solana_1.publicKey],
|
36
|
+
['amount', exports.podU64Struct],
|
37
|
+
['duration', exports.durationStruct],
|
38
|
+
['start_time', exports.podU64Struct],
|
39
|
+
['end_time', exports.podU64Struct],
|
40
|
+
['unstake_time', exports.podU64Struct],
|
41
|
+
['unstake_fee_applied', exports.podU64Struct],
|
42
|
+
], (args) => args);
|
43
|
+
exports.ledgerStruct = new beet_1.BeetStruct([
|
44
|
+
['status', beet_1.u8],
|
45
|
+
['strategy', beet_solana_1.publicKey],
|
46
|
+
['principal_mint', beet_solana_1.publicKey],
|
47
|
+
['market_information', beet_solana_1.publicKey],
|
48
|
+
['principal_due', exports.podU64Struct],
|
49
|
+
['principal_repaid', exports.podU64Struct],
|
50
|
+
['interest_due', exports.podU64Struct],
|
51
|
+
['interest_repaid', exports.podU64Struct],
|
52
|
+
['duration', exports.durationStruct],
|
53
|
+
['interest_per_second', exports.podDecimalStruct],
|
54
|
+
['start_time', exports.podU64Struct],
|
55
|
+
['end_time', exports.podU64Struct],
|
56
|
+
['apy', exports.podU64CBPSStruct],
|
35
57
|
], (args) => args);
|
36
|
-
exports.
|
37
|
-
['
|
58
|
+
exports.strategyStruct = new beet_1.BeetStruct([
|
59
|
+
['accountDiscriminator', (0, beet_1.uniformFixedSizeArray)(beet_1.u8, 8)],
|
38
60
|
['version', beet_1.u8],
|
39
61
|
['nonce', beet_solana_1.publicKey],
|
40
|
-
['
|
41
|
-
['designated_taker', beet_solana_1.publicKey],
|
62
|
+
['bump', beet_1.u8],
|
42
63
|
['principal_mint', beet_solana_1.publicKey],
|
43
|
-
['
|
44
|
-
['
|
45
|
-
['
|
46
|
-
['
|
47
|
-
['
|
48
|
-
['
|
49
|
-
['
|
50
|
-
['
|
51
|
-
['
|
52
|
-
['
|
53
|
-
['
|
54
|
-
['
|
55
|
-
['
|
56
|
-
['
|
57
|
-
['
|
58
|
-
['
|
59
|
-
['
|
60
|
-
['
|
61
|
-
['
|
62
|
-
['
|
63
|
-
[
|
64
|
-
|
64
|
+
['lender', beet_solana_1.publicKey],
|
65
|
+
['originations_enabled', exports.podBoolStruct],
|
66
|
+
['external_yield_source', beet_1.u8],
|
67
|
+
['interest_per_second', exports.podDecimalStruct],
|
68
|
+
['last_accrued_timestamp', exports.podU64Struct],
|
69
|
+
['liquidity_buffer', exports.podU64CBPSStruct],
|
70
|
+
['token_balance', exports.podU64Struct],
|
71
|
+
['interest_fee', exports.podU64CBPSStruct],
|
72
|
+
['principal_fee', exports.podU64CBPSStruct],
|
73
|
+
['origination_fee', exports.podU64CBPSStruct],
|
74
|
+
['origination_cap', exports.podU64Struct],
|
75
|
+
['external_yield_amount', exports.podU64Struct],
|
76
|
+
['current_deployed_amount', exports.podU64Struct],
|
77
|
+
['outstanding_interest_amount', exports.podU64Struct],
|
78
|
+
['fee_claimable', exports.podU64Struct],
|
79
|
+
['cumulative_principal_originated', exports.podU128Struct],
|
80
|
+
['cumulative_interest_accrued', exports.podU128Struct],
|
81
|
+
['cumulative_loan_count', exports.podU64Struct],
|
82
|
+
['active_loan_count', exports.podU64Struct],
|
83
|
+
['market_information', beet_solana_1.publicKey],
|
84
|
+
[
|
85
|
+
'collateral_map',
|
86
|
+
(0, beet_1.uniformFixedSizeArray)((0, beet_1.uniformFixedSizeArray)(exports.podU64Struct, 5), 200),
|
87
|
+
],
|
65
88
|
], (args) => args);
|
66
|
-
exports.
|
67
|
-
['
|
68
|
-
['
|
69
|
-
['
|
70
|
-
['
|
71
|
-
['interest_repaid', solana_1.u64],
|
72
|
-
['due_time_offset', solana_1.i64],
|
73
|
-
['paid_time', solana_1.i64],
|
74
|
-
['payment_type', beet_1.u8],
|
75
|
-
['is_filled', beet_1.bool],
|
76
|
-
['grace_period', solana_1.i64],
|
77
|
-
['late_payment_fee', solana_1.u64],
|
78
|
-
['early_payment_fee', solana_1.u64],
|
79
|
-
['payment_window', solana_1.i64],
|
80
|
-
['reserve', (0, beet_1.uniformFixedSizeArray)(beet_1.u8, 32)],
|
89
|
+
exports.collateralDataStruct = new beet_1.BeetStruct([
|
90
|
+
['asset_mint', beet_solana_1.publicKey],
|
91
|
+
['amount', exports.podU64Struct],
|
92
|
+
['asset_type', beet_1.u8],
|
93
|
+
['asset_identifier', beet_solana_1.publicKey],
|
81
94
|
], (args) => args);
|
82
|
-
exports.
|
83
|
-
['
|
95
|
+
exports.loanStruct = new beet_1.BeetStruct([
|
96
|
+
['accountDiscriminator', (0, beet_1.uniformFixedSizeArray)(beet_1.u8, 8)],
|
84
97
|
['version', beet_1.u8],
|
85
|
-
['
|
86
|
-
['
|
87
|
-
],
|
88
|
-
|
89
|
-
['
|
90
|
-
['
|
91
|
-
['
|
92
|
-
[
|
93
|
-
|
94
|
-
|
98
|
+
['bump', beet_1.u8],
|
99
|
+
['loan_type', beet_1.u8],
|
100
|
+
['borrower', beet_solana_1.publicKey],
|
101
|
+
['nonce', solana_1.u64],
|
102
|
+
['start_time', exports.podU64Struct],
|
103
|
+
['ledgers', (0, beet_1.uniformFixedSizeArray)(exports.ledgerStruct, 5)],
|
104
|
+
['collateral', (0, beet_1.uniformFixedSizeArray)(exports.collateralDataStruct, 5)],
|
105
|
+
[
|
106
|
+
'weight_matrix',
|
107
|
+
(0, beet_1.uniformFixedSizeArray)((0, beet_1.uniformFixedSizeArray)(exports.podU32CBPSStruct, 5), 5),
|
108
|
+
],
|
109
|
+
[
|
110
|
+
'ltv_matrix',
|
111
|
+
(0, beet_1.uniformFixedSizeArray)((0, beet_1.uniformFixedSizeArray)(exports.podU32CBPSStruct, 5), 5),
|
112
|
+
],
|
113
|
+
[
|
114
|
+
'lqt_matrix',
|
115
|
+
(0, beet_1.uniformFixedSizeArray)((0, beet_1.uniformFixedSizeArray)(exports.podU32CBPSStruct, 5), 5),
|
116
|
+
],
|
95
117
|
], (args) => args);
|
96
118
|
//# sourceMappingURL=structs.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"structs.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/loopscale/structs.ts"],"names":[],"mappings":";;;AAEA,
|
1
|
+
{"version":3,"file":"structs.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/loopscale/structs.ts"],"names":[],"mappings":";;;AAEA,oDAImC;AACnC,kEAA6D;AAC7D,+CAAyC;AAK5B,QAAA,YAAY,GAAG,IAAI,iBAAU,CACxC,CAAC,CAAC,O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C,oBAAY,EAAE,CAAC,CAAC,CAAC;IACnD,CAAC,YAAY,EAAE,IAAA,4BAAqB,EAAC,4BAAoB,EAAE,CAAC,CAAC,CAAC;IAC9D;QACE,eAAe;QACf,IAAA,4BAAqB,EAAC,IAAA,4BAAqB,EAAC,wBAAgB,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;KACrE;IACD;QACE,YAAY;QACZ,IAAA,4BAAqB,EAAC,IAAA,4BAAqB,EAAC,wBAAgB,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;KACrE;IACD;QACE,YAAY;QACZ,IAAA,4BAAqB,EAAC,IAAA,4BAAqB,EAAC,wBAAgB,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;KACrE;CACF,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAY,CACvB,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/loopscale/types.ts"],"names":[],"mappings":""}
|
@@ -0,0 +1,121 @@
|
|
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 web3_js_1 = require("@solana/web3.js");
|
13
|
+
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
14
|
+
const clients_1 = require("../../utils/clients");
|
15
|
+
const ParsedGpa_1 = require("../../utils/solana/beets/ParsedGpa");
|
16
|
+
const structs_1 = require("./structs");
|
17
|
+
const constants_1 = require("./constants");
|
18
|
+
const helpers_1 = require("./helpers");
|
19
|
+
const solana_1 = require("../../utils/solana");
|
20
|
+
const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
21
|
+
const connection = (0, clients_1.getClientSolana)();
|
22
|
+
const vaults = yield ParsedGpa_1.ParsedGpa.build(connection, structs_1.vaultStruct, constants_1.loopscaleProgramId)
|
23
|
+
.addFilter('accountDiscriminator', [211, 8, 232, 43, 2, 152, 117, 119])
|
24
|
+
.run();
|
25
|
+
if (!vaults.length)
|
26
|
+
throw new Error('No Vaults accounts found');
|
27
|
+
const strategyMap = {};
|
28
|
+
vaults.forEach((vault) => {
|
29
|
+
const seeds = [Buffer.from('strategy'), vault.pubkey.toBytes()];
|
30
|
+
strategyMap[vault.pubkey.toBase58()] = (0, helpers_1.getProgramAddress)(seeds, constants_1.loopscaleProgramId);
|
31
|
+
});
|
32
|
+
const strats = Object.values(strategyMap);
|
33
|
+
const accounts = yield (0, solana_1.getParsedMultipleAccountsInfo)(connection, structs_1.strategyStruct, strats);
|
34
|
+
const now = Math.floor(Date.now() / 1000);
|
35
|
+
const cachedVaults = [];
|
36
|
+
const tokenPriceSources = [];
|
37
|
+
const tokenPrices = yield cache.getTokenPricesAsMap(vaults.map((v) => v.principal_mint.toString()), portfolio_core_1.NetworkId.solana);
|
38
|
+
for (let i = 0; i < vaults.length; i++) {
|
39
|
+
const vault = vaults[i];
|
40
|
+
const strategyAddress = strategyMap[vault.pubkey.toString()];
|
41
|
+
const stratPubkey = new web3_js_1.PublicKey(strategyAddress);
|
42
|
+
const accountIndex = strats.indexOf(strategyAddress);
|
43
|
+
if (accountIndex >= 0) {
|
44
|
+
const strat = accounts[accountIndex];
|
45
|
+
if (!strat)
|
46
|
+
continue;
|
47
|
+
const principalMint = strat.principal_mint;
|
48
|
+
const externalYieldSource = strat.external_yield_source;
|
49
|
+
let balance = 0;
|
50
|
+
if (externalYieldSource === 1) {
|
51
|
+
// Marginfi, add this account to loader
|
52
|
+
const mfiBalance = yield (0, helpers_1.getMarginFiAccountBalance)(stratPubkey, cache);
|
53
|
+
balance += mfiBalance; // mrgn balance
|
54
|
+
}
|
55
|
+
else {
|
56
|
+
const stratTAs = yield connection.getTokenAccountsByOwner(stratPubkey, {
|
57
|
+
mint: principalMint,
|
58
|
+
});
|
59
|
+
stratTAs.value.forEach((accountInfo) => {
|
60
|
+
const decodedAccount = solana_1.tokenAccountStruct.read(accountInfo.account.data, 0);
|
61
|
+
balance += Number(decodedAccount.amount);
|
62
|
+
});
|
63
|
+
}
|
64
|
+
const lastAccruedTimestamp = (0, helpers_1.bytesToNumberLE)(new Uint8Array(strat.last_accrued_timestamp.array));
|
65
|
+
const interestPerSecond = (0, helpers_1.bytesToNumberLE)(new Uint8Array(strat.interest_per_second.array)) / 1e18;
|
66
|
+
const currentDeployedAmount = (0, helpers_1.bytesToNumberLE)(new Uint8Array(strat.current_deployed_amount.array));
|
67
|
+
const accruedDelta = now - lastAccruedTimestamp;
|
68
|
+
const deployedAmount = currentDeployedAmount + interestPerSecond * accruedDelta;
|
69
|
+
balance += deployedAmount;
|
70
|
+
cachedVaults.push({
|
71
|
+
pubkey: vault.pubkey.toString(),
|
72
|
+
lp_mint: vault.lp_mint.toString(),
|
73
|
+
principal: principalMint.toString(),
|
74
|
+
price: balance / (0, helpers_1.bytesToNumberLE)(new Uint8Array(vault.lp_supply.array)),
|
75
|
+
});
|
76
|
+
const principalTokenPrice = tokenPrices.get(principalMint.toString());
|
77
|
+
if (principalTokenPrice) {
|
78
|
+
const priceInPrincipal = balance / (0, helpers_1.bytesToNumberLE)(new Uint8Array(vault.lp_supply.array));
|
79
|
+
tokenPriceSources.push({
|
80
|
+
id: vault.pubkey.toString(),
|
81
|
+
weight: 1,
|
82
|
+
address: vault.lp_mint.toString(),
|
83
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
84
|
+
platformId: constants_1.platformId,
|
85
|
+
decimals: principalTokenPrice.decimals,
|
86
|
+
price: principalTokenPrice.price * priceInPrincipal,
|
87
|
+
underlyings: [
|
88
|
+
{
|
89
|
+
address: principalMint.toString(),
|
90
|
+
amountPerLp: priceInPrincipal,
|
91
|
+
decimals: principalTokenPrice.decimals,
|
92
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
93
|
+
price: principalTokenPrice.price,
|
94
|
+
},
|
95
|
+
],
|
96
|
+
label: 'LiquidityPool',
|
97
|
+
timestamp: Date.now(),
|
98
|
+
link: `https://app.loopscale.com/vault/AXanCP4dJHtWd7zY4X7nwxN5t5Gysfy2uG3XTxSmXdaB${vault.pubkey}`,
|
99
|
+
sourceRefs: [
|
100
|
+
{
|
101
|
+
name: 'Vault',
|
102
|
+
address: vault.pubkey.toString(),
|
103
|
+
},
|
104
|
+
],
|
105
|
+
});
|
106
|
+
}
|
107
|
+
}
|
108
|
+
}
|
109
|
+
yield cache.setTokenPriceSources(tokenPriceSources);
|
110
|
+
yield cache.setItem(constants_1.vaultsCacheKey, cachedVaults, {
|
111
|
+
prefix: constants_1.platformId,
|
112
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
113
|
+
});
|
114
|
+
});
|
115
|
+
const job = {
|
116
|
+
id: `${constants_1.platformId}-vaults`,
|
117
|
+
executor,
|
118
|
+
labels: ['normal'],
|
119
|
+
};
|
120
|
+
exports.default = job;
|
121
|
+
//# sourceMappingURL=vaultsJob.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"vaultsJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/loopscale/vaultsJob.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,6CAA4C;AAC5C,+DAAyE;AAEzE,iDAAsD;AACtD,kEAA+D;AAC/D,uCAAwD;AACxD,2CAA6E;AAC7E,uCAImB;AACnB,+CAG4B;AAI5B,MAAM,QAAQ,GAAgB,CAAO,KAAY,EAAE,EAAE;IACnD,MAAM,UAAU,G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,KAAK,CAAC,OAAO,CAAC,QAAQ,EAAE;oBACjC,SAAS,EAAE,0BAAS,CAAC,MAAM;oBAC3B,UAAU,EAAV,sBAAU;oBACV,QAAQ,EAAE,mBAAmB,CAAC,QAAQ;oBACtC,KAAK,EAAE,mBAAmB,CAAC,KAAK,GAAG,gBAAgB;oBACnD,WAAW,EAAE;wBACX;4BACE,OAAO,EAAE,aAAa,CAAC,QAAQ,EAAE;4BACjC,WAAW,EAAE,gBAAgB;4BAC7B,QAAQ,EAAE,mBAAmB,CAAC,QAAQ;4BACtC,SAAS,EAAE,0BAAS,CAAC,MAAM;4BAC3B,KAAK,EAAE,mBAAmB,CAAC,KAAK;yBACjC;qBACF;oBACD,KAAK,EAAE,eAAe;oBACtB,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;oBACrB,IAAI,EAAE,+EAA+E,KAAK,CAAC,MAAM,EAAE;oBACnG,UAAU,EAAE;wBACV;4BACE,IAAI,EAAE,OAAO;4BACb,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,QAAQ,EAAE;yBACjC;qBACF;iBACF,CAAC,CAAC;YACL,CAAC;QACH,CAAC;IACH,CAAC;IAED,MAAM,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,CAAC;IACpD,MAAM,KAAK,CAAC,OAAO,CAAC,0BAAc,EAAE,YAAY,EAAE;QAChD,MAAM,EAAE,sBAAU;QAClB,SAAS,EAAE,0BAAS,CAAC,MAAM;KAC5B,CAAC,CAAC;AACL,CAAC,CAAA,CAAC;AAEF,MAAM,GAAG,GAAQ;IACf,EAAE,EAAE,GAAG,sBAAU,SAAS;IAC1B,QAAQ;IACR,MAAM,EAAE,CAAC,QAAQ,CAAC;CACnB,CAAC;AACF,kBAAe,GAAG,CAAC"}
|
@@ -19,6 +19,7 @@ const helpers_1 = require("./helpers");
|
|
19
19
|
const depositsFetcher_1 = __importDefault(require("../drift/depositsFetcher"));
|
20
20
|
const lendsFetcher_1 = __importDefault(require("../kamino/lendsFetcher"));
|
21
21
|
const collateralFetcher_1 = __importDefault(require("../mango/collateralFetcher"));
|
22
|
+
const depositsFetcher_2 = __importDefault(require("../marginfi/depositsFetcher"));
|
22
23
|
const constants_2 = require("../tokens/constants");
|
23
24
|
const getParsedAccountInfo_1 = require("../../utils/solana/getParsedAccountInfo");
|
24
25
|
const clients_1 = require("../../utils/clients");
|
@@ -26,10 +27,7 @@ const struct_1 = require("./struct");
|
|
26
27
|
const structs_1 = require("../save/structs");
|
27
28
|
const constants_3 = require("../save/constants");
|
28
29
|
const helpers_2 = require("../save/helpers");
|
29
|
-
const MarginfiAccount_1 = require("../marginfi/structs/MarginfiAccount");
|
30
30
|
const solana_1 = require("../../utils/solana");
|
31
|
-
const constants_4 = require("../marginfi/constants");
|
32
|
-
const helpers_3 = require("../marginfi/helpers");
|
33
31
|
const ElementRegistry_1 = require("../../utils/elementbuilder/ElementRegistry");
|
34
32
|
const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
35
33
|
const client = (0, clients_1.getClientSolana)();
|
@@ -44,12 +42,9 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
44
42
|
return [];
|
45
43
|
const isSolendActivated = userAccount.solend_obligation.toString() !==
|
46
44
|
'11111111111111111111111111111111';
|
47
|
-
const isMarginFiActivated = userAccount.mfi_account.toString() !== '11111111111111111111111111111111';
|
48
45
|
const portfolioElements = [];
|
49
|
-
const [
|
50
|
-
|
51
|
-
? (0, getParsedAccountInfo_1.getParsedAccountInfo)(client, MarginfiAccount_1.marginfiAccountStruct, userAccount.mfi_account)
|
52
|
-
: undefined,
|
46
|
+
const [marginFiElements, driftElements, kaminoElements, mangoElements, saveObligation,] = yield Promise.all([
|
47
|
+
depositsFetcher_2.default.executor(pda, cache),
|
53
48
|
depositsFetcher_1.default.executor(pda, cache),
|
54
49
|
lendsFetcher_1.default.executor(pda, cache),
|
55
50
|
collateralFetcher_1.default.executor(pda, cache),
|
@@ -57,7 +52,12 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
57
52
|
? (0, getParsedAccountInfo_1.getParsedAccountInfo)(client, structs_1.obligationStruct, userAccount.solend_obligation)
|
58
53
|
: undefined,
|
59
54
|
]);
|
60
|
-
portfolioElements.push(...[
|
55
|
+
portfolioElements.push(...[
|
56
|
+
...marginFiElements,
|
57
|
+
...driftElements,
|
58
|
+
...kaminoElements,
|
59
|
+
...mangoElements,
|
60
|
+
]);
|
61
61
|
if (saveObligation) {
|
62
62
|
const mainMarketInfo = yield cache.getItem(constants_3.mainMarket, {
|
63
63
|
prefix: constants_3.marketsPrefix,
|
@@ -84,26 +84,6 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
84
84
|
}
|
85
85
|
}
|
86
86
|
}
|
87
|
-
if (marginfiAccount) {
|
88
|
-
const banksInfo = yield cache.getItem(constants_4.banksKey, {
|
89
|
-
prefix: constants_4.platform.id,
|
90
|
-
networkId: portfolio_core_1.NetworkId.solana,
|
91
|
-
});
|
92
|
-
if (banksInfo) {
|
93
|
-
const banksInfoByAddress = new Map();
|
94
|
-
const tokensAddresses = new Set();
|
95
|
-
banksInfo.forEach((bankInfo) => {
|
96
|
-
if (!bankInfo)
|
97
|
-
return;
|
98
|
-
banksInfoByAddress.set(bankInfo.pubkey.toString(), bankInfo);
|
99
|
-
tokensAddresses.add(bankInfo.mint.toString());
|
100
|
-
});
|
101
|
-
const tokenPriceById = yield cache.getTokenPricesAsMap(Array.from(tokensAddresses), portfolio_core_1.NetworkId.solana);
|
102
|
-
const element = (0, helpers_3.getElementFromAccount)(marginfiAccount, banksInfoByAddress, tokenPriceById);
|
103
|
-
if (element)
|
104
|
-
portfolioElements.push(element);
|
105
|
-
}
|
106
|
-
}
|
107
87
|
const elements = [];
|
108
88
|
for (const element of portfolioElements) {
|
109
89
|
const tmpElement = element;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"depositsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/lulo/depositsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAIoC;AACpC,6CAA4C;AAG5C,2CAAmD;AACnD,uCAA0E;AAC1E,+EAA4D;AAC5D,0EAA8D;AAC9D,mFAA6D;AAC7D,mDAA2D;AAC3D,kFAA+E;AAC/E,iDAAsD;AACtD,qCAAsE;AACtE,6CAAmD;AACnD,iDAA8E;AAE9E,6CAA6D;AAC7D
|
1
|
+
{"version":3,"file":"depositsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/lulo/depositsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAIoC;AACpC,6CAA4C;AAG5C,2CAAmD;AACnD,uCAA0E;AAC1E,+EAA4D;AAC5D,0EAA8D;AAC9D,mFAA6D;AAC7D,kFAAiE;AACjE,mDAA2D;AAC3D,kFAA+E;AAC/E,iDAAsD;AACtD,qCAAsE;AACtE,6CAAmD;AACnD,iDAA8E;AAE9E,6CAA6D;AAC7D,+CAAmE;AAEnE,gFAA6E;AAE7E,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,MAAM,GAAG,IAAA,yBAAe,GAAE,CAAC;IACjC,MAAM,GAAG,GAAG,IAAA,2BAAiB,EAAC,KAAK,CAAC,CAAC;IAErC,MAAM,CAAC,WAAW,EAAE,eAAe,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QACvD,IAAA,2CAAoB,EAAC,MAAM,EAAE,0BAAiB,EAAE,IAAI,mBAAS,CAAC,GAAG,CAAC,CAAC;QACnE,KAAK,CAAC,OAAO,CAAmB,oBAAQ,EAAE;YACxC,MAAM,EAAE,sBAAU;SACnB,CAAC;KACH,CAAC,CAAC;IACH,IAAI,CAAC,WAAW;QAAE,OAAO,EAAE,CAAC;IAE5B,MAAM,iBAAiB,GACrB,WAAW,CAAC,iBAAiB,CAAC,QAAQ,EAAE;QACxC,kCAAkC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D,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"}
|
@@ -13,15 +13,19 @@ const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
|
13
13
|
const web3_js_1 = require("@solana/web3.js");
|
14
14
|
const constants_1 = require("./constants");
|
15
15
|
const Bank_1 = require("./structs/Bank");
|
16
|
-
const filters_1 = require("./filters");
|
17
16
|
const helpers_1 = require("./helpers");
|
18
17
|
const solana_1 = require("../../utils/solana");
|
19
18
|
const clients_1 = require("../../utils/clients");
|
20
19
|
const getParsedAccountInfo_1 = require("../../utils/solana/getParsedAccountInfo");
|
21
20
|
const structs_1 = require("../native-stake/solana/structs");
|
21
|
+
const ParsedGpa_1 = require("../../utils/solana/beets/ParsedGpa");
|
22
22
|
const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
23
23
|
const connection = (0, clients_1.getClientSolana)();
|
24
|
-
const banksRawData = yield
|
24
|
+
const banksRawData = yield ParsedGpa_1.ParsedGpa.build(connection, Bank_1.bankStruct, constants_1.marginfiProgramId)
|
25
|
+
.addRawFilter(0, 'QnTef4UXSzF')
|
26
|
+
.addRawFilter(41, constants_1.MarginfiAccountAddress)
|
27
|
+
.addDataSizeFilter(Bank_1.bankStruct.byteSize)
|
28
|
+
.run();
|
25
29
|
const banks = [];
|
26
30
|
const rateItems = [];
|
27
31
|
const sources = [];
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"banksJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/marginfi/banksJob.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+DAQoC;AACpC,6CAAmD;AACnD,
|
1
|
+
{"version":3,"file":"banksJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/marginfi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yBAAQ,EAAC,UAAU,CAAC;gBACzB,GAAG,EAAE,UAAU;aAChB;YACD,eAAe;YACf,UAAU,EAAV,sBAAU;YACV,QAAQ;SACT,CAAC;QAEF,SAAS,CAAC,IAAI,CAAC;YACb,GAAG,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,IAAI,YAAY,EAAE;YAChD,KAAK,EAAE,IAAI;SACZ,CAAC,CAAC;IACL,CAAC;IACD,MAAM,KAAK,CAAC,OAAO,CAAC,oBAAQ,EAAE,KAAK,EAAE;QACnC,MAAM,EAAE,sBAAU;QAClB,SAAS,EAAE,0BAAS,CAAC,MAAM;KAC5B,CAAC,CAAC;IACH,MAAM,KAAK,CAAC,QAAQ,CAAC,SAAS,EAAE;QAC9B,MAAM,EAAE,sCAAqB;QAC7B,SAAS,EAAE,0BAAS,CAAC,MAAM;KAC5B,CAAC,CAAC;IACH,MAAM,KAAK,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAC5C,CAAC,CAAA,CAAC;AAEF,MAAM,GAAG,GAAQ;IACf,EAAE,EAAE,GAAG,sBAAU,QAAQ;IACzB,QAAQ;IACR,MAAM,EAAE,CAAC,QAAQ,CAAC;CACnB,CAAC;AACF,kBAAe,GAAG,CAAC"}
|
@@ -2,10 +2,12 @@
|
|
2
2
|
/// <reference types="jito-ts/node_modules/@solana/web3.js" />
|
3
3
|
import { PublicKey } from '@solana/web3.js';
|
4
4
|
import { Platform } from '@sonarwatch/portfolio-core';
|
5
|
-
import
|
5
|
+
import { MemoizedCache } from '../../utils/misc/MemoizedCache';
|
6
|
+
import { ParsedAccount } from '../../utils/solana';
|
7
|
+
import { BankInfo } from './types';
|
6
8
|
export declare const platformId = "marginfi";
|
7
9
|
export declare const platform: Platform;
|
8
|
-
export declare const
|
10
|
+
export declare const marginfiProgramId: PublicKey;
|
9
11
|
export declare const MarginfiAccountAddress = "4qp6Fx6tnZkY5Wropq9wUYgtFxXKwE6viZxFHg3rdAG8";
|
10
12
|
export declare const banksKey = "banks";
|
11
|
-
export declare const
|
13
|
+
export declare const marginFiBanksMemo: MemoizedCache<ParsedAccount<BankInfo>[], Map<string, ParsedAccount<BankInfo>>>;
|
@@ -1,12 +1,10 @@
|
|
1
1
|
"use strict";
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
-
};
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.
|
3
|
+
exports.marginFiBanksMemo = exports.banksKey = exports.MarginfiAccountAddress = exports.marginfiProgramId = exports.platform = exports.platformId = void 0;
|
7
4
|
const web3_js_1 = require("@solana/web3.js");
|
8
5
|
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
9
|
-
const
|
6
|
+
const MemoizedCache_1 = require("../../utils/misc/MemoizedCache");
|
7
|
+
const arrayToMap_1 = require("../../utils/misc/arrayToMap");
|
10
8
|
exports.platformId = 'marginfi';
|
11
9
|
exports.platform = {
|
12
10
|
id: exports.platformId,
|
@@ -21,8 +19,11 @@ exports.platform = {
|
|
21
19
|
tokens: ['LSTxxxnJzKDFSLr4dUkPcmCf5VyryEqzPLz5j4bpxFp'],
|
22
20
|
description: 'A liquidity layer built for finance. Access native yield, embedded risk systems, and off-chain data plug-ins.',
|
23
21
|
};
|
24
|
-
exports.
|
22
|
+
exports.marginfiProgramId = new web3_js_1.PublicKey('MFv2hWf31Z9kbCa1snEPYctwafyhdvnV7FZnsebVacA');
|
25
23
|
exports.MarginfiAccountAddress = '4qp6Fx6tnZkY5Wropq9wUYgtFxXKwE6viZxFHg3rdAG8';
|
26
24
|
exports.banksKey = 'banks';
|
27
|
-
exports.
|
25
|
+
exports.marginFiBanksMemo = new MemoizedCache_1.MemoizedCache(exports.banksKey, {
|
26
|
+
prefix: exports.platformId,
|
27
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
28
|
+
}, (arr) => (0, arrayToMap_1.arrayToMap)(arr || [], 'pubkey'));
|
28
29
|
//# sourceMappingURL=constants.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/marginfi/constants.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/marginfi/constants.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAC5C,+DAAiE;AACjE,kEAA+D;AAG/D,4DAAyD;AAE5C,QAAA,UAAU,GAAG,UAAU,CAAC;AACxB,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,UAAU;IAChB,KAAK,EACH,8EAA8E;IAChF,WAAW,EAAE,iBAAiB;IAC9B,OAAO,EAAE,2BAA2B;IACpC,MAAM,EAAE,8BAA8B;IACtC,aAAa,EAAE,4BAA4B;IAC3C,OAAO,EAAE,8BAA8B;IACvC,QAAQ,EAAE,uBAAuB;IACjC,MAAM,EAAE,CAAC,6CAA6C,CAAC;IACvD,WAAW,EACT,+GAA+G;CAClH,CAAC;AACW,QAAA,iBAAiB,GAAG,IAAI,mBAAS,CAC5C,6CAA6C,CAC9C,CAAC;AAEW,QAAA,sBAAsB,GACjC,8CAA8C,CAAC;AAEpC,QAAA,QAAQ,GAAG,OAAO,CAAC;AAEnB,QAAA,iBAAiB,GAAG,IAAI,6BAAa,CAIhD,gBAAQ,EACR;IACE,MAAM,EAAE,kBAAU;IAClB,SAAS,EAAE,0BAAS,CAAC,MAAM;CAC5B,EACD,CAAC,GAAG,EAAE,EAAE,CAAC,IAAA,uBAAU,EAAC,GAAG,IAAI,EAAE,EAAE,QAAQ,CAAC,CACzC,CAAC"}
|