@sonarwatch/portfolio-plugins 0.8.32 → 0.8.34
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 +2 -2
- package/src/index.js +8 -0
- package/src/index.js.map +1 -1
- package/src/orphanPlatorms.js +6 -0
- package/src/orphanPlatorms.js.map +1 -1
- package/src/plugins/aftermath/constants.js +1 -1
- package/src/plugins/aftermath/constants.js.map +1 -1
- package/src/plugins/compound/abis.d.ts +94 -0
- package/src/plugins/compound/abis.js +64 -0
- package/src/plugins/compound/abis.js.map +1 -0
- package/src/plugins/compound/constants.d.ts +6 -0
- package/src/plugins/compound/constants.js +100 -0
- package/src/plugins/compound/constants.js.map +1 -0
- package/src/plugins/compound/getPositionsV3Fetcher.d.ts +3 -0
- package/src/plugins/compound/getPositionsV3Fetcher.js +130 -0
- package/src/plugins/compound/getPositionsV3Fetcher.js.map +1 -0
- package/src/plugins/compound/index.d.ts +6 -0
- package/src/plugins/compound/index.js +17 -0
- package/src/plugins/compound/index.js.map +1 -0
- package/src/plugins/compound/marketsJob.d.ts +3 -0
- package/src/plugins/compound/marketsJob.js +39 -0
- package/src/plugins/compound/marketsJob.js.map +1 -0
- package/src/plugins/compound/types.d.ts +13 -0
- package/src/plugins/compound/types.js +3 -0
- package/src/plugins/compound/types.js.map +1 -0
- package/src/plugins/stargate/abis.d.ts +143 -0
- package/src/plugins/stargate/abis.js +161 -0
- package/src/plugins/stargate/abis.js.map +1 -0
- package/src/plugins/stargate/constants.d.ts +7 -0
- package/src/plugins/stargate/constants.js +37 -0
- package/src/plugins/stargate/constants.js.map +1 -0
- package/src/plugins/stargate/farmsJob.d.ts +3 -0
- package/src/plugins/stargate/farmsJob.js +48 -0
- package/src/plugins/stargate/farmsJob.js.map +1 -0
- package/src/plugins/stargate/gePoolPositionsFetcher.d.ts +3 -0
- package/src/plugins/stargate/gePoolPositionsFetcher.js +90 -0
- package/src/plugins/stargate/gePoolPositionsFetcher.js.map +1 -0
- package/src/plugins/stargate/getFarmPositionsFetcher.d.ts +3 -0
- package/src/plugins/stargate/getFarmPositionsFetcher.js +94 -0
- package/src/plugins/stargate/getFarmPositionsFetcher.js.map +1 -0
- package/src/plugins/stargate/getVoteTokensFetcher.d.ts +3 -0
- package/src/plugins/stargate/getVoteTokensFetcher.js +69 -0
- package/src/plugins/stargate/getVoteTokensFetcher.js.map +1 -0
- package/src/plugins/stargate/index.d.ts +6 -0
- package/src/plugins/stargate/index.js +24 -0
- package/src/plugins/stargate/index.js.map +1 -0
- package/src/plugins/stargate/poolsJob.d.ts +3 -0
- package/src/plugins/stargate/poolsJob.js +105 -0
- package/src/plugins/stargate/poolsJob.js.map +1 -0
- package/src/plugins/stargate/types.d.ts +8 -0
- package/src/plugins/stargate/types.js +3 -0
- package/src/plugins/stargate/types.js.map +1 -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.8.34](https://github.com/sonarwatch/portfolio/compare/plugins-0.8.33...plugins-0.8.34) (2023-10-20)
|
6
|
+
|
7
|
+
|
8
|
+
|
9
|
+
## [0.8.33](https://github.com/sonarwatch/portfolio/compare/plugins-0.8.32...plugins-0.8.33) (2023-10-18)
|
10
|
+
|
11
|
+
|
12
|
+
|
5
13
|
## [0.8.32](https://github.com/sonarwatch/portfolio/compare/plugins-0.8.31...plugins-0.8.32) (2023-10-18)
|
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.34",
|
4
4
|
"type": "commonjs",
|
5
5
|
"generators": "./generators.json",
|
6
6
|
"dependencies": {
|
@@ -37,7 +37,7 @@
|
|
37
37
|
"web3-v1": "npm:web3@^1.5.0"
|
38
38
|
},
|
39
39
|
"peerDependencies": {
|
40
|
-
"@sonarwatch/portfolio-core": "0.8.
|
40
|
+
"@sonarwatch/portfolio-core": "0.8.34"
|
41
41
|
},
|
42
42
|
"main": "./src/index.js",
|
43
43
|
"types": "./src/index.d.ts"
|
package/src/index.js
CHANGED
@@ -52,6 +52,8 @@ const navi_1 = require("./plugins/navi");
|
|
52
52
|
const rocket_pool_1 = require("./plugins/rocket-pool");
|
53
53
|
const lido_1 = require("./plugins/lido");
|
54
54
|
const curve_1 = require("./plugins/curve");
|
55
|
+
const compound_1 = require("./plugins/compound");
|
56
|
+
const stargate_1 = require("./plugins/stargate");
|
55
57
|
var constants_1 = require("./plugins/tokens/constants");
|
56
58
|
Object.defineProperty(exports, "walletTokensPlatform", { enumerable: true, get: function () { return constants_1.walletTokensPlatform; } });
|
57
59
|
Object.defineProperty(exports, "walletNftsPlatform", { enumerable: true, get: function () { return constants_1.walletNftsPlatform; } });
|
@@ -95,6 +97,8 @@ exports.platforms = [
|
|
95
97
|
...rocket_pool_1.platforms,
|
96
98
|
...lido_1.platforms,
|
97
99
|
...curve_1.platforms,
|
100
|
+
...compound_1.platforms,
|
101
|
+
...stargate_1.platforms,
|
98
102
|
];
|
99
103
|
// JOBS //
|
100
104
|
exports.jobs = [
|
@@ -124,6 +128,8 @@ exports.jobs = [
|
|
124
128
|
...kamino_1.jobs,
|
125
129
|
...navi_1.jobs,
|
126
130
|
...curve_1.jobs,
|
131
|
+
...compound_1.jobs,
|
132
|
+
...stargate_1.jobs,
|
127
133
|
];
|
128
134
|
// FETCHERS //
|
129
135
|
exports.fetchers = [
|
@@ -149,7 +155,9 @@ exports.fetchers = [
|
|
149
155
|
...navi_1.fetchers,
|
150
156
|
...rocket_pool_1.fetchers,
|
151
157
|
...curve_1.fetchers,
|
158
|
+
...stargate_1.fetchers,
|
152
159
|
...maker_1.fetchers,
|
160
|
+
...compound_1.fetchers,
|
153
161
|
];
|
154
162
|
exports.fetchersByAddressSystem = (0, getFetchersByAddressSystem_1.getFetchersByAddressSystem)(exports.fetchers);
|
155
163
|
//# 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,yCAA4D;AAC5D,2CAIyB;
|
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,uDA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AS;IACZ,GAAG,YAAS;IACZ,GAAG,aAAU;IACb,GAAG,iBAAa;IAChB,GAAG,kBAAe;IAClB,GAAG,kBAAe;IAClB,GAAG,YAAS;IACZ,GAAG,WAAQ;IACX,GAAG,aAAU;IACb,GAAG,aAAU;IACb,GAAG,YAAS;IACZ,GAAG,yBAAqB;IACxB,GAAG,gBAAa;IAChB,GAAG,iBAAc;IACjB,GAAG,aAAU;IACb,GAAG,WAAQ;IACX,GAAG,YAAS;IACZ,GAAG,eAAY;IACf,GAAG,eAAY;CAChB,CAAC;AAEF,cAAc;AACD,QAAA,QAAQ,GAAc;IACjC,GAAG,iBAAc;IACjB,GAAG,uBAAmB;IACtB,GAAG,iBAAc;IACjB,GAAG,mBAAgB;IACnB,GAAG,mBAAgB;IACnB,GAAG,iBAAc;IACjB,GAAG,gBAAa;IAChB,GAAG,kBAAe;IAClB,GAAG,eAAY;IACf,GAAG,gBAAa;IAChB,GAAG,gBAAa;IAChB,GAAG,gBAAa;IAChB,GAAG,iBAAc;IACjB,GAAG,wBAAoB;IACvB,GAAG,eAAY;IACf,GAAG,iBAAc;IACjB,GAAG,iBAAc;IACjB,GAAG,6BAAyB;IAC5B,GAAG,iBAAc;IACjB,GAAG,eAAY;IACf,GAAG,sBAAkB;IACrB,GAAG,gBAAa;IAChB,GAAG,mBAAgB;IACnB,GAAG,gBAAa;IAChB,GAAG,mBAAgB;CACpB,CAAC;AACW,QAAA,uBAAuB,GAAG,IAAA,uDAA0B,EAAC,gBAAQ,CAAC,CAAC"}
|
package/src/orphanPlatorms.js
CHANGED
@@ -55,6 +55,12 @@ const otphanPlatforms = [
|
|
55
55
|
name: 'StakeWise Staked ETH',
|
56
56
|
image: 'https://sonar.watch/img/platforms/stakewise.png',
|
57
57
|
},
|
58
|
+
{
|
59
|
+
id: 'instadapp',
|
60
|
+
defiLlamaId: 'instadapp',
|
61
|
+
name: 'Instadapp',
|
62
|
+
image: 'https://sonar.watch/img/platforms/instadapp.png',
|
63
|
+
},
|
58
64
|
];
|
59
65
|
exports.default = otphanPlatforms;
|
60
66
|
//# sourceMappingURL=orphanPlatorms.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"orphanPlatorms.js","sourceRoot":"","sources":["../../../../packages/plugins/src/orphanPlatorms.ts"],"names":[],"mappings":";;AAEA,MAAM,eAAe,GAAe;IAClC;QACE,EAAE,EAAE,SAAS;QACb,WAAW,EAAE,SAAS;QACtB,IAAI,EAAE,SAAS;QACf,KAAK,EAAE,+CAA+C;KACvD;IACD;QACE,EAAE,EAAE,OAAO;QACX,WAAW,EAAE,OAAO;QACpB,IAAI,EAAE,OAAO;QACb,KAAK,EAAE,6CAA6C;KACrD;IACD;QACE,EAAE,EAAE,kBAAkB;QACtB,WAAW,EAAE,oBAAoB;QACjC,IAAI,EAAE,oBAAoB;QAC1B,KAAK,EAAE,wDAAwD;KAChE;IACD;QACE,EAAE,EAAE,QAAQ;QACZ,WAAW,EAAE,QAAQ;QACrB,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,8CAA8C;KACtD;IACD;QACE,EAAE,EAAE,mBAAmB;QACvB,WAAW,EAAE,6BAA6B;QAC1C,IAAI,EAAE,qBAAqB;QAC3B,KAAK,EAAE,yDAAyD;KACjE;IACD;QACE,EAAE,EAAE,MAAM;QACV,WAAW,EAAE,MAAM;QACnB,IAAI,EAAE,MAAM;QACZ,KAAK,EAAE,4CAA4C;KACpD;IACD;QACE,EAAE,EAAE,OAAO;QACX,WAAW,EAAE,YAAY;QACzB,IAAI,EAAE,kBAAkB;QACxB,KAAK,EAAE,6CAA6C;KACrD;IACD;QACE,EAAE,EAAE,MAAM;QACV,WAAW,EAAE,YAAY;QACzB,IAAI,EAAE,iBAAiB;QACvB,KAAK,EAAE,4CAA4C;KACpD;IACD;QACE,EAAE,EAAE,WAAW;QACf,WAAW,EAAE,WAAW;QACxB,IAAI,EAAE,sBAAsB;QAC5B,KAAK,EAAE,iDAAiD;KACzD;CACF,CAAC;AACF,kBAAe,eAAe,CAAC"}
|
1
|
+
{"version":3,"file":"orphanPlatorms.js","sourceRoot":"","sources":["../../../../packages/plugins/src/orphanPlatorms.ts"],"names":[],"mappings":";;AAEA,MAAM,eAAe,GAAe;IAClC;QACE,EAAE,EAAE,SAAS;QACb,WAAW,EAAE,SAAS;QACtB,IAAI,EAAE,SAAS;QACf,KAAK,EAAE,+CAA+C;KACvD;IACD;QACE,EAAE,EAAE,OAAO;QACX,WAAW,EAAE,OAAO;QACpB,IAAI,EAAE,OAAO;QACb,KAAK,EAAE,6CAA6C;KACrD;IACD;QACE,EAAE,EAAE,kBAAkB;QACtB,WAAW,EAAE,oBAAoB;QACjC,IAAI,EAAE,oBAAoB;QAC1B,KAAK,EAAE,wDAAwD;KAChE;IACD;QACE,EAAE,EAAE,QAAQ;QACZ,WAAW,EAAE,QAAQ;QACrB,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,8CAA8C;KACtD;IACD;QACE,EAAE,EAAE,mBAAmB;QACvB,WAAW,EAAE,6BAA6B;QAC1C,IAAI,EAAE,qBAAqB;QAC3B,KAAK,EAAE,yDAAyD;KACjE;IACD;QACE,EAAE,EAAE,MAAM;QACV,WAAW,EAAE,MAAM;QACnB,IAAI,EAAE,MAAM;QACZ,KAAK,EAAE,4CAA4C;KACpD;IACD;QACE,EAAE,EAAE,OAAO;QACX,WAAW,EAAE,YAAY;QACzB,IAAI,EAAE,kBAAkB;QACxB,KAAK,EAAE,6CAA6C;KACrD;IACD;QACE,EAAE,EAAE,MAAM;QACV,WAAW,EAAE,YAAY;QACzB,IAAI,EAAE,iBAAiB;QACvB,KAAK,EAAE,4CAA4C;KACpD;IACD;QACE,EAAE,EAAE,WAAW;QACf,WAAW,EAAE,WAAW;QACxB,IAAI,EAAE,sBAAsB;QAC5B,KAAK,EAAE,iDAAiD;KACzD;IACD;QACE,EAAE,EAAE,WAAW;QACf,WAAW,EAAE,WAAW;QACxB,IAAI,EAAE,WAAW;QACjB,KAAK,EAAE,iDAAiD;KACzD;CACF,CAAC;AACF,kBAAe,eAAe,CAAC"}
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.lpCoinsTable = exports.aftermathPlatform = exports.platformId = void 0;
|
4
4
|
exports.platformId = 'aftermath';
|
5
5
|
exports.aftermathPlatform = {
|
6
|
-
id:
|
6
|
+
id: exports.platformId,
|
7
7
|
name: 'Aftermath',
|
8
8
|
image: 'https://sonar.watch/img/platforms/aftermath.png',
|
9
9
|
defiLlamaId: 'aftermath-finance',
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/aftermath/constants.ts"],"names":[],"mappings":";;;AAEa,QAAA,UAAU,GAAG,WAAW,CAAC;AAEzB,QAAA,iBAAiB,GAAa;IACzC,EAAE,EAAE,
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/aftermath/constants.ts"],"names":[],"mappings":";;;AAEa,QAAA,UAAU,GAAG,WAAW,CAAC;AAEzB,QAAA,iBAAiB,GAAa;IACzC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,WAAW;IACjB,KAAK,EAAE,iDAAiD;IACxD,WAAW,EAAE,mBAAmB;CACjC,CAAC;AAEW,QAAA,YAAY,GACvB,oEAAoE,CAAC"}
|
@@ -0,0 +1,94 @@
|
|
1
|
+
export declare const comethAbi: readonly [{
|
2
|
+
readonly inputs: readonly [{
|
3
|
+
readonly internalType: "address";
|
4
|
+
readonly name: "account";
|
5
|
+
readonly type: "address";
|
6
|
+
}];
|
7
|
+
readonly name: "borrowBalanceOf";
|
8
|
+
readonly outputs: readonly [{
|
9
|
+
readonly internalType: "uint256";
|
10
|
+
readonly name: "";
|
11
|
+
readonly type: "uint256";
|
12
|
+
}];
|
13
|
+
readonly stateMutability: "view";
|
14
|
+
readonly type: "function";
|
15
|
+
}, {
|
16
|
+
readonly inputs: readonly [{
|
17
|
+
readonly internalType: "address";
|
18
|
+
readonly name: "";
|
19
|
+
readonly type: "address";
|
20
|
+
}, {
|
21
|
+
readonly internalType: "address";
|
22
|
+
readonly name: "";
|
23
|
+
readonly type: "address";
|
24
|
+
}];
|
25
|
+
readonly name: "userCollateral";
|
26
|
+
readonly outputs: readonly [{
|
27
|
+
readonly internalType: "uint128";
|
28
|
+
readonly name: "balance";
|
29
|
+
readonly type: "uint128";
|
30
|
+
}, {
|
31
|
+
readonly internalType: "uint128";
|
32
|
+
readonly name: "_reserved";
|
33
|
+
readonly type: "uint128";
|
34
|
+
}];
|
35
|
+
readonly stateMutability: "view";
|
36
|
+
readonly type: "function";
|
37
|
+
}, {
|
38
|
+
readonly inputs: readonly [];
|
39
|
+
readonly name: "numAssets";
|
40
|
+
readonly outputs: readonly [{
|
41
|
+
readonly internalType: "uint8";
|
42
|
+
readonly name: "";
|
43
|
+
readonly type: "uint8";
|
44
|
+
}];
|
45
|
+
readonly stateMutability: "view";
|
46
|
+
readonly type: "function";
|
47
|
+
}, {
|
48
|
+
readonly inputs: readonly [{
|
49
|
+
readonly internalType: "uint8";
|
50
|
+
readonly name: "i";
|
51
|
+
readonly type: "uint8";
|
52
|
+
}];
|
53
|
+
readonly name: "getAssetInfo";
|
54
|
+
readonly outputs: readonly [{
|
55
|
+
readonly components: readonly [{
|
56
|
+
readonly internalType: "uint8";
|
57
|
+
readonly name: "offset";
|
58
|
+
readonly type: "uint8";
|
59
|
+
}, {
|
60
|
+
readonly internalType: "address";
|
61
|
+
readonly name: "asset";
|
62
|
+
readonly type: "address";
|
63
|
+
}, {
|
64
|
+
readonly internalType: "address";
|
65
|
+
readonly name: "priceFeed";
|
66
|
+
readonly type: "address";
|
67
|
+
}, {
|
68
|
+
readonly internalType: "uint64";
|
69
|
+
readonly name: "scale";
|
70
|
+
readonly type: "uint64";
|
71
|
+
}, {
|
72
|
+
readonly internalType: "uint64";
|
73
|
+
readonly name: "borrowCollateralFactor";
|
74
|
+
readonly type: "uint64";
|
75
|
+
}, {
|
76
|
+
readonly internalType: "uint64";
|
77
|
+
readonly name: "liquidateCollateralFactor";
|
78
|
+
readonly type: "uint64";
|
79
|
+
}, {
|
80
|
+
readonly internalType: "uint64";
|
81
|
+
readonly name: "liquidationFactor";
|
82
|
+
readonly type: "uint64";
|
83
|
+
}, {
|
84
|
+
readonly internalType: "uint128";
|
85
|
+
readonly name: "supplyCap";
|
86
|
+
readonly type: "uint128";
|
87
|
+
}];
|
88
|
+
readonly internalType: "struct CometCore.AssetInfo";
|
89
|
+
readonly name: "";
|
90
|
+
readonly type: "tuple";
|
91
|
+
}];
|
92
|
+
readonly stateMutability: "view";
|
93
|
+
readonly type: "function";
|
94
|
+
}];
|
@@ -0,0 +1,64 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.comethAbi = void 0;
|
4
|
+
exports.comethAbi = [
|
5
|
+
{
|
6
|
+
inputs: [{ internalType: 'address', name: 'account', type: 'address' }],
|
7
|
+
name: 'borrowBalanceOf',
|
8
|
+
outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
|
9
|
+
stateMutability: 'view',
|
10
|
+
type: 'function',
|
11
|
+
},
|
12
|
+
{
|
13
|
+
inputs: [
|
14
|
+
{ internalType: 'address', name: '', type: 'address' },
|
15
|
+
{ internalType: 'address', name: '', type: 'address' },
|
16
|
+
],
|
17
|
+
name: 'userCollateral',
|
18
|
+
outputs: [
|
19
|
+
{ internalType: 'uint128', name: 'balance', type: 'uint128' },
|
20
|
+
{ internalType: 'uint128', name: '_reserved', type: 'uint128' },
|
21
|
+
],
|
22
|
+
stateMutability: 'view',
|
23
|
+
type: 'function',
|
24
|
+
},
|
25
|
+
{
|
26
|
+
inputs: [],
|
27
|
+
name: 'numAssets',
|
28
|
+
outputs: [{ internalType: 'uint8', name: '', type: 'uint8' }],
|
29
|
+
stateMutability: 'view',
|
30
|
+
type: 'function',
|
31
|
+
},
|
32
|
+
{
|
33
|
+
inputs: [{ internalType: 'uint8', name: 'i', type: 'uint8' }],
|
34
|
+
name: 'getAssetInfo',
|
35
|
+
outputs: [
|
36
|
+
{
|
37
|
+
components: [
|
38
|
+
{ internalType: 'uint8', name: 'offset', type: 'uint8' },
|
39
|
+
{ internalType: 'address', name: 'asset', type: 'address' },
|
40
|
+
{ internalType: 'address', name: 'priceFeed', type: 'address' },
|
41
|
+
{ internalType: 'uint64', name: 'scale', type: 'uint64' },
|
42
|
+
{
|
43
|
+
internalType: 'uint64',
|
44
|
+
name: 'borrowCollateralFactor',
|
45
|
+
type: 'uint64',
|
46
|
+
},
|
47
|
+
{
|
48
|
+
internalType: 'uint64',
|
49
|
+
name: 'liquidateCollateralFactor',
|
50
|
+
type: 'uint64',
|
51
|
+
},
|
52
|
+
{ internalType: 'uint64', name: 'liquidationFactor', type: 'uint64' },
|
53
|
+
{ internalType: 'uint128', name: 'supplyCap', type: 'uint128' },
|
54
|
+
],
|
55
|
+
internalType: 'struct CometCore.AssetInfo',
|
56
|
+
name: '',
|
57
|
+
type: 'tuple',
|
58
|
+
},
|
59
|
+
],
|
60
|
+
stateMutability: 'view',
|
61
|
+
type: 'function',
|
62
|
+
},
|
63
|
+
];
|
64
|
+
//# sourceMappingURL=abis.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"abis.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/compound/abis.ts"],"names":[],"mappings":";;;AAAa,QAAA,SAAS,GAAG;IACvB;QACE,MAAM,EAAE,CAAC,EAAE,YAAY,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;QACvE,IAAI,EAAE,iBAAiB;QACvB,OAAO,EAAE,CAAC,EAAE,YAAY,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;QACjE,eAAe,EAAE,MAAM;QACvB,IAAI,EAAE,UAAU;KACjB;IACD;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wBACtB,IAAI,EAAE,wBAAwB;wBAC9B,IAAI,EAAE,QAAQ;qBACf;oBACD;wBACE,YAAY,EAAE,QAAQ;wBACtB,IAAI,EAAE,2BAA2B;wBACjC,IAAI,EAAE,QAAQ;qBACf;oBACD,EAAE,YAAY,EAAE,QAAQ,EAAE,IAAI,EAAE,mBAAmB,EAAE,IAAI,EAAE,QAAQ,EAAE;oBACrE,EAAE,YAAY,EAAE,SAAS,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,SAAS,EAAE;iBAChE;gBACD,YAAY,EAAE,4BAA4B;gBAC1C,IAAI,EAAE,EAAE;gBACR,IAAI,EAAE,OAAO;aACd;SACF;QACD,eAAe,EAAE,MAAM;QACvB,IAAI,EAAE,UAAU;KACjB;CACO,CAAC"}
|
@@ -0,0 +1,6 @@
|
|
1
|
+
import { EvmNetworkIdType, Platform } from '@sonarwatch/portfolio-core';
|
2
|
+
import { MarketDetail } from './types';
|
3
|
+
export declare const platformId = "compound";
|
4
|
+
export declare const fooPlatform: Platform;
|
5
|
+
export declare const comethTokenPricesPrefix = "cometh-token-prices";
|
6
|
+
export declare const marketDetails: Map<EvmNetworkIdType, MarketDetail[]>;
|
@@ -0,0 +1,100 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.marketDetails = exports.comethTokenPricesPrefix = exports.fooPlatform = exports.platformId = void 0;
|
4
|
+
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
5
|
+
exports.platformId = 'compound';
|
6
|
+
exports.fooPlatform = {
|
7
|
+
id: exports.platformId,
|
8
|
+
name: 'Compound',
|
9
|
+
image: 'https://sonar.watch/img/platforms/compound.png',
|
10
|
+
defiLlamaId: 'parent#compound-finance', // from https://defillama.com/docs/api
|
11
|
+
};
|
12
|
+
exports.comethTokenPricesPrefix = 'cometh-token-prices';
|
13
|
+
exports.marketDetails = new Map([
|
14
|
+
[
|
15
|
+
portfolio_core_1.NetworkId.ethereum,
|
16
|
+
[
|
17
|
+
{
|
18
|
+
networkId: portfolio_core_1.NetworkId.ethereum,
|
19
|
+
cometAddress: '0xc3d688b66703497daa19211eedff47f25384cdc3',
|
20
|
+
cometRewardAddress: '0x1b0e765f6224c21223aea2af16c1c46e38885a40',
|
21
|
+
baseAssetAddress: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
|
22
|
+
baseAssetDecimals: 6,
|
23
|
+
assets: [
|
24
|
+
{
|
25
|
+
address: '0xc00e94Cb662C3520282E6f5717214004A7f26888',
|
26
|
+
decimals: 18,
|
27
|
+
},
|
28
|
+
{
|
29
|
+
address: '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599',
|
30
|
+
decimals: 8,
|
31
|
+
},
|
32
|
+
{
|
33
|
+
address: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',
|
34
|
+
decimals: 18,
|
35
|
+
},
|
36
|
+
{
|
37
|
+
address: '0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984',
|
38
|
+
decimals: 18,
|
39
|
+
},
|
40
|
+
{
|
41
|
+
address: '0x514910771AF9Ca656af840dff83E8264EcF986CA',
|
42
|
+
decimals: 18,
|
43
|
+
},
|
44
|
+
],
|
45
|
+
},
|
46
|
+
{
|
47
|
+
networkId: portfolio_core_1.NetworkId.ethereum,
|
48
|
+
cometAddress: '0xa17581a9e3356d9a858b789d68b4d866e593ae94',
|
49
|
+
cometRewardAddress: '0x1b0e765f6224c21223aea2af16c1c46e38885a40',
|
50
|
+
baseAssetAddress: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
51
|
+
baseAssetDecimals: 18,
|
52
|
+
assets: [
|
53
|
+
{
|
54
|
+
address: '0xBe9895146f7AF43049ca1c1AE358B0541Ea49704',
|
55
|
+
decimals: 18,
|
56
|
+
},
|
57
|
+
{
|
58
|
+
address: '0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0',
|
59
|
+
decimals: 18,
|
60
|
+
},
|
61
|
+
],
|
62
|
+
},
|
63
|
+
],
|
64
|
+
],
|
65
|
+
[
|
66
|
+
portfolio_core_1.NetworkId.polygon,
|
67
|
+
[
|
68
|
+
{
|
69
|
+
networkId: portfolio_core_1.NetworkId.polygon,
|
70
|
+
cometAddress: '0xF25212E676D1F7F89Cd72fFEe66158f541246445',
|
71
|
+
cometRewardAddress: '0x45939657d1CA34A8FA39A924B71D28Fe8431e581',
|
72
|
+
baseAssetAddress: '0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174',
|
73
|
+
baseAssetDecimals: 6,
|
74
|
+
assets: [
|
75
|
+
{
|
76
|
+
address: '0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619',
|
77
|
+
decimals: 18,
|
78
|
+
},
|
79
|
+
{
|
80
|
+
address: '0x1BFD67037B42Cf73acF2047067bd4F2C47D9BfD6',
|
81
|
+
decimals: 8,
|
82
|
+
},
|
83
|
+
{
|
84
|
+
address: '0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270',
|
85
|
+
decimals: 18,
|
86
|
+
},
|
87
|
+
{
|
88
|
+
address: '0xfa68FB4628DFF1028CFEc22b4162FCcd0d45efb6',
|
89
|
+
decimals: 18,
|
90
|
+
},
|
91
|
+
{
|
92
|
+
address: '0x3A58a54C066FdC0f2D55FC9C89F0415C92eBf3C4',
|
93
|
+
decimals: 18,
|
94
|
+
},
|
95
|
+
],
|
96
|
+
},
|
97
|
+
],
|
98
|
+
],
|
99
|
+
]);
|
100
|
+
//# sourceMappingURL=constants.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/compound/constants.ts"],"names":[],"mappings":";;;AAAA,+DAIoC;AAGvB,QAAA,UAAU,GAAG,UAAU,CAAC;AACxB,QAAA,WAAW,GAAa;IACnC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,UAAU;IAChB,KAAK,EAAE,gDAAgD;IACvD,WA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AE;oBACN;wBACE,OAAO,EAAE,4CAA4C;wBACrD,QAAQ,EAAE,EAAE;qBACb;oBACD;wBACE,OAAO,EAAE,4CAA4C;wBACrD,QAAQ,EAAE,CAAC;qBACZ;oBACD;wBACE,OAAO,EAAE,4CAA4C;wBACrD,QAAQ,EAAE,EAAE;qBACb;oBACD;wBACE,OAAO,EAAE,4CAA4C;wBACrD,QAAQ,EAAE,EAAE;qBACb;oBACD;wBACE,OAAO,EAAE,4CAA4C;wBACrD,QAAQ,EAAE,EAAE;qBACb;iBACF;aACF;SACF;KACF;CACF,CAAC,CAAC"}
|
@@ -0,0 +1,130 @@
|
|
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 bignumber_js_1 = __importDefault(require("bignumber.js"));
|
17
|
+
const constants_1 = require("./constants");
|
18
|
+
const clients_1 = require("../../utils/clients");
|
19
|
+
const abis_1 = require("./abis");
|
20
|
+
const constants_2 = require("../../utils/misc/constants");
|
21
|
+
const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetToken"));
|
22
|
+
function getPositionsV3Fetcher(networkId) {
|
23
|
+
const executor = (owner, cache) => __awaiter(this, void 0, void 0, function* () {
|
24
|
+
const markets = constants_1.marketDetails.get(networkId);
|
25
|
+
if (!markets)
|
26
|
+
return [];
|
27
|
+
const client = (0, clients_1.getEvmClient)(networkId);
|
28
|
+
// Supply
|
29
|
+
const userCollateralContracts = markets
|
30
|
+
.map((m) => m.assets.map((asset) => ({
|
31
|
+
abi: abis_1.comethAbi,
|
32
|
+
address: m.cometAddress,
|
33
|
+
functionName: 'userCollateral',
|
34
|
+
args: [owner, asset.address],
|
35
|
+
})))
|
36
|
+
.flat();
|
37
|
+
const userCollateralResponses = yield client.multicall({
|
38
|
+
contracts: userCollateralContracts,
|
39
|
+
});
|
40
|
+
const isSupplyNotZero = userCollateralResponses.some((r) => r.status === 'success' &&
|
41
|
+
r.result[0] !== constants_2.zeroBigInt);
|
42
|
+
// Borrow
|
43
|
+
const borrowBalanceOfContracts = markets.map((m) => ({
|
44
|
+
abi: abis_1.comethAbi,
|
45
|
+
address: m.cometAddress,
|
46
|
+
functionName: 'borrowBalanceOf',
|
47
|
+
args: [owner],
|
48
|
+
}));
|
49
|
+
const borrowBalanceOfResponses = yield client.multicall({
|
50
|
+
contracts: borrowBalanceOfContracts,
|
51
|
+
});
|
52
|
+
const isBorrowNotZero = borrowBalanceOfResponses.some((r) => r.status === 'success' && r.result !== constants_2.zeroBigInt);
|
53
|
+
if (!isSupplyNotZero && !isBorrowNotZero)
|
54
|
+
return [];
|
55
|
+
const tokenPrices = yield cache.getItem(constants_1.comethTokenPricesPrefix, {
|
56
|
+
prefix: constants_1.comethTokenPricesPrefix,
|
57
|
+
networkId,
|
58
|
+
});
|
59
|
+
if (!tokenPrices)
|
60
|
+
return [];
|
61
|
+
let index = 0;
|
62
|
+
const elements = [];
|
63
|
+
for (let i = 0; i < markets.length; i++) {
|
64
|
+
// Borrow
|
65
|
+
const marketDetail = markets[i];
|
66
|
+
const borrowedAssets = [];
|
67
|
+
const borrowedYields = [];
|
68
|
+
const borrowBalanceOfResponse = borrowBalanceOfResponses[i];
|
69
|
+
if (borrowBalanceOfResponse.status === 'success' &&
|
70
|
+
borrowBalanceOfResponse.result !== constants_2.zeroBigInt) {
|
71
|
+
const borrowAmount = new bignumber_js_1.default(borrowBalanceOfResponse.result.toString())
|
72
|
+
.div(Math.pow(10, marketDetail.baseAssetDecimals))
|
73
|
+
.toNumber();
|
74
|
+
borrowedAssets.push((0, tokenPriceToAssetToken_1.default)(marketDetail.baseAssetAddress, borrowAmount, networkId, tokenPrices[marketDetail.baseAssetAddress]));
|
75
|
+
borrowedYields.push([]);
|
76
|
+
}
|
77
|
+
// Supply
|
78
|
+
const suppliedAssets = [];
|
79
|
+
const suppliedYields = [];
|
80
|
+
const rewardAssets = [];
|
81
|
+
for (let j = 0; j < marketDetail.assets.length; j++) {
|
82
|
+
const assetInfo = marketDetail.assets[j];
|
83
|
+
const userCollateralResponse = userCollateralResponses[index];
|
84
|
+
index += 1;
|
85
|
+
if (userCollateralResponse.status === 'failure')
|
86
|
+
continue;
|
87
|
+
const userCollateral = userCollateralResponse.result[0];
|
88
|
+
if (userCollateral === constants_2.zeroBigInt)
|
89
|
+
continue;
|
90
|
+
const amount = new bignumber_js_1.default(userCollateral.toString())
|
91
|
+
.div(Math.pow(10, assetInfo.decimals))
|
92
|
+
.toNumber();
|
93
|
+
const asset = (0, tokenPriceToAssetToken_1.default)(assetInfo.address, amount, networkId, tokenPrices[assetInfo.address]);
|
94
|
+
suppliedAssets.push(asset);
|
95
|
+
suppliedYields.push([]);
|
96
|
+
}
|
97
|
+
if (borrowedAssets.length === 0 &&
|
98
|
+
suppliedAssets.length === 0 &&
|
99
|
+
rewardAssets.length === 0)
|
100
|
+
continue;
|
101
|
+
const { borrowedValue, collateralRatio, suppliedValue, value } = (0, portfolio_core_1.getElementLendingValues)(suppliedAssets, borrowedAssets, rewardAssets);
|
102
|
+
elements.push({
|
103
|
+
type: portfolio_core_1.PortfolioElementType.borrowlend,
|
104
|
+
networkId: portfolio_core_1.NetworkId.ethereum,
|
105
|
+
platformId: constants_1.platformId,
|
106
|
+
label: 'Lending',
|
107
|
+
value,
|
108
|
+
data: {
|
109
|
+
borrowedAssets,
|
110
|
+
borrowedValue,
|
111
|
+
borrowedYields,
|
112
|
+
suppliedAssets,
|
113
|
+
suppliedValue,
|
114
|
+
suppliedYields,
|
115
|
+
collateralRatio,
|
116
|
+
rewardAssets,
|
117
|
+
value,
|
118
|
+
},
|
119
|
+
});
|
120
|
+
}
|
121
|
+
return elements;
|
122
|
+
});
|
123
|
+
return {
|
124
|
+
id: `${constants_1.platformId}-${networkId}-positions-v3`,
|
125
|
+
networkId: portfolio_core_1.NetworkId.ethereum,
|
126
|
+
executor,
|
127
|
+
};
|
128
|
+
}
|
129
|
+
exports.default = getPositionsV3Fetcher;
|
130
|
+
//# sourceMappingURL=getPositionsV3Fetcher.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"getPositionsV3Fetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/compound/getPositionsV3Fetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DASoC;AACpC,gEAAqC;AAErC,2CAIqB;AAErB,iDAAmD;AACnD,iCAAmC;AAEnC,0DAAwD;AACxD,qGAA6E;AAE7E,SAAwB,qBAAqB,CAC3C,SAA2B;IAE3B,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;QACtE,MAAM,OAAO,GAAG,yBAAa,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QAC7C,IAAI,CAAC,OAAO;YAAE,OAAO,EAAE,CAAC;QAExB,MAAM,MAAM,GAAG,IAAA,sBAAY,EAAC,SAAS,CAAC,CAAC;QAEvC,SAAS;QACT,MAAM,uBAAuB,GAAG,OAAO;aACpC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CACT,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,C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C,CAAA,CAAC;IAEF,OAAO;QACL,EAAE,EAAE,GAAG,sBAAU,IAAI,SAAS,eAAe;QAC7C,SAAS,EAAE,0BAAS,CAAC,QAAQ;QAC7B,QAAQ;KACT,CAAC;AACJ,CAAC;AA7ID,wCA6IC"}
|
@@ -0,0 +1,17 @@
|
|
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 portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
8
|
+
const constants_1 = require("./constants");
|
9
|
+
const marketsJob_1 = __importDefault(require("./marketsJob"));
|
10
|
+
const getPositionsV3Fetcher_1 = __importDefault(require("./getPositionsV3Fetcher"));
|
11
|
+
exports.platforms = [constants_1.fooPlatform];
|
12
|
+
exports.jobs = [marketsJob_1.default];
|
13
|
+
exports.fetchers = [
|
14
|
+
(0, getPositionsV3Fetcher_1.default)(portfolio_core_1.NetworkId.ethereum),
|
15
|
+
(0, getPositionsV3Fetcher_1.default)(portfolio_core_1.NetworkId.polygon),
|
16
|
+
];
|
17
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/compound/index.ts"],"names":[],"mappings":";;;;;;AAAA,+DAAiE;AAGjE,2CAA0C;AAC1C,8DAAsC;AACtC,oFAA4D;AAE/C,QAAA,SAAS,GAAe,CAAC,uBAAW,CAAC,CAAC;AACtC,QAAA,IAAI,GAAU,CAAC,oBAAU,CAAC,CAAC;AAC3B,QAAA,QAAQ,GAAc;IACjC,IAAA,+BAAqB,EAAC,0BAAS,CAAC,QAAQ,CAAC;IACzC,IAAA,+BAAqB,EAAC,0BAAS,CAAC,OAAO,CAAC;CACzC,CAAC"}
|
@@ -0,0 +1,39 @@
|
|
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 constants_1 = require("./constants");
|
13
|
+
const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
14
|
+
for (const [networkId, markets] of constants_1.marketDetails.entries()) {
|
15
|
+
const tokenAddresses = [
|
16
|
+
...new Set([
|
17
|
+
...markets.map((m) => m.baseAssetAddress),
|
18
|
+
...markets.map((m) => m.assets.map((a) => a.address)).flat(),
|
19
|
+
]),
|
20
|
+
];
|
21
|
+
const tokenPrices = yield cache.getTokenPrices(tokenAddresses, networkId);
|
22
|
+
const tokenPricesObj = {};
|
23
|
+
tokenPrices.forEach((tokenPrice) => {
|
24
|
+
if (!tokenPrice)
|
25
|
+
return;
|
26
|
+
tokenPricesObj[tokenPrice.address] = tokenPrice;
|
27
|
+
});
|
28
|
+
yield cache.setItem(constants_1.comethTokenPricesPrefix, tokenPricesObj, {
|
29
|
+
networkId,
|
30
|
+
prefix: constants_1.comethTokenPricesPrefix,
|
31
|
+
});
|
32
|
+
}
|
33
|
+
});
|
34
|
+
const job = {
|
35
|
+
id: `${constants_1.platformId}-v3-markets`,
|
36
|
+
executor,
|
37
|
+
};
|
38
|
+
exports.default = job;
|
39
|
+
//# sourceMappingURL=marketsJob.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"marketsJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/compound/marketsJob.ts"],"names":[],"mappings":";;;;;;;;;;;AAGA,2CAIqB;AAErB,MAAM,QAAQ,GAAgB,CAAO,KAAY,EAAE,EAAE;IACnD,KAAK,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,IAAI,yBAAa,CAAC,OAAO,EAAE,EAAE;QAC1D,MAAM,cAAc,GAAG;YACrB,GAAG,IAAI,GAAG,CAAC;gBACT,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,gBAAgB,CAAC;gBACzC,GAAG,OAAO,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;aAC7D,CAAC;SACH,CAAC;QACF,MAAM,WAAW,GAAG,MAAM,KAAK,CAAC,cAAc,CAAC,cAAc,EAAE,SAAS,CAAC,CAAC;QAC1E,MAAM,cAAc,GAA+B,EAAE,CAAC;QACtD,WAAW,CAAC,OAAO,CAAC,CAAC,UAAU,EAAE,EAAE;YACjC,IAAI,CAAC,UAAU;gBAAE,OAAO;YACxB,cAAc,CAAC,UAAU,CAAC,OAAO,CAAC,GAAG,UAAU,CAAC;QAClD,CAAC,CAAC,CAAC;QAEH,MAAM,KAAK,CAAC,OAAO,CAAC,mCAAuB,EAAE,cAAc,EAAE;YAC3D,SAAS;YACT,MAAM,EAAE,mCAAuB;SAChC,CAAC,CAAC;KACJ;AACH,CAAC,CAAA,CAAC;AACF,MAAM,GAAG,GAAQ;IACf,EAAE,EAAE,GAAG,sBAAU,aAAa;IAC9B,QAAQ;CACT,CAAC;AACF,kBAAe,GAAG,CAAC"}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { EvmNetworkIdType } from '@sonarwatch/portfolio-core';
|
2
|
+
export type UserCollateralResult = [bigint, bigint];
|
3
|
+
export type MarketDetail = {
|
4
|
+
networkId: EvmNetworkIdType;
|
5
|
+
cometAddress: `0x${string}`;
|
6
|
+
cometRewardAddress: `0x${string}`;
|
7
|
+
baseAssetAddress: `0x${string}`;
|
8
|
+
baseAssetDecimals: number;
|
9
|
+
assets: {
|
10
|
+
address: `0x${string}`;
|
11
|
+
decimals: number;
|
12
|
+
}[];
|
13
|
+
};
|