@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.
|
|
9
|
+
const internalPrice = price * Math.pow(10, 6);
|
|
10
10
|
if (internalPrice <= 900000) {
|
|
11
11
|
return 380;
|
|
12
12
|
}
|
|
13
|
-
|
|
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
|
/**
|
package/dist/utils/helpers.js
CHANGED
|
@@ -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 {
|
|
266
|
+
return { flop: {} };
|
|
267
267
|
}
|
|
268
|
-
return {
|
|
268
|
+
return { hype: {} };
|
|
269
269
|
};
|
|
270
270
|
exports.getOppositeOrderDirectionEncoded = getOppositeOrderDirectionEncoded;
|