@sonarwatch/portfolio-plugins 0.11.207 → 0.11.209
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +8 -0
- package/package.json +3 -2
- package/src/index.js +4 -0
- package/src/index.js.map +1 -1
- package/src/plugins/mole/constants.d.ts +12 -0
- package/src/plugins/mole/constants.js +25 -0
- package/src/plugins/mole/constants.js.map +1 -0
- package/src/plugins/mole/dataJob.d.ts +3 -0
- package/src/plugins/mole/dataJob.js +49 -0
- package/src/plugins/mole/dataJob.js.map +1 -0
- package/src/plugins/mole/depositsFetcher.d.ts +3 -0
- package/src/plugins/mole/depositsFetcher.js +133 -0
- package/src/plugins/mole/depositsFetcher.js.map +1 -0
- package/src/plugins/mole/farmsFetcher.d.ts +3 -0
- package/src/plugins/mole/farmsFetcher.js +132 -0
- package/src/plugins/mole/farmsFetcher.js.map +1 -0
- package/src/plugins/mole/farmsJob.d.ts +3 -0
- package/src/plugins/mole/farmsJob.js +52 -0
- package/src/plugins/mole/farmsJob.js.map +1 -0
- package/src/plugins/mole/helpers.d.ts +1 -0
- package/src/plugins/mole/helpers.js +15 -0
- package/src/plugins/mole/helpers.js.map +1 -0
- package/src/plugins/mole/index.d.ts +6 -0
- package/src/plugins/mole/index.js +15 -0
- package/src/plugins/mole/index.js.map +1 -0
- package/src/plugins/mole/types.d.ts +68 -0
- package/src/plugins/mole/types.js +3 -0
- package/src/plugins/mole/types.js.map +1 -0
- package/src/plugins/navi/collateralFetcher.js +18 -2
- package/src/plugins/navi/collateralFetcher.js.map +1 -1
- package/src/plugins/navi/constants.d.ts +21 -0
- package/src/plugins/navi/constants.js +22 -1
- package/src/plugins/navi/constants.js.map +1 -1
- package/src/plugins/navi/getAvailableRewards.d.ts +2 -0
- package/src/plugins/navi/getAvailableRewards.js +109 -0
- package/src/plugins/navi/getAvailableRewards.js.map +1 -0
- package/src/plugins/navi/types.d.ts +4 -0
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.209](https://github.com/sonarwatch/portfolio/compare/plugins-0.11.208...plugins-0.11.209) (2024-05-23)
|
6
|
+
|
7
|
+
|
8
|
+
|
9
|
+
## [0.11.208](https://github.com/sonarwatch/portfolio/compare/plugins-0.11.207...plugins-0.11.208) (2024-05-23)
|
10
|
+
|
11
|
+
|
12
|
+
|
5
13
|
## [0.11.207](https://github.com/sonarwatch/portfolio/compare/plugins-0.11.206...plugins-0.11.207) (2024-05-22)
|
6
14
|
|
7
15
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@sonarwatch/portfolio-plugins",
|
3
|
-
"version": "0.11.
|
3
|
+
"version": "0.11.209",
|
4
4
|
"type": "commonjs",
|
5
5
|
"generators": "./generators.json",
|
6
6
|
"dependencies": {
|
@@ -19,6 +19,7 @@
|
|
19
19
|
"@metaplex-foundation/beet-solana": "^0.4.0",
|
20
20
|
"@metaplex-foundation/js": "^0.19.4",
|
21
21
|
"@metaplex-foundation/umi-serializers-encodings": "^0.8.9",
|
22
|
+
"@mysten/bcs": "^0.11.1",
|
22
23
|
"@mysten/sui.js": "^0.50.1",
|
23
24
|
"@onsol/tldparser": "^0.6.1",
|
24
25
|
"@sei-js/core": "^3.0.1",
|
@@ -41,7 +42,7 @@
|
|
41
42
|
"web3-v1": "npm:web3@^1.5.0"
|
42
43
|
},
|
43
44
|
"peerDependencies": {
|
44
|
-
"@sonarwatch/portfolio-core": "0.11.
|
45
|
+
"@sonarwatch/portfolio-core": "0.11.209"
|
45
46
|
},
|
46
47
|
"main": "./src/index.js",
|
47
48
|
"types": "./src/index.d.ts"
|
package/src/index.js
CHANGED
@@ -111,6 +111,7 @@ const sandglass_1 = require("./plugins/sandglass");
|
|
111
111
|
const kriya_1 = require("./plugins/kriya");
|
112
112
|
const haedal_1 = require("./plugins/haedal");
|
113
113
|
const flowx_1 = require("./plugins/flowx");
|
114
|
+
const mole_1 = require("./plugins/mole");
|
114
115
|
var constants_1 = require("./plugins/tokens/constants");
|
115
116
|
Object.defineProperty(exports, "walletTokensPlatform", { enumerable: true, get: function () { return constants_1.walletTokensPlatform; } });
|
116
117
|
Object.defineProperty(exports, "walletNftsPlatform", { enumerable: true, get: function () { return constants_1.walletNftsPlatform; } });
|
@@ -215,6 +216,7 @@ exports.platforms = [
|
|
215
216
|
...sandglass_1.platforms,
|
216
217
|
...kriya_1.platforms,
|
217
218
|
...haedal_1.platforms,
|
219
|
+
...mole_1.platforms,
|
218
220
|
];
|
219
221
|
// JOBS //
|
220
222
|
exports.jobs = [
|
@@ -302,6 +304,7 @@ exports.jobs = [
|
|
302
304
|
...kriya_1.jobs,
|
303
305
|
...haedal_1.jobs,
|
304
306
|
...flowx_1.jobs,
|
307
|
+
...mole_1.jobs,
|
305
308
|
];
|
306
309
|
// FETCHERS //
|
307
310
|
exports.fetchers = [
|
@@ -391,6 +394,7 @@ exports.fetchers = [
|
|
391
394
|
...kriya_1.fetchers,
|
392
395
|
...haedal_1.fetchers,
|
393
396
|
...flowx_1.fetchers,
|
397
|
+
...mole_1.fetchers,
|
394
398
|
];
|
395
399
|
exports.fetchersByAddressSystem = (0, getFetchersByAddressSystem_1.getFetchersByAddressSystem)(exports.fetchers);
|
396
400
|
exports.airdropFetchers = [
|
package/src/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/plugins/src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAIA,wFAAqF;AACrF,sEAA8C;AAC9C,6CAI0B;AAC1B,yDAIgC;AAChC,uDAAgE;AAChE,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,2CAKyB;AACzB,2CAIyB;AACzB,qDAA6D;AAC7D,qEAIsC;AACtC,uDAI+B;AAC/B,mDAI6B;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,yCAIwB;AACxB,2CAIyB;AACzB,iDAI4B;AAC5B,iDAI4B;AAC5B,+CAI2B;AAC3B,yCAIwB;AACxB,2CAIyB;AACzB,mDAI6B;AAC7B,2CAIyB;AACzB,2CAIyB;AACzB,sCAIsB;AACtB,+CAI2B;AAC3B,yCAIwB;AACxB,iDAI4B;AAC5B,yCAIwB;AACxB,mDAI6B;AAC7B,qDAI8B;AAC9B,2CAIyB;AACzB,2CAKyB;AACzB,yCAIwB;AACxB,+CAI2B;AAC3B,2CAIyB;AACzB,2CAIyB;AACzB,uDAI+B;AAC/B,6DAIkC;AAClC,2CAIyB;AACzB,yCAIwB;AACxB,mDAI6B;AAC7B,6CAI0B;AAC1B,iEAIoC;AACpC,6DAIkC;AAClC,yCAIwB;AACxB,uCAIuB;AACvB,+CAI2B;AAC3B,iDAI4B;AAC5B,mDAI6B;AAC7B,2CAIyB;AACzB,+CAI2B;AAC3B,uCAIuB;AACvB,iDAI4B;AAC5B,yCAIwB;AACxB,6CAI0B;AAC1B,yCAIwB;AACxB,mDAI6B;AAC7B,2CAIyB;AACzB,mDAI6B;AAC7B,2CAIyB;AACzB,6CAI0B;AAC1B,2CAIyB;
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/plugins/src/index.ts"],"names":[],"mappings":";;;;;;;;;;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B,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;IACf,GAAG,oBAAiB;IACpB,GAAG,iBAAc;IACjB,GAAG,2BAAsB;IACzB,GAAG,yBAAkB;IACrB,GAAG,eAAY;IACf,GAAG,cAAW;IACd,GAAG,kBAAe;IAClB,GAAG,mBAAgB;IACnB,GAAG,oBAAiB;IACpB,GAAG,gBAAa;IAChB,GAAG,kBAAe;IAClB,GAAG,cAAW;IACd,GAAG,mBAAgB;IACnB,GAAG,eAAY;IACf,GAAG,iBAAc;IACjB,GAAG,eAAY;IACf,GAAG,oBAAiB;IACpB,GAAG,gBAAa;IAChB,GAAG,oBAAiB;IACpB,GAAG,gBAAa;IAChB,GAAG,iBAAc;IACjB,GAAG,gBAAa;IAChB,GAAG,eAAY;CAChB,CAAC;AACW,QAAA,uBAAuB,GAAG,IAAA,uDAA0B,EAAC,gBAAQ,CAAC,CAAC;AAE/D,QAAA,eAAe,GAAqB;IAC/C,sBAAmB;IACnB,sBAAmB;CACpB,CAAC;AACW,QAAA,8BAA8B,GACzC,IAAA,uDAA0B,EAAC,uBAAe,CAAC,CAAC"}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import { Platform } from '@sonarwatch/portfolio-core';
|
2
|
+
export declare const platformId = "mole";
|
3
|
+
export declare const platform: Platform;
|
4
|
+
export declare const magicCoin = "0x5ffa69ee4ee14d899dcc750df92de12bad4bacf81efa1ae12ee76406804dda7f::vault::MagicCoin";
|
5
|
+
export declare const suiStackedParentId = "0x02acbf5d6e48bced367c43ca121da29c05fd9a207c0d8aa4552d553f189e6700";
|
6
|
+
export declare const usdcStackedParentId = "0x81b17a30ed130e0d1f400678f07cf07578e3ee31c7d208656d71cfd56ac0fe94";
|
7
|
+
export declare const suiIncentiveUserType = "0x2f73c04ded344fd4e2530ec8012a7cffdc17cbb049559f3196c030f58c3a0cdd::sui_incentive::User";
|
8
|
+
export declare const stackedSavingsParentIds: string[];
|
9
|
+
export declare const dataUrl = "https://app.mole.fi/api/SuiMainnet/data.json";
|
10
|
+
export declare const vaultsPrefix = "mole";
|
11
|
+
export declare const dataKey = "data";
|
12
|
+
export declare const positionsKey = "positions";
|
@@ -0,0 +1,25 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.positionsKey = exports.dataKey = exports.vaultsPrefix = exports.dataUrl = exports.stackedSavingsParentIds = exports.suiIncentiveUserType = exports.usdcStackedParentId = exports.suiStackedParentId = exports.magicCoin = exports.platform = exports.platformId = void 0;
|
4
|
+
exports.platformId = 'mole';
|
5
|
+
exports.platform = {
|
6
|
+
id: exports.platformId,
|
7
|
+
name: 'Mole',
|
8
|
+
image: 'https://sonar.watch/img/platforms/mole.webp',
|
9
|
+
defiLlamaId: 'mole', // from https://defillama.com/docs/api
|
10
|
+
website: 'https://app.mole.fi/',
|
11
|
+
twitter: 'https://twitter.com/moledefi',
|
12
|
+
};
|
13
|
+
exports.magicCoin = '0x5ffa69ee4ee14d899dcc750df92de12bad4bacf81efa1ae12ee76406804dda7f::vault::MagicCoin';
|
14
|
+
exports.suiStackedParentId = '0x02acbf5d6e48bced367c43ca121da29c05fd9a207c0d8aa4552d553f189e6700';
|
15
|
+
exports.usdcStackedParentId = '0x81b17a30ed130e0d1f400678f07cf07578e3ee31c7d208656d71cfd56ac0fe94';
|
16
|
+
exports.suiIncentiveUserType = '0x2f73c04ded344fd4e2530ec8012a7cffdc17cbb049559f3196c030f58c3a0cdd::sui_incentive::User';
|
17
|
+
exports.stackedSavingsParentIds = [
|
18
|
+
exports.suiStackedParentId,
|
19
|
+
exports.usdcStackedParentId
|
20
|
+
];
|
21
|
+
exports.dataUrl = `https://app.mole.fi/api/SuiMainnet/data.json`;
|
22
|
+
exports.vaultsPrefix = `${exports.platformId}`;
|
23
|
+
exports.dataKey = 'data';
|
24
|
+
exports.positionsKey = 'positions';
|
25
|
+
//# sourceMappingURL=constants.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/mole/constants.ts"],"names":[],"mappings":";;;AAEa,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,EAAE,sCAAsC;IAC3D,OAAO,EAAE,sBAAsB;IAC/B,OAAO,EAAE,8BAA8B;CACxC,CAAC;AAEW,QAAA,SAAS,GAAG,sFAAsF,CAAC;AACnG,QAAA,kBAAkB,GAAG,oEAAoE,CAAC;AAC1F,QAAA,mBAAmB,GAAG,oEAAoE,CAAC;AAC3F,QAAA,oBAAoB,GAAG,yFAAyF,CAAC;AAEjH,QAAA,uBAAuB,GAAG;IACrC,0BAAkB;IAClB,2BAAmB;CACpB,CAAC;AAEW,QAAA,OAAO,GAAG,8CAA8C,CAAA;AAExD,QAAA,YAAY,GAAG,GAAG,kBAAU,EAAE,CAAC;AAC/B,QAAA,OAAO,GAAG,MAAM,CAAC;AACjB,QAAA,YAAY,GAAG,WAAW,CAAC"}
|
@@ -0,0 +1,49 @@
|
|
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
|
+
if (!process.env['PORTFOLIO_MOLE_API_KEY'])
|
20
|
+
throw Error('PORTFOLIO_MOLE_API_KEY is not defined');
|
21
|
+
const res = yield axios_1.default
|
22
|
+
.get(constants_1.dataUrl, {
|
23
|
+
timeout: 30000,
|
24
|
+
headers: {
|
25
|
+
key: process.env['PORTFOLIO_MOLE_API_KEY'],
|
26
|
+
},
|
27
|
+
})
|
28
|
+
.catch((err) => {
|
29
|
+
throw Error(`MOLE_API ERR: ${err}`);
|
30
|
+
});
|
31
|
+
if (!res) {
|
32
|
+
throw Error(`MOLE_API NO RESPONSE`);
|
33
|
+
}
|
34
|
+
const { data } = res;
|
35
|
+
if (!data || !data.vaults) {
|
36
|
+
throw Error(`MOLE_API MISSING DATA`);
|
37
|
+
}
|
38
|
+
yield cache.setItem(constants_1.dataKey, data, {
|
39
|
+
prefix: constants_1.vaultsPrefix,
|
40
|
+
networkId: portfolio_core_1.NetworkId.sui,
|
41
|
+
});
|
42
|
+
});
|
43
|
+
const job = {
|
44
|
+
id: `${constants_1.platformId}-data`,
|
45
|
+
executor,
|
46
|
+
label: 'normal',
|
47
|
+
};
|
48
|
+
exports.default = job;
|
49
|
+
//# sourceMappingURL=dataJob.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"dataJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/mole/dataJob.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,+DAAuD;AAGvD,2CAAyE;AAGzE,MAAM,QAAQ,GAAgB,CAAO,KAAY,EAAE,EAAE;IACnD,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAC;QACxC,MAAM,KAAK,CAAC,uCAAuC,CAAC,CAAC;IAEvD,MAAM,GAAG,GAAG,MAAM,eAAK;SACpB,GAAG,CAAW,mBAAO,EAAE;QACtB,OAAO,EAAE,KAAK;QACd,OAAO,EAAE;YACP,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAC;SAC3C;KACF,CAAC;SACD,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;QACb,MAAM,KAAK,CAAC,iBAAiB,GAAG,EAAE,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;IAEL,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,MAAM,KAAK,CAAC,sBAAsB,CAAC,CAAC;IACtC,CAAC;IAED,MAAM,EAAE,IAAI,EAAE,GAAG,GAAG,CAAC;IAErB,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;QAC1B,MAAM,KAAK,CAAC,uBAAuB,CAAC,CAAC;IACvC,CAAC;IAED,MAAM,KAAK,CAAC,OAAO,CAAC,mBAAO,EAAE,IAAI,EAAE;QACjC,MAAM,EAAE,wBAAY;QACpB,SAAS,EAAE,0BAAS,CAAC,GAAG;KACzB,CAAC,CAAC;AACL,CAAC,CAAA,CAAC;AAEF,MAAM,GAAG,GAAQ;IACf,EAAE,EAAE,GAAG,sBAAU,OAAO;IACxB,QAAQ;IACR,KAAK,EAAE,QAAQ;CAChB,CAAC;AAEF,kBAAe,GAAG,CAAC"}
|
@@ -0,0 +1,133 @@
|
|
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 constants_1 = require("./constants");
|
17
|
+
const clients_1 = require("../../utils/clients");
|
18
|
+
const aptos_1 = require("../../utils/aptos");
|
19
|
+
const tokenPriceToAssetTokens_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetTokens"));
|
20
|
+
const getDynamicFieldObject_1 = require("../../utils/sui/getDynamicFieldObject");
|
21
|
+
const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
22
|
+
var _a, _b, _c, _d, _e, _f;
|
23
|
+
const client = (0, clients_1.getClientSui)();
|
24
|
+
const [data, coinsBalances, stackedSavings] = yield Promise.all([
|
25
|
+
cache.getItem(constants_1.dataKey, {
|
26
|
+
prefix: constants_1.vaultsPrefix,
|
27
|
+
networkId: portfolio_core_1.NetworkId.sui,
|
28
|
+
}),
|
29
|
+
client.getAllBalances({ owner }),
|
30
|
+
Promise.all(constants_1.stackedSavingsParentIds.map((stackedSavingsParentId) => (0, getDynamicFieldObject_1.getDynamicFieldObject)(client, {
|
31
|
+
parentId: stackedSavingsParentId,
|
32
|
+
name: {
|
33
|
+
type: constants_1.suiIncentiveUserType,
|
34
|
+
value: { address: owner, is_object: false },
|
35
|
+
},
|
36
|
+
}))),
|
37
|
+
]);
|
38
|
+
if (!data || !data.vaults) {
|
39
|
+
return [];
|
40
|
+
}
|
41
|
+
const vaultsMap = new Map();
|
42
|
+
data.vaults.forEach((vault) => {
|
43
|
+
if (!vault)
|
44
|
+
return;
|
45
|
+
vaultsMap.set((0, portfolio_core_1.formatMoveTokenAddress)(vault.baseToken), vault);
|
46
|
+
});
|
47
|
+
const coinsTypes = [];
|
48
|
+
const balances = [];
|
49
|
+
for (let i = 0; i < coinsBalances.length; i++) {
|
50
|
+
const coinBalance = coinsBalances[i];
|
51
|
+
const amountRaw = Number(coinBalance.totalBalance);
|
52
|
+
if (amountRaw === 0)
|
53
|
+
continue;
|
54
|
+
if (!coinBalance.coinType.includes(constants_1.magicCoin))
|
55
|
+
continue;
|
56
|
+
const { keys: parsedType } = (0, aptos_1.parseTypeString)(coinBalance.coinType);
|
57
|
+
if (!parsedType)
|
58
|
+
continue;
|
59
|
+
if (!coinsTypes.includes(parsedType[0].type))
|
60
|
+
coinsTypes.push(parsedType[0].type);
|
61
|
+
balances.push({
|
62
|
+
type: parsedType[0].type,
|
63
|
+
amountRaw,
|
64
|
+
});
|
65
|
+
}
|
66
|
+
for (let i = 0; i < stackedSavings.length; i++) {
|
67
|
+
const stackedSaving = stackedSavings[i];
|
68
|
+
if (!((_b = (_a = stackedSaving.data) === null || _a === void 0 ? void 0 : _a.content) === null || _b === void 0 ? void 0 : _b.fields))
|
69
|
+
continue;
|
70
|
+
const amountRaw = Number(stackedSaving.data.content.fields.value.fields.amount);
|
71
|
+
if (amountRaw === 0)
|
72
|
+
continue;
|
73
|
+
if (!((_d = (_c = stackedSaving.data) === null || _c === void 0 ? void 0 : _c.content) === null || _d === void 0 ? void 0 : _d.type.includes(constants_1.magicCoin)))
|
74
|
+
continue;
|
75
|
+
const parsedTypeString = (0, aptos_1.parseTypeString)((_f = (_e = stackedSaving.data) === null || _e === void 0 ? void 0 : _e.content) === null || _f === void 0 ? void 0 : _f.type);
|
76
|
+
if (!parsedTypeString.keys)
|
77
|
+
continue;
|
78
|
+
const { keys: parsedSubType } = (0, aptos_1.parseTypeString)(parsedTypeString.keys[1].type);
|
79
|
+
if (!parsedSubType)
|
80
|
+
continue;
|
81
|
+
const { keys: parsedSubSubType } = (0, aptos_1.parseTypeString)(parsedSubType[0].type);
|
82
|
+
if (!parsedSubSubType)
|
83
|
+
continue;
|
84
|
+
if (!coinsTypes.includes(parsedSubSubType[0].type))
|
85
|
+
coinsTypes.push(parsedSubSubType[0].type);
|
86
|
+
balances.push({
|
87
|
+
type: parsedSubSubType[0].type,
|
88
|
+
amountRaw,
|
89
|
+
});
|
90
|
+
}
|
91
|
+
const tokenPrices = yield cache.getTokenPricesAsMap(coinsTypes, portfolio_core_1.NetworkId.sui);
|
92
|
+
const liquidities = [];
|
93
|
+
for (let i = 0; i < balances.length; i++) {
|
94
|
+
const coinBalance = balances[i];
|
95
|
+
const tokenPrice = tokenPrices.get((0, portfolio_core_1.formatMoveTokenAddress)(coinBalance.type));
|
96
|
+
if (!tokenPrice)
|
97
|
+
continue;
|
98
|
+
const vault = vaultsMap.get((0, portfolio_core_1.formatMoveTokenAddress)(coinBalance.type));
|
99
|
+
if (!vault)
|
100
|
+
continue;
|
101
|
+
const assets = (0, tokenPriceToAssetTokens_1.default)(coinBalance.type, (Number(coinBalance.amountRaw) / Math.pow(10, tokenPrice.decimals)) *
|
102
|
+
vault.baseTokenPerIbToken, portfolio_core_1.NetworkId.sui, tokenPrice);
|
103
|
+
const assetsValue = (0, portfolio_core_1.getUsdValueSum)(assets.map((a) => a.value));
|
104
|
+
const value = assetsValue;
|
105
|
+
liquidities.push({
|
106
|
+
value,
|
107
|
+
assets,
|
108
|
+
assetsValue,
|
109
|
+
rewardAssets: [],
|
110
|
+
rewardAssetsValue: null,
|
111
|
+
yields: [],
|
112
|
+
});
|
113
|
+
}
|
114
|
+
if (liquidities.length === 0)
|
115
|
+
return [];
|
116
|
+
return [
|
117
|
+
{
|
118
|
+
type: 'liquidity',
|
119
|
+
data: { liquidities },
|
120
|
+
label: 'Staked',
|
121
|
+
networkId: portfolio_core_1.NetworkId.sui,
|
122
|
+
platformId: constants_1.platformId,
|
123
|
+
value: (0, portfolio_core_1.getUsdValueSum)(liquidities.map((liq) => liq.value)),
|
124
|
+
},
|
125
|
+
];
|
126
|
+
});
|
127
|
+
const fetcher = {
|
128
|
+
id: `${constants_1.platformId}-deposits`,
|
129
|
+
networkId: portfolio_core_1.NetworkId.sui,
|
130
|
+
executor,
|
131
|
+
};
|
132
|
+
exports.default = fetcher;
|
133
|
+
//# sourceMappingURL=depositsFetcher.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"depositsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/mole/depositsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAOoC;AAGpC,2CAOqB;AACrB,iDAAmD;AACnD,6CAAoD;AACpD,uGAA+E;AAE/E,iFAA8E;AAE9E,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;;IACtE,MAAM,MAAM,GAAG,IAAA,sBAAY,GAAE,CAAC;IAE9B,MAAM,CAAC,IAAI,EAAE,aAAa,EAAE,cAAc,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QAC9D,KAAK,CAAC,OAAO,CAAsB,mBAAO,EAAE;YAC1C,MAAM,EAAE,wBAAY;YACpB,SAAS,EAAE,0BAAS,CAAC,GAAG;SACzB,CAAC;QACF,MAAM,CAAC,cAAc,CAAC,EAAE,KAAK,EAAE,CAAC;QAChC,OAAO,CAAC,GAAG,CACT,mCAAuB,CAAC,GAAG,CAAC,CAAC,sBAAsB,EAAE,EAAE,CACrD,IAAA,6CAAqB,EAAW,MAAM,EAAE;YACtC,QAAQ,EAAE,sBAAsB;YAChC,IAAI,EAAE;gBACJ,IAAI,EAAE,gCAAoB;gBAC1B,KAAK,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE;aAC5C;SACF,CAAC,CACH,CACF;KACF,CAAC,CA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,EAAE,EAAE;SACX,CAAC,CAAC;IACL,CAAC;IAED,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAExC,OAAO;QACL;YACE,IAAI,EAAE,WAAW;YACjB,IAAI,EAAE,EAAE,WAAW,EAAE;YACrB,KAAK,EAAE,QAAQ;YACf,SAAS,EAAE,0BAAS,CAAC,GAAG;YACxB,UAAU,EAAV,sBAAU;YACV,KAAK,EAAE,IAAA,+BAAc,EAAC,WAAW,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;SAC3D;KACF,CAAC;AACJ,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"}
|
@@ -0,0 +1,132 @@
|
|
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 transactions_1 = require("@mysten/sui.js/transactions");
|
16
|
+
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
17
|
+
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
18
|
+
const constants_1 = require("./constants");
|
19
|
+
const clients_1 = require("../../utils/clients");
|
20
|
+
const helpers_1 = require("./helpers");
|
21
|
+
const tokenPriceToAssetTokens_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetTokens"));
|
22
|
+
const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
23
|
+
const client = (0, clients_1.getClientSui)();
|
24
|
+
const elements = [];
|
25
|
+
const [data, positions] = yield Promise.all([
|
26
|
+
cache.getItem(constants_1.dataKey, {
|
27
|
+
prefix: constants_1.vaultsPrefix,
|
28
|
+
networkId: portfolio_core_1.NetworkId.sui,
|
29
|
+
}),
|
30
|
+
cache.getItem(constants_1.positionsKey, {
|
31
|
+
prefix: constants_1.vaultsPrefix,
|
32
|
+
networkId: portfolio_core_1.NetworkId.sui,
|
33
|
+
}),
|
34
|
+
]);
|
35
|
+
if (!data || !data.farms || !data.vaults || !data.others || !positions)
|
36
|
+
return [];
|
37
|
+
const coinsTypes = data.vaults.map((v) => (0, portfolio_core_1.formatMoveTokenAddress)(v.baseToken));
|
38
|
+
const tokenPrices = yield cache.getTokenPricesAsMap(coinsTypes, portfolio_core_1.NetworkId.sui);
|
39
|
+
const myPositions = positions.filter((position) => position.owner === owner);
|
40
|
+
if (myPositions.length === 0)
|
41
|
+
return [];
|
42
|
+
const liquidities = [];
|
43
|
+
yield Promise.all(myPositions.map((position) => __awaiter(void 0, void 0, void 0, function* () {
|
44
|
+
const positionId = position.id;
|
45
|
+
const positionWorker = position.worker;
|
46
|
+
let farm;
|
47
|
+
let borrowingInterest;
|
48
|
+
data.farms.forEach((f) => {
|
49
|
+
f.borrowingInterests.forEach((b) => {
|
50
|
+
if (b.address === positionWorker) {
|
51
|
+
farm = f;
|
52
|
+
borrowingInterest = b;
|
53
|
+
}
|
54
|
+
});
|
55
|
+
});
|
56
|
+
if (!farm || !borrowingInterest) {
|
57
|
+
return;
|
58
|
+
}
|
59
|
+
const packageObjectId = borrowingInterest.upgradeAddr;
|
60
|
+
const module = 'cetus_clmm_worker';
|
61
|
+
const func = borrowingInterest.isReverse
|
62
|
+
? 'position_info_reverse'
|
63
|
+
: 'position_info';
|
64
|
+
const tx = new transactions_1.TransactionBlock();
|
65
|
+
tx.moveCall({
|
66
|
+
target: `${packageObjectId}::${module}::${func}`,
|
67
|
+
arguments: [
|
68
|
+
tx.object(borrowingInterest.workerInfo),
|
69
|
+
tx.object(data.others.globalStorage),
|
70
|
+
tx.object(borrowingInterest.pool),
|
71
|
+
tx.pure(positionId),
|
72
|
+
],
|
73
|
+
typeArguments: [
|
74
|
+
borrowingInterest.isReverse
|
75
|
+
? farm.symbol1Address
|
76
|
+
: farm.symbol2Address, // baseCoinType
|
77
|
+
borrowingInterest.isReverse
|
78
|
+
? farm.symbol2Address
|
79
|
+
: farm.symbol1Address, // farmingCoinType
|
80
|
+
farm.lpAddress,
|
81
|
+
],
|
82
|
+
});
|
83
|
+
const dir = yield client.devInspectTransactionBlock({
|
84
|
+
sender: '0x7ca96e9760a722923f94e692faa26806b311565dbbfb707ed4f9fc1e336f2c73',
|
85
|
+
transactionBlock: tx,
|
86
|
+
});
|
87
|
+
if (!dir.results || !dir.results[0].returnValues)
|
88
|
+
return;
|
89
|
+
const health = new bignumber_js_1.default((0, helpers_1.serializeReturnValue)(dir.results[0].returnValues[0])).dividedBy(Math.pow(10, (borrowingInterest.isReverse
|
90
|
+
? farm.symbol1Decimals
|
91
|
+
: farm.symbol2Decimals)));
|
92
|
+
const debtValue = new bignumber_js_1.default((0, helpers_1.serializeReturnValue)(dir.results[0].returnValues[1])).dividedBy(Math.pow(10, (borrowingInterest.isReverse
|
93
|
+
? farm.symbol1Decimals
|
94
|
+
: farm.symbol2Decimals)));
|
95
|
+
const equityValue = health.minus(debtValue);
|
96
|
+
// const leverage = health.dividedBy(equityValue);
|
97
|
+
// const debtRatio = debtValue.dividedBy(health);
|
98
|
+
const assets = [];
|
99
|
+
assets.push(...(0, tokenPriceToAssetTokens_1.default)(farm.symbol1Address, borrowingInterest.isReverse ? equityValue.toNumber() : 0, portfolio_core_1.NetworkId.sui, tokenPrices.get((0, portfolio_core_1.formatMoveTokenAddress)(farm.symbol1Address))));
|
100
|
+
assets.push(...(0, tokenPriceToAssetTokens_1.default)(farm.symbol2Address, borrowingInterest.isReverse ? 0 : equityValue.toNumber(), portfolio_core_1.NetworkId.sui, tokenPrices.get((0, portfolio_core_1.formatMoveTokenAddress)(farm.symbol2Address))));
|
101
|
+
const assetsValue = (0, portfolio_core_1.getUsdValueSum)(assets.map((a) => a.value));
|
102
|
+
const value = assetsValue;
|
103
|
+
liquidities.push({
|
104
|
+
value,
|
105
|
+
assets,
|
106
|
+
assetsValue,
|
107
|
+
rewardAssets: [],
|
108
|
+
rewardAssetsValue: null,
|
109
|
+
yields: [],
|
110
|
+
});
|
111
|
+
})));
|
112
|
+
if (liquidities.length === 0)
|
113
|
+
return [];
|
114
|
+
elements.push({
|
115
|
+
networkId: portfolio_core_1.NetworkId.sui,
|
116
|
+
platformId: constants_1.platformId,
|
117
|
+
type: portfolio_core_1.PortfolioElementType.liquidity,
|
118
|
+
label: 'Leverage',
|
119
|
+
value: (0, portfolio_core_1.getUsdValueSum)(liquidities.map((l) => l.value)),
|
120
|
+
data: {
|
121
|
+
liquidities,
|
122
|
+
},
|
123
|
+
});
|
124
|
+
return elements;
|
125
|
+
});
|
126
|
+
const fetcher = {
|
127
|
+
id: `${constants_1.platformId}-farms`,
|
128
|
+
networkId: portfolio_core_1.NetworkId.sui,
|
129
|
+
executor,
|
130
|
+
};
|
131
|
+
exports.default = fetcher;
|
132
|
+
//# sourceMappingURL=farmsFetcher.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"farmsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/mole/farmsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,8DAA+D;AAC/D,+DASoC;AACpC,gEA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KAAK,CAAC,CAAC;QACtD,IAAI,EAAE;YACJ,WAAW;SACZ;KACF,CAAC,CAAC;IAEH,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,QAAQ;IACzB,SAAS,EAAE,0BAAS,CAAC,GAAG;IACxB,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|
@@ -0,0 +1,52 @@
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
+
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
13
|
+
const constants_1 = require("./constants");
|
14
|
+
const clients_1 = require("../../utils/clients");
|
15
|
+
const multiGetObjects_1 = require("../../utils/sui/multiGetObjects");
|
16
|
+
const getDynamicFieldObjects_1 = require("../../utils/sui/getDynamicFieldObjects");
|
17
|
+
const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
18
|
+
const data = yield cache.getItem(constants_1.dataKey, {
|
19
|
+
prefix: constants_1.vaultsPrefix,
|
20
|
+
networkId: portfolio_core_1.NetworkId.sui,
|
21
|
+
});
|
22
|
+
if (!data || !data.farms || !data.vaults || !data.others)
|
23
|
+
return;
|
24
|
+
const client = (0, clients_1.getClientSui)();
|
25
|
+
const vaultInfos = yield (0, multiGetObjects_1.multiGetObjects)(client, data.vaults.map((v) => v.vaultInfo));
|
26
|
+
const positionObjectIds = [];
|
27
|
+
vaultInfos.forEach((vaultInfo) => {
|
28
|
+
var _a, _b, _c, _d;
|
29
|
+
if ((_b = (_a = vaultInfo.data) === null || _a === void 0 ? void 0 : _a.content) === null || _b === void 0 ? void 0 : _b.fields.value.fields.positions.fields.id.id)
|
30
|
+
positionObjectIds.push((_d = (_c = vaultInfo.data) === null || _c === void 0 ? void 0 : _c.content) === null || _d === void 0 ? void 0 : _d.fields.value.fields.positions.fields.id.id);
|
31
|
+
});
|
32
|
+
const positionsByVault = yield Promise.all(positionObjectIds.map((positionObjectId) => (0, getDynamicFieldObjects_1.getDynamicFieldObjects)(client, positionObjectId)));
|
33
|
+
const positions = positionsByVault.flat().map((position) => {
|
34
|
+
var _a, _b, _c, _d, _e, _f;
|
35
|
+
return ({
|
36
|
+
id: (_b = (_a = position.data) === null || _a === void 0 ? void 0 : _a.content) === null || _b === void 0 ? void 0 : _b.fields.name,
|
37
|
+
owner: (_d = (_c = position.data) === null || _c === void 0 ? void 0 : _c.content) === null || _d === void 0 ? void 0 : _d.fields.value.fields.owner,
|
38
|
+
worker: (_f = (_e = position.data) === null || _e === void 0 ? void 0 : _e.content) === null || _f === void 0 ? void 0 : _f.fields.value.fields.worker,
|
39
|
+
});
|
40
|
+
});
|
41
|
+
yield cache.setItem(constants_1.positionsKey, positions, {
|
42
|
+
prefix: constants_1.vaultsPrefix,
|
43
|
+
networkId: portfolio_core_1.NetworkId.sui,
|
44
|
+
});
|
45
|
+
});
|
46
|
+
const job = {
|
47
|
+
id: `${constants_1.platformId}-farms`,
|
48
|
+
executor,
|
49
|
+
label: 'realtime',
|
50
|
+
};
|
51
|
+
exports.default = job;
|
52
|
+
//# sourceMappingURL=farmsJob.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"farmsJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/mole/farmsJob.ts"],"names":[],"mapp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,CACF,CAAC;IAEF,MAAM,SAAS,GAAG,gBAAgB,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE;;QAAC,OAAA,CAAC;YAC3D,EAAE,EAAE,MAAA,MAAA,QAAQ,CAAC,IAAI,0CAAE,OAAO,0CAAE,MAAM,CAAC,IAAI;YACvC,KAAK,EAAE,MAAA,MAAA,QAAQ,CAAC,IAAI,0CAAE,OAAO,0CAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK;YACxD,MAAM,EAAE,MAAA,MAAA,QAAQ,CAAC,IAAI,0CAAE,OAAO,0CAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM;SAC3D,CAAC,CAAA;KAAA,CAAC,CAAC;IAEJ,MAAM,KAAK,CAAC,OAAO,CAAC,wBAAY,EAAE,SAAS,EAAE;QAC3C,MAAM,EAAE,wBAAY;QACpB,SAAS,EAAE,0BAAS,CAAC,GAAG;KACzB,CAAC,CAAC;AACL,CAAC,CAAA,CAAC;AAEF,MAAM,GAAG,GAAQ;IACf,EAAE,EAAE,GAAG,sBAAU,QAAQ;IACzB,QAAQ;IACR,KAAK,EAAE,UAAU;CAClB,CAAC;AACF,kBAAe,GAAG,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare const serializeReturnValue: (e: any) => any;
|
@@ -0,0 +1,15 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.serializeReturnValue = void 0;
|
4
|
+
const bcs_1 = require("@mysten/bcs");
|
5
|
+
const bcs = new bcs_1.BCS((0, bcs_1.getSuiMoveConfig)());
|
6
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
7
|
+
const serializeReturnValue = (e) => {
|
8
|
+
let t = e[0];
|
9
|
+
if (t instanceof Array)
|
10
|
+
t = Uint8Array.from(t);
|
11
|
+
const n = bcs.de(e[1], t);
|
12
|
+
return e[1] === 'u64' ? BigInt(n) : n;
|
13
|
+
};
|
14
|
+
exports.serializeReturnValue = serializeReturnValue;
|
15
|
+
//# sourceMappingURL=helpers.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/mole/helpers.ts"],"names":[],"mappings":";;;AAAA,qCAAoD;AAEpD,MAAM,GAAG,GAAG,IAAI,SAAG,CAAC,IAAA,sBAAgB,GAAE,CAAC,CAAC;AAExC,8DAA8D;AACvD,MAAM,oBAAoB,GAAG,CAAC,CAAM,EAAE,EAAE;IAC7C,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAEb,IAAI,CAAC,YAAY,KAAK;QAAE,CAAC,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAE/C,MAAM,CAAC,GAAG,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC1B,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACxC,CAAC,CAAC;AAPW,QAAA,oBAAoB,wBAO/B"}
|
@@ -0,0 +1,15 @@
|
|
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 depositsFetcher_1 = __importDefault(require("./depositsFetcher"));
|
9
|
+
const farmsFetcher_1 = __importDefault(require("./farmsFetcher"));
|
10
|
+
const farmsJob_1 = __importDefault(require("./farmsJob"));
|
11
|
+
const dataJob_1 = __importDefault(require("./dataJob"));
|
12
|
+
exports.platforms = [constants_1.platform];
|
13
|
+
exports.jobs = [dataJob_1.default, farmsJob_1.default];
|
14
|
+
exports.fetchers = [depositsFetcher_1.default, farmsFetcher_1.default];
|
15
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/mole/index.ts"],"names":[],"mappings":";;;;;;AAGA,2CAAuC;AACvC,wEAAgD;AAChD,kEAA0C;AAC1C,0DAAkC;AAClC,wDAAgC;AAEnB,QAAA,SAAS,GAAe,CAAC,oBAAQ,CAAC,CAAC;AACnC,QAAA,IAAI,GAAU,CAAC,iBAAO,EAAE,kBAAQ,CAAC,CAAC;AAClC,QAAA,QAAQ,GAAc,CAAC,yBAAe,EAAE,sBAAY,CAAC,CAAC"}
|
@@ -0,0 +1,68 @@
|
|
1
|
+
export type Vault = {
|
2
|
+
vaultInfo: string;
|
3
|
+
baseDecimals: number;
|
4
|
+
baseToken: string;
|
5
|
+
baseTokenPerIbToken: number;
|
6
|
+
};
|
7
|
+
export type UserInfo = {
|
8
|
+
value: {
|
9
|
+
fields: {
|
10
|
+
amount: number;
|
11
|
+
};
|
12
|
+
type: string;
|
13
|
+
};
|
14
|
+
};
|
15
|
+
export type MoleData = {
|
16
|
+
vaults: Vault[];
|
17
|
+
farms: Farm[];
|
18
|
+
others: {
|
19
|
+
globalStorage: string;
|
20
|
+
};
|
21
|
+
};
|
22
|
+
export type Farm = {
|
23
|
+
symbol1Address: string;
|
24
|
+
symbol1Decimals: number;
|
25
|
+
symbol2Address: string;
|
26
|
+
symbol2Decimals: number;
|
27
|
+
lpAddress: string;
|
28
|
+
borrowingInterests: BorrowingInterest[];
|
29
|
+
};
|
30
|
+
export type BorrowingInterest = {
|
31
|
+
address: string;
|
32
|
+
isReverse: boolean;
|
33
|
+
upgradeAddr: string;
|
34
|
+
workerInfo: string;
|
35
|
+
pool: string;
|
36
|
+
};
|
37
|
+
export type VaultInfo = {
|
38
|
+
value: {
|
39
|
+
fields: {
|
40
|
+
positions: {
|
41
|
+
fields: {
|
42
|
+
id: {
|
43
|
+
id: string;
|
44
|
+
};
|
45
|
+
};
|
46
|
+
};
|
47
|
+
};
|
48
|
+
};
|
49
|
+
};
|
50
|
+
export type PositionInfo = {
|
51
|
+
id: {
|
52
|
+
id: string;
|
53
|
+
};
|
54
|
+
name: string;
|
55
|
+
value: {
|
56
|
+
fields: {
|
57
|
+
debt_share: string;
|
58
|
+
owner: string;
|
59
|
+
worker: string;
|
60
|
+
};
|
61
|
+
type: string;
|
62
|
+
};
|
63
|
+
};
|
64
|
+
export type PositionSummary = {
|
65
|
+
id: string;
|
66
|
+
owner: string;
|
67
|
+
worker: string;
|
68
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/mole/types.ts"],"names":[],"mappings":""}
|
@@ -18,6 +18,7 @@ const constants_1 = require("./constants");
|
|
18
18
|
const clients_1 = require("../../utils/clients");
|
19
19
|
const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetToken"));
|
20
20
|
const getDynamicFieldObject_1 = require("../../utils/sui/getDynamicFieldObject");
|
21
|
+
const getAvailableRewards_1 = require("./getAvailableRewards");
|
21
22
|
const amountFactor = new bignumber_js_1.default(Math.pow(10, 36));
|
22
23
|
const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
23
24
|
var _a, _b, _c, _d;
|
@@ -34,7 +35,10 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
34
35
|
});
|
35
36
|
if (!reservesData)
|
36
37
|
return [];
|
37
|
-
const tokenPrices = yield
|
38
|
+
const [tokenPrices, rewards] = yield Promise.all([
|
39
|
+
cache.getTokenPricesAsMap(reservesData.map((r) => r.value.fields.coin_type), portfolio_core_1.NetworkId.sui),
|
40
|
+
(0, getAvailableRewards_1.getAvailableRewards)(client, owner),
|
41
|
+
]);
|
38
42
|
for (const rData of reservesData) {
|
39
43
|
const borrowBalancePromise = (0, getDynamicFieldObject_1.getDynamicFieldObject)(client, {
|
40
44
|
parentId: rData.value.fields.borrow_balance.fields.user_state.fields.id.id,
|
@@ -92,7 +96,19 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
92
96
|
}
|
93
97
|
}
|
94
98
|
}
|
95
|
-
if (
|
99
|
+
if (rewards.size > 0) {
|
100
|
+
rewards.forEach((amount, coinType) => {
|
101
|
+
const tokenPrice = tokenPrices.get((0, portfolio_core_1.formatTokenAddress)(coinType, portfolio_core_1.NetworkId.sui));
|
102
|
+
if (tokenPrice) {
|
103
|
+
rewardAssets.push((0, tokenPriceToAssetToken_1.default)(coinType, new bignumber_js_1.default(amount)
|
104
|
+
.dividedBy(Math.pow(10, tokenPrice.decimals))
|
105
|
+
.toNumber(), portfolio_core_1.NetworkId.sui, tokenPrice));
|
106
|
+
}
|
107
|
+
});
|
108
|
+
}
|
109
|
+
if (suppliedAssets.length === 0 &&
|
110
|
+
borrowedAssets.length === 0 &&
|
111
|
+
rewardAssets.length === 0)
|
96
112
|
return [];
|
97
113
|
const { borrowedValue, suppliedValue, value, healthRatio, rewardValue } = (0, portfolio_core_1.getElementLendingValues)(suppliedAssets, borrowedAssets, rewardAssets, suppliedLtvs);
|
98
114
|
const element = {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"collateralFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/navi/collateralFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DASoC;AACpC,gEAAqC;AAGrC,2CAKqB;AACrB,iDAAmD;AACnD,qGAA6E;AAE7E,iFAA8E;
|
1
|
+
{"version":3,"file":"collateralFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/navi/collateralFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DASoC;AACpC,gEAAqC;AAGrC,2CAKqB;AACrB,iDAAmD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U,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;IACF,OAAO,CAAC,OAAO,CAAC,CAAC;AACnB,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,aAAa;IAC9B,SAAS,EAAE,0BAAS,CAAC,GAAG;IACxB,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|
@@ -14,3 +14,24 @@ export declare const poolsInfos: {
|
|
14
14
|
borrowBalanceParentId: string;
|
15
15
|
supplyBalanceParentId: string;
|
16
16
|
}[];
|
17
|
+
export declare const rewardsFunds: {
|
18
|
+
f975bc2d4cca10e3ace8887e20afd77b46c383b4465eac694c4688344955dea4: {
|
19
|
+
coinType: string;
|
20
|
+
oracleId: number;
|
21
|
+
};
|
22
|
+
e2b5ada45273676e0da8ae10f8fe079a7cec3d0f59187d3d20b1549c275b07ea: {
|
23
|
+
coinType: string;
|
24
|
+
oracleId: number;
|
25
|
+
};
|
26
|
+
a20e18085ce04be8aa722fbe85423f1ad6b1ae3b1be81ffac00a30f1d6d6ab51: {
|
27
|
+
coinType: string;
|
28
|
+
oracleId: number;
|
29
|
+
};
|
30
|
+
'9dae0cf104a193217904f88a48ce2cf0221e8cd9073878edd05101d6b771fa09': {
|
31
|
+
coinType: string;
|
32
|
+
oracleId: number;
|
33
|
+
};
|
34
|
+
};
|
35
|
+
export declare const incentiveFunction = "0x64372b54147adb0ac8a603adab92c81e3d732c8cafafa368d8f3ff9dcb6a53af::incentive_getter::get_incentive_pools_group_by_phase";
|
36
|
+
export declare const incentiveObjectId = "0xf87a8acb8b81d14307894d12595541a73f19933f88e1326d5be349c7a6f7559c";
|
37
|
+
export declare const incentiveStorageObjectId = "0xbb4e2f4b6205c2e2a2db47aeb4f830796ec7c005f88537ee775986639bc442fe";
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.poolsInfos = exports.rateFactor = exports.reserveParentId = exports.reservesKey = exports.reservesPrefix = exports.platform = exports.platformId = void 0;
|
3
|
+
exports.incentiveStorageObjectId = exports.incentiveObjectId = exports.incentiveFunction = exports.rewardsFunds = exports.poolsInfos = exports.rateFactor = exports.reserveParentId = exports.reservesKey = exports.reservesPrefix = exports.platform = exports.platformId = void 0;
|
4
4
|
exports.platformId = 'navi';
|
5
5
|
exports.platform = {
|
6
6
|
id: exports.platformId,
|
@@ -61,4 +61,25 @@ exports.poolsInfos = [
|
|
61
61
|
supplyBalanceParentId: '0x6adc72faf2a9a15a583c9fb04f457c6a5f0b456bc9b4832413a131dfd4faddae',
|
62
62
|
},
|
63
63
|
];
|
64
|
+
exports.rewardsFunds = {
|
65
|
+
f975bc2d4cca10e3ace8887e20afd77b46c383b4465eac694c4688344955dea4: {
|
66
|
+
coinType: '0x2::sui::SUI',
|
67
|
+
oracleId: 0,
|
68
|
+
},
|
69
|
+
e2b5ada45273676e0da8ae10f8fe079a7cec3d0f59187d3d20b1549c275b07ea: {
|
70
|
+
coinType: '0x549e8b69270defbfafd4f94e17ec44cdbdd99820b33bda2278dea3b9a32d3f55::cert::CERT',
|
71
|
+
oracleId: 5,
|
72
|
+
},
|
73
|
+
a20e18085ce04be8aa722fbe85423f1ad6b1ae3b1be81ffac00a30f1d6d6ab51: {
|
74
|
+
coinType: '0xbde4ba4c2e274a60ce15c1cfff9e5c42e41654ac8b6d906a57efa4bd3c29f47d::hasui::HASUI',
|
75
|
+
oracleId: 6,
|
76
|
+
},
|
77
|
+
'9dae0cf104a193217904f88a48ce2cf0221e8cd9073878edd05101d6b771fa09': {
|
78
|
+
coinType: '0xa99b8952d4f7d947ea77fe0ecdcc9e5fc0bcab2841d6e2a5aa00c3044e5544b5::navx::NAVX',
|
79
|
+
oracleId: 7,
|
80
|
+
},
|
81
|
+
};
|
82
|
+
exports.incentiveFunction = '0x64372b54147adb0ac8a603adab92c81e3d732c8cafafa368d8f3ff9dcb6a53af::incentive_getter::get_incentive_pools_group_by_phase';
|
83
|
+
exports.incentiveObjectId = '0xf87a8acb8b81d14307894d12595541a73f19933f88e1326d5be349c7a6f7559c';
|
84
|
+
exports.incentiveStorageObjectId = '0xbb4e2f4b6205c2e2a2db47aeb4f830796ec7c005f88537ee775986639bc442fe';
|
64
85
|
//# sourceMappingURL=constants.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/navi/constants.ts"],"names":[],"mappings":";;;AAEa,QAAA,UAAU,GAAG,MAAM,CAAC;AACpB,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,qCAAqC,kBAAU,MAAM;IAC5D,WAAW,EAAE,sBAAsB;IACnC,OAAO,EAAE,8BAA8B;IACvC,OAAO,EAAE,mCAAmC;CAC7C,CAAC;AAEW,QAAA,cAAc,GAAG,kBAAU,CAAC;AAC5B,QAAA,WAAW,GAAG,UAAU,CAAC;AAEzB,QAAA,eAAe,GAC1B,oEAAoE,CAAC;AAE1D,QAAA,UAAU,GAAG,EAAE,CAAC;AAEhB,QAAA,UAAU,GAAG;IACxB;QACE,EAAE,EAAE,CAAC;QACL,IAAI,EAAE,KAAK;QACX,IAAI,EAAE,8EAA8E;QACpF,WAAW,EACT,oEAAoE;QACtE,IAAI,EAAE,oEAAoE;QAC1E,qBAAqB,EACnB,oEAAoE;QACtE,qBAAqB,EACnB,oEAAoE;KACvE;IACD;QACE,EAAE,EAAE,CAAC;QACL,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,gFAAgF;QACtF,WAAW,EACT,oEAAoE;QACtE,IAAI,EAAE,oEAAoE;QAC1E,qBAAqB,EACnB,oEAAoE;QACtE,qBAAqB,EACnB,oEAAoE;KACvE;IACD;QACE,EAAE,EAAE,CAAC;QACL,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,gFAAgF;QACtF,WAAW,EACT,oEAAoE;QACtE,IAAI,EAAE,EAAE;QACR,qBAAqB,EACnB,oEAAoE;QACtE,qBAAqB,EACnB,oEAAoE;KACvE;IACD;QACE,EAAE,EAAE,CAAC;QACL,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,gFAAgF;QACtF,IAAI,EAAE,oEAAoE;QAC1E,WAAW,EACT,oEAAoE;QACtE,qBAAqB,EACnB,oEAAoE;QACtE,qBAAqB,EACnB,oEAAoE;KACvE;IACD;QACE,EAAE,EAAE,CAAC;QACL,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,kFAAkF;QACxF,IAAI,EAAE,oEAAoE;QAC1E,WAAW,EACT,oEAAoE;QACtE,qBAAqB,EACnB,oEAAoE;QACtE,qBAAqB,EACnB,oEAAoE;KACvE;CACF,CAAC"}
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/navi/constants.ts"],"names":[],"mappings":";;;AAEa,QAAA,UAAU,GAAG,MAAM,CAAC;AACpB,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,qCAAqC,kBAAU,MAAM;IAC5D,WAAW,EAAE,sBAAsB;IACnC,OAAO,EAAE,8BAA8B;IACvC,OAAO,EAAE,mCAAmC;CAC7C,CAAC;AAEW,QAAA,cAAc,GAAG,kBAAU,CAAC;AAC5B,QAAA,WAAW,GAAG,UAAU,CAAC;AAEzB,QAAA,eAAe,GAC1B,oEAAoE,CAAC;AAE1D,QAAA,UAAU,GAAG,EAAE,CAAC;AAEhB,QAAA,UAAU,GAAG;IACxB;QACE,EAAE,EAAE,CAAC;QACL,IAAI,EAAE,KAAK;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AQ,EAAE,CAAC;KACZ;CACF,CAAC;AAEW,QAAA,iBAAiB,GAC5B,0HAA0H,CAAC;AAChH,QAAA,iBAAiB,GAC5B,oEAAoE,CAAC;AAC1D,QAAA,wBAAwB,GACnC,oEAAoE,CAAC"}
|
@@ -0,0 +1,109 @@
|
|
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
|
+
exports.getAvailableRewards = void 0;
|
16
|
+
const transactions_1 = require("@mysten/sui.js/transactions");
|
17
|
+
const bcs_1 = require("@mysten/bcs");
|
18
|
+
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
19
|
+
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
20
|
+
const constants_1 = require("./constants");
|
21
|
+
const bcs = new bcs_1.BCS((0, bcs_1.getSuiMoveConfig)());
|
22
|
+
bcs.registerStructType('IncentivePoolInfo', {
|
23
|
+
pool_id: 'address',
|
24
|
+
funds: 'address',
|
25
|
+
phase: 'u64',
|
26
|
+
start_at: 'u64',
|
27
|
+
end_at: 'u64',
|
28
|
+
closed_at: 'u64',
|
29
|
+
total_supply: 'u64',
|
30
|
+
asset_id: 'u8',
|
31
|
+
option: 'u8',
|
32
|
+
factor: 'u256',
|
33
|
+
distributed: 'u64',
|
34
|
+
available: 'u256',
|
35
|
+
total: 'u256',
|
36
|
+
});
|
37
|
+
bcs.registerStructType('IncentivePoolInfoByPhase', {
|
38
|
+
phase: 'u64',
|
39
|
+
pools: 'vector<IncentivePoolInfo>',
|
40
|
+
});
|
41
|
+
function getSupplyRewardsTransactionBlock(owner) {
|
42
|
+
const tx = new transactions_1.TransactionBlock();
|
43
|
+
tx.moveCall({
|
44
|
+
target: constants_1.incentiveFunction,
|
45
|
+
arguments: [
|
46
|
+
tx.object(portfolio_core_1.suiClockAddress),
|
47
|
+
tx.object(constants_1.incentiveObjectId),
|
48
|
+
tx.object(constants_1.incentiveStorageObjectId),
|
49
|
+
tx.pure(0),
|
50
|
+
tx.pure(1),
|
51
|
+
tx.pure(owner),
|
52
|
+
],
|
53
|
+
});
|
54
|
+
return tx;
|
55
|
+
}
|
56
|
+
function getBorrowRewardsTransactionBlock(owner) {
|
57
|
+
const tx = new transactions_1.TransactionBlock();
|
58
|
+
tx.moveCall({
|
59
|
+
target: constants_1.incentiveFunction,
|
60
|
+
arguments: [
|
61
|
+
tx.object(portfolio_core_1.suiClockAddress),
|
62
|
+
tx.object(constants_1.incentiveObjectId),
|
63
|
+
tx.object(constants_1.incentiveStorageObjectId),
|
64
|
+
tx.pure(1),
|
65
|
+
tx.pure(3),
|
66
|
+
tx.pure(owner),
|
67
|
+
],
|
68
|
+
});
|
69
|
+
return tx;
|
70
|
+
}
|
71
|
+
function getRewardPoolsData(client, tx, owner) {
|
72
|
+
return __awaiter(this, void 0, void 0, function* () {
|
73
|
+
const rewardsPoolsInfos = yield client.devInspectTransactionBlock({
|
74
|
+
transactionBlock: tx,
|
75
|
+
sender: owner,
|
76
|
+
});
|
77
|
+
if (rewardsPoolsInfos.results && rewardsPoolsInfos.results[0].returnValues) {
|
78
|
+
const o = rewardsPoolsInfos.results[0].returnValues;
|
79
|
+
return o
|
80
|
+
.map((e) => bcs.de('vector<IncentivePoolInfoByPhase>', Uint8Array.from(e[0])))
|
81
|
+
.flat()
|
82
|
+
.sort((e, n) => Number(n.phase) - Number(e.phase));
|
83
|
+
}
|
84
|
+
return [];
|
85
|
+
});
|
86
|
+
}
|
87
|
+
function getAvailableRewards(client, owner) {
|
88
|
+
return __awaiter(this, void 0, void 0, function* () {
|
89
|
+
const [supplyRewardPoolsData, borrowRewardPoolsData] = yield Promise.all([
|
90
|
+
getRewardPoolsData(client, getSupplyRewardsTransactionBlock(owner), owner),
|
91
|
+
getRewardPoolsData(client, getBorrowRewardsTransactionBlock(owner), owner),
|
92
|
+
]);
|
93
|
+
const rewards = new Map();
|
94
|
+
const browseRewardPoolData = (e) => {
|
95
|
+
e.pools.forEach((pool) => {
|
96
|
+
const funds = pool.funds;
|
97
|
+
const { coinType } = constants_1.rewardsFunds[funds];
|
98
|
+
const aggAmount = rewards.get(coinType) || 0;
|
99
|
+
rewards.set(coinType, aggAmount +
|
100
|
+
new bignumber_js_1.default(pool.available).shiftedBy(-1 * constants_1.rateFactor).toNumber());
|
101
|
+
});
|
102
|
+
};
|
103
|
+
supplyRewardPoolsData.forEach(browseRewardPoolData);
|
104
|
+
borrowRewardPoolsData.forEach(browseRewardPoolData);
|
105
|
+
return rewards;
|
106
|
+
});
|
107
|
+
}
|
108
|
+
exports.getAvailableRewards = getAvailableRewards;
|
109
|
+
//# sourceMappingURL=getAvailableRewards.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"getAvailableRewards.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/navi/getAvailableRewards.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,8DAA+D;AAC/D,qCAAoD;AACpD,gEAAqC;AACrC,+DAA6D;AAE7D,2CAMqB;AAGrB,MAAM,GAAG,GAAG,IAAI,SAAG,CAAC,IAAA,sBAAgB,GAAE,CAAC,CAAC;AAExC,GAAG,CAAC,kBAAkB,CAAC,mBAAmB,EAAE;IAC1C,OAAO,EAAE,SAAS;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