@gainsnetwork/sdk 0.2.12-rc14 → 0.2.12-rc16
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/lib/constants.d.ts +7 -0
- package/lib/constants.js +11 -4
- package/lib/contracts/utils/pairs.js +7 -0
- package/lib/trade/fees/borrowing/index.d.ts +0 -1
- package/lib/trade/fees/borrowing/index.js +9 -7
- package/lib/trade/types.d.ts +8 -1
- package/lib/trade/types.js +7 -0
- package/package.json +1 -1
package/lib/constants.d.ts
CHANGED
|
@@ -256,6 +256,13 @@ export declare const pairs: {
|
|
|
256
256
|
"UXLINK/USD": string;
|
|
257
257
|
"AVAIL/USD": string;
|
|
258
258
|
"BANANA/USD": string;
|
|
259
|
+
"RARE/USD": string;
|
|
260
|
+
"SYS/USD": string;
|
|
261
|
+
"NMR/USD": string;
|
|
262
|
+
"RSR/USD": string;
|
|
263
|
+
"SYN/USD": string;
|
|
264
|
+
"AUCTION/USD": string;
|
|
265
|
+
"ALICE/USD": string;
|
|
259
266
|
};
|
|
260
267
|
export declare const getAssetClassFromGroupIndex: (groupIndex: number) => string | undefined;
|
|
261
268
|
export declare const tickerChanges: {
|
package/lib/constants.js
CHANGED
|
@@ -264,6 +264,13 @@ exports.pairs = {
|
|
|
264
264
|
"UXLINK/USD": CRYPTO,
|
|
265
265
|
"AVAIL/USD": CRYPTO,
|
|
266
266
|
"BANANA/USD": CRYPTO,
|
|
267
|
+
"RARE/USD": CRYPTO,
|
|
268
|
+
"SYS/USD": CRYPTO,
|
|
269
|
+
"NMR/USD": CRYPTO,
|
|
270
|
+
"RSR/USD": CRYPTO,
|
|
271
|
+
"SYN/USD": CRYPTO,
|
|
272
|
+
"AUCTION/USD": CRYPTO,
|
|
273
|
+
"ALICE/USD": CRYPTO,
|
|
267
274
|
};
|
|
268
275
|
const getAssetClassFromGroupIndex = (groupIndex) => {
|
|
269
276
|
switch (groupIndex) {
|
|
@@ -296,10 +303,10 @@ exports.stockSplits = {
|
|
|
296
303
|
"TSLA_1/USD": { date: "8/25/2022", split: 3 },
|
|
297
304
|
};
|
|
298
305
|
exports.delistedPairIxs = new Set([
|
|
299
|
-
6, 31, 36,
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
306
|
+
6, 31, 36, 45, 48, 51, 54, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70,
|
|
307
|
+
71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
|
|
308
|
+
97, 99, 101, 106, 108, 52, 131, 147, 160, 179, 182, 183, 190, 229, 163, 155,
|
|
309
|
+
15, 170, 239, 254, 230,
|
|
303
310
|
]);
|
|
304
311
|
exports.delistedGroupsIxs = new Set([6, 7]);
|
|
305
312
|
exports.DEFAULT_PROTECTION_CLOSE_FACTOR = 1;
|
|
@@ -362,4 +362,11 @@ const PAIR_INDEX_TO_DESCRIPTION = {
|
|
|
362
362
|
[types_1.PairIndex.UXLINKUSD]: "UXLINK to US Dollar",
|
|
363
363
|
[types_1.PairIndex.AVAILUSD]: "Avail to US Dollar",
|
|
364
364
|
[types_1.PairIndex.BANANAUSD]: "Banana Gun to US Dollar",
|
|
365
|
+
[types_1.PairIndex.RAREUSD]: "SuperRare to US Dollar",
|
|
366
|
+
[types_1.PairIndex.SYSUSD]: "Syscoin to US Dollar",
|
|
367
|
+
[types_1.PairIndex.NMRUSD]: "Numeraire to US Dollar",
|
|
368
|
+
[types_1.PairIndex.RSRUSD]: "Reserve Rights to US Dollar",
|
|
369
|
+
[types_1.PairIndex.SYNUSD]: "Synapse to US Dollar",
|
|
370
|
+
[types_1.PairIndex.AUCTIONUSD]: "Bounce to US Dollar",
|
|
371
|
+
[types_1.PairIndex.ALICEUSD]: "My Neighbor Alice to US Dollar",
|
|
365
372
|
};
|
|
@@ -4,7 +4,6 @@ export type GetBorrowingFeeContext = {
|
|
|
4
4
|
currentBlock: number;
|
|
5
5
|
groups: BorrowingFee.Group[];
|
|
6
6
|
pairs: BorrowingFee.Pair[];
|
|
7
|
-
openInterest: OpenInterest;
|
|
8
7
|
};
|
|
9
8
|
export declare const getBorrowingFee: (posDai: number, pairIndex: PairIndex, long: boolean, initialAccFees: BorrowingFee.InitialAccFees, context: GetBorrowingFeeContext) => number;
|
|
10
9
|
export declare const withinMaxGroupOi: (pairIndex: PairIndex, long: boolean, positionSizeCollateral: number, context: {
|
|
@@ -28,10 +28,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
exports.BorrowingFee = exports.borrowingFeeUtils = exports.withinMaxGroupOi = exports.getBorrowingFee = void 0;
|
|
30
30
|
const getBorrowingFee = (posDai, pairIndex, long, initialAccFees, context) => {
|
|
31
|
-
if (!context.groups ||
|
|
32
|
-
!context.pairs ||
|
|
33
|
-
!context.openInterest ||
|
|
34
|
-
!context.pairs[pairIndex]) {
|
|
31
|
+
if (!context.groups || !context.pairs || !context.pairs[pairIndex]) {
|
|
35
32
|
return 0;
|
|
36
33
|
}
|
|
37
34
|
const { pairs } = context;
|
|
@@ -39,9 +36,13 @@ const getBorrowingFee = (posDai, pairIndex, long, initialAccFees, context) => {
|
|
|
39
36
|
const firstPairGroup = (pairGroups === null || pairGroups === void 0 ? void 0 : pairGroups.length) > 0 ? pairGroups[0] : undefined;
|
|
40
37
|
let fee = 0;
|
|
41
38
|
if (!firstPairGroup || firstPairGroup.block > initialAccFees.block) {
|
|
39
|
+
const openInterest = pairs[pairIndex].oi;
|
|
42
40
|
fee =
|
|
43
41
|
(!firstPairGroup
|
|
44
|
-
? getPairPendingAccFee(pairIndex, context.currentBlock, long,
|
|
42
|
+
? getPairPendingAccFee(pairIndex, context.currentBlock, long, {
|
|
43
|
+
pairs,
|
|
44
|
+
openInterest,
|
|
45
|
+
})
|
|
45
46
|
: long
|
|
46
47
|
? firstPairGroup.pairAccFeeLong
|
|
47
48
|
: firstPairGroup.pairAccFeeShort) - initialAccFees.accPairFee;
|
|
@@ -96,13 +97,14 @@ const getPairGroupAccFeesDeltas = (i, pairGroups, initialFees, pairIndex, long,
|
|
|
96
97
|
const beforeTradeOpen = group.block < initialFees.block;
|
|
97
98
|
let deltaGroup, deltaPair;
|
|
98
99
|
if (i == pairGroups.length - 1) {
|
|
99
|
-
const { currentBlock, groups, pairs
|
|
100
|
+
const { currentBlock, groups, pairs } = context;
|
|
101
|
+
const openInterest = pairs[pairIndex].oi;
|
|
100
102
|
deltaGroup = getGroupPendingAccFee(group.groupIndex, currentBlock, long, {
|
|
101
103
|
groups,
|
|
102
104
|
});
|
|
103
105
|
deltaPair = getPairPendingAccFee(pairIndex, currentBlock, long, {
|
|
104
106
|
pairs,
|
|
105
|
-
openInterest
|
|
107
|
+
openInterest,
|
|
106
108
|
});
|
|
107
109
|
}
|
|
108
110
|
else {
|
package/lib/trade/types.d.ts
CHANGED
|
@@ -462,5 +462,12 @@ export declare enum PairIndex {
|
|
|
462
462
|
SLERFUSD = 253,
|
|
463
463
|
UXLINKUSD = 254,
|
|
464
464
|
AVAILUSD = 255,
|
|
465
|
-
BANANAUSD = 256
|
|
465
|
+
BANANAUSD = 256,
|
|
466
|
+
RAREUSD = 257,
|
|
467
|
+
SYSUSD = 258,
|
|
468
|
+
NMRUSD = 259,
|
|
469
|
+
RSRUSD = 260,
|
|
470
|
+
SYNUSD = 261,
|
|
471
|
+
AUCTIONUSD = 262,
|
|
472
|
+
ALICEUSD = 263
|
|
466
473
|
}
|
package/lib/trade/types.js
CHANGED
|
@@ -286,4 +286,11 @@ var PairIndex;
|
|
|
286
286
|
PairIndex[PairIndex["UXLINKUSD"] = 254] = "UXLINKUSD";
|
|
287
287
|
PairIndex[PairIndex["AVAILUSD"] = 255] = "AVAILUSD";
|
|
288
288
|
PairIndex[PairIndex["BANANAUSD"] = 256] = "BANANAUSD";
|
|
289
|
+
PairIndex[PairIndex["RAREUSD"] = 257] = "RAREUSD";
|
|
290
|
+
PairIndex[PairIndex["SYSUSD"] = 258] = "SYSUSD";
|
|
291
|
+
PairIndex[PairIndex["NMRUSD"] = 259] = "NMRUSD";
|
|
292
|
+
PairIndex[PairIndex["RSRUSD"] = 260] = "RSRUSD";
|
|
293
|
+
PairIndex[PairIndex["SYNUSD"] = 261] = "SYNUSD";
|
|
294
|
+
PairIndex[PairIndex["AUCTIONUSD"] = 262] = "AUCTIONUSD";
|
|
295
|
+
PairIndex[PairIndex["ALICEUSD"] = 263] = "ALICEUSD";
|
|
289
296
|
})(PairIndex = exports.PairIndex || (exports.PairIndex = {}));
|