@sonarwatch/portfolio-plugins 0.11.91 → 0.11.92
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +1091 -1087
- 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/bskt/constants.d.ts +7 -0
- package/src/plugins/bskt/constants.js +17 -0
- package/src/plugins/bskt/constants.js.map +1 -0
- package/src/plugins/bskt/filters.d.ts +2 -0
- package/src/plugins/bskt/filters.js +14 -0
- package/src/plugins/bskt/filters.js.map +1 -0
- package/src/plugins/bskt/index.d.ts +6 -0
- package/src/plugins/bskt/index.js +12 -0
- package/src/plugins/bskt/index.js.map +1 -0
- package/src/plugins/bskt/structs.d.ts +13 -0
- package/src/plugins/bskt/structs.js +15 -0
- package/src/plugins/bskt/structs.js.map +1 -0
- package/src/plugins/bskt/types.d.ts +4 -0
- package/src/plugins/bskt/types.js +3 -0
- package/src/plugins/bskt/types.js.map +1 -0
- package/src/plugins/bskt/vestingFetcher.d.ts +3 -0
- package/src/plugins/bskt/vestingFetcher.js +114 -0
- package/src/plugins/bskt/vestingFetcher.js.map +1 -0
- package/src/plugins/kamino/farmsFetcher.js +14 -5
- package/src/plugins/kamino/farmsFetcher.js.map +1 -1
- package/src/plugins/kamino/farmsJob.js +3 -5
- package/src/plugins/kamino/farmsJob.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.92",
|
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.92"
|
45
45
|
},
|
46
46
|
"main": "./src/index.js",
|
47
47
|
"types": "./src/index.d.ts"
|
package/src/index.js
CHANGED
@@ -86,6 +86,7 @@ const flash_1 = require("./plugins/flash");
|
|
86
86
|
const bonkrewards_1 = require("./plugins/bonkrewards");
|
87
87
|
const accessprotocol_1 = require("./plugins/accessprotocol");
|
88
88
|
const aptin_1 = require("./plugins/aptin");
|
89
|
+
const bskt_1 = require("./plugins/bskt");
|
89
90
|
var constants_1 = require("./plugins/tokens/constants");
|
90
91
|
Object.defineProperty(exports, "walletTokensPlatform", { enumerable: true, get: function () { return constants_1.walletTokensPlatform; } });
|
91
92
|
Object.defineProperty(exports, "walletNftsPlatform", { enumerable: true, get: function () { return constants_1.walletNftsPlatform; } });
|
@@ -162,6 +163,7 @@ exports.platforms = [
|
|
162
163
|
...bonkrewards_1.platforms,
|
163
164
|
...accessprotocol_1.platforms,
|
164
165
|
...aptin_1.platforms,
|
166
|
+
...bskt_1.platforms,
|
165
167
|
];
|
166
168
|
// JOBS //
|
167
169
|
exports.jobs = [
|
@@ -224,6 +226,7 @@ exports.jobs = [
|
|
224
226
|
...bonkrewards_1.jobs,
|
225
227
|
...accessprotocol_1.jobs,
|
226
228
|
...aptin_1.jobs,
|
229
|
+
...bskt_1.jobs,
|
227
230
|
];
|
228
231
|
// FETCHERS //
|
229
232
|
exports.fetchers = [
|
@@ -288,6 +291,7 @@ exports.fetchers = [
|
|
288
291
|
...bonkrewards_1.fetchers,
|
289
292
|
...accessprotocol_1.fetchers,
|
290
293
|
...aptin_1.fetchers,
|
294
|
+
...bskt_1.fetchers,
|
291
295
|
];
|
292
296
|
exports.fetchersByAddressSystem = (0, getFetchersByAddressSystem_1.getFetchersByAddressSystem)(exports.fetchers);
|
293
297
|
//# 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,6CAI0B;AAC1B,2CAIyB;AACzB,iDAI4B;AAC5B,iDAI4B;AAC5B,+CAG2B;AAC3B,yCAIwB;AACxB,2CAIyB;AACzB,mDAI6B;AAC7B,2CAIyB;AACzB,2CAIyB;AACzB,sCAIsB;AACtB,+CAI2B;AAC3B,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;
|
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,6CAI0B;AAC1B,2CAIyB;AACzB,iDAI4B;AAC5B,iDAI4B;AAC5B,+CAG2B;AAC3B,yCAIwB;AACxB,2CAIyB;AACzB,mDAI6B;AAC7B,2CAIyB;AACzB,2CAIyB;AACzB,sCAIsB;AACtB,+CAI2B;AAC3B,iDAI4B;AAC5B,yCAIwB;AACxB,mDAI6B;AAC7B,qDAI8B;AAC9B,2CAIyB;AACzB,2CAIyB;AACzB,yCAIwB;AACxB,+CAI2B;AAC3B,2CAIyB;AACzB,2CAIyB;AACzB,uDAI+B;AAC/B,6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AAG,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;CAChB,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 = "bskt";
|
4
|
+
export declare const platform: Platform;
|
5
|
+
export declare const bsktPid: PublicKey;
|
6
|
+
export declare const bsktDecimals = 5;
|
7
|
+
export declare const bsktMint = "6gnCPhXtLnUD76HjQuSYPENLSZdG8RvDB1pTLM5aLSJA";
|
@@ -0,0 +1,17 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.bsktMint = exports.bsktDecimals = exports.bsktPid = exports.platform = exports.platformId = void 0;
|
4
|
+
const web3_js_1 = require("@solana/web3.js");
|
5
|
+
exports.platformId = 'bskt';
|
6
|
+
exports.platform = {
|
7
|
+
id: exports.platformId,
|
8
|
+
name: 'BSKT',
|
9
|
+
image: 'https://sonar.watch/img/platforms/bskt.png',
|
10
|
+
// defiLlamaId: 'foo-finance', // from https://defillama.com/docs/api
|
11
|
+
website: 'https://claim.bskt.fi/',
|
12
|
+
twitter: 'https://twitter.com/bsktfi',
|
13
|
+
};
|
14
|
+
exports.bsktPid = new web3_js_1.PublicKey('BSKTvA6XG9QyqhW5Hgq8pG8pm5NnvuYyc4pYefSzM62X');
|
15
|
+
exports.bsktDecimals = 5;
|
16
|
+
exports.bsktMint = '6gnCPhXtLnUD76HjQuSYPENLSZdG8RvDB1pTLM5aLSJA';
|
17
|
+
//# sourceMappingURL=constants.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/bskt/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,4CAA4C;IACnD,qEAAqE;IACrE,OAAO,EAAE,wBAAwB;IACjC,OAAO,EAAE,4BAA4B;CACtC,CAAC;AAEW,QAAA,OAAO,GAAG,IAAI,mBAAS,CAClC,8CAA8C,CAC/C,CAAC;AAEW,QAAA,YAAY,GAAG,CAAC,CAAC;AACjB,QAAA,QAAQ,GAAG,8CAA8C,CAAC"}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.vestingAccountFilter = void 0;
|
4
|
+
const vestingAccountFilter = (owner) => [
|
5
|
+
{
|
6
|
+
memcmp: {
|
7
|
+
offset: 8,
|
8
|
+
bytes: owner,
|
9
|
+
},
|
10
|
+
},
|
11
|
+
{ dataSize: 130 },
|
12
|
+
];
|
13
|
+
exports.vestingAccountFilter = vestingAccountFilter;
|
14
|
+
//# sourceMappingURL=filters.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"filters.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/bskt/filters.ts"],"names":[],"mappings":";;;AAEO,MAAM,oBAAoB,GAAG,CAClC,KAAa,EACe,EAAE,CAAC;IAC/B;QACE,MAAM,EAAE;YACN,MAAM,EAAE,CAAC;YACT,KAAK,EAAE,KAAK;SACb;KACF;IACD,EAAE,QAAQ,EAAE,GAAG,EAAE;CAClB,CAAC;AAVW,QAAA,oBAAoB,wBAU/B"}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
exports.fetchers = exports.jobs = exports.platforms = void 0;
|
7
|
+
const constants_1 = require("./constants");
|
8
|
+
const vestingFetcher_1 = __importDefault(require("./vestingFetcher"));
|
9
|
+
exports.platforms = [constants_1.platform];
|
10
|
+
exports.jobs = [];
|
11
|
+
exports.fetchers = [vestingFetcher_1.default];
|
12
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/bskt/index.ts"],"names":[],"mappings":";;;;;;AAGA,2CAAuC;AACvC,sEAA8C;AAEjC,QAAA,SAAS,GAAe,CAAC,oBAAQ,CAAC,CAAC;AACnC,QAAA,IAAI,GAAU,EAAE,CAAC;AACjB,QAAA,QAAQ,GAAc,CAAC,wBAAc,CAAC,CAAC"}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
/// <reference types="node" />
|
2
|
+
import { BeetStruct } from '@metaplex-foundation/beet';
|
3
|
+
import { PublicKey } from '@solana/web3.js';
|
4
|
+
import BigNumber from 'bignumber.js';
|
5
|
+
export type VestingAccount = {
|
6
|
+
buffer: Buffer;
|
7
|
+
owner: PublicKey;
|
8
|
+
lastClaimedAt: BigNumber;
|
9
|
+
totalAmount: BigNumber;
|
10
|
+
amountClaimed: BigNumber;
|
11
|
+
isCanceled: boolean;
|
12
|
+
};
|
13
|
+
export declare const vestingAccountStruct: BeetStruct<VestingAccount, Partial<VestingAccount>>;
|
@@ -0,0 +1,15 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.vestingAccountStruct = 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.vestingAccountStruct = new beet_1.BeetStruct([
|
8
|
+
['buffer', (0, solana_1.blob)(8)],
|
9
|
+
['owner', beet_solana_1.publicKey],
|
10
|
+
['lastClaimedAt', solana_1.i64],
|
11
|
+
['totalAmount', solana_1.u64],
|
12
|
+
['amountClaimed', solana_1.u64],
|
13
|
+
['isCanceled', beet_1.bool],
|
14
|
+
], (args) => args);
|
15
|
+
//# sourceMappingURL=structs.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"structs.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/bskt/structs.ts"],"names":[],"mappings":";;;AAAA,oDAA6D;AAC7D,kEAA6D;AAG7D,+CAAoD;AAWvC,QAAA,oBAAoB,GAAG,IAAI,iBAAU,CAChD;IACE,CAAC,QAAQ,EAAE,IAAA,aAAI,EAAC,CAAC,CAAC,CAAC;IACnB,CAAC,OAAO,EAAE,uBAAS,CAAC;IACpB,CAAC,eAAe,EAAE,YAAG,CAAC;IACtB,CAAC,aAAa,EAAE,YAAG,CAAC;IACpB,CAAC,eAAe,EAAE,YAAG,CAAC;IACtB,CAAC,YAAY,EAAE,WAAI,CAAC;CACrB,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAsB,CACjC,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/bskt/types.ts"],"names":[],"mappings":""}
|
@@ -0,0 +1,114 @@
|
|
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 axios_1 = __importDefault(require("axios"));
|
17
|
+
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
18
|
+
const constants_1 = require("./constants");
|
19
|
+
const solana_1 = require("../../utils/solana");
|
20
|
+
const structs_1 = require("./structs");
|
21
|
+
const filters_1 = require("./filters");
|
22
|
+
const clients_1 = require("../../utils/clients");
|
23
|
+
const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetToken"));
|
24
|
+
const oneDay = 1000 * 60 * 60 * 24;
|
25
|
+
const startDate = new Date(1709078400000);
|
26
|
+
const endDate = new Date(startDate.getTime() + 30 * oneDay);
|
27
|
+
const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
28
|
+
const client = (0, clients_1.getClientSolana)();
|
29
|
+
const vestingAccounts = yield (0, solana_1.getParsedProgramAccounts)(client, structs_1.vestingAccountStruct, constants_1.bsktPid, (0, filters_1.vestingAccountFilter)(owner));
|
30
|
+
const bsktTokenPrice = yield cache.getTokenPrice(constants_1.bsktMint, portfolio_core_1.NetworkId.solana);
|
31
|
+
if (vestingAccounts.length === 0) {
|
32
|
+
const res = yield axios_1.default.get(`https://claim.bskt.fi/api/getClaim?wallet=${owner}`);
|
33
|
+
if (res.data.amount) {
|
34
|
+
const assets = [];
|
35
|
+
const totalAmount = new bignumber_js_1.default(res.data.amount);
|
36
|
+
const amountPerUnlock = new bignumber_js_1.default(totalAmount).dividedBy(30);
|
37
|
+
const daysSinceLaunch = new bignumber_js_1.default(Date.now())
|
38
|
+
.minus(startDate.getTime())
|
39
|
+
.dividedBy(oneDay)
|
40
|
+
.decimalPlaces(0, bignumber_js_1.default.ROUND_DOWN);
|
41
|
+
const unlockedSince = new Date(startDate.getTime() + daysSinceLaunch.times(oneDay).toNumber());
|
42
|
+
const claimableAmount = amountPerUnlock.times(daysSinceLaunch.minus(1));
|
43
|
+
assets.push(Object.assign(Object.assign({}, (0, tokenPriceToAssetToken_1.default)(constants_1.bsktMint, claimableAmount.toNumber(), portfolio_core_1.NetworkId.solana, bsktTokenPrice)), { attributes: {
|
44
|
+
lockedUntil: unlockedSince.getTime(),
|
45
|
+
} }));
|
46
|
+
const amountLeftLocked = totalAmount.minus(claimableAmount);
|
47
|
+
if (!amountLeftLocked.isZero()) {
|
48
|
+
assets.push(Object.assign(Object.assign({}, (0, tokenPriceToAssetToken_1.default)(constants_1.bsktMint, totalAmount.minus(claimableAmount).toNumber(), portfolio_core_1.NetworkId.solana, bsktTokenPrice)), { attributes: {
|
49
|
+
lockedUntil: endDate.getTime(),
|
50
|
+
} }));
|
51
|
+
}
|
52
|
+
return [
|
53
|
+
{
|
54
|
+
type: portfolio_core_1.PortfolioElementType.multiple,
|
55
|
+
label: 'Vesting',
|
56
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
57
|
+
platformId: constants_1.platformId,
|
58
|
+
data: { assets },
|
59
|
+
value: (0, portfolio_core_1.getUsdValueSum)(assets.map((asset) => asset.value)),
|
60
|
+
},
|
61
|
+
];
|
62
|
+
}
|
63
|
+
}
|
64
|
+
const assets = [];
|
65
|
+
for (const vesting of vestingAccounts) {
|
66
|
+
if (vesting.totalAmount.isEqualTo(vesting.amountClaimed))
|
67
|
+
continue;
|
68
|
+
const lastClaimedTm = vesting.lastClaimedAt.times(1000).toNumber();
|
69
|
+
const amountPerUnlock = vesting.totalAmount.dividedBy(30);
|
70
|
+
const daysSinceClaim = new bignumber_js_1.default((Date.now() - vesting.lastClaimedAt.times(1000).toNumber()) / oneDay)
|
71
|
+
.decimalPlaces(0, bignumber_js_1.default.ROUND_DOWN)
|
72
|
+
.toNumber();
|
73
|
+
const amountAvailable = amountPerUnlock.times(daysSinceClaim);
|
74
|
+
const unlockedSince = new Date(lastClaimedTm + daysSinceClaim * oneDay);
|
75
|
+
if (!amountAvailable.isZero() && unlockedSince < endDate) {
|
76
|
+
assets.push(Object.assign(Object.assign({}, (0, tokenPriceToAssetToken_1.default)(constants_1.bsktMint, amountAvailable.dividedBy(Math.pow(10, constants_1.bsktDecimals)).toNumber(), portfolio_core_1.NetworkId.solana, bsktTokenPrice)), { attributes: {
|
77
|
+
lockedUntil: unlockedSince.getTime(),
|
78
|
+
} }));
|
79
|
+
}
|
80
|
+
const nextUnlock = new Date(lastClaimedTm + (daysSinceClaim + 1) * oneDay);
|
81
|
+
if (nextUnlock < endDate) {
|
82
|
+
assets.push(Object.assign(Object.assign({}, (0, tokenPriceToAssetToken_1.default)(constants_1.bsktMint, amountPerUnlock.dividedBy(Math.pow(10, constants_1.bsktDecimals)).toNumber(), portfolio_core_1.NetworkId.solana, bsktTokenPrice)), { attributes: {
|
83
|
+
lockedUntil: nextUnlock.getTime(),
|
84
|
+
} }));
|
85
|
+
}
|
86
|
+
const amountLockedLeft = vesting.totalAmount
|
87
|
+
.minus(vesting.amountClaimed)
|
88
|
+
.minus(amountAvailable);
|
89
|
+
if (!amountLockedLeft.isZero()) {
|
90
|
+
assets.push(Object.assign(Object.assign({}, (0, tokenPriceToAssetToken_1.default)(constants_1.bsktMint, amountLockedLeft.dividedBy(Math.pow(10, constants_1.bsktDecimals)).toNumber(), portfolio_core_1.NetworkId.solana, bsktTokenPrice)), { attributes: {
|
91
|
+
lockedUntil: endDate.getTime(),
|
92
|
+
} }));
|
93
|
+
}
|
94
|
+
}
|
95
|
+
if (assets.length === 0)
|
96
|
+
return [];
|
97
|
+
return [
|
98
|
+
{
|
99
|
+
type: portfolio_core_1.PortfolioElementType.multiple,
|
100
|
+
label: 'Vesting',
|
101
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
102
|
+
platformId: constants_1.platformId,
|
103
|
+
data: { assets },
|
104
|
+
value: (0, portfolio_core_1.getUsdValueSum)(assets.map((asset) => asset.value)),
|
105
|
+
},
|
106
|
+
];
|
107
|
+
});
|
108
|
+
const fetcher = {
|
109
|
+
id: `${constants_1.platformId}-vesting`,
|
110
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
111
|
+
executor,
|
112
|
+
};
|
113
|
+
exports.default = fetcher;
|
114
|
+
//# sourceMappingURL=vestingFetcher.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"vestingFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/bskt/vestingFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAKoC;AACpC,kDAA6C;AAC7C,gEAAqC;AAGrC,2CAA0E;AAC1E,+CAA8D;AAC9D,uCAAiD;AACjD,uCAAiD;AACjD,iDAAsD;AACtD,qGAA6E;AAG7E,MAAM,MAAM,GAAG,IAAI,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;AACnC,MAAM,SAAS,GAAG,IAAI,IAAI,CAAC,aAAa,CAAC,CAAC;AAC1C,MAAM,OAAO,GAAG,IAAI,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,GAAG,EAAE,GAAG,MAAM,CAAC,CAAC;AAE5D,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,MAAM,GAAG,IAAA,yBAAe,GAAE,CAAC;IACjC,MAAM,eAAe,GAAG,MAAM,IAAA,iCAAwB,EACpD,MAAM,EACN,8BAAoB,EACpB,mBAAO,EACP,IAAA,8BAAoB,EAAC,KAAK,CAAC,CAC5B,CAAC;IACF,MAAM,cAAc,GAAG,MAAM,KAAK,CAAC,aAAa,CAAC,oBAAQ,EAAE,0BAAS,CAAC,MAAM,CAAC,CAAC;IAE7E,IAAI,eAAe,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACjC,MAAM,GAAG,GAAiC,MAAM,eAAK,CAAC,GAAG,CACvD,6CAA6C,KAAK,EAAE,CACrD,CAAC;QACF,IAAI,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;YACpB,MAAM,MAAM,GAAqB,EAAE,CAAC;YAEpC,MAAM,WAAW,GAAG,IAAI,sBAAS,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YACnD,MAAM,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EAAE,MAAM,EAAE;YAChB,KAAK,EAAE,IAAA,+BAAc,EAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;SAC1D;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"}
|
@@ -18,7 +18,7 @@ const clients_1 = require("../../utils/clients");
|
|
18
18
|
const solana_1 = require("../../utils/solana");
|
19
19
|
const vaults_1 = require("./structs/vaults");
|
20
20
|
const filters_1 = require("./filters");
|
21
|
-
const
|
21
|
+
const tokenPriceToAssetTokens_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetTokens"));
|
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 userStates = yield (0, solana_1.getParsedProgramAccounts)(client, vaults_1.userStateStruct, constants_1.farmProgramId, (0, filters_1.userStateFilter)(owner));
|
@@ -32,21 +32,30 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
32
32
|
return [];
|
33
33
|
const farmById = new Map();
|
34
34
|
farmsInfo.forEach((farmInfo) => farmById.set(farmInfo.pubkey, farmInfo));
|
35
|
+
const mints = new Set();
|
36
|
+
farmsInfo.forEach((farm) => {
|
37
|
+
mints.add(farm.mint);
|
38
|
+
farm.rewardsMints.forEach((reward) => mints.add(reward));
|
39
|
+
});
|
40
|
+
const tokenPrices = yield cache.getTokenPrices(Array.from(mints), portfolio_core_1.NetworkId.solana);
|
41
|
+
const tokenPriceById = new Map();
|
42
|
+
tokenPrices.forEach((tP) => tP ? tokenPriceById.set(tP.address, tP) : undefined);
|
35
43
|
const liquidities = [];
|
36
44
|
for (const userState of userStates) {
|
37
45
|
const rewardAssets = [];
|
38
46
|
const assets = [];
|
47
|
+
if (userState.activeStakeScaled.isZero())
|
48
|
+
continue;
|
39
49
|
const farm = farmById.get(userState.farmState.toString());
|
40
50
|
if (!farm)
|
41
51
|
continue;
|
42
|
-
|
43
|
-
|
44
|
-
const { price, decimals } = farm;
|
52
|
+
const tokenPrice = tokenPriceById.get(farm.mint);
|
53
|
+
const { decimals } = farm;
|
45
54
|
const amount = userState.activeStakeScaled
|
46
55
|
.dividedBy(Math.pow(10, 18))
|
47
56
|
.dividedBy(Math.pow(10, decimals))
|
48
57
|
.toNumber();
|
49
|
-
assets.push((0,
|
58
|
+
assets.push(...(0, tokenPriceToAssetTokens_1.default)(farm.mint, amount, portfolio_core_1.NetworkId.solana, tokenPrice));
|
50
59
|
// for (let i = 0; i < farm.rewardsMints.length; i++) {
|
51
60
|
// const rewardMint = farm.rewardsMints[i];
|
52
61
|
// if (rewardMint === '11111111111111111111111111111111') continue;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"farmsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/kamino/farmsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+
|
1
|
+
{"version":3,"file":"farmsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/kamino/farmsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAOoC;AAGpC,2CAAkE;AAClE,iDAAsD;AACtD,+CAA8D;AAC9D,6CAAmD;AACnD,uCAA4C;AAE5C,uGAA+E;AAE/E,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,MAAM,GAAG,IAAA,yBAAe,GAAE,CAAC;IAEjC,MAAM,UAAU,GAAG,MAAM,IAAA,iCAAwB,EAC/C,MAAM,EACN,wBAAe,EACf,yBAAa,EACb,IAAA,yBAAe,EAAC,KAAK,CAAC,CACvB,CAAC;IACF,IAAI,CAAC,UAA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;QAC/D,MAAM,iBAAiB,GAAG,IAAI,CAAC;QAC/B,MAAM,KAAK,GAAG,WAAW,CAAC;QAE1B,MAAM,SAAS,GAAuB;YACpC,KAAK;YACL,MAAM;YACN,WAAW;YACX,YAAY;YACZ,iBAAiB;YACjB,MAAM,EAAE,EAAE;SACX,CAAC;QACF,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAC9B,CAAC;IACD,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAExC,OAAO;QACL;YACE,SAAS,EAAE,0BAAS,CAAC,MAAM;YAC3B,UAAU,EAAV,sBAAU;YACV,IAAI,EAAE,qCAAoB,CAAC,SAAS;YACpC,KAAK,EAAE,SAAS;YAChB,KAAK,EAAE,IAAA,+BAAc,EAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;YACtD,IAAI,EAAE;gBACJ,WAAW;aACZ;SACF;KACF,CAAC;AACJ,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"}
|
@@ -8,9 +8,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
9
|
});
|
10
10
|
};
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
13
|
-
};
|
14
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
15
12
|
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
16
13
|
const clients_1 = require("../../utils/clients");
|
@@ -18,11 +15,12 @@ const solana_1 = require("../../utils/solana");
|
|
18
15
|
const filters_1 = require("../../utils/solana/filters");
|
19
16
|
const constants_1 = require("./constants");
|
20
17
|
const vaults_1 = require("./structs/vaults");
|
21
|
-
const getTokensPricesMap_1 = __importDefault(require("../../utils/misc/getTokensPricesMap"));
|
22
18
|
const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
23
19
|
const client = (0, clients_1.getClientSolana)();
|
24
20
|
const farms = yield (0, solana_1.getParsedProgramAccounts)(client, vaults_1.farmStateStruct, constants_1.farmProgramId, (0, filters_1.dataSizeFilter)(8336));
|
25
|
-
const
|
21
|
+
const tokenPrices = yield cache.getTokenPrices(farms.map((farm) => farm.token.mint.toString()), portfolio_core_1.NetworkId.solana);
|
22
|
+
const tokenPriceById = new Map();
|
23
|
+
tokenPrices.forEach((tP) => tP ? tokenPriceById.set(tP.address, tP) : undefined);
|
26
24
|
const farmsInfo = [];
|
27
25
|
farms.forEach((farm) => {
|
28
26
|
if (farm.token.mint.toString() === '11111111111111111111111111111111')
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"farmsJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/kamino/farmsJob.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"farmsJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/kamino/farmsJob.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+DAAmE;AAGnE,iDAAsD;AACtD,+CAA8D;AAC9D,wDAA4D;AAC5D,2CAAkE;AAClE,6CAAmD;AAGnD,MAAM,QAAQ,GAAgB,CAAO,KAAY,EAAE,EAAE;IACnD,MAAM,MAAM,GAAG,IAAA,yBAAe,GAAE,CAAC;IAEjC,MAAM,KAAK,GAAG,MAAM,IAAA,iCAAwB,EAC1C,MAAM,EACN,wBAAe,EACf,yBAAa,EACb,IAAA,wBAAc,EAAC,IAAI,CAAC,CACrB,CAAC;IAEF,MAAM,WAAW,GAAG,MAAM,KAAK,CAAC,cAAc,CAC5C,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EA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AC3B,CAAC,CAAC,CAAC;IAEH,MAAM,KAAK,CAAC,OAAO,CAAC,oBAAQ,EAAE,SAAS,EAAE;QACvC,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"}
|
@@ -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
|