@sonarwatch/portfolio-plugins 0.12.38 → 0.12.40
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +8 -0
- package/package.json +1 -1
- package/src/plugins/drift/constants.d.ts +1 -0
- package/src/plugins/drift/constants.js +2 -1
- package/src/plugins/drift/constants.js.map +1 -1
- package/src/plugins/drift/depositsFetcher.js +3 -10
- package/src/plugins/drift/depositsFetcher.js.map +1 -1
- package/src/plugins/drift/perpHelpers/constants.d.ts +1 -0
- package/src/plugins/drift/perpHelpers/constants.js +95 -1
- package/src/plugins/drift/perpHelpers/constants.js.map +1 -1
- package/src/plugins/drift/perpHelpers/getMintFromOracle.d.ts +2 -0
- package/src/plugins/drift/perpHelpers/getMintFromOracle.js +40 -0
- package/src/plugins/drift/perpHelpers/getMintFromOracle.js.map +1 -0
- package/src/plugins/drift/spotMarketsJob.js +10 -0
- package/src/plugins/drift/spotMarketsJob.js.map +1 -1
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.12.40](https://github.com/sonarwatch/portfolio/compare/plugins-0.12.39...plugins-0.12.40) (2024-06-25)
|
6
|
+
|
7
|
+
|
8
|
+
|
9
|
+
## [0.12.39](https://github.com/sonarwatch/portfolio/compare/plugins-0.12.38...plugins-0.12.39) (2024-06-25)
|
10
|
+
|
11
|
+
|
12
|
+
|
5
13
|
## [0.12.38](https://github.com/sonarwatch/portfolio/compare/plugins-0.12.37...plugins-0.12.38) (2024-06-25)
|
6
14
|
|
7
15
|
|
package/package.json
CHANGED
@@ -9,6 +9,7 @@ export declare const prefixSpotMarkets = "drift-spotMarkets";
|
|
9
9
|
export declare const driftProgram: PublicKey;
|
10
10
|
export declare const preMarketPriceKey = "premarketPrice";
|
11
11
|
export declare const perpMarketsIndexesKey = "perp-markets-indexes";
|
12
|
+
export declare const oracleToMintKey = "oracle-to-mint";
|
12
13
|
export declare const airdropUrl = "https://airdrop.drift.trade/eligibility/";
|
13
14
|
export declare const distributorPid = "E7HtfkEMhmn9uwL7EFNydcXBWy5WCYN1vFmKKjipEH1x";
|
14
15
|
export declare const driftDecimals = 6;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.driftMint = exports.driftDecimals = exports.distributorPid = exports.airdropUrl = exports.perpMarketsIndexesKey = exports.preMarketPriceKey = exports.driftProgram = exports.prefixSpotMarkets = exports.platform = exports.platformWebsite = exports.platformImage = exports.platformName = exports.platformId = void 0;
|
3
|
+
exports.driftMint = exports.driftDecimals = exports.distributorPid = exports.airdropUrl = exports.oracleToMintKey = exports.perpMarketsIndexesKey = exports.preMarketPriceKey = exports.driftProgram = exports.prefixSpotMarkets = exports.platform = exports.platformWebsite = exports.platformImage = exports.platformName = exports.platformId = void 0;
|
4
4
|
const web3_js_1 = require("@solana/web3.js");
|
5
5
|
exports.platformId = 'drift';
|
6
6
|
exports.platformName = 'Drift';
|
@@ -17,6 +17,7 @@ exports.prefixSpotMarkets = `${exports.platformId}-spotMarkets`;
|
|
17
17
|
exports.driftProgram = new web3_js_1.PublicKey('dRiftyHA39MWEi3m9aunc5MzRF1JYuBsbn6VPcn33UH');
|
18
18
|
exports.preMarketPriceKey = 'premarketPrice';
|
19
19
|
exports.perpMarketsIndexesKey = 'perp-markets-indexes';
|
20
|
+
exports.oracleToMintKey = 'oracle-to-mint';
|
20
21
|
exports.airdropUrl = 'https://airdrop.drift.trade/eligibility/';
|
21
22
|
exports.distributorPid = 'E7HtfkEMhmn9uwL7EFNydcXBWy5WCYN1vFmKKjipEH1x';
|
22
23
|
exports.driftDecimals = 6;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/drift/constants.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAG/B,QAAA,UAAU,GAAG,OAAO,CAAC;AACrB,QAAA,YAAY,GAAG,OAAO,CAAC;AACvB,QAAA,aAAa,GAAG,6CAA6C,CAAC;AAC9D,QAAA,eAAe,GAAG,0BAA0B,CAAC;AAC7C,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,oBAAY;IAClB,KAAK,EAAE,qBAAa;IACpB,WAAW,EAAE,OAAO;IACpB,OAAO,EAAE,uBAAe;CACzB,CAAC;AACW,QAAA,iBAAiB,GAAG,GAAG,kBAAU,cAAc,CAAC;AAEhD,QAAA,YAAY,GAAG,IAAI,mBAAS,CACvC,6CAA6C,CAC9C,CAAC;AAEW,QAAA,iBAAiB,GAAG,gBAAgB,CAAC;AACrC,QAAA,qBAAqB,GAAG,sBAAsB,CAAC;
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/drift/constants.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAG/B,QAAA,UAAU,GAAG,OAAO,CAAC;AACrB,QAAA,YAAY,GAAG,OAAO,CAAC;AACvB,QAAA,aAAa,GAAG,6CAA6C,CAAC;AAC9D,QAAA,eAAe,GAAG,0BAA0B,CAAC;AAC7C,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,oBAAY;IAClB,KAAK,EAAE,qBAAa;IACpB,WAAW,EAAE,OAAO;IACpB,OAAO,EAAE,uBAAe;CACzB,CAAC;AACW,QAAA,iBAAiB,GAAG,GAAG,kBAAU,cAAc,CAAC;AAEhD,QAAA,YAAY,GAAG,IAAI,mBAAS,CACvC,6CAA6C,CAC9C,CAAC;AAEW,QAAA,iBAAiB,GAAG,gBAAgB,CAAC;AACrC,QAAA,qBAAqB,GAAG,sBAAsB,CAAC;AAC/C,QAAA,eAAe,GAAG,gBAAgB,CAAC;AAEnC,QAAA,UAAU,GAAG,0CAA0C,CAAC;AACxD,QAAA,cAAc,GAAG,8CAA8C,CAAC;AAChE,QAAA,aAAa,GAAG,CAAC,CAAC;AAClB,QAAA,SAAS,GAAG,8CAA8C,CAAC"}
|
@@ -26,6 +26,7 @@ const constants_2 = require("./perpHelpers/constants");
|
|
26
26
|
const types_1 = require("./perpHelpers/types");
|
27
27
|
const getOraclePrice_1 = require("./perpHelpers/getOraclePrice");
|
28
28
|
const getPerpMarket_1 = require("./perpHelpers/getPerpMarket");
|
29
|
+
const getMintFromOracle_1 = require("./perpHelpers/getMintFromOracle");
|
29
30
|
const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
30
31
|
const client = (0, clients_1.getClientSolana)();
|
31
32
|
const spotMarketsItems = yield cache.getAllItems({
|
@@ -122,22 +123,14 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
122
123
|
const side = (0, position_1.positionCurrentDirection)(perpPosition) === types_1.PositionDirection.LONG
|
123
124
|
? portfolio_core_1.LeverageSide.long
|
124
125
|
: portfolio_core_1.LeverageSide.short;
|
125
|
-
|
126
|
-
// // console.log('entryPrice', calculateEntryPrice(perpPosition));
|
127
|
-
// console.log('perpPosition:', perpPosition.baseAssetAmount.toString());
|
128
|
-
// console.log('pnl:', pnl.toString());
|
129
|
-
// console.log('baseAssetValue:', baseAssetValue.toString());
|
130
|
-
// console.log(
|
131
|
-
// 'quoteEntryAmount:',
|
132
|
-
// perpPosition.quoteEntryAmount.toString()
|
133
|
-
// );
|
134
|
-
// console.log('-----');
|
126
|
+
const mint = yield (0, getMintFromOracle_1.getMintFromOracle)(market.amm.oracle.toString(), cache);
|
135
127
|
const asset = {
|
136
128
|
type: portfolio_core_1.PortfolioAssetType.generic,
|
137
129
|
networkId: portfolio_core_1.NetworkId.solana,
|
138
130
|
value: pnl,
|
139
131
|
data: {
|
140
132
|
name: (0, solana_1.u8ArrayToString)(market.name),
|
133
|
+
address: mint || undefined,
|
141
134
|
},
|
142
135
|
attributes: {
|
143
136
|
tags: [side],
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"depositsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/drift/depositsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAaoC;AACpC,gEAAqC;AACrC,6CAA4C;AAG5C,2CAKqB;AACrB,qCAKkB;AAClB,uCAMmB;AAEnB,+CAI4B;AAC5B,iDAAsD;AACtD,qGAA6E;AAC7E,qDAGgC;AAChC,uDAAqE;AACrE,+CAAwD;AACxD,iEAA8D;AAC9D,+DAA4D;
|
1
|
+
{"version":3,"file":"depositsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/drift/depositsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAaoC;AACpC,gEAAqC;AACrC,6CAA4C;AAG5C,2CAKqB;AACrB,qCAKkB;AAClB,uCAMmB;AAEnB,+CAI4B;AAC5B,iDAAsD;AACtD,qGAA6E;AAC7E,qDAGgC;AAChC,uDAAqE;AACrE,+CAAwD;AACxD,iEAA8D;AAC9D,+DAA4D;AAC5D,uEAAoE;AAEpE,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,MAAM,GAAG,IAAA,yBAAe,GAAE,CAAC;IAEjC,MAAM,gBAAgB,GAAG,MAAM,KAAK,CAAC,WAAW,CAAqB;QACnE,MAAM,EAAE,6BAAiB;QACzB,SAAS,EAAE,0BAAS,CAAC,MAAM;KAC5B,CAAC,CAAC;IAEH,IAAI,gBAAgB,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAE7C,MAAM,iBAAiB,GAAoC,IAAI,GAAG,EAAE,CAAC;IACrE,MAAM,WAAW,GAAG,EAAE,CAAC;IACvB,MAAM,mCAAmC,GAAgB,EAAE,CAAC;IAC5D,KAAK,MAAM,cAAc,IAAI,gBAAgB,EAAE,CAAC;QAC9C,mCAAmC,CAAC,cAAc,CAAC,WAAW,CAAC;YAC7D,IAAA,mDAAyC,EACvC,wBA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ACN;YACD,IAAI,EAAE,IAAA,wBAAe,EAAC,WAAW,CAAC,IAAI,CAAC;SACxC,CAAC,CAAC;IACL,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,WAAW;IAC5B,SAAS,EAAE,0BAAS,CAAC,MAAM;IAC3B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|
@@ -25,3 +25,4 @@ export declare const FUNDING_RATE_BUFFER_PRECISION: import("bn.js");
|
|
25
25
|
export declare const SPOT_MARKET_IMF_PRECISION_EXP: import("bn.js");
|
26
26
|
export declare const SPOT_MARKET_IMF_PRECISION: import("bn.js");
|
27
27
|
export declare const SPOT_MARKET_WEIGHT_PRECISION: import("bn.js");
|
28
|
+
export declare const oracleToMintLocal: string[][];
|
@@ -3,7 +3,7 @@ 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
|
-
exports.SPOT_MARKET_WEIGHT_PRECISION = exports.SPOT_MARKET_IMF_PRECISION = exports.SPOT_MARKET_IMF_PRECISION_EXP = exports.FUNDING_RATE_BUFFER_PRECISION = exports.FUNDING_RATE_BUFFER_PRECISION_EXP = exports.FIVE_MINUTE = exports.AMM_TIMES_PEG_TO_QUOTE_PRECISION_RATIO = exports.DEFAULT_REVENUE_SINCE_LAST_FUNDING_SPREAD_RETREAT = exports.PERCENTAGE_PRECISION = exports.PERCENTAGE_PRECISION_EXP = exports.BID_ASK_SPREAD_PRECISION = exports.PRICE_DIV_PEG = exports.AMM_TO_QUOTE_PRECISION_RATIO = exports.AMM_RESERVE_PRECISION = exports.QUOTE_PRECISION = exports.QUOTE_PRECISION_EXP = exports.AMM_RESERVE_PRECISION_EXP = exports.TEN = exports.TWO = exports.ONE = exports.ZERO = exports.PEG_PRECISION = exports.PEG_PRECISION_EXP = exports.PRICE_PRECISION_BIG_NUMBER = exports.PRICE_PRECISION = exports.PRICE_PRECISION_EXP = void 0;
|
6
|
+
exports.oracleToMintLocal = exports.SPOT_MARKET_WEIGHT_PRECISION = exports.SPOT_MARKET_IMF_PRECISION = exports.SPOT_MARKET_IMF_PRECISION_EXP = exports.FUNDING_RATE_BUFFER_PRECISION = exports.FUNDING_RATE_BUFFER_PRECISION_EXP = exports.FIVE_MINUTE = exports.AMM_TIMES_PEG_TO_QUOTE_PRECISION_RATIO = exports.DEFAULT_REVENUE_SINCE_LAST_FUNDING_SPREAD_RETREAT = exports.PERCENTAGE_PRECISION = exports.PERCENTAGE_PRECISION_EXP = exports.BID_ASK_SPREAD_PRECISION = exports.PRICE_DIV_PEG = exports.AMM_TO_QUOTE_PRECISION_RATIO = exports.AMM_RESERVE_PRECISION = exports.QUOTE_PRECISION = exports.QUOTE_PRECISION_EXP = exports.AMM_RESERVE_PRECISION_EXP = exports.TEN = exports.TWO = exports.ONE = exports.ZERO = exports.PEG_PRECISION = exports.PEG_PRECISION_EXP = exports.PRICE_PRECISION_BIG_NUMBER = exports.PRICE_PRECISION = exports.PRICE_PRECISION_EXP = void 0;
|
7
7
|
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
8
8
|
const bn_js_1 = require("bn.js");
|
9
9
|
exports.PRICE_PRECISION_EXP = new bn_js_1.BN(6);
|
@@ -32,4 +32,98 @@ exports.FUNDING_RATE_BUFFER_PRECISION = new bn_js_1.BN(10).pow(exports.FUNDING_R
|
|
32
32
|
exports.SPOT_MARKET_IMF_PRECISION_EXP = new bn_js_1.BN(6);
|
33
33
|
exports.SPOT_MARKET_IMF_PRECISION = new bn_js_1.BN(10).pow(exports.SPOT_MARKET_IMF_PRECISION_EXP);
|
34
34
|
exports.SPOT_MARKET_WEIGHT_PRECISION = new bn_js_1.BN(10000);
|
35
|
+
exports.oracleToMintLocal = [
|
36
|
+
[
|
37
|
+
'4o4CUwzFwLqCvmA5x1G4VzoZkAhAcbiuiYyjWX1CVbY2',
|
38
|
+
'4cwVHQtwiK7r9aAUsu4cetk1JtLWPymopWcpTSsihCdL',
|
39
|
+
],
|
40
|
+
[
|
41
|
+
'g6eRCbboSwK4tSWngn773RCMexr1APQr4uA9bGZBYfo',
|
42
|
+
'JUPyiwrYJFskUPiHa7hkeR8VUtAeFoSYbKedZNsDvCN',
|
43
|
+
],
|
44
|
+
[
|
45
|
+
'4CkQJBxhU8EZ2UjhigbtdaPbpTe6mqf811fipYBFbSYN',
|
46
|
+
'9gP2kCy3wA1ctvYWQk75guqXuHfrEomqydHLtcTCqiLa',
|
47
|
+
],
|
48
|
+
[
|
49
|
+
'JBu1AL4obBcCMqKBBxhpWCNUt136ijcuMZLFvTP7iWdB',
|
50
|
+
'7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs',
|
51
|
+
],
|
52
|
+
[
|
53
|
+
'FNNvb1AFDnDVPkocEri8mWbJ1952HQZtFLuwPiUjSJQ',
|
54
|
+
'HHncifGW3yJyaW2fRRfBYAawnD9ogbsWM5PccFA4GHSx',
|
55
|
+
],
|
56
|
+
[
|
57
|
+
'D8UUgr8a3aR3yUeHLu7v8FWK7E8Y5sSU7qrYBXUJXBQ5',
|
58
|
+
'jtojtomepa8beP8AuQc6eXt5FriJwfFMwQx2v2f9mCL',
|
59
|
+
],
|
60
|
+
[
|
61
|
+
'7KVswB9vkCgeM3SHP7aGDijvdRAHK8P5wi9JXViCrtYh',
|
62
|
+
'Gz7VkD4MacbEB6yC5XD3HcumEiYx2EtDYYrfikGsvopG',
|
63
|
+
],
|
64
|
+
[
|
65
|
+
'ALdkqQDMfHNg77oCNskfX751kHys4KE7SFuZzuKaN536',
|
66
|
+
'2wpTofQ8SkACrkZWrZDjXPitYa8AwWgX8AfxdeBRRVLX',
|
67
|
+
],
|
68
|
+
[
|
69
|
+
'H9j8CT1bFiWHaZUPMooEaxMRHdWdJ5T9CzFn41z96JHW',
|
70
|
+
'85VBFQZC9TZkfaptBWjvUw7YbZjy52A6mjtPGjstQAmQ',
|
71
|
+
],
|
72
|
+
[
|
73
|
+
'PeNpQeGEm9UEFJ6MBCMauY4WW4h3YxoESPWbsqVKucE',
|
74
|
+
'DriFtupJYLTosbwoN8koMbEYSx54aFAVLddWsbksjwg7',
|
75
|
+
],
|
76
|
+
[
|
77
|
+
'7Cfyymx49ipGsgEsCA2XygAB2DUsan4C6Cyb5c8oR5st',
|
78
|
+
'TNSRxcUxoT9xBG3de7PiJyTDYu7kskLqcpddxnEJAS6',
|
79
|
+
],
|
80
|
+
[
|
81
|
+
'Gcm39uDrFyRCZko4hdrKMTBQsboPJHEd4RwnWhWFKr9a',
|
82
|
+
'BZLbGTNCSFfoth2GYDtwr7e4imWzpR5jqcUuGEwr646K',
|
83
|
+
],
|
84
|
+
[
|
85
|
+
'7moA1i5vQUpfDwSpK6Pw9s56ahB7WFGidtbL2ujWrVvm',
|
86
|
+
'hntyVP6YFm1Hg25TN9WGLqM12b8TQmcknKrdu1oxWux',
|
87
|
+
],
|
88
|
+
[
|
89
|
+
'nrYkQQQur7z8rYTST3G9GqATviK5SxTDkrqd21MW6Ue',
|
90
|
+
'HZ1JovNiVvGrGNiiYvEozEVgZ58xaU3RKwX8eACQBCt3',
|
91
|
+
],
|
92
|
+
[
|
93
|
+
'8ihFLu5FimgTQ1Unh4dVyEHUGodJ5gJQCrQf4KUVB9bN',
|
94
|
+
'DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263',
|
95
|
+
],
|
96
|
+
[
|
97
|
+
'GVXRSBjFk6e6J3NbVPXohDJetcTjaeeuykUpbQF8UoMU',
|
98
|
+
'3NZ9JMVBmGAqocybic2c7LQCJScmgsAZ6vQqTDzcqmJh',
|
99
|
+
],
|
100
|
+
[
|
101
|
+
'Ax9ujW5B9oqcv59N8m6f1BpTBq2rGeGaBcpKjC5UYsXU',
|
102
|
+
'KgV1GvrHQmRBY8sHQQeUKwTm2r2h8t4C8qt12Cw1HVE',
|
103
|
+
],
|
104
|
+
[
|
105
|
+
'3Qub3HaAJaa2xNY7SUqPKd3vVwTqDfDDkEUMPjXD2c1q',
|
106
|
+
'JzwfZvJGdsqbrKZQUvzJpWhbHcZUix7CYcCaoiNpjxg',
|
107
|
+
],
|
108
|
+
[
|
109
|
+
'6ABgrEZk8urs6kJ1JNdC1sspH5zKXRqxy8sg3ZG2cQps',
|
110
|
+
'EKpQGSJtjMFqKZ9KQanSqYXRcF8fBopzLHYxdM65zcjm',
|
111
|
+
],
|
112
|
+
[
|
113
|
+
'CYGfrBJB9HgLf9iZyN4aH5HvUAi2htQ4MjPxeXMf4Egn',
|
114
|
+
'rndrizKT3MK1iimdxRdWabcF7Zg7AR5T4nud4EkHBof',
|
115
|
+
],
|
116
|
+
[
|
117
|
+
'5HRrdmghsnU3i2u5StaKaydS7eq3vnKVKwXMzCNKsc4C',
|
118
|
+
'9cMWa1wuWcio3vgEpiFg7PqKbcoafuUw5sLYFkXJ2J8M',
|
119
|
+
],
|
120
|
+
[
|
121
|
+
'H6ARHf6YXhGYeQfUzQNGk6rDNnLBQKrenN712K4AQJEG',
|
122
|
+
'So11111111111111111111111111111111111111112',
|
123
|
+
],
|
124
|
+
[
|
125
|
+
'6ynsvjkE2UoiRScbDx7ZxbBsyn7wyvg5P1vENvhtkG1C',
|
126
|
+
'KMNo3nJsBXfcpJTVhZcXLW7RmTwTt4GVFE7suUBo9sS',
|
127
|
+
],
|
128
|
+
];
|
35
129
|
//# sourceMappingURL=constants.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/plugins/drift/perpHelpers/constants.ts"],"names":[],"mappings":";;;;;;AAAA,gEAAqC;AACrC,iCAA2B;AAEd,QAAA,mBAAmB,GAAG,IAAI,UAAE,CAAC,CAAC,CAAC,CAAC;AAChC,QAAA,eAAe,GAAG,IAAI,UAAE,CAAC,EAAE,CAAC,CAAC,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,CAAC,EAAE,CACJ,CAAC,GAAG,CAAC,uBAAe,CAAC,CAAC;AACV,QAAA,sCAAsC,GACjD,6BAAqB,CAAC,GAAG,CAAC,qBAAa,CAAC,CAAC,GAAG,CAAC,uBAAe,CAAC,CAAC;AACnD,QAAA,WAAW,GAAG,IAAI,UAAE,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;AAC7B,QAAA,iCAAiC,GAAG,IAAI,UAAE,CAAC,CAAC,CAAC,CAAC;AAC9C,QAAA,6BAA6B,GAAG,IAAI,UAAE,CAAC,EAAE,CAAC,CAAC,GAAG,CACzD,yCAAiC,CAClC,CAAC;AACW,QAAA,6BAA6B,GAAG,IAAI,UAAE,CAAC,CAAC,CAAC,CAAC;AAC1C,QAAA,yBAAyB,GAAG,IAAI,UAAE,CAAC,EAAE,CAAC,CAAC,GAAG,CACrD,qCAA6B,CAC9B,CAAC;AACW,QAAA,4BAA4B,GAAG,IAAI,UAAE,CAAC,KAAK,CAAC,CAAC"}
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/plugins/drift/perpHelpers/constants.ts"],"names":[],"mappings":";;;;;;AAAA,gEAAqC;AACrC,iCAA2B;AAEd,QAAA,mBAAmB,GAAG,IAAI,UAAE,CAAC,CAAC,CAAC,CAAC;AAChC,QAAA,eAAe,GAAG,IAAI,UAAE,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,2BAAmB,CAAC,CAAC;AACtD,QAAA,0BAA0B,GAAG,IAAI,sBAAS,CACrD,uBAAe,CAAC,QAAQ,EAAE,CAC3B,CAAC;AACW,QAAA,iBAAiB,GAAG,IAAI,UAAE,CAAC,CAAC,CAAC,CAAC;AAC9B,QAAA,aAAa,GAAG,IAAI,UAAE,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,yBAAiB,CAAC,CAAC;AAClD,QAAA,IAAI,GAAG,IAAI,UAAE,CAAC,CAAC,CAAC,CAAC;AACjB,QAAA,GAAG,GAAG,IA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"}
|
@@ -0,0 +1,40 @@
|
|
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
|
+
exports.getMintFromOracle = void 0;
|
13
|
+
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
14
|
+
const constants_1 = require("./constants");
|
15
|
+
const constants_2 = require("../constants");
|
16
|
+
const map = new Map();
|
17
|
+
let lastUpdate = 0;
|
18
|
+
const ttl = 3600000;
|
19
|
+
function getMintFromOracle(oracle, cache) {
|
20
|
+
return __awaiter(this, void 0, void 0, function* () {
|
21
|
+
if (lastUpdate < Date.now() - ttl) {
|
22
|
+
constants_1.oracleToMintLocal.forEach(([cOracle, cMint]) => {
|
23
|
+
map.set(cOracle, cMint);
|
24
|
+
});
|
25
|
+
const cachedOracleToMint = yield cache.getItem(constants_2.oracleToMintKey, {
|
26
|
+
prefix: constants_2.platformId,
|
27
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
28
|
+
});
|
29
|
+
if (cachedOracleToMint) {
|
30
|
+
cachedOracleToMint.forEach(([cOracle, cMint]) => {
|
31
|
+
map.set(cOracle, cMint);
|
32
|
+
});
|
33
|
+
}
|
34
|
+
lastUpdate = Date.now();
|
35
|
+
}
|
36
|
+
return map.get(oracle) || null;
|
37
|
+
});
|
38
|
+
}
|
39
|
+
exports.getMintFromOracle = getMintFromOracle;
|
40
|
+
//# sourceMappingURL=getMintFromOracle.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"getMintFromOracle.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/plugins/drift/perpHelpers/getMintFromOracle.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+DAAuD;AAEvD,2CAAgD;AAChD,4CAA2D;AAE3D,MAAM,GAAG,GAAwB,IAAI,GAAG,EAAE,CAAC;AAC3C,IAAI,UAAU,GAAG,CAAC,CAAC;AACnB,MAAM,GAAG,GAAG,OAAO,CAAC;AAEpB,SAAsB,iBAAiB,CACrC,MAAc,EACd,KAAY;;QAEZ,IAAI,UAAU,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,GAAG,EAAE,CAAC;YAClC,6BAAiB,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE,EAAE;gBAC7C,GAAG,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;YAC1B,CAAC,CAAC,CAAC;YACH,MAAM,kBAAkB,GAAG,MAAM,KAAK,CAAC,OAAO,CAC5C,2BAAe,EACf;gBACE,MAAM,EAAE,sBAAU;gBAClB,SAAS,EAAE,0BAAS,CAAC,MAAM;aAC5B,CACF,CAAC;YACF,IAAI,kBAAkB,EAAE,CAAC;gBACvB,kBAAkB,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE,EAAE;oBAC9C,GAAG,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;gBAC1B,CAAC,CAAC,CAAC;YACL,CAAC;YACD,UAAU,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAC1B,CAAC;QAED,OAAO,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC;IACjC,CAAC;CAAA;AAxBD,8CAwBC"}
|
@@ -25,6 +25,16 @@ const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
|
25
25
|
const spotMarketsAccount = yield (0, solana_1.getParsedProgramAccounts)(client, struct_1.spotMarketStruct, constants_1.driftProgram, filters_1.marketFilter);
|
26
26
|
if (!spotMarketsAccount)
|
27
27
|
return;
|
28
|
+
// Oracle to mint
|
29
|
+
const oracleToMint = [];
|
30
|
+
for (let i = 0; i < spotMarketsAccount.length; i++) {
|
31
|
+
const acc = spotMarketsAccount[i];
|
32
|
+
oracleToMint.push([acc.oracle.toString(), acc.mint.toString()]);
|
33
|
+
}
|
34
|
+
yield cache.setItem(constants_1.oracleToMintKey, oracleToMint, {
|
35
|
+
prefix: constants_1.platformId,
|
36
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
37
|
+
});
|
28
38
|
for (let index = 0; index < spotMarketsAccount.length; index++) {
|
29
39
|
const spotMarketAccount = spotMarketsAccount[index];
|
30
40
|
const depositApr = (0, helpers_1.calculateDepositRate)(spotMarketAccount).toNumber();
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"spotMarketsJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/drift/spotMarketsJob.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAKoC;AACpC,gEAAqC;AACrC,
|
1
|
+
{"version":3,"file":"spotMarketsJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/drift/spotMarketsJob.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAKoC;AACpC,gEAAqC;AACrC,2CAKqB;AACrB,+CAA8D;AAC9D,qCAA4C;AAC5C,uCAAyC;AACzC,iDAAsD;AACtD,uCAKmB;AAKnB,MAAM,QAAQ,GAAgB,CAAO,KAAY,EAAE,EAAE;IACnD,MAAM,MAAM,GAAG,IAAA,yBAAe,GAAE,CAAC;IACjC,MAAM,kBAAkB,GAAG,MAAM,IAAA,iCAAwB,EACvD,MAAM,EACN,yBAAgB,EAChB,wBAAY,EACZ,sBAAY,CACb,CAAC;IACF,IAAI,CAAC,kBAAkB;QAAE,OAAO;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