@sonarwatch/portfolio-plugins 0.11.181 → 0.11.182
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +1459 -1455
- package/README.md +3 -3
- package/package.json +2 -2
- package/src/index.js +4 -0
- package/src/index.js.map +1 -1
- package/src/plugins/balancer/helpers/pools.js +21 -21
- package/src/plugins/clone/constants.d.ts +7 -0
- package/src/plugins/clone/constants.js +17 -0
- package/src/plugins/clone/constants.js.map +1 -0
- package/src/plugins/clone/depositsFetcher.d.ts +3 -0
- package/src/plugins/clone/depositsFetcher.js +135 -0
- package/src/plugins/clone/depositsFetcher.js.map +1 -0
- package/src/plugins/clone/helpers.d.ts +2 -0
- package/src/plugins/clone/helpers.js +10 -0
- package/src/plugins/clone/helpers.js.map +1 -0
- package/src/plugins/clone/index.d.ts +6 -0
- package/src/plugins/clone/index.js +13 -0
- package/src/plugins/clone/index.js.map +1 -0
- package/src/plugins/clone/poolsJob.d.ts +3 -0
- package/src/plugins/clone/poolsJob.js +33 -0
- package/src/plugins/clone/poolsJob.js.map +1 -0
- package/src/plugins/clone/structs.d.ts +60 -0
- package/src/plugins/clone/structs.js +57 -0
- package/src/plugins/clone/structs.js.map +1 -0
- package/src/plugins/clone/types.d.ts +25 -0
- package/src/plugins/clone/types.js +12 -0
- package/src/plugins/clone/types.js.map +1 -0
- package/src/plugins/sushiswap/helpers.js +24 -24
- 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/constants.d.ts +3 -0
- package/src/utils/solana/constants.js +7 -1
- package/src/utils/solana/constants.js.map +1 -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.182",
|
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.182"
|
45
45
|
},
|
46
46
|
"main": "./src/index.js",
|
47
47
|
"types": "./src/index.d.ts"
|
package/src/index.js
CHANGED
@@ -105,6 +105,7 @@ const banx_1 = require("./plugins/banx");
|
|
105
105
|
const nosana_1 = require("./plugins/nosana");
|
106
106
|
const jito_1 = require("./plugins/jito");
|
107
107
|
const magiceden_1 = require("./plugins/magiceden");
|
108
|
+
const clone_1 = require("./plugins/clone");
|
108
109
|
var constants_1 = require("./plugins/tokens/constants");
|
109
110
|
Object.defineProperty(exports, "walletTokensPlatform", { enumerable: true, get: function () { return constants_1.walletTokensPlatform; } });
|
110
111
|
Object.defineProperty(exports, "walletNftsPlatform", { enumerable: true, get: function () { return constants_1.walletNftsPlatform; } });
|
@@ -203,6 +204,7 @@ exports.platforms = [
|
|
203
204
|
...nosana_1.platforms,
|
204
205
|
...jito_1.platforms,
|
205
206
|
...magiceden_1.platforms,
|
207
|
+
...clone_1.platforms,
|
206
208
|
];
|
207
209
|
// JOBS //
|
208
210
|
exports.jobs = [
|
@@ -284,6 +286,7 @@ exports.jobs = [
|
|
284
286
|
...nosana_1.jobs,
|
285
287
|
...jito_1.jobs,
|
286
288
|
...magiceden_1.jobs,
|
289
|
+
...clone_1.jobs,
|
287
290
|
];
|
288
291
|
// FETCHERS //
|
289
292
|
exports.fetchers = [
|
@@ -367,6 +370,7 @@ exports.fetchers = [
|
|
367
370
|
...nosana_1.fetchers,
|
368
371
|
...jito_1.fetchers,
|
369
372
|
...magiceden_1.fetchers,
|
373
|
+
...clone_1.fetchers,
|
370
374
|
];
|
371
375
|
exports.fetchersByAddressSystem = (0, getFetchersByAddressSystem_1.getFetchersByAddressSystem)(exports.fetchers);
|
372
376
|
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/plugins/src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAGA,wFAAqF;AACrF,sEAA8C;AAC9C,6CAI0B;AAC1B,yDAIgC;AAChC,iDAG4B;AAC5B,iDAI4B;AAC5B,2CAGyB;AACzB,6CAI0B;AAC1B,+CAI2B;AAC3B,yCAIwB;AACxB,+CAI2B;AAC3B,2CAIyB;AACzB,6CAI0B;AAC1B,2CAIyB;AACzB,6CAG0B;AAC1B,6CAI0B;AAC1B,yCAIwB;AACxB,2DAGiC;AACjC,6CAI0B;AAC1B,2CAIyB;AACzB,2CAIyB;AACzB,qDAA6D;AAC7D,qEAIsC;AACtC,uDAI+B;AAC/B,mDAG6B;AAC7B,qDAG8B;AAC9B,uDAG+B;AAC/B,2CAIyB;AACzB,6CAI0B;AAC1B,6CAG0B;AAC1B,yCAIwB;AACxB,+CAI2B;AAC3B,uDAG+B;AAC/B,yCAGwB;AACxB,2CAIyB;AACzB,iDAI4B;AAC5B,iDAI4B;AAC5B,6CAI0B;AAC1B,+CAI2B;AAC3B,qDAG8B;AAC9B,iDAI4B;AAC5B,iDAI4B;AAC5B,mDAG6B;AAC7B,yCAIwB;AACxB,2CAIyB;AACzB,iDAI4B;AAC5B,iDAI4B;AAC5B,+CAI2B;AAC3B,yCAIwB;AACxB,2CAIyB;AACzB,mDAI6B;AAC7B,2CAIyB;AACzB,2CAIyB;AACzB,sCAIsB;AACtB,+CAI2B;AAC3B,yCAIwB;AACxB,iDAI4B;AAC5B,yCAIwB;AACxB,mDAI6B;AAC7B,qDAI8B;AAC9B,2CAIyB;AACzB,2CAIyB;AACzB,yCAIwB;AACxB,+CAI2B;AAC3B,2CAIyB;AACzB,2CAIyB;AACzB,uDAI+B;AAC/B,6DAIkC;AAClC,2CAIyB;AACzB,yCAIwB;AACxB,mDAI6B;AAC7B,6CAI0B;AAC1B,iEAIoC;AACpC,6DAIkC;AAClC,yCAIwB;AACxB,uCAIuB;AACvB,+CAI2B;AAC3B,iDAI4B;AAC5B,mDAI6B;AAC7B,2CAIyB;AACzB,+CAI2B;AAC3B,uCAIuB;AACvB,iDAI4B;AAC5B,yCAIwB;AACxB,6CAI0B;AAC1B,yCAIwB;AACxB,mDAI6B;
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/plugins/src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAGA,wFAAqF;AACrF,sEAA8C;AAC9C,6CAI0B;AAC1B,yDAIgC;AAChC,iDAG4B;AAC5B,iDAI4B;AAC5B,2CAGyB;AACzB,6CAI0B;AAC1B,+CAI2B;AAC3B,yCAIwB;AACxB,+CAI2B;AAC3B,2CAIyB;AACzB,6CAI0B;AAC1B,2CAIyB;AACzB,6CAG0B;AAC1B,6CAI0B;AAC1B,yCAIwB;AACxB,2DAGiC;AACjC,6CAI0B;AAC1B,2CAIyB;AACzB,2CAIyB;AACzB,qDAA6D;AAC7D,qEAIsC;AACtC,uDAI+B;AAC/B,mDAG6B;AAC7B,qDAG8B;AAC9B,uDAG+B;AAC/B,2CAIyB;AACzB,6CAI0B;AAC1B,6CAG0B;AAC1B,yCAIwB;AACxB,+CAI2B;AAC3B,uDAG+B;AAC/B,yCAGwB;AACxB,2CAIyB;AACzB,iDAI4B;AAC5B,iDAI4B;AAC5B,6CAI0B;AAC1B,+CAI2B;AAC3B,qDAG8B;AAC9B,iDAI4B;AAC5B,iDAI4B;AAC5B,mDAG6B;AAC7B,yCAIwB;AACxB,2CAIyB;AACzB,iDAI4B;AAC5B,iDAI4B;AAC5B,+CAI2B;AAC3B,yCAI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AG,cAAe;IAClB,GAAG,kBAAe;IAClB,GAAG,eAAY;IACf,GAAG,mBAAgB;IACnB,GAAG,eAAY;IACf,GAAG,oBAAiB;IACpB,GAAG,kBAAe;IAClB,GAAG,qBAAkB;IACrB,GAAG,gBAAa;IAChB,GAAG,gBAAa;IAChB,GAAG,eAAY;IACf,GAAG,kBAAe;IAClB,GAAG,gBAAa;IAChB,GAAG,gBAAa;IAChB,GAAG,sBAAmB;IACtB,GAAG,yBAAsB;IACzB,GAAG,gBAAa;IAChB,GAAG,eAAY;IACf,GAAG,oBAAiB;IACpB,GAAG,iBAAc;IACjB,GAAG,2BAAsB;IACzB,GAAG,yBAAkB;IACrB,GAAG,eAAY;IACf,GAAG,cAAW;IACd,GAAG,kBAAe;IAClB,GAAG,mBAAgB;IACnB,GAAG,oBAAiB;IACpB,GAAG,gBAAa;IAChB,GAAG,kBAAe;IAClB,GAAG,cAAW;IACd,GAAG,mBAAgB;IACnB,GAAG,eAAY;IACf,GAAG,iBAAc;IACjB,GAAG,eAAY;IACf,GAAG,oBAAiB;IACpB,GAAG,gBAAa;CACjB,CAAC;AACW,QAAA,uBAAuB,GAAG,IAAA,uDAA0B,EAAC,gBAAQ,CAAC,CAAC"}
|
@@ -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;
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import { PublicKey } from '@solana/web3.js';
|
2
|
+
import { Platform } from '@sonarwatch/portfolio-core';
|
3
|
+
export declare const platformId = "clone";
|
4
|
+
export declare const platform: Platform;
|
5
|
+
export declare const clonePid: PublicKey;
|
6
|
+
export declare const poolsPubkey: PublicKey;
|
7
|
+
export declare const poolsKey = "pools";
|
@@ -0,0 +1,17 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.poolsKey = exports.poolsPubkey = exports.clonePid = exports.platform = exports.platformId = void 0;
|
4
|
+
const web3_js_1 = require("@solana/web3.js");
|
5
|
+
exports.platformId = 'clone';
|
6
|
+
exports.platform = {
|
7
|
+
id: exports.platformId,
|
8
|
+
name: 'Clone',
|
9
|
+
image: 'https://sonar.watch/img/platforms/clone.png',
|
10
|
+
defiLlamaId: 'clone-protocol', // from https://defillama.com/docs/api
|
11
|
+
website: 'https://clone.so/',
|
12
|
+
twitter: 'https://twitter.com/CloneProtocol',
|
13
|
+
};
|
14
|
+
exports.clonePid = new web3_js_1.PublicKey('C1onEW2kPetmHmwe74YC1ESx3LnFEpVau6g2pg4fHycr');
|
15
|
+
exports.poolsPubkey = new web3_js_1.PublicKey('5DmaSksXDg49G8586cqKjC1wd8gNVtoPmqmJeRMsQBut');
|
16
|
+
exports.poolsKey = 'pools';
|
17
|
+
//# sourceMappingURL=constants.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/clone/constants.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAG/B,QAAA,UAAU,GAAG,OAAO,CAAC;AACrB,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,OAAO;IACb,KAAK,EAAE,6CAA6C;IACpD,WAAW,EAAE,gBAAgB,EAAE,sCAAsC;IACrE,OAAO,EAAE,mBAAmB;IAC5B,OAAO,EAAE,mCAAmC;CAC7C,CAAC;AAEW,QAAA,QAAQ,GAAG,IAAI,mBAAS,CACnC,8CAA8C,CAC/C,CAAC;AACW,QAAA,WAAW,GAAG,IAAI,mBAAS,CACtC,8CAA8C,CAC/C,CAAC;AAEW,QAAA,QAAQ,GAAG,OAAO,CAAC"}
|
@@ -0,0 +1,135 @@
|
|
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 constants_1 = require("./constants");
|
17
|
+
const clients_1 = require("../../utils/clients");
|
18
|
+
const helpers_1 = require("./helpers");
|
19
|
+
const getParsedAccountInfo_1 = require("../../utils/solana/getParsedAccountInfo");
|
20
|
+
const structs_1 = require("./structs");
|
21
|
+
const solana_1 = require("../../utils/solana");
|
22
|
+
const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetToken"));
|
23
|
+
const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
24
|
+
const client = (0, clients_1.getClientSolana)();
|
25
|
+
const pda = (0, helpers_1.getUserAccount)(owner);
|
26
|
+
const userAccount = yield (0, getParsedAccountInfo_1.getParsedAccountInfo)(client, structs_1.userStruct, pda);
|
27
|
+
if (!userAccount)
|
28
|
+
return [];
|
29
|
+
const pools = yield cache.getItem(constants_1.poolsKey, {
|
30
|
+
prefix: constants_1.platformId,
|
31
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
32
|
+
});
|
33
|
+
if (!pools)
|
34
|
+
return [];
|
35
|
+
const tokenPriceById = yield cache.getTokenPricesAsMap([...pools.map((pool) => pool.assetInfo.onassetMint), solana_1.usdcSolanaMint], portfolio_core_1.NetworkId.solana);
|
36
|
+
const usdcTokenPrice = tokenPriceById.get(solana_1.usdcSolanaMint);
|
37
|
+
const { borrows, comet } = userAccount;
|
38
|
+
const elements = [];
|
39
|
+
for (const borrow of borrows) {
|
40
|
+
const { collateralAmount: borrowCollatAmount, borrowedOnasset, poolIndex, } = borrow;
|
41
|
+
const pool = pools.at(poolIndex);
|
42
|
+
if (!pool)
|
43
|
+
continue;
|
44
|
+
const tokenPrice = tokenPriceById.get(pool.assetInfo.onassetMint);
|
45
|
+
if (!tokenPrice)
|
46
|
+
continue;
|
47
|
+
const borrowedAssets = [];
|
48
|
+
const borrowedYields = [];
|
49
|
+
const suppliedAssets = [];
|
50
|
+
const suppliedYields = [];
|
51
|
+
const rewardAssets = [];
|
52
|
+
if (!borrowCollatAmount.isZero()) {
|
53
|
+
suppliedAssets.push((0, tokenPriceToAssetToken_1.default)(solana_1.usdcSolanaMint, borrowCollatAmount.dividedBy(solana_1.usdcSolanaFactor).toNumber(), portfolio_core_1.NetworkId.solana, usdcTokenPrice));
|
54
|
+
}
|
55
|
+
if (!borrowedOnasset.isZero()) {
|
56
|
+
borrowedAssets.push((0, tokenPriceToAssetToken_1.default)(tokenPrice.address, borrowedOnasset.dividedBy(Math.pow(10, tokenPrice.decimals)).toNumber(), portfolio_core_1.NetworkId.solana, tokenPrice));
|
57
|
+
}
|
58
|
+
if (suppliedAssets.length === 0 && borrowedAssets.length === 0)
|
59
|
+
continue;
|
60
|
+
const { borrowedValue, suppliedValue, value, healthRatio, rewardValue } = (0, portfolio_core_1.getElementLendingValues)(suppliedAssets, borrowedAssets, rewardAssets);
|
61
|
+
elements.push({
|
62
|
+
type: portfolio_core_1.PortfolioElementType.borrowlend,
|
63
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
64
|
+
platformId: constants_1.platformId,
|
65
|
+
label: 'Lending',
|
66
|
+
value,
|
67
|
+
data: {
|
68
|
+
borrowedAssets,
|
69
|
+
borrowedValue,
|
70
|
+
borrowedYields,
|
71
|
+
suppliedAssets,
|
72
|
+
suppliedValue,
|
73
|
+
suppliedYields,
|
74
|
+
collateralRatio: null,
|
75
|
+
healthRatio,
|
76
|
+
rewardAssets,
|
77
|
+
rewardValue,
|
78
|
+
value,
|
79
|
+
},
|
80
|
+
});
|
81
|
+
}
|
82
|
+
const { positions, collateralAmount } = comet;
|
83
|
+
const borrowedAssets = [];
|
84
|
+
const borrowedYields = [];
|
85
|
+
const suppliedAssets = [];
|
86
|
+
const suppliedYields = [];
|
87
|
+
const rewardAssets = [];
|
88
|
+
if (!collateralAmount.isZero()) {
|
89
|
+
suppliedAssets.push((0, tokenPriceToAssetToken_1.default)(solana_1.usdcSolanaMint, collateralAmount.dividedBy(solana_1.usdcSolanaFactor).toNumber(), portfolio_core_1.NetworkId.solana, usdcTokenPrice));
|
90
|
+
}
|
91
|
+
for (const position of positions) {
|
92
|
+
const amount = position.committedCollateralLiquidity;
|
93
|
+
const pool = pools.at(position.poolIndex);
|
94
|
+
if (!pool)
|
95
|
+
continue;
|
96
|
+
const tokenPrice = tokenPriceById.get(pool.assetInfo.onassetMint);
|
97
|
+
if (!tokenPrice)
|
98
|
+
continue;
|
99
|
+
if (!amount.isZero()) {
|
100
|
+
borrowedAssets.push((0, tokenPriceToAssetToken_1.default)(tokenPrice.address, amount.dividedBy(Math.pow(10, tokenPrice.decimals)).toNumber(), portfolio_core_1.NetworkId.solana, tokenPrice));
|
101
|
+
}
|
102
|
+
}
|
103
|
+
if (suppliedAssets.length !== 0 && borrowedAssets.length !== 0) {
|
104
|
+
const { borrowedValue, suppliedValue, value, healthRatio, rewardValue } = (0, portfolio_core_1.getElementLendingValues)(suppliedAssets, borrowedAssets, rewardAssets);
|
105
|
+
elements.push({
|
106
|
+
type: portfolio_core_1.PortfolioElementType.borrowlend,
|
107
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
108
|
+
platformId: constants_1.platformId,
|
109
|
+
label: 'Lending',
|
110
|
+
value,
|
111
|
+
name: 'Comet',
|
112
|
+
data: {
|
113
|
+
borrowedAssets,
|
114
|
+
borrowedValue,
|
115
|
+
borrowedYields,
|
116
|
+
suppliedAssets,
|
117
|
+
suppliedValue,
|
118
|
+
suppliedYields,
|
119
|
+
collateralRatio: null,
|
120
|
+
healthRatio,
|
121
|
+
rewardAssets,
|
122
|
+
rewardValue,
|
123
|
+
value,
|
124
|
+
},
|
125
|
+
});
|
126
|
+
}
|
127
|
+
return elements;
|
128
|
+
});
|
129
|
+
const fetcher = {
|
130
|
+
id: `${constants_1.platformId}-deposits`,
|
131
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
132
|
+
executor,
|
133
|
+
};
|
134
|
+
exports.default = fetcher;
|
135
|
+
//# sourceMappingURL=depositsFetcher.js.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
|
+
const web3_js_1 = require("@solana/web3.js");
|
5
|
+
const constants_1 = require("./constants");
|
6
|
+
function getUserAccount(owner) {
|
7
|
+
return web3_js_1.PublicKey.findProgramAddressSync([Buffer.from('user', 'utf-8'), new web3_js_1.PublicKey(owner).toBuffer()], constants_1.clonePid)[0];
|
8
|
+
}
|
9
|
+
exports.getUserAccount = getUserAccount;
|
10
|
+
//# sourceMappingURL=helpers.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/clone/helpers.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAC5C,2CAAuC;AAEvC,SAAgB,cAAc,CAAC,KAAa;IAC1C,OAAO,mBAAS,CAAC,sBAAsB,CACrC,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,mBAAS,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE,CAAC,EAC/D,oBAAQ,CACT,CAAC,CAAC,CAAC,CAAC;AACP,CAAC;AALD,wCAKC"}
|
@@ -0,0 +1,13 @@
|
|
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 depositsFetcher_1 = __importDefault(require("./depositsFetcher"));
|
9
|
+
const poolsJob_1 = __importDefault(require("./poolsJob"));
|
10
|
+
exports.platforms = [constants_1.platform];
|
11
|
+
exports.jobs = [poolsJob_1.default];
|
12
|
+
exports.fetchers = [depositsFetcher_1.default];
|
13
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/clone/index.ts"],"names":[],"mappings":";;;;;;AAGA,2CAAuC;AACvC,wEAAgD;AAChD,0DAAkC;AAErB,QAAA,SAAS,GAAe,CAAC,oBAAQ,CAAC,CAAC;AACnC,QAAA,IAAI,GAAU,CAAC,kBAAQ,CAAC,CAAC;AACzB,QAAA,QAAQ,GAAc,CAAC,yBAAe,CAAC,CAAC"}
|
@@ -0,0 +1,33 @@
|
|
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 clients_1 = require("../../utils/clients");
|
14
|
+
const getParsedAccountInfo_1 = require("../../utils/solana/getParsedAccountInfo");
|
15
|
+
const constants_1 = require("./constants");
|
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 pools = yield (0, getParsedAccountInfo_1.getParsedAccountInfo)(client, structs_1.PoolsStruct, constants_1.poolsPubkey);
|
20
|
+
if (!pools)
|
21
|
+
throw new Error('Clone Pools not found');
|
22
|
+
yield cache.setItem(constants_1.poolsKey, pools.pools, {
|
23
|
+
prefix: constants_1.platformId,
|
24
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
25
|
+
});
|
26
|
+
});
|
27
|
+
const job = {
|
28
|
+
id: `${constants_1.platformId}-pools`,
|
29
|
+
executor,
|
30
|
+
label: 'normal',
|
31
|
+
};
|
32
|
+
exports.default = job;
|
33
|
+
//# sourceMappingURL=poolsJob.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"poolsJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/clone/poolsJob.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+DAAuD;AAGvD,iDAAsD;AACtD,kFAA+E;AAC/E,2CAAgE;AAChE,uCAAwC;AAExC,MAAM,QAAQ,GAAgB,CAAO,KAAY,EAAE,EAAE;IACnD,MAAM,MAAM,GAAG,IAAA,yBAAe,GAAE,CAAC;IAEjC,MAAM,KAAK,GAAG,MAAM,IAAA,2CAAoB,EAAC,MAAM,EAAE,qBAAW,EAAE,uBAAW,CAAC,CAAC;IAC3E,IAAI,CAAC,KAAK;QAAE,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;IAErD,MAAM,KAAK,CAAC,OAAO,CAAC,oBAAQ,EAAE,KAAK,CAAC,KAAK,EAAE;QACzC,MAAM,EAAE,sBAAU;QAClB,SAAS,EAAE,0BAAS,CAAC,MAAM;KAC5B,CAAC,CAAC;AACL,CAAC,CAAA,CAAC;AAEF,MAAM,GAAG,GAAQ;IACf,EAAE,EAAE,GAAG,sBAAU,QAAQ;IACzB,QAAQ;IACR,KAAK,EAAE,QAAQ;CAChB,CAAC;AACF,kBAAe,GAAG,CAAC"}
|
@@ -0,0 +1,60 @@
|
|
1
|
+
/// <reference types="node" />
|
2
|
+
import { BeetStruct, FixableBeetStruct } from '@metaplex-foundation/beet';
|
3
|
+
import BigNumber from 'bignumber.js';
|
4
|
+
import { PublicKey } from '@metaplex-foundation/js';
|
5
|
+
export type Borrow = {
|
6
|
+
poolIndex: number;
|
7
|
+
borrowedOnasset: BigNumber;
|
8
|
+
collateralAmount: BigNumber;
|
9
|
+
};
|
10
|
+
export declare const borrowStruct: BeetStruct<Borrow, Partial<Borrow>>;
|
11
|
+
export type LiquidityPosition = {
|
12
|
+
poolIndex: number;
|
13
|
+
committedCollateralLiquidity: BigNumber;
|
14
|
+
collateralIldRebate: BigNumber;
|
15
|
+
onassetIldRebate: BigNumber;
|
16
|
+
};
|
17
|
+
export declare const liquidityPositionStruct: BeetStruct<LiquidityPosition, Partial<LiquidityPosition>>;
|
18
|
+
export type Comet = {
|
19
|
+
collateralAmount: BigNumber;
|
20
|
+
positions: LiquidityPosition[];
|
21
|
+
};
|
22
|
+
export declare const CometStruct: FixableBeetStruct<Comet, Partial<Comet>>;
|
23
|
+
export type User = {
|
24
|
+
buffer: Buffer;
|
25
|
+
borrows: Borrow[];
|
26
|
+
comet: Comet;
|
27
|
+
};
|
28
|
+
export declare const userStruct: FixableBeetStruct<User, Partial<User>>;
|
29
|
+
export declare enum Status {
|
30
|
+
Active = 0,
|
31
|
+
Frozen = 1,
|
32
|
+
Extraction = 2,
|
33
|
+
Liquidation = 3,
|
34
|
+
Deprecation = 4
|
35
|
+
}
|
36
|
+
export type AssetInfo = {
|
37
|
+
onassetMint: PublicKey;
|
38
|
+
oracleInfoIndex: number;
|
39
|
+
ilHealthScoreCoefficient: number;
|
40
|
+
positionHealthScoreCoefficient: number;
|
41
|
+
minOvercollateralRatio: number;
|
42
|
+
maxLiquidationOvercollateralRatio: number;
|
43
|
+
};
|
44
|
+
export declare const assetInfoStruct: BeetStruct<AssetInfo, Partial<AssetInfo>>;
|
45
|
+
export type Pool = {
|
46
|
+
underlyingAssetTokenAccount: PublicKey;
|
47
|
+
committedCollateralLiquidity: BigNumber;
|
48
|
+
collateralIld: BigNumber;
|
49
|
+
onassetIld: BigNumber;
|
50
|
+
treasuryTradingFeeBps: number;
|
51
|
+
liquidityTradingFeeBps: number;
|
52
|
+
assetInfo: AssetInfo;
|
53
|
+
status: Status;
|
54
|
+
};
|
55
|
+
export declare const poolStruct: BeetStruct<Pool, Partial<Pool>>;
|
56
|
+
export type Pools = {
|
57
|
+
buffer: Buffer;
|
58
|
+
pools: Pool[];
|
59
|
+
};
|
60
|
+
export declare const PoolsStruct: FixableBeetStruct<Pools, Partial<Pools>>;
|
@@ -0,0 +1,57 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.PoolsStruct = exports.poolStruct = exports.assetInfoStruct = exports.Status = exports.userStruct = exports.CometStruct = exports.liquidityPositionStruct = exports.borrowStruct = 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.borrowStruct = new beet_1.BeetStruct([
|
8
|
+
['poolIndex', beet_1.u8],
|
9
|
+
['borrowedOnasset', solana_1.u64],
|
10
|
+
['collateralAmount', solana_1.u64],
|
11
|
+
], (args) => args);
|
12
|
+
exports.liquidityPositionStruct = new beet_1.BeetStruct([
|
13
|
+
['poolIndex', beet_1.u8],
|
14
|
+
['committedCollateralLiquidity', solana_1.u64],
|
15
|
+
['collateralIldRebate', solana_1.i64],
|
16
|
+
['onassetIldRebate', solana_1.i64],
|
17
|
+
], (args) => args);
|
18
|
+
exports.CometStruct = new beet_1.FixableBeetStruct([
|
19
|
+
['collateralAmount', solana_1.u64],
|
20
|
+
['positions', (0, beet_1.array)(exports.liquidityPositionStruct)],
|
21
|
+
], (args) => args);
|
22
|
+
exports.userStruct = new beet_1.FixableBeetStruct([
|
23
|
+
['buffer', (0, solana_1.blob)(8)],
|
24
|
+
['borrows', (0, beet_1.array)(exports.borrowStruct)],
|
25
|
+
['comet', exports.CometStruct],
|
26
|
+
], (args) => args);
|
27
|
+
var Status;
|
28
|
+
(function (Status) {
|
29
|
+
Status[Status["Active"] = 0] = "Active";
|
30
|
+
Status[Status["Frozen"] = 1] = "Frozen";
|
31
|
+
Status[Status["Extraction"] = 2] = "Extraction";
|
32
|
+
Status[Status["Liquidation"] = 3] = "Liquidation";
|
33
|
+
Status[Status["Deprecation"] = 4] = "Deprecation";
|
34
|
+
})(Status || (exports.Status = Status = {}));
|
35
|
+
exports.assetInfoStruct = new beet_1.BeetStruct([
|
36
|
+
['onassetMint', beet_solana_1.publicKey],
|
37
|
+
['oracleInfoIndex', beet_1.u8],
|
38
|
+
['ilHealthScoreCoefficient', beet_1.u16],
|
39
|
+
['positionHealthScoreCoefficient', beet_1.u16],
|
40
|
+
['minOvercollateralRatio', beet_1.u16],
|
41
|
+
['maxLiquidationOvercollateralRatio', beet_1.u16],
|
42
|
+
], (args) => args);
|
43
|
+
exports.poolStruct = new beet_1.BeetStruct([
|
44
|
+
['underlyingAssetTokenAccount', beet_solana_1.publicKey],
|
45
|
+
['committedCollateralLiquidity', solana_1.u64],
|
46
|
+
['collateralIld', solana_1.i64],
|
47
|
+
['onassetIld', solana_1.i64],
|
48
|
+
['treasuryTradingFeeBps', beet_1.u16],
|
49
|
+
['liquidityTradingFeeBps', beet_1.u16],
|
50
|
+
['assetInfo', exports.assetInfoStruct],
|
51
|
+
['status', beet_1.u8],
|
52
|
+
], (args) => args);
|
53
|
+
exports.PoolsStruct = new beet_1.FixableBeetStruct([
|
54
|
+
['buffer', (0, solana_1.blob)(8)],
|
55
|
+
['pools', (0, beet_1.array)(exports.poolStruct)],
|
56
|
+
], (args) => args);
|
57
|
+
//# sourceMappingURL=structs.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"structs.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/clone/structs.ts"],"names":[],"mappings":";;;AAAA,oDAMmC;AAEnC,kEAA6D;AAE7D,+CAAoD;AAQvC,QAAA,YAAY,GAAG,IAAI,iBAAU,CACxC;IACE,CAAC,WAAW,EAAE,SAAE,CAAC;IACjB,CAAC,iBAAiB,EAAE,YAAG,CAAC;IACxB,CAAC,kBAAkB,EAAE,YAAG,CAAC;CAC1B,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAc,CACzB,CAAC;AASW,QAA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AAA,UAAU,GAAG,IAAI,iBAAU,CACtC;IACE,CAAC,6BAA6B,EAAE,uBAAS,CAAC;IAC1C,CAAC,8BAA8B,EAAE,YAAG,CAAC;IACrC,CAAC,eAAe,EAAE,YAAG,CAAC;IACtB,CAAC,YAAY,EAAE,YAAG,CAAC;IACnB,CAAC,uBAAuB,EAAE,UAAG,CAAC;IAC9B,CAAC,wBAAwB,EAAE,UAAG,CAAC;IAC/B,CAAC,WAAW,EAAE,uBAAe,CAAC;IAC9B,CAAC,QAAQ,EAAE,SAAE,CAAC;CACf,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAY,CACvB,CAAC;AAOW,QAAA,WAAW,GAAG,IAAI,wBAAiB,CAC9C;IACE,CAAC,QAAQ,EAAE,IAAA,aAAI,EAAC,CAAC,CAAC,CAAC;IACnB,CAAC,OAAO,EAAE,IAAA,YAAK,EAAC,kBAAU,CAAC,CAAC;CAC7B,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAa,CACxB,CAAC"}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
export declare enum Status {
|
2
|
+
Active = 0,
|
3
|
+
Frozen = 1,
|
4
|
+
Extraction = 2,
|
5
|
+
Liquidation = 3,
|
6
|
+
Deprecation = 4
|
7
|
+
}
|
8
|
+
export type AssetInfo = {
|
9
|
+
onassetMint: string;
|
10
|
+
oracleInfoIndex: number;
|
11
|
+
ilHealthScoreCoefficient: number;
|
12
|
+
positionHealthScoreCoefficient: number;
|
13
|
+
minOvercollateralRatio: number;
|
14
|
+
maxLiquidationOvercollateralRatio: number;
|
15
|
+
};
|
16
|
+
export type Pool = {
|
17
|
+
underlyingAssetTokenAccount: string;
|
18
|
+
committedCollateralLiquidity: string;
|
19
|
+
collateralIld: string;
|
20
|
+
onassetIld: string;
|
21
|
+
treasuryTradingFeeBps: number;
|
22
|
+
liquidityTradingFeeBps: number;
|
23
|
+
assetInfo: AssetInfo;
|
24
|
+
status: Status;
|
25
|
+
};
|
@@ -0,0 +1,12 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.Status = void 0;
|
4
|
+
var Status;
|
5
|
+
(function (Status) {
|
6
|
+
Status[Status["Active"] = 0] = "Active";
|
7
|
+
Status[Status["Frozen"] = 1] = "Frozen";
|
8
|
+
Status[Status["Extraction"] = 2] = "Extraction";
|
9
|
+
Status[Status["Liquidation"] = 3] = "Liquidation";
|
10
|
+
Status[Status["Deprecation"] = 4] = "Deprecation";
|
11
|
+
})(Status || (exports.Status = Status = {}));
|
12
|
+
//# sourceMappingURL=types.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/clone/types.ts"],"names":[],"mappings":";;;AAAA,IAAY,MAMX;AAND,WAAY,MAAM;IAChB,uCAAM,CAAA;IACN,uCAAM,CAAA;IACN,+CAAU,CAAA;IACV,iDAAW,CAAA;IACX,iDAAW,CAAA;AACb,CAAC,EANW,MAAM,sBAAN,MAAM,QAMjB"}
|
@@ -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;
|