@defisaver/positions-sdk 2.1.80 → 2.1.82

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.
@@ -114,9 +114,6 @@ const formatReserveAsset = (reserveAsset, hubAsset, reserveId, oracleDecimals, n
114
114
  const totalDebtRaw = (_d = reserveAsset.totalDebt) !== null && _d !== void 0 ? _d : 0;
115
115
  const supplyCapRaw = (_e = reserveAsset.supplyCap) !== null && _e !== void 0 ? _e : 0;
116
116
  const borrowCapRaw = (_f = reserveAsset.borrowCap) !== null && _f !== void 0 ? _f : 0;
117
- const totalSuppliedDec = (0, utils_1.isMaxUint)(totalSuppliedRaw.toString()) ? new decimal_js_1.default(0) : new decimal_js_1.default(totalSuppliedRaw.toString());
118
- const totalDrawnDec = (0, utils_1.isMaxUint)(totalDrawnRaw.toString()) ? new decimal_js_1.default(0) : new decimal_js_1.default(totalDrawnRaw.toString());
119
- const utilization = totalSuppliedDec.isZero() ? '0' : totalDrawnDec.times(100).div(totalSuppliedDec).toString();
120
117
  /** @DEV Hub related calculations */
121
118
  const drawnRate = new decimal_js_1.default(hubAsset.drawnRate.toString()).div(new decimal_js_1.default(10).pow(27));
122
119
  const borrowApr = drawnRate.mul(100);
@@ -130,6 +127,7 @@ const formatReserveAsset = (reserveAsset, hubAsset, reserveId, oracleDecimals, n
130
127
  const totalPremiumShares = new decimal_js_1.default(hubAsset.totalPremiumShares.toString());
131
128
  const premiumMultiplier = totalDrawnShares.isZero() ? new decimal_js_1.default(1) : totalDrawnShares.add(totalPremiumShares).div(totalDrawnShares);
132
129
  const supplyApr = borrowApr.mul(hubUtilization).mul(premiumMultiplier).mul(new decimal_js_1.default(1).minus(liquidityFee));
130
+ const utilization = hubUtilization.times(100).toString();
133
131
  return ({
134
132
  symbol,
135
133
  underlying: reserveAsset.underlying,
@@ -71,9 +71,6 @@ const formatReserveAsset = (reserveAsset, hubAsset, reserveId, oracleDecimals, n
71
71
  const totalDebtRaw = (_d = reserveAsset.totalDebt) !== null && _d !== void 0 ? _d : 0;
72
72
  const supplyCapRaw = (_e = reserveAsset.supplyCap) !== null && _e !== void 0 ? _e : 0;
73
73
  const borrowCapRaw = (_f = reserveAsset.borrowCap) !== null && _f !== void 0 ? _f : 0;
74
- const totalSuppliedDec = isMaxUint(totalSuppliedRaw.toString()) ? new Dec(0) : new Dec(totalSuppliedRaw.toString());
75
- const totalDrawnDec = isMaxUint(totalDrawnRaw.toString()) ? new Dec(0) : new Dec(totalDrawnRaw.toString());
76
- const utilization = totalSuppliedDec.isZero() ? '0' : totalDrawnDec.times(100).div(totalSuppliedDec).toString();
77
74
  /** @DEV Hub related calculations */
78
75
  const drawnRate = new Dec(hubAsset.drawnRate.toString()).div(new Dec(10).pow(27));
79
76
  const borrowApr = drawnRate.mul(100);
@@ -87,6 +84,7 @@ const formatReserveAsset = (reserveAsset, hubAsset, reserveId, oracleDecimals, n
87
84
  const totalPremiumShares = new Dec(hubAsset.totalPremiumShares.toString());
88
85
  const premiumMultiplier = totalDrawnShares.isZero() ? new Dec(1) : totalDrawnShares.add(totalPremiumShares).div(totalDrawnShares);
89
86
  const supplyApr = borrowApr.mul(hubUtilization).mul(premiumMultiplier).mul(new Dec(1).minus(liquidityFee));
87
+ const utilization = hubUtilization.times(100).toString();
90
88
  return ({
91
89
  symbol,
92
90
  underlying: reserveAsset.underlying,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defisaver/positions-sdk",
3
- "version": "2.1.80",
3
+ "version": "2.1.82",
4
4
  "description": "",
5
5
  "main": "./cjs/index.js",
6
6
  "module": "./esm/index.js",
@@ -83,9 +83,6 @@ const formatReserveAsset = async (reserveAsset: AaveV4ReserveAssetOnChain, hubAs
83
83
  const totalDebtRaw = reserveAsset.totalDebt ?? 0;
84
84
  const supplyCapRaw = reserveAsset.supplyCap ?? 0;
85
85
  const borrowCapRaw = reserveAsset.borrowCap ?? 0;
86
- const totalSuppliedDec = isMaxUint(totalSuppliedRaw.toString()) ? new Dec(0) : new Dec(totalSuppliedRaw.toString());
87
- const totalDrawnDec = isMaxUint(totalDrawnRaw.toString()) ? new Dec(0) : new Dec(totalDrawnRaw.toString());
88
- const utilization = totalSuppliedDec.isZero() ? '0' : totalDrawnDec.times(100).div(totalSuppliedDec).toString();
89
86
 
90
87
  /** @DEV Hub related calculations */
91
88
  const drawnRate = new Dec(hubAsset.drawnRate.toString()).div(new Dec(10).pow(27));
@@ -100,6 +97,7 @@ const formatReserveAsset = async (reserveAsset: AaveV4ReserveAssetOnChain, hubAs
100
97
  const totalPremiumShares = new Dec(hubAsset.totalPremiumShares.toString());
101
98
  const premiumMultiplier = totalDrawnShares.isZero() ? new Dec(1) : totalDrawnShares.add(totalPremiumShares).div(totalDrawnShares);
102
99
  const supplyApr = borrowApr.mul(hubUtilization).mul(premiumMultiplier).mul(new Dec(1).minus(liquidityFee));
100
+ const utilization = hubUtilization.times(100).toString();
103
101
 
104
102
  return ({
105
103
  symbol,