@sonarwatch/portfolio-plugins 0.11.158 → 0.11.159
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +1359 -1355
- package/README.md +3 -3
- package/package.json +2 -2
- package/src/plugins/abex/marketsJob.js +2 -2
- package/src/plugins/abex/marketsJob.js.map +1 -1
- package/src/plugins/aftermath/poolsJob.js +36 -102
- package/src/plugins/aftermath/poolsJob.js.map +1 -1
- package/src/plugins/atrix/poolsV1Job.js +2 -2
- package/src/plugins/atrix/poolsV1Job.js.map +1 -1
- package/src/plugins/auxexchange/aptosLpJob.js +6 -4
- package/src/plugins/auxexchange/aptosLpJob.js.map +1 -1
- package/src/plugins/balancer/helpers/pools.js +21 -21
- package/src/plugins/fluxbeam/poolsJob.js +6 -4
- package/src/plugins/fluxbeam/poolsJob.js.map +1 -1
- package/src/plugins/kai/vaultsJob.js +2 -2
- package/src/plugins/kai/vaultsJob.js.map +1 -1
- package/src/plugins/liquiditypools-sei/job.js +6 -4
- package/src/plugins/liquiditypools-sei/job.js.map +1 -1
- package/src/plugins/liquidswap/aptosLpJob.js +2 -2
- package/src/plugins/liquidswap/aptosLpJob.js.map +1 -1
- package/src/plugins/marginfi/banksJob.d.ts +3 -0
- package/src/plugins/marginfi/{jobExecutor.js → banksJob.js} +8 -3
- package/src/plugins/marginfi/banksJob.js.map +1 -0
- package/src/plugins/marginfi/depositsFetcher.d.ts +3 -0
- package/src/plugins/marginfi/{fetcherExecutor.js → depositsFetcher.js} +8 -3
- package/src/plugins/marginfi/{fetcherExecutor.js.map → depositsFetcher.js.map} +1 -1
- package/src/plugins/marginfi/index.js +4 -17
- package/src/plugins/marginfi/index.js.map +1 -1
- package/src/plugins/meteora/multiTokenPoolsJob.js +2 -2
- package/src/plugins/meteora/multiTokenPoolsJob.js.map +1 -1
- package/src/plugins/meteora/poolsJob.js +6 -4
- package/src/plugins/meteora/poolsJob.js.map +1 -1
- package/src/plugins/orca/lpTokensJob.js +6 -4
- package/src/plugins/orca/lpTokensJob.js.map +1 -1
- package/src/plugins/pancakeswap/aptosLpJob.js +6 -4
- package/src/plugins/pancakeswap/aptosLpJob.js.map +1 -1
- package/src/plugins/raydium/lpTokensJob.js +6 -4
- package/src/plugins/raydium/lpTokensJob.js.map +1 -1
- package/src/plugins/sushiswap/aptos/poolsJob.js +2 -2
- package/src/plugins/sushiswap/aptos/poolsJob.js.map +1 -1
- package/src/plugins/sushiswap/helpers.js +24 -24
- package/src/plugins/symmetry/basketsJob.js +2 -2
- package/src/plugins/symmetry/basketsJob.js.map +1 -1
- package/src/plugins/tulip/lendingTokensJob.js +2 -2
- package/src/plugins/tulip/lendingTokensJob.js.map +1 -1
- package/src/plugins/tulip/strategyTokensJob.js +2 -2
- package/src/plugins/tulip/strategyTokensJob.js.map +1 -1
- package/src/plugins/uniswap-v2/helpers.js +22 -22
- package/src/utils/clmm/tokenPricesFromSqrt.js +11 -4
- package/src/utils/clmm/tokenPricesFromSqrt.js.map +1 -1
- package/src/utils/misc/getLpTokenSource.d.ts +13 -9
- package/src/utils/misc/getLpTokenSource.js +29 -8
- package/src/utils/misc/getLpTokenSource.js.map +1 -1
- package/src/utils/misc/getLpTokenSourceOld.d.ts +18 -0
- package/src/utils/misc/getLpTokenSourceOld.js +32 -0
- package/src/utils/misc/getLpTokenSourceOld.js.map +1 -0
- package/src/utils/misc/getLpTokenSourceRaw.d.ts +16 -5
- package/src/utils/misc/getLpTokenSourceRaw.js +22 -6
- package/src/utils/misc/getLpTokenSourceRaw.js.map +1 -1
- package/src/utils/misc/getLpTokenSourceRawOld.d.ts +25 -0
- package/src/utils/misc/getLpTokenSourceRawOld.js +20 -0
- package/src/utils/misc/getLpTokenSourceRawOld.js.map +1 -0
- package/src/utils/misc/getLpUnderlyingTokenSource.d.ts +14 -18
- package/src/utils/misc/getLpUnderlyingTokenSource.js +101 -70
- package/src/utils/misc/getLpUnderlyingTokenSource.js.map +1 -1
- package/src/utils/misc/getLpUnderlyingTokenSourceOld.d.ts +26 -0
- package/src/utils/misc/getLpUnderlyingTokenSourceOld.js +73 -0
- package/src/utils/misc/getLpUnderlyingTokenSourceOld.js.map +1 -0
- package/src/utils/sei/constants.js +8 -8
- package/src/utils/sei/getQueryBalanceByOwner.js +4 -4
- package/src/plugins/marginfi/fetcherExecutor.d.ts +0 -3
- package/src/plugins/marginfi/jobExecutor.d.ts +0 -3
- package/src/plugins/marginfi/jobExecutor.js.map +0 -1
@@ -17,7 +17,7 @@ const clients_1 = require("../../utils/clients");
|
|
17
17
|
const solana_1 = require("../../utils/solana");
|
18
18
|
const constants_1 = require("./constants");
|
19
19
|
const structs_1 = require("./structs");
|
20
|
-
const
|
20
|
+
const getLpTokenSourceOld_1 = __importDefault(require("../../utils/misc/getLpTokenSourceOld"));
|
21
21
|
const filters_1 = require("./filters");
|
22
22
|
const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
23
23
|
const client = (0, clients_1.getClientSolana)();
|
@@ -55,7 +55,7 @@ const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
|
55
55
|
const { supply, decimals } = mintAccount;
|
56
56
|
if (supply.isZero())
|
57
57
|
continue;
|
58
|
-
const lpTokenSource = (0,
|
58
|
+
const lpTokenSource = (0, getLpTokenSourceOld_1.default)(portfolio_core_1.NetworkId.solana, lpMint, constants_1.platformId, {
|
59
59
|
address: lpMint.toString(),
|
60
60
|
decimals,
|
61
61
|
supply: supply.dividedBy(Math.pow(10, decimals)).toNumber(),
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"strategyTokensJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/tulip/strategyTokensJob.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAAuD;AAIvD,iDAAsD;AACtD,+CAK4B;AAC5B,2CAAsE;AACtE,uCAA0D;AAC1D
|
1
|
+
{"version":3,"file":"strategyTokensJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/tulip/strategyTokensJob.ts"],"names":[],"mappings":";;;;;;;;;;;;;;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,CAAC,SAAS,CAAC,SAAA,EAAE,EAAI,QAAQ,CAAA,CAAC,CAAC,QAAQ,EAAE;SACpD,EACD;4CAEO,UAAU,KACb,aAAa,EAAE,YAAY,CAAC,QAAQ,EAAE;SAEzC,CACF,CAAC;QACF,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,mBAAmB,CAAC,aAAa,CAAC,CAAC,CAAC;IAC1D,CAAC;IAED,MAAM,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AAC9B,CAAC,CAAA,CAAC;AAEF,MAAM,GAAG,GAAQ;IACf,EAAE,EAAE,GAAG,sBAAU,kBAAkB;IACnC,QAAQ;IACR,KAAK,EAAE,QAAQ;CAChB,CAAC;AACF,kBAAe,GAAG,CAAC"}
|
@@ -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;
|
@@ -13,6 +13,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
13
13
|
};
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
15
15
|
exports.sqrtPriceX64ToPrice = void 0;
|
16
|
+
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
16
17
|
const decimal_js_1 = __importDefault(require("decimal.js"));
|
17
18
|
const getDecimalsForToken_1 = require("../misc/getDecimalsForToken");
|
18
19
|
const constants_1 = require("../../plugins/tokens/constants");
|
@@ -20,9 +21,15 @@ const getSourceWeight_1 = __importDefault(require("../misc/getSourceWeight"));
|
|
20
21
|
const computeAndStoreLpPrice_1 = require("../misc/computeAndStoreLpPrice");
|
21
22
|
const getLpUnderlyingTokenSource_1 = require("../misc/getLpUnderlyingTokenSource");
|
22
23
|
function storeTokenPricesFromSqrt(cache, networkId, source, reserveX, reserveY, sqrtPrice, mintX, mintY, tempDecimalsX, tempDecimalsY) {
|
24
|
+
var _a, _b, _c, _d;
|
23
25
|
return __awaiter(this, void 0, void 0, function* () {
|
24
|
-
|
25
|
-
|
26
|
+
const isAcceptedX = (_b = (_a = getLpUnderlyingTokenSource_1.defaultAcceptedPairs
|
27
|
+
.get(networkId)) === null || _a === void 0 ? void 0 : _a.includes((0, portfolio_core_1.formatTokenAddress)(mintX, networkId))) !== null && _b !== void 0 ? _b : false;
|
28
|
+
const isAcceptedY = (_d = (_c = getLpUnderlyingTokenSource_1.defaultAcceptedPairs
|
29
|
+
.get(networkId)) === null || _c === void 0 ? void 0 : _c.includes((0, portfolio_core_1.formatTokenAddress)(mintY, networkId))) !== null && _d !== void 0 ? _d : false;
|
30
|
+
if (!isAcceptedX && !isAcceptedY)
|
31
|
+
return undefined;
|
32
|
+
if (isAcceptedX && isAcceptedY)
|
26
33
|
return undefined;
|
27
34
|
const [tokenPriceX, tokenPriceY] = yield cache.getTokenPrices([mintX, mintY], networkId);
|
28
35
|
if (!tokenPriceX && !tokenPriceY)
|
@@ -32,7 +39,7 @@ function storeTokenPricesFromSqrt(cache, networkId, source, reserveX, reserveY,
|
|
32
39
|
if (!decimalsX || !decimalsY)
|
33
40
|
return undefined;
|
34
41
|
const xToYPrice = sqrtPriceX64ToPrice(sqrtPrice, decimalsX, decimalsY);
|
35
|
-
if (tokenPriceX &&
|
42
|
+
if (tokenPriceX && isAcceptedX) {
|
36
43
|
const price = tokenPriceX.price * new decimal_js_1.default(1).dividedBy(xToYPrice).toNumber();
|
37
44
|
const tvl = reserveX
|
38
45
|
.multipliedBy(tokenPriceX.price)
|
@@ -54,7 +61,7 @@ function storeTokenPricesFromSqrt(cache, networkId, source, reserveX, reserveY,
|
|
54
61
|
yield cache.setTokenPriceSource(tokenPriceSource);
|
55
62
|
return [tokenPriceX.price, price];
|
56
63
|
}
|
57
|
-
if (tokenPriceY &&
|
64
|
+
if (tokenPriceY && isAcceptedY) {
|
58
65
|
const price = tokenPriceY.price * xToYPrice.toNumber();
|
59
66
|
const tvl = reserveY
|
60
67
|
.multipliedBy(tokenPriceY.price)
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"tokenPricesFromSqrt.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/clmm/tokenPricesFromSqrt.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;
|
1
|
+
{"version":3,"file":"tokenPricesFromSqrt.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/clmm/tokenPricesFromSqrt.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+DAIoC;AAEpC,4DAAiC;AAEjC,qEAAkE;AAClE,8DAAsE;AACtE,8EAAsD;AACtD,2EAAkE;AAClE,mFAA0E;AAE1E,SAA8B,wBAAwB,CACpD,KAA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MAAM;gBACV,MAAM;gBACN,OAAO,EAAE,KAAK;gBACd,SAAS;gBACT,UAAU,EAAE,gCAAoB,CAAC,EAAE;gBACnC,QAAQ,EAAE,SAAS;gBACnB,KAAK;gBACL,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;aACtB,CAAC;YACF,MAAM,KAAK,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,CAAC;YAClD,OAAO,CAAC,KAAK,EAAE,WAAW,CAAC,KAAK,CAAC,CAAC;QACpC,CAAC;QAED,OAAO,SAAS,CAAC;;CAClB;AAjFD,2CAiFC;AAED,MAAM,cAAc,GAAG,CAAC,GAAY,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,oBAAO,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AAExE,SAAgB,mBAAmB,CACjC,YAAuB,EACvB,SAAiB,EACjB,SAAiB;IAEjB,OAAO,cAAc,CAAC,IAAI,oBAAO,CAAC,YAAY,CAAC,QAAQ,EAAE,CAAC,CAAC;SACxD,GAAG,CAAC,CAAC,CAAC;SACN,GAAG,CAAC,oBAAO,CAAC,GAAG,CAAC,EAAE,EAAE,SAAS,GAAG,SAAS,CAAC,CAAC,CAAC;AACjD,CAAC;AARD,kDAQC"}
|
@@ -1,14 +1,18 @@
|
|
1
1
|
import { NetworkIdType, TokenPriceSource } from '@sonarwatch/portfolio-core';
|
2
|
-
|
3
|
-
|
4
|
-
reserveAmount: number;
|
5
|
-
price: number;
|
6
|
-
decimals: number;
|
7
|
-
};
|
8
|
-
type LpDetails = {
|
2
|
+
import { PoolUnderlying } from './getLpUnderlyingTokenSource';
|
3
|
+
export type LpDetails = {
|
9
4
|
address: string;
|
10
5
|
decimals: number;
|
11
6
|
supply: number;
|
12
7
|
};
|
13
|
-
export
|
14
|
-
|
8
|
+
export type GetLpTokenSourceParams = {
|
9
|
+
networkId: NetworkIdType;
|
10
|
+
sourceId: string;
|
11
|
+
platformId: string;
|
12
|
+
lpDetails: LpDetails;
|
13
|
+
poolUnderlyings: PoolUnderlying[];
|
14
|
+
elementName?: string;
|
15
|
+
liquidityName?: string;
|
16
|
+
priceUnderlyings?: boolean;
|
17
|
+
};
|
18
|
+
export declare function getLpTokenSource(params: GetLpTokenSourceParams): TokenPriceSource[];
|
@@ -1,27 +1,48 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
exports.getLpTokenSource = void 0;
|
4
|
+
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
5
|
+
const getLpUnderlyingTokenSource_1 = require("./getLpUnderlyingTokenSource");
|
6
|
+
function getLpTokenSource(params) {
|
7
|
+
const { poolUnderlyings, liquidityName, elementName, lpDetails, platformId, sourceId, networkId, priceUnderlyings, } = params;
|
8
|
+
const sources = [];
|
9
|
+
// Price underlyings
|
10
|
+
if (priceUnderlyings) {
|
11
|
+
const uSources = (0, getLpUnderlyingTokenSource_1.getLpUnderlyingTokenSource)({
|
12
|
+
networkId,
|
13
|
+
sourceId: lpDetails.address,
|
14
|
+
poolUnderlyings,
|
15
|
+
});
|
16
|
+
sources.push(...uSources);
|
17
|
+
}
|
18
|
+
if (poolUnderlyings.some((u) => !u.tokenPrice))
|
19
|
+
return sources;
|
20
|
+
// Price LP
|
21
|
+
const price = poolUnderlyings.reduce(
|
22
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
23
|
+
(acc, u) => acc + u.reserveAmount * u.tokenPrice.price, 0) / lpDetails.supply;
|
24
|
+
const lpSource = {
|
7
25
|
networkId,
|
8
26
|
platformId,
|
9
27
|
id: sourceId,
|
10
28
|
elementName,
|
11
29
|
liquidityName,
|
12
30
|
weight: 1,
|
13
|
-
address: lpDetails.address,
|
31
|
+
address: (0, portfolio_core_1.formatTokenAddress)(lpDetails.address, networkId),
|
14
32
|
price,
|
15
33
|
decimals: lpDetails.decimals,
|
16
34
|
underlyings: poolUnderlyings.map((u) => ({
|
17
35
|
networkId,
|
18
|
-
address: u.address,
|
19
|
-
|
36
|
+
address: (0, portfolio_core_1.formatTokenAddress)(u.address, networkId),
|
37
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
38
|
+
price: u.tokenPrice.price,
|
20
39
|
amountPerLp: u.reserveAmount / lpDetails.supply,
|
21
40
|
decimals: u.decimals,
|
22
41
|
})),
|
23
42
|
timestamp: Date.now(),
|
24
43
|
};
|
44
|
+
sources.push(lpSource);
|
45
|
+
return sources;
|
25
46
|
}
|
26
|
-
exports.
|
47
|
+
exports.getLpTokenSource = getLpTokenSource;
|
27
48
|
//# sourceMappingURL=getLpTokenSource.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"getLpTokenSource.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/misc/getLpTokenSource.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"getLpTokenSource.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/misc/getLpTokenSource.ts"],"names":[],"mappings":";;;AAAA,+DAIoC;AACpC,6EAGsC;AAmBtC,SAAgB,gBAAgB,CAC9B,MAA8B;IAE9B,MAAM,EACJ,eAAe,EACf,aAAa,EACb,WAAW,EACX,SAAS,EACT,UAAU,EACV,QAAQ,EACR,SAAS,EACT,gBAAgB,GACjB,GAAG,MAAM,CAAC;IACX,MAAM,OAAO,GAAuB,EAAE,CAAC;IAEvC,oBAAoB;IACpB,IAAI,gBAAgB,EAAE,CAAC;QACrB,MAAM,QAAQ,GAAG,IAAA,uDAA0B,EAAC;YAC1C,SAAS;YACT,QAAQ,EAAE,SAAS,CAAC,OAAO;YAC3B,eAAe;SAChB,CAAC,CAAC;QACH,OAAO,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,CAAC;IAC5B,CAAC;IAED,IAAI,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC;QAAE,OAAO,OAAO,CAAC;IAC/D,WAAW;IACX,MAAM,KAAK,GACT,eAAe,CAAC,MAAM;IACpB,oEAAoE;IACpE,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,aAAa,GAAG,CAAC,CAAC,UAAW,CAAC,KAAK,EACvD,CAAC,CACF,GAAG,SAAS,CAAC,MAAM,CAAC;IACvB,MAAM,QAAQ,GAAqB;QACjC,SAAS;QACT,UAAU;QACV,EAAE,EAAE,QAAQ;QACZ,WAAW;QACX,aAAa;QACb,MAAM,EAAE,CAAC;QACT,OAAO,EAAE,IAAA,mCAAkB,EAAC,SAAS,CAAC,OAAO,EAAE,SAAS,CAAC;QACzD,KAAK;QACL,QAAQ,EAAE,SAAS,CAAC,QAAQ;QAC5B,WAAW,EAAE,eAAe,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACvC,SAAS;YACT,OAAO,EAAE,IAAA,mCAAkB,EAAC,CAAC,CAAC,OAAO,EAAE,SAAS,CAAC;YACjD,oEAAoE;YACpE,KAAK,EAAE,CAAC,CAAC,UAAW,CAAC,KAAK;YAC1B,WAAW,EAAE,CAAC,CAAC,aAAa,GAAG,SAAS,CAAC,MAAM;YAC/C,QAAQ,EAAE,CAAC,CAAC,QAAQ;SACrB,CAAC,CAAC;QACH,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;KACtB,CAAC;IACF,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACvB,OAAO,OAAO,CAAC;AACjB,CAAC;AAvDD,4CAuDC"}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import { NetworkIdType, TokenPriceSource } from '@sonarwatch/portfolio-core';
|
2
|
+
type PoolUnderlying = {
|
3
|
+
address: string;
|
4
|
+
reserveAmount: number;
|
5
|
+
price: number;
|
6
|
+
decimals: number;
|
7
|
+
};
|
8
|
+
type LpDetails = {
|
9
|
+
address: string;
|
10
|
+
decimals: number;
|
11
|
+
supply: number;
|
12
|
+
};
|
13
|
+
/**
|
14
|
+
* @deprecated
|
15
|
+
* This function has been deprecated. Use the new getLpTokenSource instead.
|
16
|
+
*/
|
17
|
+
export default function getLpTokenSourceOld(networkId: NetworkIdType, sourceId: string, platformId: string, lpDetails: LpDetails, poolUnderlyings: PoolUnderlying[], elementName?: string, liquidityName?: string): TokenPriceSource;
|
18
|
+
export {};
|
@@ -0,0 +1,32 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
4
|
+
/**
|
5
|
+
* @deprecated
|
6
|
+
* This function has been deprecated. Use the new getLpTokenSource instead.
|
7
|
+
*/
|
8
|
+
function getLpTokenSourceOld(networkId, sourceId, platformId, lpDetails, poolUnderlyings, elementName, liquidityName) {
|
9
|
+
const price = poolUnderlyings.reduce((acc, u) => acc + u.reserveAmount * u.price, 0) /
|
10
|
+
lpDetails.supply;
|
11
|
+
return {
|
12
|
+
networkId,
|
13
|
+
platformId,
|
14
|
+
id: sourceId,
|
15
|
+
elementName,
|
16
|
+
liquidityName,
|
17
|
+
weight: 1,
|
18
|
+
address: (0, portfolio_core_1.formatTokenAddress)(lpDetails.address, networkId),
|
19
|
+
price,
|
20
|
+
decimals: lpDetails.decimals,
|
21
|
+
underlyings: poolUnderlyings.map((u) => ({
|
22
|
+
networkId,
|
23
|
+
address: (0, portfolio_core_1.formatTokenAddress)(u.address, networkId),
|
24
|
+
price: u.price,
|
25
|
+
amountPerLp: u.reserveAmount / lpDetails.supply,
|
26
|
+
decimals: u.decimals,
|
27
|
+
})),
|
28
|
+
timestamp: Date.now(),
|
29
|
+
};
|
30
|
+
}
|
31
|
+
exports.default = getLpTokenSourceOld;
|
32
|
+
//# sourceMappingURL=getLpTokenSourceOld.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"getLpTokenSourceOld.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/misc/getLpTokenSourceOld.ts"],"names":[],"mappings":";;AAAA,+DAIoC;AAepC;;;GAGG;AACH,SAAwB,mBAAmB,CACzC,SAAwB,EACxB,QAAgB,EAChB,UAAkB,EAClB,SAAoB,EACpB,eAAiC,EACjC,WAAoB,EACpB,aAAsB;IAEtB,MAAM,KAAK,GACT,eAAe,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,aAAa,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC;QACtE,SAAS,CAAC,MAAM,CAAC;IAEnB,OAAO;QACL,SAAS;QACT,UAAU;QACV,EAAE,EAAE,QAAQ;QACZ,WAAW;QACX,aAAa;QACb,MAAM,EAAE,CAAC;QACT,OAAO,EAAE,IAAA,mCAAkB,EAAC,SAAS,CAAC,OAAO,EAAE,SAAS,CAAC;QACzD,KAAK;QACL,QAAQ,EAAE,SAAS,CAAC,QAAQ;QAC5B,WAAW,EAAE,eAAe,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACvC,SAAS;YACT,OAAO,EAAE,IAAA,mCAAkB,EAAC,CAAC,CAAC,OAAO,EAAE,SAAS,CAAC;YACjD,KAAK,EAAE,CAAC,CAAC,KAAK;YACd,WAAW,EAAE,CAAC,CAAC,aAAa,GAAG,SAAS,CAAC,MAAM;YAC/C,QAAQ,EAAE,CAAC,CAAC,QAAQ;SACrB,CAAC,CAAC;QACH,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;KACtB,CAAC;AACJ,CAAC;AAhCD,sCAgCC"}
|
@@ -1,15 +1,26 @@
|
|
1
|
-
import { NetworkIdType, TokenPriceSource } from '@sonarwatch/portfolio-core';
|
1
|
+
import { NetworkIdType, TokenPrice, TokenPriceSource } from '@sonarwatch/portfolio-core';
|
2
2
|
import BigNumber from 'bignumber.js';
|
3
3
|
export type PoolUnderlyingRaw = {
|
4
4
|
address: string;
|
5
|
-
reserveAmountRaw: BigNumber;
|
6
|
-
price: number;
|
5
|
+
reserveAmountRaw: BigNumber | string;
|
7
6
|
decimals: number;
|
7
|
+
weight: number;
|
8
|
+
tokenPrice?: TokenPrice;
|
8
9
|
};
|
9
10
|
type LpDetailsRaw = {
|
10
11
|
address: string;
|
11
12
|
decimals: number;
|
12
|
-
supplyRaw: BigNumber;
|
13
|
+
supplyRaw: BigNumber | string;
|
13
14
|
};
|
14
|
-
export
|
15
|
+
export type GetLpTokenSourceRawParams = {
|
16
|
+
networkId: NetworkIdType;
|
17
|
+
sourceId: string;
|
18
|
+
platformId: string;
|
19
|
+
lpDetails: LpDetailsRaw;
|
20
|
+
poolUnderlyingsRaw: PoolUnderlyingRaw[];
|
21
|
+
elementName?: string;
|
22
|
+
liquidityName?: string;
|
23
|
+
priceUnderlyings?: boolean;
|
24
|
+
};
|
25
|
+
export declare function getLpTokenSourceRaw(params: GetLpTokenSourceRawParams): TokenPriceSource[];
|
15
26
|
export {};
|
@@ -3,11 +3,27 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
6
|
+
exports.getLpTokenSourceRaw = void 0;
|
7
|
+
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
8
|
+
const getLpTokenSource_1 = require("./getLpTokenSource");
|
9
|
+
function getLpTokenSourceRaw(params) {
|
10
|
+
const { lpDetails, poolUnderlyingsRaw } = params;
|
11
|
+
const fLpDetails = Object.assign(Object.assign({}, lpDetails), { supply: new bignumber_js_1.default(lpDetails.supplyRaw)
|
12
|
+
.div(Math.pow(10, lpDetails.decimals))
|
13
|
+
.toNumber() });
|
14
|
+
const fPoolUnderlyingsRaw = poolUnderlyingsRaw.map((pu) => (Object.assign(Object.assign({}, pu), { reserveAmount: new bignumber_js_1.default(pu.reserveAmountRaw)
|
15
|
+
.div(Math.pow(10, pu.decimals))
|
16
|
+
.toNumber() })));
|
17
|
+
return (0, getLpTokenSource_1.getLpTokenSource)({
|
18
|
+
lpDetails: fLpDetails,
|
19
|
+
networkId: params.networkId,
|
20
|
+
platformId: params.platformId,
|
21
|
+
sourceId: params.sourceId,
|
22
|
+
poolUnderlyings: fPoolUnderlyingsRaw,
|
23
|
+
elementName: params.elementName,
|
24
|
+
liquidityName: params.elementName,
|
25
|
+
priceUnderlyings: params.priceUnderlyings,
|
26
|
+
});
|
11
27
|
}
|
12
|
-
exports.
|
28
|
+
exports.getLpTokenSourceRaw = getLpTokenSourceRaw;
|
13
29
|
//# sourceMappingURL=getLpTokenSourceRaw.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"getLpTokenSourceRaw.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/misc/getLpTokenSourceRaw.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"getLpTokenSourceRaw.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/misc/getLpTokenSourceRaw.ts"],"names":[],"mappings":";;;;;;AAKA,gEAAqC;AACrC,yDAAiE;AA4BjE,SAAgB,mBAAmB,CACjC,MAAiC;IAEjC,MAAM,EAAE,SAAS,EAAE,kBAAkB,EAAE,GAAG,MAAM,CAAC;IACjD,MAAM,UAAU,mCACX,SAAS,KACZ,MAAM,EAAE,IAAI,sBAAS,CAAC,SAAS,CAAC,SAAS,CAAC;aACvC,GAAG,CAAC,SAAA,EAAE,EAAI,SAAS,CAAC,QAAQ,CAAA,CAAC;aAC7B,QAAQ,EAAE,GACd,CAAC;IACF,MAAM,mBAAmB,GAAqB,kBAAkB,CAAC,GAAG,CAClE,CAAC,EAAE,EAAE,EAAE,CAAC,iCACH,EAAE,KACL,aAAa,EAAE,IAAI,sBAAS,CAAC,EAAE,CAAC,gBAAgB,CAAC;aAC9C,GAAG,CAAC,SAAA,EAAE,EAAI,EAAE,CAAC,QAAQ,CAAA,CAAC;aACtB,QAAQ,EAAE,IACb,CACH,CAAC;IAEF,OAAO,IAAA,mCAAgB,EAAC;QACtB,SAAS,EAAE,UAAU;QACrB,SAAS,EAAE,MAAM,CAAC,SAAS;QAC3B,UAAU,EAAE,MAAM,CAAC,UAAU;QAC7B,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,eAAe,EAAE,mBAAmB;QACpC,WAAW,EAAE,MAAM,CAAC,WAAW;QAC/B,aAAa,EAAE,MAAM,CAAC,WAAW;QACjC,gBAAgB,EAAE,MAAM,CAAC,gBAAgB;KAC1C,CAAC,CAAC;AACL,CAAC;AA7BD,kDA6BC"}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import { NetworkIdType, TokenPriceSource } from '@sonarwatch/portfolio-core';
|
2
|
+
import BigNumber from 'bignumber.js';
|
3
|
+
/**
|
4
|
+
* @deprecated
|
5
|
+
*/
|
6
|
+
export type PoolUnderlyingRaw = {
|
7
|
+
address: string;
|
8
|
+
reserveAmountRaw: BigNumber | string;
|
9
|
+
price: number;
|
10
|
+
decimals: number;
|
11
|
+
};
|
12
|
+
/**
|
13
|
+
* @deprecated
|
14
|
+
*/
|
15
|
+
type LpDetailsRaw = {
|
16
|
+
address: string;
|
17
|
+
decimals: number;
|
18
|
+
supplyRaw: BigNumber | string;
|
19
|
+
};
|
20
|
+
/**
|
21
|
+
* @deprecated
|
22
|
+
* This function has been deprecated. Use the new getLpTokenSourceRaw instead.
|
23
|
+
*/
|
24
|
+
export default function getLpTokenSourceRawOld(networkId: NetworkIdType, sourceId: string, platformId: string, lpDetailsRaw: LpDetailsRaw, poolUnderlyingsRaw: PoolUnderlyingRaw[], elementName?: string, liquidityName?: string): TokenPriceSource;
|
25
|
+
export {};
|
@@ -0,0 +1,20 @@
|
|
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
|
+
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
7
|
+
const getLpTokenSourceOld_1 = __importDefault(require("./getLpTokenSourceOld"));
|
8
|
+
/**
|
9
|
+
* @deprecated
|
10
|
+
* This function has been deprecated. Use the new getLpTokenSourceRaw instead.
|
11
|
+
*/
|
12
|
+
function getLpTokenSourceRawOld(networkId, sourceId, platformId, lpDetailsRaw, poolUnderlyingsRaw, elementName, liquidityName) {
|
13
|
+
return (0, getLpTokenSourceOld_1.default)(networkId, sourceId, platformId, Object.assign(Object.assign({}, lpDetailsRaw), { supply: new bignumber_js_1.default(lpDetailsRaw.supplyRaw)
|
14
|
+
.div(Math.pow(10, lpDetailsRaw.decimals))
|
15
|
+
.toNumber() }), poolUnderlyingsRaw.map((u) => (Object.assign(Object.assign({}, u), { reserveAmount: new bignumber_js_1.default(u.reserveAmountRaw)
|
16
|
+
.div(Math.pow(10, u.decimals))
|
17
|
+
.toNumber() }))), elementName, liquidityName);
|
18
|
+
}
|
19
|
+
exports.default = getLpTokenSourceRawOld;
|
20
|
+
//# sourceMappingURL=getLpTokenSourceRawOld.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"getLpTokenSourceRawOld.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/misc/getLpTokenSourceRawOld.ts"],"names":[],"mappings":";;;;;AACA,gEAAqC;AACrC,gFAAwD;AAqBxD;;;GAGG;AACH,SAAwB,sBAAsB,CAC5C,SAAwB,EACxB,QAAgB,EAChB,UAAkB,EAClB,YAA0B,EAC1B,kBAAuC,EACvC,WAAoB,EACpB,aAAsB;IAEtB,OAAO,IAAA,6BAAmB,EACxB,SAAS,EACT,QAAQ,EACR,UAAU,kCAEL,YAAY,KACf,MAAM,EAAE,IAAI,sBAAS,CAAC,YAAY,CAAC,SAAS,CAAC;aAC1C,GAAG,CAAC,SAAA,EAAE,EAAI,YAAY,CAAC,QAAQ,CAAA,CAAC;aAChC,QAAQ,EAAE,KAEf,kBAAkB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,iCACzB,CAAC,KACJ,aAAa,EAAE,IAAI,sBAAS,CAAC,CAAC,CAAC,gBAAgB,CAAC;aAC7C,GAAG,CAAC,SAAA,EAAE,EAAI,CAAC,CAAC,QAAQ,CAAA,CAAC;aACrB,QAAQ,EAAE,IACb,CAAC,EACH,WAAW,EACX,aAAa,CACd,CAAC;AACJ,CAAC;AA5BD,yCA4BC"}
|
@@ -1,22 +1,18 @@
|
|
1
1
|
import { NetworkIdType, TokenPrice, TokenPriceSource } from '@sonarwatch/portfolio-core';
|
2
|
-
|
3
|
-
export type
|
4
|
-
id: string;
|
5
|
-
supply: BigNumber;
|
6
|
-
lpDecimals: number;
|
7
|
-
reserveTokenX: BigNumber;
|
8
|
-
reserveTokenY: BigNumber;
|
9
|
-
mintTokenX: string;
|
10
|
-
decimalX?: number;
|
11
|
-
mintTokenY: string;
|
12
|
-
decimalY?: number;
|
13
|
-
};
|
14
|
-
type PoolUnderlyingRaw = {
|
2
|
+
export declare const defaultAcceptedPairs: Map<NetworkIdType, string[]>;
|
3
|
+
export type PoolUnderlying = {
|
15
4
|
address: string;
|
16
|
-
|
5
|
+
reserveAmount: number;
|
17
6
|
decimals: number;
|
18
|
-
|
7
|
+
weight: number;
|
8
|
+
tokenPrice?: TokenPrice;
|
9
|
+
};
|
10
|
+
export type GetLpUnderlyingTokenSourceParams = {
|
11
|
+
networkId: NetworkIdType;
|
12
|
+
sourceId: string;
|
13
|
+
poolUnderlyings: PoolUnderlying[];
|
14
|
+
platformId?: string;
|
15
|
+
acceptedPairs?: string[];
|
16
|
+
minReserveValue?: number;
|
19
17
|
};
|
20
|
-
export declare
|
21
|
-
export default function getLpUnderlyingTokenSource(sourceId: string, networkId: NetworkIdType, poolUnderlyingsA: PoolUnderlyingRaw, poolUnderlyingsB: PoolUnderlyingRaw, minTvl?: number, acceptedPairs?: string[]): TokenPriceSource | null;
|
22
|
-
export {};
|
18
|
+
export declare function getLpUnderlyingTokenSource(params: GetLpUnderlyingTokenSourceParams): TokenPriceSource[];
|