@haven-fi/solauto-sdk 1.0.89 → 1.0.92

Sign up to get free protection for your applications and to get access to all the features.
@@ -1 +1 @@
1
- {"version":3,"file":"numberUtils.d.ts","sourceRoot":"","sources":["../../src/utils/numberUtils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,wBAAgB,uBAAuB,CACrC,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,eAAe,EAAE,MAAM,GACtB,MAAM,CAMR;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAElE;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEpE;AAED,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE7C;AAED,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE3C;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,CAqBrD;AAED,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,UAAU,GAAG,MAAM,CAejE;AAED,wBAAgB,oBAAoB,CAClC,eAAe,EAAE,MAAM,EACvB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,2BAA2B,EAAE,MAAM,EACnC,gBAAgB,CAAC,EAAE,MAAM,UAW1B;AAED,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,OAAO,EACnB,OAAO,EAAE,OAAO,EAChB,mBAAmB,EAAE,MAAM,GAC1B;IACD,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;CACf,CA8BA;AAED,wBAAgB,2BAA2B,CACzC,SAAS,EAAE,MAAM,EACjB,eAAe,EAAE,MAAM,EACvB,gBAAgB,EAAE,MAAM,GACvB,MAAM,CAER;AAED,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AE,MAAM,CAAC;CACf,CAgCA;AAED,wBAAgB,2BAA2B,CACzC,SAAS,EAAE,MAAM,EACjB,eAAe,EAAE,MAAM,EACvB,gBAAgB,EAAE,MAAM,GACvB,MAAM,CAER;AAED,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,UAKzE;AAED,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,UAKvE;AAED,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,UAKvE"}
@@ -69,12 +69,13 @@ function getDebtAdjustmentUsd(liqThresholdBps, supplyUsd, debtUsd, targetLiqUtil
69
69
  }
70
70
  function getSolautoFeesBps(isReferred, feeType, positionNetWorthUsd) {
71
71
  const minSize = 10000; // Minimum position size
72
- const maxSize = 1000000; // Maximum position size
73
- const maxFeeBps = 100; // Fee in basis points for minSize (1%)
74
- const minFeeBps = 10; // Fee in basis points for maxSize (0.1%)
72
+ const maxSize = 500000; // Maximum position size
73
+ const maxFeeBps = 500; // Fee in basis points for minSize (5%)
74
+ const minFeeBps = 50; // Fee in basis points for maxSize (0.5%)
75
+ const k = 0.55;
75
76
  let feeBps = 0;
76
77
  if (feeType === generated_1.FeeType.Small) {
77
- feeBps = 100;
78
+ feeBps = minFeeBps;
78
79
  }
79
80
  else if (positionNetWorthUsd <= minSize) {
80
81
  feeBps = maxFeeBps;
@@ -85,7 +86,7 @@ function getSolautoFeesBps(isReferred, feeType, positionNetWorthUsd) {
85
86
  else {
86
87
  const t = (Math.log(positionNetWorthUsd) - Math.log(minSize)) /
87
88
  (Math.log(maxSize) - Math.log(minSize));
88
- feeBps = Math.round(minFeeBps + (maxFeeBps - minFeeBps) * (1 - t));
89
+ feeBps = Math.round(minFeeBps + (maxFeeBps - minFeeBps) * (1 - Math.pow(t, k)));
89
90
  }
90
91
  let referrer = 0;
91
92
  if (isReferred) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haven-fi/solauto-sdk",
3
- "version": "1.0.89",
3
+ "version": "1.0.92",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "description": "Typescript SDK for the Solauto program on the Solana blockchain",
@@ -96,14 +96,16 @@ export function getSolautoFeesBps(
96
96
  referrer: number;
97
97
  total: number;
98
98
  } {
99
- const minSize = 10000; // Minimum position size
100
- const maxSize = 1000000; // Maximum position size
101
- const maxFeeBps = 100; // Fee in basis points for minSize (1%)
102
- const minFeeBps = 10; // Fee in basis points for maxSize (0.1%)
99
+ const minSize = 10_000; // Minimum position size
100
+ const maxSize = 500_000; // Maximum position size
101
+ const maxFeeBps = 500; // Fee in basis points for minSize (5%)
102
+ const minFeeBps = 50; // Fee in basis points for maxSize (0.5%)
103
+ const k = 0.55;
103
104
 
104
105
  let feeBps: number = 0;
106
+
105
107
  if (feeType === FeeType.Small) {
106
- feeBps = 100;
108
+ feeBps = minFeeBps;
107
109
  } else if (positionNetWorthUsd <= minSize) {
108
110
  feeBps = maxFeeBps;
109
111
  } else if (positionNetWorthUsd >= maxSize) {
@@ -112,7 +114,7 @@ export function getSolautoFeesBps(
112
114
  const t =
113
115
  (Math.log(positionNetWorthUsd) - Math.log(minSize)) /
114
116
  (Math.log(maxSize) - Math.log(minSize));
115
- feeBps = Math.round(minFeeBps + (maxFeeBps - minFeeBps) * (1 - t));
117
+ feeBps = Math.round(minFeeBps + (maxFeeBps - minFeeBps) * (1 - Math.pow(t, k)));
116
118
  }
117
119
 
118
120
  let referrer = 0;