@gearbox-protocol/sdk 3.0.0-next.217 → 3.0.0-next.218
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/lib/core/pool.js +6 -4
- package/package.json +1 -1
package/lib/core/pool.js
CHANGED
|
@@ -137,10 +137,12 @@ class PoolData {
|
|
|
137
137
|
return "universal";
|
|
138
138
|
}
|
|
139
139
|
static calculateUtilization(expected, available) {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
140
|
+
if (expected === 0n)
|
|
141
|
+
return 0;
|
|
142
|
+
const borrowed = expected - available;
|
|
143
|
+
const u = Number((borrowed * sdk_gov_1.PERCENTAGE_FACTOR) / expected) /
|
|
144
|
+
Number(sdk_gov_1.PERCENTAGE_DECIMALS);
|
|
145
|
+
return Math.max(0, u);
|
|
144
146
|
}
|
|
145
147
|
}
|
|
146
148
|
exports.PoolData = PoolData;
|