@haven-fi/solauto-sdk 1.0.91 → 1.0.93
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/dist/utils/numberUtils.js +3 -3
- package/package.json +1 -1
- package/src/utils/numberUtils.ts +20 -20
@@ -70,9 +70,9 @@ function getDebtAdjustmentUsd(liqThresholdBps, supplyUsd, debtUsd, targetLiqUtil
|
|
70
70
|
function getSolautoFeesBps(isReferred, feeType, positionNetWorthUsd) {
|
71
71
|
const minSize = 10000; // Minimum position size
|
72
72
|
const maxSize = 1000000; // Maximum position size
|
73
|
-
const maxFeeBps =
|
74
|
-
const minFeeBps =
|
75
|
-
const k = 0.
|
73
|
+
const maxFeeBps = 500; // Fee in basis points for minSize (5%)
|
74
|
+
const minFeeBps = 10; // Fee in basis points for maxSize (0.1%)
|
75
|
+
const k = 0.55;
|
76
76
|
let feeBps = 0;
|
77
77
|
if (feeType === generated_1.FeeType.Small) {
|
78
78
|
feeBps = minFeeBps;
|
package/package.json
CHANGED
package/src/utils/numberUtils.ts
CHANGED
@@ -96,26 +96,26 @@ export function getSolautoFeesBps(
|
|
96
96
|
referrer: number;
|
97
97
|
total: number;
|
98
98
|
} {
|
99
|
-
const minSize =
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
99
|
+
const minSize = 10_000; // Minimum position size
|
100
|
+
const maxSize = 1_000_000; // Maximum position size
|
101
|
+
const maxFeeBps = 500; // Fee in basis points for minSize (5%)
|
102
|
+
const minFeeBps = 10; // Fee in basis points for maxSize (0.1%)
|
103
|
+
const k = 0.55;
|
104
|
+
|
105
|
+
let feeBps: number = 0;
|
106
|
+
|
107
|
+
if (feeType === FeeType.Small) {
|
108
|
+
feeBps = minFeeBps;
|
109
|
+
} else if (positionNetWorthUsd <= minSize) {
|
110
|
+
feeBps = maxFeeBps;
|
111
|
+
} else if (positionNetWorthUsd >= maxSize) {
|
112
|
+
feeBps = minFeeBps;
|
113
|
+
} else {
|
114
|
+
const t =
|
115
|
+
(Math.log(positionNetWorthUsd) - Math.log(minSize)) /
|
116
|
+
(Math.log(maxSize) - Math.log(minSize));
|
117
|
+
feeBps = Math.round(minFeeBps + (maxFeeBps - minFeeBps) * (1 - Math.pow(t, k)));
|
118
|
+
}
|
119
119
|
|
120
120
|
let referrer = 0;
|
121
121
|
if (isReferred) {
|