@sonarwatch/portfolio-plugins 0.8.38 → 0.8.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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/balancer/constants.d.ts +5 -0
- package/src/plugins/balancer/constants.js +13 -0
- package/src/plugins/balancer/constants.js.map +1 -0
- package/src/plugins/balancer/helpers.d.ts +3 -0
- package/src/plugins/balancer/helpers.js +135 -0
- package/src/plugins/balancer/helpers.js.map +1 -0
- package/src/plugins/balancer/index.d.ts +6 -0
- package/src/plugins/balancer/index.js +13 -0
- package/src/plugins/balancer/index.js.map +1 -0
- package/src/plugins/balancer/poolsJob.d.ts +3 -0
- package/src/plugins/balancer/poolsJob.js +23 -0
- package/src/plugins/balancer/poolsJob.js.map +1 -0
- package/src/plugins/balancer/positionFetcher.d.ts +3 -0
- package/src/plugins/balancer/positionFetcher.js +46 -0
- package/src/plugins/balancer/positionFetcher.js.map +1 -0
- package/src/plugins/balancer/types.d.ts +13 -0
- package/src/plugins/balancer/types.js +3 -0
- package/src/plugins/balancer/types.js.map +1 -0
- package/src/plugins/top-tokens/forcedAddresses.js +6 -6
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.8.40](https://github.com/sonarwatch/portfolio/compare/plugins-0.8.39...plugins-0.8.40) (2023-10-23)
|
6
|
+
|
7
|
+
|
8
|
+
|
9
|
+
## [0.8.39](https://github.com/sonarwatch/portfolio/compare/plugins-0.8.38...plugins-0.8.39) (2023-10-23)
|
10
|
+
|
11
|
+
|
12
|
+
|
5
13
|
## [0.8.38](https://github.com/sonarwatch/portfolio/compare/plugins-0.8.37...plugins-0.8.38) (2023-10-21)
|
6
14
|
|
7
15
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@sonarwatch/portfolio-plugins",
|
3
|
-
"version": "0.8.
|
3
|
+
"version": "0.8.40",
|
4
4
|
"type": "commonjs",
|
5
5
|
"generators": "./generators.json",
|
6
6
|
"dependencies": {
|
@@ -29,6 +29,7 @@
|
|
29
29
|
"bn.js": "^5.2.1",
|
30
30
|
"decimal.js": "^10.4.3",
|
31
31
|
"dsa-connect": "^0.6.47",
|
32
|
+
"graphql-request": "^6.1.0",
|
32
33
|
"long": "^5.2.3",
|
33
34
|
"osmojs": "^16.5.1",
|
34
35
|
"reflect-metadata": "^0.1.13",
|
@@ -37,7 +38,7 @@
|
|
37
38
|
"web3-v1": "npm:web3@^1.5.0"
|
38
39
|
},
|
39
40
|
"peerDependencies": {
|
40
|
-
"@sonarwatch/portfolio-core": "0.8.
|
41
|
+
"@sonarwatch/portfolio-core": "0.8.41"
|
41
42
|
},
|
42
43
|
"main": "./src/index.js",
|
43
44
|
"types": "./src/index.d.ts"
|
package/src/index.js
CHANGED
@@ -55,6 +55,7 @@ const curve_1 = require("./plugins/curve");
|
|
55
55
|
const compound_1 = require("./plugins/compound");
|
56
56
|
const stargate_1 = require("./plugins/stargate");
|
57
57
|
const stader_1 = require("./plugins/stader");
|
58
|
+
const balancer_1 = require("./plugins/balancer");
|
58
59
|
var constants_1 = require("./plugins/tokens/constants");
|
59
60
|
Object.defineProperty(exports, "walletTokensPlatform", { enumerable: true, get: function () { return constants_1.walletTokensPlatform; } });
|
60
61
|
Object.defineProperty(exports, "walletNftsPlatform", { enumerable: true, get: function () { return constants_1.walletNftsPlatform; } });
|
@@ -101,6 +102,7 @@ exports.platforms = [
|
|
101
102
|
...compound_1.platforms,
|
102
103
|
...stargate_1.platforms,
|
103
104
|
...stader_1.platforms,
|
105
|
+
...balancer_1.platforms,
|
104
106
|
];
|
105
107
|
// JOBS //
|
106
108
|
exports.jobs = [
|
@@ -133,6 +135,7 @@ exports.jobs = [
|
|
133
135
|
...compound_1.jobs,
|
134
136
|
...stargate_1.jobs,
|
135
137
|
...stader_1.jobs,
|
138
|
+
...balancer_1.jobs,
|
136
139
|
];
|
137
140
|
// FETCHERS //
|
138
141
|
exports.fetchers = [
|
@@ -163,6 +166,7 @@ exports.fetchers = [
|
|
163
166
|
...compound_1.fetchers,
|
164
167
|
...lido_1.fetchers,
|
165
168
|
...stader_1.fetchers,
|
169
|
+
...balancer_1.fetchers,
|
166
170
|
];
|
167
171
|
exports.fetchersByAddressSystem = (0, getFetchersByAddressSystem_1.getFetchersByAddressSystem)(exports.fetchers);
|
168
172
|
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/plugins/src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAGA,wFAAqF;AACrF,sEAA8C;AAC9C,6CAI0B;AAC1B,yDAIgC;AAChC,iDAG4B;AAC5B,iDAI4B;AAC5B,2CAGyB;AACzB,6CAI0B;AAC1B,+CAI2B;AAC3B,yCAIwB;AACxB,+CAG2B;AAC3B,2CAIyB;AACzB,6CAI0B;AAC1B,2CAIyB;AACzB,6CAG0B;AAC1B,6CAI0B;AAC1B,yCAIwB;AACxB,2DAGiC;AACjC,6CAI0B;AAC1B,2CAIyB;AACzB,2CAIyB;AACzB,qDAA6D;AAC7D,qEAIsC;AACtC,uDAG+B;AAC/B,mDAG6B;AAC7B,qDAG8B;AAC9B,uDAG+B;AAC/B,2CAIyB;AACzB,6CAG0B;AAC1B,6CAG0B;AAC1B,yCAIwB;AACxB,uDAG+B;AAC/B,yCAGwB;AACxB,2CAIyB;AACzB,iDAI4B;AAC5B,iDAI4B;AAC5B,6CAI0B;
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/plugins/src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAGA,wFAAqF;AACrF,sEAA8C;AAC9C,6C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;IACf,GAAG,sBAAkB;IACrB,GAAG,gBAAa;IAChB,GAAG,mBAAgB;IACnB,GAAG,gBAAa;IAChB,GAAG,mBAAgB;IACnB,GAAG,eAAY;IACf,GAAG,iBAAc;IACjB,GAAG,mBAAgB;CACpB,CAAC;AACW,QAAA,uBAAuB,GAAG,IAAA,uDAA0B,EAAC,gBAAQ,CAAC,CAAC"}
|
@@ -0,0 +1,5 @@
|
|
1
|
+
import { Platform } from '@sonarwatch/portfolio-core';
|
2
|
+
export declare const platformId = "balancer";
|
3
|
+
export declare const platform: Platform;
|
4
|
+
export declare const poolsCacheKey: string;
|
5
|
+
export declare const ethereumGaugeControllerAddress = "0xC128468b7Ce63eA702C1f104D55A2566b13D3ABD";
|
@@ -0,0 +1,13 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.ethereumGaugeControllerAddress = exports.poolsCacheKey = exports.platform = exports.platformId = void 0;
|
4
|
+
exports.platformId = 'balancer';
|
5
|
+
exports.platform = {
|
6
|
+
id: exports.platformId,
|
7
|
+
name: 'Balancer',
|
8
|
+
image: 'https://sonar.watch/img/platforms/balancer.png',
|
9
|
+
defiLlamaId: 'parent#balancer', // from https://defillama.com/docs/api
|
10
|
+
};
|
11
|
+
exports.poolsCacheKey = `${exports.platformId}-pools`;
|
12
|
+
exports.ethereumGaugeControllerAddress = '0xC128468b7Ce63eA702C1f104D55A2566b13D3ABD';
|
13
|
+
//# sourceMappingURL=constants.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/balancer/constants.ts"],"names":[],"mappings":";;;AAEa,QAAA,UAAU,GAAG,UAAU,CAAC;AACxB,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,UAAU;IAChB,KAAK,EAAE,gDAAgD;IACvD,WAAW,EAAE,iBAAiB,EAAE,sCAAsC;CACvE,CAAC;AACW,QAAA,aAAa,GAAG,GAAG,kBAAU,QAAQ,CAAC;AAEtC,QAAA,8BAA8B,GACzC,4CAA4C,CAAC"}
|
@@ -0,0 +1,135 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
+
if (k2 === undefined) k2 = k;
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
+
}
|
8
|
+
Object.defineProperty(o, k2, desc);
|
9
|
+
}) : (function(o, m, k, k2) {
|
10
|
+
if (k2 === undefined) k2 = k;
|
11
|
+
o[k2] = m[k];
|
12
|
+
}));
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
15
|
+
}) : function(o, v) {
|
16
|
+
o["default"] = v;
|
17
|
+
});
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
19
|
+
if (mod && mod.__esModule) return mod;
|
20
|
+
var result = {};
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
22
|
+
__setModuleDefault(result, mod);
|
23
|
+
return result;
|
24
|
+
};
|
25
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
32
|
+
});
|
33
|
+
};
|
34
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
35
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
36
|
+
};
|
37
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
38
|
+
exports.getBalancerPools = void 0;
|
39
|
+
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
40
|
+
const graphql_request_1 = __importStar(require("graphql-request"));
|
41
|
+
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
42
|
+
const constants_1 = require("./constants");
|
43
|
+
const runInBatch_1 = __importDefault(require("../../utils/misc/runInBatch"));
|
44
|
+
function getBalancerPools(url, networkId, cache) {
|
45
|
+
return __awaiter(this, void 0, void 0, function* () {
|
46
|
+
const query = (0, graphql_request_1.gql) `
|
47
|
+
query pools {
|
48
|
+
pools(
|
49
|
+
first: 1000
|
50
|
+
orderBy: totalLiquidity
|
51
|
+
orderDirection: desc
|
52
|
+
where: { totalLiquidity_gt: "500" }
|
53
|
+
) {
|
54
|
+
id
|
55
|
+
address
|
56
|
+
symbol
|
57
|
+
totalLiquidity
|
58
|
+
tokens {
|
59
|
+
balance
|
60
|
+
decimals
|
61
|
+
symbol
|
62
|
+
address
|
63
|
+
}
|
64
|
+
}
|
65
|
+
}
|
66
|
+
`;
|
67
|
+
const res = yield (0, graphql_request_1.default)(url, query);
|
68
|
+
const pools = res.pools;
|
69
|
+
if (!pools || !pools.length)
|
70
|
+
return;
|
71
|
+
const underlyingAddresses = [
|
72
|
+
...new Set(pools.map((p) => p.tokens.map((t) => t.address)).flat()),
|
73
|
+
];
|
74
|
+
const tokenPriceResults = yield (0, runInBatch_1.default)([...underlyingAddresses].map((mint) => () => cache.getTokenPrice(mint, networkId)));
|
75
|
+
const tokenPricesByAddress = new Map();
|
76
|
+
tokenPriceResults.forEach((r) => {
|
77
|
+
if (r.status === 'rejected')
|
78
|
+
return;
|
79
|
+
if (!r.value)
|
80
|
+
return;
|
81
|
+
tokenPricesByAddress.set(r.value.address, r.value);
|
82
|
+
});
|
83
|
+
const poolAddresses = [];
|
84
|
+
for (let i = 0; i < pools.length; i++) {
|
85
|
+
const pool = pools[i];
|
86
|
+
if (!pool.address || !pool.tokens || !pool.id)
|
87
|
+
continue;
|
88
|
+
const underlyings = [];
|
89
|
+
let tvl = new bignumber_js_1.default(0);
|
90
|
+
for (let j = 0; j < pool.tokens.length; j++) {
|
91
|
+
const token = pool.tokens[j];
|
92
|
+
const address = (0, portfolio_core_1.formatTokenAddress)(token.address, networkId);
|
93
|
+
const tokenPrice = tokenPricesByAddress.get(address);
|
94
|
+
if (!tokenPrice)
|
95
|
+
break;
|
96
|
+
tvl = tvl.plus(new bignumber_js_1.default(token.balance).times(token.balance));
|
97
|
+
underlyings.push({
|
98
|
+
networkId,
|
99
|
+
address,
|
100
|
+
decimals: token.decimals,
|
101
|
+
price: tokenPrice.price,
|
102
|
+
amountPerLp: new bignumber_js_1.default(pool.totalLiquidity)
|
103
|
+
.div(token.balance)
|
104
|
+
.toNumber(),
|
105
|
+
});
|
106
|
+
}
|
107
|
+
if (underlyings.length !== pool.tokens.length)
|
108
|
+
continue;
|
109
|
+
if (underlyings.length === 0)
|
110
|
+
continue;
|
111
|
+
const price = tvl.div(pool.totalLiquidity).toNumber();
|
112
|
+
const lpAddress = (0, portfolio_core_1.formatTokenAddress)(pool.address, networkId);
|
113
|
+
const source = {
|
114
|
+
id: constants_1.platformId,
|
115
|
+
address: lpAddress,
|
116
|
+
decimals: 18,
|
117
|
+
networkId,
|
118
|
+
platformId: 'balancer',
|
119
|
+
price,
|
120
|
+
timestamp: Date.now(),
|
121
|
+
weight: 1,
|
122
|
+
elementName: 'Balancer V2',
|
123
|
+
underlyings,
|
124
|
+
};
|
125
|
+
yield cache.setTokenPriceSource(source);
|
126
|
+
poolAddresses.push(lpAddress);
|
127
|
+
}
|
128
|
+
yield cache.setItem(constants_1.poolsCacheKey, poolAddresses, {
|
129
|
+
prefix: constants_1.platformId,
|
130
|
+
networkId,
|
131
|
+
});
|
132
|
+
});
|
133
|
+
}
|
134
|
+
exports.getBalancerPools = getBalancerPools;
|
135
|
+
//# sourceMappingURL=helpers.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/balancer/helpers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+DAMoC;AACpC,mEAA+C;AAC/C,gEAAqC;AAGrC,2CAAwD;AACxD,6EAAqD;AAErD,SAAsB,gBAAgB,CACpC,GAAW,EACX,SAAwB,EACxB,KAAY;;QAEZ,MAAM,KAAK,GAAG,IAAA,qBAAG,EAAA;;;;;;;;;;;;;;;;;;;;GAoBhB,CAAC;QACF,MAAM,GAAG,GAAG,MAAM,IAAA,yBAAO,EAAoB,GAAG,EAAE,KAAK,CAAC,CAAC;QACzD,MAAM,KAAK,GAAG,GAAG,CAAC,KAAe,CAAC;QAClC,IAAI,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,MAAM;YAAE,OAAO;QAEpC,MAAM,mBAAmB,GAAG;YAC1B,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;SACpE,CAAC;QAEF,MAAM,iBAAiB,GAAG,MAAM,IAAA,oBAAU,EACxC,CAAC,GAAG,mBAAmB,CAAC,CAAC,GAAG,CAC1B,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,aAAa,CAAC,IAAI,EAAE,SAAS,CAAC,CACrD,CACF,CAAC;QACF,MAAM,oBAAoB,GAA4B,IAAI,GAAG,EAAE,CAAC;QAChE,iBAAiB,CAAC,OAAO,CAAC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Q,EAAE,KAAK,CAAC,QAAQ;oBACxB,KAAK,EAAE,UAAU,CAAC,KAAK;oBACvB,WAAW,EAAE,IAAI,sBAAS,CAAC,IAAI,CAAC,cAAc,CAAC;yBAC5C,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC;yBAClB,QAAQ,EAAE;iBACd,CAAC,CAAC;aACJ;YACD,IAAI,WAAW,CAAC,MAAM,KAAK,IAAI,CAAC,MAAM,CAAC,MAAM;gBAAE,SAAS;YACxD,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC;gBAAE,SAAS;YAEvC,MAAM,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,QAAQ,EAAE,CAAC;YACtD,MAAM,SAAS,GAAG,IAAA,mCAAkB,EAAC,IAAI,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;YAC9D,MAAM,MAAM,GAAqB;gBAC/B,EAAE,EAAE,sBAAU;gBACd,OAAO,EAAE,SAAS;gBAClB,QAAQ,EAAE,EAAE;gBACZ,SAAS;gBACT,UAAU,EAAE,UAAU;gBACtB,KAAK;gBACL,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;gBACrB,MAAM,EAAE,CAAC;gBACT,WAAW,EAAE,aAAa;gBAC1B,WAAW;aACZ,CAAC;YACF,MAAM,KAAK,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC;YACxC,aAAa,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;SAC/B;QACD,MAAM,KAAK,CAAC,OAAO,CAAC,yBAAa,EAAE,aAAa,EAAE;YAChD,MAAM,EAAE,sBAAU;YAClB,SAAS;SACV,CAAC,CAAC;IACL,CAAC;CAAA;AA7FD,4CA6FC"}
|
@@ -0,0 +1,13 @@
|
|
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 poolsJob_1 = __importDefault(require("./poolsJob"));
|
9
|
+
// import positionFetcher from './positionFetcher';
|
10
|
+
exports.platforms = [constants_1.platform];
|
11
|
+
exports.jobs = [poolsJob_1.default];
|
12
|
+
exports.fetchers = [];
|
13
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/balancer/index.ts"],"names":[],"mappings":";;;;;;AAGA,2CAAuC;AACvC,0DAAkC;AAClC,mDAAmD;AAEtC,QAAA,SAAS,GAAe,CAAC,oBAAQ,CAAC,CAAC;AACnC,QAAA,IAAI,GAAU,CAAC,kBAAQ,CAAC,CAAC;AACzB,QAAA,QAAQ,GAAc,EAAE,CAAC"}
|
@@ -0,0 +1,23 @@
|
|
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 helpers_1 = require("./helpers");
|
15
|
+
const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
16
|
+
yield (0, helpers_1.getBalancerPools)('https://api.thegraph.com/subgraphs/name/balancer-labs/balancer-v2', portfolio_core_1.NetworkId.ethereum, cache);
|
17
|
+
});
|
18
|
+
const job = {
|
19
|
+
id: `${constants_1.platformId}-pools`,
|
20
|
+
executor,
|
21
|
+
};
|
22
|
+
exports.default = job;
|
23
|
+
//# sourceMappingURL=poolsJob.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"poolsJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/balancer/poolsJob.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+DAAuD;AAGvD,2CAAyC;AACzC,uCAA6C;AAE7C,MAAM,QAAQ,GAAgB,CAAO,KAAY,EAAE,EAAE;IACnD,MAAM,IAAA,0BAAgB,EACpB,mEAAmE,EACnE,0BAAS,CAAC,QAAQ,EAClB,KAAK,CACN,CAAC;AACJ,CAAC,CAAA,CAAC;AACF,MAAM,GAAG,GAAQ;IACf,EAAE,EAAE,GAAG,sBAAU,QAAQ;IACzB,QAAQ;CACT,CAAC;AACF,kBAAe,GAAG,CAAC"}
|
@@ -0,0 +1,46 @@
|
|
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 executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
15
|
+
const ethTokenPrice = yield cache.getTokenPrice(portfolio_core_1.ethereumNativeAddress, portfolio_core_1.NetworkId.ethereum);
|
16
|
+
const amount = 2;
|
17
|
+
const price = (ethTokenPrice === null || ethTokenPrice === void 0 ? void 0 : ethTokenPrice.price) || null;
|
18
|
+
const value = price ? amount * price : null;
|
19
|
+
const element = {
|
20
|
+
networkId: portfolio_core_1.NetworkId.ethereum,
|
21
|
+
label: 'Deposit',
|
22
|
+
platformId: constants_1.platformId,
|
23
|
+
type: portfolio_core_1.PortfolioElementType.single,
|
24
|
+
value,
|
25
|
+
data: {
|
26
|
+
asset: {
|
27
|
+
type: portfolio_core_1.PortfolioAssetType.token,
|
28
|
+
networkId: portfolio_core_1.NetworkId.ethereum,
|
29
|
+
value,
|
30
|
+
data: {
|
31
|
+
address: portfolio_core_1.ethereumNativeAddress,
|
32
|
+
amount,
|
33
|
+
price,
|
34
|
+
},
|
35
|
+
},
|
36
|
+
},
|
37
|
+
};
|
38
|
+
return [element];
|
39
|
+
});
|
40
|
+
const fetcher = {
|
41
|
+
id: `${constants_1.platformId}-position`,
|
42
|
+
networkId: portfolio_core_1.NetworkId.ethereum,
|
43
|
+
executor,
|
44
|
+
};
|
45
|
+
exports.default = fetcher;
|
46
|
+
//# sourceMappingURL=positionFetcher.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"positionFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/balancer/positionFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+DAMoC;AAEpC,2CAAyC;AAGzC,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,aAAa,GAAG,MAAM,KAAK,CAAC,aAAa,CAC7C,sCAAqB,EACrB,0BAAS,CAAC,QAAQ,CACnB,CAAC;IACF,MAAM,MAAM,GAAG,CAAC,CAAC;IACjB,MAAM,KAAK,GAAG,CAAA,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,KAAK,KAAI,IAAI,CAAC;IAC3C,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;IAE5C,MAAM,OAAO,GAA2B;QACtC,SAAS,EAAE,0BAAS,CAAC,QAAQ;QAC7B,KAAK,EAAE,SAAS;QAChB,UAAU,EAAV,sBAAU;QACV,IAAI,EAAE,qCAAoB,CAAC,MAAM;QACjC,KAAK;QACL,IAAI,EAAE;YACJ,KAAK,EAAE;gBACL,IAAI,EAAE,mCAAkB,CAAC,KAAK;gBAC9B,SAAS,EAAE,0BAAS,CAAC,QAAQ;gBAC7B,KAAK;gBACL,IAAI,EAAE;oBACJ,OAAO,EAAE,sCAAqB;oBAC9B,MAAM;oBACN,KAAK;iBACN;aACF;SACF;KACF,CAAC;IAEF,OAAO,CAAC,OAAO,CAAC,CAAC;AACnB,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,WAAW;IAC5B,SAAS,EAAE,0BAAS,CAAC,QAAQ;IAC7B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/balancer/types.ts"],"names":[],"mappings":""}
|
@@ -38,12 +38,12 @@ const forcedAddresses = new Map([
|
|
38
38
|
portfolio_core_1.NetworkId.avalanche,
|
39
39
|
[
|
40
40
|
'0x152b9d0FdC40C096757F570A51E494bd4b943E50',
|
41
|
-
'
|
42
|
-
'
|
43
|
-
'
|
44
|
-
'
|
45
|
-
'
|
46
|
-
'
|
41
|
+
'0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E',
|
42
|
+
'0xA7D7079b0FEaD91F3e65f86E8915Cb59c1a4C664',
|
43
|
+
'0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7',
|
44
|
+
'0xc7198437980c041c805A1EDcbA50c1Ce5db95118',
|
45
|
+
'0xd586E7F844cEa2F87f50152665BCbc2C279D8d70',
|
46
|
+
'0x49D5c2BdFfac6CE2BFdB6640F4F80f226bc10bAB', // weth.e
|
47
47
|
],
|
48
48
|
],
|
49
49
|
]);
|