@sonarwatch/portfolio-plugins 0.11.220 → 0.11.221
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 +2 -2
- package/src/index.js +4 -0
- package/src/index.js.map +1 -1
- package/src/plugins/hedgehog/ammJob.d.ts +3 -0
- package/src/plugins/hedgehog/ammJob.js +119 -0
- package/src/plugins/hedgehog/ammJob.js.map +1 -0
- package/src/plugins/hedgehog/constants.d.ts +6 -0
- package/src/plugins/hedgehog/constants.js +16 -0
- package/src/plugins/hedgehog/constants.js.map +1 -0
- package/src/plugins/hedgehog/index.d.ts +6 -0
- package/src/plugins/hedgehog/index.js +12 -0
- package/src/plugins/hedgehog/index.js.map +1 -0
- package/src/plugins/hedgehog/structs.d.ts +40 -0
- package/src/plugins/hedgehog/structs.js +41 -0
- package/src/plugins/hedgehog/structs.js.map +1 -0
- package/src/plugins/orca/getWhirlpoolPositions.d.ts +3 -3
- package/src/plugins/orca/getWhirlpoolPositions.js +4 -4
- package/src/plugins/orca/getWhirlpoolPositions.js.map +1 -1
- package/src/plugins/raydium/clmmJob.js +1 -1
- package/src/plugins/raydium/clmmJob.js.map +1 -1
- package/src/plugins/raydium/constants.d.ts +1 -0
- package/src/plugins/raydium/constants.js +2 -1
- package/src/plugins/raydium/constants.js.map +1 -1
- package/src/plugins/raydium/cpmmJob.d.ts +3 -0
- package/src/plugins/raydium/cpmmJob.js +98 -0
- package/src/plugins/raydium/cpmmJob.js.map +1 -0
- package/src/plugins/raydium/filters.d.ts +2 -1
- package/src/plugins/raydium/filters.js +5 -2
- package/src/plugins/raydium/filters.js.map +1 -1
- package/src/plugins/raydium/index.js +2 -1
- package/src/plugins/raydium/index.js.map +1 -1
- package/src/plugins/raydium/structs/cpmm.d.ts +30 -0
- package/src/plugins/raydium/structs/cpmm.js +32 -0
- package/src/plugins/raydium/structs/cpmm.js.map +1 -0
- package/src/plugins/scallop/cnyAirdropFetcher.d.ts +3 -0
- package/src/plugins/scallop/cnyAirdropFetcher.js +79 -0
- package/src/plugins/scallop/cnyAirdropFetcher.js.map +1 -0
- package/src/plugins/scallop/constants.d.ts +2 -0
- package/src/plugins/scallop/constants.js +3 -1
- package/src/plugins/scallop/constants.js.map +1 -1
- package/src/plugins/scallop/index.js +2 -0
- package/src/plugins/scallop/index.js.map +1 -1
- package/src/plugins/scallop/types/data.d.ts +29 -0
- package/src/plugins/tokens/fetchers/solana-nfts-underlyings.js +39 -24
- package/src/plugins/tokens/fetchers/solana-nfts-underlyings.js.map +1 -1
- package/src/plugins/tokens/fetchers/solana.js +2 -0
- package/src/plugins/tokens/fetchers/solana.js.map +1 -1
- package/src/plugins/tokens/types.d.ts +1 -1
- package/src/utils/misc/getLpTokenSourceRaw.js +1 -1
- package/src/utils/misc/getLpTokenSourceRaw.js.map +1 -1
- package/src/utils/misc/getLpUnderlyingTokenSource.js +6 -6
- package/src/utils/misc/getLpUnderlyingTokenSource.js.map +1 -1
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.11.221](https://github.com/sonarwatch/portfolio/compare/plugins-0.11.220...plugins-0.11.221) (2024-05-28)
|
6
|
+
|
7
|
+
|
8
|
+
|
5
9
|
## [0.11.220](https://github.com/sonarwatch/portfolio/compare/plugins-0.11.219...plugins-0.11.220) (2024-05-27)
|
6
10
|
|
7
11
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@sonarwatch/portfolio-plugins",
|
3
|
-
"version": "0.11.
|
3
|
+
"version": "0.11.221",
|
4
4
|
"type": "commonjs",
|
5
5
|
"generators": "./generators.json",
|
6
6
|
"dependencies": {
|
@@ -42,7 +42,7 @@
|
|
42
42
|
"web3-v1": "npm:web3@^1.5.0"
|
43
43
|
},
|
44
44
|
"peerDependencies": {
|
45
|
-
"@sonarwatch/portfolio-core": "0.11.
|
45
|
+
"@sonarwatch/portfolio-core": "0.11.221"
|
46
46
|
},
|
47
47
|
"main": "./src/index.js",
|
48
48
|
"types": "./src/index.d.ts"
|
package/src/index.js
CHANGED
@@ -114,6 +114,7 @@ const flowx_1 = require("./plugins/flowx");
|
|
114
114
|
const mole_1 = require("./plugins/mole");
|
115
115
|
const bonfida_1 = require("./plugins/bonfida");
|
116
116
|
const cropper_1 = require("./plugins/cropper");
|
117
|
+
const hedgehog_1 = require("./plugins/hedgehog");
|
117
118
|
var constants_1 = require("./plugins/tokens/constants");
|
118
119
|
Object.defineProperty(exports, "walletTokensPlatform", { enumerable: true, get: function () { return constants_1.walletTokensPlatform; } });
|
119
120
|
Object.defineProperty(exports, "walletNftsPlatform", { enumerable: true, get: function () { return constants_1.walletNftsPlatform; } });
|
@@ -221,6 +222,7 @@ exports.platforms = [
|
|
221
222
|
...mole_1.platforms,
|
222
223
|
...bonfida_1.platforms,
|
223
224
|
...cropper_1.platforms,
|
225
|
+
...hedgehog_1.platforms,
|
224
226
|
];
|
225
227
|
// JOBS //
|
226
228
|
exports.jobs = [
|
@@ -311,6 +313,7 @@ exports.jobs = [
|
|
311
313
|
...mole_1.jobs,
|
312
314
|
...bonfida_1.jobs,
|
313
315
|
...cropper_1.jobs,
|
316
|
+
...hedgehog_1.jobs,
|
314
317
|
];
|
315
318
|
// FETCHERS //
|
316
319
|
exports.fetchers = [
|
@@ -403,6 +406,7 @@ exports.fetchers = [
|
|
403
406
|
...mole_1.fetchers,
|
404
407
|
...bonfida_1.fetchers,
|
405
408
|
...cropper_1.fetchers,
|
409
|
+
...hedgehog_1.fetchers,
|
406
410
|
];
|
407
411
|
exports.fetchersByAddressSystem = (0, getFetchersByAddressSystem_1.getFetchersByAddressSystem)(exports.fetchers);
|
408
412
|
exports.airdropFetchers = [
|
package/src/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/plugins/src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;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;AAE/D,QAAA,eAAe,GAAqB;IAC/C,sBAAmB;IACnB,sBAAmB;CACpB,CAAC;AACW,QAAA,8BAA8B,GACzC,IAAA,uDAA0B,EAAC,uBAAe,CAAC,CAAC"}
|
@@ -0,0 +1,119 @@
|
|
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 constants_1 = require("./constants");
|
14
|
+
const clients_1 = require("../../utils/clients");
|
15
|
+
const solana_1 = require("../../utils/solana");
|
16
|
+
const structs_1 = require("./structs");
|
17
|
+
const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
18
|
+
const client = (0, clients_1.getClientSolana)();
|
19
|
+
const accounts = yield (0, solana_1.getParsedProgramAccounts)(client, structs_1.swapStruct, constants_1.ammPid, [
|
20
|
+
{
|
21
|
+
dataSize: structs_1.swapStruct.byteSize,
|
22
|
+
},
|
23
|
+
]);
|
24
|
+
if (accounts.length === 0)
|
25
|
+
return;
|
26
|
+
const tokenSwapAddresses = accounts.map((a) => a.underlyingSwap);
|
27
|
+
const tokenSwapAccounts = (yield (0, solana_1.getParsedMultipleAccountsInfo)(client, structs_1.tokenSwapStruct, tokenSwapAddresses)).filter((a) => a !== null);
|
28
|
+
// Token accounts
|
29
|
+
const tokenAccountAddresses = tokenSwapAccounts
|
30
|
+
.map((a) => [a.tokenAccountA, a.tokenAccountB])
|
31
|
+
.flat();
|
32
|
+
const tokenAccounts = yield (0, solana_1.getParsedMultipleAccountsInfo)(client, solana_1.tokenAccountStruct, tokenAccountAddresses);
|
33
|
+
const tokenAccountsMap = new Map();
|
34
|
+
tokenAccounts.forEach((a) => {
|
35
|
+
if (!a)
|
36
|
+
return;
|
37
|
+
tokenAccountsMap.set(a.pubkey.toString(), a);
|
38
|
+
});
|
39
|
+
// Mint accounts
|
40
|
+
const mintAddresses = tokenSwapAccounts
|
41
|
+
.map((a) => [a.mintA, a.mintB, a.tokenPool])
|
42
|
+
.flat();
|
43
|
+
const mintAccounts = yield (0, solana_1.getParsedMultipleAccountsInfo)(client, solana_1.mintAccountStruct, mintAddresses);
|
44
|
+
const mintAccountsMap = new Map();
|
45
|
+
mintAccounts.forEach((a) => {
|
46
|
+
if (!a)
|
47
|
+
return;
|
48
|
+
mintAccountsMap.set(a.pubkey.toString(), a);
|
49
|
+
});
|
50
|
+
const tokenPrices = yield cache.getTokenPricesAsMap(tokenSwapAccounts.map((a) => a.tokenPool.toString()), portfolio_core_1.NetworkId.solana);
|
51
|
+
const sources = [];
|
52
|
+
for (let i = 0; i < tokenSwapAccounts.length; i++) {
|
53
|
+
const acc = tokenSwapAccounts[i];
|
54
|
+
const poolMint = mintAccountsMap.get(acc.tokenPool.toString());
|
55
|
+
if (!poolMint)
|
56
|
+
continue;
|
57
|
+
const mintA = mintAccountsMap.get(acc.mintA.toString());
|
58
|
+
const mintB = mintAccountsMap.get(acc.mintB.toString());
|
59
|
+
if (!mintA || !mintB)
|
60
|
+
continue;
|
61
|
+
const tokenAccountA = tokenAccountsMap.get(acc.tokenAccountA.toString());
|
62
|
+
const tokenAccountB = tokenAccountsMap.get(acc.tokenAccountB.toString());
|
63
|
+
if (!tokenAccountA || !tokenAccountB)
|
64
|
+
continue;
|
65
|
+
if (tokenAccountA.amount.isZero())
|
66
|
+
continue;
|
67
|
+
if (tokenAccountB.amount.isZero())
|
68
|
+
continue;
|
69
|
+
const tokenPrice = tokenPrices.get(acc.tokenPool.toString());
|
70
|
+
if (!tokenPrice)
|
71
|
+
continue;
|
72
|
+
const totalAmount = tokenAccountA.amount.plus(tokenAccountB.amount);
|
73
|
+
const priceA = totalAmount
|
74
|
+
.plus(tokenAccountA.amount)
|
75
|
+
.div(totalAmount)
|
76
|
+
.minus(1)
|
77
|
+
.times(tokenPrice === null || tokenPrice === void 0 ? void 0 : tokenPrice.price)
|
78
|
+
.toNumber();
|
79
|
+
const priceB = totalAmount
|
80
|
+
.plus(tokenAccountB.amount)
|
81
|
+
.div(totalAmount)
|
82
|
+
.minus(1)
|
83
|
+
.times(tokenPrice === null || tokenPrice === void 0 ? void 0 : tokenPrice.price)
|
84
|
+
.toNumber();
|
85
|
+
const sourceA = {
|
86
|
+
address: mintA.pubkey.toString(),
|
87
|
+
decimals: mintA.decimals,
|
88
|
+
id: constants_1.platformId,
|
89
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
90
|
+
platformId: constants_1.platformId,
|
91
|
+
timestamp: Date.now(),
|
92
|
+
elementName: 'Hedgehog AMM',
|
93
|
+
liquidityName: 'Bet - YES',
|
94
|
+
weight: 1,
|
95
|
+
price: priceA,
|
96
|
+
};
|
97
|
+
const sourceB = {
|
98
|
+
address: mintB.pubkey.toString(),
|
99
|
+
decimals: mintB.decimals,
|
100
|
+
id: constants_1.platformId,
|
101
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
102
|
+
platformId: constants_1.platformId,
|
103
|
+
timestamp: Date.now(),
|
104
|
+
elementName: 'Hedgehog AMM',
|
105
|
+
liquidityName: 'Bet - YES',
|
106
|
+
weight: 1,
|
107
|
+
price: priceB,
|
108
|
+
};
|
109
|
+
sources.push(sourceA, sourceB);
|
110
|
+
}
|
111
|
+
yield cache.setTokenPriceSources(sources);
|
112
|
+
});
|
113
|
+
const job = {
|
114
|
+
id: `${constants_1.platformId}-amm`,
|
115
|
+
executor,
|
116
|
+
label: 'normal',
|
117
|
+
};
|
118
|
+
exports.default = job;
|
119
|
+
//# sourceMappingURL=ammJob.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"ammJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/hedgehog/ammJob.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+DAAyE;AAGzE,2CAAiD;AACjD,iDAAsD;AACtD,+CAQ4B;AAC5B,uCAAmE;AAEnE,MAAM,QAAQ,GAAgB,CAAO,KAAY,EAAE,EAAE;IACnD,MAAM,MAAM,GAAG,IAAA,yBAAe,GAAE,CAAC;IAEjC,MAAM,QAAQ,GAAG,MAAM,IAAA,iCAAwB,EAAC,MAAM,EAAE,oBAAU,EAAE,kBAAM,EAAE;QAC1E;YACE,QAAQ,EAAE,oBAAU,CAAC,QAAQ;SAC9B;KACF,CAAC,CAAC;IACH,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO;IAClC,MAAM,kBAAkB,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC;IACjE,MAAM,iBAAiB,GAAG,CACxB,MAAM,IAAA,sCAA6B,EACjC,MAAM,EACN,yBAAe,EACf,kBAAkB,CACnB,CACF,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,IAAI,CAA+B,CAAC;IAE1D,iBAAiB;IACjB,MAAM,qBAAqB,GAAG,iBAAiB;SAC5C,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC,CAAC,aAAa,CAAC,CAAC;SAC9C,IAAI,EAAE,CAAC;IACV,MAAM,aAAa,GAAG,MAAM,IAAA,sCAA6B,EACvD,MAAM,EACN,2BAAkB,EAClB,qBAAqB,CACtB,CAAC;IACF,MAAM,gBAAgB,GAA6C,IAAI,GAAG,EAAE,CAAC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|
+
export declare const platformId = "hedgehog";
|
4
|
+
export declare const platform: Platform;
|
5
|
+
export declare const ammPid: PublicKey;
|
6
|
+
export declare const swapPid: PublicKey;
|
@@ -0,0 +1,16 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.swapPid = exports.ammPid = exports.platform = exports.platformId = void 0;
|
4
|
+
const web3_js_1 = require("@solana/web3.js");
|
5
|
+
exports.platformId = 'hedgehog';
|
6
|
+
exports.platform = {
|
7
|
+
id: exports.platformId,
|
8
|
+
name: 'Hedgehog Markets',
|
9
|
+
image: 'https://sonar.watch/img/platforms/hedgehog.webp',
|
10
|
+
website: 'https://hedgehog.markets',
|
11
|
+
twitter: 'https://twitter.com/HedgehogMarket',
|
12
|
+
// defiLlamaId: 'foo-finance', // from https://defillama.com/docs/api
|
13
|
+
};
|
14
|
+
exports.ammPid = new web3_js_1.PublicKey('Hr4whNgXr3yZsJvx3TVSwfsFgXuSEPB1xKmvgrtLhsrM');
|
15
|
+
exports.swapPid = new web3_js_1.PublicKey('2ZznCMfx2XP43zaPw9R9wKnjXWiEeEexyhdBPv3UqDtD');
|
16
|
+
//# sourceMappingURL=constants.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/hedgehog/constants.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAG/B,QAAA,UAAU,GAAG,UAAU,CAAC;AACxB,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,kBAAkB;IACxB,KAAK,EAAE,iDAAiD;IACxD,OAAO,EAAE,0BAA0B;IACnC,OAAO,EAAE,oCAAoC;IAC7C,qEAAqE;CACtE,CAAC;AACW,QAAA,MAAM,GAAG,IAAI,mBAAS,CACjC,8CAA8C,CAC/C,CAAC;AACW,QAAA,OAAO,GAAG,IAAI,mBAAS,CAClC,8CAA8C,CAC/C,CAAC"}
|
@@ -0,0 +1,12 @@
|
|
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 ammJob_1 = __importDefault(require("./ammJob"));
|
9
|
+
exports.platforms = [constants_1.platform];
|
10
|
+
exports.jobs = [ammJob_1.default];
|
11
|
+
exports.fetchers = [];
|
12
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/hedgehog/index.ts"],"names":[],"mappings":";;;;;;AAGA,2CAAuC;AACvC,sDAA8B;AAEjB,QAAA,SAAS,GAAe,CAAC,oBAAQ,CAAC,CAAC;AACnC,QAAA,IAAI,GAAU,CAAC,gBAAM,CAAC,CAAC;AACvB,QAAA,QAAQ,GAAc,EAAE,CAAC"}
|
@@ -0,0 +1,40 @@
|
|
1
|
+
/// <reference types="node" />
|
2
|
+
import { BeetStruct } from '@metaplex-foundation/beet';
|
3
|
+
import { PublicKey } from '@solana/web3.js';
|
4
|
+
import BigNumber from 'bignumber.js';
|
5
|
+
export type Swap = {
|
6
|
+
buffer: Buffer;
|
7
|
+
underlyingSwap: PublicKey;
|
8
|
+
creator: PublicKey;
|
9
|
+
fees: Buffer;
|
10
|
+
index: BigNumber;
|
11
|
+
volume: BigNumber;
|
12
|
+
nonce: number;
|
13
|
+
padding: Buffer;
|
14
|
+
};
|
15
|
+
export declare const swapStruct: BeetStruct<Swap, Partial<Swap>>;
|
16
|
+
export type TokenSwap = {
|
17
|
+
buffer: Buffer;
|
18
|
+
version: number;
|
19
|
+
isInitialized: number;
|
20
|
+
bumpSeed: number;
|
21
|
+
tokenProgramId: PublicKey;
|
22
|
+
mintA: PublicKey;
|
23
|
+
mintB: PublicKey;
|
24
|
+
tokenPool: PublicKey;
|
25
|
+
tokenAccountA: PublicKey;
|
26
|
+
tokenAccountB: PublicKey;
|
27
|
+
feeAccount: PublicKey;
|
28
|
+
tradeFeeNumerator: BigNumber;
|
29
|
+
tradeFeeDenominator: BigNumber;
|
30
|
+
ownerTradeFeeNumerator: BigNumber;
|
31
|
+
ownerTradeFeeDenominator: BigNumber;
|
32
|
+
ownerWithdrawFeeNumerator: BigNumber;
|
33
|
+
ownerWithdrawFeeDenominator: BigNumber;
|
34
|
+
hostFeeNumerator: BigNumber;
|
35
|
+
hostFeeDenominator: BigNumber;
|
36
|
+
curveType: number;
|
37
|
+
curveParameters: Buffer;
|
38
|
+
swapGuardian: PublicKey;
|
39
|
+
};
|
40
|
+
export declare const tokenSwapStruct: BeetStruct<TokenSwap, Partial<TokenSwap>>;
|
@@ -0,0 +1,41 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.tokenSwapStruct = exports.swapStruct = void 0;
|
4
|
+
const beet_1 = require("@metaplex-foundation/beet");
|
5
|
+
const beet_solana_1 = require("@metaplex-foundation/beet-solana");
|
6
|
+
const solana_1 = require("../../utils/solana");
|
7
|
+
exports.swapStruct = new beet_1.BeetStruct([
|
8
|
+
['buffer', (0, solana_1.blob)(8)],
|
9
|
+
['underlyingSwap', beet_solana_1.publicKey],
|
10
|
+
['creator', beet_solana_1.publicKey],
|
11
|
+
['fees', (0, solana_1.blob)(12)],
|
12
|
+
['index', solana_1.u64],
|
13
|
+
['volume', solana_1.u128],
|
14
|
+
['nonce', beet_1.u8],
|
15
|
+
['padding', (0, solana_1.blob)(32)],
|
16
|
+
], (args) => args);
|
17
|
+
exports.tokenSwapStruct = new beet_1.BeetStruct([
|
18
|
+
['buffer', (0, solana_1.blob)(5)],
|
19
|
+
['version', beet_1.u8],
|
20
|
+
['isInitialized', beet_1.u8],
|
21
|
+
['bumpSeed', beet_1.u8],
|
22
|
+
['tokenProgramId', beet_solana_1.publicKey],
|
23
|
+
['mintA', beet_solana_1.publicKey],
|
24
|
+
['mintB', beet_solana_1.publicKey],
|
25
|
+
['tokenPool', beet_solana_1.publicKey],
|
26
|
+
['tokenAccountA', beet_solana_1.publicKey],
|
27
|
+
['tokenAccountB', beet_solana_1.publicKey],
|
28
|
+
['feeAccount', beet_solana_1.publicKey],
|
29
|
+
['tradeFeeNumerator', solana_1.u64],
|
30
|
+
['tradeFeeDenominator', solana_1.u64],
|
31
|
+
['ownerTradeFeeNumerator', solana_1.u64],
|
32
|
+
['ownerTradeFeeDenominator', solana_1.u64],
|
33
|
+
['ownerWithdrawFeeNumerator', solana_1.u64],
|
34
|
+
['ownerWithdrawFeeDenominator', solana_1.u64],
|
35
|
+
['hostFeeNumerator', solana_1.u64],
|
36
|
+
['hostFeeDenominator', solana_1.u64],
|
37
|
+
['curveType', beet_1.u8],
|
38
|
+
['curveParameters', (0, solana_1.blob)(32)],
|
39
|
+
['swapGuardian', beet_solana_1.publicKey],
|
40
|
+
], (args) => args);
|
41
|
+
//# sourceMappingURL=structs.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"structs.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/hedgehog/structs.ts"],"names":[],"mappings":";;;AAAA,oDAA2D;AAC3D,kEAA6D;AAG7D,+CAAqD;AAaxC,QAAA,UAAU,GAAG,IAAI,iBAAU,CACtC;IACE,CAAC,QAAQ,EAAE,IAAA,aAAI,EAAC,CAAC,CAAC,CAAC;IACnB,CAAC,gBAAgB,EAAE,uBAAS,CAAC;IAC7B,CAAC,SAAS,EAAE,uBAAS,CAAC;IACtB,CAAC,MAAM,EAAE,IAAA,aAAI,EAAC,EAAE,CAAC,CAAC;IAClB,CAAC,OAAO,EAAE,YAAG,CAAC;IACd,CAAC,QAAQ,EAAE,aAAI,CAAC;IAChB,CAAC,OAAO,EAAE,SAAE,CAAC;IACb,CAA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{ NftFetcher } from '../tokens/types';
|
3
|
+
export declare const getWhirlpoolPositions: NftFetcher;
|
4
|
+
export declare function getOrcaNftFetcher(platformId: string, programId: PublicKey): NftFetcher;
|
@@ -12,7 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
13
13
|
};
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
15
|
-
exports.
|
15
|
+
exports.getOrcaNftFetcher = exports.getWhirlpoolPositions = void 0;
|
16
16
|
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
17
17
|
const web3_js_1 = require("@solana/web3.js");
|
18
18
|
const constants_1 = require("./constants");
|
@@ -22,8 +22,8 @@ const whirlpool_1 = require("./structs/whirlpool");
|
|
22
22
|
const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetToken"));
|
23
23
|
const runInBatch_1 = __importDefault(require("../../utils/misc/runInBatch"));
|
24
24
|
const tokenAmountFromLiquidity_1 = require("../../utils/clmm/tokenAmountFromLiquidity");
|
25
|
-
exports.getWhirlpoolPositions =
|
26
|
-
function
|
25
|
+
exports.getWhirlpoolPositions = getOrcaNftFetcher(constants_1.platformId, constants_1.whirlpoolProgram);
|
26
|
+
function getOrcaNftFetcher(platformId, programId) {
|
27
27
|
return (cache, nfts) => __awaiter(this, void 0, void 0, function* () {
|
28
28
|
const client = (0, clients_1.getClientSolana)();
|
29
29
|
const positionsProgramAddress = [];
|
@@ -123,5 +123,5 @@ function getOrcaAppraiser(platformId, programId) {
|
|
123
123
|
];
|
124
124
|
});
|
125
125
|
}
|
126
|
-
exports.
|
126
|
+
exports.getOrcaNftFetcher = getOrcaNftFetcher;
|
127
127
|
//# sourceMappingURL=getWhirlpoolPositions.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"getWhirlpoolPositions.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/orca/getWhirlpoolPositions.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+DAOoC;AACpC,6CAA4C;AAC5C,2CAIqB;AACrB,iDAAsD;AACtD,+CAG4B;AAE5B,mDAAgE;AAChE,qGAA6E;AAC7E,6EAAqD;AACrD,wFAAyF;AAG5E,QAAA,qBAAqB,GAAG,
|
1
|
+
{"version":3,"file":"getWhirlpoolPositions.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/orca/getWhirlpoolPositions.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+DAOoC;AACpC,6CAA4C;AAC5C,2CAIqB;AACrB,iDAAsD;AACtD,+CAG4B;AAE5B,mDAAgE;AAChE,qGAA6E;AAC7E,6EAAqD;AACrD,wFAAyF;AAG5E,QAAA,qBAAqB,GAAG,iBAAiB,CACpD,sBAAc,EACd,4BAAgB,CACjB,CAAC;AAEF,SAAgB,iBAAiB,CAC/B,UAAkB,EAClB,SAAoB;IAEpB,OAAO,CACL,KAAY,EACZ,IAAiC,EACJ,EAAE;QAC/B,MAAM,MAAM,GAAG,IAAA,yBAAe,GAAE,CAAC;QACjC,MAAM,uBAAuB,GAAgB,EAAE,CAAC;QAEhD,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;YACnB,MAAM,OAAO,GAAG,IAAI,mBAAS,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAEhD,MAAM,YAAY,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;YAEnE,MAAM,CAAC,cAAc,CAAC,GAAG,mBAAS,CAAC,sBAAsB,CACvD,YAAY,EACZ,SAAS,CACV,CAAC;YACF,uBAAuB,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QAC/C,CAAC,CAAC,CAAC;QACH,IAAI,uBAAuB,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,EAAE,CAAC;QAEpD,MAAM,aAAa,GAAG,MAA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E,qCAAoB,CAAC,SAAS;gBACpC,SAAS,EAAE,0BAAS,CAAC,MAAM;gBAC3B,UAAU;gBACV,KAAK,EAAE,eAAe;gBACtB,IAAI,EAAE,cAAc;gBACpB,KAAK,EAAE,mBAAmB;gBAC1B,IAAI,EAAE;oBACJ,WAAW,EAAE,MAAM;iBACpB;aACF;SACF,CAAC;IACJ,CAAC,CAAA,CAAC;AACJ,CAAC;AAlJD,8CAkJC"}
|
@@ -22,7 +22,7 @@ const clmms_1 = require("./structs/clmms");
|
|
22
22
|
const filters_1 = require("./filters");
|
23
23
|
const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
24
24
|
const client = (0, clients_1.getClientSolana)();
|
25
|
-
const clmmPoolsInfo = yield (0, solana_1.getParsedProgramAccounts)(client, clmms_1.poolStateStruct, constants_1.raydiumProgram, filters_1.
|
25
|
+
const clmmPoolsInfo = yield (0, solana_1.getParsedProgramAccounts)(client, clmms_1.poolStateStruct, constants_1.raydiumProgram, filters_1.clmmPoolsStateFilter);
|
26
26
|
const promises = [];
|
27
27
|
for (let id = 0; id < clmmPoolsInfo.length; id++) {
|
28
28
|
const poolState = clmmPoolsInfo[id];
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"clmmJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/raydium/clmmJob.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAAuD;AACvD,gEAAqC;AACrC,2CAA2E;AAC3E,+CAA8D;AAC9D,iDAAsD;AAGtD,+FAA4E;AAC5E,2CAAkD;AAClD,
|
1
|
+
{"version":3,"file":"clmmJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/raydium/clmmJob.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAAuD;AACvD,gEAAqC;AACrC,2CAA2E;AAC3E,+CAA8D;AAC9D,iDAAsD;AAGtD,+FAA4E;AAC5E,2CAAkD;AAClD,uCAAiD;AAEjD,MAAM,QAAQ,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;AAEF,MAAM,GAAG,GAAQ;IACf,EAAE,EAAE,GAAG,sBAAU,OAAO;IACxB,QAAQ;IACR,KAAK,EAAE,QAAQ;CAChB,CAAC;AACF,kBAAe,GAAG,CAAC"}
|
@@ -6,6 +6,7 @@ export declare const AMM_PROGRAM_ID_V3: PublicKey;
|
|
6
6
|
export declare const AMM_PROGRAM_ID_V4: PublicKey;
|
7
7
|
export declare const AMM_PROGRAM_ID_V5: PublicKey;
|
8
8
|
export declare const raydiumProgram: PublicKey;
|
9
|
+
export declare const cpmmProgramId: PublicKey;
|
9
10
|
export declare const poolStatesPrefix = "raydium-poolSates";
|
10
11
|
export declare const positionsIdentifier = "Raydium Concentrated Liquidity";
|
11
12
|
export declare const rayMint = "4k3Dyjzvzp8eMZWUXbBCjEvwSkkk59S5iCNLY3QrkX6R";
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.rayDecimals = exports.rayMint = exports.positionsIdentifier = exports.poolStatesPrefix = exports.raydiumProgram = exports.AMM_PROGRAM_ID_V5 = exports.AMM_PROGRAM_ID_V4 = exports.AMM_PROGRAM_ID_V3 = exports.platform = exports.platformId = void 0;
|
3
|
+
exports.rayDecimals = exports.rayMint = exports.positionsIdentifier = exports.poolStatesPrefix = exports.cpmmProgramId = exports.raydiumProgram = exports.AMM_PROGRAM_ID_V5 = exports.AMM_PROGRAM_ID_V4 = exports.AMM_PROGRAM_ID_V3 = exports.platform = exports.platformId = void 0;
|
4
4
|
const web3_js_1 = require("@solana/web3.js");
|
5
5
|
exports.platformId = 'raydium';
|
6
6
|
exports.platform = {
|
@@ -14,6 +14,7 @@ exports.AMM_PROGRAM_ID_V3 = new web3_js_1.PublicKey('EhhTKczWMGQt46ynNeRX1Wfeagw
|
|
14
14
|
exports.AMM_PROGRAM_ID_V4 = new web3_js_1.PublicKey('675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8');
|
15
15
|
exports.AMM_PROGRAM_ID_V5 = new web3_js_1.PublicKey('5quBtoiQqxF9Jv6KYKctB59NT3gtJD2Y65kdnB1Uev3h');
|
16
16
|
exports.raydiumProgram = new web3_js_1.PublicKey('CAMMCzo5YL8w4VFF8KVHrK22GGUsp5VTaW7grrKgrWqK');
|
17
|
+
exports.cpmmProgramId = new web3_js_1.PublicKey('CPMMoo8L3F4NbTegBCKVNunggL7H1ZpdTHKxQB5qKP1C');
|
17
18
|
exports.poolStatesPrefix = `${exports.platformId}-poolSates`;
|
18
19
|
exports.positionsIdentifier = 'Raydium Concentrated Liquidity';
|
19
20
|
exports.rayMint = '4k3Dyjzvzp8eMZWUXbBCjEvwSkkk59S5iCNLY3QrkX6R';
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/raydium/constants.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAG/B,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;IACtB,OAAO,EAAE,qBAAqB;CAC/B,CAAC;AAEW,QAAA,iBAAiB,GAAG,IAAI,mBAAS,CAC5C,8CAA8C,CAC/C,CAAC;AAEW,QAAA,iBAAiB,GAAG,IAAI,mBAAS,CAC5C,8CAA8C,CAC/C,CAAC;AAEW,QAAA,iBAAiB,GAAG,IAAI,mBAAS,CAC5C,8CAA8C,CAC/C,CAAC;AAEW,QAAA,cAAc,GAAG,IAAI,mBAAS,CACzC,8CAA8C,CAC/C,CAAC;AAEW,QAAA,gBAAgB,GAAG,GAAG,kBAAU,YAAY,CAAC;AAE7C,QAAA,mBAAmB,GAAG,gCAAgC,CAAC;AAEvD,QAAA,OAAO,GAAG,8CAA8C,CAAC;AACzD,QAAA,WAAW,GAAG,CAAC,CAAC"}
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/raydium/constants.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAG/B,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;IACtB,OAAO,EAAE,qBAAqB;CAC/B,CAAC;AAEW,QAAA,iBAAiB,GAAG,IAAI,mBAAS,CAC5C,8CAA8C,CAC/C,CAAC;AAEW,QAAA,iBAAiB,GAAG,IAAI,mBAAS,CAC5C,8CAA8C,CAC/C,CAAC;AAEW,QAAA,iBAAiB,GAAG,IAAI,mBAAS,CAC5C,8CAA8C,CAC/C,CAAC;AAEW,QAAA,cAAc,GAAG,IAAI,mBAAS,CACzC,8CAA8C,CAC/C,CAAC;AAEW,QAAA,aAAa,GAAG,IAAI,mBAAS,CACxC,8CAA8C,CAC/C,CAAC;AAEW,QAAA,gBAAgB,GAAG,GAAG,kBAAU,YAAY,CAAC;AAE7C,QAAA,mBAAmB,GAAG,gCAAgC,CAAC;AAEvD,QAAA,OAAO,GAAG,8CAA8C,CAAC;AACzD,QAAA,WAAW,GAAG,CAAC,CAAC"}
|
@@ -0,0 +1,98 @@
|
|
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 constants_1 = require("./constants");
|
14
|
+
const solana_1 = require("../../utils/solana");
|
15
|
+
const clients_1 = require("../../utils/clients");
|
16
|
+
const filters_1 = require("./filters");
|
17
|
+
const cpmm_1 = require("./structs/cpmm");
|
18
|
+
const getLpTokenSourceRaw_1 = require("../../utils/misc/getLpTokenSourceRaw");
|
19
|
+
const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
20
|
+
const client = (0, clients_1.getClientSolana)();
|
21
|
+
const clmmPoolsInfo = yield (0, solana_1.getParsedProgramAccounts)(client, cpmm_1.poolStateStruct, constants_1.cpmmProgramId, filters_1.cpmmPoolsStateFilter);
|
22
|
+
const tokenAccountsPkeys = [];
|
23
|
+
const mints = new Set();
|
24
|
+
clmmPoolsInfo.forEach((pI) => {
|
25
|
+
mints.add(pI.token0Mint.toString());
|
26
|
+
mints.add(pI.token1Mint.toString());
|
27
|
+
tokenAccountsPkeys.push(...[pI.token0Vault, pI.token1Vault]);
|
28
|
+
});
|
29
|
+
const [tokenAccounts, tokenPriceById] = yield Promise.all([
|
30
|
+
(0, solana_1.getParsedMultipleAccountsInfo)(client, solana_1.tokenAccountStruct, tokenAccountsPkeys),
|
31
|
+
cache.getTokenPricesAsMap(Array.from(mints), portfolio_core_1.NetworkId.solana),
|
32
|
+
]);
|
33
|
+
const tokenAccountsMap = new Map();
|
34
|
+
tokenAccounts.forEach((tA) => {
|
35
|
+
if (!tA)
|
36
|
+
return;
|
37
|
+
tokenAccountsMap.set(tA.pubkey.toString(), tA);
|
38
|
+
});
|
39
|
+
const tokenPriceSources = [];
|
40
|
+
for (let id = 0; id < clmmPoolsInfo.length; id++) {
|
41
|
+
const poolState = clmmPoolsInfo[id];
|
42
|
+
const mintA = poolState.token0Mint.toString();
|
43
|
+
const mintB = poolState.token1Mint.toString();
|
44
|
+
const tokenAccountA = tokenAccountsMap.get(poolState.token0Vault.toString());
|
45
|
+
const tokenAccountB = tokenAccountsMap.get(poolState.token1Vault.toString());
|
46
|
+
if (!tokenAccountA || !tokenAccountB)
|
47
|
+
continue;
|
48
|
+
const decimalsA = poolState.mint0Decimals;
|
49
|
+
const decimalsB = poolState.mint1Decimals;
|
50
|
+
const tokenAmountARaw = tokenAccountA.amount;
|
51
|
+
const tokenAmountBRaw = tokenAccountB.amount;
|
52
|
+
if (tokenAmountARaw.isZero() && tokenAmountBRaw.isZero())
|
53
|
+
continue;
|
54
|
+
const [tokenPriceA, tokenPriceB] = [
|
55
|
+
tokenPriceById.get(mintA),
|
56
|
+
tokenPriceById.get(mintB),
|
57
|
+
];
|
58
|
+
const { lpMint, lpMintDecimals, lpSupply } = poolState;
|
59
|
+
if (lpSupply.isZero())
|
60
|
+
continue;
|
61
|
+
tokenPriceSources.push(...(0, getLpTokenSourceRaw_1.getLpTokenSourceRaw)({
|
62
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
63
|
+
lpDetails: {
|
64
|
+
address: lpMint.toString(),
|
65
|
+
decimals: lpMintDecimals,
|
66
|
+
supplyRaw: lpSupply,
|
67
|
+
},
|
68
|
+
poolUnderlyingsRaw: [
|
69
|
+
{
|
70
|
+
address: mintA,
|
71
|
+
decimals: decimalsA,
|
72
|
+
tokenPrice: tokenPriceA,
|
73
|
+
reserveAmountRaw: tokenAmountARaw,
|
74
|
+
weight: 0.5,
|
75
|
+
},
|
76
|
+
{
|
77
|
+
address: mintB,
|
78
|
+
decimals: decimalsB,
|
79
|
+
tokenPrice: tokenPriceB,
|
80
|
+
reserveAmountRaw: tokenAmountBRaw,
|
81
|
+
weight: 0.5,
|
82
|
+
},
|
83
|
+
],
|
84
|
+
sourceId: poolState.pubkey.toString(),
|
85
|
+
elementName: 'CPMM',
|
86
|
+
platformId: constants_1.platformId,
|
87
|
+
priceUnderlyings: true,
|
88
|
+
}));
|
89
|
+
}
|
90
|
+
yield cache.setTokenPriceSources(tokenPriceSources);
|
91
|
+
});
|
92
|
+
const job = {
|
93
|
+
id: `${constants_1.platformId}-cpmm`,
|
94
|
+
executor,
|
95
|
+
label: 'normal',
|
96
|
+
};
|
97
|
+
exports.default = job;
|
98
|
+
//# sourceMappingURL=cpmmJob.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"cpmmJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/raydium/cpmmJob.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+DAAuD;AAEvD,2CAAwD;AACxD,+CAK4B;AAC5B,iDAAsD;AAGtD,uCAAiD;AACjD,yCAAiD;AACjD,8EAA2E;AAE3E,MAAM,QAAQ,GAAgB,CAAO,KAAY,EAAE,EAAE;IACnD,MAAM,MAAM,GAAG,IAAA,yBAAe,GAAE,CAAC;IAEjC,MAAM,aAAa,GAAG,MAAM,IAAA,iCAAwB,EAClD,MAAM,EACN,sBAAe,EACf,yBAAa,EACb,8BAAoB,CACrB,CAAC;IAEF,MAAM,kBAAkB,GAAgB,EAAE,CAAC;IAC3C,MAAM,KAAK,GAAgB,IAAI,GAAG,EAAE,CAAC;IACrC,aAAa,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE;QAC3B,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC,CAAC;QACpC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC,CAAC;QACpC,kBAAkB,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,WAAW,EAAE,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC;IAC/D,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,aAAa,EAAE,cAAc,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QACxD,IAAA,sCAA6B,EAC3B,MAAM,EACN,2BAAkB,EAClB,kBAAkB,CACnB;QACD,KAAK,CAAC,mBAAmB,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
|
2
2
|
export declare const ammV4Filter: GetProgramAccountsFilter[];
|
3
3
|
export declare const ammV5Filter: GetProgramAccountsFilter[];
|
4
|
-
export declare const
|
4
|
+
export declare const clmmPoolsStateFilter: GetProgramAccountsFilter[];
|
5
|
+
export declare const cpmmPoolsStateFilter: GetProgramAccountsFilter[];
|
5
6
|
export declare const stakingFilters: (owner: string) => GetProgramAccountsFilter[];
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.stakingFilters = exports.
|
3
|
+
exports.stakingFilters = exports.cpmmPoolsStateFilter = exports.clmmPoolsStateFilter = exports.ammV5Filter = exports.ammV4Filter = void 0;
|
4
4
|
const amms_1 = require("./structs/amms");
|
5
5
|
exports.ammV4Filter = [
|
6
6
|
{ dataSize: amms_1.ammInfoV4Struct.byteSize },
|
@@ -8,9 +8,12 @@ exports.ammV4Filter = [
|
|
8
8
|
exports.ammV5Filter = [
|
9
9
|
{ dataSize: amms_1.ammInfoV5Struct.byteSize },
|
10
10
|
];
|
11
|
-
exports.
|
11
|
+
exports.clmmPoolsStateFilter = [
|
12
12
|
{ dataSize: 1544 },
|
13
13
|
];
|
14
|
+
exports.cpmmPoolsStateFilter = [
|
15
|
+
{ dataSize: 637 },
|
16
|
+
];
|
14
17
|
const stakingFilters = (owner) => [
|
15
18
|
{
|
16
19
|
memcmp: {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"filters.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/raydium/filters.ts"],"names":[],"mappings":";;;AACA,yCAAkE;AAErD,QAAA,WAAW,GAA+B;IACrD,EAAE,QAAQ,EAAE,sBAAe,CAAC,QAAQ,EAAE;CACvC,CAAC;AAEW,QAAA,WAAW,GAA+B;IACrD,EAAE,QAAQ,EAAE,sBAAe,CAAC,QAAQ,EAAE;CACvC,CAAC;AAEW,QAAA,
|
1
|
+
{"version":3,"file":"filters.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/raydium/filters.ts"],"names":[],"mappings":";;;AACA,yCAAkE;AAErD,QAAA,WAAW,GAA+B;IACrD,EAAE,QAAQ,EAAE,sBAAe,CAAC,QAAQ,EAAE;CACvC,CAAC;AAEW,QAAA,WAAW,GAA+B;IACrD,EAAE,QAAQ,EAAE,sBAAe,CAAC,QAAQ,EAAE;CACvC,CAAC;AAEW,QAAA,oBAAoB,GAA+B;IAC9D,EAAE,QAAQ,EAAE,IAAI,EAAE;CACnB,CAAC;AAEW,QAAA,oBAAoB,GAA+B;IAC9D,EAAE,QAAQ,EAAE,GAAG,EAAE;CAClB,CAAC;AAEK,MAAM,cAAc,GAAG,CAAC,KAAa,EAA8B,EAAE,CAAC;IAC3E;QACE,MAAM,EAAE;YACN,MAAM,EAAE,EAAE;YACV,KAAK,EAAE,KAAK;SACb;KACF;IACD,EAAE,QAAQ,EAAE,GAAG,EAAE;CAClB,CAAC;AARW,QAAA,cAAc,kBAQzB"}
|
@@ -6,9 +6,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.fetchers = exports.jobs = exports.platforms = void 0;
|
7
7
|
const lpTokensJob_1 = __importDefault(require("./lpTokensJob"));
|
8
8
|
const clmmJob_1 = __importDefault(require("./clmmJob"));
|
9
|
+
const cpmmJob_1 = __importDefault(require("./cpmmJob"));
|
9
10
|
const constants_1 = require("./constants");
|
10
11
|
const stakingFetcher_1 = __importDefault(require("./stakingFetcher"));
|
11
12
|
exports.platforms = [constants_1.platform];
|
12
|
-
exports.jobs = [lpTokensJob_1.default, clmmJob_1.default];
|
13
|
+
exports.jobs = [lpTokensJob_1.default, clmmJob_1.default, cpmmJob_1.default];
|
13
14
|
exports.fetchers = [stakingFetcher_1.default];
|
14
15
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/raydium/index.ts"],"names":[],"mappings":";;;;;;AAGA,gEAAwC;AACxC,wDAAgC;AAChC,2CAAuC;AACvC,sEAA8C;AAEjC,QAAA,SAAS,GAAe,CAAC,oBAAQ,CAAC,CAAC;AACnC,QAAA,IAAI,GAAU,CAAC,qBAAW,EAAE,iBAAO,CAAC,CAAC;
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/raydium/index.ts"],"names":[],"mappings":";;;;;;AAGA,gEAAwC;AACxC,wDAAgC;AAChC,wDAAgC;AAChC,2CAAuC;AACvC,sEAA8C;AAEjC,QAAA,SAAS,GAAe,CAAC,oBAAQ,CAAC,CAAC;AACnC,QAAA,IAAI,GAAU,CAAC,qBAAW,EAAE,iBAAO,EAAE,iBAAO,CAAC,CAAC;AAC9C,QAAA,QAAQ,GAAc,CAAC,wBAAc,CAAC,CAAC"}
|
@@ -0,0 +1,30 @@
|
|
1
|
+
/// <reference types="node" />
|
2
|
+
import { BeetStruct } from '@metaplex-foundation/beet';
|
3
|
+
import { PublicKey } from '@metaplex-foundation/js';
|
4
|
+
import BigNumber from 'bignumber.js';
|
5
|
+
export type PoolState = {
|
6
|
+
buffer: Buffer;
|
7
|
+
ammConfig: PublicKey;
|
8
|
+
poolCreator: PublicKey;
|
9
|
+
token0Vault: PublicKey;
|
10
|
+
token1Vault: PublicKey;
|
11
|
+
lpMint: PublicKey;
|
12
|
+
token0Mint: PublicKey;
|
13
|
+
token1Mint: PublicKey;
|
14
|
+
token0Program: PublicKey;
|
15
|
+
token1Program: PublicKey;
|
16
|
+
observationKey: PublicKey;
|
17
|
+
authBump: number;
|
18
|
+
status: number;
|
19
|
+
lpMintDecimals: number;
|
20
|
+
mint0Decimals: number;
|
21
|
+
mint1Decimals: number;
|
22
|
+
lpSupply: BigNumber;
|
23
|
+
protocolFeesToken0: BigNumber;
|
24
|
+
protocolFeesToken1: BigNumber;
|
25
|
+
fundFeesToken0: BigNumber;
|
26
|
+
fundFeesToken1: BigNumber;
|
27
|
+
openTime: BigNumber;
|
28
|
+
padding: BigNumber[];
|
29
|
+
};
|
30
|
+
export declare const poolStateStruct: BeetStruct<PoolState, Partial<PoolState>>;
|
@@ -0,0 +1,32 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.poolStateStruct = void 0;
|
4
|
+
const beet_1 = require("@metaplex-foundation/beet");
|
5
|
+
const beet_solana_1 = require("@metaplex-foundation/beet-solana");
|
6
|
+
const solana_1 = require("../../../utils/solana");
|
7
|
+
exports.poolStateStruct = new beet_1.BeetStruct([
|
8
|
+
['buffer', (0, solana_1.blob)(8)],
|
9
|
+
['ammConfig', beet_solana_1.publicKey],
|
10
|
+
['poolCreator', beet_solana_1.publicKey],
|
11
|
+
['token0Vault', beet_solana_1.publicKey],
|
12
|
+
['token1Vault', beet_solana_1.publicKey],
|
13
|
+
['lpMint', beet_solana_1.publicKey],
|
14
|
+
['token0Mint', beet_solana_1.publicKey],
|
15
|
+
['token1Mint', beet_solana_1.publicKey],
|
16
|
+
['token0Program', beet_solana_1.publicKey],
|
17
|
+
['token1Program', beet_solana_1.publicKey],
|
18
|
+
['observationKey', beet_solana_1.publicKey],
|
19
|
+
['authBump', beet_1.u8],
|
20
|
+
['status', beet_1.u8],
|
21
|
+
['lpMintDecimals', beet_1.u8],
|
22
|
+
['mint0Decimals', beet_1.u8],
|
23
|
+
['mint1Decimals', beet_1.u8],
|
24
|
+
['lpSupply', solana_1.u64],
|
25
|
+
['protocolFeesToken0', solana_1.u64],
|
26
|
+
['protocolFeesToken1', solana_1.u64],
|
27
|
+
['fundFeesToken0', solana_1.u64],
|
28
|
+
['fundFeesToken1', solana_1.u64],
|
29
|
+
['openTime', solana_1.u64],
|
30
|
+
['padding', (0, beet_1.uniformFixedSizeArray)(solana_1.u64, 32)],
|
31
|
+
], (args) => args);
|
32
|
+
//# sourceMappingURL=cpmm.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"cpmm.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/plugins/raydium/structs/cpmm.ts"],"names":[],"mappings":";;;AAAA,oDAImC;AAGnC,kEAA6D;AAC7D,kDAAkD;AA4BrC,QAAA,eAAe,GAAG,IAAI,iBAAU,CAC3C;IACE,CAAC,QAAQ,EAAE,IAAA,aAAI,EAAC,CAAC,CAAC,CAAC;IACnB,CAAC,WAAW,EAAE,uBAAS,CAAC;IACxB,CAAC,aAAa,EAAE,uBAAS,CAAC;IAC1B,CAAC,aAAa,EAAE,uBAAS,CAAC;IAC1B,CAAC,aAAa,EAAE,uBAAS,CAAC;IAC1B,CAAC,QAAQ,EAAE,uBAAS,CAAC;IACrB,CAAC,YAAY,EAAE,uBAAS,CAAC;IACzB,CAAC,YAAY,EAAE,uBAAS,CAAC;IACzB,CAAC,eAAe,EAAE,uBAAS,CAAC;IAC5B,CAAC,eAAe,EAAE,uBAAS,CAAC;IAC5B,CAAC,gBAAgB,EAAE,uBAAS,CAAC;IAC7B,CAAC,UAAU,EAAE,SAAE,CAAC;IAChB,CAAC,QAAQ,EAAE,SAAE,CAAC;IACd,CAAC,gBAAgB,EAAE,SAAE,CAAC;IACtB,CAAC,eAAe,EAAE,SAAE,CAAC;IACrB,CAAC,eAAe,EAAE,SAAE,CAAC;IACrB,CAAC,UAAU,EAAE,YAAG,CAAC;IACjB,CAAC,oBAAoB,EAAE,YAAG,CAAC;IAC3B,CAAC,oBAAoB,EAAE,YAAG,CAAC;IAC3B,CAAC,gBAAgB,EAAE,YAAG,CAAC;IACvB,CAAC,gBAAgB,EAAE,YAAG,CAAC;IACvB,CAAC,UAAU,EAAE,YAAG,CAAC;IACjB,CAAC,SAAS,EAAE,IAAA,4BAAqB,EAAC,YAAG,EAAE,EAAE,CAAC,CAAC;CAC5C,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAiB,CAC5B,CAAC"}
|
@@ -0,0 +1,79 @@
|
|
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 bcs_1 = require("@mysten/bcs");
|
17
|
+
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
18
|
+
const axios_1 = __importDefault(require("axios"));
|
19
|
+
const constants_1 = require("./constants");
|
20
|
+
const clients_1 = require("../../utils/clients");
|
21
|
+
const getDynamicFieldObject_1 = require("../../utils/sui/getDynamicFieldObject");
|
22
|
+
const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetToken"));
|
23
|
+
const constants_2 = require("../pyth/constants");
|
24
|
+
function getAmount(claimData) {
|
25
|
+
if (!claimData)
|
26
|
+
return undefined;
|
27
|
+
const bcs = new bcs_1.BCS((0, bcs_1.getSuiMoveConfig)());
|
28
|
+
bcs.registerStructType('Validation', {
|
29
|
+
prefix: 'vector<u8>',
|
30
|
+
address: 'address',
|
31
|
+
amount: 'u64',
|
32
|
+
});
|
33
|
+
const eligibility = bcs.de('Validation', claimData, 'base64');
|
34
|
+
return (0, bignumber_js_1.default)(eligibility.amount)
|
35
|
+
.shiftedBy(-1 * 6)
|
36
|
+
.toNumber();
|
37
|
+
}
|
38
|
+
const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
39
|
+
const signature = yield axios_1.default
|
40
|
+
.get(constants_1.airdropUrl + owner)
|
41
|
+
.catch(() => null);
|
42
|
+
if (!(signature === null || signature === void 0 ? void 0 : signature.data.data) || signature.status === 404)
|
43
|
+
return [];
|
44
|
+
const client = (0, clients_1.getClientSui)();
|
45
|
+
const amount = getAmount(signature.data.data);
|
46
|
+
if (!amount)
|
47
|
+
return [];
|
48
|
+
const claimStatus = yield (0, getDynamicFieldObject_1.getDynamicFieldObject)(client, {
|
49
|
+
name: {
|
50
|
+
type: 'address',
|
51
|
+
value: owner,
|
52
|
+
},
|
53
|
+
parentId: constants_1.tableId,
|
54
|
+
});
|
55
|
+
if (claimStatus.data)
|
56
|
+
return [];
|
57
|
+
const pythPrice = yield cache.getTokenPrice(constants_2.pythMint, portfolio_core_1.NetworkId.solana);
|
58
|
+
const asset = (0, tokenPriceToAssetToken_1.default)(constants_2.pythMint, amount, portfolio_core_1.NetworkId.solana, pythPrice, undefined, { isClaimable: true });
|
59
|
+
return [
|
60
|
+
{
|
61
|
+
type: portfolio_core_1.PortfolioElementType.multiple,
|
62
|
+
label: 'Airdrop',
|
63
|
+
name: 'CNY',
|
64
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
65
|
+
platformId: constants_1.platformId,
|
66
|
+
data: {
|
67
|
+
assets: [asset],
|
68
|
+
},
|
69
|
+
value: asset.value,
|
70
|
+
},
|
71
|
+
];
|
72
|
+
});
|
73
|
+
const fetcher = {
|
74
|
+
id: `${constants_1.platformId}-cny-airdrop`,
|
75
|
+
networkId: portfolio_core_1.NetworkId.sui,
|
76
|
+
executor,
|
77
|
+
};
|
78
|
+
exports.default = fetcher;
|
79
|
+
//# sourceMappingURL=cnyAirdropFetcher.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"cnyAirdropFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/scallop/cnyAirdropFetcher.ts"],"names":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AAM,IAAA,6CAAqB,EAAc,MAAM,EAAE;QACnE,IAAI,EAAE;YACJ,IAAI,EAAE,SAAS;YACf,KAAK,EAAE,KAAK;SACb;QACD,QAAQ,EAAE,mBAAO;KAClB,CAAC,CAAC;IACH,IAAI,WAAW,CAAC,IAAI;QAAE,OAAO,EAAE,CAAC;IAEhC,MAAM,SAAS,GAAG,MAAM,KAAK,CAAC,aAAa,CAAC,oBAAQ,EAAE,0BAAS,CAAC,MAAM,CAAC,CAAC;IACxE,MAAM,KAAK,GAAG,IAAA,gCAAsB,EAClC,oBAAQ,EACR,MAAM,EACN,0BAAS,CAAC,MAAM,EAChB,SAAS,EACT,SAAS,EACT,EAAE,WAAW,EAAE,IAAI,EAAE,CACtB,CAAC;IAEF,OAAO;QACL;YACE,IAAI,EAAE,qCAAoB,CAAC,QAAQ;YACnC,KAAK,EAAE,SAAS;YAChB,IAAI,EAAE,KAAK;YACX,SAAS,EAAE,0BAAS,CAAC,MAAM;YAC3B,UAAU,EAAV,sBAAU;YACV,IAAI,EAAE;gBACJ,MAAM,EAAE,CAAC,KAAK,CAAC;aAChB;YACD,KAAK,EAAE,KAAK,CAAC,KAAK;SACnB;KACF,CAAC;AACJ,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"}
|
@@ -16,3 +16,5 @@ export declare const obligationKeyPackageId = "0xefe8b36d5b2e43728cc323298626b83
|
|
16
16
|
export declare const baseIndexRate = 1000000000;
|
17
17
|
export declare const scaAddress = "0x7016aae72cfc67f2fadf55769c0a7dd54291a583b63051a5ed71081cce836ac6::sca::SCA";
|
18
18
|
export declare const scaDecimals = 9;
|
19
|
+
export declare const tableId = "0xbfbbbdf1fe9b70cdd1ebd1444ca273000177f81a405935f6007b7727d2ff90c2";
|
20
|
+
export declare const airdropUrl = "https://airdrop.apis.scallop.io/cny-campaign/claim-signature/";
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.scaDecimals = exports.scaAddress = exports.baseIndexRate = exports.obligationKeyPackageId = exports.marketCoinPackageId = exports.spoolAccountPackageId = exports.spoolsKey = exports.poolsKey = exports.marketKey = exports.addressKey = exports.addressEndpoint = exports.spoolsPrefix = exports.poolsPrefix = exports.marketPrefix = exports.addressPrefix = exports.platform = exports.platformId = void 0;
|
3
|
+
exports.airdropUrl = exports.tableId = exports.scaDecimals = exports.scaAddress = exports.baseIndexRate = exports.obligationKeyPackageId = exports.marketCoinPackageId = exports.spoolAccountPackageId = exports.spoolsKey = exports.poolsKey = exports.marketKey = exports.addressKey = exports.addressEndpoint = exports.spoolsPrefix = exports.poolsPrefix = exports.marketPrefix = exports.addressPrefix = exports.platform = exports.platformId = void 0;
|
4
4
|
exports.platformId = 'scallop';
|
5
5
|
exports.platform = {
|
6
6
|
id: exports.platformId,
|
@@ -25,4 +25,6 @@ exports.obligationKeyPackageId = `${PROTOCOL_OBJECT_ID}::obligation::ObligationK
|
|
25
25
|
exports.baseIndexRate = 1000000000;
|
26
26
|
exports.scaAddress = '0x7016aae72cfc67f2fadf55769c0a7dd54291a583b63051a5ed71081cce836ac6::sca::SCA';
|
27
27
|
exports.scaDecimals = 9;
|
28
|
+
exports.tableId = '0xbfbbbdf1fe9b70cdd1ebd1444ca273000177f81a405935f6007b7727d2ff90c2';
|
29
|
+
exports.airdropUrl = 'https://airdrop.apis.scallop.io/cny-campaign/claim-signature/';
|
28
30
|
//# sourceMappingURL=constants.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/scallop/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,qCAAqC,kBAAU,MAAM;IAC5D,WAAW,EAAE,gBAAgB;IAC7B,OAAO,EAAE,yBAAyB;CACnC,CAAC;AAEW,QAAA,aAAa,GAAG,GAAG,kBAAU,UAAU,CAAC;AACxC,QAAA,YAAY,GAAG,GAAG,kBAAU,SAAS,CAAC;AACtC,QAAA,WAAW,GAAG,GAAG,kBAAU,QAAQ,CAAC;AACpC,QAAA,YAAY,GAAG,GAAG,kBAAU,eAAe,CAAC;AAE5C,QAAA,eAAe,GAC1B,+DAA+D,CAAC;AACrD,QAAA,UAAU,GAAG,qBAAqB,CAAC;AACnC,QAAA,SAAS,GAAG,oBAAoB,CAAC;AACjC,QAAA,QAAQ,GAAG,mBAAmB,CAAC;AAC/B,QAAA,SAAS,GAAG,0BAA0B,CAAC;AAEvC,QAAA,qBAAqB,GAAG,iGAAiG,CAAC;AACvI,MAAM,kBAAkB,GACtB,oEAAoE,CAAC;AAC1D,QAAA,mBAAmB,GAAG,GAAG,kBAAkB,uBAAuB,CAAC;AACnE,QAAA,sBAAsB,GAAG,GAAG,kBAAkB,6BAA6B,CAAC;AAC5E,QAAA,aAAa,GAAG,UAAa,CAAC;AAC9B,QAAA,UAAU,GACrB,8EAA8E,CAAC;AACpE,QAAA,WAAW,GAAG,CAAC,CAAC"}
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/scallop/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,qCAAqC,kBAAU,MAAM;IAC5D,WAAW,EAAE,gBAAgB;IAC7B,OAAO,EAAE,yBAAyB;CACnC,CAAC;AAEW,QAAA,aAAa,GAAG,GAAG,kBAAU,UAAU,CAAC;AACxC,QAAA,YAAY,GAAG,GAAG,kBAAU,SAAS,CAAC;AACtC,QAAA,WAAW,GAAG,GAAG,kBAAU,QAAQ,CAAC;AACpC,QAAA,YAAY,GAAG,GAAG,kBAAU,eAAe,CAAC;AAE5C,QAAA,eAAe,GAC1B,+DAA+D,CAAC;AACrD,QAAA,UAAU,GAAG,qBAAqB,CAAC;AACnC,QAAA,SAAS,GAAG,oBAAoB,CAAC;AACjC,QAAA,QAAQ,GAAG,mBAAmB,CAAC;AAC/B,QAAA,SAAS,GAAG,0BAA0B,CAAC;AAEvC,QAAA,qBAAqB,GAAG,iGAAiG,CAAC;AACvI,MAAM,kBAAkB,GACtB,oEAAoE,CAAC;AAC1D,QAAA,mBAAmB,GAAG,GAAG,kBAAkB,uBAAuB,CAAC;AACnE,QAAA,sBAAsB,GAAG,GAAG,kBAAkB,6BAA6B,CAAC;AAC5E,QAAA,aAAa,GAAG,UAAa,CAAC;AAC9B,QAAA,UAAU,GACrB,8EAA8E,CAAC;AACpE,QAAA,WAAW,GAAG,CAAC,CAAC;AAEhB,QAAA,OAAO,GAClB,oEAAoE,CAAC;AAC1D,QAAA,UAAU,GACrB,+DAA+D,CAAC"}
|
@@ -11,12 +11,14 @@ const spoolsMarketJob_1 = __importDefault(require("./spoolsMarketJob"));
|
|
11
11
|
const lendingsFetcher_1 = __importDefault(require("./lendingsFetcher"));
|
12
12
|
const veScaFetcher_1 = __importDefault(require("./veScaFetcher"));
|
13
13
|
const obligationsFetcher_1 = __importDefault(require("./obligationsFetcher"));
|
14
|
+
const cnyAirdropFetcher_1 = __importDefault(require("./cnyAirdropFetcher"));
|
14
15
|
const constants_1 = require("./constants");
|
15
16
|
exports.jobs = [addressJob_1.default, poolsJob_1.default, marketJob_1.default, spoolsMarketJob_1.default];
|
16
17
|
exports.fetchers = [
|
17
18
|
lendingsFetcher_1.default,
|
18
19
|
obligationsFetcher_1.default,
|
19
20
|
veScaFetcher_1.default,
|
21
|
+
cnyAirdropFetcher_1.default,
|
20
22
|
];
|
21
23
|
exports.platforms = [constants_1.platform];
|
22
24
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/scallop/index.ts"],"names":[],"mappings":";;;;;;AAGA,0DAAkC;AAClC,8DAAsC;AACtC,4DAAoC;AACpC,wEAAgD;AAEhD,wEAAgD;AAChD,kEAA0C;AAC1C,8EAAsD;AACtD,2CAAuC;AAE1B,QAAA,IAAI,GAAU,CAAC,oBAAU,EAAE,kBAAQ,EAAE,mBAAS,EAAE,yBAAe,CAAC,CAAC;AACjE,QAAA,QAAQ,GAAc;IACjC,yBAAe;IACf,4BAAkB;IAClB,sBAAY;
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/scallop/index.ts"],"names":[],"mappings":";;;;;;AAGA,0DAAkC;AAClC,8DAAsC;AACtC,4DAAoC;AACpC,wEAAgD;AAEhD,wEAAgD;AAChD,kEAA0C;AAC1C,8EAAsD;AACtD,4EAAmD;AACnD,2CAAuC;AAE1B,QAAA,IAAI,GAAU,CAAC,oBAAU,EAAE,kBAAQ,EAAE,mBAAS,EAAE,yBAAe,CAAC,CAAC;AACjE,QAAA,QAAQ,GAAc;IACjC,yBAAe;IACf,4BAAkB;IAClB,sBAAY;IACZ,2BAAgB;CACjB,CAAC;AACW,QAAA,SAAS,GAAe,CAAC,oBAAQ,CAAC,CAAC"}
|
@@ -24,3 +24,32 @@ export type UserStakeAccounts = {
|
|
24
24
|
export type Pools = {
|
25
25
|
[T in string]: CoinTypeMetadata;
|
26
26
|
};
|
27
|
+
export type ClaimStatus = {
|
28
|
+
name: string;
|
29
|
+
value: number;
|
30
|
+
id: ID;
|
31
|
+
};
|
32
|
+
export type TreasuryInfo = {
|
33
|
+
claim_enabled: boolean;
|
34
|
+
claim_record: ClaimRecord;
|
35
|
+
id: ID;
|
36
|
+
msg_author_pubkey: number[];
|
37
|
+
treasury: string;
|
38
|
+
};
|
39
|
+
export type ClaimRecord = {
|
40
|
+
fields: Fields;
|
41
|
+
type: string;
|
42
|
+
};
|
43
|
+
export type Fields = {
|
44
|
+
id: ID;
|
45
|
+
size: string;
|
46
|
+
};
|
47
|
+
export type ID = {
|
48
|
+
id: string;
|
49
|
+
};
|
50
|
+
export type ApiResponse = {
|
51
|
+
signature: {
|
52
|
+
[key: string]: number;
|
53
|
+
};
|
54
|
+
data: string;
|
55
|
+
};
|
@@ -25,16 +25,32 @@ const getAssetsByOwnerDas_1 = require("../../../utils/solana/das/getAssetsByOwne
|
|
25
25
|
const heliusAssetToAssetCollectible_1 = require("../../../utils/solana/das/heliusAssetToAssetCollectible");
|
26
26
|
const constants_2 = require("../../orca/constants");
|
27
27
|
const constants_3 = require("../../cropper/constants");
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
28
|
+
const nftsUnderlyingsMap = new Map([
|
29
|
+
[
|
30
|
+
'raydium',
|
31
|
+
{ checker: helpers_1.isARaydiumPosition, fetcher: getRaydiumCLMMPositions_1.getRaydiumCLMMPositions },
|
32
|
+
],
|
33
|
+
[
|
34
|
+
'orca',
|
35
|
+
{
|
36
|
+
checker: helpers_2.isAnOrcaPosition,
|
37
|
+
fetcher: (0, getWhirlpoolPositions_1.getOrcaNftFetcher)(constants_2.platformId, constants_2.whirlpoolProgram),
|
38
|
+
},
|
39
|
+
],
|
40
|
+
[
|
41
|
+
'cropper',
|
42
|
+
{
|
43
|
+
checker: helpers_3.isClmmPosition,
|
44
|
+
fetcher: (0, getWhirlpoolPositions_1.getOrcaNftFetcher)(constants_3.platformId, constants_3.clmmPid),
|
45
|
+
},
|
46
|
+
],
|
47
|
+
[
|
48
|
+
'helium',
|
49
|
+
{
|
50
|
+
checker: helpers_4.isAnHeliumNFTVote,
|
51
|
+
fetcher: helpers_4.getHeliumElementsFromNFTs,
|
52
|
+
},
|
53
|
+
],
|
38
54
|
]);
|
39
55
|
const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
40
56
|
var _a, _b;
|
@@ -49,30 +65,29 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
49
65
|
};
|
50
66
|
const assets = yield (0, getAssetsByOwnerDas_1.getAssetsByOwnerDas)(dasEndpoint, owner, displayOptions);
|
51
67
|
const nftsByIndentifier = new Map();
|
52
|
-
for (let n = 0; n < assets.length; n
|
68
|
+
for (let n = 0; n < assets.length; n += 1) {
|
53
69
|
const nft = (0, heliusAssetToAssetCollectible_1.heliusAssetToAssetCollectible)(assets[n]);
|
54
70
|
if (!nft)
|
55
71
|
continue;
|
56
72
|
if ((_a = nft.attributes.tags) === null || _a === void 0 ? void 0 : _a.includes('compressed'))
|
57
73
|
continue;
|
58
|
-
for (const
|
59
|
-
if (
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
else {
|
64
|
-
(_b = nftsByIndentifier.get(identifier)) === null || _b === void 0 ? void 0 : _b.push(nft);
|
65
|
-
}
|
74
|
+
for (const [key, { checker }] of nftsUnderlyingsMap.entries()) {
|
75
|
+
if (!checker(nft))
|
76
|
+
continue;
|
77
|
+
if (!nftsByIndentifier.get(key)) {
|
78
|
+
nftsByIndentifier.set(key, []);
|
66
79
|
}
|
80
|
+
(_b = nftsByIndentifier.get(key)) === null || _b === void 0 ? void 0 : _b.push(nft);
|
81
|
+
break;
|
67
82
|
}
|
68
83
|
}
|
69
|
-
const
|
70
|
-
for (const [
|
71
|
-
const nfts = nftsByIndentifier.get(
|
84
|
+
const results = [];
|
85
|
+
for (const [key, { fetcher }] of nftsUnderlyingsMap) {
|
86
|
+
const nfts = nftsByIndentifier.get(key);
|
72
87
|
if (nfts)
|
73
|
-
|
88
|
+
results.push(fetcher(cache, nfts));
|
74
89
|
}
|
75
|
-
const result = yield Promise.allSettled(
|
90
|
+
const result = yield Promise.allSettled(results);
|
76
91
|
const elements = result
|
77
92
|
.map((res) => (res.status === 'rejected' ? [] : res.value))
|
78
93
|
.flat();
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"solana-nfts-underlyings.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/plugins/tokens/fetchers/solana-nfts-underlyings.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAIoC;AAGpC,4CAAoD;AAEpD,mFAAgF;AAChF,
|
1
|
+
{"version":3,"file":"solana-nfts-underlyings.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/plugins/tokens/fetchers/solana-nfts-underlyings.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAIoC;AAGpC,4CAAoD;AAEpD,mFAAgF;AAChF,4EAAqE;AACrE,mDAA2D;AAC3D,gDAAsD;AACtD,mDAA4E;AAE5E,gDAG4B;AAC5B,uGAA+E;AAC/E,uFAAoF;AAEpF,2GAAwG;AAExG,oDAG8B;AAC9B,uDAGiC;AAIjC,MAAM,kBAAkB,GAGpB,IAAI,GAAG,CAAC;IACV;QACE,SAAS;QACT,EAAE,OAAO,EAAE,4BAAkB,EAAE,OAAO,EAAE,iDAAuB,EAAE;KAClE;IACD;QACE,MAAM;QACN;YACE,OAAO,EAAE,0BAAgB;YACzB,OAAO,EAAE,IAAA,yCAAiB,EAAC,sBAAc,EAAE,4BAAgB,CAAC;SAC7D;KACF;IACD;QACE,SAAS;QACT;YACE,OAAO,EAAE,wBAAiB;YAC1B,OAAO,EAAE,IAAA,yCAAiB,EAAC,sBAAiB,EAAE,mBAAO,CAAC;SACvD;KACF;IACD;QACE,QAAQ;QACR;YACE,OAAO,EAAE,2BAAiB;YAC1B,OAAO,EAAE,mCAAyB;SACnC;KACF;CACF,CAAC,CAAC;AAEH,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;;IACtE,MAAM,WAAW,GAAG,IAAA,8BAAoB,GAAE,CAAC;IAC3C,MAAM,cAAc,GAAmB;QACrC,sBAAsB,EAAE,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xC,IAAI,IAAI;YAAE,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;IAC/C,CAAC;IACD,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;IAEjD,MAAM,QAAQ,GAAG,MAAM;SACpB,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,MAAM,KAAK,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;SAC1D,IAAI,EAAE,CAAC;IAEV,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,gCAAoB,CAAC,EAAE,0BAA0B;IACxD,SAAS,EAAE,0BAAS,CAAC,MAAM;IAC3B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|
@@ -26,6 +26,8 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
26
26
|
const dasEndpoint = (0, getSolanaDasEndpoint_1.default)();
|
27
27
|
const items = yield (0, getAssetsByOwnerDas_1.getAssetsByOwnerDas)(dasEndpoint, owner, {
|
28
28
|
showNativeBalance: false,
|
29
|
+
showGrandTotal: false,
|
30
|
+
showInscription: false,
|
29
31
|
});
|
30
32
|
const fungibleAddresses = items.reduce((addresses, curr) => {
|
31
33
|
if ((0, isHeliusFungibleAsset_1.isHeliusFungibleAsset)(curr))
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"solana.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/plugins/tokens/fetchers/solana.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DASoC;AACpC,gEAAqC;AAErC,4CAAwE;AAExE,wCAAkD;AAClD,wGAAgF;AAChF,sGAA8E;AAC9E,2GAAwG;AACxG,uFAAoF;AACpF,2FAAwF;AACxF,uGAA+E;AAE/E,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,WAAW,GAAG,IAAA,8BAAoB,GAAE,CAAC;IAC3C,MAAM,KAAK,GAAG,MAAM,IAAA,yCAAmB,EAAC,WAAW,EAAE,KAAK,EAAE;QAC1D,iBAAiB,EAAE,KAAK;
|
1
|
+
{"version":3,"file":"solana.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/plugins/tokens/fetchers/solana.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DASoC;AACpC,gEAAqC;AAErC,4CAAwE;AAExE,wCAAkD;AAClD,wGAAgF;AAChF,sGAA8E;AAC9E,2GAAwG;AACxG,uFAAoF;AACpF,2FAAwF;AACxF,uGAA+E;AAE/E,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,WAAW,GAAG,IAAA,8BAAoB,GAAE,CAAC;IAC3C,MAAM,KAAK,GAAG,MAAM,IAAA,yCAAmB,EAAC,WAAW,EAAE,KAAK,EAAE;QAC1D,iBAAiB,EAAE,KAAK;QACxB,cAAc,EAAE,KAAK;QACrB,eAAe,EAAE,KAAK;KACvB,CAAC,CAAC;IAEH,MAAM,iBAAiB,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,SAAmB,EAAE,IAAI,EAAE,EAAE;QACnE,IAAI,IAAA,6CAAqB,EAAC,IAAI,CAAC;YAAE,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACzD,OAAO,SAAS,CAAC;IACnB,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,gBAAgB,GAAG,MAAM,KAAK,CAAC,cAAc,CACjD,iBAAiB,EACjB,0BAAS,CAAC,MAAM,CACjB,CAAC;IACF,MAAM,WAAW,GAA4B,IAAI,GAAG,EAAE,CAAC;IACvD,gBAAgB,CAAC,OAAO,CAAC,CAAC,UAAU,EAAE,EAAE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E,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;YACtD,IAAI,EAAE;gBACJ,MAAM,EAAE,WAAW;aACpB;SACF,CAAC,CAAC;IACL,CAAC;IACD,KAAK,MAAM,CAAC,GAAG,EAAE,WAAW,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,gBAAgB,CAAC,EAAE,CAAC;QAClE,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,GAAG,IAAA,oBAAU,EAAC,GAAG,CAAC,CAAC;QACpD,QAAQ,CAAC,IAAI,CAAC;YACZ,IAAI,EAAE,qCAAoB,CAAC,SAAS;YACpC,SAAS,EAAE,0BAAS,CAAC,MAAM;YAC3B,UAAU;YACV,IAAI,EAAE,WAAW;YACjB,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;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,gCAAoB,CAAC,EAAE,SAAS;IACvC,SAAS,EAAE,0BAAS,CAAC,MAAM;IAC3B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|
@@ -35,4 +35,4 @@ export type Token = {
|
|
35
35
|
index?: string;
|
36
36
|
};
|
37
37
|
};
|
38
|
-
export type
|
38
|
+
export type NftFetcher = (cache: Cache, nfts: PortfolioAssetCollectible[]) => Promise<PortfolioElement[]>;
|
@@ -21,7 +21,7 @@ function getLpTokenSourceRaw(params) {
|
|
21
21
|
sourceId: params.sourceId,
|
22
22
|
poolUnderlyings: fPoolUnderlyingsRaw,
|
23
23
|
elementName: params.elementName,
|
24
|
-
liquidityName: params.
|
24
|
+
liquidityName: params.liquidityName,
|
25
25
|
priceUnderlyings: params.priceUnderlyings,
|
26
26
|
});
|
27
27
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"getLpTokenSourceRaw.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/misc/getLpTokenSourceRaw.ts"],"names":[],"mappings":";;;;;;AAKA,gEAAqC;AACrC,yDAAiE;AA4BjE,SAAgB,mBAAmB,CACjC,MAAiC;IAEjC,MAAM,EAAE,SAAS,EAAE,kBAAkB,EAAE,GAAG,MAAM,CAAC;IACjD,MAAM,UAAU,mCACX,SAAS,KACZ,MAAM,EAAE,IAAI,sBAAS,CAAC,SAAS,CAAC,SAAS,CAAC;aACvC,GAAG,CAAC,SAAA,EAAE,EAAI,SAAS,CAAC,QAAQ,CAAA,CAAC;aAC7B,QAAQ,EAAE,GACd,CAAC;IACF,MAAM,mBAAmB,GAAqB,kBAAkB,CAAC,GAAG,CAClE,CAAC,EAAE,EAAE,EAAE,CAAC,iCACH,EAAE,KACL,aAAa,EAAE,IAAI,sBAAS,CAAC,EAAE,CAAC,gBAAgB,CAAC;aAC9C,GAAG,CAAC,SAAA,EAAE,EAAI,EAAE,CAAC,QAAQ,CAAA,CAAC;aACtB,QAAQ,EAAE,IACb,CACH,CAAC;IAEF,OAAO,IAAA,mCAAgB,EAAC;QACtB,SAAS,EAAE,UAAU;QACrB,SAAS,EAAE,MAAM,CAAC,SAAS;QAC3B,UAAU,EAAE,MAAM,CAAC,UAAU;QAC7B,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,eAAe,EAAE,mBAAmB;QACpC,WAAW,EAAE,MAAM,CAAC,WAAW;QAC/B,aAAa,EAAE,MAAM,CAAC,
|
1
|
+
{"version":3,"file":"getLpTokenSourceRaw.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/misc/getLpTokenSourceRaw.ts"],"names":[],"mappings":";;;;;;AAKA,gEAAqC;AACrC,yDAAiE;AA4BjE,SAAgB,mBAAmB,CACjC,MAAiC;IAEjC,MAAM,EAAE,SAAS,EAAE,kBAAkB,EAAE,GAAG,MAAM,CAAC;IACjD,MAAM,UAAU,mCACX,SAAS,KACZ,MAAM,EAAE,IAAI,sBAAS,CAAC,SAAS,CAAC,SAAS,CAAC;aACvC,GAAG,CAAC,SAAA,EAAE,EAAI,SAAS,CAAC,QAAQ,CAAA,CAAC;aAC7B,QAAQ,EAAE,GACd,CAAC;IACF,MAAM,mBAAmB,GAAqB,kBAAkB,CAAC,GAAG,CAClE,CAAC,EAAE,EAAE,EAAE,CAAC,iCACH,EAAE,KACL,aAAa,EAAE,IAAI,sBAAS,CAAC,EAAE,CAAC,gBAAgB,CAAC;aAC9C,GAAG,CAAC,SAAA,EAAE,EAAI,EAAE,CAAC,QAAQ,CAAA,CAAC;aACtB,QAAQ,EAAE,IACb,CACH,CAAC;IAEF,OAAO,IAAA,mCAAgB,EAAC;QACtB,SAAS,EAAE,UAAU;QACrB,SAAS,EAAE,MAAM,CAAC,SAAS;QAC3B,UAAU,EAAE,MAAM,CAAC,UAAU;QAC7B,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,eAAe,EAAE,mBAAmB;QACpC,WAAW,EAAE,MAAM,CAAC,WAAW;QAC/B,aAAa,EAAE,MAAM,CAAC,aAAa;QACnC,gBAAgB,EAAE,MAAM,CAAC,gBAAgB;KAC1C,CAAC,CAAC;AACL,CAAC;AA7BD,kDA6BC"}
|
@@ -62,7 +62,7 @@ function getLpUnderlyingTokenSource(params) {
|
|
62
62
|
throw new Error(`Weights are greater than 1: ${totalWeight}`);
|
63
63
|
if (totalWeight < 0.99)
|
64
64
|
throw new Error(`Weights are smaller than 1: ${totalWeight}`);
|
65
|
-
let
|
65
|
+
let knownUnderlying;
|
66
66
|
const fAddresses = poolUnderlyings.map((u) => (0, portfolio_core_1.formatTokenAddress)(u.address, networkId));
|
67
67
|
let knownReserveValue;
|
68
68
|
for (let i = 0; i < poolUnderlyings.length; i++) {
|
@@ -72,18 +72,18 @@ function getLpUnderlyingTokenSource(params) {
|
|
72
72
|
if (!acceptedPairs.includes(fAddresses[i]))
|
73
73
|
continue;
|
74
74
|
const reserveValue = u.tokenPrice.price * u.reserveAmount;
|
75
|
-
if (
|
75
|
+
if (knownUnderlying &&
|
76
76
|
knownReserveValue &&
|
77
77
|
knownReserveValue > reserveValue)
|
78
78
|
continue;
|
79
|
-
|
79
|
+
knownUnderlying = u;
|
80
80
|
knownReserveValue = reserveValue;
|
81
81
|
}
|
82
|
-
if (!
|
82
|
+
if (!knownUnderlying || !knownReserveValue)
|
83
83
|
return [];
|
84
84
|
if (knownReserveValue < minReserveValue)
|
85
85
|
return [];
|
86
|
-
const knownUnderlayingAddress = (0, portfolio_core_1.formatTokenAddress)(
|
86
|
+
const knownUnderlayingAddress = (0, portfolio_core_1.formatTokenAddress)(knownUnderlying.address, networkId);
|
87
87
|
const sources = [];
|
88
88
|
for (let i = 0; i < poolUnderlyings.length; i++) {
|
89
89
|
const u = poolUnderlyings[i];
|
@@ -94,7 +94,7 @@ function getLpUnderlyingTokenSource(params) {
|
|
94
94
|
if (u.tokenPrice &&
|
95
95
|
u.tokenPrice.sources.some((s) => s.id === portfolio_core_1.coingeckoSourceId))
|
96
96
|
continue;
|
97
|
-
const price = ((u.weight /
|
97
|
+
const price = ((u.weight / knownUnderlying.weight) * knownReserveValue) /
|
98
98
|
u.reserveAmount;
|
99
99
|
const source = {
|
100
100
|
id: sourceId,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"getLpUnderlyingTokenSource.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/misc/getLpUnderlyingTokenSource.ts"],"names":[],"mappings":";;;;;;AAAA,+DAYoC;AACpC,8DAAsE;AACtE,wEAAgD;AAEnC,QAAA,oBAAoB,GAAG,IAAI,GAAG,CAA0B;IACnE;QACE,0BAAS,CAAC,GAAG;QACb;YACE,iCAAgB;YAChB,sEAAsE,EAAE,OAAO;YAC/E,qHAAqH,EAAE,SAAS;SACjI,CAAC,GAAG,CAAC,CA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AAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAC1C,IAAI,CAAC,eAAe;QAAE,eAAe,GAAG,IAAI,CAAC;IAE7C,6BAA6B;IAC7B,MAAM,WAAW,GAAG,eAAe,CAAC,MAAM,CACxC,CAAC,UAAU,EAAE,CAAC,EAAE,EAAE,CAAC,UAAU,GAAG,CAAC,CAAC,MAAM,EACxC,CAAC,CACF,CAAC;IACF,IAAI,WAAW,GAAG,IAAI;QACpB,MAAM,IAAI,KAAK,CAAC,+BAA+B,WAAW,EAAE,CAAC,CAAC;IAChE,IAAI,WAAW,GAAG,IAAI;QACpB,MAAM,IAAI,KAAK,CAAC,+BAA+B,WAAW,EAAE,CAAC,CAAC;IAEhE,IAAI,
|
1
|
+
{"version":3,"file":"getLpUnderlyingTokenSource.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/misc/getLpUnderlyingTokenSource.ts"],"names":[],"mappings":";;;;;;AAAA,+DAYoC;AACpC,8DAAsE;AACtE,wEAAgD;AAEnC,QAAA,oBAAoB,GAAG,IAAI,GAAG,CAA0B;IACnE;QACE,0BAAS,CAAC,GAAG;QACb;YACE,iCAAgB;YAChB,sEAAsE,EAAE,OAAO;YAC/E,qHAAqH,EAAE,SAAS;SACjI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,mCAAkB,EAAC,CAAC,EAAE,0BAAS,CAAC,GAAG,CAAC,CAAC;KACnD;IACD;QACE,0BAAS,CAAC,MAAM;QAChB;YACE,oCAAmB;YACnB,2CAA0B;YAC1B,8CAA8C,EAAE,OAAO;YACvD,8CAA8C,EAAE,OAAO;SACxD,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,mCAAkB,EAAC,CAAC,EAAE,0BAAS,CAAC,MAAM,CAAC,CAAC;KACtD;IACD;QACE,0BAAS,CAAC,KAAK;QACf;YACE,mCAAkB;YAClB,6EAA6E,EAAE,SAAS;YACxF,mFAAmF,E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