@sonarwatch/portfolio-plugins 0.11.107 → 0.11.109

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [0.11.109](https://github.com/sonarwatch/portfolio/compare/plugins-0.11.108...plugins-0.11.109) (2024-03-08)
6
+
7
+
8
+
9
+ ## [0.11.108](https://github.com/sonarwatch/portfolio/compare/plugins-0.11.107...plugins-0.11.108) (2024-03-07)
10
+
11
+
12
+
5
13
  ## [0.11.107](https://github.com/sonarwatch/portfolio/compare/plugins-0.11.106...plugins-0.11.107) (2024-03-07)
6
14
 
7
15
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sonarwatch/portfolio-plugins",
3
- "version": "0.11.107",
3
+ "version": "0.11.109",
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.107"
44
+ "@sonarwatch/portfolio-core": "0.11.109"
45
45
  },
46
46
  "main": "./src/index.js",
47
47
  "types": "./src/index.d.ts"
@@ -8,8 +8,11 @@ export declare const season2RewardsPrefix = "marinade-s2Rewards";
8
8
  export declare const marinadeTicketProgramId: PublicKey;
9
9
  export declare const claimProgram: PublicKey;
10
10
  export declare const mndeMint = "MNDEFzGvMt87ueuHvVU9VcTqsAP5b3fTGPsHuuPA5ey";
11
+ export declare const mndeDecimals = 9;
11
12
  export declare const solFactor: BigNumber;
12
13
  export declare const baseRewardsUrl = "https://native-staking-referral.marinade.finance/v1/rewards/";
13
14
  export declare const season2Route = "all/season-2?pubkey=";
14
15
  export declare const stakerRoute = "staker?pubkey=";
15
16
  export declare const referrerRoute = "referrer?pubkey=";
17
+ export declare const season1Unlock: Date;
18
+ export declare const season2Unlock: Date;
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.referrerRoute = exports.stakerRoute = exports.season2Route = exports.baseRewardsUrl = exports.solFactor = exports.mndeMint = exports.claimProgram = exports.marinadeTicketProgramId = exports.season2RewardsPrefix = exports.cachePrefix = exports.marinadePlatform = exports.platformId = void 0;
6
+ exports.season2Unlock = exports.season1Unlock = exports.referrerRoute = exports.stakerRoute = exports.season2Route = exports.baseRewardsUrl = exports.solFactor = exports.mndeDecimals = exports.mndeMint = exports.claimProgram = exports.marinadeTicketProgramId = exports.season2RewardsPrefix = exports.cachePrefix = exports.marinadePlatform = exports.platformId = void 0;
7
7
  const web3_js_1 = require("@solana/web3.js");
8
8
  const portfolio_core_1 = require("@sonarwatch/portfolio-core");
9
9
  const bignumber_js_1 = __importDefault(require("bignumber.js"));
@@ -20,9 +20,12 @@ exports.season2RewardsPrefix = `${exports.platformId}-s2Rewards`;
20
20
  exports.marinadeTicketProgramId = new web3_js_1.PublicKey('MarBmsSgKXdrN1egZf5sqe1TMai9K1rChYNDJgjq7aD');
21
21
  exports.claimProgram = new web3_js_1.PublicKey('indiXdKbsC4QSLQQnn6ngZvkqfywn6KgEeQbkGSpk1V');
22
22
  exports.mndeMint = 'MNDEFzGvMt87ueuHvVU9VcTqsAP5b3fTGPsHuuPA5ey';
23
+ exports.mndeDecimals = 9;
23
24
  exports.solFactor = new bignumber_js_1.default(Math.pow(10, portfolio_core_1.solanaNetwork.native.decimals));
24
25
  exports.baseRewardsUrl = 'https://native-staking-referral.marinade.finance/v1/rewards/';
25
26
  exports.season2Route = 'all/season-2?pubkey=';
26
27
  exports.stakerRoute = 'staker?pubkey=';
27
28
  exports.referrerRoute = 'referrer?pubkey=';
29
+ exports.season1Unlock = new Date(1704067200000); // January 1 2024
30
+ exports.season2Unlock = new Date(1711843200000); // March 31 2024
28
31
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/marinade/constants.ts"],"names":[],"mappings":";;;;;;AAAA,6CAA4C;AAC5C,+DAAqE;AACrE,gEAAqC;AAExB,QAAA,UAAU,GAAG,UAAU,CAAC;AACxB,QAAA,gBAAgB,GAAa;IACxC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,UAAU;IAChB,KAAK,EAAE,gDAAgD;IACvD,WAAW,EAAE,yBAAyB;IACtC,OAAO,EAAE,2BAA2B;CACrC,CAAC;AAEW,QAAA,WAAW,GAAG,UAAU,CAAC;AACzB,QAAA,oBAAoB,GAAG,GAAG,kBAAU,YAAY,CAAC;AACjD,QAAA,uBAAuB,GAAG,IAAI,mBAAS,CAClD,6CAA6C,CAC9C,CAAC;AACW,QAAA,YAAY,GAAG,IAAI,mBAAS,CACvC,6CAA6C,CAC9C,CAAC;AACW,QAAA,QAAQ,GAAG,6CAA6C,CAAC;AACzD,QAAA,SAAS,GAAG,IAAI,sBAAS,CAAC,SAAA,EAAE,EAAI,8BAAa,CAAC,MAAM,CAAC,QAAQ,CAAA,CAAC,CAAC;AAC/D,QAAA,cAAc,GACzB,8DAA8D,CAAC;AACpD,QAAA,YAAY,GAAG,sBAAsB,CAAC;AACtC,QAAA,WAAW,GAAG,gBAAgB,CAAC;AAC/B,QAAA,aAAa,GAAG,kBAAkB,CAAC"}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/marinade/constants.ts"],"names":[],"mappings":";;;;;;AAAA,6CAA4C;AAC5C,+DAAqE;AACrE,gEAAqC;AAExB,QAAA,UAAU,GAAG,UAAU,CAAC;AACxB,QAAA,gBAAgB,GAAa;IACxC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,UAAU;IAChB,KAAK,EAAE,gDAAgD;IACvD,WAAW,EAAE,yBAAyB;IACtC,OAAO,EAAE,2BAA2B;CACrC,CAAC;AAEW,QAAA,WAAW,GAAG,UAAU,CAAC;AACzB,QAAA,oBAAoB,GAAG,GAAG,kBAAU,YAAY,CAAC;AACjD,QAAA,uBAAuB,GAAG,IAAI,mBAAS,CAClD,6CAA6C,CAC9C,CAAC;AACW,QAAA,YAAY,GAAG,IAAI,mBAAS,CACvC,6CAA6C,CAC9C,CAAC;AACW,QAAA,QAAQ,GAAG,6CAA6C,CAAC;AACzD,QAAA,YAAY,GAAG,CAAC,CAAC;AACjB,QAAA,SAAS,GAAG,IAAI,sBAAS,CAAC,SAAA,EAAE,EAAI,8BAAa,CAAC,MAAM,CAAC,QAAQ,CAAA,CAAC,CAAC;AAC/D,QAAA,cAAc,GACzB,8DAA8D,CAAC;AACpD,QAAA,YAAY,GAAG,sBAAsB,CAAC;AACtC,QAAA,WAAW,GAAG,gBAAgB,CAAC;AAC/B,QAAA,aAAa,GAAG,kBAAkB,CAAC;AACnC,QAAA,aAAa,GAAG,IAAI,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,iBAAiB;AAC1D,QAAA,aAAa,GAAG,IAAI,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,gBAAgB"}
@@ -5,8 +5,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.fetchers = exports.platforms = void 0;
7
7
  const ticketsFetcher_1 = __importDefault(require("./ticketsFetcher"));
8
- const rewardsFetcher_1 = __importDefault(require("./rewardsFetcher"));
8
+ const rewardsS2Fetcher_1 = __importDefault(require("./rewardsS2Fetcher"));
9
+ const rewardsS1Fetcher_1 = __importDefault(require("./rewardsS1Fetcher"));
9
10
  const constants_1 = require("./constants");
10
11
  exports.platforms = [constants_1.marinadePlatform];
11
- exports.fetchers = [ticketsFetcher_1.default, rewardsFetcher_1.default];
12
+ exports.fetchers = [
13
+ ticketsFetcher_1.default,
14
+ rewardsS1Fetcher_1.default,
15
+ rewardsS2Fetcher_1.default,
16
+ ];
12
17
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/marinade/index.ts"],"names":[],"mappings":";;;;;;AAEA,sEAA8C;AAC9C,sEAA8C;AAC9C,2CAA+C;AAElC,QAAA,SAAS,GAAe,CAAC,4BAAgB,CAAC,CAAC;AAC3C,QAAA,QAAQ,GAAc,CAAC,wBAAc,EAAE,wBAAc,CAAC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/marinade/index.ts"],"names":[],"mappings":";;;;;;AAEA,sEAA8C;AAC9C,0EAAkD;AAClD,0EAAkD;AAClD,2CAA+C;AAElC,QAAA,SAAS,GAAe,CAAC,4BAAgB,CAAC,CAAC;AAC3C,QAAA,QAAQ,GAAc;IACjC,wBAAc;IACd,0BAAgB;IAChB,0BAAgB;CACjB,CAAC"}
@@ -0,0 +1,70 @@
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 tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetToken"));
20
+ const clients_1 = require("../../utils/clients");
21
+ const structs_1 = require("./structs");
22
+ const helpers_1 = require("./helpers");
23
+ const getParsedAccountInfo_1 = require("../../utils/solana/getParsedAccountInfo");
24
+ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
25
+ const client = (0, clients_1.getClientSolana)();
26
+ const promises = [
27
+ cache.getTokenPrice(constants_1.mndeMint, portfolio_core_1.NetworkId.solana),
28
+ (0, getParsedAccountInfo_1.getParsedAccountInfo)(client, structs_1.claimRecordStruct, (0, helpers_1.getClaimPda)(owner)),
29
+ axios_1.default
30
+ .get(constants_1.baseRewardsUrl + constants_1.referrerRoute + owner)
31
+ .catch(() => null),
32
+ ];
33
+ const [mndeTokenPrice, claimRecord, getReferrerRewards] = yield Promise.all(promises);
34
+ const assets = [];
35
+ if (claimRecord && !claimRecord.nonClaimedAmount.isZero()) {
36
+ assets.push(Object.assign({}, (0, tokenPriceToAssetToken_1.default)(constants_1.mndeMint, claimRecord.nonClaimedAmount.dividedBy(Math.pow(10, constants_1.mndeDecimals)).toNumber(), portfolio_core_1.NetworkId.solana, mndeTokenPrice, undefined, {
37
+ lockedUntil: constants_1.season1Unlock.getTime(),
38
+ tags: ['Staking'],
39
+ })));
40
+ }
41
+ if (getReferrerRewards) {
42
+ const rewardAmount = new bignumber_js_1.default(getReferrerRewards.data.rewards);
43
+ if (!rewardAmount.isZero()) {
44
+ assets.push(Object.assign({}, (0, tokenPriceToAssetToken_1.default)(constants_1.mndeMint, rewardAmount.dividedBy(Math.pow(10, constants_1.mndeDecimals)).toNumber(), portfolio_core_1.NetworkId.solana, mndeTokenPrice, undefined, {
45
+ lockedUntil: constants_1.season2Unlock.getTime(),
46
+ tags: ['Referrer'],
47
+ })));
48
+ }
49
+ }
50
+ if (assets.length === 0)
51
+ return [];
52
+ return [
53
+ {
54
+ type: portfolio_core_1.PortfolioElementType.multiple,
55
+ label: 'Rewards',
56
+ networkId: portfolio_core_1.NetworkId.solana,
57
+ platformId: constants_1.platformId,
58
+ name: 'Season 1',
59
+ data: { assets },
60
+ value: (0, portfolio_core_1.getUsdValueSum)(assets.map((asset) => asset.value)),
61
+ },
62
+ ];
63
+ });
64
+ const fetcher = {
65
+ id: `${constants_1.platformId}-rewards-s1`,
66
+ networkId: portfolio_core_1.NetworkId.solana,
67
+ executor,
68
+ };
69
+ exports.default = fetcher;
70
+ //# sourceMappingURL=rewardsS1Fetcher.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rewardsS1Fetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/marinade/rewardsS1Fetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAKoC;AACpC,kDAA6C;AAC7C,gEAAqC;AAGrC,2CAQqB;AAErB,qGAA6E;AAC7E,iDAAsD;AACtD,uCAA8C;AAC9C,uCAAwC;AACxC,kFAA+E;AAE/E,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,MAAM,GAAG,IAAA,yBAAe,GAAE,CAAC;IACjC,MAAM,QAAQ,GAAG;QACf,KAAK,CAAC,aAAa,CAAC,oBAAQ,EAAE,0BAAS,CAAC,MAAM,CAAC;QAC/C,IAAA,2CAAoB,EAAC,MAAM,EAAE,2BAAiB,EAAE,IAAA,qBAAW,EAAC,KAAK,CAAC,CAAC;QACnE,eAAK;aACF,GAAG,CACF,0BAAc,GAAG,yBAAa,GAAG,KAAK,CACvC;aACA,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC;KACZ,CAAC;IAEX,MAAM,CAAC,cAAc,EAAE,WAAW,EAAE,kBAAkB,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CACzE,QAAQ,CACT,CAAC;IAEF,MAAM,MAAM,GAAqB,EAAE,CAAC;IACpC,IAAI,WAAW,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,MAAM,EAAE,EAAE,CAAC;QAC1D,MAAM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CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,aAAa;IAC9B,SAAS,EAAE,0BAAS,CAAC,MAAM;IAC3B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Fetcher } from '../../Fetcher';
2
+ declare const fetcher: Fetcher;
3
+ export default fetcher;
@@ -0,0 +1,93 @@
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 tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetToken"));
20
+ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
21
+ const promises = [
22
+ cache.getTokenPrice(constants_1.mndeMint, portfolio_core_1.NetworkId.solana),
23
+ cache.getItem(owner, {
24
+ prefix: constants_1.season2RewardsPrefix,
25
+ networkId: portfolio_core_1.NetworkId.solana,
26
+ }),
27
+ ];
28
+ // eslint-disable-next-line prefer-const
29
+ let [mndeTokenPrice, season2Rewards] = yield Promise.all(promises);
30
+ const assets = [];
31
+ if (!season2Rewards) {
32
+ const getSeason2Rewards = yield axios_1.default
33
+ .get(constants_1.baseRewardsUrl + constants_1.season2Route + owner)
34
+ .catch(() => null);
35
+ if (getSeason2Rewards) {
36
+ season2Rewards = getSeason2Rewards.data;
37
+ yield cache.setItem(owner, season2Rewards, {
38
+ prefix: constants_1.season2RewardsPrefix,
39
+ networkId: portfolio_core_1.NetworkId.solana,
40
+ ttl: 1000 * 60 * 60 * 5,
41
+ });
42
+ }
43
+ }
44
+ if (season2Rewards) {
45
+ if (season2Rewards.staker.mSOLRewards) {
46
+ const stakingRewardAmount = new bignumber_js_1.default(season2Rewards.staker.mSOLRewards);
47
+ if (!stakingRewardAmount.isZero()) {
48
+ assets.push(Object.assign({}, (0, tokenPriceToAssetToken_1.default)(constants_1.mndeMint, stakingRewardAmount.dividedBy(Math.pow(10, constants_1.mndeDecimals)).toNumber(), portfolio_core_1.NetworkId.solana, mndeTokenPrice, undefined, {
49
+ lockedUntil: constants_1.season2Unlock.getTime(),
50
+ tags: ['Staking'],
51
+ })));
52
+ }
53
+ }
54
+ if (season2Rewards.governor.vemndeDirectedStakeVotesRewards) {
55
+ const governorRewardAmount = new bignumber_js_1.default(season2Rewards.governor.vemndeDirectedStakeVotesRewards);
56
+ if (!governorRewardAmount.isZero()) {
57
+ assets.push(Object.assign({}, (0, tokenPriceToAssetToken_1.default)(constants_1.mndeMint, governorRewardAmount.dividedBy(Math.pow(10, constants_1.mndeDecimals)).toNumber(), portfolio_core_1.NetworkId.solana, mndeTokenPrice, undefined, {
58
+ lockedUntil: constants_1.season2Unlock.getTime(),
59
+ tags: ['Governor'],
60
+ })));
61
+ }
62
+ }
63
+ if (season2Rewards.validator.algoScoreRewards) {
64
+ const validatorRewardAmount = new bignumber_js_1.default(season2Rewards.validator.algoScoreRewards);
65
+ if (!validatorRewardAmount.isZero()) {
66
+ assets.push(Object.assign({}, (0, tokenPriceToAssetToken_1.default)(constants_1.mndeMint, validatorRewardAmount.dividedBy(Math.pow(10, constants_1.mndeDecimals)).toNumber(), portfolio_core_1.NetworkId.solana, mndeTokenPrice, undefined, {
67
+ lockedUntil: constants_1.season2Unlock.getTime(),
68
+ tags: ['Validator'],
69
+ })));
70
+ }
71
+ }
72
+ }
73
+ if (assets.length === 0)
74
+ return [];
75
+ return [
76
+ {
77
+ type: portfolio_core_1.PortfolioElementType.multiple,
78
+ label: 'Rewards',
79
+ networkId: portfolio_core_1.NetworkId.solana,
80
+ platformId: constants_1.platformId,
81
+ name: 'Season 2',
82
+ data: { assets },
83
+ value: (0, portfolio_core_1.getUsdValueSum)(assets.map((asset) => asset.value)),
84
+ },
85
+ ];
86
+ });
87
+ const fetcher = {
88
+ id: `${constants_1.platformId}-rewards-s2`,
89
+ networkId: portfolio_core_1.NetworkId.solana,
90
+ executor,
91
+ };
92
+ exports.default = fetcher;
93
+ //# sourceMappingURL=rewardsS2Fetcher.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rewardsS2Fetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/marinade/rewardsS2Fetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAKoC;AACpC,kDAA6C;AAC7C,gEAAqC;AAGrC,2CAQqB;AAErB,qGAA6E;AAE7E,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,QAAQ,GAAG;QACf,KAAK,CAAC,aAAa,CAAC,oBAAQ,EAAE,0BAAS,CAAC,MAAM,CAAC;QAC/C,KAAK,CAAC,OAAO,CAAkB,KAAK,EAAE;YACpC,MAAM,EAAE,gCAAoB;YAC5B,SAAS,EAAE,0BAAS,CAAC,MAAM;SAC5B,CAAC;KACM,CAAC;IAEX,wCAAwC;IACxC,IAAI,CAAC,cAAc,EAAE,cAAc,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAEnE,MAAM,MAAM,GAAqB,EAAE,CAAC;IACpC,IAAI,CAAC,cAAc,EAAE,CAAC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AAC,CAAC;SAC1D;KACF,CAAC;AACJ,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,aAAa;IAC9B,SAAS,EAAE,0BAAS,CAAC,MAAM;IAC3B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
@@ -20,7 +20,7 @@ const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/token
20
20
  const getOwnedObjects_1 = require("../../utils/sui/getOwnedObjects");
21
21
  const clients_1 = require("../../utils/clients");
22
22
  const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
23
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
23
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
24
24
  const elements = [];
25
25
  const borrowedAssets = [];
26
26
  const borrowedYields = [];
@@ -118,18 +118,12 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
118
118
  }
119
119
  }
120
120
  const tokenAddresses = Object.values(lendingAssets).map((value) => value.coinType);
121
- const tokenPriceResult = yield cache.getTokenPrices(tokenAddresses, portfolio_core_1.NetworkId.sui);
122
- const tokenPrices = new Map();
123
- tokenPriceResult.forEach((r) => {
124
- if (!r)
125
- return;
126
- tokenPrices.set(r.address, r);
127
- });
121
+ const tokenPrices = yield cache.getTokenPricesAsMap([...tokenAddresses, portfolio_core_1.suiNetwork.native.address], portfolio_core_1.NetworkId.sui);
128
122
  if (pendingReward.isGreaterThan(0)) {
129
123
  const pendingRewardAmount = pendingReward
130
- .shiftedBy(-1 * ((_j = (_h = (_g = pools['sui']) === null || _g === void 0 ? void 0 : _g.metadata) === null || _h === void 0 ? void 0 : _h.decimals) !== null && _j !== void 0 ? _j : 0))
124
+ .shiftedBy(-1 * portfolio_core_1.suiNetwork.native.decimals)
131
125
  .toNumber();
132
- const rewardTokenAddress = (0, portfolio_core_1.formatMoveTokenAddress)(pools['sui'].coinType);
126
+ const rewardTokenAddress = (0, portfolio_core_1.formatMoveTokenAddress)(portfolio_core_1.suiNetwork.native.address);
133
127
  const rewardTokenPrice = tokenPrices.get(rewardTokenAddress);
134
128
  const rewardAssetToken = (0, tokenPriceToAssetToken_1.default)(rewardTokenAddress, pendingRewardAmount, portfolio_core_1.NetworkId.sui, rewardTokenPrice, undefined, {
135
129
  isClaimable: true,
@@ -145,8 +139,8 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
145
139
  const addressMove = (0, portfolio_core_1.formatMoveTokenAddress)(assetValue.coinType);
146
140
  const tokenPrice = tokenPrices.get(addressMove);
147
141
  const lendingAmount = assetValue.amount
148
- .multipliedBy((_k = lendingRate.get(assetName)) !== null && _k !== void 0 ? _k : 0)
149
- .shiftedBy(-1 * ((_o = (_m = (_l = pools[assetName]) === null || _l === void 0 ? void 0 : _l.metadata) === null || _m === void 0 ? void 0 : _m.decimals) !== null && _o !== void 0 ? _o : 0))
142
+ .multipliedBy((_g = lendingRate.get(assetName)) !== null && _g !== void 0 ? _g : 0)
143
+ .shiftedBy(-1 * ((_k = (_j = (_h = pools[assetName]) === null || _h === void 0 ? void 0 : _h.metadata) === null || _j === void 0 ? void 0 : _j.decimals) !== null && _k !== void 0 ? _k : 0))
150
144
  .toNumber();
151
145
  const assetToken = (0, tokenPriceToAssetToken_1.default)(addressMove, lendingAmount, portfolio_core_1.NetworkId.sui, tokenPrice);
152
146
  suppliedYields.push([
@@ -1 +1 @@
1
- {"version":3,"file":"lendingsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/scallop/lendingsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAUoC;AACpC,gDAA0E;AAC1E,gEAAqC;AAIrC,2CAWqB;AACrB,qGAA6E;AAQ7E,qEAAkE;AAClE,iDAAmD;AAEnD,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;;IACtE,MAAM,QAAQ,GAAuB,EAAE,CAAC;IACxC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AAE,YAAY,CAAC,CAAC;IACxE,QAAQ,CAAC,IAAI,CAAC;QACZ,IAAI,EAAE,qCAAoB,CAAC,UAAU;QACrC,SAAS,EAAE,0BAAS,CAAC,GAAG;QACxB,UAAU,EAAV,sBAAU;QACV,KAAK,EAAE,SAAS;QAChB,KAAK;QACL,IAAI,EAAE;YACJ,cAAc;YACd,aAAa;YACb,cAAc;YACd,cAAc;YACd,aAAa;YACb,cAAc;YACd,eAAe,EAAE,IAAI;YACrB,WAAW;YACX,YAAY;YACZ,WAAW;YACX,KAAK;SACN;KACF,CAAC,CAAC;IACH,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,WAAW;IAC5B,SAAS,EAAE,0BAAS,CAAC,GAAG;IACxB,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
@@ -1,131 +0,0 @@
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 tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetToken"));
20
- const clients_1 = require("../../utils/clients");
21
- const structs_1 = require("./structs");
22
- const helpers_1 = require("./helpers");
23
- const getParsedAccountInfo_1 = require("../../utils/solana/getParsedAccountInfo");
24
- const decimals = 9;
25
- const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
26
- const mndeTokenPrice = yield cache.getTokenPrice(constants_1.mndeMint, portfolio_core_1.NetworkId.solana);
27
- if (!mndeTokenPrice)
28
- return [];
29
- const season1Unlock = new Date(1704067200000); // January 1 2024
30
- const season2Unlock = new Date(1711843200000); // March 31 2024
31
- const client = (0, clients_1.getClientSolana)();
32
- const pda = (0, helpers_1.getClaimPda)(owner);
33
- const claimRecord = yield (0, getParsedAccountInfo_1.getParsedAccountInfo)(client, structs_1.claimRecordStruct, pda);
34
- const getReferrerRewards = yield axios_1.default
35
- .get(constants_1.baseRewardsUrl + constants_1.referrerRoute + owner)
36
- .catch(() => null);
37
- const season1Assets = [];
38
- const elements = [];
39
- if (claimRecord && !claimRecord.nonClaimedAmount.isZero()) {
40
- season1Assets.push(Object.assign(Object.assign({}, (0, tokenPriceToAssetToken_1.default)(constants_1.mndeMint, claimRecord.nonClaimedAmount.dividedBy(Math.pow(10, decimals)).toNumber(), portfolio_core_1.NetworkId.solana, mndeTokenPrice)), { attributes: {
41
- lockedUntil: season1Unlock.getTime(),
42
- tags: ['Staking'],
43
- } }));
44
- }
45
- if (getReferrerRewards) {
46
- const rewardAmount = new bignumber_js_1.default(getReferrerRewards.data.rewards);
47
- if (!rewardAmount.isZero()) {
48
- season1Assets.push(Object.assign(Object.assign({}, (0, tokenPriceToAssetToken_1.default)(constants_1.mndeMint, rewardAmount.dividedBy(Math.pow(10, decimals)).toNumber(), portfolio_core_1.NetworkId.solana, mndeTokenPrice)), { attributes: {
49
- lockedUntil: season2Unlock.getTime(),
50
- tags: ['Referrer'],
51
- } }));
52
- }
53
- }
54
- if (season1Assets.length > 0) {
55
- elements.push({
56
- type: portfolio_core_1.PortfolioElementType.multiple,
57
- label: 'Rewards',
58
- networkId: portfolio_core_1.NetworkId.solana,
59
- platformId: constants_1.platformId,
60
- name: 'Season 1',
61
- data: { assets: season1Assets },
62
- value: (0, portfolio_core_1.getUsdValueSum)(season1Assets.map((asset) => asset.value)),
63
- });
64
- }
65
- const season2Assets = [];
66
- let season2Rewards = yield cache.getItem(owner, {
67
- prefix: constants_1.season2RewardsPrefix,
68
- networkId: portfolio_core_1.NetworkId.solana,
69
- });
70
- if (!season2Rewards) {
71
- const getSeason2Rewards = yield axios_1.default
72
- .get(constants_1.baseRewardsUrl + constants_1.season2Route + owner)
73
- .catch(() => null);
74
- if (getSeason2Rewards) {
75
- season2Rewards = getSeason2Rewards.data;
76
- yield cache.setItem(owner, season2Rewards, {
77
- prefix: constants_1.season2RewardsPrefix,
78
- networkId: portfolio_core_1.NetworkId.solana,
79
- ttl: 1000 * 60 * 60 * 5,
80
- });
81
- }
82
- }
83
- if (season2Rewards) {
84
- if (season2Rewards.staker.mSOLRewards) {
85
- const stakingRewardAmount = new bignumber_js_1.default(season2Rewards.staker.mSOLRewards);
86
- if (!stakingRewardAmount.isZero()) {
87
- season2Assets.push(Object.assign(Object.assign({}, (0, tokenPriceToAssetToken_1.default)(constants_1.mndeMint, stakingRewardAmount.dividedBy(Math.pow(10, decimals)).toNumber(), portfolio_core_1.NetworkId.solana, mndeTokenPrice)), { attributes: {
88
- lockedUntil: season2Unlock.getTime(),
89
- tags: ['Staking'],
90
- } }));
91
- }
92
- }
93
- if (season2Rewards.governor.vemndeDirectedStakeVotesRewards) {
94
- const governorRewardAmount = new bignumber_js_1.default(season2Rewards.governor.vemndeDirectedStakeVotesRewards);
95
- if (!governorRewardAmount.isZero()) {
96
- season2Assets.push(Object.assign(Object.assign({}, (0, tokenPriceToAssetToken_1.default)(constants_1.mndeMint, governorRewardAmount.dividedBy(Math.pow(10, decimals)).toNumber(), portfolio_core_1.NetworkId.solana, mndeTokenPrice)), { attributes: {
97
- lockedUntil: season2Unlock.getTime(),
98
- tags: ['Governor'],
99
- } }));
100
- }
101
- }
102
- if (season2Rewards.validator.algoScoreRewards) {
103
- const validatorRewardAmount = new bignumber_js_1.default(season2Rewards.validator.algoScoreRewards);
104
- if (!validatorRewardAmount.isZero()) {
105
- season2Assets.push(Object.assign(Object.assign({}, (0, tokenPriceToAssetToken_1.default)(constants_1.mndeMint, validatorRewardAmount.dividedBy(Math.pow(10, decimals)).toNumber(), portfolio_core_1.NetworkId.solana, mndeTokenPrice)), { attributes: {
106
- lockedUntil: season2Unlock.getTime(),
107
- tags: ['Validator'],
108
- } }));
109
- }
110
- }
111
- }
112
- if (season2Assets.length > 0) {
113
- elements.push({
114
- type: portfolio_core_1.PortfolioElementType.multiple,
115
- label: 'Rewards',
116
- networkId: portfolio_core_1.NetworkId.solana,
117
- platformId: constants_1.platformId,
118
- name: 'Season 2',
119
- data: { assets: season2Assets },
120
- value: (0, portfolio_core_1.getUsdValueSum)(season2Assets.map((asset) => asset.value)),
121
- });
122
- }
123
- return elements;
124
- });
125
- const fetcher = {
126
- id: `${constants_1.platformId}-rewards`,
127
- networkId: portfolio_core_1.NetworkId.solana,
128
- executor,
129
- };
130
- exports.default = fetcher;
131
- //# sourceMappingURL=rewardsFetcher.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"rewardsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/marinade/rewardsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAMoC;AACpC,kDAA6C;AAC7C,gEAAqC;AAGrC,2CAOqB;AAErB,qGAA6E;AAC7E,iDAAsD;AACtD,uCAA8C;AAC9C,uCAAwC;AACxC,kFAA+E;AAE/E,MAAM,QAAQ,GAAG,CAAC,CAAC;AAEnB,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,cAAc,GAAG,MAAM,KAAK,CAAC,aAAa,CAAC,oBAAQ,EAAE,0BAAS,CAAC,MAAM,CAAC,CAAC;IAC7E,IAAI,CAAC,c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