@dhedge/backend-flatcoin-core 0.1.20 → 0.1.22

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.
@@ -0,0 +1,134 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Viewer = void 0;
4
+ exports.Viewer = [
5
+ {
6
+ inputs: [
7
+ {
8
+ internalType: 'contract IFlatcoinVault',
9
+ name: '_vault',
10
+ type: 'address',
11
+ },
12
+ ],
13
+ stateMutability: 'nonpayable',
14
+ type: 'constructor',
15
+ },
16
+ {
17
+ inputs: [
18
+ {
19
+ internalType: 'address',
20
+ name: 'account',
21
+ type: 'address',
22
+ },
23
+ ],
24
+ name: 'getAccountLeveragePositionData',
25
+ outputs: [
26
+ {
27
+ components: [
28
+ {
29
+ internalType: 'uint256',
30
+ name: 'tokenId',
31
+ type: 'uint256',
32
+ },
33
+ {
34
+ internalType: 'uint256',
35
+ name: 'lastPrice',
36
+ type: 'uint256',
37
+ },
38
+ {
39
+ internalType: 'uint256',
40
+ name: 'marginDeposited',
41
+ type: 'uint256',
42
+ },
43
+ {
44
+ internalType: 'uint256',
45
+ name: 'additionalSize',
46
+ type: 'uint256',
47
+ },
48
+ {
49
+ internalType: 'int256',
50
+ name: 'entryCumulativeFunding',
51
+ type: 'int256',
52
+ },
53
+ {
54
+ internalType: 'int256',
55
+ name: 'profitLoss',
56
+ type: 'int256',
57
+ },
58
+ {
59
+ internalType: 'int256',
60
+ name: 'accruedFunding',
61
+ type: 'int256',
62
+ },
63
+ {
64
+ internalType: 'int256',
65
+ name: 'marginAfterSettlement',
66
+ type: 'int256',
67
+ },
68
+ {
69
+ internalType: 'uint256',
70
+ name: 'liquidationPrice',
71
+ type: 'uint256',
72
+ },
73
+ ],
74
+ internalType: 'struct FlatcoinStructs.LeveragePositionData[]',
75
+ name: 'positionData',
76
+ type: 'tuple[]',
77
+ },
78
+ ],
79
+ stateMutability: 'view',
80
+ type: 'function',
81
+ },
82
+ {
83
+ inputs: [],
84
+ name: 'getFlatcoinPriceInUSD',
85
+ outputs: [
86
+ {
87
+ internalType: 'uint256',
88
+ name: 'priceInUSD',
89
+ type: 'uint256',
90
+ },
91
+ ],
92
+ stateMutability: 'view',
93
+ type: 'function',
94
+ },
95
+ {
96
+ inputs: [],
97
+ name: 'getFlatcoinTVL',
98
+ outputs: [
99
+ {
100
+ internalType: 'uint256',
101
+ name: 'tvl',
102
+ type: 'uint256',
103
+ },
104
+ ],
105
+ stateMutability: 'view',
106
+ type: 'function',
107
+ },
108
+ {
109
+ inputs: [],
110
+ name: 'getMarketSkewPercentage',
111
+ outputs: [
112
+ {
113
+ internalType: 'int256',
114
+ name: 'skewPercent',
115
+ type: 'int256',
116
+ },
117
+ ],
118
+ stateMutability: 'view',
119
+ type: 'function',
120
+ },
121
+ {
122
+ inputs: [],
123
+ name: 'vault',
124
+ outputs: [
125
+ {
126
+ internalType: 'contract IFlatcoinVault',
127
+ name: '',
128
+ type: 'address',
129
+ },
130
+ ],
131
+ stateMutability: 'view',
132
+ type: 'function',
133
+ },
134
+ ];
@@ -1,7 +1,4 @@
1
- import * as FlatcoinV1 from '../contracts/abi/FlatcoinV1.json';
2
- export { FlatcoinV1 };
3
- import * as Viewer from '../contracts/abi/Viewer.json';
4
- export { Viewer };
5
- import * as FlatcoinErrors from '../contracts/abi/FlatcoinErrors.json';
6
- export { FlatcoinErrors };
1
+ export { FlatcoinV1 } from './abi/flatcoin-v1';
2
+ export { Viewer } from './abi/viewer';
3
+ export { FlatcoinErrors } from './abi/flatcoin-errors';
7
4
  export * from './helpers';
@@ -10,27 +10,15 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
10
10
  if (k2 === undefined) k2 = k;
11
11
  o[k2] = m[k];
12
12
  }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
13
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
26
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
27
15
  };
28
16
  Object.defineProperty(exports, "__esModule", { value: true });
29
17
  exports.FlatcoinErrors = exports.Viewer = exports.FlatcoinV1 = void 0;
30
- const FlatcoinV1 = __importStar(require("../contracts/abi/FlatcoinV1.json"));
31
- exports.FlatcoinV1 = FlatcoinV1;
32
- const Viewer = __importStar(require("../contracts/abi/Viewer.json"));
33
- exports.Viewer = Viewer;
34
- const FlatcoinErrors = __importStar(require("../contracts/abi/FlatcoinErrors.json"));
35
- exports.FlatcoinErrors = FlatcoinErrors;
18
+ var flatcoin_v1_1 = require("./abi/flatcoin-v1");
19
+ Object.defineProperty(exports, "FlatcoinV1", { enumerable: true, get: function () { return flatcoin_v1_1.FlatcoinV1; } });
20
+ var viewer_1 = require("./abi/viewer");
21
+ Object.defineProperty(exports, "Viewer", { enumerable: true, get: function () { return viewer_1.Viewer; } });
22
+ var flatcoin_errors_1 = require("./abi/flatcoin-errors");
23
+ Object.defineProperty(exports, "FlatcoinErrors", { enumerable: true, get: function () { return flatcoin_errors_1.FlatcoinErrors; } });
36
24
  __exportStar(require("./helpers"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhedge/backend-flatcoin-core",
3
- "version": "0.1.20",
3
+ "version": "0.1.22",
4
4
  "description": "Backend Flatcoin Core",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,436 +0,0 @@
1
- [
2
- {
3
- "inputs": [
4
- {
5
- "internalType": "uint256",
6
- "name": "amount",
7
- "type": "uint256"
8
- },
9
- {
10
- "internalType": "uint256",
11
- "name": "minAmount",
12
- "type": "uint256"
13
- }
14
- ],
15
- "name": "AmountTooSmall",
16
- "type": "error"
17
- },
18
- {
19
- "inputs": [
20
- {
21
- "internalType": "uint256",
22
- "name": "executableTime",
23
- "type": "uint256"
24
- }
25
- ],
26
- "name": "ExecutableTimeNotReached",
27
- "type": "error"
28
- },
29
- {
30
- "inputs": [
31
- {
32
- "internalType": "uint256",
33
- "name": "supplied",
34
- "type": "uint256"
35
- },
36
- {
37
- "internalType": "uint256",
38
- "name": "accepted",
39
- "type": "uint256"
40
- }
41
- ],
42
- "name": "HighSlippage",
43
- "type": "error"
44
- },
45
- {
46
- "inputs": [
47
- {
48
- "internalType": "uint256",
49
- "name": "fee",
50
- "type": "uint256"
51
- }
52
- ],
53
- "name": "InvalidFee",
54
- "type": "error"
55
- },
56
- {
57
- "inputs": [
58
- {
59
- "internalType": "string",
60
- "name": "variableName",
61
- "type": "string"
62
- }
63
- ],
64
- "name": "InvariantViolation",
65
- "type": "error"
66
- },
67
- {
68
- "inputs": [
69
- {
70
- "internalType": "uint256",
71
- "name": "maxFillPrice",
72
- "type": "uint256"
73
- },
74
- {
75
- "internalType": "uint256",
76
- "name": "leverageModifyFillPrice",
77
- "type": "uint256"
78
- }
79
- ],
80
- "name": "MaxFillPriceTooLow",
81
- "type": "error"
82
- },
83
- {
84
- "inputs": [
85
- {
86
- "internalType": "uint256",
87
- "name": "minFillPrice",
88
- "type": "uint256"
89
- },
90
- {
91
- "internalType": "uint256",
92
- "name": "leverageModifyFillPrice",
93
- "type": "uint256"
94
- }
95
- ],
96
- "name": "MinFillPriceTooHigh",
97
- "type": "error"
98
- },
99
- {
100
- "inputs": [
101
- {
102
- "internalType": "enum IDelayedOrder.OrderType",
103
- "name": "orderType",
104
- "type": "uint8"
105
- }
106
- ],
107
- "name": "NoPendingOrderAllowed",
108
- "type": "error"
109
- },
110
- {
111
- "inputs": [
112
- {
113
- "internalType": "address",
114
- "name": "account",
115
- "type": "address"
116
- },
117
- {
118
- "internalType": "uint256",
119
- "name": "totalBalance",
120
- "type": "uint256"
121
- },
122
- {
123
- "internalType": "uint256",
124
- "name": "withdrawAmount",
125
- "type": "uint256"
126
- }
127
- ],
128
- "name": "NotEnoughBalanceForWithdraw",
129
- "type": "error"
130
- },
131
- {
132
- "inputs": [
133
- {
134
- "internalType": "int256",
135
- "name": "marginAmount",
136
- "type": "int256"
137
- },
138
- {
139
- "internalType": "uint256",
140
- "name": "feeAmount",
141
- "type": "uint256"
142
- }
143
- ],
144
- "name": "NotEnoughMarginForFees",
145
- "type": "error"
146
- },
147
- {
148
- "inputs": [
149
- {
150
- "internalType": "uint256",
151
- "name": "tokenId",
152
- "type": "uint256"
153
- },
154
- {
155
- "internalType": "address",
156
- "name": "msgSender",
157
- "type": "address"
158
- }
159
- ],
160
- "name": "NotTokenOwner",
161
- "type": "error"
162
- },
163
- {
164
- "inputs": [
165
- {
166
- "internalType": "address",
167
- "name": "msgSender",
168
- "type": "address"
169
- }
170
- ],
171
- "name": "OnlyOwner",
172
- "type": "error"
173
- },
174
- {
175
- "inputs": [],
176
- "name": "OrderHasExpired",
177
- "type": "error"
178
- },
179
- {
180
- "inputs": [],
181
- "name": "OrderHasNotExpired",
182
- "type": "error"
183
- },
184
- {
185
- "inputs": [
186
- {
187
- "internalType": "bytes32",
188
- "name": "moduleKey",
189
- "type": "bytes32"
190
- }
191
- ],
192
- "name": "Paused",
193
- "type": "error"
194
- },
195
- {
196
- "inputs": [
197
- {
198
- "internalType": "string",
199
- "name": "variableName",
200
- "type": "string"
201
- }
202
- ],
203
- "name": "ZeroAddress",
204
- "type": "error"
205
- },
206
- {
207
- "inputs": [
208
- {
209
- "internalType": "string",
210
- "name": "variableName",
211
- "type": "string"
212
- }
213
- ],
214
- "name": "ZeroValue",
215
- "type": "error"
216
- },
217
- {
218
- "inputs": [
219
- {
220
- "internalType": "uint256",
221
- "name": "collateralCap",
222
- "type": "uint256"
223
- }
224
- ],
225
- "name": "DepositCapReached",
226
- "type": "error"
227
- },
228
- {
229
- "inputs": [
230
- {
231
- "internalType": "uint256",
232
- "name": "skewFractionMax",
233
- "type": "uint256"
234
- }
235
- ],
236
- "name": "InvalidSkewFractionMax",
237
- "type": "error"
238
- },
239
- {
240
- "inputs": [],
241
- "name": "MarginMismatchOnClose",
242
- "type": "error"
243
- },
244
- {
245
- "inputs": [
246
- {
247
- "internalType": "uint256",
248
- "name": "skewFraction",
249
- "type": "uint256"
250
- }
251
- ],
252
- "name": "MaxSkewReached",
253
- "type": "error"
254
- },
255
- {
256
- "inputs": [
257
- {
258
- "internalType": "address",
259
- "name": "msgSender",
260
- "type": "address"
261
- }
262
- ],
263
- "name": "OnlyAuthorizedModule",
264
- "type": "error"
265
- },
266
- {
267
- "inputs": [
268
- {
269
- "internalType": "uint256",
270
- "name": "tokenId",
271
- "type": "uint256"
272
- }
273
- ],
274
- "name": "TaskNotFound",
275
- "type": "error"
276
- },
277
- {
278
- "inputs": [],
279
- "name": "AdjustNotAllowed",
280
- "type": "error"
281
- },
282
- {
283
- "inputs": [],
284
- "name": "InvalidLeverageCriteria",
285
- "type": "error"
286
- },
287
- {
288
- "inputs": [
289
- {
290
- "internalType": "uint256",
291
- "name": "leverageMax",
292
- "type": "uint256"
293
- },
294
- {
295
- "internalType": "uint256",
296
- "name": "leverage",
297
- "type": "uint256"
298
- }
299
- ],
300
- "name": "LeverageTooHigh",
301
- "type": "error"
302
- },
303
- {
304
- "inputs": [
305
- {
306
- "internalType": "uint256",
307
- "name": "leverageMin",
308
- "type": "uint256"
309
- },
310
- {
311
- "internalType": "uint256",
312
- "name": "leverage",
313
- "type": "uint256"
314
- }
315
- ],
316
- "name": "LeverageTooLow",
317
- "type": "error"
318
- },
319
- {
320
- "inputs": [
321
- {
322
- "internalType": "uint256",
323
- "name": "marginMin",
324
- "type": "uint256"
325
- },
326
- {
327
- "internalType": "uint256",
328
- "name": "margin",
329
- "type": "uint256"
330
- }
331
- ],
332
- "name": "MarginTooSmall",
333
- "type": "error"
334
- },
335
- {
336
- "inputs": [
337
- {
338
- "internalType": "int256",
339
- "name": "settledMargin",
340
- "type": "int256"
341
- }
342
- ],
343
- "name": "SettledMarginNotPositive",
344
- "type": "error"
345
- },
346
- {
347
- "inputs": [
348
- {
349
- "internalType": "uint256",
350
- "name": "tokenId",
351
- "type": "uint256"
352
- }
353
- ],
354
- "name": "CannotLiquidate",
355
- "type": "error"
356
- },
357
- {
358
- "inputs": [
359
- {
360
- "internalType": "uint256",
361
- "name": "lower",
362
- "type": "uint256"
363
- },
364
- {
365
- "internalType": "uint256",
366
- "name": "upper",
367
- "type": "uint256"
368
- }
369
- ],
370
- "name": "InvalidBounds",
371
- "type": "error"
372
- },
373
- {
374
- "inputs": [],
375
- "name": "ETHPriceExpired",
376
- "type": "error"
377
- },
378
- {
379
- "inputs": [],
380
- "name": "ETHPriceInvalid",
381
- "type": "error"
382
- },
383
- {
384
- "inputs": [
385
- {
386
- "internalType": "enum FlatcoinErrors.PriceSource",
387
- "name": "priceSource",
388
- "type": "uint8"
389
- }
390
- ],
391
- "name": "PriceExpired",
392
- "type": "error"
393
- },
394
- {
395
- "inputs": [
396
- {
397
- "internalType": "enum FlatcoinErrors.PriceSource",
398
- "name": "priceSource",
399
- "type": "uint8"
400
- }
401
- ],
402
- "name": "PriceInvalid",
403
- "type": "error"
404
- },
405
- {
406
- "inputs": [],
407
- "name": "OracleConfigInvalid",
408
- "type": "error"
409
- },
410
- {
411
- "inputs": [
412
- {
413
- "internalType": "uint256",
414
- "name": "diffPercent",
415
- "type": "uint256"
416
- }
417
- ],
418
- "name": "PriceMismatch",
419
- "type": "error"
420
- },
421
- {
422
- "inputs": [],
423
- "name": "RefundFailed",
424
- "type": "error"
425
- },
426
- {
427
- "inputs": [],
428
- "name": "PriceImpactDuringFullWithdraw",
429
- "type": "error"
430
- },
431
- {
432
- "inputs": [],
433
- "name": "PriceImpactDuringWithdraw",
434
- "type": "error"
435
- }
436
- ]