@triadxyz/triad-protocol 3.5.0-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
|
/**
|