@sonarwatch/portfolio-plugins 0.12.120 → 0.12.122

Sign up to get free protection for your applications and to get access to all the features.
@@ -22,41 +22,64 @@ const solana_1 = require("../../utils/solana");
22
22
  const fetchTokenSupplyAndDecimals_1 = require("../../utils/solana/fetchTokenSupplyAndDecimals");
23
23
  const runInBatch_1 = __importDefault(require("../../utils/misc/runInBatch"));
24
24
  const computeAndStoreLpPrice_1 = require("../../utils/misc/computeAndStoreLpPrice");
25
- const getTokensPricesMap_1 = __importDefault(require("../../utils/misc/getTokensPricesMap"));
26
- const getLpUnderlyingTokenSourceOld_1 = __importDefault(require("../../utils/misc/getLpUnderlyingTokenSourceOld"));
27
25
  const getDecimalsForToken_1 = require("../../utils/misc/getDecimalsForToken");
28
- const getLpTokenSourceRawOld_1 = __importDefault(require("../../utils/misc/getLpTokenSourceRawOld"));
26
+ const getLpTokenSource_1 = require("../../utils/misc/getLpTokenSource");
29
27
  const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
30
28
  const client = (0, clients_1.getClientSolana)();
31
- const farmsAccounts = yield (0, solana_1.getParsedProgramAccounts)(client, oldLiquidities_1.aquafarmStruct, constants_1.aquafarmsProgram, filters_1.aquafarmFilters);
32
- const poolsAccounts = yield (0, solana_1.getParsedProgramAccounts)(client, oldLiquidities_1.poolInfoStruct, constants_1.poolsProgram, filters_1.poolsFilters);
33
- const mints = [];
29
+ const [farmsAccounts, poolsAccounts] = yield Promise.all([
30
+ (0, solana_1.getParsedProgramAccounts)(client, oldLiquidities_1.aquafarmStruct, constants_1.aquafarmsProgram, filters_1.aquafarmFilters),
31
+ (0, solana_1.getParsedProgramAccounts)(client, oldLiquidities_1.poolInfoStruct, constants_1.poolsProgram, filters_1.poolsFilters),
32
+ ]);
33
+ const mintsSet = new Set();
34
34
  const tokensAccountAddresses = [];
35
35
  farmsAccounts.forEach((farm) => {
36
- mints.push(farm.baseTokenMint.toString());
36
+ mintsSet.add(farm.baseTokenMint.toString());
37
37
  tokensAccountAddresses.push(farm.baseTokenVault);
38
38
  });
39
39
  poolsAccounts.forEach((pool) => {
40
- mints.push(...[pool.mintA.toString(), pool.mintB.toString()]);
40
+ mintsSet.add(pool.mintA.toString());
41
+ mintsSet.add(pool.mintB.toString());
41
42
  tokensAccountAddresses.push(...[pool.tokenAccountA, pool.tokenAccountB]);
42
43
  });
43
- const tokenPrices = yield (0, getTokensPricesMap_1.default)(mints, portfolio_core_1.NetworkId.solana, cache);
44
- const tokensAccounts = yield (0, solana_1.getParsedMultipleAccountsInfo)(client, solana_1.tokenAccountStruct, tokensAccountAddresses);
44
+ const mints = Array.from(mintsSet);
45
+ const [tokenPriceById, tokensAccounts, poolsSupplyAndDecimals, farmsSupplyAndDecimals,] = yield Promise.all([
46
+ cache.getTokenPricesAsMap(mints, portfolio_core_1.NetworkId.solana),
47
+ (0, solana_1.getParsedMultipleAccountsInfo)(client, solana_1.tokenAccountStruct, tokensAccountAddresses),
48
+ (0, runInBatch_1.default)(poolsAccounts.map((pool) => () => (0, fetchTokenSupplyAndDecimals_1.fetchTokenSupplyAndDecimals)(pool.tokenPool, client, 0))),
49
+ (0, runInBatch_1.default)(farmsAccounts.map((farm) => () => (0, fetchTokenSupplyAndDecimals_1.fetchTokenSupplyAndDecimals)(farm.farmTokenMint, client, 0))),
50
+ ]);
51
+ const unknownMints = mints.filter((mint) => !tokenPriceById.get(mint));
52
+ const mintDecimals = yield (0, runInBatch_1.default)(unknownMints.map((mint) => () => (0, getDecimalsForToken_1.getDecimalsForToken)(cache, mint, portfolio_core_1.NetworkId.solana)));
45
53
  const tokenAccountByAddress = new Map();
54
+ const tokensSupplyAndDecimalsByMint = new Map();
55
+ const decimalsByMint = new Map();
46
56
  tokensAccounts.forEach((tAccount) => {
47
57
  if (!tAccount)
48
58
  return;
49
59
  tokenAccountByAddress.set(tAccount.pubkey.toString(), tAccount);
50
60
  });
51
- const batchResult = yield (0, runInBatch_1.default)(poolsAccounts.map((pool) => () => (0, fetchTokenSupplyAndDecimals_1.fetchTokenSupplyAndDecimals)(pool.tokenPool, client, 0)));
52
- const poolTokenInfoByAddress = new Map();
53
- batchResult.forEach((r, index) => {
61
+ farmsSupplyAndDecimals.forEach((r, index) => {
54
62
  if (r.status === 'rejected')
55
63
  return;
56
64
  if (!r.value)
57
65
  return;
58
- poolTokenInfoByAddress.set(poolsAccounts[index].tokenPool.toString(), r.value);
66
+ tokensSupplyAndDecimalsByMint.set(farmsAccounts[index].farmTokenMint.toString(), r.value);
59
67
  });
68
+ poolsSupplyAndDecimals.forEach((r, index) => {
69
+ if (r.status === 'rejected')
70
+ return;
71
+ if (!r.value)
72
+ return;
73
+ tokensSupplyAndDecimalsByMint.set(poolsAccounts[index].tokenPool.toString(), r.value);
74
+ });
75
+ mintDecimals.forEach((r, index) => {
76
+ if (r.status === 'rejected')
77
+ return;
78
+ if (!r.value)
79
+ return;
80
+ decimalsByMint.set(mints[index], r.value);
81
+ });
82
+ const sources = [];
60
83
  for (const poolAccount of poolsAccounts) {
61
84
  if ([
62
85
  poolAccount.tokenAccountA.toString(),
@@ -64,7 +87,7 @@ const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
64
87
  ].includes('11111111111111111111111111111111'))
65
88
  continue;
66
89
  const lpMint = poolAccount.tokenPool;
67
- const lpSupplyAndDecimals = poolTokenInfoByAddress.get(lpMint.toString());
90
+ const lpSupplyAndDecimals = tokensSupplyAndDecimalsByMint.get(lpMint.toString());
68
91
  if (!lpSupplyAndDecimals)
69
92
  continue;
70
93
  const lpSupply = new bignumber_js_1.default(lpSupplyAndDecimals.supply).times(Math.pow(10, lpSupplyAndDecimals.decimals));
@@ -76,76 +99,53 @@ const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
76
99
  continue;
77
100
  const mintA = poolAccount.mintA.toString();
78
101
  const mintB = poolAccount.mintB.toString();
79
- const tokenPriceA = tokenPrices.get(poolAccount.mintA.toString());
80
- const tokenPriceB = tokenPrices.get(poolAccount.mintB.toString());
81
- const [decimalsA, decimalsB] = yield Promise.all([
82
- (0, getDecimalsForToken_1.getDecimalsForToken)(cache, mintA, portfolio_core_1.NetworkId.solana),
83
- (0, getDecimalsForToken_1.getDecimalsForToken)(cache, mintB, portfolio_core_1.NetworkId.solana),
84
- ]);
102
+ const tokenPriceA = tokenPriceById.get(poolAccount.mintA.toString());
103
+ const tokenPriceB = tokenPriceById.get(poolAccount.mintB.toString());
104
+ const [decimalsA, decimalsB] = [
105
+ (tokenPriceA === null || tokenPriceA === void 0 ? void 0 : tokenPriceA.decimals) || decimalsByMint.get(mintA),
106
+ (tokenPriceB === null || tokenPriceB === void 0 ? void 0 : tokenPriceB.decimals) || decimalsByMint.get(mintB),
107
+ ];
85
108
  const lpDecimals = lpSupplyAndDecimals.decimals;
86
109
  if (!decimalsA || !decimalsB)
87
110
  continue;
88
111
  const coinAmountWei = new bignumber_js_1.default(poolCoinTokenAccount.amount.toString());
89
112
  const pcAmountWei = new bignumber_js_1.default(poolPcTokenAccount.amount.toString());
90
- const underlyingSource = (0, getLpUnderlyingTokenSourceOld_1.default)(lpMint.toString(), portfolio_core_1.NetworkId.solana, {
91
- address: mintA,
92
- decimals: decimalsA,
93
- reserveAmountRaw: coinAmountWei,
94
- tokenPrice: tokenPriceA,
95
- weight: 0.5,
96
- }, {
97
- address: mintB,
98
- decimals: decimalsB,
99
- reserveAmountRaw: pcAmountWei,
100
- tokenPrice: tokenPriceB,
101
- weight: 0.5,
102
- });
103
- if (underlyingSource)
104
- yield cache.setTokenPriceSource(underlyingSource);
105
- if (!tokenPriceA || !tokenPriceB)
106
- continue;
107
- const lpSource = (0, getLpTokenSourceRawOld_1.default)(portfolio_core_1.NetworkId.solana, lpMint.toString(), constants_1.platformId, { address: lpMint.toString(), decimals: lpDecimals, supplyRaw: lpSupply }, [
108
- {
109
- address: tokenPriceA.address,
110
- decimals: tokenPriceA.decimals,
111
- price: tokenPriceA.price,
112
- reserveAmountRaw: coinAmountWei,
113
+ const tokenPriceSources = (0, getLpTokenSource_1.getLpTokenSource)({
114
+ lpDetails: {
115
+ address: lpMint.toString(),
116
+ decimals: lpDecimals,
117
+ supply: lpSupply.dividedBy(Math.pow(10, lpDecimals)).toNumber(),
113
118
  },
114
- {
115
- address: tokenPriceB.address,
116
- decimals: tokenPriceB.decimals,
117
- price: tokenPriceB.price,
118
- reserveAmountRaw: pcAmountWei,
119
- },
120
- ], 'Aquafarms (deprecated)');
121
- yield cache.setTokenPriceSource(lpSource);
122
- // const poolData: PoolData = {
123
- // id: lpMint.toString(),
124
- // lpDecimals,
125
- // mintTokenX: poolAccount.mintA.toString(),
126
- // mintTokenY: poolAccount.mintB.toString(),
127
- // reserveTokenX: coinAmountWei,
128
- // reserveTokenY: pcAmountWei,
129
- // supply: lpSupply,
130
- // decimalX: tokenPriceA.decimals,
131
- // decimalY: tokenPriceB.decimals,
132
- // };
133
- // await computeAndStoreLpPrice(cache, poolData, NetworkId.solana, platformId);
119
+ networkId: portfolio_core_1.NetworkId.solana,
120
+ platformId: constants_1.platformId,
121
+ poolUnderlyings: [
122
+ {
123
+ address: mintA,
124
+ decimals: decimalsA,
125
+ tokenPrice: tokenPriceA,
126
+ reserveAmount: coinAmountWei.dividedBy(Math.pow(10, decimalsA)).toNumber(),
127
+ },
128
+ {
129
+ address: mintB,
130
+ decimals: decimalsB,
131
+ reserveAmount: pcAmountWei.dividedBy(Math.pow(10, decimalsB)).toNumber(),
132
+ tokenPrice: tokenPriceB,
133
+ },
134
+ ],
135
+ sourceId: lpMint.toString(),
136
+ elementName: 'Aquafarms (deprecated)',
137
+ priceUnderlyings: true,
138
+ });
139
+ sources.push(...tokenPriceSources);
134
140
  }
135
- const tokensSupDecResult = yield (0, runInBatch_1.default)(farmsAccounts.map((farm) => () => (0, fetchTokenSupplyAndDecimals_1.fetchTokenSupplyAndDecimals)(farm.farmTokenMint, client, 0)));
136
- const tokensSuppliesAndDecimalsByMint = new Map();
137
- tokensSupDecResult.forEach((r, index) => {
138
- if (r.status === 'rejected')
139
- return;
140
- if (!r.value)
141
- return;
142
- tokensSuppliesAndDecimalsByMint.set(farmsAccounts[index].farmTokenMint.toString(), r.value);
143
- });
144
141
  for (let i = 0; i < farmsAccounts.length; i += 1) {
145
142
  const aquafarm = farmsAccounts[i];
143
+ if (aquafarm.farmTokenMint.toString() !==
144
+ 'DJseRvvLM53GrowUcjjCRYXJSzMH7dN5jrkGWaFAU3fm')
145
+ continue;
146
146
  const baseMint = aquafarm.baseTokenMint.toString();
147
- const baseToken = yield cache.getTokenPrice(baseMint, portfolio_core_1.NetworkId.solana);
148
- if (!baseToken)
147
+ const baseTokenPrice = tokenPriceById.get(baseMint);
148
+ if (!baseTokenPrice)
149
149
  continue;
150
150
  const baseVault = tokenAccountByAddress.get(aquafarm.baseTokenVault.toString());
151
151
  if (!baseVault)
@@ -153,18 +153,36 @@ const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
153
153
  if (baseVault.amount.isZero())
154
154
  continue;
155
155
  const farmMint = aquafarm.farmTokenMint.toString();
156
- const tokenSupplyRes = tokensSuppliesAndDecimalsByMint.get(farmMint);
156
+ const tokenSupplyRes = tokensSupplyAndDecimalsByMint.get(farmMint);
157
157
  if (!tokenSupplyRes)
158
158
  continue;
159
159
  const { decimals: farmDecimals, supply: farmSupply } = tokenSupplyRes;
160
160
  const baseVaultAmount = baseVault.amount
161
- .div(Math.pow(10, baseToken.decimals))
161
+ .div(Math.pow(10, baseTokenPrice.decimals))
162
162
  .toNumber();
163
- const baseVaultValue = baseVaultAmount * baseToken.price;
163
+ const baseVaultValue = baseVaultAmount * baseTokenPrice.price;
164
164
  if (baseVaultValue < computeAndStoreLpPrice_1.minimumLiquidity.toNumber())
165
165
  continue;
166
166
  const price = baseVaultValue / farmSupply;
167
- yield cache.setTokenPriceSource({
167
+ if (aquafarm.farmTokenMint.toString() ===
168
+ 'DJseRvvLM53GrowUcjjCRYXJSzMH7dN5jrkGWaFAU3fm') {
169
+ sources.push({
170
+ id: constants_1.orcaStakingPlatformId,
171
+ elementName: '(deprecated)',
172
+ weight: 1,
173
+ address: farmMint.toString(),
174
+ networkId: portfolio_core_1.NetworkId.solana,
175
+ platformId: constants_1.platformId,
176
+ decimals: farmDecimals,
177
+ price,
178
+ underlyings: baseTokenPrice.underlyings || [
179
+ Object.assign(Object.assign({}, baseTokenPrice), { amountPerLp: 1 }),
180
+ ],
181
+ timestamp: Date.now(),
182
+ });
183
+ continue;
184
+ }
185
+ sources.push({
168
186
  id: constants_1.platformId,
169
187
  elementName: 'Aquafarms (deprecated)',
170
188
  weight: 1,
@@ -173,10 +191,13 @@ const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
173
191
  platformId: constants_1.platformId,
174
192
  decimals: farmDecimals,
175
193
  price,
176
- underlyings: baseToken.underlyings,
194
+ underlyings: baseTokenPrice.underlyings || [
195
+ Object.assign(Object.assign({}, baseTokenPrice), { amountPerLp: 1 }),
196
+ ],
177
197
  timestamp: Date.now(),
178
198
  });
179
199
  }
200
+ yield cache.setTokenPriceSources(sources);
180
201
  });
181
202
  const job = {
182
203
  id: `${constants_1.platformId}-lp-tokens`,
@@ -1 +1 @@
1
- {"version":3,"file":"lpTokensJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/orca/lpTokensJob.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAAuD;AACvD,gEAAqC;AAErC,2CAAyE;AACzE,uCAA0D;AAC1D,iDAAsD;AACtD,6DAA0E;AAC1E,+CAK4B;AAC5B,gGAA6F;AAG7F,6EAAqD;AACrD,oFAA2E;AAC3E,6FAAoE;AACpE,mHAA2F;AAC3F,8EAA2E;AAC3E,qGAA6E;AAE7E,MAAM,QAAQ,GAAgB,CAAO,KAAY,EAAE,EAAE;IACnD,MAAM,MAAM,GAAG,IAAA,yBAAe,GAAE,CAAC;IACjC,MAAM,aAAa,GAAG,MAAM,IAAA,iCAAwB,EAClD,MAAM,EACN,+BAAc,EACd,4BAAgB,EAChB,yBAAe,CAChB,CAAC;IAEF,MAAM,aAAa,GAAG,MA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,WAAW,EAAE,cAAc,CAAC,WAAW,IAAI;oDACpC,cAAc,KAAE,WAAW,EAAE,CAAC;iBACpC;gBACD,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;aACtB,CAAC,CAAC;YACH,SAAS;QACX,CAAC;QAED,OAAO,CAAC,IAAI,CAAC;YACX,EAAE,EAAE,sBAAU;YACd,WAAW,EAAE,wBAAwB;YACrC,MAAM,EAAE,CAAC;YACT,OAAO,EAAE,QAAQ,CAAC,QAAQ,EAAE;YAC5B,SAAS,EAAE,0BAAS,CAAC,MAAM;YAC3B,UAAU,EAAV,sBAAU;YACV,QAAQ,EAAE,YAAY;YACtB,KAAK;YACL,WAAW,EAAE,cAAc,CAAC,WAAW,IAAI;gDACpC,cAAc,KAAE,WAAW,EAAE,CAAC;aACpC;YACD,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;SACtB,CAAC,CAAC;IACL,CAAC;IAED,MAAM,KAAK,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAC5C,CAAC,CAAA,CAAC;AAEF,MAAM,GAAG,GAAQ;IACf,EAAE,EAAE,GAAG,sBAAU,YAAY;IAC7B,QAAQ;IACR,KAAK,EAAE,QAAQ;CAChB,CAAC;AACF,kBAAe,GAAG,CAAC"}
@@ -54,30 +54,30 @@ function sushiV3PairToUniV2(pair) {
54
54
  }
55
55
  function getV3PairsAddresses(url, length = 300) {
56
56
  return __awaiter(this, void 0, void 0, function* () {
57
- const query = (0, graphql_request_1.gql) `
58
- {
59
- pools(
60
- orderBy: totalValueLockedUSD
61
- first: ${length}
62
- orderDirection: desc
63
- where: { volumeUSD_not: "0", liquidity_not: "0" }
64
- ) {
65
- id
66
- token0Price
67
- token1Price
68
- liquidity
69
- token0 {
70
- id
71
- totalSupply
72
- decimals
73
- }
74
- token1 {
75
- id
76
- totalSupply
77
- decimals
78
- }
79
- }
80
- }
57
+ const query = (0, graphql_request_1.gql) `
58
+ {
59
+ pools(
60
+ orderBy: totalValueLockedUSD
61
+ first: ${length}
62
+ orderDirection: desc
63
+ where: { volumeUSD_not: "0", liquidity_not: "0" }
64
+ ) {
65
+ id
66
+ token0Price
67
+ token1Price
68
+ liquidity
69
+ token0 {
70
+ id
71
+ totalSupply
72
+ decimals
73
+ }
74
+ token1 {
75
+ id
76
+ totalSupply
77
+ decimals
78
+ }
79
+ }
80
+ }
81
81
  `;
82
82
  const res = yield (0, graphql_request_1.default)(url, query);
83
83
  const pools = res.pools;
@@ -40,28 +40,28 @@ function getPairKey(version) {
40
40
  exports.getPairKey = getPairKey;
41
41
  function getPairsV2FromTheGraph(url, length = 300) {
42
42
  return __awaiter(this, void 0, void 0, function* () {
43
- const query = (0, graphql_request_1.gql) `
44
- {
45
- pairs(
46
- orderBy: reserveUSD
47
- first: ${length}
48
- orderDirection: desc
49
- where: { trackedReserveETH_not: "0" }
50
- ) {
51
- id
52
- reserve0
53
- reserve1
54
- totalSupply
55
- token0 {
56
- id
57
- decimals
58
- }
59
- token1 {
60
- id
61
- decimals
62
- }
63
- }
64
- }
43
+ const query = (0, graphql_request_1.gql) `
44
+ {
45
+ pairs(
46
+ orderBy: reserveUSD
47
+ first: ${length}
48
+ orderDirection: desc
49
+ where: { trackedReserveETH_not: "0" }
50
+ ) {
51
+ id
52
+ reserve0
53
+ reserve1
54
+ totalSupply
55
+ token0 {
56
+ id
57
+ decimals
58
+ }
59
+ token1 {
60
+ id
61
+ decimals
62
+ }
63
+ }
64
+ }
65
65
  `;
66
66
  const res = yield (0, graphql_request_1.default)(url, query);
67
67
  const pairs = res.pairs;
@@ -1,16 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.poolQueryMsg = exports.minterQueryMsg = exports.tokenInfoQueryMsg = exports.infoQueryMsg = void 0;
4
- exports.infoQueryMsg = JSON.parse(`{
5
- "info": {}
4
+ exports.infoQueryMsg = JSON.parse(`{
5
+ "info": {}
6
6
  }`);
7
- exports.tokenInfoQueryMsg = JSON.parse(`{
8
- "token_info": {}
7
+ exports.tokenInfoQueryMsg = JSON.parse(`{
8
+ "token_info": {}
9
9
  }`);
10
- exports.minterQueryMsg = JSON.parse(`{
11
- "minter": {}
10
+ exports.minterQueryMsg = JSON.parse(`{
11
+ "minter": {}
12
12
  }`);
13
- exports.poolQueryMsg = JSON.parse(`{
14
- "pool": {}
13
+ exports.poolQueryMsg = JSON.parse(`{
14
+ "pool": {}
15
15
  }`);
16
16
  //# sourceMappingURL=constants.js.map
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  function getQueryBalanceByOwner(owner) {
4
- return JSON.parse(`{
5
- "balance": {
6
- "address": "${owner}"
7
- }
4
+ return JSON.parse(`{
5
+ "balance": {
6
+ "address": "${owner}"
7
+ }
8
8
  }`);
9
9
  }
10
10
  exports.default = getQueryBalanceByOwner;