@sonarwatch/portfolio-plugins 0.12.130 → 0.12.131

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [0.12.131](https://github.com/sonarwatch/portfolio/compare/plugins-0.12.130...plugins-0.12.131) (2024-08-12)
6
+
7
+
8
+
5
9
  ## [0.12.130](https://github.com/sonarwatch/portfolio/compare/plugins-0.12.129...plugins-0.12.130) (2024-08-12)
6
10
 
7
11
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sonarwatch/portfolio-plugins",
3
- "version": "0.12.130",
3
+ "version": "0.12.131",
4
4
  "type": "commonjs",
5
5
  "types": "./src/index.d.ts",
6
6
  "peerDependencies": {
@@ -11,8 +11,7 @@ exports.platform = {
11
11
  defiLlamaId: 'deepbook', // from https://defillama.com/docs/api
12
12
  };
13
13
  exports.airdropStatics = {
14
- claimLink: undefined,
15
- emitterLink: 'https://deepbook.tech/#airdrop',
14
+ emitterLink: 'https://deepbook.tech',
16
15
  emitterName: 'DeepBook',
17
16
  id: `${exports.platformId}-token-launch`,
18
17
  image: 'https://sonar.watch/img/platforms/deepbook.webp',
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/deepbook/constants.ts"],"names":[],"mappings":";;;AAGa,QAAA,UAAU,GAAG,UAAU,CAAC;AACxB,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,UAAU;IAChB,KAAK,EAAE,iDAAiD;IACxD,OAAO,EAAE,uBAAuB;IAChC,OAAO,EAAE,6BAA6B;IACtC,WAAW,EAAE,UAAU,EAAE,sCAAsC;CAChE,CAAC;AACW,QAAA,cAAc,GAAmB;IAC5C,SAAS,EAAE,SAAS;IACpB,WAAW,EAAE,gCAAgC;IAC7C,WAAW,EAAE,UAAU;IACvB,EAAE,EAAE,GAAG,kBAAU,eAAe;IAChC,KAAK,EAAE,iDAAiD;IACxD,QAAQ,EAAE,SAAS;IACnB,UAAU,EAAE,SAAS;CACtB,CAAC;AAEW,QAAA,QAAQ,GACnB,gFAAgF,CAAC;AACtE,QAAA,YAAY,GAAG,CAAC,CAAC"}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/deepbook/constants.ts"],"names":[],"mappings":";;;AAGa,QAAA,UAAU,GAAG,UAAU,CAAC;AACxB,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,UAAU;IAChB,KAAK,EAAE,iDAAiD;IACxD,OAAO,EAAE,uBAAuB;IAChC,OAAO,EAAE,6BAA6B;IACtC,WAAW,EAAE,UAAU,EAAE,sCAAsC;CAChE,CAAC;AACW,QAAA,cAAc,GAAmB;IAC5C,WAAW,EAAE,uBAAuB;IACpC,WAAW,EAAE,UAAU;IACvB,EAAE,EAAE,GAAG,kBAAU,eAAe;IAChC,KAAK,EAAE,iDAAiD;IACxD,QAAQ,EAAE,SAAS;IACnB,UAAU,EAAE,SAAS;CACtB,CAAC;AAEW,QAAA,QAAQ,GACnB,gFAAgF,CAAC;AACtE,QAAA,YAAY,GAAG,CAAC,CAAC"}
@@ -1,3 +1,3 @@
1
- import { MergeMiner, Miner, Position, Rewarder } from './types';
1
+ import { MergeMiner, Miner, Position, QuarryData, Rewarder } from './types';
2
2
  import { ParsedAccount } from '../../utils/solana';
3
- export declare const calculatePositions: (mergeMinerAccounts: ParsedAccount<MergeMiner>[], minerAccounts: ParsedAccount<Miner>[], replicaMinerAccounts: ParsedAccount<Miner>[][], allRewarders: Rewarder[], owner: string) => Position[];
3
+ export declare const calculatePositions: (mergeMinerAccounts: ParsedAccount<MergeMiner>[], minerAccounts: ParsedAccount<Miner>[], replicaMinerAccounts: ParsedAccount<Miner>[][], allRewarders: Rewarder[], quarryAccounts: ParsedAccount<QuarryData>[], owner: string) => Position[];
@@ -3,7 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.calculatePositions = void 0;
4
4
  const web3_js_1 = require("@solana/web3.js");
5
5
  const helpers_1 = require("./helpers");
6
- const calculatePositions = (mergeMinerAccounts, minerAccounts, replicaMinerAccounts, allRewarders, owner) => {
6
+ const getClaimableRewards_1 = require("./getClaimableRewards");
7
+ const calculatePositions = (mergeMinerAccounts, minerAccounts, replicaMinerAccounts, allRewarders, quarryAccounts, owner) => {
7
8
  const positions = [];
8
9
  const quarryPDAS = (0, helpers_1.getQuarryPDAs)(allRewarders, new web3_js_1.PublicKey(owner));
9
10
  [...mergeMinerAccounts, ...minerAccounts].forEach((account, i) => {
@@ -21,13 +22,38 @@ const calculatePositions = (mergeMinerAccounts, minerAccounts, replicaMinerAccou
21
22
  const primaryQuarry = primaryRewarder.quarries.find((q) => quarryPDA.primaryQuarry.toString() === q.quarry);
22
23
  if (!primaryQuarry)
23
24
  return;
24
- const rewardsToken = [
25
- quarryPDA.rewardsToken.toString(),
26
- ...quarryPDA.replicas.map((r) => r.rewardsMint.toString()),
27
- ];
28
- const rewardsBalance = (0, helpers_1.isMinerAccount)(account)
29
- ? [account.rewardsEarned]
30
- : replicaMinerAccounts[i].map((acc) => acc.rewardsEarned);
25
+ const rewardsBalance = [];
26
+ const rewardsTokenInfo = [];
27
+ const primaryQuarryAccount = quarryAccounts.find((q) => q.pubkey.toString() === primaryQuarry.quarry.toString());
28
+ if (!primaryQuarryAccount)
29
+ return;
30
+ if ((0, helpers_1.isMinerAccount)(account)) {
31
+ rewardsTokenInfo.push(primaryRewarder.rewardsTokenInfo);
32
+ rewardsBalance.push((0, getClaimableRewards_1.getClaimableRewards)(primaryQuarryAccount, account));
33
+ }
34
+ else {
35
+ const minerAccount = replicaMinerAccounts[i].find((a) => a.quarry === primaryQuarryAccount.pubkey.toString());
36
+ if (!minerAccount)
37
+ return;
38
+ rewardsTokenInfo.push(primaryRewarder.rewardsTokenInfo);
39
+ rewardsBalance.push((0, getClaimableRewards_1.getClaimableRewards)(primaryQuarryAccount, minerAccount));
40
+ primaryQuarry.replicaQuarries.forEach((r) => {
41
+ const quarryAccount = quarryAccounts.find((q) => q.pubkey.toString() === r.quarry);
42
+ if (!quarryAccount)
43
+ return;
44
+ const replicaMinerAccount = replicaMinerAccounts[i].find((a) => a.quarry === quarryAccount.pubkey.toString());
45
+ if (!replicaMinerAccount)
46
+ return;
47
+ const replicaQuarryPDA = quarryPDA.replicas.find((rq) => rq.replicaQuarry.toString() === r.quarry);
48
+ if (!replicaQuarryPDA)
49
+ return;
50
+ const replicaRewarder = allRewarders.find((rew) => rew.rewarder === replicaQuarryPDA.rewarder.toString());
51
+ if (!replicaRewarder)
52
+ return;
53
+ rewardsTokenInfo.push(replicaRewarder.rewardsTokenInfo);
54
+ rewardsBalance.push((0, getClaimableRewards_1.getClaimableRewards)(quarryAccount, replicaMinerAccount));
55
+ });
56
+ }
31
57
  positions.push({
32
58
  primaryRewarder: {
33
59
  slug: primaryRewarder.slug,
@@ -37,7 +63,7 @@ const calculatePositions = (mergeMinerAccounts, minerAccounts, replicaMinerAccou
37
63
  ? account.balance
38
64
  : account.primaryBalance,
39
65
  stakedTokenInfo: primaryQuarry.primaryTokenInfo,
40
- rewardsToken,
66
+ rewardsTokenInfo,
41
67
  rewardsBalance,
42
68
  });
43
69
  });
@@ -1 +1 @@
1
- {"version":3,"file":"calculatePositions.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/quarry/calculatePositions.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAG5C,uCAA0D;AAEnD,MAAM,kBAAkB,GAAG,CAChC,kBAA+C,EAC/C,aAAqC,EACrC,oBAA8C,EAC9C,YAAwB,EACxB,KAAa,EACb,EAAE;IACF,MAAM,SAAS,GAAe,EAAE,CAAC;IAEjC,MAAM,UAAU,GAAG,IAAA,uBAAa,EAAC,YAAY,EAAE,IAAI,mBAAS,CAAC,KAAK,CAAC,CAAC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AC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;QAE5D,SAAS,CAAC,IAAI,CAAC;YACb,eAAe,EAAE;gBACf,IAAI,EAAE,eAAe,CAAC,IAAI;gBAC1B,IAAI,EAAE,MAAA,eAAe,CAAC,IAAI,0CAAE,IAAI;aACjC;YACD,aAAa,EAAE,IAAA,wBAAc,EAAC,OAAO,CAAC;gBACpC,CAAC,CAAC,OAAO,CAAC,OAAO;gBACjB,CAAC,CAAC,OAAO,CAAC,cAAc;YAC1B,eAAe,EAAE,aAAa,CAAC,gBAAgB;YAC/C,YAAY;YACZ,cAAc;SACf,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AAvDW,QAAA,kBAAkB,sBAuD7B"}
1
+ {"version":3,"file":"calculatePositions.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/quarry/calculatePositions.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAW5C,uCAA0D;AAC1D,+DAA4D;AAErD,MAAM,kBAAkB,GAAG,CAChC,kBAA+C,EAC/C,aAAqC,EACrC,oBAA8C,EAC9C,YAAwB,EACxB,cAA2C,EAC3C,KAAa,EACb,EAAE;IACF,MAAM,SAAS,GAAe,EAAE,CAAC;IAEjC,MAAM,UAAU,GAAG,IAAA,uBAAa,EAAC,YAAY,EAAE,IAAI,mBAAS,CAAC,KAAK,CAAC,CAAC,CAAC;IAErE,CAAC,GAAG,kBAAkB,EAAE,GAAG,aAAa,CAAC,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,CAAC,EAAE,EAAE;;QAC/D,IAAI,CAAC,OAAO;YAAE,OAAO;QAErB,MAAM,SAAS,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CACtC,IAAA,wBAAc,EAAC,OAAO,CAAC;YACrB,CAAC,CAAC,CAAC,CAAC,UA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IAAI,CACjB,IAAA,yCAAmB,EAAC,aAAa,EAAE,mBAAmB,CAAC,CACxD,CAAC;YACJ,CAAC,CAAC,CAAC;QACL,CAAC;QAED,SAAS,CAAC,IAAI,CAAC;YACb,eAAe,EAAE;gBACf,IAAI,EAAE,eAAe,CAAC,IAAI;gBAC1B,IAAI,EAAE,MAAA,eAAe,CAAC,IAAI,0CAAE,IAAI;aACjC;YACD,aAAa,EAAE,IAAA,wBAAc,EAAC,OAAO,CAAC;gBACpC,CAAC,CAAC,OAAO,CAAC,OAAO;gBACjB,CAAC,CAAC,OAAO,CAAC,cAAc;YAC1B,eAAe,EAAE,aAAa,CAAC,gBAAgB;YAC/C,gBAAgB;YAChB,cAAc;SACf,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AA7FW,QAAA,kBAAkB,sBA6F7B"}
@@ -0,0 +1,3 @@
1
+ import BigNumber from 'bignumber.js';
2
+ import { Miner, QuarryData } from './types';
3
+ export declare const getClaimableRewards: (quarryAccount: QuarryData, minerAccount: Miner) => BigNumber;
@@ -0,0 +1,18 @@
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.getClaimableRewards = void 0;
7
+ const bn_js_1 = __importDefault(require("bn.js"));
8
+ const bignumber_js_1 = __importDefault(require("bignumber.js"));
9
+ const payroll_1 = require("./payroll");
10
+ const getClaimableRewards = (quarryAccount, minerAccount) => {
11
+ const timeInSec = new bn_js_1.default(Math.floor(Date.now() / 1000));
12
+ const payroll = new payroll_1.Payroll(new bn_js_1.default(quarryAccount.famineTs), new bn_js_1.default(quarryAccount.lastUpdateTs), new bn_js_1.default(quarryAccount.annualRewardsRate), new bn_js_1.default(quarryAccount.rewardsPerTokenStored), new bn_js_1.default(quarryAccount.totalTokensDeposited));
13
+ return new bignumber_js_1.default(payroll
14
+ .calculateRewardsEarned(timeInSec, new bn_js_1.default(minerAccount.balance), new bn_js_1.default(minerAccount.rewardsPerTokenPaid), new bn_js_1.default(minerAccount.rewardsEarned))
15
+ .toString());
16
+ };
17
+ exports.getClaimableRewards = getClaimableRewards;
18
+ //# sourceMappingURL=getClaimableRewards.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getClaimableRewards.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/quarry/getClaimableRewards.ts"],"names":[],"mappings":";;;;;;AAAA,kDAAuB;AACvB,gEAAqC;AAErC,uCAAoC;AAE7B,MAAM,mBAAmB,GAAG,CACjC,aAAyB,EACzB,YAAmB,EACnB,EAAE;IACF,MAAM,SAAS,GAAG,IAAI,eAAE,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC;IAExD,MAAM,OAAO,GAAG,IAAI,iBAAO,CACzB,IAAI,eAAE,CAAC,aAAa,CAAC,QAAQ,CAAC,EAC9B,IAAI,eAAE,CAAC,aAAa,CAAC,YAAY,CAAC,EAClC,IAAI,eAAE,CAAC,aAAa,CAAC,iBAAiB,CAAC,EACvC,IAAI,eAAE,CAAC,aAAa,CAAC,qBAAqB,CAAC,EAC3C,IAAI,eAAE,CAAC,aAAa,CAAC,oBAAoB,CAAC,CAC3C,CAAC;IAEF,OAAO,IAAI,sBAAS,CAClB,OAAO;SACJ,sBAAsB,CACrB,SAAS,EACT,IAAI,eAAE,CAAC,YAAY,CAAC,OAAO,CAAC,EAC5B,IAAI,eAAE,CAAC,YAAY,CAAC,mBAAmB,CAAC,EACxC,IAAI,eAAE,CAAC,YAAY,CAAC,aAAa,CAAC,CACnC;SACA,QAAQ,EAAE,CACd,CAAC;AACJ,CAAC,CAAC;AAxBW,QAAA,mBAAmB,uBAwB9B"}
@@ -0,0 +1,29 @@
1
+ import BN from 'bn.js';
2
+ export declare const MAX_U64 = "18446744073709551616";
3
+ export declare const ZERO: BN;
4
+ export declare const BASE_TEN: BN;
5
+ export declare const MAX_U64_BN: BN;
6
+ export declare const SECONDS_PER_YEAR: BN;
7
+ export declare class Payroll {
8
+ readonly famineTs: BN;
9
+ readonly lastCheckpointTs: BN;
10
+ readonly annualRewardsRate: BN;
11
+ readonly rewardsPerTokenStored: BN;
12
+ readonly totalTokensDeposited: BN;
13
+ constructor(famineTs: BN, lastCheckpointTs: BN, annualRewardsRate: BN, rewardsPerTokenStored: BN, totalTokensDeposited: BN);
14
+ /**
15
+ * Calculates the amount of tokens that this user can receive.
16
+ * @param currentTs
17
+ * @returns
18
+ */
19
+ calculateRewardPerToken(currentTs: BN): BN;
20
+ /**
21
+ * Calculates the amount of tokens that this user can claim.
22
+ * @param currentTs
23
+ * @param tokensDeposited
24
+ * @param rewardsPerTokenPaid
25
+ * @param rewardsEarned
26
+ * @returns
27
+ */
28
+ calculateRewardsEarned(currentTs: BN, tokensDeposited: BN, rewardsPerTokenPaid: BN, rewardsEarned: BN): BN;
29
+ }
@@ -0,0 +1,54 @@
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.Payroll = exports.SECONDS_PER_YEAR = exports.MAX_U64_BN = exports.BASE_TEN = exports.ZERO = exports.MAX_U64 = void 0;
7
+ const bn_js_1 = __importDefault(require("bn.js"));
8
+ exports.MAX_U64 = '18446744073709551616';
9
+ exports.ZERO = new bn_js_1.default(0);
10
+ exports.BASE_TEN = new bn_js_1.default(10);
11
+ exports.MAX_U64_BN = new bn_js_1.default(exports.MAX_U64);
12
+ exports.SECONDS_PER_YEAR = new bn_js_1.default(365 * 86400);
13
+ class Payroll {
14
+ constructor(famineTs, lastCheckpointTs, annualRewardsRate, rewardsPerTokenStored, totalTokensDeposited) {
15
+ this.famineTs = famineTs;
16
+ this.lastCheckpointTs = lastCheckpointTs;
17
+ this.annualRewardsRate = annualRewardsRate;
18
+ this.rewardsPerTokenStored = rewardsPerTokenStored;
19
+ this.totalTokensDeposited = totalTokensDeposited;
20
+ }
21
+ /**
22
+ * Calculates the amount of tokens that this user can receive.
23
+ * @param currentTs
24
+ * @returns
25
+ */
26
+ calculateRewardPerToken(currentTs) {
27
+ if (this.totalTokensDeposited.isZero()) {
28
+ return this.rewardsPerTokenStored;
29
+ }
30
+ const lastTimeRewardsApplicable = bn_js_1.default.min(currentTs, this.famineTs);
31
+ const timeWorked = bn_js_1.default.max(exports.ZERO, lastTimeRewardsApplicable.sub(this.lastCheckpointTs));
32
+ const reward = timeWorked
33
+ .mul(exports.MAX_U64_BN)
34
+ .mul(this.annualRewardsRate)
35
+ .div(exports.SECONDS_PER_YEAR)
36
+ .div(this.totalTokensDeposited);
37
+ return this.rewardsPerTokenStored.add(reward);
38
+ }
39
+ /**
40
+ * Calculates the amount of tokens that this user can claim.
41
+ * @param currentTs
42
+ * @param tokensDeposited
43
+ * @param rewardsPerTokenPaid
44
+ * @param rewardsEarned
45
+ * @returns
46
+ */
47
+ calculateRewardsEarned(currentTs, tokensDeposited, rewardsPerTokenPaid, rewardsEarned) {
48
+ const netNewRewards = this.calculateRewardPerToken(currentTs).sub(rewardsPerTokenPaid);
49
+ const earnedRewards = tokensDeposited.mul(netNewRewards).div(exports.MAX_U64_BN);
50
+ return earnedRewards.add(rewardsEarned);
51
+ }
52
+ }
53
+ exports.Payroll = Payroll;
54
+ //# sourceMappingURL=payroll.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"payroll.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/quarry/payroll.ts"],"names":[],"mappings":";;;;;;AAAA,kDAAuB;AAEV,QAAA,OAAO,GAAG,sBAAsB,CAAC;AAEjC,QAAA,IAAI,GAAG,IAAI,eAAE,CAAC,CAAC,CAAC,CAAC;AACjB,QAAA,QAAQ,GAAG,IAAI,eAAE,CAAC,EAAE,CAAC,CAAC;A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AAC,CAAC;QACnE,MAAM,aAAa,GAAG,eAAe,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,GAAG,CAAC,kBAAU,CAAC,CAAC;QACzE,OAAO,aAAa,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;IAC1C,CAAC;CACF;AAnDD,0BAmDC"}
@@ -14,6 +14,7 @@ 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 bignumber_js_1 = __importDefault(require("bignumber.js"));
17
+ const web3_js_1 = require("@solana/web3.js");
17
18
  const constants_1 = require("./constants");
18
19
  const constants_2 = require("../thevault/constants");
19
20
  const constants_3 = require("../saber/constants");
@@ -36,24 +37,23 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
36
37
  ]);
37
38
  if (mergeMinerAccounts.length === 0 && minerAccounts.length === 0)
38
39
  return [];
39
- const replicaMinerAccounts = yield Promise.all(mergeMinerAccounts.map((mmAcount) => {
40
- return (0, solana_1.getAutoParsedProgramAccounts)(connection, constants_1.mineIdlItem, (0, filters_1.minerFilters)(mmAcount.pubkey.toString()));
41
- }));
40
+ const replicaMinerAccounts = yield Promise.all(mergeMinerAccounts.map((mmAcount) => (0, solana_1.getAutoParsedProgramAccounts)(connection, constants_1.mineIdlItem, (0, filters_1.minerFilters)(mmAcount.pubkey.toString()))));
41
+ const quarryAccounts = yield (0, solana_1.getAutoParsedMultipleAccountsInfo)(connection, constants_1.mineIdlItem, [...minerAccounts, ...[...replicaMinerAccounts.values()].flat()].map((m) => new web3_js_1.PublicKey(m.quarry))).then((accs) => accs.filter((acc) => acc !== null));
42
42
  const allRewarders = yield rewardersMemo.getItem(cache);
43
43
  if (!allRewarders)
44
44
  return [];
45
- const positions = (0, calculatePositions_1.calculatePositions)(mergeMinerAccounts, minerAccounts, replicaMinerAccounts, allRewarders, owner);
45
+ const positions = (0, calculatePositions_1.calculatePositions)(mergeMinerAccounts, minerAccounts, replicaMinerAccounts, allRewarders, quarryAccounts, owner);
46
46
  if (positions.length === 0)
47
47
  return [];
48
48
  const mints = new Set();
49
49
  positions.forEach((position) => {
50
50
  mints.add(position.stakedTokenInfo.address);
51
- position.rewardsToken.forEach((rewardToken) => mints.add(rewardToken.toString()));
51
+ position.rewardsTokenInfo.forEach((rewardTokenInfo) => mints.add(rewardTokenInfo.address.toString()));
52
52
  });
53
53
  const tokenPrices = yield cache.getTokenPricesAsMap([...mints], portfolio_core_1.NetworkId.solana);
54
54
  const elements = [];
55
55
  positions.forEach((position) => {
56
- const { rewardsToken, rewardsBalance, primaryRewarder, stakedBalance, stakedTokenInfo, } = position;
56
+ const { rewardsTokenInfo, rewardsBalance, primaryRewarder, stakedBalance, stakedTokenInfo, } = position;
57
57
  const assets = [];
58
58
  const rewardAssets = [];
59
59
  const stakedTokenPrice = tokenPrices.get(stakedTokenInfo.address);
@@ -78,19 +78,36 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
78
78
  imageUri: stakedTokenInfo.logoURI,
79
79
  });
80
80
  }
81
- rewardsToken.forEach((rewardToken, i) => {
81
+ rewardsTokenInfo.forEach((rewardTokenInfo, i) => {
82
82
  var _a;
83
- if (rewardsBalance[i] === '0')
83
+ if (rewardsBalance[i].isZero())
84
84
  return;
85
- const rewardTokenPrice = tokenPrices.get(rewardToken);
85
+ const rewardTokenPrice = tokenPrices.get(rewardTokenInfo.address);
86
86
  if (rewardTokenPrice) {
87
87
  rewardAssets.push((0, tokenPriceToAssetToken_1.default)(rewardTokenPrice.elementName === constants_1.IOUTokensElementName &&
88
88
  ((_a = rewardTokenPrice.underlyings) === null || _a === void 0 ? void 0 : _a.length) === 1
89
89
  ? rewardTokenPrice.underlyings[0].address
90
- : rewardTokenPrice.address, new bignumber_js_1.default(rewardsBalance[i])
90
+ : rewardTokenPrice.address, rewardsBalance[i]
91
91
  .dividedBy(Math.pow(10, rewardTokenPrice.decimals))
92
92
  .toNumber(), portfolio_core_1.NetworkId.solana, rewardTokenPrice));
93
93
  }
94
+ else {
95
+ rewardAssets.push({
96
+ networkId: portfolio_core_1.NetworkId.solana,
97
+ type: 'token',
98
+ value: null,
99
+ attributes: {},
100
+ name: rewardTokenInfo.symbol,
101
+ data: {
102
+ amount: new bignumber_js_1.default(rewardsBalance[i])
103
+ .dividedBy(Math.pow(10, rewardTokenInfo.decimals))
104
+ .toNumber(),
105
+ address: rewardTokenInfo.address,
106
+ price: null,
107
+ },
108
+ imageUri: rewardTokenInfo.logoURI,
109
+ });
110
+ }
94
111
  });
95
112
  const assetsValue = (0, portfolio_core_1.getUsdValueSum)(assets.map((a) => a.value));
96
113
  const rewardAssetsValue = (0, portfolio_core_1.getUsdValueSum)(rewardAssets.map((a) => a.value));
@@ -1 +1 @@
1
- {"version":3,"file":"positionsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/quarry/positionsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAMoC;AACpC,gEAAqC;AAErC,2CAOqB;AACrB,qDAAyE;AACzE,kDAAmE;AAEnE,iDAAsD;AACtD,+CAG4B;AAE5B,kEAA+D;AAC/D,qGAA6E;AAC7E,uGAA+E;AAC/E,uCAA4D;AAC5D,6DAA0D;AAE1D,MAAM,aAAa,GAAG,IAAI,6BAAa,CAAa,6BAAiB,EAAE;IACrE,MAAM,EAAE,sBAAU;IAClB,SAAS,EAAE,0BAAS,CAAC,MAAM;CAC5B,CAAC,CAAC;AAEH,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,UAAU,GAAG,IAAA,yBAAe,GAAE,CAAC;IAErC,MAAM,CAAC,kBAAkB,EAAE,aAAa,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QAC5D,IAAA,qCAA4B,EAC1B,UAAU,EACV,4BAAgB,EAChB,IAAA,2BAAiB,EAAC,KAAK,CAAC,CACzB,CAAC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M,KAAK,GAAG,WAAW,CAAC;QAE1B,IAAI,iBAAiB,CAAC;QAEtB,QAAQ,eAAe,CAAC,IAAI,EAAE,CAAC;YAC7B,KAAK,OAAO;gBACV,iBAAiB,GAAG,sBAAkB,CAAC;gBACvC,MAAM;YACR,KAAK,OAAO;gBACV,iBAAiB,GAAG,sBAAe,CAAC;gBACpC,MAAM;YACR;gBACE,iBAAiB,GAAG,sBAAU,CAAC;QACnC,CAAC;QAED,QAAQ,CAAC,IAAI,CAAC;YACZ,SAAS,EAAE,0BAAS,CAAC,MAAM;YAC3B,KAAK,EAAE,SAAS;YAChB,UAAU,EAAE,iBAAiB;YAC7B,IAAI,EAAE,qCAAoB,CAAC,SAAS;YACpC,KAAK;YACL,IAAI,EACF,iBAAiB,KAAK,sBAAU,CAAC,CAAC,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC,oBAAQ,CAAC,IAAI;YACzE,IAAI,EAAE;gBACJ,WAAW,EAAE;oBACX;wBACE,MAAM;wBACN,WAAW;wBACX,YAAY;wBACZ,iBAAiB;wBACjB,KAAK;wBACL,MAAM,EAAE,EAAE;qBACX;iBACF;aACF;SACF,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,YAAY;IAC7B,SAAS,EAAE,0BAAS,CAAC,MAAM;IAC3B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
1
+ {"version":3,"file":"positionsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/quarry/positionsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAMoC;AACpC,gEAAqC;AACrC,6CAA4C;AAE5C,2CAOqB;AACrB,qDAAyE;AACzE,kDAAmE;AAEnE,iDAAsD;AACtD,+CAI4B;AAQ5B,kEAA+D;AAC/D,qGAA6E;AAC7E,uGAA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AC;QAC/D,MAAM,iBAAiB,GAAG,IAAA,+BAAc,EAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;QAC3E,MAAM,KAAK,GAAG,WAAW,CAAC;QAE1B,IAAI,iBAAiB,CAAC;QAEtB,QAAQ,eAAe,CAAC,IAAI,EAAE,CAAC;YAC7B,KAAK,OAAO;gBACV,iBAAiB,GAAG,sBAAkB,CAAC;gBACvC,MAAM;YACR,KAAK,OAAO;gBACV,iBAAiB,GAAG,sBAAe,CAAC;gBACpC,MAAM;YACR;gBACE,iBAAiB,GAAG,sBAAU,CAAC;QACnC,CAAC;QAED,QAAQ,CAAC,IAAI,CAAC;YACZ,SAAS,EAAE,0BAAS,CAAC,MAAM;YAC3B,KAAK,EAAE,SAAS;YAChB,UAAU,EAAE,iBAAiB;YAC7B,IAAI,EAAE,qCAAoB,CAAC,SAAS;YACpC,KAAK;YACL,IAAI,EACF,iBAAiB,KAAK,sBAAU,CAAC,CAAC,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC,oBAAQ,CAAC,IAAI;YACzE,IAAI,EAAE;gBACJ,WAAW,EAAE;oBACX;wBACE,MAAM;wBACN,WAAW;wBACX,YAAY;wBACZ,iBAAiB;wBACjB,KAAK;wBACL,MAAM,EAAE,EAAE;qBACX;iBACF;aACF;SACF,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,YAAY;IAC7B,SAAS,EAAE,0BAAS,CAAC,MAAM;IAC3B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import { PublicKey } from '@solana/web3.js';
2
+ import BigNumber from 'bignumber.js';
2
3
  export type TokenInfo = {
3
4
  decimals: number;
4
5
  mint: string;
@@ -87,8 +88,21 @@ export type Position = {
87
88
  slug: string;
88
89
  name?: string;
89
90
  };
90
- rewardsToken: string[];
91
- rewardsBalance: string[];
91
+ rewardsTokenInfo: DetailedTokenInfo[];
92
+ rewardsBalance: BigNumber[];
92
93
  stakedTokenInfo: DetailedTokenInfo;
93
94
  stakedBalance: string;
94
95
  };
96
+ export type QuarryData = {
97
+ rewarder: string;
98
+ tokenMintKey: string;
99
+ index: number;
100
+ tokenMintDecimals: number;
101
+ famineTs: string;
102
+ lastUpdateTs: string;
103
+ rewardsPerTokenStored: string;
104
+ annualRewardsRate: string;
105
+ rewardsShare: string;
106
+ totalTokensDeposited: string;
107
+ numMiners: string;
108
+ };
@@ -11,7 +11,6 @@ exports.platform = {
11
11
  defiLlamaId: 'suins', // from https://defillama.com/docs/api
12
12
  };
13
13
  exports.airdropStatics = {
14
- claimLink: undefined,
15
14
  emitterLink: 'https://token.suins.io/',
16
15
  emitterName: 'Sui NS',
17
16
  id: `${exports.platformId}-token-launch`,
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/suins/constants.ts"],"names":[],"mappings":";;;AAGa,QAAA,UAAU,GAAG,OAAO,CAAC;AACrB,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,kBAAkB;IACxB,KAAK,EAAE,8CAA8C;IACrD,OAAO,EAAE,mBAAmB;IAC5B,OAAO,EAAE,yBAAyB;IAClC,WAAW,EAAE,OAAO,EAAE,sCAAsC;CAC7D,CAAC;AACW,QAAA,cAAc,GAAmB;IAC5C,SAAS,EAAE,SAAS;IACpB,WAAW,EAAE,yBAAyB;IACtC,WAAW,EAAE,QAAQ;IACrB,EAAE,EAAE,GAAG,kBAAU,eAAe;IAChC,KAAK,EAAE,8CAA8C;IACrD,QAAQ,EAAE,SAAS;IACnB,UAAU,EAAE,SAAS;CACtB,CAAC;AAEW,QAAA,MAAM,GAAG,SAAS,CAAC;AACnB,QAAA,UAAU,GAAG,CAAC,CAAC"}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/suins/constants.ts"],"names":[],"mappings":";;;AAGa,QAAA,UAAU,GAAG,OAAO,CAAC;AACrB,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,kBAAkB;IACxB,KAAK,EAAE,8CAA8C;IACrD,OAAO,EAAE,mBAAmB;IAC5B,OAAO,EAAE,yBAAyB;IAClC,WAAW,EAAE,OAAO,EAAE,sCAAsC;CAC7D,CAAC;AACW,QAAA,cAAc,GAAmB;IAC5C,WAAW,EAAE,yBAAyB;IACtC,WAAW,EAAE,QAAQ;IACrB,EAAE,EAAE,GAAG,kBAAU,eAAe;IAChC,KAAK,EAAE,8CAA8C;IACrD,QAAQ,EAAE,SAAS;IACnB,UAAU,EAAE,SAAS;CACtB,CAAC;AAEW,QAAA,MAAM,GAAG,SAAS,CAAC;AACnB,QAAA,UAAU,GAAG,CAAC,CAAC"}