@sonarwatch/portfolio-plugins 0.12.110 → 0.12.111
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +2152 -2148
- package/README.md +3 -3
- package/package.json +1 -1
- package/src/plugins/balancer/helpers/pools.js +21 -21
- package/src/plugins/save/constants.d.ts +5 -3
- package/src/plugins/save/constants.js +6 -4
- package/src/plugins/save/constants.js.map +1 -1
- package/src/plugins/save/index.js +2 -1
- package/src/plugins/save/index.js.map +1 -1
- package/src/plugins/save/rewardStatsJob.d.ts +3 -0
- package/src/plugins/save/rewardStatsJob.js +31 -0
- package/src/plugins/save/rewardStatsJob.js.map +1 -0
- package/src/plugins/save/rewardsFetcher.js +96 -54
- package/src/plugins/save/rewardsFetcher.js.map +1 -1
- package/src/plugins/save/structs.d.ts +12 -0
- package/src/plugins/save/structs.js +12 -1
- package/src/plugins/save/structs.js.map +1 -1
- package/src/plugins/save/types.d.ts +46 -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/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
@@ -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;
|
@@ -3,14 +3,16 @@ import { Platform } from '@sonarwatch/portfolio-core';
|
|
3
3
|
export declare const platformId = "save";
|
4
4
|
export declare const platform: Platform;
|
5
5
|
export declare const marketsPrefix = "save-markets";
|
6
|
-
export declare const reservesPrefix = "save-reserves";
|
7
6
|
export declare const marketsKey = "markets";
|
7
|
+
export declare const reservesPrefix = "save-reserves";
|
8
|
+
export declare const rewardStatsPrefix = "save-reward-stats";
|
9
|
+
export declare const rewardStatsKey = "reward-stats";
|
8
10
|
export declare const pid: PublicKey;
|
9
11
|
export declare const merkleProgramId: PublicKey;
|
10
12
|
export declare const marketsEndpoint = "https://api.solend.fi/v1/markets/configs";
|
11
13
|
export declare const reserveEndpoint = "https://api.solend.fi/v1/reserves/?ids=";
|
12
14
|
export declare const wadsDecimal = 18;
|
13
15
|
export declare const mainMarket = "4UpD2fh7xH3VP9QQaXtsS1YY3bxzWhtfpks7FatyKvdY";
|
14
|
-
export declare const
|
15
|
-
export declare const
|
16
|
+
export declare const rewardProofsEndpoint = "https://api.save.finance/liquidity-mining/reward-proofs?obligation=";
|
17
|
+
export declare const externalRewardStatsEndpoint = "https://api.save.finance/liquidity-mining/external-reward-stats-v2?flat=true";
|
16
18
|
export declare const slndMint = "SLNDpmoWTVADgEdndyvWzroNL7zSi1dF9PC3xHGtPwp";
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.slndMint = exports.
|
3
|
+
exports.slndMint = exports.externalRewardStatsEndpoint = exports.rewardProofsEndpoint = exports.mainMarket = exports.wadsDecimal = exports.reserveEndpoint = exports.marketsEndpoint = exports.merkleProgramId = exports.pid = exports.rewardStatsKey = exports.rewardStatsPrefix = exports.reservesPrefix = exports.marketsKey = exports.marketsPrefix = exports.platform = exports.platformId = void 0;
|
4
4
|
const web3_js_1 = require("@solana/web3.js");
|
5
5
|
exports.platformId = 'save';
|
6
6
|
exports.platform = {
|
@@ -11,15 +11,17 @@ exports.platform = {
|
|
11
11
|
website: 'https://save.finance/',
|
12
12
|
};
|
13
13
|
exports.marketsPrefix = `${exports.platformId}-markets`;
|
14
|
-
exports.reservesPrefix = `${exports.platformId}-reserves`;
|
15
14
|
exports.marketsKey = 'markets';
|
15
|
+
exports.reservesPrefix = `${exports.platformId}-reserves`;
|
16
|
+
exports.rewardStatsPrefix = `${exports.platformId}-reward-stats`;
|
17
|
+
exports.rewardStatsKey = 'reward-stats';
|
16
18
|
exports.pid = new web3_js_1.PublicKey('So1endDq2YkqhipRh3WViPa8hdiSpxWy6z3Z6tMCpAo');
|
17
19
|
exports.merkleProgramId = new web3_js_1.PublicKey('mrksLcZ6rMs9xkmJgw6oKiR3GECw44Gb5NeDqu64kiw');
|
18
20
|
exports.marketsEndpoint = 'https://api.solend.fi/v1/markets/configs';
|
19
21
|
exports.reserveEndpoint = 'https://api.solend.fi/v1/reserves/?ids=';
|
20
22
|
exports.wadsDecimal = 18;
|
21
23
|
exports.mainMarket = '4UpD2fh7xH3VP9QQaXtsS1YY3bxzWhtfpks7FatyKvdY';
|
22
|
-
exports.
|
23
|
-
exports.
|
24
|
+
exports.rewardProofsEndpoint = 'https://api.save.finance/liquidity-mining/reward-proofs?obligation=';
|
25
|
+
exports.externalRewardStatsEndpoint = 'https://api.save.finance/liquidity-mining/external-reward-stats-v2?flat=true';
|
24
26
|
exports.slndMint = 'SLNDpmoWTVADgEdndyvWzroNL7zSi1dF9PC3xHGtPwp';
|
25
27
|
//# sourceMappingURL=constants.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/save/constants.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAG/B,QAAA,UAAU,GAAG,MAAM,CAAC;AACpB,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,6CAA6C;IACpD,WAAW,EAAE,MAAM;IACnB,OAAO,EAAE,uBAAuB;CACjC,CAAC;AACW,QAAA,aAAa,GAAG,GAAG,kBAAU,UAAU,CAAC;AACxC,QAAA,cAAc,GAAG,GAAG,kBAAU,WAAW,CAAC;AAC1C,QAAA,
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/save/constants.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAG/B,QAAA,UAAU,GAAG,MAAM,CAAC;AACpB,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,6CAA6C;IACpD,WAAW,EAAE,MAAM;IACnB,OAAO,EAAE,uBAAuB;CACjC,CAAC;AACW,QAAA,aAAa,GAAG,GAAG,kBAAU,UAAU,CAAC;AACxC,QAAA,UAAU,GAAG,SAAS,CAAC;AACvB,QAAA,cAAc,GAAG,GAAG,kBAAU,WAAW,CAAC;AAC1C,QAAA,iBAAiB,GAAG,GAAG,kBAAU,eAAe,CAAC;AACjD,QAAA,cAAc,GAAG,cAAc,CAAC;AAEhC,QAAA,GAAG,GAAG,IAAI,mBAAS,CAAC,6CAA6C,CAAC,CAAC;AACnE,QAAA,eAAe,GAAG,IAAI,mBAAS,CAC1C,6CAA6C,CAC9C,CAAC;AACW,QAAA,eAAe,GAAG,0CAA0C,CAAC;AAC7D,QAAA,eAAe,GAAG,yCAAyC,CAAC;AAC5D,QAAA,WAAW,GAAG,EAAE,CAAC;AACjB,QAAA,UAAU,GAAG,8CAA8C,CAAC;AAC5D,QAAA,oBAAoB,GAC/B,qEAAqE,CAAC;AAC3D,QAAA,2BAA2B,GACtC,8EAA8E,CAAC;AAEpE,QAAA,QAAQ,GAAG,6CAA6C,CAAC"}
|
@@ -9,7 +9,8 @@ const marketsJob_1 = __importDefault(require("./marketsJob"));
|
|
9
9
|
const obligationsFetcher_1 = __importDefault(require("./obligationsFetcher"));
|
10
10
|
const constants_1 = require("./constants");
|
11
11
|
const rewardsFetcher_1 = __importDefault(require("./rewardsFetcher"));
|
12
|
+
const rewardStatsJob_1 = __importDefault(require("./rewardStatsJob"));
|
12
13
|
exports.platforms = [constants_1.platform];
|
13
|
-
exports.jobs = [marketsJob_1.default, reservesJob_1.default];
|
14
|
+
exports.jobs = [marketsJob_1.default, reservesJob_1.default, rewardStatsJob_1.default];
|
14
15
|
exports.fetchers = [obligationsFetcher_1.default, rewardsFetcher_1.default];
|
15
16
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/save/index.ts"],"names":[],"mappings":";;;;;;AAGA,gEAAwC;AACxC,8DAAsC;AACtC,8EAAqD;AACrD,2CAAuC;AACvC,sEAA8C;AAEjC,QAAA,SAAS,GAAe,CAAC,oBAAQ,CAAC,CAAC;AACnC,QAAA,IAAI,GAAU,CAAC,oBAAU,EAAE,qBAAW,CAAC,CAAC;
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/save/index.ts"],"names":[],"mappings":";;;;;;AAGA,gEAAwC;AACxC,8DAAsC;AACtC,8EAAqD;AACrD,2CAAuC;AACvC,sEAA8C;AAC9C,sEAA8C;AAEjC,QAAA,SAAS,GAAe,CAAC,oBAAQ,CAAC,CAAC;AACnC,QAAA,IAAI,GAAU,CAAC,oBAAU,EAAE,qBAAW,EAAE,wBAAc,CAAC,CAAC;AACxD,QAAA,QAAQ,GAAc,CAAC,4BAAiB,EAAE,wBAAc,CAAC,CAAC"}
|
@@ -0,0 +1,31 @@
|
|
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 axios_1 = __importDefault(require("axios"));
|
16
|
+
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
17
|
+
const constants_1 = require("./constants");
|
18
|
+
const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
19
|
+
const rewardStatsRes = yield axios_1.default.get(constants_1.externalRewardStatsEndpoint);
|
20
|
+
yield cache.setItem(constants_1.rewardStatsKey, rewardStatsRes.data, {
|
21
|
+
prefix: constants_1.rewardStatsPrefix,
|
22
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
23
|
+
});
|
24
|
+
});
|
25
|
+
const job = {
|
26
|
+
id: `${constants_1.platformId}-reward-stats`,
|
27
|
+
executor,
|
28
|
+
label: 'normal',
|
29
|
+
};
|
30
|
+
exports.default = job;
|
31
|
+
//# sourceMappingURL=rewardStatsJob.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"rewardStatsJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/save/rewardStatsJob.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,+DAAuD;AACvD,2CAKqB;AAKrB,MAAM,QAAQ,GAAgB,CAAO,KAAY,EAAE,EAAE;IACnD,MAAM,cAAc,GAAG,MAAM,eAAK,CAAC,GAAG,CACpC,uCAA2B,CAC5B,CAAC;IAEF,MAAM,KAAK,CAAC,OAAO,CAAC,0BAAc,EAAE,cAAc,CAAC,IAAI,EAAE;QACvD,MAAM,EAAE,6BAAiB;QACzB,SAAS,EAAE,0BAAS,CAAC,MAAM;KAC5B,CAAC,CAAC;AACL,CAAC,CAAA,CAAC;AAEF,MAAM,GAAG,GAAQ;IACf,EAAE,EAAE,GAAG,sBAAU,eAAe;IAChC,QAAQ;IACR,KAAK,EAAE,QAAQ;CAChB,CAAC;AACF,kBAAe,GAAG,CAAC"}
|
@@ -14,77 +14,119 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
15
15
|
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
16
16
|
const axios_1 = __importDefault(require("axios"));
|
17
|
-
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
18
17
|
const web3_js_1 = require("@solana/web3.js");
|
19
18
|
const bn_js_1 = require("bn.js");
|
19
|
+
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
20
20
|
const constants_1 = require("./constants");
|
21
|
-
const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetToken"));
|
22
21
|
const solana_1 = require("../../utils/solana");
|
23
22
|
const clients_1 = require("../../utils/clients");
|
24
23
|
const structs_1 = require("./structs");
|
25
|
-
const
|
26
|
-
|
24
|
+
const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetToken"));
|
25
|
+
const getClaimData = (owner) => __awaiter(void 0, void 0, void 0, function* () {
|
27
26
|
const obligationAddress = yield web3_js_1.PublicKey.createWithSeed(new web3_js_1.PublicKey(owner), '4UpD2fh7xH3VP9QQaXtsS1YY3bxzWhtf', constants_1.pid);
|
28
|
-
const
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
const
|
33
|
-
const slndRewards = rewards.filter((reward) => reward.incentivizer === 'slnd_points' &&
|
34
|
-
reward.quantity &&
|
35
|
-
reward.quantity !== '0');
|
36
|
-
const claimAndBumps = slndRewards.map((d) => web3_js_1.PublicKey.findProgramAddressSync([
|
27
|
+
const rewardProofsRes = yield axios_1.default.get(constants_1.rewardProofsEndpoint + obligationAddress.toString());
|
28
|
+
return rewardProofsRes.data.map((d) => (Object.assign(Object.assign({}, d), { distributorPublicKey: new web3_js_1.PublicKey(d.distributorPublicKey) })));
|
29
|
+
});
|
30
|
+
const getRewardData = (client, claimData) => __awaiter(void 0, void 0, void 0, function* () {
|
31
|
+
const claimAndBumps = claimData.map((d) => web3_js_1.PublicKey.findProgramAddressSync([
|
37
32
|
Buffer.from('ClaimStatus', 'utf8'),
|
38
|
-
new bn_js_1.BN.BN(d.index).toArrayLike(Buffer, 'le', 8),
|
39
|
-
|
40
|
-
], new web3_js_1.PublicKey(constants_1.merkleProgramId))
|
41
|
-
const
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
33
|
+
new bn_js_1.BN.BN.BN(d.index).toArrayLike(Buffer, 'le', 8),
|
34
|
+
d.distributorPublicKey.toBytes(),
|
35
|
+
], new web3_js_1.PublicKey(constants_1.merkleProgramId)));
|
36
|
+
const [merkleDistributors, claimStatuses] = yield Promise.all([
|
37
|
+
(0, solana_1.getParsedMultipleAccountsInfo)(client, structs_1.merkleDistributorStruct, claimData.map((d) => d.distributorPublicKey)),
|
38
|
+
(0, solana_1.getParsedMultipleAccountsInfo)(client, structs_1.claimStatusStruct, claimAndBumps.map((candb) => candb[0])),
|
39
|
+
]);
|
40
|
+
const fullData = (yield Promise.all(claimData.map((d, index) => __awaiter(void 0, void 0, void 0, function* () {
|
41
|
+
const merkleDistributor = merkleDistributors[index];
|
42
|
+
const claimAndBump = claimAndBumps[index];
|
43
|
+
const claimStatus = claimStatuses[index];
|
44
|
+
if (!merkleDistributor || !claimAndBump)
|
45
|
+
return null;
|
46
|
+
const [distributorATAPublicKey] = web3_js_1.PublicKey.findProgramAddressSync([
|
47
|
+
d.distributorPublicKey.toBuffer(),
|
48
|
+
new web3_js_1.PublicKey(solana_1.solanaTokenPid).toBuffer(),
|
49
|
+
merkleDistributor.mint.toBuffer(),
|
50
|
+
], solana_1.associatedTokenProgramId);
|
51
|
+
const accountFunded = (yield client.getTokenAccountBalance(distributorATAPublicKey)).value
|
52
|
+
.amount !== '0';
|
53
|
+
return Object.assign(Object.assign({}, d), { accountFunded, claimId: claimAndBump[0], claimStatusBump: claimAndBump[1], claimed: Boolean(claimStatus === null || claimStatus === void 0 ? void 0 : claimStatus.isClaimed), claimedAt: claimStatus ? Number(claimStatus.claimedAt) : 0, distributor: merkleDistributor, distributorATAPublicKey });
|
54
|
+
})))).filter((d) => d !== null);
|
55
|
+
const slndRewards = fullData.filter((d) => ['slnd_options', 'slnd'].includes(d.incentivizer));
|
56
|
+
return {
|
57
|
+
pythPointsRewards: fullData.filter((c) => c.incentivizer === 'pyth_points'),
|
58
|
+
slndPointsRewards: fullData.filter((c) => c.incentivizer === 'slnd_points'),
|
59
|
+
slnd: slndRewards,
|
60
|
+
external: fullData
|
61
|
+
.filter((d) => !['slnd_options', 'slnd', 'pyth_points', 'slnd_points'].includes(d.incentivizer))
|
62
|
+
.reduce((acc, currentValue) => {
|
63
|
+
if (!acc[currentValue.distributor.mint.toString()]) {
|
64
|
+
acc[currentValue.distributor.mint.toString()] = [];
|
65
|
+
}
|
66
|
+
acc[currentValue.distributor.mint.toString()].push(currentValue);
|
67
|
+
return acc;
|
68
|
+
}, {}),
|
69
|
+
};
|
70
|
+
});
|
71
|
+
const getRewards = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
72
|
+
const claimData = yield getClaimData(owner);
|
73
|
+
if (claimData.length === 0)
|
50
74
|
return [];
|
51
|
-
const
|
52
|
-
|
53
|
-
(
|
75
|
+
const client = (0, clients_1.getClientSolana)();
|
76
|
+
const [rewardData, rewardStats] = yield Promise.all([
|
77
|
+
getRewardData(client, claimData),
|
78
|
+
cache.getItem(constants_1.rewardStatsKey, {
|
79
|
+
prefix: constants_1.rewardStatsPrefix,
|
80
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
81
|
+
}),
|
54
82
|
]);
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
83
|
+
if (!rewardStats || rewardStats.length === 0)
|
84
|
+
return [];
|
85
|
+
const rewardsSummary = [
|
86
|
+
...new Set(rewardStats.map((rew) => rew.rewardMint)),
|
87
|
+
].map((rewardMint) => {
|
88
|
+
var _a, _b;
|
89
|
+
const claims = (_b = (_a = rewardData === null || rewardData === void 0 ? void 0 : rewardData.external) === null || _a === void 0 ? void 0 : _a[rewardMint]) !== null && _b !== void 0 ? _b : [];
|
90
|
+
const unclaimed = claims.filter((cd) => !cd.claimed && cd.accountFunded);
|
91
|
+
const totalUnclaimed = unclaimed.reduce((sum, lot) => new bignumber_js_1.default(lot.quantity).plus(sum), new bignumber_js_1.default(0));
|
92
|
+
return {
|
93
|
+
rewardMint,
|
94
|
+
totalUnclaimed,
|
95
|
+
};
|
66
96
|
});
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
97
|
+
const unclaimedSlnd = rewardData === null || rewardData === void 0 ? void 0 : rewardData.slnd.filter((cd) => cd.incentivizer === 'slnd' && !cd.claimed).reduce((sum, lot) => new bignumber_js_1.default(lot.quantity).dividedBy(Math.pow(10, 6)).plus(sum), new bignumber_js_1.default(0));
|
98
|
+
rewardsSummary.push({
|
99
|
+
rewardMint: constants_1.slndMint,
|
100
|
+
totalUnclaimed: unclaimedSlnd,
|
101
|
+
});
|
102
|
+
return rewardsSummary.filter((r) => r.totalUnclaimed.isGreaterThan(0));
|
103
|
+
});
|
104
|
+
const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
105
|
+
const rewards = yield getRewards(owner, cache);
|
106
|
+
if (rewards.length === 0)
|
107
|
+
return [];
|
108
|
+
const tokenPrices = yield cache.getTokenPricesAsMap(rewards.map((r) => r.rewardMint), portfolio_core_1.NetworkId.solana);
|
109
|
+
const assets = [];
|
110
|
+
rewards.forEach((reward) => {
|
111
|
+
const tokenPrice = tokenPrices.get(reward.rewardMint);
|
71
112
|
if (!tokenPrice)
|
72
113
|
return;
|
73
|
-
assets.push(Object.assign(Object.assign({}, (0, tokenPriceToAssetToken_1.default)(tokenPrice.address,
|
114
|
+
assets.push(Object.assign(Object.assign({}, (0, tokenPriceToAssetToken_1.default)(tokenPrice.address, reward.totalUnclaimed.dividedBy(Math.pow(10, tokenPrice.decimals)).toNumber(), portfolio_core_1.NetworkId.solana, tokenPrice)), { attributes: { isClaimable: true } }));
|
74
115
|
});
|
75
116
|
if (assets.length === 0)
|
76
117
|
return [];
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
118
|
+
return [
|
119
|
+
{
|
120
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
121
|
+
label: 'Rewards',
|
122
|
+
platformId: constants_1.platformId,
|
123
|
+
type: portfolio_core_1.PortfolioElementType.multiple,
|
124
|
+
value: (0, portfolio_core_1.getUsdValueSum)(assets.map((a) => a.value)),
|
125
|
+
data: {
|
126
|
+
assets,
|
127
|
+
},
|
85
128
|
},
|
86
|
-
|
87
|
-
return [element];
|
129
|
+
];
|
88
130
|
});
|
89
131
|
const fetcher = {
|
90
132
|
id: `${constants_1.platformId}-rewards`,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"rewardsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/save/rewardsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+
|
1
|
+
{"version":3,"file":"rewardsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/save/rewardsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAKoC;AACpC,kDAA0B;AAC1B,6CAAwD;AACxD,iCAA2B;AAC3B,gEAAqC;AAGrC,2CAQqB;AAErB,+CAI4B;AAC5B,iDAAsD;AACtD,uCAKmB;AACnB,qGAA6E;AAE7E,MAAM,YAAY,GAAG,CAAO,KAAa,EAAE,EAAE;IAC3C,MAAM,iBAAiB,GAAG,MAAM,mBAAS,CAAC,cAAc,CACtD,IAAI,mBAAS,CAAC,KAAK,CAAC,EACpB,kCAAkC,EAClC,eAAG,CACJ,CAAC;IAEF,MAAM,eAAe,GAAG,MAAM,eAAK,CAAC,GAAG,CACrC,gCAAoB,GAAG,iBAAiB,CAAC,QAAQ,EAAE,CACpD,CAAC;IACF,OAAO,eAAe,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,iCAClC,CAAC,KACJ,oBAAoB,EAAE,IAAI,mBAAS,CAAC,CAAC,CAAC,oBAAoB,CAAC,IAC3D,CAAC,CAAC;AACN,CAAC,CAAA,CAAC;AAEF,MAAM,aAAa,GAAG,CAAO,MAAkB,EAAE,SAAsB,EAAE,EAAE;IACzE,MAAM,aAAa,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CACxC,mB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AAM;aACP;SACF;KACF,CAAC;AACJ,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,UAAU;IAC3B,SAAS,EAAE,0BAAS,CAAC,MAAM;IAC3B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|
@@ -93,3 +93,15 @@ export type ClaimStatus = {
|
|
93
93
|
amount: BigNumber;
|
94
94
|
};
|
95
95
|
export declare const claimStatusStruct: BeetStruct<ClaimStatus, Partial<ClaimStatus>>;
|
96
|
+
export type MerkleDistributor = {
|
97
|
+
buffer: Buffer;
|
98
|
+
base: PublicKey;
|
99
|
+
bump: number;
|
100
|
+
root: number[];
|
101
|
+
mint: PublicKey;
|
102
|
+
maxTotalClaim: BigNumber;
|
103
|
+
maxNumNodes: BigNumber;
|
104
|
+
totalAmountClaimed: BigNumber;
|
105
|
+
numNodesClaimed: BigNumber;
|
106
|
+
};
|
107
|
+
export declare const merkleDistributorStruct: BeetStruct<MerkleDistributor, Partial<MerkleDistributor>>;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.claimStatusStruct = exports.obligationLiquidityStruct = exports.obligationCollateralStruct = exports.obligationStruct = exports.reserveStruct = exports.lastUpdateStruct = exports.liquidityStruct = exports.collateralStruct = exports.reserveConfigStruct = exports.feesStruct = void 0;
|
3
|
+
exports.merkleDistributorStruct = exports.claimStatusStruct = exports.obligationLiquidityStruct = exports.obligationCollateralStruct = exports.obligationStruct = exports.reserveStruct = exports.lastUpdateStruct = exports.liquidityStruct = exports.collateralStruct = exports.reserveConfigStruct = exports.feesStruct = void 0;
|
4
4
|
const beet_1 = require("@metaplex-foundation/beet");
|
5
5
|
const beet_solana_1 = require("@metaplex-foundation/beet-solana");
|
6
6
|
const solana_1 = require("../../utils/solana");
|
@@ -85,4 +85,15 @@ exports.claimStatusStruct = new beet_1.BeetStruct([
|
|
85
85
|
['claimedAt', solana_1.i64],
|
86
86
|
['amount', solana_1.u64],
|
87
87
|
], (args) => args);
|
88
|
+
exports.merkleDistributorStruct = new beet_1.BeetStruct([
|
89
|
+
['buffer', (0, solana_1.blob)(8)],
|
90
|
+
['base', beet_solana_1.publicKey],
|
91
|
+
['bump', beet_1.u8],
|
92
|
+
['root', (0, beet_1.uniformFixedSizeArray)(beet_1.u8, 32)],
|
93
|
+
['mint', beet_solana_1.publicKey],
|
94
|
+
['maxTotalClaim', solana_1.u64],
|
95
|
+
['maxNumNodes', solana_1.u64],
|
96
|
+
['totalAmountClaimed', solana_1.u64],
|
97
|
+
['numNodesClaimed', solana_1.u64],
|
98
|
+
], (args) => args);
|
88
99
|
//# sourceMappingURL=structs.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"structs.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/save/structs.ts"],"names":[],"mappings":";;;AAAA,
|
1
|
+
{"version":3,"file":"structs.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/save/structs.ts"],"names":[],"mappings":";;;AAAA,oDAKmC;AACnC,kEAA6D;AAG7D,+CAA0D;AAQ7C,QAAA,UAAU,GAAG,IAAI,iBAAU,CACtC;IACE,CAAC,cAAc,EAAE,YAAG,CAAC;IACrB,CAAC,iBAAiB,EAAE,YAAG,CAAC;IACxB,CAAC,mBAAmB,EAAE,SAAE,CAAC;CAC1B,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAY,CACvB,CAAC;AAgBW,QAAA,mBAAmB,GAAG,IAAI,iBAAU,CAC/C;IACE,CAAC,wBAAwB,EAAE,SAAE,CAAC;IAC9B,CAAC,kBAAkB,EAAE,SAAE,CAAC;IACxB,CAAC,kBAAkB,EAAE,SAAE,CAAC;IACxB,CAAC,sBAAsB,EAAE,SAAE,CAAC;IAC5B,CAAC,eAAe,EAAE,SAAE,CAAC;IACrB,CAAC,mBAAmB,EAAE,SAAE,CAAC;IACzB,CAA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aAAI,CAAC;IAClC,CAAC,oBAAoB,EAAE,aAAI,CAAC;IAC5B,CAAC,aAAa,EAAE,aAAI,CAAC;IACrB,CAAC,SAAS,EAAE,IAAA,aAAI,EAAC,EAAE,CAAC,CAAC;CACtB,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAA2B,CACtC,CAAC;AAUW,QAAA,iBAAiB,GAAG,IAAI,iBAAU,CAC7C;IACE,CAAC,QAAQ,EAAE,IAAA,aAAI,EAAC,CAAC,CAAC,CAAC;IACnB,CAAC,WAAW,EAAE,WAAI,CAAC;IACnB,CAAC,UAAU,EAAE,uBAAS,CAAC;IACvB,CAAC,WAAW,EAAE,YAAG,CAAC;IAClB,CAAC,QAAQ,EAAE,YAAG,CAAC;CAChB,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAmB,CAC9B,CAAC;AAcW,QAAA,uBAAuB,GAAG,IAAI,iBAAU,CACnD;IACE,CAAC,QAAQ,EAAE,IAAA,aAAI,EAAC,CAAC,CAAC,CAAC;IACnB,CAAC,MAAM,EAAE,uBAAS,CAAC;IACnB,CAAC,MAAM,EAAE,SAAE,CAAC;IACZ,CAAC,MAAM,EAAE,IAAA,4BAAqB,EAAC,SAAE,EAAE,EAAE,CAAC,CAAC;IACvC,CAAC,MAAM,EAAE,uBAAS,CAAC;IACnB,CAAC,eAAe,EAAE,YAAG,CAAC;IACtB,CAAC,aAAa,EAAE,YAAG,CAAC;IACpB,CAAC,oBAAoB,EAAE,YAAG,CAAC;IAC3B,CAAC,iBAAiB,EAAE,YAAG,CAAC;CACzB,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAyB,CACpC,CAAC"}
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import { PublicKey } from '@solana/web3.js';
|
1
2
|
export interface ApiResponse<T> {
|
2
3
|
results: T[];
|
3
4
|
next: null;
|
@@ -113,6 +114,24 @@ export type ExternalReward = {
|
|
113
114
|
lastSlot: number;
|
114
115
|
lastTx: 'string';
|
115
116
|
};
|
117
|
+
export type RewardStat = {
|
118
|
+
incentivizer: string;
|
119
|
+
lastSlot: number;
|
120
|
+
market: string;
|
121
|
+
mint: string;
|
122
|
+
reserveID: string;
|
123
|
+
rewardMint: string;
|
124
|
+
rewardSymbol: string;
|
125
|
+
rewardsPerShare: string;
|
126
|
+
side: string;
|
127
|
+
tokenMint: string;
|
128
|
+
totalBalance: string;
|
129
|
+
rewardRates: {
|
130
|
+
name: string;
|
131
|
+
beginningSlot: number;
|
132
|
+
rewardRate: number;
|
133
|
+
}[];
|
134
|
+
};
|
116
135
|
export type Obligation = {
|
117
136
|
obligationID: string;
|
118
137
|
lotNumber: number;
|
@@ -121,4 +140,31 @@ export type Obligation = {
|
|
121
140
|
distributorPublicKey: string;
|
122
141
|
name: string;
|
123
142
|
incentivizer: string;
|
143
|
+
distributor: {
|
144
|
+
mint: string;
|
145
|
+
};
|
146
|
+
};
|
147
|
+
export type ClaimData = {
|
148
|
+
name: string;
|
149
|
+
obligationID: string;
|
150
|
+
lotNumber: number;
|
151
|
+
index: number;
|
152
|
+
quantity: string;
|
153
|
+
root: string;
|
154
|
+
proof: Array<string>;
|
155
|
+
distributorPublicKey: PublicKey;
|
156
|
+
optionMarketKey: PublicKey | null;
|
157
|
+
incentivizer: string;
|
158
|
+
};
|
159
|
+
export type FullClaimDataType = ClaimData & {
|
160
|
+
claimed: boolean;
|
161
|
+
claimedAt: number;
|
162
|
+
claimStatusBump: number;
|
163
|
+
accountFunded: boolean;
|
164
|
+
distributor: {
|
165
|
+
mint: PublicKey;
|
166
|
+
bump: number;
|
167
|
+
};
|
168
|
+
claimId: PublicKey;
|
169
|
+
distributorATAPublicKey: PublicKey;
|
124
170
|
};
|
@@ -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;
|