@sonarwatch/portfolio-plugins 0.11.135 → 0.11.136
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +1271 -1267
- package/README.md +3 -3
- package/package.json +2 -2
- package/src/plugins/balancer/helpers/pools.js +21 -21
- package/src/plugins/flash/stakeFetcher.js +30 -24
- package/src/plugins/flash/stakeFetcher.js.map +1 -1
- package/src/plugins/flexlend/depositsFetcher.js +4 -8
- package/src/plugins/flexlend/depositsFetcher.js.map +1 -1
- package/src/plugins/jupiter/index.js +2 -0
- package/src/plugins/jupiter/index.js.map +1 -1
- package/src/plugins/jupiter/testFetcher.d.ts +3 -0
- package/src/plugins/jupiter/testFetcher.js +77 -0
- package/src/plugins/jupiter/testFetcher.js.map +1 -0
- package/src/plugins/solend/obligationsFetcher.js +10 -1
- package/src/plugins/solend/obligationsFetcher.js.map +1 -1
- 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/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.136",
|
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.136"
|
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;
|
@@ -22,6 +22,8 @@ const helpers_1 = require("./helpers");
|
|
22
22
|
const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
23
23
|
const client = (0, clients_1.getClientSolana)();
|
24
24
|
const stakeAccounts = yield (0, solana_1.getParsedMultipleAccountsInfo)(client, structs_1.flpStakeStruct, (0, helpers_1.getPdas)(owner));
|
25
|
+
if (!stakeAccounts.some((account) => account !== null))
|
26
|
+
return [];
|
25
27
|
const pools = stakeAccounts.map((stakeAccount) => stakeAccount ? stakeAccount.pool.toString() : '');
|
26
28
|
const flpMints = yield cache.getItems(pools, {
|
27
29
|
prefix: constants_1.platformId,
|
@@ -36,36 +38,40 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
36
38
|
if (flpMint && stakeAccount)
|
37
39
|
flpMintById.set(stakeAccount.pubkey.toString(), flpMint[0]);
|
38
40
|
}
|
39
|
-
const tokenPrices = yield cache.getTokenPrices(Array.from(flpMintById.values()), portfolio_core_1.NetworkId.solana);
|
40
|
-
const
|
41
|
+
const tokenPrices = yield cache.getTokenPrices([...Array.from(flpMintById.values()), solana_1.usdcSolanaMint], portfolio_core_1.NetworkId.solana);
|
42
|
+
const usdcTokenPrice = tokenPrices[tokenPrices.length - 1];
|
43
|
+
const elements = [];
|
41
44
|
for (let j = 0; j < stakeAccounts.length; j++) {
|
45
|
+
const assets = [];
|
42
46
|
const stakeAccount = stakeAccounts[j];
|
43
47
|
if (!stakeAccount)
|
44
48
|
continue;
|
45
49
|
const flpTokenPrice = tokenPrices[j];
|
46
|
-
if (!flpTokenPrice)
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
.
|
51
|
-
|
52
|
-
|
53
|
-
|
50
|
+
if (!stakeAccount.stakeStats.activeAmount.isZero() && flpTokenPrice) {
|
51
|
+
const amount = stakeAccount.stakeStats.activeAmount
|
52
|
+
.plus(stakeAccount.stakeStats.pendingActivation)
|
53
|
+
.dividedBy(Math.pow(10, flpTokenPrice.decimals));
|
54
|
+
assets.push((0, tokenPriceToAssetToken_1.default)(flpTokenPrice.address, amount.toNumber(), portfolio_core_1.NetworkId.solana, flpTokenPrice));
|
55
|
+
}
|
56
|
+
if (!stakeAccount.unclaimedRewards.isZero()) {
|
57
|
+
const unclaimedAmount = stakeAccount.unclaimedRewards
|
58
|
+
.times(stakeAccount.feeShareBps)
|
59
|
+
.dividedBy(Math.pow(10, 10));
|
60
|
+
assets.push(Object.assign(Object.assign({}, (0, tokenPriceToAssetToken_1.default)(solana_1.usdcSolanaMint, unclaimedAmount.toNumber(), portfolio_core_1.NetworkId.solana, usdcTokenPrice)), { attributes: { isClaimable: true } }));
|
61
|
+
}
|
62
|
+
if (assets.length !== 0)
|
63
|
+
elements.push({
|
64
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
65
|
+
label: 'Staked',
|
66
|
+
platformId: constants_1.platformId,
|
67
|
+
type: portfolio_core_1.PortfolioElementType.multiple,
|
68
|
+
value: (0, portfolio_core_1.getUsdValueSum)(assets.map((asset) => asset.value)),
|
69
|
+
data: {
|
70
|
+
assets,
|
71
|
+
},
|
72
|
+
});
|
54
73
|
}
|
55
|
-
|
56
|
-
return [];
|
57
|
-
return [
|
58
|
-
{
|
59
|
-
networkId: portfolio_core_1.NetworkId.solana,
|
60
|
-
label: 'Staked',
|
61
|
-
platformId: constants_1.platformId,
|
62
|
-
type: portfolio_core_1.PortfolioElementType.multiple,
|
63
|
-
value: (0, portfolio_core_1.getUsdValueSum)(assets.map((asset) => asset.value)),
|
64
|
-
data: {
|
65
|
-
assets,
|
66
|
-
},
|
67
|
-
},
|
68
|
-
];
|
74
|
+
return elements;
|
69
75
|
});
|
70
76
|
const fetcher = {
|
71
77
|
id: `${constants_1.platformId}-stake`,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"stakeFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/flash/stakeFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+
|
1
|
+
{"version":3,"file":"stakeFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/flash/stakeFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAMoC;AAGpC,2CAAyC;AACzC,iDAAsD;AACtD,+CAG4B;AAC5B,uCAA2C;AAC3C,qGAA6E;AAC7E,uCAAoC;AAEpC,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EA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AAU,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,IACjC,CAAC;QACL,CAAC;QAED,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;YACrB,QAAQ,CAAC,IAAI,CAAC;gBACZ,SAAS,EAAE,0BAAS,CAAC,MAAM;gBAC3B,KAAK,EAAE,QAAQ;gBACf,UAAU,EAAV,sBAAU;gBACV,IAAI,EAAE,qCAAoB,CAAC,QAAQ;gBACnC,KAAK,EAAE,IAAA,+BAAc,EAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;gBACzD,IAAI,EAAE;oBACJ,MAAM;iBACP;aACF,CAAC,CAAC;IACP,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,QAAQ;IACzB,SAAS,EAAE,0BAAS,CAAC,MAAM;IAC3B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|
@@ -16,19 +16,15 @@ 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");
|
23
19
|
const constants_2 = require("../tokens/constants");
|
24
20
|
const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
25
21
|
const pda = (0, helpers_1.getDerivedAccount)(owner);
|
26
22
|
const portfolioElements = (yield Promise.all([
|
27
|
-
|
23
|
+
// marginfiDepositsFetchers[0].executor(pda, cache),
|
28
24
|
obligationsFetcher_1.default.executor(pda, cache),
|
29
|
-
|
30
|
-
|
31
|
-
|
25
|
+
// driftDepositsFetcher.executor(pda, cache),
|
26
|
+
// kaminoLendDepositFetcher.executor(pda, cache),
|
27
|
+
// mangoDepositFetcher.executor(pda, cache),
|
32
28
|
])).flat();
|
33
29
|
if (portfolioElements.length === 0)
|
34
30
|
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/flexlend/depositsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAAyE;AAGzE,2CAAyC;AACzC,uCAA8C;AAC9C,sFAAiE;AAKjE,mDAA2D;AAE3D,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,GAAG,GAAG,IAAA,2BAAiB,EAAC,KAAK,CAAC,CAAC;IAErC,MAAM,iBAAiB,GAAG,CACxB,MAAM,OAAO,CAAC,GAAG,CAAC;QAChB,oDAAoD;QACpD,4BAAqB,CAAC,QAAQ,CAAC,GAAG,EAAE,KAAK,CAAC;QAC1C,6CAA6C;QAC7C,iDAAiD;QACjD,4CAA4C;KAC7C,CAAC,CACH,CAAC,IAAI,EAAE,CAAC;IAET,IAAI,iBAAiB,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAE9C,MAAM,QAAQ,GAAuB,EAAE,CAAC;IACxC,KAAK,MAAM,OAAO,IAAI,iBAAiB,EAAE,CAAC;QACxC,MAAM,UAAU,GAAG,OAAO,CAAC;QAC3B,UAAU,CAAC,IAAI;YACb,UAAU,CAAC,UAAU,KAAK,gCAAoB,CAAC,EAAE;gBAC/C,CAAC,CAAC,gBAAgB;gBAClB,CAAC,CAAC,UAAU,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE;oBAC/C,UAAU,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACrC,UAAU,CAAC,UAAU,GAAG,sBAAU,CAAC;QACnC,QAAQ,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"}
|
@@ -10,6 +10,7 @@ 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"));
|
13
14
|
exports.platforms = [constants_1.jupiterPlatform];
|
14
15
|
exports.jobs = [custodiesJob_1.default];
|
15
16
|
exports.fetchers = [
|
@@ -17,5 +18,6 @@ exports.fetchers = [
|
|
17
18
|
airdropFetcher_1.default,
|
18
19
|
voteFetcher_1.default,
|
19
20
|
valueAverageFetcher_1.default,
|
21
|
+
testFetcher_1.default,
|
20
22
|
];
|
21
23
|
//# 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;AACxD,gEAAiC;AAEpB,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;IACnB,qBAAI;CACL,CAAC"}
|
@@ -0,0 +1,77 @@
|
|
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 bignumber_js_1 = __importDefault(require("bignumber.js"));
|
17
|
+
const constants_1 = require("./constants");
|
18
|
+
const solana_1 = require("../../utils/solana");
|
19
|
+
const clients_1 = require("../../utils/clients");
|
20
|
+
const vote_1 = require("./structs/vote");
|
21
|
+
const filters_1 = require("../../utils/solana/filters");
|
22
|
+
const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
23
|
+
const client = (0, clients_1.getClientSolana)();
|
24
|
+
const escrowAccount = yield (0, solana_1.getParsedProgramAccounts)(client, vote_1.escrowStruct, constants_1.voteProgramId, (0, filters_1.dataSizeFilter)(322));
|
25
|
+
if (!escrowAccount)
|
26
|
+
return [];
|
27
|
+
const jupTokenPrice = yield cache.getTokenPrice(constants_1.jupMint, portfolio_core_1.NetworkId.solana);
|
28
|
+
if (!jupTokenPrice)
|
29
|
+
return [];
|
30
|
+
const { decimals } = jupTokenPrice;
|
31
|
+
let lockedWithoutWithdraw = 0;
|
32
|
+
const unlockEachDay = [];
|
33
|
+
for (const account of escrowAccount) {
|
34
|
+
const amount = account.amount.dividedBy(Math.pow(10, decimals)).toNumber();
|
35
|
+
if (!account.escrowStartedAt.isZero()) {
|
36
|
+
const unlockingAt = new Date(account.escrowEndsAt.times(1000).toNumber());
|
37
|
+
const daysUntilUnlock = new bignumber_js_1.default(unlockingAt.getTime() - Date.now())
|
38
|
+
.dividedBy(1000 * 60 * 60 * 24)
|
39
|
+
.decimalPlaces(0, bignumber_js_1.default.ROUND_DOWN)
|
40
|
+
.toNumber();
|
41
|
+
if (unlockEachDay[daysUntilUnlock]) {
|
42
|
+
unlockEachDay[daysUntilUnlock] += amount;
|
43
|
+
}
|
44
|
+
else {
|
45
|
+
unlockEachDay[daysUntilUnlock] = amount;
|
46
|
+
}
|
47
|
+
}
|
48
|
+
else {
|
49
|
+
lockedWithoutWithdraw += amount;
|
50
|
+
}
|
51
|
+
}
|
52
|
+
const unlockingAmount = unlockEachDay.reduce((amount, sum) => amount + sum);
|
53
|
+
const total = unlockingAmount + lockedWithoutWithdraw;
|
54
|
+
console.log('Amount Total : ', total);
|
55
|
+
console.log(`Amount Locked : ${lockedWithoutWithdraw}(${(lockedWithoutWithdraw / total) * 100}%)`);
|
56
|
+
console.log(`Amount unlocking :${unlockingAmount}(${(unlockingAmount / total) * 100}%)`);
|
57
|
+
for (let i = 0; i < unlockEachDay.length; i++) {
|
58
|
+
const unlocking = unlockEachDay[i];
|
59
|
+
if (!unlocking)
|
60
|
+
continue;
|
61
|
+
const value = unlocking * jupTokenPrice.price;
|
62
|
+
const percent = new bignumber_js_1.default(unlocking / total)
|
63
|
+
.times(100)
|
64
|
+
.decimalPlaces(2, bignumber_js_1.default.ROUND_DOWN)
|
65
|
+
.toNumber();
|
66
|
+
console.log(`Unlock in ${i} days : ${percent}% (${unlocking} JUP/ ${value}$) `);
|
67
|
+
}
|
68
|
+
const elements = [];
|
69
|
+
return elements;
|
70
|
+
});
|
71
|
+
const fetcher = {
|
72
|
+
id: `${constants_1.platformId}-test`,
|
73
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
74
|
+
executor,
|
75
|
+
};
|
76
|
+
exports.default = fetcher;
|
77
|
+
//# sourceMappingURL=testFetcher.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"testFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/jupiter/testFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAAyE;AACzE,gEAAqC;AAGrC,2CAAiE;AACjE,+CAA8D;AAC9D,iDAAsD;AACtD,yCAA8C;AAC9C,wDAA4D;AAE5D,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,MAAM,GAAG,IAAA,yBAAe,GAAE,CAAC;IACjC,MAAM,aAAa,GAAG,MAAM,IAAA,iCAAwB,EAClD,MAAM,EACN,mBAAY,EACZ,yBAAa,EACb,IAAA,wBAAc,EAAC,GAAG,CAAC,CACpB,CAAC;IAEF,IAAI,CAAC,aAAa;QAAE,OAAO,EAAE,CAAC;IAE9B,MAAM,aAAa,GAAG,MAAM,KAAK,CAAC,aAAa,CAAC,mBAAO,EAAE,0BAAS,CAAC,MAAM,CAAC,CAAC;IAC3E,IAAI,CAAC,aAAa;QAAE,OAAO,EAAE,CAAC;IAC9B,MAAM,EAAE,QAAQ,EAAE,GAAG,aAAa,CAAC;IAEnC,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AAC,qBAAqB,GAAG,KAAK,CAAC,GAAG,GACpC,IAAI,CACL,CAAC;IACF,OAAO,CAAC,GAAG,CACT,qBAAqB,eAAe,IAAI,CAAC,eAAe,GAAG,KAAK,CAAC,GAAG,GAAG,IAAI,CAC5E,CAAC;IACF,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,aAAa,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QAC9C,MAAM,SAAS,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC;QACnC,IAAI,CAAC,SAAS;YAAE,SAAS;QAEzB,MAAM,KAAK,GAAG,SAAS,GAAG,aAAa,CAAC,KAAK,CAAC;QAC9C,MAAM,OAAO,GAAG,IAAI,sBAAS,CAAC,SAAS,GAAG,KAAK,CAAC;aAC7C,KAAK,CAAC,GAAG,CAAC;aACV,aAAa,CAAC,CAAC,EAAE,sBAAS,CAAC,UAAU,CAAC;aACtC,QAAQ,EAAE,CAAC;QACd,OAAO,CAAC,GAAG,CACT,aAAa,CAAC,WAAW,OAAO,MAAM,SAAS,SAAS,KAAK,KAAK,CACnE,CAAC;IACJ,CAAC;IAED,MAAM,QAAQ,GAAuB,EAAE,CAAC;IACxC,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,OAAO;IACxB,SAAS,EAAE,0BAAS,CAAC,MAAM;IAC3B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|
@@ -35,9 +35,12 @@ 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
|
-
|
38
|
+
if (market)
|
39
|
+
marketsByAddress.set(market.address.toString(), market);
|
39
40
|
});
|
40
41
|
for (const marketInfo of markets) {
|
42
|
+
if (!marketInfo)
|
43
|
+
continue;
|
41
44
|
const seeds = [
|
42
45
|
(0, helpers_1.getObligationSeed)(marketInfo.address, 0),
|
43
46
|
(0, helpers_1.getObligationSeed)(marketInfo.address, 1),
|
@@ -49,12 +52,18 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
49
52
|
obligationAddresses.push(obligationAddress);
|
50
53
|
}
|
51
54
|
}
|
55
|
+
console.log('constexecutor:FetcherExecutor= ~ owner:', owner);
|
52
56
|
// Flexlend, only support the main pool on Solend
|
57
|
+
// mainMarket = 4UpD2fh7xH3VP9QQaXtsS1YY3bxzWhtfpks7FatyKvdY
|
53
58
|
const marketSeed = constants_1.mainMarket.slice(0, 16);
|
59
|
+
// owner = 5MBMRrJcAFmkQ39iSB3v6U8ifz4HqizS32voDrmSC6nu
|
54
60
|
const ownerSeed = owner.slice(0, 16);
|
55
61
|
const obligationSeed = ownerSeed + marketSeed;
|
62
|
+
// AUTOMATION PUBLIC KEY = 8PWR75ppAGonv9dXStjficjXmdsuDKmDoVNcy4oYhAMs
|
56
63
|
const oldFlexlendObligAddress = yield web3_js_1.PublicKey.createWithSeed(constants_2.AUTOMATION_PUBLIC_KEY, obligationSeed, constants_1.pid);
|
64
|
+
// -> gives : 3UHaFeLkzaHn1Rnks1p8s1xJdwHqMzD4JazWZH4PkzJ9 (correct)
|
57
65
|
const newFlexlendObligAddress = yield web3_js_1.PublicKey.createWithSeed(new web3_js_1.PublicKey(owner), obligationSeed, constants_1.pid);
|
66
|
+
// -> gives : AnwJKJf4YYKqYz6QBDbf1GhUFhPCExGAH4tNGjKXMBtP (inccorect)
|
58
67
|
obligationAddresses.push(...[oldFlexlendObligAddress, newFlexlendObligAddress]);
|
59
68
|
const obligations = yield (0, solana_1.getParsedMultipleAccountsInfo)(client, structs_1.obligationStruct, obligationAddresses);
|
60
69
|
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,gBAAgB,CAAC,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,MAAM,CAAC,CAAC;
|
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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ErB,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;
|
@@ -40,28 +40,28 @@ function getPairKey(version) {
|
|
40
40
|
exports.getPairKey = getPairKey;
|
41
41
|
function getPairsV2FromTheGraph(url, length = 300) {
|
42
42
|
return __awaiter(this, void 0, void 0, function* () {
|
43
|
-
const query = (0, graphql_request_1.gql) `
|
44
|
-
{
|
45
|
-
pairs(
|
46
|
-
orderBy: reserveUSD
|
47
|
-
first: ${length}
|
48
|
-
orderDirection: desc
|
49
|
-
where: { trackedReserveETH_not: "0" }
|
50
|
-
) {
|
51
|
-
id
|
52
|
-
reserve0
|
53
|
-
reserve1
|
54
|
-
totalSupply
|
55
|
-
token0 {
|
56
|
-
id
|
57
|
-
decimals
|
58
|
-
}
|
59
|
-
token1 {
|
60
|
-
id
|
61
|
-
decimals
|
62
|
-
}
|
63
|
-
}
|
64
|
-
}
|
43
|
+
const query = (0, graphql_request_1.gql) `
|
44
|
+
{
|
45
|
+
pairs(
|
46
|
+
orderBy: reserveUSD
|
47
|
+
first: ${length}
|
48
|
+
orderDirection: desc
|
49
|
+
where: { trackedReserveETH_not: "0" }
|
50
|
+
) {
|
51
|
+
id
|
52
|
+
reserve0
|
53
|
+
reserve1
|
54
|
+
totalSupply
|
55
|
+
token0 {
|
56
|
+
id
|
57
|
+
decimals
|
58
|
+
}
|
59
|
+
token1 {
|
60
|
+
id
|
61
|
+
decimals
|
62
|
+
}
|
63
|
+
}
|
64
|
+
}
|
65
65
|
`;
|
66
66
|
const res = yield (0, graphql_request_1.default)(url, query);
|
67
67
|
const pairs = res.pairs;
|
@@ -1,16 +1,16 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.poolQueryMsg = exports.minterQueryMsg = exports.tokenInfoQueryMsg = exports.infoQueryMsg = void 0;
|
4
|
-
exports.infoQueryMsg = JSON.parse(`{
|
5
|
-
"info": {}
|
4
|
+
exports.infoQueryMsg = JSON.parse(`{
|
5
|
+
"info": {}
|
6
6
|
}`);
|
7
|
-
exports.tokenInfoQueryMsg = JSON.parse(`{
|
8
|
-
"token_info": {}
|
7
|
+
exports.tokenInfoQueryMsg = JSON.parse(`{
|
8
|
+
"token_info": {}
|
9
9
|
}`);
|
10
|
-
exports.minterQueryMsg = JSON.parse(`{
|
11
|
-
"minter": {}
|
10
|
+
exports.minterQueryMsg = JSON.parse(`{
|
11
|
+
"minter": {}
|
12
12
|
}`);
|
13
|
-
exports.poolQueryMsg = JSON.parse(`{
|
14
|
-
"pool": {}
|
13
|
+
exports.poolQueryMsg = JSON.parse(`{
|
14
|
+
"pool": {}
|
15
15
|
}`);
|
16
16
|
//# sourceMappingURL=constants.js.map
|
@@ -1,10 +1,10 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
function getQueryBalanceByOwner(owner) {
|
4
|
-
return JSON.parse(`{
|
5
|
-
"balance": {
|
6
|
-
"address": "${owner}"
|
7
|
-
}
|
4
|
+
return JSON.parse(`{
|
5
|
+
"balance": {
|
6
|
+
"address": "${owner}"
|
7
|
+
}
|
8
8
|
}`);
|
9
9
|
}
|
10
10
|
exports.default = getQueryBalanceByOwner;
|