@triadxyz/triad-protocol 3.4.9-beta → 3.5.1-beta

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.
@@ -6,17 +6,11 @@ exports.generateFeeCurve = exports.simulateSellOrder = exports.simulateBuyOrder
6
6
  * Returns fee in basis points (bps)
7
7
  */
8
8
  function calculateDynamicFeeBps(price) {
9
- const internalPrice = Math.floor(price * 1000000);
9
+ const internalPrice = price * Math.pow(10, 6);
10
10
  if (internalPrice <= 900000) {
11
11
  return 380;
12
12
  }
13
- const priceAbove90 = internalPrice - 900000;
14
- const feeReduction = Math.floor((priceAbove90 * 100) / 80000);
15
- const calculatedFee = Math.max(0, 190 - feeReduction);
16
- const maxPossibleFee = internalPrice < 999999
17
- ? Math.floor(((999999 - internalPrice) * 10000) / internalPrice)
18
- : 0;
19
- return Math.max(90, Math.min(calculatedFee, maxPossibleFee));
13
+ return Math.floor(((990000 - internalPrice) * 1900) / price);
20
14
  }
21
15
  exports.calculateDynamicFeeBps = calculateDynamicFeeBps;
22
16
  /**
@@ -263,8 +263,8 @@ const getOppositeOrderDirection = (orderDirection) => {
263
263
  exports.getOppositeOrderDirection = getOppositeOrderDirection;
264
264
  const getOppositeOrderDirectionEncoded = (orderDirection) => {
265
265
  if (Object.keys(orderDirection)[0] === 'hype') {
266
- return { hype: {} };
266
+ return { flop: {} };
267
267
  }
268
- return { flop: {} };
268
+ return { hype: {} };
269
269
  };
270
270
  exports.getOppositeOrderDirectionEncoded = getOppositeOrderDirectionEncoded;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@triadxyz/triad-protocol",
3
- "version": "3.4.9-beta",
3
+ "version": "3.5.1-beta",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",