@sonarwatch/portfolio-plugins 0.11.118 → 0.11.120
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +1203 -1195
- package/README.md +3 -3
- package/package.json +2 -2
- package/src/plugins/abex/constants.d.ts +2 -0
- package/src/plugins/abex/constants.js +3 -1
- package/src/plugins/abex/constants.js.map +1 -1
- package/src/plugins/abex/marketsJob.js +13 -4
- package/src/plugins/abex/marketsJob.js.map +1 -1
- package/src/plugins/abex/positionsFetcher.js +32 -7
- package/src/plugins/abex/positionsFetcher.js.map +1 -1
- package/src/plugins/abex/types.d.ts +13 -0
- package/src/plugins/balancer/helpers/pools.js +21 -21
- package/src/plugins/jupiter/voteFetcher.js +2 -1
- package/src/plugins/jupiter/voteFetcher.js.map +1 -1
- package/src/plugins/suilend/constants.d.ts +1 -0
- package/src/plugins/suilend/constants.js +2 -1
- package/src/plugins/suilend/constants.js.map +1 -1
- package/src/plugins/suilend/helpers.js.map +1 -1
- package/src/plugins/suilend/marketsJob.js +0 -19
- package/src/plugins/suilend/marketsJob.js.map +1 -1
- package/src/plugins/suilend/obligationsFetcher.js +14 -38
- package/src/plugins/suilend/obligationsFetcher.js.map +1 -1
- package/src/plugins/sushiswap/helpers.js +24 -24
- package/src/plugins/uniswap-v2/helpers.js +22 -22
- package/src/utils/sei/constants.js +8 -8
- package/src/utils/sei/getQueryBalanceByOwner.js +4 -4
package/README.md
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
# @sonarwatch/portfolio-plugins
|
2
|
-
|
3
|
-
This library is @sonarwatch/portfolio-plugins
|
1
|
+
# @sonarwatch/portfolio-plugins
|
2
|
+
|
3
|
+
This library is @sonarwatch/portfolio-plugins
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@sonarwatch/portfolio-plugins",
|
3
|
-
"version": "0.11.
|
3
|
+
"version": "0.11.120",
|
4
4
|
"type": "commonjs",
|
5
5
|
"generators": "./generators.json",
|
6
6
|
"dependencies": {
|
@@ -41,7 +41,7 @@
|
|
41
41
|
"web3-v1": "npm:web3@^1.5.0"
|
42
42
|
},
|
43
43
|
"peerDependencies": {
|
44
|
-
"@sonarwatch/portfolio-core": "0.11.
|
44
|
+
"@sonarwatch/portfolio-core": "0.11.120"
|
45
45
|
},
|
46
46
|
"main": "./src/index.js",
|
47
47
|
"types": "./src/index.d.ts"
|
@@ -5,3 +5,5 @@ export declare const alpType = "0xceab84acf6bf70f503c3b0627acaff6b3f84cee0f2d7ed
|
|
5
5
|
export declare const alpDecimals = 6;
|
6
6
|
export declare const depositVaultRegistry = "0x3c6595e543c4766dd63b5b2fa918516bac2920bc1944da068be031dced46a18d";
|
7
7
|
export declare const alpSupplyObjectId = "0x7705d4670e7ef4623d6392888f73f6773b5f0218b6cb1486a4be238692a58bca";
|
8
|
+
export declare const poolObjectId = "0x9a1c1130b6c8c6b465397ef8a99b2917c5a7a957df98cb4812212674aa971f63";
|
9
|
+
export declare const poolAccRewardPerShareKey = "accRewardPerShare";
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.alpSupplyObjectId = exports.depositVaultRegistry = exports.alpDecimals = exports.alpType = exports.platform = exports.platformId = void 0;
|
3
|
+
exports.poolAccRewardPerShareKey = exports.poolObjectId = exports.alpSupplyObjectId = exports.depositVaultRegistry = exports.alpDecimals = exports.alpType = exports.platform = exports.platformId = void 0;
|
4
4
|
exports.platformId = 'abex';
|
5
5
|
exports.platform = {
|
6
6
|
id: exports.platformId,
|
@@ -14,4 +14,6 @@ exports.alpType = '0xceab84acf6bf70f503c3b0627acaff6b3f84cee0f2d7ed53d00fa6c2a16
|
|
14
14
|
exports.alpDecimals = 6;
|
15
15
|
exports.depositVaultRegistry = '0x3c6595e543c4766dd63b5b2fa918516bac2920bc1944da068be031dced46a18d';
|
16
16
|
exports.alpSupplyObjectId = '0x7705d4670e7ef4623d6392888f73f6773b5f0218b6cb1486a4be238692a58bca';
|
17
|
+
exports.poolObjectId = '0x9a1c1130b6c8c6b465397ef8a99b2917c5a7a957df98cb4812212674aa971f63';
|
18
|
+
exports.poolAccRewardPerShareKey = 'accRewardPerShare';
|
17
19
|
//# sourceMappingURL=constants.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/abex/constants.ts"],"names":[],"mappings":";;;AAEa,QAAA,UAAU,GAAG,MAAM,CAAC;AACpB,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,cAAc;IACpB,KAAK,EAAE,6CAA6C;IACpD,OAAO,EAAE,kBAAkB;IAC3B,OAAO,EAAE,iCAAiC;IAC1C,WAAW,EAAE,cAAc,EAAE,sCAAsC;CACpE,CAAC;AAEW,QAAA,OAAO,GAClB,8EAA8E,CAAC;AACpE,QAAA,WAAW,GAAG,CAAC,CAAC;AAChB,QAAA,oBAAoB,GAC/B,oEAAoE,CAAC;AAC1D,QAAA,iBAAiB,GAC5B,oEAAoE,CAAC"}
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/abex/constants.ts"],"names":[],"mappings":";;;AAEa,QAAA,UAAU,GAAG,MAAM,CAAC;AACpB,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,cAAc;IACpB,KAAK,EAAE,6CAA6C;IACpD,OAAO,EAAE,kBAAkB;IAC3B,OAAO,EAAE,iCAAiC;IAC1C,WAAW,EAAE,cAAc,EAAE,sCAAsC;CACpE,CAAC;AAEW,QAAA,OAAO,GAClB,8EAA8E,CAAC;AACpE,QAAA,WAAW,GAAG,CAAC,CAAC;AAChB,QAAA,oBAAoB,GAC/B,oEAAoE,CAAC;AAC1D,QAAA,iBAAiB,GAC5B,oEAAoE,CAAC;AAC1D,QAAA,YAAY,GACvB,oEAAoE,CAAC;AAC1D,QAAA,wBAAwB,GAAG,mBAAmB,CAAC"}
|
@@ -23,10 +23,19 @@ const aptos_1 = require("../../utils/aptos");
|
|
23
23
|
const getObject_1 = require("../../utils/sui/getObject");
|
24
24
|
const constants_2 = require("../tokens/constants");
|
25
25
|
const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
26
|
-
var _a, _b, _c, _d, _e, _f;
|
26
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
27
27
|
const client = (0, clients_1.getClientSui)();
|
28
|
+
// Pool
|
29
|
+
const poolObject = yield (0, getObject_1.getObject)(client, constants_1.poolObjectId);
|
30
|
+
const accRewardPerShare = (_b = (_a = poolObject.data) === null || _a === void 0 ? void 0 : _a.content) === null || _b === void 0 ? void 0 : _b.fields.acc_reward_per_share;
|
31
|
+
if (accRewardPerShare) {
|
32
|
+
yield cache.setItem(constants_1.poolAccRewardPerShareKey, accRewardPerShare, {
|
33
|
+
prefix: constants_1.platformId,
|
34
|
+
networkId: portfolio_core_1.NetworkId.sui,
|
35
|
+
});
|
36
|
+
}
|
28
37
|
const lpObject = yield (0, getObject_1.getObject)(client, constants_1.alpSupplyObjectId);
|
29
|
-
const lpSupply = (
|
38
|
+
const lpSupply = (_d = (_c = lpObject.data) === null || _c === void 0 ? void 0 : _c.content) === null || _d === void 0 ? void 0 : _d.fields.lp_supply.fields.value;
|
30
39
|
if (!lpSupply)
|
31
40
|
return;
|
32
41
|
const depositVaultFields = yield (0, getDynamicFields_1.getDynamicFields)(client, constants_1.depositVaultRegistry);
|
@@ -46,10 +55,10 @@ const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
|
46
55
|
const lpUnderlyings = [];
|
47
56
|
for (let i = 0; i < objects.length; i++) {
|
48
57
|
const object = objects[i];
|
49
|
-
const market = (
|
58
|
+
const market = (_f = (_e = object.data) === null || _e === void 0 ? void 0 : _e.content) === null || _f === void 0 ? void 0 : _f.fields;
|
50
59
|
if (!market)
|
51
60
|
return;
|
52
|
-
const uType = (
|
61
|
+
const uType = (_h = (_g = (0, aptos_1.parseTypeString)(market.value.type).keys) === null || _g === void 0 ? void 0 : _g.at(0)) === null || _h === void 0 ? void 0 : _h.type;
|
53
62
|
if (!uType)
|
54
63
|
return;
|
55
64
|
const tokenPrice = tokenPrices.get((0, portfolio_core_1.formatTokenAddress)(uType, portfolio_core_1.NetworkId.sui));
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"marketsJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/abex/marketsJob.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAA2E;AAC3E,gEAAqC;AAGrC,
|
1
|
+
{"version":3,"file":"marketsJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/abex/marketsJob.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAA2E;AAC3E,gEAAqC;AAGrC,2CAQqB;AACrB,iDAAmD;AACnD,uEAAoE;AAEpE,qEAAkE;AAClE,+FAE8C;AAC9C,6CAAoD;AACpD,yDAAsD;AACtD,mDAA2D;AAE3D,MAAM,QAAQ,GAAgB,CAAO,KAAY,EAAE,EAAE;;IACnD,MAAM,MAAM,GAAG,IAAA,sBAAY,GAAE,CAAC;IAE9B,OAAO;IACP,MAAM,UAAU,GAAG,MAAM,IAAA,qBAAS,EAAO,MAAM,EAAE,wBAAY,CAAC,CAAC;IAC/D,MAAM,iBAAiB,GACrB,MAAA,MAAA,UAAU,CAAC,IAAI,0CAAE,OAAO,0CAAE,MAAM,CAAC,oBAAoB,CAAC;IACxD,IAAI,iBAAiB,EAAE,CAAC;QACtB,MAAM,KAAK,CAAC,OAAO,CAAC,oCAAwB,EAAE,iBAAiB,EAAE;YAC/D,MAAM,EAAE,sBAAU;YAClB,SAAS,EAAE,0BAAS,CAAC,GAAG;SACzB,CAAC,CAAC;IACL,CAAC;IAED,MAAM,QAAQ,GAAG,MAAM,IAAA,qBAAS,EAAY,MAAM,EAAE,6BAAiB,CAAC,CAAC;IACvE,MA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SAAS;QACtB,WAAW,EAAE,SAAS;QACtB,MAAM,EAAE,CAAC;QACT,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;KACtB,CAAC,CAAC;AACL,CAAC,CAAA,CAAC;AACF,MAAM,GAAG,GAAQ;IACf,EAAE,EAAE,GAAG,sBAAU,UAAU;IAC3B,QAAQ;IACR,KAAK,EAAE,QAAQ;CAChB,CAAC;AACF,kBAAe,GAAG,CAAC"}
|
@@ -19,7 +19,7 @@ const clients_1 = require("../../utils/clients");
|
|
19
19
|
const getOwnedObjects_1 = require("../../utils/sui/getOwnedObjects");
|
20
20
|
const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetToken"));
|
21
21
|
const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
22
|
-
var _a, _b;
|
22
|
+
var _a, _b, _c, _d;
|
23
23
|
const client = (0, clients_1.getClientSui)();
|
24
24
|
const objects = yield (0, getOwnedObjects_1.getOwnedObjects)(client, owner, {
|
25
25
|
filter: {
|
@@ -28,13 +28,38 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
28
28
|
});
|
29
29
|
if (objects.length === 0)
|
30
30
|
return [];
|
31
|
-
const alpPrice = yield cache.
|
31
|
+
const [alpPrice, suiPrice] = yield cache.getTokenPrices([constants_1.alpType, portfolio_core_1.suiNativeAddress], portfolio_core_1.NetworkId.sui);
|
32
|
+
const poolAccRewardPerShareStr = yield cache.getItem(constants_1.poolAccRewardPerShareKey, {
|
33
|
+
prefix: constants_1.platformId,
|
34
|
+
networkId: portfolio_core_1.NetworkId.sui,
|
35
|
+
});
|
36
|
+
const poolAccRewardPerShare = poolAccRewardPerShareStr
|
37
|
+
? new bignumber_js_1.default(poolAccRewardPerShareStr)
|
38
|
+
: undefined;
|
32
39
|
let alpAmount = new bignumber_js_1.default(0);
|
40
|
+
let claimmableAmount = new bignumber_js_1.default(0);
|
33
41
|
for (let i = 0; i < objects.length; i++) {
|
34
42
|
const object = objects[i];
|
35
|
-
|
43
|
+
const cAlpAmount = (_b = (_a = object.data) === null || _a === void 0 ? void 0 : _a.content) === null || _b === void 0 ? void 0 : _b.fields.stake;
|
44
|
+
if (!cAlpAmount)
|
45
|
+
continue;
|
46
|
+
alpAmount = alpAmount.plus(cAlpAmount);
|
47
|
+
if (!poolAccRewardPerShare)
|
48
|
+
continue;
|
49
|
+
const accRewardPerShare = (_d = (_c = object.data) === null || _c === void 0 ? void 0 : _c.content) === null || _d === void 0 ? void 0 : _d.fields.acc_reward_per_share;
|
50
|
+
if (!accRewardPerShare)
|
51
|
+
continue;
|
52
|
+
const cClaimmableAmount = poolAccRewardPerShare
|
53
|
+
.minus(accRewardPerShare)
|
54
|
+
.times(cAlpAmount)
|
55
|
+
.div(Math.pow(10, 18));
|
56
|
+
claimmableAmount = claimmableAmount.plus(cClaimmableAmount);
|
36
57
|
}
|
37
58
|
const asset = (0, tokenPriceToAssetToken_1.default)(constants_1.alpType, alpAmount.dividedBy(Math.pow(10, constants_1.alpDecimals)).toNumber(), portfolio_core_1.NetworkId.sui, alpPrice);
|
59
|
+
const rewardAsset = (0, tokenPriceToAssetToken_1.default)(portfolio_core_1.suiNativeAddress, claimmableAmount.dividedBy(Math.pow(10, portfolio_core_1.suiNativeDecimals)).toNumber(), portfolio_core_1.NetworkId.sui, suiPrice);
|
60
|
+
if (claimmableAmount.isZero() && alpAmount.isZero())
|
61
|
+
return [];
|
62
|
+
const value = (0, portfolio_core_1.getUsdValueSum)([rewardAsset.value, asset.value]);
|
38
63
|
const element = {
|
39
64
|
networkId: portfolio_core_1.NetworkId.sui,
|
40
65
|
label: 'Staked',
|
@@ -45,14 +70,14 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
45
70
|
{
|
46
71
|
assets: [asset],
|
47
72
|
assetsValue: asset.value,
|
48
|
-
rewardAssets: [],
|
49
|
-
rewardAssetsValue:
|
50
|
-
value
|
73
|
+
rewardAssets: [rewardAsset],
|
74
|
+
rewardAssetsValue: rewardAsset.value,
|
75
|
+
value,
|
51
76
|
yields: [],
|
52
77
|
},
|
53
78
|
],
|
54
79
|
},
|
55
|
-
value
|
80
|
+
value,
|
56
81
|
};
|
57
82
|
return [element];
|
58
83
|
});
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"positionsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/abex/positionsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+
|
1
|
+
{"version":3,"file":"positionsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/abex/positionsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAMoC;AACpC,gEAAqC;AAErC,2CAKqB;AAErB,iDAAmD;AACnD,qEAAkE;AAElE,qGAA6E;AAE7E,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;;IACtE,MAAM,MAAM,GAAG,IAAA,sBAAY,GAAE,CAAC;IAC9B,MAAM,OAAO,GAAG,MAAM,IAAA,iCAAe,EAAa,MAAM,EAAE,KAAK,EAAE;QAC/D,MAAM,EAAE;YACN,OAAO,EACL,oEAAoE;SACvE;KACF,CAAC,CAAC;IACH,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAEpC,MAAM,CAAC,QAAQ,EAAE,QAAQ,CAAC,GAAG,MAAM,KAAK,CAAC,cAAc,CACrD,CAAC,mBAAO,EAAE,iCAAgB,CAAC,EAC3B,0BAAS,CAAC,GAAG,CACd,CAAC;IACF,MAAM,wBAAwB,GAAG,MAAM,KAAK,CAAC,OAAO,CAClD,oCAAwB,EACxB;QACE,MAAM,EAAE,sBAAU;QAClB,SAAS,EAAE,0BAAS,CAAC,GAAG;KACzB,CACF,CAAC;IACF,MAAM,qBAAqB,GAAG,wBAAwB;QACpD,CAAC,CAAC,IAAI,sBAAS,CAAC,wBAAwB,CAAC;QACzC,CAAC,C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QAAQ,EAAE,EAC9D,0BAAS,CAAC,GAAG,EACb,QAAQ,CACT,CAAC;IAEF,IAAI,gBAAgB,CAAC,MAAM,EAAE,IAAI,SAAS,CAAC,MAAM,EAAE;QAAE,OAAO,EAAE,CAAC;IAC/D,MAAM,KAAK,GAAG,IAAA,+BAAc,EAAC,CAAC,WAAW,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;IAC/D,MAAM,OAAO,GAA8B;QACzC,SAAS,EAAE,0BAAS,CAAC,GAAG;QACxB,KAAK,EAAE,QAAQ;QACf,UAAU,EAAV,sBAAU;QACV,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE;YACJ,WAAW,EAAE;gBACX;oBACE,MAAM,EAAE,CAAC,KAAK,CAAC;oBACf,WAAW,EAAE,KAAK,CAAC,KAAK;oBACxB,YAAY,EAAE,CAAC,WAAW,CAAC;oBAC3B,iBAAiB,EAAE,WAAW,CAAC,KAAK;oBACpC,KAAK;oBACL,MAAM,EAAE,EAAE;iBACX;aACF;SACF;QACD,KAAK;KACN,CAAC;IACF,OAAO,CAAC,OAAO,CAAC,CAAC;AACnB,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,YAAY;IAC7B,SAAS,EAAE,0BAAS,CAAC,GAAG;IACxB,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|
@@ -6,6 +6,19 @@ export type Credential = {
|
|
6
6
|
lock_until: string;
|
7
7
|
stake: string;
|
8
8
|
};
|
9
|
+
export type Pool = {
|
10
|
+
acc_reward_per_share: string;
|
11
|
+
enabled: boolean;
|
12
|
+
end_time: string;
|
13
|
+
id: {
|
14
|
+
id: string;
|
15
|
+
};
|
16
|
+
last_updated_time: string;
|
17
|
+
lock_duration: string;
|
18
|
+
reward: string;
|
19
|
+
staked_amount: string;
|
20
|
+
start_time: string;
|
21
|
+
};
|
9
22
|
export type AlpMarket = {
|
10
23
|
fun_mask: string;
|
11
24
|
id: {
|
@@ -36,27 +36,27 @@ exports.getBalancerPoolsV2 = void 0;
|
|
36
36
|
const graphql_request_1 = __importStar(require("graphql-request"));
|
37
37
|
function getBalancerPoolsV2(url) {
|
38
38
|
return __awaiter(this, void 0, void 0, function* () {
|
39
|
-
const query = (0, graphql_request_1.gql) `
|
40
|
-
query pools {
|
41
|
-
pools(
|
42
|
-
first: 1000
|
43
|
-
orderBy: totalLiquidity
|
44
|
-
orderDirection: desc
|
45
|
-
where: { totalLiquidity_gt: "500" }
|
46
|
-
) {
|
47
|
-
id
|
48
|
-
address
|
49
|
-
symbol
|
50
|
-
totalLiquidity
|
51
|
-
totalShares
|
52
|
-
tokens {
|
53
|
-
balance
|
54
|
-
decimals
|
55
|
-
symbol
|
56
|
-
address
|
57
|
-
}
|
58
|
-
}
|
59
|
-
}
|
39
|
+
const query = (0, graphql_request_1.gql) `
|
40
|
+
query pools {
|
41
|
+
pools(
|
42
|
+
first: 1000
|
43
|
+
orderBy: totalLiquidity
|
44
|
+
orderDirection: desc
|
45
|
+
where: { totalLiquidity_gt: "500" }
|
46
|
+
) {
|
47
|
+
id
|
48
|
+
address
|
49
|
+
symbol
|
50
|
+
totalLiquidity
|
51
|
+
totalShares
|
52
|
+
tokens {
|
53
|
+
balance
|
54
|
+
decimals
|
55
|
+
symbol
|
56
|
+
address
|
57
|
+
}
|
58
|
+
}
|
59
|
+
}
|
60
60
|
`;
|
61
61
|
const res = yield (0, graphql_request_1.default)(url, query);
|
62
62
|
const pools = res.pools;
|
@@ -39,7 +39,8 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
39
39
|
return [
|
40
40
|
{
|
41
41
|
type: portfolio_core_1.PortfolioElementType.multiple,
|
42
|
-
label: '
|
42
|
+
label: 'Staked',
|
43
|
+
name: 'Vote',
|
43
44
|
networkId: portfolio_core_1.NetworkId.solana,
|
44
45
|
platformId: constants_1.platformId,
|
45
46
|
data: { assets: [asset] },
|
@@ -1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,MAAM,WAAW,GAAG,IAAI,IAAI,CAC1B,aAAa,CAAC,YAAY,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,CAClD,CAAC;QACF,KAAK,CAAC,UAAU,GAAG,EAAE,WAAW,EAAE,WAAW,CAAC,OAAO,EAAE,EAAE,CAAC;IAC5D,CAAC;IAED,OAAO;QACL;YACE,IAAI,EAAE,qCAAoB,CAAC,QAAQ;YACnC,KAAK,EAAE,QAAQ;YACf,IAAI,EAAE,MAAM;YACZ,SAAS,EAAE,0BAAS,CAAC,MAAM;YAC3B,UAAU,EAAV,sBAAU;YACV,IAAI,EAAE,EAAE,MAAM,EAAE,CAAC,KAAK,CAAC,EAAE;YACzB,KAAK,EAAE,KAAK,CAAC,KAAK;SACnB;KACF,CAAC;AACJ,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,OAAO;IACxB,SAAS,EAAE,0BAAS,CAAC,MAAM;IAC3B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|
@@ -4,6 +4,7 @@ export declare const platform: Platform;
|
|
4
4
|
export declare const packageId = "0xf95b06141ed4a174f239417323bde3f209b972f5930d8521ea38a52aff3a6ddf";
|
5
5
|
export declare const obligationType = "0xf95b06141ed4a174f239417323bde3f209b972f5930d8521ea38a52aff3a6ddf::obligation::Obligation";
|
6
6
|
export declare const mainMarket = "0x84030d26d85eaa7035084a057f2f11f701b7e2e4eda87551becbc7c97505ece1";
|
7
|
+
export declare const marketsRegistry = "0x64faff8d91a56c4f55debbb44767b009ee744a70bc2cc8e3bbd2718c92f85931";
|
7
8
|
export declare const obligationOwnerCapType = "0xf95b06141ed4a174f239417323bde3f209b972f5930d8521ea38a52aff3a6ddf::lending_market::ObligationOwnerCap<0xf95b06141ed4a174f239417323bde3f209b972f5930d8521ea38a52aff3a6ddf";
|
8
9
|
export declare const poolsKey = "poolsInfo";
|
9
10
|
export declare const marketsKey = "markets";
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.marketsKey = exports.poolsKey = exports.obligationOwnerCapType = exports.mainMarket = exports.obligationType = exports.packageId = exports.platform = exports.platformId = void 0;
|
3
|
+
exports.marketsKey = exports.poolsKey = exports.obligationOwnerCapType = exports.marketsRegistry = exports.mainMarket = exports.obligationType = exports.packageId = exports.platform = exports.platformId = void 0;
|
4
4
|
exports.platformId = 'suilend';
|
5
5
|
exports.platform = {
|
6
6
|
id: exports.platformId,
|
@@ -13,6 +13,7 @@ exports.platform = {
|
|
13
13
|
exports.packageId = '0xf95b06141ed4a174f239417323bde3f209b972f5930d8521ea38a52aff3a6ddf';
|
14
14
|
exports.obligationType = `${exports.packageId}::obligation::Obligation`;
|
15
15
|
exports.mainMarket = '0x84030d26d85eaa7035084a057f2f11f701b7e2e4eda87551becbc7c97505ece1';
|
16
|
+
exports.marketsRegistry = '0x64faff8d91a56c4f55debbb44767b009ee744a70bc2cc8e3bbd2718c92f85931';
|
16
17
|
exports.obligationOwnerCapType = `${exports.packageId}::lending_market::ObligationOwnerCap<${exports.packageId}`;
|
17
18
|
exports.poolsKey = 'poolsInfo';
|
18
19
|
exports.marketsKey = 'markets';
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/suilend/constants.ts"],"names":[],"mappings":";;;AAEa,QAAA,UAAU,GAAG,SAAS,CAAC;AACvB,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,SAAS;IACf,KAAK,EAAE,+CAA+C;IACtD,WAAW,EAAE,SAAS,EAAE,sCAAsC;IAC9D,OAAO,EAAE,yBAAyB;IAClC,OAAO,EAAE,qCAAqC;CAC/C,CAAC;AAEW,QAAA,SAAS,GACpB,oEAAoE,CAAC;AAE1D,QAAA,cAAc,GAAG,GAAG,iBAAS,0BAA0B,CAAC;AACxD,QAAA,UAAU,GACrB,oEAAoE,CAAC;AAE1D,QAAA,sBAAsB,GAAG,GAAG,iBAAS,wCAAwC,iBAAS,EAAE,CAAC;AACzF,QAAA,QAAQ,GAAG,WAAW,CAAC;AACvB,QAAA,UAAU,GAAG,SAAS,CAAC"}
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/suilend/constants.ts"],"names":[],"mappings":";;;AAEa,QAAA,UAAU,GAAG,SAAS,CAAC;AACvB,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,SAAS;IACf,KAAK,EAAE,+CAA+C;IACtD,WAAW,EAAE,SAAS,EAAE,sCAAsC;IAC9D,OAAO,EAAE,yBAAyB;IAClC,OAAO,EAAE,qCAAqC;CAC/C,CAAC;AAEW,QAAA,SAAS,GACpB,oEAAoE,CAAC;AAE1D,QAAA,cAAc,GAAG,GAAG,iBAAS,0BAA0B,CAAC;AACxD,QAAA,UAAU,GACrB,oEAAoE,CAAC;AAC1D,QAAA,eAAe,GAC1B,oEAAoE,CAAC;AAE1D,QAAA,sBAAsB,GAAG,GAAG,iBAAS,wCAAwC,iBAAS,EAAE,CAAC;AACzF,QAAA,QAAQ,GAAG,WAAW,CAAC;AACvB,QAAA,UAAU,GAAG,SAAS,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/suilend/helpers.ts"],"names":[],"mappings":";;;AAEA,SAAgB,oBAAoB,CAClC,cAA2C;IAE3C,IAAI,CAAC,cAAc;QAAE,OAAO,SAAS,CAAC;
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/suilend/helpers.ts"],"names":[],"mappings":";;;AAEA,SAAgB,oBAAoB,CAClC,cAA2C;IAE3C,IAAI,CAAC,cAAc;QAAE,OAAO,SAAS,CAAC;IAEtC,MAAM,kBAAkB,GAA4B,IAAI,GAAG,EAAE,CAAC;IAC9D,KAAK,MAAM,aAAa,IAAI,cAAc,EAAE,CAAC;QAC3C,MAAM,EAAE,QAAQ,EAAE,GAAG,aAAa,CAAC;QACnC,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;YAC/B,MAAM,YAAY,GAChB,OAAO,CAAC,MAAM,CAAC,4BAA4B,CAAC,MAAM,CAAC,YAAY,CAAC;YAClE,KAAK,MAAM,UAAU,IAAI,YAAY;gBACnC,kBAAkB,CAAC,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC;QACvE,CAAC;IACH,CAAC;IACD,OAAO,kBAAkB,CAAC;AAC5B,CAAC;AAhBD,oDAgBC"}
|
@@ -18,25 +18,6 @@ const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
|
18
18
|
const marketsObjects = yield (0, multiGetObjects_1.multiGetObjects)(client, [
|
19
19
|
constants_1.mainMarket,
|
20
20
|
]);
|
21
|
-
// const poolsRewardsInfo: RewardInfo[] = [];
|
22
|
-
// for (const object of markets) {
|
23
|
-
// if (!object.data || !object.data.content) continue;
|
24
|
-
// const { fields } = object.data.content;
|
25
|
-
// const { reserves } = fields;
|
26
|
-
// for (const reserve of reserves) {
|
27
|
-
// const poolsRewards =
|
28
|
-
// reserve.fields.deposits_pool_reward_manager.fields.pool_rewards;
|
29
|
-
// for (const poolReward of poolsRewards)
|
30
|
-
// poolsRewardsInfo.push({
|
31
|
-
// poolId: poolReward.fields.id.id,
|
32
|
-
// rewardMint: poolReward.fields.coin_type.fields.name,
|
33
|
-
// });
|
34
|
-
// }
|
35
|
-
// }
|
36
|
-
// await cache.setItem(poolsKey, poolsRewardsInfo, {
|
37
|
-
// prefix: platformId,
|
38
|
-
// networkId: NetworkId.sui,
|
39
|
-
// });
|
40
21
|
yield cache.setItem(constants_1.marketsKey, marketsObjects.map((object) => { var _a, _b; return (_b = (_a = object.data) === null || _a === void 0 ? void 0 : _a.content) === null || _b === void 0 ? void 0 : _b.fields; }), {
|
41
22
|
prefix: constants_1.platformId,
|
42
23
|
networkId: portfolio_core_1.NetworkId.sui,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"marketsJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/suilend/marketsJob.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+DAAuD;AAGvD,iDAAmD;AACnD,qEAAkE;AAClE,2CAAiE;AAGjE,MAAM,QAAQ,GAAgB,CAAO,KAAY,EAAE,EAAE;IACnD,MAAM,MAAM,GAAG,IAAA,sBAAY,GAAE,CAAC;IAC9B,MAAM,cAAc,GAAG,MAAM,IAAA,iCAAe,EAAgB,MAAM,EAAE;QAClE,sBAAU;KACX,CAAC,CAAC;IAEH,
|
1
|
+
{"version":3,"file":"marketsJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/suilend/marketsJob.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+DAAuD;AAGvD,iDAAmD;AACnD,qEAAkE;AAClE,2CAAiE;AAGjE,MAAM,QAAQ,GAAgB,CAAO,KAAY,EAAE,EAAE;IACnD,MAAM,MAAM,GAAG,IAAA,sBAAY,GAAE,CAAC;IAC9B,MAAM,cAAc,GAAG,MAAM,IAAA,iCAAe,EAAgB,MAAM,EAAE;QAClE,sBAAU;KACX,CAAC,CAAC;IAEH,MAAM,KAAK,CAAC,OAAO,CACjB,sBAAU,EACV,cAAc,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,eAAC,OAAA,MAAA,MAAA,MAAM,CAAC,IAAI,0CAAE,OAAO,0CAAE,MAAM,CAAA,EAAA,CAAC,EAC5D;QACE,MAAM,EAAE,sBAAU;QAClB,SAAS,EAAE,0BAAS,CAAC,GAAG;KACzB,CACF,CAAC;AACJ,CAAC,CAAA,CAAC;AAEF,MAAM,GAAG,GAAQ;IACf,EAAE,EAAE,GAAG,sBAAU,UAAU;IAC3B,QAAQ;IACR,KAAK,EAAE,QAAQ;CAChB,CAAC;AACF,kBAAe,GAAG,CAAC"}
|
@@ -42,16 +42,6 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
42
42
|
if (obligations.length === 0)
|
43
43
|
return [];
|
44
44
|
const mints = new Set();
|
45
|
-
// const rewardsInfos = await cache.getItem<RewardInfo[]>(poolsKey, {
|
46
|
-
// prefix: platformId,
|
47
|
-
// networkId: NetworkId.sui,
|
48
|
-
// });
|
49
|
-
// const rewardInfoById: Map<string, string> = new Map();
|
50
|
-
// if (rewardsInfos)
|
51
|
-
// rewardsInfos.forEach((rI) => {
|
52
|
-
// rewardInfoById.set(rI.poolId, rI.rewardMint);
|
53
|
-
// mints.add(rI.rewardMint);
|
54
|
-
// });
|
55
45
|
const markets = yield cache.getItem(constants_1.marketsKey, {
|
56
46
|
prefix: constants_1.platformId,
|
57
47
|
networkId: portfolio_core_1.NetworkId.sui,
|
@@ -90,10 +80,9 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
90
80
|
// Deposits
|
91
81
|
for (const deposit of deposits) {
|
92
82
|
const { fields } = deposit;
|
93
|
-
const
|
94
|
-
if (
|
83
|
+
const reserve = reserves.at(Number(fields.reserve_array_index));
|
84
|
+
if (!reserve)
|
95
85
|
continue;
|
96
|
-
const reserve = reserves[index];
|
97
86
|
const reserveBorrowAmount = new bignumber_js_1.default(reserve.fields.borrowed_amount.fields.value).dividedBy(Math.pow(10, constants_2.wadsDecimal));
|
98
87
|
const reserveAvailableAmount = new bignumber_js_1.default(reserve.fields.available_amount);
|
99
88
|
const cSupply = new bignumber_js_1.default(reserve.fields.ctoken_supply);
|
@@ -115,10 +104,9 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
115
104
|
// Borrows
|
116
105
|
for (const borrow of borrows) {
|
117
106
|
const { fields } = borrow;
|
118
|
-
const
|
119
|
-
if (
|
107
|
+
const reserve = reserves.at(Number(fields.reserve_array_index));
|
108
|
+
if (!reserve)
|
120
109
|
continue;
|
121
|
-
const reserve = reserves[index];
|
122
110
|
const tokenPrice = tokenPriceById.get((0, portfolio_core_1.formatTokenAddress)(fields.coin_type.fields.name, portfolio_core_1.NetworkId.sui));
|
123
111
|
if (!tokenPrice)
|
124
112
|
continue;
|
@@ -132,14 +120,13 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
132
120
|
.dividedBy(Math.pow(10, constants_2.wadsDecimal))
|
133
121
|
.dividedBy(amount);
|
134
122
|
borrowedAssets.push((0, tokenPriceToAssetToken_1.default)(tokenPrice.address, amount.toNumber(), portfolio_core_1.NetworkId.sui, tokenPrice, price.toNumber()));
|
135
|
-
const borrowWeight =
|
123
|
+
const borrowWeight = new bignumber_js_1.default(reserve.fields.config.fields.element.fields.borrow_weight_bps).dividedBy(Math.pow(10, 4));
|
136
124
|
borrowedWeights.push(borrowWeight.toNumber());
|
137
125
|
}
|
138
126
|
// Rewards
|
139
127
|
if (!poolRewardById)
|
140
128
|
continue;
|
141
|
-
const
|
142
|
-
const earnedAmountByMint = new Map();
|
129
|
+
const rewardAmountByMint = new Map();
|
143
130
|
for (const userRewardManager of userRewardManagers) {
|
144
131
|
const share = new bignumber_js_1.default(userRewardManager.fields.share);
|
145
132
|
for (const userReward of userRewardManager.fields.rewards) {
|
@@ -147,36 +134,25 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
147
134
|
if (!poolReward)
|
148
135
|
continue;
|
149
136
|
const rewardMint = poolReward.coin_type.fields.name;
|
150
|
-
const
|
151
|
-
|
137
|
+
const cumulativeAmount = new bignumber_js_1.default(poolReward.cumulative_rewards_per_share.fields.value)
|
138
|
+
.minus(userReward.fields.cumulative_rewards_per_share.fields.value)
|
152
139
|
.times(share)
|
153
140
|
.dividedBy(Math.pow(10, constants_2.wadsDecimal));
|
154
141
|
if (cumulativeAmount.isZero())
|
155
142
|
continue;
|
156
|
-
const previousCumAmount =
|
143
|
+
const previousCumAmount = rewardAmountByMint.get(rewardMint);
|
157
144
|
if (previousCumAmount) {
|
158
|
-
|
145
|
+
rewardAmountByMint.set(rewardMint, previousCumAmount.plus(cumulativeAmount));
|
159
146
|
}
|
160
147
|
else {
|
161
|
-
|
162
|
-
}
|
163
|
-
const previousEarnedAmount = earnedAmountByMint.get(rewardMint);
|
164
|
-
if (previousEarnedAmount) {
|
165
|
-
earnedAmountByMint.set(rewardMint, previousEarnedAmount.plus(earnedAmount));
|
166
|
-
}
|
167
|
-
else {
|
168
|
-
earnedAmountByMint.set(rewardMint, earnedAmount);
|
148
|
+
rewardAmountByMint.set(rewardMint, cumulativeAmount);
|
169
149
|
}
|
170
150
|
}
|
171
151
|
}
|
172
|
-
|
152
|
+
rewardAmountByMint.forEach((amount, mint) => {
|
173
153
|
const tokenPrice = tokenPriceById.get((0, portfolio_core_1.formatTokenAddress)(mint, portfolio_core_1.NetworkId.sui));
|
174
|
-
const earnedAmount = earnedAmountByMint.get(mint);
|
175
154
|
if (tokenPrice)
|
176
|
-
rewardAssets.push(Object.assign(Object.assign({}, (0, tokenPriceToAssetToken_1.default)(tokenPrice.address, amount
|
177
|
-
.dividedBy(Math.pow(10, tokenPrice.decimals))
|
178
|
-
.minus(earnedAmount || 0)
|
179
|
-
.toNumber(), portfolio_core_1.NetworkId.sui, tokenPrice)), { attributes: { isClaimable: true } }));
|
155
|
+
rewardAssets.push(Object.assign(Object.assign({}, (0, tokenPriceToAssetToken_1.default)(tokenPrice.address, amount.dividedBy(Math.pow(10, tokenPrice.decimals)).toNumber(), portfolio_core_1.NetworkId.sui, tokenPrice)), { attributes: { isClaimable: true } }));
|
180
156
|
});
|
181
157
|
}
|
182
158
|
if (suppliedAssets.length === 0 &&
|
@@ -199,7 +175,7 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
199
175
|
suppliedYields,
|
200
176
|
collateralRatio: null,
|
201
177
|
healthRatio,
|
202
|
-
rewardAssets
|
178
|
+
rewardAssets,
|
203
179
|
rewardValue,
|
204
180
|
value,
|
205
181
|
},
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"obligationsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/suilend/obligationsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAQoC;AACpC,gEAAqC;AAGrC,2CAKqB;AACrB,iDAAmD;AACnD,qEAAkE;AAElE,qEAAkE;AAClE,qGAA6E;AAC7E,uCAAiD;AACjD,mDAAkD;AAElD,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;;IACtE,MAAM,MAAM,GAAG,IAAA,sBAAY,GAAE,CAAC;IAE9B,MAAM,oBAAoB,GAAG,MAAM,IAAA,iCAAe,EAChD,MAAM,EACN,KAAK,EACL;QACE,MAAM,EAAE,EAAE,OAAO,EAAE,qBAAS,EAAE;KAC/B,CACF,CAAC;IACF,IAAI,oBAAoB,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAEjD,MAAM,aAAa,GAAa,EAAE,CAAC;IACnC,KAAK,MAAM,kBAAkB,IAAI,oBAAoB,EAAE,CAAC;QACtD,MAAM,IAAI,GAAG,MAAA,MAAA,kBAAkB,CAAC,IAAI,0CAAE,OAAO,0CAAE,IAAI,CAAC;QACpD,IAAI,CAAC,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,UAAU,CAAC,kCAAsB,CAAC,CAAA;YAAE,SAAS;QAExD,MAAM,YAAY,GAAG,MAAA,MAAA,kBAAkB,CAAC,IAAI,0CAAE,OAAO,0CAAE,MAAM,CAAC,aAAa,CAAC;QAC5E,IAAI,YAAY;YAAE,aAAa,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IACrD,CAAC;IAED,MAAM,WAAW,GAAG,MAAM,IAAA,iCAAe,EAAa,MAAM,EAAE,aAAa,CAAC,CAAC;IAC7E,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAExC,MAAM,KAAK,GAAgB,IAAI,GAAG,EAAE,CAAC;IACrC,
|
1
|
+
{"version":3,"file":"obligationsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/suilend/obligationsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAQoC;AACpC,gEAAqC;AAGrC,2CAKqB;AACrB,iDAAmD;AACnD,qEAAkE;AAElE,qEAAkE;AAClE,qGAA6E;AAC7E,uCAAiD;AACjD,mDAAkD;AAElD,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;;IACtE,MAAM,MAAM,GAAG,IAAA,sBAAY,GAAE,CAAC;IAE9B,MAAM,oBAAoB,GAAG,MAAM,IAAA,iCAAe,EAChD,MAAM,EACN,KAAK,EACL;QACE,MAAM,EAAE,EAAE,OAAO,EAAE,qBAAS,EAAE;KAC/B,CACF,CAAC;IACF,IAAI,oBAAoB,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAEjD,MAAM,aAAa,GAAa,EAAE,CAAC;IACnC,KAAK,MAAM,kBAAkB,IAAI,oBAAoB,EAAE,CAAC;QACtD,MAAM,IAAI,GAAG,MAAA,MAAA,kBAAkB,CAAC,IAAI,0CAAE,OAAO,0CAAE,IAAI,CAAC;QACpD,IAAI,CAAC,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,UAAU,CAAC,kCAAsB,CAAC,CAAA;YAAE,SAAS;QAExD,MAAM,YAAY,GAAG,MAAA,MAAA,kBAAkB,CAAC,IAAI,0CAAE,OAAO,0CAAE,MAAM,CAAC,aAAa,CAAC;QAC5E,IAAI,YAAY;YAAE,aAAa,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IACrD,CAAC;IAED,MAAM,WAAW,GAAG,MAAM,IAAA,iCAAe,EAAa,MAAM,EAAE,a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G;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;IACF,OAAO,CAAC,OAAO,CAAC,CAAC;AACnB,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,cAAc;IAC/B,SAAS,EAAE,0BAAS,CAAC,GAAG;IACxB,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|
@@ -54,30 +54,30 @@ function sushiV3PairToUniV2(pair) {
|
|
54
54
|
}
|
55
55
|
function getV3PairsAddresses(url, length = 300) {
|
56
56
|
return __awaiter(this, void 0, void 0, function* () {
|
57
|
-
const query = (0, graphql_request_1.gql) `
|
58
|
-
{
|
59
|
-
pools(
|
60
|
-
orderBy: totalValueLockedUSD
|
61
|
-
first: ${length}
|
62
|
-
orderDirection: desc
|
63
|
-
where: { volumeUSD_not: "0", liquidity_not: "0" }
|
64
|
-
) {
|
65
|
-
id
|
66
|
-
token0Price
|
67
|
-
token1Price
|
68
|
-
liquidity
|
69
|
-
token0 {
|
70
|
-
id
|
71
|
-
totalSupply
|
72
|
-
decimals
|
73
|
-
}
|
74
|
-
token1 {
|
75
|
-
id
|
76
|
-
totalSupply
|
77
|
-
decimals
|
78
|
-
}
|
79
|
-
}
|
80
|
-
}
|
57
|
+
const query = (0, graphql_request_1.gql) `
|
58
|
+
{
|
59
|
+
pools(
|
60
|
+
orderBy: totalValueLockedUSD
|
61
|
+
first: ${length}
|
62
|
+
orderDirection: desc
|
63
|
+
where: { volumeUSD_not: "0", liquidity_not: "0" }
|
64
|
+
) {
|
65
|
+
id
|
66
|
+
token0Price
|
67
|
+
token1Price
|
68
|
+
liquidity
|
69
|
+
token0 {
|
70
|
+
id
|
71
|
+
totalSupply
|
72
|
+
decimals
|
73
|
+
}
|
74
|
+
token1 {
|
75
|
+
id
|
76
|
+
totalSupply
|
77
|
+
decimals
|
78
|
+
}
|
79
|
+
}
|
80
|
+
}
|
81
81
|
`;
|
82
82
|
const res = yield (0, graphql_request_1.default)(url, query);
|
83
83
|
const pools = res.pools;
|
@@ -40,28 +40,28 @@ function getPairKey(version) {
|
|
40
40
|
exports.getPairKey = getPairKey;
|
41
41
|
function getPairsV2FromTheGraph(url, length = 300) {
|
42
42
|
return __awaiter(this, void 0, void 0, function* () {
|
43
|
-
const query = (0, graphql_request_1.gql) `
|
44
|
-
{
|
45
|
-
pairs(
|
46
|
-
orderBy: reserveUSD
|
47
|
-
first: ${length}
|
48
|
-
orderDirection: desc
|
49
|
-
where: { trackedReserveETH_not: "0" }
|
50
|
-
) {
|
51
|
-
id
|
52
|
-
reserve0
|
53
|
-
reserve1
|
54
|
-
totalSupply
|
55
|
-
token0 {
|
56
|
-
id
|
57
|
-
decimals
|
58
|
-
}
|
59
|
-
token1 {
|
60
|
-
id
|
61
|
-
decimals
|
62
|
-
}
|
63
|
-
}
|
64
|
-
}
|
43
|
+
const query = (0, graphql_request_1.gql) `
|
44
|
+
{
|
45
|
+
pairs(
|
46
|
+
orderBy: reserveUSD
|
47
|
+
first: ${length}
|
48
|
+
orderDirection: desc
|
49
|
+
where: { trackedReserveETH_not: "0" }
|
50
|
+
) {
|
51
|
+
id
|
52
|
+
reserve0
|
53
|
+
reserve1
|
54
|
+
totalSupply
|
55
|
+
token0 {
|
56
|
+
id
|
57
|
+
decimals
|
58
|
+
}
|
59
|
+
token1 {
|
60
|
+
id
|
61
|
+
decimals
|
62
|
+
}
|
63
|
+
}
|
64
|
+
}
|
65
65
|
`;
|
66
66
|
const res = yield (0, graphql_request_1.default)(url, query);
|
67
67
|
const pairs = res.pairs;
|