@sonarwatch/portfolio-plugins 0.11.128 → 0.11.129
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +1235 -1231
- package/README.md +3 -3
- package/package.json +2 -2
- package/src/plugins/balancer/helpers/pools.js +21 -21
- package/src/plugins/flexlend/depositsFetcher.js +8 -4
- package/src/plugins/flexlend/depositsFetcher.js.map +1 -1
- package/src/plugins/jupiter/helpers.d.ts +1 -1
- package/src/plugins/jupiter/helpers.js +3 -3
- package/src/plugins/jupiter/helpers.js.map +1 -1
- package/src/plugins/jupiter/index.js +0 -2
- package/src/plugins/jupiter/index.js.map +1 -1
- package/src/plugins/lifinity/xLfntyJob.js +4 -4
- package/src/plugins/lifinity/xLfntyJob.js.map +1 -1
- package/src/plugins/solend/obligationsFetcher.js +1 -10
- package/src/plugins/solend/obligationsFetcher.js.map +1 -1
- package/src/plugins/sushiswap/helpers.js +24 -24
- package/src/plugins/symmetry/basketsJob.js +12 -9
- package/src/plugins/symmetry/basketsJob.js.map +1 -1
- package/src/plugins/symmetry/structs.d.ts +5 -1
- package/src/plugins/symmetry/structs.js +7 -2
- package/src/plugins/symmetry/structs.js.map +1 -1
- package/src/plugins/uniswap-v2/helpers.js +22 -22
- package/src/utils/sei/constants.js +8 -8
- package/src/utils/sei/getQueryBalanceByOwner.js +4 -4
- package/src/utils/solana/getDecimals.d.ts +3 -0
- package/src/utils/solana/getDecimals.js +26 -0
- package/src/utils/solana/getDecimals.js.map +1 -0
- package/src/utils/solana/getMultipleDecimals.d.ts +3 -0
- package/src/utils/solana/getMultipleDecimals.js +32 -0
- package/src/utils/solana/getMultipleDecimals.js.map +1 -0
- package/src/plugins/jupiter/testFetcher.d.ts +0 -3
- package/src/plugins/jupiter/testFetcher.js +0 -77
- package/src/plugins/jupiter/testFetcher.js.map +0 -1
package/README.md
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
# @sonarwatch/portfolio-plugins
|
2
|
-
|
3
|
-
This library is @sonarwatch/portfolio-plugins
|
1
|
+
# @sonarwatch/portfolio-plugins
|
2
|
+
|
3
|
+
This library is @sonarwatch/portfolio-plugins
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@sonarwatch/portfolio-plugins",
|
3
|
-
"version": "0.11.
|
3
|
+
"version": "0.11.129",
|
4
4
|
"type": "commonjs",
|
5
5
|
"generators": "./generators.json",
|
6
6
|
"dependencies": {
|
@@ -41,7 +41,7 @@
|
|
41
41
|
"web3-v1": "npm:web3@^1.5.0"
|
42
42
|
},
|
43
43
|
"peerDependencies": {
|
44
|
-
"@sonarwatch/portfolio-core": "0.11.
|
44
|
+
"@sonarwatch/portfolio-core": "0.11.129"
|
45
45
|
},
|
46
46
|
"main": "./src/index.js",
|
47
47
|
"types": "./src/index.d.ts"
|
@@ -36,27 +36,27 @@ exports.getBalancerPoolsV2 = void 0;
|
|
36
36
|
const graphql_request_1 = __importStar(require("graphql-request"));
|
37
37
|
function getBalancerPoolsV2(url) {
|
38
38
|
return __awaiter(this, void 0, void 0, function* () {
|
39
|
-
const query = (0, graphql_request_1.gql) `
|
40
|
-
query pools {
|
41
|
-
pools(
|
42
|
-
first: 1000
|
43
|
-
orderBy: totalLiquidity
|
44
|
-
orderDirection: desc
|
45
|
-
where: { totalLiquidity_gt: "500" }
|
46
|
-
) {
|
47
|
-
id
|
48
|
-
address
|
49
|
-
symbol
|
50
|
-
totalLiquidity
|
51
|
-
totalShares
|
52
|
-
tokens {
|
53
|
-
balance
|
54
|
-
decimals
|
55
|
-
symbol
|
56
|
-
address
|
57
|
-
}
|
58
|
-
}
|
59
|
-
}
|
39
|
+
const query = (0, graphql_request_1.gql) `
|
40
|
+
query pools {
|
41
|
+
pools(
|
42
|
+
first: 1000
|
43
|
+
orderBy: totalLiquidity
|
44
|
+
orderDirection: desc
|
45
|
+
where: { totalLiquidity_gt: "500" }
|
46
|
+
) {
|
47
|
+
id
|
48
|
+
address
|
49
|
+
symbol
|
50
|
+
totalLiquidity
|
51
|
+
totalShares
|
52
|
+
tokens {
|
53
|
+
balance
|
54
|
+
decimals
|
55
|
+
symbol
|
56
|
+
address
|
57
|
+
}
|
58
|
+
}
|
59
|
+
}
|
60
60
|
`;
|
61
61
|
const res = yield (0, graphql_request_1.default)(url, query);
|
62
62
|
const pools = res.pools;
|
@@ -16,15 +16,19 @@ const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
|
16
16
|
const constants_1 = require("./constants");
|
17
17
|
const helpers_1 = require("./helpers");
|
18
18
|
const obligationsFetcher_1 = __importDefault(require("../solend/obligationsFetcher"));
|
19
|
+
const deposits_1 = __importDefault(require("../drift/deposits"));
|
20
|
+
const lendsFetcher_1 = __importDefault(require("../kamino/lendsFetcher"));
|
21
|
+
const collateralFetcher_1 = __importDefault(require("../mango/collateralFetcher"));
|
22
|
+
const index_1 = require("../marginfi/index");
|
19
23
|
const constants_2 = require("../tokens/constants");
|
20
24
|
const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
21
25
|
const pda = (0, helpers_1.getDerivedAccount)(owner);
|
22
26
|
const portfolioElements = (yield Promise.all([
|
23
|
-
|
27
|
+
index_1.fetchers[0].executor(pda, cache),
|
24
28
|
obligationsFetcher_1.default.executor(pda, cache),
|
25
|
-
|
26
|
-
|
27
|
-
|
29
|
+
deposits_1.default.executor(pda, cache),
|
30
|
+
lendsFetcher_1.default.executor(pda, cache),
|
31
|
+
collateralFetcher_1.default.executor(pda, cache),
|
28
32
|
])).flat();
|
29
33
|
if (portfolioElements.length === 0)
|
30
34
|
return [];
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"depositsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/flexlend/depositsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAAyE;AAGzE,2CAAyC;AACzC,uCAA8C;AAC9C,sFAAiE;
|
1
|
+
{"version":3,"file":"depositsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/fl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Q,CAAC,IAAI,mBACR,UAAU,EACb,CAAC;IACL,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,WAAW;IAC5B,SAAS,EAAE,0BAAS,CAAC,MAAM;IAC3B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|
@@ -2,5 +2,5 @@ import { PublicKey } from '@solana/web3.js';
|
|
2
2
|
import { PortfolioAsset } from '@sonarwatch/portfolio-core';
|
3
3
|
export declare function deriveClaimStatus(claimant: PublicKey, distributor: PublicKey, programId: PublicKey): [PublicKey, number];
|
4
4
|
export declare function getVotePda(owner: string): PublicKey;
|
5
|
-
export declare function
|
5
|
+
export declare function getJupiterPrices(mints: PublicKey[], vsMint: PublicKey): Promise<Map<string, number>>;
|
6
6
|
export declare function getMergedAssets(assets: PortfolioAsset[]): PortfolioAsset[];
|
@@ -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.getMergedAssets = exports.
|
15
|
+
exports.getMergedAssets = exports.getJupiterPrices = exports.getVotePda = exports.deriveClaimStatus = void 0;
|
16
16
|
const web3_js_1 = require("@solana/web3.js");
|
17
17
|
const axios_1 = __importDefault(require("axios"));
|
18
18
|
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
@@ -29,7 +29,7 @@ function getVotePda(owner) {
|
|
29
29
|
], constants_1.voteProgramId)[0];
|
30
30
|
}
|
31
31
|
exports.getVotePda = getVotePda;
|
32
|
-
function
|
32
|
+
function getJupiterPrices(mints, vsMint) {
|
33
33
|
return __awaiter(this, void 0, void 0, function* () {
|
34
34
|
const res = yield axios_1.default.get('https://price.jup.ag/v4/price', {
|
35
35
|
params: {
|
@@ -44,7 +44,7 @@ function getPrices(mints, vsMint) {
|
|
44
44
|
return prices;
|
45
45
|
});
|
46
46
|
}
|
47
|
-
exports.
|
47
|
+
exports.getJupiterPrices = getJupiterPrices;
|
48
48
|
function getMergedAssets(assets) {
|
49
49
|
const assetByMint = new Map();
|
50
50
|
for (const asset of assets) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/jupiter/helpers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6CAA4C;AAC5C,kDAA6C;AAC7C,+DAA4E;AAC5E,2CAA0D;AAG1D,SAAgB,iBAAiB,CAC/B,QAAmB,EACnB,WAAsB,EACtB,SAAoB;IAEpB,OAAO,mBAAS,CAAC,sBAAsB,CACrC,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,EAAE,QAAQ,CAAC,OAAO,EAAE,EAAE,WAAW,CAAC,OAAO,EAAE,CAAC,EACvE,SAAS,CACV,CAAC;AACJ,CAAC;AATD,8CASC;AAED,SAAgB,UAAU,CAAC,KAAa;IACtC,OAAO,mBAAS,CAAC,sBAAsB,CACrC;QACE,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC;QACrB,wBAAY,CAAC,OAAO,EAAE;QACtB,IAAI,mBAAS,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE;KAC/B,EACD,yBAAa,CACd,CAAC,CAAC,CAAC,CAAC;AACP,CAAC;AATD,gCASC;AAED,SAAsB,
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/jupiter/helpers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6CAA4C;AAC5C,kDAA6C;AAC7C,+DAA4E;AAC5E,2CAA0D;AAG1D,SAAgB,iBAAiB,CAC/B,QAAmB,EACnB,WAAsB,EACtB,SAAoB;IAEpB,OAAO,mBAAS,CAAC,sBAAsB,CACrC,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,E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AM,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC,IAAI,CAAC;QAC/B,MAAM,WAAW,GAAG,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC;QACtC,MAAM,UAAU,GAAG,KAAK,CAAC,KAAK,CAAC;QAC/B,MAAM,aAAa,GAAG,WAAW,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAC/C,IAAI,CAAC,aAAa,EAAE,CAAC;YACnB,WAAW,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QAClC,CAAC;aAAM,CAAC;YACN,aAAa,CAAC,IAAI,CAAC,MAAM,IAAI,WAAW,CAAC;YACzC,aAAa,CAAC,KAAK,GAAG,IAAA,+BAAc,EAAC,CAAC,UAAU,EAAE,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC;YACxE,WAAW,CAAC,GAAG,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;QAC1C,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC,CAAC;AAC1C,CAAC;AAnBD,0CAmBC"}
|
@@ -10,7 +10,6 @@ const airdropFetcher_1 = __importDefault(require("./airdropFetcher"));
|
|
10
10
|
const voteFetcher_1 = __importDefault(require("./voteFetcher"));
|
11
11
|
const constants_1 = require("./constants");
|
12
12
|
const valueAverageFetcher_1 = __importDefault(require("./valueAverageFetcher"));
|
13
|
-
const testFetcher_1 = __importDefault(require("./testFetcher"));
|
14
13
|
exports.platforms = [constants_1.jupiterPlatform];
|
15
14
|
exports.jobs = [custodiesJob_1.default];
|
16
15
|
exports.fetchers = [
|
@@ -18,6 +17,5 @@ exports.fetchers = [
|
|
18
17
|
airdropFetcher_1.default,
|
19
18
|
voteFetcher_1.default,
|
20
19
|
valueAverageFetcher_1.default,
|
21
|
-
testFetcher_1.default,
|
22
20
|
];
|
23
21
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/jupiter/index.ts"],"names":[],"mappings":";;;;;;AAGA,0EAAkD;AAClD,kEAA0C;AAC1C,sEAA8C;AAC9C,gEAAwC;AACxC,2CAA8C;AAC9C,gFAAwD;
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/jupiter/index.ts"],"names":[],"mappings":";;;;;;AAGA,0EAAkD;AAClD,kEAA0C;AAC1C,sEAA8C;AAC9C,gEAAwC;AACxC,2CAA8C;AAC9C,gFAAwD;AAE3C,QAAA,SAAS,GAAe,CAAC,2BAAe,CAAC,CAAC;AAC1C,QAAA,IAAI,GAAU,CAAC,sBAAY,CAAC,CAAC;AAC7B,QAAA,QAAQ,GAAc;IACjC,0BAAgB;IAChB,wBAAc;IACd,qBAAW;IACX,6BAAmB;CACpB,CAAC"}
|
@@ -15,13 +15,13 @@ const constants_1 = require("./constants");
|
|
15
15
|
const helpers_1 = require("../jupiter/helpers");
|
16
16
|
const constants_2 = require("../tokens/constants");
|
17
17
|
const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
18
|
-
const prices = yield (0, helpers_1.getPrices)([new web3_js_1.PublicKey(constants_1.xLfntyMint)], new web3_js_1.PublicKey(constants_1.lfntyMint));
|
19
|
-
const price = prices.get(constants_1.xLfntyMint);
|
20
|
-
if (!price)
|
21
|
-
return;
|
22
18
|
const lfntyTokenPrice = yield cache.getTokenPrice(constants_1.lfntyMint, portfolio_core_1.NetworkId.solana);
|
23
19
|
if (!lfntyTokenPrice)
|
24
20
|
return;
|
21
|
+
const prices = yield (0, helpers_1.getJupiterPrices)([new web3_js_1.PublicKey(constants_1.xLfntyMint)], new web3_js_1.PublicKey(constants_1.lfntyMint));
|
22
|
+
const price = prices.get(constants_1.xLfntyMint);
|
23
|
+
if (!price)
|
24
|
+
return;
|
25
25
|
const source = {
|
26
26
|
address: constants_1.xLfntyMint,
|
27
27
|
decimals: constants_1.xLfntyDecimals,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"xLfntyJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/lifinity/xLfntyJob.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+DAAyE;AACzE,6CAA4C;AAG5C,2CAAgF;AAChF,
|
1
|
+
{"version":3,"file":"xLfntyJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/lifinity/xLfntyJob.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+DAAyE;AACzE,6CAA4C;AAG5C,2CAAgF;AAChF,gDAAsD;AACtD,mDAA2D;AAE3D,MAAM,QAAQ,GAAgB,CAAO,KAAY,EAAE,EAAE;IACnD,MAAM,eAAe,GAAG,MAAM,KAAK,CAAC,aAAa,CAC/C,qBAAS,EACT,0BAAS,CAAC,MAAM,CACjB,CAAC;IACF,IAAI,CAAC,eAAe;QAAE,OAAO;IAE7B,MAAM,MAAM,GAAG,MAAM,IAAA,0BAAgB,EACnC,CAAC,IAAI,mBAAS,CAAC,sBAAU,CAAC,CAAC,EAC3B,IAAI,mBAAS,CAAC,qBAAS,CAAC,CACzB,CAAC;IACF,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,sBAAU,CAAC,CAAC;IACrC,IAAI,CAAC,KAAK;QAAE,OAAO;IAEnB,MAAM,MAAM,GAAqB;QAC/B,OAAO,EAAE,sBAAU;QACnB,QAAQ,EAAE,0BAAc;QACxB,EAAE,EAAE,aAAa;QACjB,SAAS,EAAE,0BAAS,CAAC,MAAM;QAC3B,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;QACrB,KAAK,EAAE,KAAK,GAAG,eAAe,CAAC,KAAK;QACpC,UAAU,EAAE,gCAAoB,CAAC,EAAE;QACnC,MAAM,EAAE,GAAG;KACZ,CAAC;IACF,MAAM,KAAK,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC;AAC1C,CAAC,CAAA,CAAC;AACF,MAAM,GAAG,GAAQ;IACf,EAAE,EAAE,GAAG,sBAAU,SAAS;IAC1B,QAAQ;IACR,KAAK,EAAE,QAAQ;CAChB,CAAC;AACF,kBAAe,GAAG,CAAC"}
|
@@ -35,12 +35,9 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
35
35
|
return [];
|
36
36
|
const marketsByAddress = new Map();
|
37
37
|
markets.forEach((market) => {
|
38
|
-
|
39
|
-
marketsByAddress.set(market.address.toString(), market);
|
38
|
+
marketsByAddress.set(market.address.toString(), market);
|
40
39
|
});
|
41
40
|
for (const marketInfo of markets) {
|
42
|
-
if (!marketInfo)
|
43
|
-
continue;
|
44
41
|
const seeds = [
|
45
42
|
(0, helpers_1.getObligationSeed)(marketInfo.address, 0),
|
46
43
|
(0, helpers_1.getObligationSeed)(marketInfo.address, 1),
|
@@ -52,18 +49,12 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
52
49
|
obligationAddresses.push(obligationAddress);
|
53
50
|
}
|
54
51
|
}
|
55
|
-
console.log('constexecutor:FetcherExecutor= ~ owner:', owner);
|
56
52
|
// Flexlend, only support the main pool on Solend
|
57
|
-
// mainMarket = 4UpD2fh7xH3VP9QQaXtsS1YY3bxzWhtfpks7FatyKvdY
|
58
53
|
const marketSeed = constants_1.mainMarket.slice(0, 16);
|
59
|
-
// owner = 5MBMRrJcAFmkQ39iSB3v6U8ifz4HqizS32voDrmSC6nu
|
60
54
|
const ownerSeed = owner.slice(0, 16);
|
61
55
|
const obligationSeed = ownerSeed + marketSeed;
|
62
|
-
// AUTOMATION PUBLIC KEY = 8PWR75ppAGonv9dXStjficjXmdsuDKmDoVNcy4oYhAMs
|
63
56
|
const oldFlexlendObligAddress = yield web3_js_1.PublicKey.createWithSeed(constants_2.AUTOMATION_PUBLIC_KEY, obligationSeed, constants_1.pid);
|
64
|
-
// -> gives : 3UHaFeLkzaHn1Rnks1p8s1xJdwHqMzD4JazWZH4PkzJ9 (correct)
|
65
57
|
const newFlexlendObligAddress = yield web3_js_1.PublicKey.createWithSeed(new web3_js_1.PublicKey(owner), obligationSeed, constants_1.pid);
|
66
|
-
// -> gives : AnwJKJf4YYKqYz6QBDbf1GhUFhPCExGAH4tNGjKXMBtP (inccorect)
|
67
58
|
obligationAddresses.push(...[oldFlexlendObligAddress, newFlexlendObligAddress]);
|
68
59
|
const obligations = yield (0, solana_1.getParsedMultipleAccountsInfo)(client, structs_1.obligationStruct, obligationAddresses);
|
69
60
|
if (obligations.length === 0)
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"obligationsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/solend/obligationsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DASoC;AACpC,gEAAqC;AACrC,6CAA4C;AAG5C,2CAOqB;AACrB,uCAA6D;AAE7D,+CAAmE;AACnE,iDAAsD;AACtD,uCAA6C;AAC7C,qGAA6E;AAC7E,6EAAqD;AACrD,qDAA8D;AAC9D,6DAAiE;AAEjE,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,MAAM,GAAG,IAAA,yBAAe,GAAE,CAAC;IACjC,MAAM,mBAAmB,GAAG,EAAE,CAAC;IAE/B,MAAM,OAAO,GAAG,MAAM,KAAK,CAAC,WAAW,CAAa;QAClD,MAAM,EAAE,yBAAa;QACrB,SAAS,EAAE,0BAAS,CAAC,MAAM;KAC5B,CAAC,CAAC;IACH,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IACpC,MAAM,gBAAgB,GAA4B,IAAI,GAAG,EAAE,CAAC;IAC5D,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;QACzB,
|
1
|
+
{"version":3,"file":"obligationsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/solend/obligationsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DASoC;AAC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E,MAAM,CAAC,IAAI;YACjB,IAAI,EAAE;gBACJ,cAAc;gBACd,aAAa;gBACb,cAAc;gBACd,cAAc;gBACd,aAAa;gBACb,cAAc;gBACd,eAAe,EAAE,IAAI;gBAErB,WAAW;gBACX,YAAY;gBACZ,WAAW;gBACX,KAAK;aACN;SACF,CAAC,CAAC;IACL,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,cAAc;IAC/B,SAAS,EAAE,0BAAS,CAAC,MAAM;IAC3B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,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;
|
@@ -12,6 +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
|
+
/* eslint-disable no-labels */
|
15
16
|
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
16
17
|
const constants_1 = require("./constants");
|
17
18
|
const solana_1 = require("../../utils/solana");
|
@@ -20,26 +21,25 @@ const structs_1 = require("./structs");
|
|
20
21
|
const filters_1 = require("./filters");
|
21
22
|
const getParsedAccountInfo_1 = require("../../utils/solana/getParsedAccountInfo");
|
22
23
|
const getLpTokenSourceRaw_1 = __importDefault(require("../../utils/misc/getLpTokenSourceRaw"));
|
23
|
-
const runInBatch_1 = __importDefault(require("../../utils/misc/runInBatch"));
|
24
24
|
const helpers_1 = require("../../utils/solana/pyth/helpers");
|
25
25
|
const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
26
26
|
const connection = (0, clients_1.getClientSolana)();
|
27
27
|
const tokenListRes = yield (0, getParsedAccountInfo_1.getParsedAccountInfo)(connection, structs_1.tokenListStruct, constants_1.tokenListAddress);
|
28
28
|
if (!tokenListRes)
|
29
29
|
return;
|
30
|
-
const tokenSettings = tokenListRes.list
|
31
|
-
.map((t) => t)
|
32
|
-
.slice(0, tokenListRes.numTokens.toNumber());
|
30
|
+
const tokenSettings = [...tokenListRes.list].slice(0, tokenListRes.numTokens.toNumber());
|
33
31
|
// Add tokens prices from Pyth Oracles
|
34
|
-
const
|
32
|
+
const pythSources = yield (0, helpers_1.getPythTokenPriceSources)(connection, tokenSettings
|
33
|
+
.filter((ts) => ts.oracleType === structs_1.OracleType.Pyth)
|
34
|
+
.map((ts) => ({
|
35
35
|
mint: ts.tokenMint,
|
36
36
|
oracle: ts.oracleAccount,
|
37
37
|
})));
|
38
|
-
yield cache.setTokenPriceSources(
|
38
|
+
yield cache.setTokenPriceSources(pythSources);
|
39
39
|
const tokenPrices = yield cache.getTokenPrices(tokenSettings.map((ts) => ts.tokenMint.toString()), portfolio_core_1.NetworkId.solana);
|
40
40
|
const accounts = yield (0, solana_1.getParsedProgramAccounts)(connection, structs_1.fundStruct, constants_1.basketProgramId, filters_1.fundFilters);
|
41
41
|
const lpSources = [];
|
42
|
-
for (let i = 0; i < accounts.length; i++) {
|
42
|
+
mainLoop: for (let i = 0; i < accounts.length; i++) {
|
43
43
|
const account = accounts[i];
|
44
44
|
if (account.supplyOutstanding.isZero())
|
45
45
|
continue;
|
@@ -48,12 +48,15 @@ const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
|
48
48
|
const tokenIndex = account.currentCompToken[j].toNumber();
|
49
49
|
const tokenPrice = tokenPrices[tokenIndex];
|
50
50
|
if (!tokenPrice)
|
51
|
+
continue mainLoop;
|
52
|
+
const reserveAmountRaw = account.currentCompAmount[j];
|
53
|
+
if (reserveAmountRaw.isZero())
|
51
54
|
continue;
|
52
55
|
poolUnderlyingRaw.push({
|
53
56
|
address: tokenPrice.address,
|
54
57
|
decimals: tokenPrice.decimals,
|
55
58
|
price: tokenPrice.price,
|
56
|
-
reserveAmountRaw
|
59
|
+
reserveAmountRaw,
|
57
60
|
});
|
58
61
|
}
|
59
62
|
if (poolUnderlyingRaw.length === 0)
|
@@ -65,7 +68,7 @@ const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
|
65
68
|
}, poolUnderlyingRaw);
|
66
69
|
lpSources.push(lpSource);
|
67
70
|
}
|
68
|
-
yield
|
71
|
+
yield cache.setTokenPriceSources(lpSources);
|
69
72
|
});
|
70
73
|
const job = {
|
71
74
|
id: `${constants_1.platformId}-baskets`,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"basketsJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/symmetry/basketsJob.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAAyE;AAGzE,2CAA4E;AAC5E,+CAA8D;AAC9D,iDAAsD;AACtD,
|
1
|
+
{"version":3,"file":"basketsJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/symmetry/basketsJob.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,8BAA8B;AAC9B,+DAAyE;AAGzE,2CAA4E;AAC5E,+CAA8D;AAC9D,iDAAsD;AACtD,uCAAoE;AACpE,uCAAwC;AACxC,kFAA+E;AAC/E,+FAE8C;AAC9C,6DAA2E;AAE3E,MAAM,QAAQ,GAAgB,CAAO,KAAY,EAAE,EAAE;IACnD,MAAM,UAAU,GAAG,IAAA,yBAAe,GAAE,CAAC;IAErC,MAAM,YAAY,GAAG,MAAM,IAAA,2CAAoB,EAC7C,UAAU,EACV,yBAAe,EACf,4BAAgB,CACjB,CAAC;IACF,IAAI,CAAC,YAAY;QAAE,OAAO;IAC1B,MAAM,aAAa,GAAG,CAAC,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC,KAAK,CAChD,CAAC,EACD,YAAY,CAAC,SAAS,CAAC,QAAQ,EAAE,CAClC,CAAC;IAEF,sCAAsC;IACtC,MAAM,WAAW,GAAG,MAAM,IAAA,kCAAwB,EAChD,UAAU,EACV,aAAa;SACV,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,UAAU,KAAK,oBAAU,CAAC,IAAI,CAAC;SACjD,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;QACZ,IAAI,EAAE,EAAE,CAAC,SAAS;QAClB,MAAM,EAAE,EAAE,CAAC,aAAa;KACzB,CAAC,CAAC,CACN,CAAC;IACF,MAAM,KAAK,CAAC,oBAAoB,CAAC,WAAW,C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CAAC,CAAC;QACL,CAAC;QACD,IAAI,iBAAiB,CAAC,MAAM,KAAK,CAAC;YAAE,SAAS;QAE7C,MAAM,QAAQ,GAAG,IAAA,6BAAmB,EAClC,0BAAS,CAAC,MAAM,EAChB,sBAAU,EACV,sBAAU,EACV,QAAQ,EACR;YACE,OAAO,EAAE,OAAO,CAAC,SAAS,CAAC,QAAQ,EAAE;YACrC,QAAQ,EAAE,CAAC;YACX,SAAS,EAAE,OAAO,CAAC,iBAAiB;SACrC,EACD,iBAAiB,CAClB,CAAC;QACF,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC3B,CAAC;IACD,MAAM,KAAK,CAAC,oBAAoB,CAAC,SAAS,CAAC,CAAC;AAC9C,CAAC,CAAA,CAAC;AACF,MAAM,GAAG,GAAQ;IACf,EAAE,EAAE,GAAG,sBAAU,UAAU;IAC3B,QAAQ;IACR,KAAK,EAAE,QAAQ;CAChB,CAAC;AACF,kBAAe,GAAG,CAAC"}
|
@@ -52,12 +52,16 @@ export type Fund = {
|
|
52
52
|
extraBytes: number[];
|
53
53
|
};
|
54
54
|
export declare const fundStruct: BeetStruct<Fund, Partial<Fund>>;
|
55
|
+
export declare enum OracleType {
|
56
|
+
Pyth = 0,
|
57
|
+
CustomSwitchboard = 1
|
58
|
+
}
|
55
59
|
export type TokenSettings = {
|
56
60
|
tokenMint: PublicKey;
|
57
61
|
decimals: number;
|
58
62
|
coingeckoId: number[];
|
59
63
|
pdaTokenAccount: PublicKey;
|
60
|
-
oracleType:
|
64
|
+
oracleType: OracleType;
|
61
65
|
oracleAccount: PublicKey;
|
62
66
|
oracleIndex: number;
|
63
67
|
oracleConfidencePct: number;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.tokenListStruct = exports.tokenSettingsStruct = exports.fundStruct = void 0;
|
3
|
+
exports.tokenListStruct = exports.tokenSettingsStruct = exports.OracleType = exports.fundStruct = void 0;
|
4
4
|
const beet_solana_1 = require("@metaplex-foundation/beet-solana");
|
5
5
|
const beet_1 = require("@metaplex-foundation/beet");
|
6
6
|
const solana_1 = require("../../utils/solana");
|
@@ -53,6 +53,11 @@ exports.fundStruct = new beet_1.BeetStruct([
|
|
53
53
|
['uri', (0, beet_1.uniformFixedSizeArray)(beet_1.u8, 300)],
|
54
54
|
['extraBytes', (0, beet_1.uniformFixedSizeArray)(beet_1.u8, 394)],
|
55
55
|
], (args) => args);
|
56
|
+
var OracleType;
|
57
|
+
(function (OracleType) {
|
58
|
+
OracleType[OracleType["Pyth"] = 0] = "Pyth";
|
59
|
+
OracleType[OracleType["CustomSwitchboard"] = 1] = "CustomSwitchboard";
|
60
|
+
})(OracleType || (exports.OracleType = OracleType = {}));
|
56
61
|
exports.tokenSettingsStruct = new beet_1.BeetStruct([
|
57
62
|
['tokenMint', beet_solana_1.publicKey],
|
58
63
|
['decimals', beet_1.u8],
|
@@ -73,6 +78,6 @@ exports.tokenSettingsStruct = new beet_1.BeetStruct([
|
|
73
78
|
exports.tokenListStruct = new beet_1.FixableBeetStruct([
|
74
79
|
['buffer', (0, solana_1.blob)(8)],
|
75
80
|
['numTokens', solana_1.u64],
|
76
|
-
['list', (0, beet_1.uniformFixedSizeArray)(exports.tokenSettingsStruct,
|
81
|
+
['list', (0, beet_1.uniformFixedSizeArray)(exports.tokenSettingsStruct, 200)],
|
77
82
|
], (args) => args);
|
78
83
|
//# sourceMappingURL=structs.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"structs.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/symmetry/structs.ts"],"names":[],"mappings":";;;AAAA,kEAA6D;AAC7D,oDAKmC;AAGnC,+CAA+C;AAqDlC,QAAA,UAAU,GAAG,IAAI,iBAAU,CACtC;IACE,CAAC,QAAQ,EAAE,IAAA,aAAI,EAAC,CAAC,CAAC,CAAC;IACnB,CAAC,SAAS,EAAE,YAAG,CAAC;IACh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 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;
|
@@ -0,0 +1,26 @@
|
|
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
|
+
exports.getDecimals = void 0;
|
13
|
+
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
14
|
+
const getParsedAccountInfo_1 = require("./getParsedAccountInfo");
|
15
|
+
const structs_1 = require("./structs");
|
16
|
+
const solMints = [portfolio_core_1.solanaNativeAddress, portfolio_core_1.solanaNativeWrappedAddress];
|
17
|
+
function getDecimals(connection, mint) {
|
18
|
+
return __awaiter(this, void 0, void 0, function* () {
|
19
|
+
if (solMints.includes(mint.toString()))
|
20
|
+
return portfolio_core_1.solanaNativeDecimals;
|
21
|
+
const mintAccount = yield (0, getParsedAccountInfo_1.getParsedAccountInfo)(connection, structs_1.mintAccountStruct, mint);
|
22
|
+
return (mintAccount === null || mintAccount === void 0 ? void 0 : mintAccount.decimals) || null;
|
23
|
+
});
|
24
|
+
}
|
25
|
+
exports.getDecimals = getDecimals;
|
26
|
+
//# sourceMappingURL=getDecimals.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"getDecimals.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/solana/getDecimals.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,+DAIoC;AAEpC,iEAA8D;AAC9D,uCAA8C;AAE9C,MAAM,QAAQ,GAAG,CAAC,oCAAmB,EAAE,2CAA0B,CAAC,CAAC;AAEnE,SAAsB,WAAW,CAC/B,UAAwB,EACxB,IAAe;;QAEf,IAAI,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;YAAE,OAAO,qCAAoB,CAAC;QAEpE,MAAM,WAAW,GAAG,MAAM,IAAA,2CAAoB,EAC5C,UAAU,EACV,2BAAiB,EACjB,IAAI,CACL,CAAC;QACF,OAAO,CAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,QAAQ,KAAI,IAAI,CAAC;IACvC,CAAC;CAAA;AAZD,kCAYC"}
|