@d8x/perpetuals-sdk 0.1.12 → 0.2.0
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/dist/cjs/abi/testnet/IPerpetualManager.json +5215 -0
- package/dist/cjs/abi/testnet/LimitOrderBook.json +1075 -0
- package/dist/cjs/abi/zkevmTestnet/IPerpetualManager.json +5215 -0
- package/dist/cjs/abi/zkevmTestnet/LimitOrderBook.json +1075 -0
- package/dist/cjs/abi/zkevmTestnet/LimitOrderBookFactory.json +135 -0
- package/dist/cjs/accountTrade.js +441 -0
- package/dist/cjs/accountTrade.js.map +1 -0
- package/dist/{src → cjs}/brokerTool.js +31 -84
- package/dist/cjs/brokerTool.js.map +1 -0
- package/dist/cjs/config/defaultConfig.json +47 -0
- package/dist/cjs/config/mockSwap.json +4 -0
- package/dist/cjs/config/priceFeedConfig.json +104 -0
- package/dist/cjs/config/symbolList.json +13 -0
- package/dist/cjs/d8XMath.js.map +1 -0
- package/dist/cjs/index.js +29 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/liquidatorTool.js +287 -0
- package/dist/cjs/liquidatorTool.js.map +1 -0
- package/dist/{src → cjs}/liquidityProviderTool.js +12 -65
- package/dist/cjs/liquidityProviderTool.js.map +1 -0
- package/dist/{src → cjs}/marketData.js +52 -134
- package/dist/cjs/marketData.js.map +1 -0
- package/dist/{src → cjs}/nodeSDKTypes.d.ts +5 -5
- package/dist/cjs/nodeSDKTypes.js +64 -0
- package/dist/cjs/nodeSDKTypes.js.map +1 -0
- package/dist/{src → cjs}/orderReferrerTool.d.ts +12 -5
- package/dist/{src → cjs}/orderReferrerTool.js +114 -112
- package/dist/cjs/orderReferrerTool.js.map +1 -0
- package/dist/{src → cjs}/perpetualDataHandler.d.ts +1 -1
- package/dist/{src → cjs}/perpetualDataHandler.js +47 -109
- package/dist/cjs/perpetualDataHandler.js.map +1 -0
- package/dist/{src → cjs}/perpetualEventHandler.d.ts +3 -3
- package/dist/{src → cjs}/perpetualEventHandler.js +12 -74
- package/dist/cjs/perpetualEventHandler.js.map +1 -0
- package/dist/cjs/priceFeeds.js +466 -0
- package/dist/cjs/priceFeeds.js.map +1 -0
- package/dist/{src → cjs}/traderDigests.js +7 -43
- package/dist/cjs/traderDigests.js.map +1 -0
- package/dist/{src → cjs}/traderInterface.js +13 -66
- package/dist/cjs/traderInterface.js.map +1 -0
- package/dist/{src → cjs}/triangulator.js +2 -17
- package/dist/cjs/triangulator.js.map +1 -0
- package/dist/{src → cjs}/utils.js +3 -29
- package/dist/cjs/utils.js.map +1 -0
- package/dist/cjs/version.d.ts +1 -0
- package/dist/{src → cjs}/version.js +1 -1
- package/dist/cjs/version.js.map +1 -0
- package/dist/{src → cjs}/writeAccessHandler.js +12 -65
- package/dist/cjs/writeAccessHandler.js.map +1 -0
- package/dist/esm/abi/ERC20.json +288 -0
- package/dist/esm/abi/MockTokenSwap.json +186 -0
- package/dist/{abi/testnet → esm/abi/central-park}/IPerpetualManager.json +404 -214
- package/dist/{abi/testnet → esm/abi/central-park}/LimitOrderBook.json +197 -15
- package/dist/esm/abi/central-park/LimitOrderBookFactory.json +135 -0
- package/dist/esm/abi/testnet/IPerpetualManager.json +5215 -0
- package/dist/esm/abi/testnet/LimitOrderBook.json +1075 -0
- package/dist/esm/abi/testnet/LimitOrderBookFactory.json +135 -0
- package/dist/esm/abi/zkevmTestnet/IPerpetualManager.json +5215 -0
- package/dist/esm/abi/zkevmTestnet/LimitOrderBook.json +1075 -0
- package/dist/esm/abi/zkevmTestnet/LimitOrderBookFactory.json +135 -0
- package/dist/esm/accountTrade.d.ts +221 -0
- package/dist/{src → esm}/accountTrade.js +22 -93
- package/dist/esm/accountTrade.js.map +1 -0
- package/dist/esm/brokerTool.d.ts +318 -0
- package/dist/esm/brokerTool.js +572 -0
- package/dist/esm/brokerTool.js.map +1 -0
- package/dist/esm/config/defaultConfig.json +47 -0
- package/dist/esm/config/mockSwap.json +4 -0
- package/dist/esm/config/priceFeedConfig.json +104 -0
- package/dist/esm/config/symbolList.json +13 -0
- package/dist/esm/d8XMath.d.ts +122 -0
- package/dist/esm/d8XMath.js +247 -0
- package/dist/esm/d8XMath.js.map +1 -0
- package/{src/index.ts → dist/esm/index.d.ts} +1 -15
- package/dist/esm/index.js +16 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/liquidatorTool.d.ts +158 -0
- package/dist/{src → esm}/liquidatorTool.js +10 -65
- package/dist/esm/liquidatorTool.js.map +1 -0
- package/dist/esm/liquidityProviderTool.d.ts +126 -0
- package/dist/esm/liquidityProviderTool.js +218 -0
- package/dist/esm/liquidityProviderTool.js.map +1 -0
- package/dist/esm/marketData.d.ts +309 -0
- package/dist/esm/marketData.js +1007 -0
- package/dist/esm/marketData.js.map +1 -0
- package/dist/esm/nodeSDKTypes.d.ts +266 -0
- package/dist/esm/nodeSDKTypes.js +60 -0
- package/dist/esm/nodeSDKTypes.js.map +1 -0
- package/dist/esm/orderReferrerTool.d.ts +196 -0
- package/dist/esm/orderReferrerTool.js +491 -0
- package/dist/esm/orderReferrerTool.js.map +1 -0
- package/dist/esm/perpetualDataHandler.d.ts +220 -0
- package/dist/esm/perpetualDataHandler.js +1060 -0
- package/dist/esm/perpetualDataHandler.js.map +1 -0
- package/dist/esm/perpetualEventHandler.d.ts +179 -0
- package/dist/esm/perpetualEventHandler.js +435 -0
- package/dist/esm/perpetualEventHandler.js.map +1 -0
- package/dist/esm/priceFeeds.d.ts +115 -0
- package/dist/{src → esm}/priceFeeds.js +16 -83
- package/dist/esm/priceFeeds.js.map +1 -0
- package/dist/esm/traderDigests.d.ts +21 -0
- package/dist/esm/traderDigests.js +80 -0
- package/dist/esm/traderDigests.js.map +1 -0
- package/dist/esm/traderInterface.d.ts +79 -0
- package/dist/esm/traderInterface.js +196 -0
- package/dist/esm/traderInterface.js.map +1 -0
- package/dist/esm/triangulator.d.ts +27 -0
- package/dist/esm/triangulator.js +110 -0
- package/dist/esm/triangulator.js.map +1 -0
- package/dist/esm/utils.d.ts +59 -0
- package/dist/esm/utils.js +138 -0
- package/dist/esm/utils.js.map +1 -0
- package/dist/esm/version.d.ts +1 -0
- package/dist/esm/version.js +2 -0
- package/dist/esm/version.js.map +1 -0
- package/dist/esm/writeAccessHandler.d.ts +50 -0
- package/dist/esm/writeAccessHandler.js +157 -0
- package/dist/esm/writeAccessHandler.js.map +1 -0
- package/package.json +16 -26
- package/dist/bundle.js +0 -36793
- package/dist/config/defaultConfig.json +0 -47
- package/dist/config/mockSwap.json +0 -4
- package/dist/config/priceFeedConfig.json +0 -104
- package/dist/config/symbolList.json +0 -13
- package/dist/src/index.js +0 -45
- package/dist/src/nodeSDKTypes.js +0 -115
- package/dist/src/version.d.ts +0 -1
- package/module.d.ts +0 -1
- package/src/accountTrade.ts +0 -392
- package/src/brokerTool.ts +0 -507
- package/src/d8XMath.ts +0 -319
- package/src/liquidatorTool.ts +0 -258
- package/src/liquidityProviderTool.ts +0 -186
- package/src/marketData.ts +0 -946
- package/src/nodeSDKTypes.ts +0 -293
- package/src/orderReferrerTool.ts +0 -389
- package/src/perpetualDataHandler.ts +0 -1061
- package/src/perpetualEventHandler.ts +0 -455
- package/src/priceFeeds.ts +0 -381
- package/src/traderDigests.ts +0 -91
- package/src/traderInterface.ts +0 -159
- package/src/triangulator.ts +0 -105
- package/src/utils.ts +0 -134
- package/src/version.ts +0 -1
- package/src/writeAccessHandler.ts +0 -127
- /package/dist/{abi → cjs/abi}/ERC20.json +0 -0
- /package/dist/{abi → cjs/abi}/MockTokenSwap.json +0 -0
- /package/dist/{abi → cjs/abi}/central-park/IPerpetualManager.json +0 -0
- /package/dist/{abi → cjs/abi}/central-park/LimitOrderBook.json +0 -0
- /package/dist/{abi → cjs/abi}/central-park/LimitOrderBookFactory.json +0 -0
- /package/dist/{abi → cjs/abi}/testnet/LimitOrderBookFactory.json +0 -0
- /package/dist/{src → cjs}/accountTrade.d.ts +0 -0
- /package/dist/{src → cjs}/brokerTool.d.ts +0 -0
- /package/dist/{src → cjs}/d8XMath.d.ts +0 -0
- /package/dist/{src → cjs}/d8XMath.js +0 -0
- /package/dist/{src → cjs}/index.d.ts +0 -0
- /package/dist/{src → cjs}/liquidatorTool.d.ts +0 -0
- /package/dist/{src → cjs}/liquidityProviderTool.d.ts +0 -0
- /package/dist/{src → cjs}/marketData.d.ts +0 -0
- /package/dist/{src → cjs}/priceFeeds.d.ts +0 -0
- /package/dist/{src → cjs}/traderDigests.d.ts +0 -0
- /package/dist/{src → cjs}/traderInterface.d.ts +0 -0
- /package/dist/{src → cjs}/triangulator.d.ts +0 -0
- /package/dist/{src → cjs}/utils.d.ts +0 -0
- /package/dist/{src → cjs}/writeAccessHandler.d.ts +0 -0
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var tslib_1 = require("tslib");
|
|
4
|
+
var writeAccessHandler_1 = tslib_1.__importDefault(require("./writeAccessHandler"));
|
|
5
|
+
var d8XMath_1 = require("./d8XMath");
|
|
6
|
+
/**
|
|
7
|
+
* Functions to liquidate traders. This class requires a private key
|
|
8
|
+
* and executes smart-contract interactions that require gas-payments.
|
|
9
|
+
* @extends WriteAccessHandler
|
|
10
|
+
*/
|
|
11
|
+
var LiquidatorTool = /** @class */ (function (_super) {
|
|
12
|
+
tslib_1.__extends(LiquidatorTool, _super);
|
|
13
|
+
/**
|
|
14
|
+
* Constructs a LiquidatorTool instance for a given configuration and private key.
|
|
15
|
+
* @param {NodeSDKConfig} config Configuration object, see PerpetualDataHandler.
|
|
16
|
+
* readSDKConfig.
|
|
17
|
+
* @example
|
|
18
|
+
* import { LiquidatorTool, PerpetualDataHandler } from '@d8x/perpetuals-sdk';
|
|
19
|
+
* async function main() {
|
|
20
|
+
* console.log(LiquidatorTool);
|
|
21
|
+
* // load configuration for testnet
|
|
22
|
+
* const config = PerpetualDataHandler.readSDKConfig("testnet");
|
|
23
|
+
* // LiquidatorTool (authentication required, PK is an environment variable with a private key)
|
|
24
|
+
* const pk: string = <string>process.env.PK;
|
|
25
|
+
* let lqudtrTool = new LiquidatorTool(config, pk);
|
|
26
|
+
* // Create a proxy instance to access the blockchain
|
|
27
|
+
* await lqudtrTool.createProxyInstance();
|
|
28
|
+
* }
|
|
29
|
+
* main();
|
|
30
|
+
*
|
|
31
|
+
* @param {string} privateKey Private key of account that liquidates.
|
|
32
|
+
*/
|
|
33
|
+
function LiquidatorTool(config, privateKey) {
|
|
34
|
+
return _super.call(this, config, privateKey) || this;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Liquidate a trader.
|
|
38
|
+
* @param {string} symbol Symbol of the form ETH-USD-MATIC.
|
|
39
|
+
* @param {string} traderAddr Address of the trader to be liquidated.
|
|
40
|
+
* @param {string=} liquidatorAddr Address to be credited if the liquidation succeeds.
|
|
41
|
+
* @param {PriceFeedSubmission} priceFeedData optional. VAA and timestamps for oracle. If not provided will query from REST API.
|
|
42
|
+
* Defaults to the wallet used to execute the liquidation.
|
|
43
|
+
* @example
|
|
44
|
+
* import { LiquidatorTool, PerpetualDataHandler } from '@d8x/perpetuals-sdk';
|
|
45
|
+
* async function main() {
|
|
46
|
+
* console.log(LiquidatorTool);
|
|
47
|
+
* // Setup (authentication required, PK is an environment variable with a private key)
|
|
48
|
+
* const config = PerpetualDataHandler.readSDKConfig("testnet");
|
|
49
|
+
* const pk: string = <string>process.env.PK;
|
|
50
|
+
* let lqudtrTool = new LiquidatorTool(config, pk);
|
|
51
|
+
* await lqudtrTool.createProxyInstance();
|
|
52
|
+
* // liquidate trader
|
|
53
|
+
* let liqAmount = await lqudtrTool.liquidateTrader("ETH-USD-MATIC",
|
|
54
|
+
* "0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B");
|
|
55
|
+
* console.log(liqAmount);
|
|
56
|
+
* }
|
|
57
|
+
* main();
|
|
58
|
+
*
|
|
59
|
+
* @returns Transaction object.
|
|
60
|
+
*/
|
|
61
|
+
LiquidatorTool.prototype.liquidateTrader = function (symbol, traderAddr, liquidatorAddr, priceFeedData) {
|
|
62
|
+
if (liquidatorAddr === void 0) { liquidatorAddr = ""; }
|
|
63
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
64
|
+
var perpID;
|
|
65
|
+
return tslib_1.__generator(this, function (_a) {
|
|
66
|
+
switch (_a.label) {
|
|
67
|
+
case 0:
|
|
68
|
+
// this operation spends gas, so signer is required
|
|
69
|
+
if (this.proxyContract == null || this.signer == null) {
|
|
70
|
+
throw Error("no proxy contract or wallet initialized. Use createProxyInstance().");
|
|
71
|
+
}
|
|
72
|
+
// liquidator is signer unless specified otherwise
|
|
73
|
+
if (liquidatorAddr == "") {
|
|
74
|
+
liquidatorAddr = this.traderAddr;
|
|
75
|
+
}
|
|
76
|
+
perpID = LiquidatorTool.symbolToPerpetualId(symbol, this.symbolToPerpStaticInfo);
|
|
77
|
+
if (!(priceFeedData == undefined)) return [3 /*break*/, 2];
|
|
78
|
+
return [4 /*yield*/, this.fetchLatestFeedPriceInfo(symbol)];
|
|
79
|
+
case 1:
|
|
80
|
+
priceFeedData = _a.sent();
|
|
81
|
+
_a.label = 2;
|
|
82
|
+
case 2: return [4 /*yield*/, this._liquidateByAMM(perpID, liquidatorAddr, traderAddr, priceFeedData, {
|
|
83
|
+
gasLimit: this.gasLimit,
|
|
84
|
+
value: this.PRICE_UPDATE_FEE_GWEI * priceFeedData.priceFeedVaas.length,
|
|
85
|
+
})];
|
|
86
|
+
case 3: return [2 /*return*/, _a.sent()];
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* Check if the collateral of a trader is above the maintenance margin ("maintenance margin safe").
|
|
93
|
+
* If not, the position can be liquidated.
|
|
94
|
+
* @param {string} symbol Symbol of the form ETH-USD-MATIC.
|
|
95
|
+
* @param {string} traderAddr Address of the trader whose position you want to assess.
|
|
96
|
+
* @param {number[]} indexPrices optional, index price S2/S3 for which we test
|
|
97
|
+
* @example
|
|
98
|
+
* import { LiquidatorTool, PerpetualDataHandler } from '@d8x/perpetuals-sdk';
|
|
99
|
+
* async function main() {
|
|
100
|
+
* console.log(LiquidatorTool);
|
|
101
|
+
* // Setup (authentication required, PK is an environment variable with a private key)
|
|
102
|
+
* const config = PerpetualDataHandler.readSDKConfig("testnet");
|
|
103
|
+
* const pk: string = <string>process.env.PK;
|
|
104
|
+
* let lqudtrTool = new LiquidatorTool(config, pk);
|
|
105
|
+
* await lqudtrTool.createProxyInstance();
|
|
106
|
+
* // check if trader can be liquidated
|
|
107
|
+
* let safe = await lqudtrTool.isMaintenanceMarginSafe("ETH-USD-MATIC",
|
|
108
|
+
* "0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B");
|
|
109
|
+
* console.log(safe);
|
|
110
|
+
* }
|
|
111
|
+
* main();
|
|
112
|
+
*
|
|
113
|
+
* @returns {boolean} True if the trader is maintenance margin safe in the perpetual.
|
|
114
|
+
* False means that the trader's position can be liquidated.
|
|
115
|
+
*/
|
|
116
|
+
LiquidatorTool.prototype.isMaintenanceMarginSafe = function (symbol, traderAddr, indexPrices) {
|
|
117
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
118
|
+
var idx_notional, perpID, obj, traderState, idx_maintenanceMgnRate, idx_marginAccountPositionBC, idx_collateralToQuoteConversion, idx_marginBalance, maintMgnRate, pos, marginbalance, coll2quote, base2collateral, threshold;
|
|
119
|
+
return tslib_1.__generator(this, function (_a) {
|
|
120
|
+
switch (_a.label) {
|
|
121
|
+
case 0:
|
|
122
|
+
if (this.proxyContract == null) {
|
|
123
|
+
throw Error("no proxy contract initialized. Use createProxyInstance().");
|
|
124
|
+
}
|
|
125
|
+
idx_notional = 4;
|
|
126
|
+
perpID = LiquidatorTool.symbolToPerpetualId(symbol, this.symbolToPerpStaticInfo);
|
|
127
|
+
if (!(indexPrices == undefined)) return [3 /*break*/, 2];
|
|
128
|
+
return [4 /*yield*/, this.priceFeedGetter.fetchPricesForPerpetual(symbol)];
|
|
129
|
+
case 1:
|
|
130
|
+
obj = _a.sent();
|
|
131
|
+
indexPrices = [obj.idxPrices[0], obj.idxPrices[1]];
|
|
132
|
+
_a.label = 2;
|
|
133
|
+
case 2: return [4 /*yield*/, this.proxyContract.getTraderState(perpID, traderAddr, indexPrices.map(function (x) { return (0, d8XMath_1.floatToABK64x64)(x); }))];
|
|
134
|
+
case 3:
|
|
135
|
+
traderState = _a.sent();
|
|
136
|
+
if (traderState[idx_notional] == 0) {
|
|
137
|
+
// trader does not have open position
|
|
138
|
+
return [2 /*return*/, true];
|
|
139
|
+
}
|
|
140
|
+
idx_maintenanceMgnRate = 10;
|
|
141
|
+
idx_marginAccountPositionBC = 4;
|
|
142
|
+
idx_collateralToQuoteConversion = 9;
|
|
143
|
+
idx_marginBalance = 0;
|
|
144
|
+
maintMgnRate = (0, d8XMath_1.ABK64x64ToFloat)(traderState[idx_maintenanceMgnRate]);
|
|
145
|
+
pos = (0, d8XMath_1.ABK64x64ToFloat)(traderState[idx_marginAccountPositionBC]);
|
|
146
|
+
marginbalance = (0, d8XMath_1.ABK64x64ToFloat)(traderState[idx_marginBalance]);
|
|
147
|
+
coll2quote = (0, d8XMath_1.ABK64x64ToFloat)(traderState[idx_collateralToQuoteConversion]);
|
|
148
|
+
base2collateral = indexPrices[0] / coll2quote;
|
|
149
|
+
threshold = Math.abs(pos * base2collateral * maintMgnRate);
|
|
150
|
+
return [2 /*return*/, marginbalance >= threshold];
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
});
|
|
154
|
+
};
|
|
155
|
+
/**
|
|
156
|
+
*
|
|
157
|
+
* @param perpetualId Perpetual id.
|
|
158
|
+
* @param liquidatorAddr Address to be credited for the liquidation.
|
|
159
|
+
* @param traderAddr Address of the trader to be liquidated.
|
|
160
|
+
* @param priceFeedData contains VAA and timestamps required
|
|
161
|
+
* @param options E.g., Gas limit, fee.
|
|
162
|
+
* @ignore
|
|
163
|
+
*/
|
|
164
|
+
LiquidatorTool.prototype._liquidateByAMM = function (perpetualId, liquidatorAddr, traderAddr, priceFeedData, options) {
|
|
165
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
166
|
+
return tslib_1.__generator(this, function (_a) {
|
|
167
|
+
switch (_a.label) {
|
|
168
|
+
case 0: return [4 /*yield*/, this.proxyContract.liquidateByAMM(perpetualId, liquidatorAddr, traderAddr, priceFeedData.priceFeedVaas, priceFeedData.timestamps, options)];
|
|
169
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
});
|
|
173
|
+
};
|
|
174
|
+
/**
|
|
175
|
+
* Total number of active accounts for this symbol, i.e. accounts with positions that are currently open.
|
|
176
|
+
* @param {string} symbol Symbol of the form ETH-USD-MATIC.
|
|
177
|
+
* @example
|
|
178
|
+
* import { LiquidatorTool, PerpetualDataHandler } from '@d8x/perpetuals-sdk';
|
|
179
|
+
* async function main() {
|
|
180
|
+
* console.log(LiquidatorTool);
|
|
181
|
+
* // Setup (authentication required, PK is an environment variable with a private key)
|
|
182
|
+
* const config = PerpetualDataHandler.readSDKConfig("testnet");
|
|
183
|
+
* const pk: string = <string>process.env.PK;
|
|
184
|
+
* let lqudtrTool = new LiquidatorTool(config, pk);
|
|
185
|
+
* await lqudtrTool.createProxyInstance();
|
|
186
|
+
* // get number of active accounts
|
|
187
|
+
* let accounts = await lqudtrTool.countActivePerpAccounts("ETH-USD-MATIC");
|
|
188
|
+
* console.log(accounts);
|
|
189
|
+
* }
|
|
190
|
+
* main();
|
|
191
|
+
*
|
|
192
|
+
* @returns {number} Number of active accounts.
|
|
193
|
+
*/
|
|
194
|
+
LiquidatorTool.prototype.countActivePerpAccounts = function (symbol) {
|
|
195
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
196
|
+
var perpID, numAccounts;
|
|
197
|
+
return tslib_1.__generator(this, function (_a) {
|
|
198
|
+
switch (_a.label) {
|
|
199
|
+
case 0:
|
|
200
|
+
if (this.proxyContract == null) {
|
|
201
|
+
throw Error("no proxy contract initialized. Use createProxyInstance().");
|
|
202
|
+
}
|
|
203
|
+
perpID = LiquidatorTool.symbolToPerpetualId(symbol, this.symbolToPerpStaticInfo);
|
|
204
|
+
return [4 /*yield*/, this.proxyContract.countActivePerpAccounts(perpID)];
|
|
205
|
+
case 1:
|
|
206
|
+
numAccounts = _a.sent();
|
|
207
|
+
return [2 /*return*/, Number(numAccounts)];
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
});
|
|
211
|
+
};
|
|
212
|
+
/**
|
|
213
|
+
* Get addresses of active accounts by chunks.
|
|
214
|
+
* @param {string} symbol Symbol of the form ETH-USD-MATIC.
|
|
215
|
+
* @param {number} from From which account we start counting (0-indexed).
|
|
216
|
+
* @param {number} to Until which account we count, non inclusive.
|
|
217
|
+
* @example
|
|
218
|
+
* import { LiquidatorTool, PerpetualDataHandler } from '@d8x/perpetuals-sdk';
|
|
219
|
+
* async function main() {
|
|
220
|
+
* console.log(LiquidatorTool);
|
|
221
|
+
* // Setup (authentication required, PK is an environment variable with a private key)
|
|
222
|
+
* const config = PerpetualDataHandler.readSDKConfig("testnet");
|
|
223
|
+
* const pk: string = <string>process.env.PK;
|
|
224
|
+
* let lqudtrTool = new LiquidatorTool(config, pk);
|
|
225
|
+
* await lqudtrTool.createProxyInstance();
|
|
226
|
+
* // get all active accounts in chunks
|
|
227
|
+
* let accounts = await lqudtrTool.getActiveAccountsByChunks("ETH-USD-MATIC", 0, 4);
|
|
228
|
+
* console.log(accounts);
|
|
229
|
+
* }
|
|
230
|
+
* main();
|
|
231
|
+
*
|
|
232
|
+
* @returns {string[]} Array of addresses at locations 'from', 'from'+1 ,..., 'to'-1.
|
|
233
|
+
*/
|
|
234
|
+
LiquidatorTool.prototype.getActiveAccountsByChunks = function (symbol, from, to) {
|
|
235
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
236
|
+
var perpID;
|
|
237
|
+
return tslib_1.__generator(this, function (_a) {
|
|
238
|
+
switch (_a.label) {
|
|
239
|
+
case 0:
|
|
240
|
+
if (this.proxyContract == null) {
|
|
241
|
+
throw Error("no proxy contract initialized. Use createProxyInstance().");
|
|
242
|
+
}
|
|
243
|
+
perpID = LiquidatorTool.symbolToPerpetualId(symbol, this.symbolToPerpStaticInfo);
|
|
244
|
+
return [4 /*yield*/, this.proxyContract.getActivePerpAccountsByChunks(perpID, from, to)];
|
|
245
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
246
|
+
}
|
|
247
|
+
});
|
|
248
|
+
});
|
|
249
|
+
};
|
|
250
|
+
/**
|
|
251
|
+
* Addresses for all the active accounts in this perpetual symbol.
|
|
252
|
+
* @param {string} symbol Symbol of the form ETH-USD-MATIC.
|
|
253
|
+
* @example
|
|
254
|
+
* import { LiquidatorTool, PerpetualDataHandler } from '@d8x/perpetuals-sdk';
|
|
255
|
+
* async function main() {
|
|
256
|
+
* console.log(LiquidatorTool);
|
|
257
|
+
* // Setup (authentication required, PK is an environment variable with a private key)
|
|
258
|
+
* const config = PerpetualDataHandler.readSDKConfig("testnet");
|
|
259
|
+
* const pk: string = <string>process.env.PK;
|
|
260
|
+
* let lqudtrTool = new LiquidatorTool(config, pk);
|
|
261
|
+
* await lqudtrTool.createProxyInstance();
|
|
262
|
+
* // get all active accounts
|
|
263
|
+
* let accounts = await lqudtrTool.getAllActiveAccounts("ETH-USD-MATIC");
|
|
264
|
+
* console.log(accounts);
|
|
265
|
+
* }
|
|
266
|
+
* main();
|
|
267
|
+
*
|
|
268
|
+
* @returns {string[]} Array of addresses.
|
|
269
|
+
*/
|
|
270
|
+
LiquidatorTool.prototype.getAllActiveAccounts = function (symbol) {
|
|
271
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
272
|
+
var totalAccounts;
|
|
273
|
+
return tslib_1.__generator(this, function (_a) {
|
|
274
|
+
switch (_a.label) {
|
|
275
|
+
case 0: return [4 /*yield*/, this.countActivePerpAccounts(symbol)];
|
|
276
|
+
case 1:
|
|
277
|
+
totalAccounts = _a.sent();
|
|
278
|
+
return [4 /*yield*/, this.getActiveAccountsByChunks(symbol, 0, totalAccounts)];
|
|
279
|
+
case 2: return [2 /*return*/, _a.sent()];
|
|
280
|
+
}
|
|
281
|
+
});
|
|
282
|
+
});
|
|
283
|
+
};
|
|
284
|
+
return LiquidatorTool;
|
|
285
|
+
}(writeAccessHandler_1.default));
|
|
286
|
+
exports.default = LiquidatorTool;
|
|
287
|
+
//# sourceMappingURL=liquidatorTool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"liquidatorTool.js","sourceRoot":"","sources":["../../src/liquidatorTool.ts"],"names":[],"mappings":";;;AAAA,oFAAsD;AAGtD,qCAA6D;AAE7D;;;;GAIG;AACH;IAA4C,0CAAkB;IAC5D;;;;;;;;;;;;;;;;;;;OAmBG;IACH,wBAAmB,MAAqB,EAAE,UAAkB;eAC1D,kBAAM,MAAM,EAAE,UAAU,CAAC;IAC3B,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACU,wCAAe,GAA5B,UACE,MAAc,EACd,UAAkB,EAClB,cAA2B,EAC3B,aAAmC;QADnC,+BAAA,EAAA,mBAA2B;;;;;;wBAG3B,mDAAmD;wBACnD,IAAI,IAAI,CAAC,aAAa,IAAI,IAAI,IAAI,IAAI,CAAC,MAAM,IAAI,IAAI,EAAE;4BACrD,MAAM,KAAK,CAAC,qEAAqE,CAAC,CAAC;yBACpF;wBACD,kDAAkD;wBAClD,IAAI,cAAc,IAAI,EAAE,EAAE;4BACxB,cAAc,GAAG,IAAI,CAAC,UAAU,CAAC;yBAClC;wBACG,MAAM,GAAG,cAAc,CAAC,mBAAmB,CAAC,MAAM,EAAE,IAAI,CAAC,sBAAsB,CAAC,CAAC;6BACjF,CAAA,aAAa,IAAI,SAAS,CAAA,EAA1B,wBAA0B;wBACZ,qBAAM,IAAI,CAAC,wBAAwB,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AC,uBAAuB,CAAC,MAAM,CAAC,EAAA;;wBAAtE,WAAW,GAAG,SAAwD;wBAC1E,sBAAO,MAAM,CAAC,WAAW,CAAC,EAAC;;;;KAC5B;IAED;;;;;;;;;;;;;;;;;;;;;OAqBG;IACU,kDAAyB,GAAtC,UAAuC,MAAc,EAAE,IAAY,EAAE,EAAU;;;;;;wBAC7E,IAAI,IAAI,CAAC,aAAa,IAAI,IAAI,EAAE;4BAC9B,MAAM,KAAK,CAAC,2DAA2D,CAAC,CAAC;yBAC1E;wBACG,MAAM,GAAG,cAAc,CAAC,mBAAmB,CAAC,MAAM,EAAE,IAAI,CAAC,sBAAsB,CAAC,CAAC;wBAC9E,qBAAM,IAAI,CAAC,aAAa,CAAC,6BAA6B,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC,EAAA;4BAA/E,sBAAO,SAAwE,EAAC;;;;KACjF;IAED;;;;;;;;;;;;;;;;;;;OAmBG;IACU,6CAAoB,GAAjC,UAAkC,MAAc;;;;;4BAE1B,qBAAM,IAAI,CAAC,uBAAuB,CAAC,MAAM,CAAC,EAAA;;wBAA1D,aAAa,GAAG,SAA0C;wBACvD,qBAAM,IAAI,CAAC,yBAAyB,CAAC,MAAM,EAAE,CAAC,EAAE,aAAa,CAAC,EAAA;4BAArE,sBAAO,SAA8D,EAAC;;;;KACvE;IACH,qBAAC;AAAD,CAAC,AAvPD,CAA4C,4BAAkB,GAuP7D"}
|
|
@@ -1,71 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
21
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
22
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
23
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
-
});
|
|
25
|
-
};
|
|
26
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
27
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
28
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
29
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
30
|
-
function step(op) {
|
|
31
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
32
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
33
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
34
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
35
|
-
switch (op[0]) {
|
|
36
|
-
case 0: case 1: t = op; break;
|
|
37
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
38
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
39
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
40
|
-
default:
|
|
41
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
42
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
43
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
44
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
45
|
-
if (t[2]) _.ops.pop();
|
|
46
|
-
_.trys.pop(); continue;
|
|
47
|
-
}
|
|
48
|
-
op = body.call(thisArg, _);
|
|
49
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
50
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
54
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
55
|
-
};
|
|
56
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var tslib_1 = require("tslib");
|
|
57
4
|
var ethers_1 = require("ethers");
|
|
58
5
|
var d8XMath_1 = require("./d8XMath");
|
|
59
6
|
var nodeSDKTypes_1 = require("./nodeSDKTypes");
|
|
60
|
-
var perpetualDataHandler_1 = __importDefault(require("./perpetualDataHandler"));
|
|
61
|
-
var writeAccessHandler_1 = __importDefault(require("./writeAccessHandler"));
|
|
7
|
+
var perpetualDataHandler_1 = tslib_1.__importDefault(require("./perpetualDataHandler"));
|
|
8
|
+
var writeAccessHandler_1 = tslib_1.__importDefault(require("./writeAccessHandler"));
|
|
62
9
|
/**
|
|
63
10
|
* Functions to provide liquidity. This class requires a private key and executes
|
|
64
11
|
* smart-contract interactions that require gas-payments.
|
|
65
12
|
* @extends WriteAccessHandler
|
|
66
13
|
*/
|
|
67
14
|
var LiquidityProviderTool = /** @class */ (function (_super) {
|
|
68
|
-
__extends(LiquidityProviderTool, _super);
|
|
15
|
+
tslib_1.__extends(LiquidityProviderTool, _super);
|
|
69
16
|
/**
|
|
70
17
|
* Constructor
|
|
71
18
|
* @param {NodeSDKConfig} config Configuration object, see PerpetualDataHandler.
|
|
@@ -111,9 +58,9 @@ var LiquidityProviderTool = /** @class */ (function (_super) {
|
|
|
111
58
|
* @return Value in poolSymbol-currency (e.g. MATIC, USDC), balance of pool share tokens, and share token symbol.
|
|
112
59
|
*/
|
|
113
60
|
LiquidityProviderTool.prototype.getParticipationValue = function (poolSymbolName) {
|
|
114
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
61
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
115
62
|
var poolId, shareTokenAddr, shareToken, dShareTokenBalanceOfAddr, valueCCDec18, shareTokenBalanceOfAddr;
|
|
116
|
-
return __generator(this, function (_a) {
|
|
63
|
+
return tslib_1.__generator(this, function (_a) {
|
|
117
64
|
switch (_a.label) {
|
|
118
65
|
case 0:
|
|
119
66
|
if (this.proxyContract == null ||
|
|
@@ -164,9 +111,9 @@ var LiquidityProviderTool = /** @class */ (function (_super) {
|
|
|
164
111
|
* @return Transaction object
|
|
165
112
|
*/
|
|
166
113
|
LiquidityProviderTool.prototype.addLiquidity = function (poolSymbolName, amountCC) {
|
|
167
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
114
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
168
115
|
var poolId, tx;
|
|
169
|
-
return __generator(this, function (_a) {
|
|
116
|
+
return tslib_1.__generator(this, function (_a) {
|
|
170
117
|
switch (_a.label) {
|
|
171
118
|
case 0:
|
|
172
119
|
if (this.proxyContract == null || this.signer == null) {
|
|
@@ -207,9 +154,9 @@ var LiquidityProviderTool = /** @class */ (function (_super) {
|
|
|
207
154
|
* @return Transaction object.
|
|
208
155
|
*/
|
|
209
156
|
LiquidityProviderTool.prototype.initiateLiquidityWithdrawal = function (poolSymbolName, amountPoolShares) {
|
|
210
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
157
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
211
158
|
var poolId, tx;
|
|
212
|
-
return __generator(this, function (_a) {
|
|
159
|
+
return tslib_1.__generator(this, function (_a) {
|
|
213
160
|
switch (_a.label) {
|
|
214
161
|
case 0:
|
|
215
162
|
if (this.proxyContract == null || this.signer == null) {
|
|
@@ -248,9 +195,9 @@ var LiquidityProviderTool = /** @class */ (function (_super) {
|
|
|
248
195
|
* @returns Transaction object.
|
|
249
196
|
*/
|
|
250
197
|
LiquidityProviderTool.prototype.executeLiquidityWithdrawal = function (poolSymbolName) {
|
|
251
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
198
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
252
199
|
var poolId, tx;
|
|
253
|
-
return __generator(this, function (_a) {
|
|
200
|
+
return tslib_1.__generator(this, function (_a) {
|
|
254
201
|
switch (_a.label) {
|
|
255
202
|
case 0:
|
|
256
203
|
if (this.proxyContract == null || this.signer == null) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"liquidityProviderTool.js","sourceRoot":"","sources":["../../src/liquidityProviderTool.ts"],"names":[],"mappings":";;;AAAA,iCAAgC;AAChC,qCAAuD;AACvD,+CAA0D;AAC1D,wFAA0D;AAC1D,oFAAsD;AACtD;;;;GAIG;AACH;IAAmD,iDAAkB;IACnE;;;;;;;;;;;;;;;;;;;OAmBG;IACH,+BAAmB,MAAqB,EAAE,UAAkB;eAC1D,kBAAM,MAAM,EAAE,UAAU,CAAC;IAC3B,CAAC;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACU,qDAAqB,GAAlC,UACE,cAAsB;;;;;;wBAEtB,IACE,IAAI,CAAC,aAAa,IAAI,IAAI;4BAC1B,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