@gearbox-protocol/sdk 14.12.0-next.66 → 14.12.0-next.67

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.
Files changed (225) hide show
  1. package/dist/cjs/common-utils/index.js +2 -2
  2. package/dist/cjs/common-utils/utils/apy/calculate-safe-borrow-rate.js +3 -3
  3. package/dist/cjs/common-utils/utils/assets-math.js +7 -7
  4. package/dist/cjs/common-utils/utils/creditAccount/calc-health-factor.js +2 -2
  5. package/dist/cjs/common-utils/utils/creditAccount/debt.js +2 -2
  6. package/dist/cjs/common-utils/utils/creditAccount/quota-utils.js +5 -5
  7. package/dist/cjs/common-utils/utils/index.js +2 -2
  8. package/dist/cjs/common-utils/utils/strategies/leverage/calculate-max-leverage-factor.js +2 -2
  9. package/dist/cjs/common-utils/utils/strategies/leverage/calculate-max-strategy-debt.js +5 -5
  10. package/dist/cjs/common-utils/utils/strategies/strategy-info/calculate-total-points.js +2 -2
  11. package/dist/cjs/common-utils/utils/strategies/strategy-info/get-cm-you-can-earn.js +2 -2
  12. package/dist/cjs/common-utils/utils/validation/validate-open-account-pool-status.js +4 -4
  13. package/dist/cjs/model/history.js +28 -0
  14. package/dist/cjs/model/history.schema.js +84 -0
  15. package/dist/cjs/model/index.js +64 -0
  16. package/dist/cjs/model/liquidations.js +23 -0
  17. package/dist/cjs/model/liquidations.schema.js +91 -0
  18. package/dist/cjs/model/opportunities.js +55 -0
  19. package/dist/cjs/model/opportunities.schema.js +220 -0
  20. package/dist/cjs/model/package.json +1 -0
  21. package/dist/cjs/model/positions.js +1 -0
  22. package/dist/cjs/model/primitives.js +1 -0
  23. package/dist/cjs/model/primitives.schema.js +85 -0
  24. package/dist/cjs/new-sdk/AbstractNamespace.js +158 -0
  25. package/dist/cjs/new-sdk/GearboxSDK.js +122 -0
  26. package/dist/cjs/new-sdk/index.js +11 -0
  27. package/dist/cjs/new-sdk/opportunities/OpportunitiesNamespace.js +122 -0
  28. package/dist/cjs/new-sdk/opportunities/index.js +4 -0
  29. package/dist/cjs/new-sdk/opportunities/types.js +1 -0
  30. package/dist/cjs/new-sdk/package.json +1 -0
  31. package/dist/cjs/new-sdk/types.js +22 -0
  32. package/dist/cjs/new-sdk/utils/history.js +1 -0
  33. package/dist/cjs/new-sdk/utils/index.js +2 -0
  34. package/dist/cjs/offchain/GearboxAPI.js +33 -0
  35. package/dist/cjs/offchain/index.js +8 -0
  36. package/dist/cjs/offchain/opportunities/OffchainOpportunities.js +97 -0
  37. package/dist/cjs/offchain/opportunities/index.js +4 -0
  38. package/dist/cjs/offchain/package.json +1 -0
  39. package/dist/cjs/offchain/types.js +1 -0
  40. package/dist/cjs/preview/preview/buildDelayedPreview.js +5 -5
  41. package/dist/cjs/rewards/rewards/api.js +2 -2
  42. package/dist/cjs/rewards/rewards/extra-apy.js +2 -2
  43. package/dist/cjs/sdk/MultichainSDK.js +18 -2
  44. package/dist/cjs/sdk/OnchainSDK.js +8 -1
  45. package/dist/cjs/sdk/accounts/index.js +2 -0
  46. package/dist/cjs/sdk/accounts/liquidations/LiquidationsService.js +150 -106
  47. package/dist/cjs/sdk/accounts/liquidations/MultichainLiquidationsService.js +32 -38
  48. package/dist/cjs/sdk/accounts/liquidations/constants.js +13 -0
  49. package/dist/cjs/sdk/accounts/liquidations/index.js +2 -0
  50. package/dist/cjs/sdk/base/MultichainConstruct.js +80 -0
  51. package/dist/cjs/sdk/base/TokensMeta.js +51 -0
  52. package/dist/cjs/sdk/base/index.js +2 -0
  53. package/dist/cjs/sdk/chain/chains.js +76 -0
  54. package/dist/cjs/sdk/chain/index.js +4 -0
  55. package/dist/cjs/sdk/core/errors.js +13 -0
  56. package/dist/cjs/sdk/core/index.js +2 -1
  57. package/dist/cjs/sdk/index.js +25 -1
  58. package/dist/cjs/sdk/market/MarketConfiguratorContract.js +14 -0
  59. package/dist/cjs/sdk/market/MarketSuite.js +163 -0
  60. package/dist/cjs/sdk/market/credit/CreditManagerV310Contract.js +26 -0
  61. package/dist/cjs/sdk/market/credit/CreditSuite.js +102 -0
  62. package/dist/cjs/sdk/market/math.js +104 -0
  63. package/dist/cjs/sdk/market/oracle/PriceOracleBaseContract.js +52 -0
  64. package/dist/cjs/sdk/market/pool/LinearInterestRateModelContract.js +30 -0
  65. package/dist/cjs/sdk/market/pool/PoolQuotaKeeperV310Contract.js +26 -0
  66. package/dist/cjs/sdk/market/pool/PoolSuite.js +28 -0
  67. package/dist/cjs/sdk/market/pool/PoolV310Contract.js +27 -0
  68. package/dist/cjs/sdk/market/pool/math.js +44 -0
  69. package/dist/cjs/sdk/market/pricefeeds/AbstractPriceFeed.js +17 -0
  70. package/dist/cjs/sdk/opportunities/MultichainOpportunitiesService.js +60 -0
  71. package/dist/cjs/sdk/opportunities/OpportunitiesService.js +103 -0
  72. package/dist/cjs/sdk/opportunities/index.js +12 -0
  73. package/dist/cjs/sdk/types/multichain.js +1 -0
  74. package/dist/cjs/{common-utils → sdk}/utils/bigint-math.js +11 -11
  75. package/dist/cjs/sdk/utils/index.js +3 -0
  76. package/dist/cjs/sdk/utils/zod.js +12 -0
  77. package/dist/esm/common-utils/index.js +1 -1
  78. package/dist/esm/common-utils/utils/apy/calculate-safe-borrow-rate.js +1 -1
  79. package/dist/esm/common-utils/utils/assets-math.js +1 -1
  80. package/dist/esm/common-utils/utils/creditAccount/calc-health-factor.js +1 -1
  81. package/dist/esm/common-utils/utils/creditAccount/debt.js +1 -1
  82. package/dist/esm/common-utils/utils/creditAccount/quota-utils.js +1 -1
  83. package/dist/esm/common-utils/utils/index.js +1 -1
  84. package/dist/esm/common-utils/utils/strategies/leverage/calculate-max-leverage-factor.js +1 -1
  85. package/dist/esm/common-utils/utils/strategies/leverage/calculate-max-strategy-debt.js +1 -1
  86. package/dist/esm/common-utils/utils/strategies/strategy-info/calculate-total-points.js +1 -1
  87. package/dist/esm/common-utils/utils/strategies/strategy-info/get-cm-you-can-earn.js +1 -1
  88. package/dist/esm/common-utils/utils/validation/validate-open-account-pool-status.js +1 -1
  89. package/dist/esm/model/history.js +26 -0
  90. package/dist/esm/model/history.schema.js +76 -0
  91. package/dist/esm/model/index.js +9 -0
  92. package/dist/esm/model/liquidations.js +22 -0
  93. package/dist/esm/model/liquidations.schema.js +83 -0
  94. package/dist/esm/model/opportunities.js +51 -0
  95. package/dist/esm/model/opportunities.schema.js +198 -0
  96. package/dist/esm/model/package.json +1 -0
  97. package/dist/esm/model/positions.js +1 -0
  98. package/dist/esm/model/primitives.js +1 -0
  99. package/dist/esm/model/primitives.schema.js +75 -0
  100. package/dist/esm/new-sdk/AbstractNamespace.js +157 -0
  101. package/dist/esm/new-sdk/GearboxSDK.js +121 -0
  102. package/dist/esm/new-sdk/index.js +7 -0
  103. package/dist/esm/new-sdk/opportunities/OpportunitiesNamespace.js +121 -0
  104. package/dist/esm/new-sdk/opportunities/index.js +3 -0
  105. package/dist/esm/new-sdk/opportunities/types.js +1 -0
  106. package/dist/esm/new-sdk/package.json +1 -0
  107. package/dist/esm/new-sdk/types.js +21 -0
  108. package/dist/esm/new-sdk/utils/history.js +1 -0
  109. package/dist/esm/new-sdk/utils/index.js +2 -0
  110. package/dist/esm/offchain/GearboxAPI.js +32 -0
  111. package/dist/esm/offchain/index.js +5 -0
  112. package/dist/esm/offchain/opportunities/OffchainOpportunities.js +95 -0
  113. package/dist/esm/offchain/opportunities/index.js +2 -0
  114. package/dist/esm/offchain/package.json +1 -0
  115. package/dist/esm/offchain/types.js +1 -0
  116. package/dist/esm/preview/preview/buildDelayedPreview.js +1 -1
  117. package/dist/esm/rewards/rewards/api.js +1 -1
  118. package/dist/esm/rewards/rewards/extra-apy.js +1 -1
  119. package/dist/esm/sdk/MultichainSDK.js +18 -2
  120. package/dist/esm/sdk/OnchainSDK.js +8 -1
  121. package/dist/esm/sdk/accounts/index.js +2 -2
  122. package/dist/esm/sdk/accounts/liquidations/LiquidationsService.js +152 -108
  123. package/dist/esm/sdk/accounts/liquidations/MultichainLiquidationsService.js +32 -38
  124. package/dist/esm/sdk/accounts/liquidations/constants.js +12 -1
  125. package/dist/esm/sdk/accounts/liquidations/index.js +2 -2
  126. package/dist/esm/sdk/base/MultichainConstruct.js +79 -0
  127. package/dist/esm/sdk/base/TokensMeta.js +51 -0
  128. package/dist/esm/sdk/base/index.js +2 -1
  129. package/dist/esm/sdk/chain/chains.js +74 -2
  130. package/dist/esm/sdk/chain/index.js +2 -2
  131. package/dist/esm/sdk/core/errors.js +13 -1
  132. package/dist/esm/sdk/core/index.js +2 -2
  133. package/dist/esm/sdk/index.js +11 -5
  134. package/dist/esm/sdk/market/MarketConfiguratorContract.js +14 -0
  135. package/dist/esm/sdk/market/MarketSuite.js +163 -0
  136. package/dist/esm/sdk/market/credit/CreditManagerV310Contract.js +26 -0
  137. package/dist/esm/sdk/market/credit/CreditSuite.js +102 -0
  138. package/dist/esm/sdk/market/math.js +98 -0
  139. package/dist/esm/sdk/market/oracle/PriceOracleBaseContract.js +52 -0
  140. package/dist/esm/sdk/market/pool/LinearInterestRateModelContract.js +30 -0
  141. package/dist/esm/sdk/market/pool/PoolQuotaKeeperV310Contract.js +26 -0
  142. package/dist/esm/sdk/market/pool/PoolSuite.js +28 -0
  143. package/dist/esm/sdk/market/pool/PoolV310Contract.js +27 -0
  144. package/dist/esm/sdk/market/pool/math.js +41 -0
  145. package/dist/esm/sdk/market/pricefeeds/AbstractPriceFeed.js +17 -0
  146. package/dist/esm/sdk/opportunities/MultichainOpportunitiesService.js +59 -0
  147. package/dist/esm/sdk/opportunities/OpportunitiesService.js +102 -0
  148. package/dist/esm/sdk/opportunities/index.js +4 -0
  149. package/dist/esm/sdk/types/multichain.js +1 -0
  150. package/dist/esm/{common-utils → sdk}/utils/bigint-math.js +11 -11
  151. package/dist/esm/sdk/utils/index.js +3 -2
  152. package/dist/esm/sdk/utils/zod.js +13 -2
  153. package/dist/types/common-utils/index.d.ts +1 -1
  154. package/dist/types/common-utils/utils/index.d.ts +1 -1
  155. package/dist/types/model/history.d.ts +105 -0
  156. package/dist/types/model/history.schema.d.ts +66 -0
  157. package/dist/types/model/index.d.ts +9 -0
  158. package/dist/types/model/liquidations.d.ts +230 -0
  159. package/dist/types/model/liquidations.schema.d.ts +292 -0
  160. package/dist/types/model/opportunities.d.ts +543 -0
  161. package/dist/types/model/opportunities.schema.d.ts +1066 -0
  162. package/dist/types/model/positions.d.ts +11 -0
  163. package/dist/types/model/primitives.d.ts +193 -0
  164. package/dist/types/model/primitives.schema.d.ts +81 -0
  165. package/dist/types/new-sdk/AbstractNamespace.d.ts +119 -0
  166. package/dist/types/new-sdk/GearboxSDK.d.ts +78 -0
  167. package/dist/types/new-sdk/index.d.ts +9 -0
  168. package/dist/types/new-sdk/opportunities/OpportunitiesNamespace.d.ts +69 -0
  169. package/dist/types/new-sdk/opportunities/index.d.ts +3 -0
  170. package/dist/types/new-sdk/opportunities/types.d.ts +66 -0
  171. package/dist/types/new-sdk/types.d.ts +149 -0
  172. package/dist/types/new-sdk/utils/history.d.ts +44 -0
  173. package/dist/types/new-sdk/utils/index.d.ts +2 -0
  174. package/dist/types/offchain/GearboxAPI.d.ts +31 -0
  175. package/dist/types/offchain/index.d.ts +5 -0
  176. package/dist/types/offchain/opportunities/OffchainOpportunities.d.ts +69 -0
  177. package/dist/types/offchain/opportunities/index.d.ts +2 -0
  178. package/dist/types/offchain/types.d.ts +50 -0
  179. package/dist/types/sdk/MultichainSDK.d.ts +15 -2
  180. package/dist/types/sdk/OnchainSDK.d.ts +9 -3
  181. package/dist/types/sdk/accounts/index.d.ts +3 -3
  182. package/dist/types/sdk/accounts/liquidations/LiquidationsService.d.ts +24 -16
  183. package/dist/types/sdk/accounts/liquidations/MultichainLiquidationsService.d.ts +26 -20
  184. package/dist/types/sdk/accounts/liquidations/constants.d.ts +12 -1
  185. package/dist/types/sdk/accounts/liquidations/index.d.ts +3 -3
  186. package/dist/types/sdk/accounts/liquidations/types.d.ts +34 -309
  187. package/dist/types/sdk/base/MultichainConstruct.d.ts +57 -0
  188. package/dist/types/sdk/base/TokensMeta.d.ts +26 -0
  189. package/dist/types/sdk/base/index.d.ts +2 -1
  190. package/dist/types/sdk/chain/chains.d.ts +68 -1
  191. package/dist/types/sdk/chain/index.d.ts +2 -2
  192. package/dist/types/sdk/core/errors.d.ts +10 -1
  193. package/dist/types/sdk/core/index.d.ts +2 -2
  194. package/dist/types/sdk/index.d.ts +15 -8
  195. package/dist/types/sdk/market/MarketConfiguratorContract.d.ts +9 -0
  196. package/dist/types/sdk/market/MarketSuite.d.ts +109 -1
  197. package/dist/types/sdk/market/credit/CreditManagerV310Contract.d.ts +14 -0
  198. package/dist/types/sdk/market/credit/CreditSuite.d.ts +47 -0
  199. package/dist/types/sdk/market/credit/types.d.ts +22 -0
  200. package/dist/types/sdk/market/index.d.ts +2 -2
  201. package/dist/types/sdk/market/math.d.ts +74 -0
  202. package/dist/types/sdk/market/oracle/PriceOracleBaseContract.d.ts +23 -0
  203. package/dist/types/sdk/market/oracle/types.d.ts +46 -0
  204. package/dist/types/sdk/market/pool/LinearInterestRateModelContract.d.ts +12 -0
  205. package/dist/types/sdk/market/pool/PoolQuotaKeeperV310Contract.d.ts +22 -1
  206. package/dist/types/sdk/market/pool/PoolSuite.d.ts +23 -0
  207. package/dist/types/sdk/market/pool/PoolV310Contract.d.ts +18 -0
  208. package/dist/types/sdk/market/pool/math.d.ts +57 -0
  209. package/dist/types/sdk/market/pool/types.d.ts +23 -0
  210. package/dist/types/sdk/market/pricefeeds/AbstractPriceFeed.d.ts +6 -0
  211. package/dist/types/sdk/market/pricefeeds/types.d.ts +10 -0
  212. package/dist/types/sdk/opportunities/MultichainOpportunitiesService.d.ts +40 -0
  213. package/dist/types/sdk/opportunities/OpportunitiesService.d.ts +47 -0
  214. package/dist/types/sdk/opportunities/index.d.ts +4 -0
  215. package/dist/types/sdk/types/index.d.ts +2 -1
  216. package/dist/types/sdk/types/multichain.d.ts +65 -0
  217. package/dist/types/sdk/types/state.d.ts +1 -1
  218. package/dist/types/sdk/types/transactions.d.ts +3 -0
  219. package/dist/types/{common-utils → sdk}/utils/bigint-math.d.ts +7 -11
  220. package/dist/types/sdk/utils/index.d.ts +3 -2
  221. package/dist/types/sdk/utils/zod.d.ts +6 -2
  222. package/package.json +16 -1
  223. package/dist/cjs/sdk/accounts/liquidations/helpers.js +0 -201
  224. package/dist/esm/sdk/accounts/liquidations/helpers.js +0 -192
  225. package/dist/types/sdk/accounts/liquidations/helpers.d.ts +0 -140
@@ -0,0 +1,98 @@
1
+ import { PERCENTAGE_FACTOR, PRICE_DECIMALS, RAY } from "../constants/math.js";
2
+ //#region src/sdk/market/math.ts
3
+ /**
4
+ * Conversions between the units the protocol stores and the basis points the
5
+ * read model exposes.
6
+ *
7
+ * These live here rather than inside the service so that the on-chain adapter,
8
+ * the merger and any future consumer of the read model share one definition of
9
+ * every derived value.
10
+ **/
11
+ const FULL = Number(PERCENTAGE_FACTOR);
12
+ /**
13
+ * Converts a ray-scaled rate (`10 ** 27` = 100%) to basis points, truncating
14
+ * towards zero.
15
+ *
16
+ * @example
17
+ * ```ts
18
+ * rayToBps(50_000_000_000_000_000_000_000_000n) // 500, i.e. 5%
19
+ * ```
20
+ **/
21
+ function rayToBps(ray) {
22
+ return Number(ray * PERCENTAGE_FACTOR / RAY);
23
+ }
24
+ /**
25
+ * Converts a USD value in the oracle's 8-decimal fixed point to a float.
26
+ *
27
+ * @example
28
+ * ```ts
29
+ * usdToNumber(150_050_000_000n) // 1500.5
30
+ * ```
31
+ **/
32
+ function usdToNumber(usd) {
33
+ return Number(usd) / Number(PRICE_DECIMALS);
34
+ }
35
+ /**
36
+ * Share of capital currently borrowed, in basis points. Returns `0` when there
37
+ * is nothing to borrow from, and never exceeds 100%.
38
+ *
39
+ * @example
40
+ * ```ts
41
+ * utilizationBps(750n, 1000n) // 7500, i.e. 75%
42
+ * ```
43
+ **/
44
+ function utilizationBps(borrowed, total) {
45
+ if (total <= 0n || borrowed <= 0n) return 0;
46
+ const utilization = Number(borrowed * PERCENTAGE_FACTOR / total);
47
+ return Math.min(utilization, FULL);
48
+ }
49
+ /**
50
+ * Annual cost of debt for a credit manager, in basis points: the pool's base
51
+ * rate plus the protocol's cut of the accrued interest.
52
+ *
53
+ * @param baseInterestRate - Pool base rate in ray.
54
+ * @param feeInterest - Credit manager interest fee in basis points.
55
+ *
56
+ * @example
57
+ * ```ts
58
+ * // 5% base rate, 50% interest fee
59
+ * borrowApyBps(50_000_000_000_000_000_000_000_000n, 5000) // 750, i.e. 7.5%
60
+ * ```
61
+ **/
62
+ function borrowApyBps(baseInterestRate, feeInterest) {
63
+ return rayToBps(baseInterestRate * (PERCENTAGE_FACTOR + BigInt(feeInterest)) / PERCENTAGE_FACTOR);
64
+ }
65
+ /**
66
+ * Highest leverage a liquidation threshold allows: `1 / (1 - lt)`.
67
+ *
68
+ * A threshold of 100% or more would allow unbounded leverage; such tokens are
69
+ * not strategies and are filtered out before this is called, so the guard here
70
+ * only exists to keep the function total.
71
+ *
72
+ * @example
73
+ * ```ts
74
+ * maxLeverage(9000) // 10
75
+ * maxLeverage(8000) // 5
76
+ * ```
77
+ **/
78
+ function maxLeverage(liquidationThreshold) {
79
+ const equity = FULL - liquidationThreshold;
80
+ return equity > 0 ? FULL / equity : Number.POSITIVE_INFINITY;
81
+ }
82
+ /**
83
+ * Annual quota cost scaled to the debt a maximally leveraged position carries,
84
+ * in basis points. Every unit of own capital carries `maxLeverage - 1` units of
85
+ * debt, and the quota is paid on the whole quoted position.
86
+ *
87
+ * @example
88
+ * ```ts
89
+ * // 2.5% quota rate at 5x leverage
90
+ * additionalBorrowApyBps(250, 5) // 1000, i.e. 10%
91
+ * ```
92
+ **/
93
+ function additionalBorrowApyBps(quotaRate, leverage) {
94
+ if (!Number.isFinite(leverage)) return 0;
95
+ return Math.round(quotaRate * Math.max(leverage - 1, 0));
96
+ }
97
+ //#endregion
98
+ export { additionalBorrowApyBps, borrowApyBps, maxLeverage, rayToBps, usdToNumber, utilizationBps };
@@ -6,6 +6,7 @@ import { formatBN } from "../../utils/formatter.js";
6
6
  import "../../utils/index.js";
7
7
  import { BaseContract } from "../../base/BaseContract.js";
8
8
  import "../../base/index.js";
9
+ import { usdToNumber } from "../math.js";
9
10
  import { PriceFeedRef } from "../pricefeeds/PriceFeedRef.js";
10
11
  import { priceFeedCompressorAbi } from "../../../abi/compressors/priceFeedCompressor.js";
11
12
  import "../pricefeeds/index.js";
@@ -103,6 +104,57 @@ var PriceOracleBaseContract = class extends BaseContract {
103
104
  return amount * 10n ** BigInt(this.tokensMeta.decimals(to)) / price;
104
105
  }
105
106
  /**
107
+ * {@inheritDoc IPriceOracleContract.safeUsdValue}
108
+ **/
109
+ safeUsdValue(token, amount) {
110
+ try {
111
+ return usdToNumber(this.convertToUSD(token, amount));
112
+ } catch (e) {
113
+ this.logger?.debug(`cannot price ${this.labelAddress(token)}: ${e}`);
114
+ return null;
115
+ }
116
+ }
117
+ /**
118
+ * {@inheritDoc IPriceOracleContract.toAmount}
119
+ **/
120
+ toAmount = (token, value) => {
121
+ return {
122
+ value,
123
+ valueUsd: this.safeUsdValue(token, value)
124
+ };
125
+ };
126
+ /**
127
+ * {@inheritDoc IPriceOracleContract.toTokenAmount}
128
+ **/
129
+ toTokenAmount = (token, value) => {
130
+ return {
131
+ token: this.tokensMeta.mustGetToken(token),
132
+ ...this.toAmount(token, value)
133
+ };
134
+ };
135
+ /**
136
+ * {@inheritDoc IPriceOracleContract.priceFeedData}
137
+ **/
138
+ priceFeedData(token) {
139
+ const ref = this.mainPriceFeeds.get(token);
140
+ if (!ref) throw new Error(`no main price feed for ${this.labelAddress(token)} in oracle ${this.labelAddress(this.address)}`);
141
+ return ref.priceFeed.describe();
142
+ }
143
+ /**
144
+ * {@inheritDoc IPriceOracleContract.priceFeedSummary}
145
+ **/
146
+ priceFeedSummary(underlying, collateral) {
147
+ const collateralUnit = 10n ** BigInt(this.tokensMeta.decimals(collateral));
148
+ const underlyingUnit = 10n ** BigInt(this.tokensMeta.decimals(underlying));
149
+ return {
150
+ underlyingPriceInUsd: usdToNumber(this.mainPrice(underlying)),
151
+ collateralPriceInUsd: usdToNumber(this.mainPrice(collateral)),
152
+ collateralPriceInUnderlying: Number(this.convert(collateral, underlying, collateralUnit)) / Number(underlyingUnit),
153
+ underlyingFeed: this.priceFeedData(underlying),
154
+ collateralFeed: this.priceFeedData(collateral)
155
+ };
156
+ }
157
+ /**
106
158
  * {@inheritDoc IPriceOracleContract.priceFeeds}
107
159
  **/
108
160
  get priceFeeds() {
@@ -3,6 +3,7 @@ import "../../utils/index.js";
3
3
  import { BaseContract } from "../../base/BaseContract.js";
4
4
  import "../../base/index.js";
5
5
  import { iLinearInterestRateModelV310Abi } from "../../../abi/310/iLinearInterestRateModelV310.js";
6
+ import { borrowRateAtUtilization, rateCurveUtilizations, supplyRateAtUtilization } from "./math.js";
6
7
  import { decodeAbiParameters } from "viem";
7
8
  //#region src/sdk/market/pool/LinearInterestRateModelContract.ts
8
9
  const abi = iLinearInterestRateModelV310Abi;
@@ -58,6 +59,35 @@ var LinearInterestRateModelContract = class extends BaseContract {
58
59
  this.Rslope3 = Rslope3;
59
60
  this.isBorrowingMoreU2Forbidden = isBorrowingMoreU2Forbidden;
60
61
  }
62
+ /**
63
+ * The model's own parameters, gathered for the rate math.
64
+ */
65
+ get params() {
66
+ return {
67
+ U1: this.U1,
68
+ U2: this.U2,
69
+ Rbase: this.Rbase,
70
+ Rslope1: this.Rslope1,
71
+ Rslope2: this.Rslope2,
72
+ Rslope3: this.Rslope3,
73
+ isBorrowingMoreU2Forbidden: this.isBorrowingMoreU2Forbidden
74
+ };
75
+ }
76
+ /**
77
+ * The model evaluated into chart-ready points, so that no consumer has to
78
+ * reimplement it.
79
+ */
80
+ rateCurve() {
81
+ const { params } = this;
82
+ return {
83
+ points: rateCurveUtilizations(params).map((utilization) => ({
84
+ utilization,
85
+ supplyApy: supplyRateAtUtilization(utilization, params),
86
+ borrowApy: borrowRateAtUtilization(utilization, params)
87
+ })),
88
+ borrowingLimitUtilization: params.isBorrowingMoreU2Forbidden ? params.U2 : null
89
+ };
90
+ }
61
91
  stateHuman(raw) {
62
92
  return {
63
93
  ...super.stateHuman(raw),
@@ -20,6 +20,32 @@ var PoolQuotaKeeperV310Contract = class extends BaseContract {
20
20
  return [q.token, q];
21
21
  }), "quotas");
22
22
  }
23
+ /**
24
+ * Whether the market still accepts quota for a token: a token whose quota is
25
+ * inactive or whose limit is exhausted can no longer back a new position.
26
+ *
27
+ * @param token - Token address.
28
+ */
29
+ hasActiveQuota(token) {
30
+ const quota = this.quotas.get(token);
31
+ return !!quota?.isActive && quota.limit > 0n;
32
+ }
33
+ /**
34
+ * Every token the market still accepts quota for, see
35
+ * {@link hasActiveQuota}.
36
+ */
37
+ get activeQuotaTokens() {
38
+ return this.quotas.keys().filter((token) => this.hasActiveQuota(token));
39
+ }
40
+ /**
41
+ * Annual quota rate paid on a quoted token, in basis points, or `0` when the
42
+ * market does not quote it.
43
+ *
44
+ * @param token - Quoted token address.
45
+ */
46
+ quotaRate(token) {
47
+ return this.quotas.get(token)?.rate ?? 0;
48
+ }
23
49
  stateHuman(raw = true) {
24
50
  return {
25
51
  ...super.stateHuman(raw),
@@ -99,6 +99,34 @@ var PoolSuite = class extends SDKConstruct {
99
99
  return this.pool.underlying;
100
100
  }
101
101
  /**
102
+ * {@inheritDoc IPoolContract.unwrappedUnderlying}
103
+ */
104
+ get unwrappedUnderlying() {
105
+ return this.pool.unwrappedUnderlying;
106
+ }
107
+ /**
108
+ * {@inheritDoc IPoolContract.utilization}
109
+ */
110
+ get utilization() {
111
+ return this.pool.utilization;
112
+ }
113
+ /**
114
+ * Whether the pool is paused, which blocks borrowing across every connected
115
+ * credit suite.
116
+ */
117
+ get isPaused() {
118
+ return this.pool.isPaused;
119
+ }
120
+ /**
121
+ * Interest rate curve of the pool's rate model.
122
+ *
123
+ * @throws If the market uses an interest-rate model that is not linear, and
124
+ * therefore has no curve the SDK can evaluate.
125
+ */
126
+ get rateCurve() {
127
+ return this.linearModel.rateCurve();
128
+ }
129
+ /**
102
130
  * RWA factory associated with the pool's underlying, undefined for non-RWA markets.
103
131
  */
104
132
  get rwaFactory() {
@@ -1,10 +1,13 @@
1
1
  import { iPausableAbi } from "../../../abi/iPausable.js";
2
2
  import { iPoolV310Abi } from "../../../abi/310/generated.js";
3
3
  import { AddressMap } from "../../utils/AddressMap.js";
4
+ import { RAY } from "../../constants/math.js";
5
+ import "../../constants/index.js";
4
6
  import { formatBN, formatBNvalue, percentFmt } from "../../utils/formatter.js";
5
7
  import "../../utils/index.js";
6
8
  import { BaseContract } from "../../base/BaseContract.js";
7
9
  import "../../base/index.js";
10
+ import { utilizationBps } from "../math.js";
8
11
  //#region src/sdk/market/pool/PoolV310Contract.ts
9
12
  const abi = [...iPoolV310Abi, ...iPausableAbi];
10
13
  var PoolV310Contract = class extends BaseContract {
@@ -31,6 +34,30 @@ var PoolV310Contract = class extends BaseContract {
31
34
  const meta = this.#sdk.tokensMeta.mustGet(this.underlying);
32
35
  if (this.#sdk.tokensMeta.isRWAUnderlying(meta)) return this.#sdk.mustGetContract(meta.rwaFactory);
33
36
  }
37
+ /**
38
+ * {@inheritDoc IPoolContract.borrowed}
39
+ */
40
+ get borrowed() {
41
+ return this.expectedLiquidity > this.availableLiquidity ? this.expectedLiquidity - this.availableLiquidity : 0n;
42
+ }
43
+ /**
44
+ * {@inheritDoc IPoolContract.totalAssets}
45
+ */
46
+ get totalAssets() {
47
+ return this.totalSupply * this.dieselRate / RAY;
48
+ }
49
+ /**
50
+ * {@inheritDoc IPoolContract.utilization}
51
+ */
52
+ get utilization() {
53
+ return utilizationBps(this.borrowed, this.expectedLiquidity);
54
+ }
55
+ /**
56
+ * {@inheritDoc IPoolContract.unwrappedUnderlying}
57
+ */
58
+ get unwrappedUnderlying() {
59
+ return this.tokensMeta.unwrapRWA(this.underlying);
60
+ }
34
61
  stateHuman(raw = true) {
35
62
  return {
36
63
  ...super.stateHuman(raw),
@@ -0,0 +1,41 @@
1
+ import { PERCENTAGE_FACTOR } from "../../constants/math.js";
2
+ //#region src/sdk/market/pool/math.ts
3
+ const FULL = Number(PERCENTAGE_FACTOR);
4
+ /**
5
+ * Base rate borrowers pay at a given utilization, in basis points, following
6
+ * the linear interest rate model's three segments.
7
+ *
8
+ * The result excludes the per-credit-manager interest fee: the model belongs to
9
+ * the pool, and every credit manager of a market can charge a different one.
10
+ **/
11
+ function borrowRateAtUtilization(utilization, params) {
12
+ const { U1, U2, Rbase, Rslope1, Rslope2, Rslope3 } = params;
13
+ const u = Math.min(Math.max(utilization, 0), FULL);
14
+ if (u <= 0) return Rbase;
15
+ if (u <= U1) return Math.round(Rbase + Rslope1 * u / U1);
16
+ if (u <= U2) return Math.round(Rbase + Rslope1 + Rslope2 * (u - U1) / Math.max(U2 - U1, 1));
17
+ return Math.round(Rbase + Rslope1 + Rslope2 + Rslope3 * (u - U2) / Math.max(FULL - U2, 1));
18
+ }
19
+ /**
20
+ * Rate depositors earn at a given utilization, in basis points: the interest
21
+ * borrowers pay, spread over the pool's whole liquidity.
22
+ **/
23
+ function supplyRateAtUtilization(utilization, params) {
24
+ const u = Math.min(Math.max(utilization, 0), FULL);
25
+ return Math.round(borrowRateAtUtilization(u, params) * u / FULL);
26
+ }
27
+ /**
28
+ * Utilizations the rate curve is sampled at: a fixed grid plus both kinks of
29
+ * the model, so the borrow leg is exact and the supply leg — which is
30
+ * quadratic between kinks — is smooth.
31
+ **/
32
+ function rateCurveUtilizations(params) {
33
+ const step = FULL / 20;
34
+ const grid = /* @__PURE__ */ new Set();
35
+ for (let u = 0; u <= FULL; u += step) grid.add(u);
36
+ grid.add(params.U1);
37
+ grid.add(params.U2);
38
+ return [...grid].filter((u) => u >= 0 && u <= FULL).sort((a, b) => a - b);
39
+ }
40
+ //#endregion
41
+ export { borrowRateAtUtilization, rateCurveUtilizations, supplyRateAtUtilization };
@@ -88,6 +88,23 @@ var AbstractPriceFeedContract = class extends BaseContract {
88
88
  const underlying = this.underlyingPriceFeeds.flatMap((f) => f.priceFeed.updatableDependencies());
89
89
  return isUpdatablePriceFeed(this) ? [this, ...underlying] : underlying;
90
90
  }
91
+ /**
92
+ * {@inheritDoc IPriceFeedContract.describe}
93
+ */
94
+ describe() {
95
+ let dependencies = [];
96
+ try {
97
+ dependencies = this.underlyingPriceFeeds.map((ref) => ref.priceFeed.describe());
98
+ } catch {
99
+ dependencies = [];
100
+ }
101
+ return {
102
+ name: this.name,
103
+ type: this.contractType,
104
+ feedAddress: this.address,
105
+ dependencies
106
+ };
107
+ }
91
108
  };
92
109
  //#endregion
93
110
  export { AbstractPriceFeedContract, PartialPriceFeedInitError };
@@ -0,0 +1,59 @@
1
+ import { getNetworkType } from "../chain/chains.js";
2
+ import { MultichainConstruct } from "../base/MultichainConstruct.js";
3
+ import "../base/index.js";
4
+ //#region src/sdk/opportunities/MultichainOpportunitiesService.ts
5
+ /**
6
+ * Cross-chain counterpart of {@link OpportunitiesService}.
7
+ *
8
+ * Fans out over every chain configured in {@link MultichainSDK}. A chain that
9
+ * fails is logged and skipped so one dead RPC does not empty the list; its
10
+ * failure is reported in {@link MultichainResult.meta}.
11
+ *
12
+ * Detail reads need no fan-out: an opportunity key names its chain.
13
+ *
14
+ * @typeParam Plugins - Map of attached plugin types.
15
+ **/
16
+ var MultichainOpportunitiesService = class extends MultichainConstruct {
17
+ /**
18
+ * Opportunities of all queried chains, see {@link OpportunitiesService.list}.
19
+ *
20
+ * A filter that names chains narrows the fan-out itself, so chains whose rows
21
+ * would be discarded are never queried and never appear in the meta.
22
+ **/
23
+ async list(filter) {
24
+ return this.queryChains({
25
+ networks: this.#networksOf(filter),
26
+ label: "list opportunities",
27
+ run: (sdk) => sdk.opportunities.list(filter)
28
+ });
29
+ }
30
+ /**
31
+ * {@inheritDoc OpportunitiesService.getPool}
32
+ **/
33
+ async getPool(key) {
34
+ return this.sdk.chain(key.chainId).opportunities.getPool(key);
35
+ }
36
+ /**
37
+ * {@inheritDoc OpportunitiesService.getStrategy}
38
+ **/
39
+ async getStrategy(key) {
40
+ return this.sdk.chain(key.chainId).opportunities.getStrategy(key);
41
+ }
42
+ /**
43
+ * Chains named by the filter, or `undefined` to query all of them. Chain ids
44
+ * the SDK does not support are dropped here rather than reported as failures:
45
+ * a filter naming them is a narrowing, not a request.
46
+ **/
47
+ #networksOf(filter) {
48
+ if (!filter?.chainIds) return;
49
+ const networks = [];
50
+ for (const chainId of filter.chainIds) try {
51
+ networks.push(getNetworkType(chainId));
52
+ } catch {
53
+ this.sdk.logger?.debug(`ignoring unsupported chain ${chainId} in opportunities filter`);
54
+ }
55
+ return networks;
56
+ }
57
+ };
58
+ //#endregion
59
+ export { MultichainOpportunitiesService };
@@ -0,0 +1,102 @@
1
+ import { SDKConstruct } from "../base/SDKConstruct.js";
2
+ import "../base/index.js";
3
+ import { usdToNumber } from "../market/math.js";
4
+ //#region src/sdk/opportunities/OpportunitiesService.ts
5
+ /**
6
+ * A lookup that knows of no strategy, used when a filter rules strategies out
7
+ * and the credit-account query is skipped altogether.
8
+ **/
9
+ const NO_TOTALS = () => void 0;
10
+ /**
11
+ * Builds the `opportunities` read model from the chain.
12
+ *
13
+ * Everything except the credit-account totals comes from the market state the
14
+ * SDK already holds, so a list costs one RPC round-trip at most. Yield figures
15
+ * that fold in incentives, points or history are deliberately absent: they are
16
+ * the backend's job, and this service never guesses them.
17
+ *
18
+ * The rows themselves are assembled by the market wrappers — see
19
+ * {@link MarketSuite.opportunities} — because every value in them is market
20
+ * state. What is left here is the one thing no single market can answer: how
21
+ * much the credit accounts of a strategy are worth.
22
+ **/
23
+ var OpportunitiesService = class extends SDKConstruct {
24
+ /**
25
+ * Every pool and strategy of every loaded market on this chain.
26
+ *
27
+ * Strategies are measured by the value locked in their credit accounts, so
28
+ * the list issues one credit-account query unless the filter rules strategies
29
+ * out entirely.
30
+ *
31
+ * @param filter - Optional narrowing, applied to the built rows.
32
+ **/
33
+ async list(filter) {
34
+ if (filter?.chainIds && !filter.chainIds.includes(this.chainId)) return [];
35
+ const { markets } = this.sdk.marketRegister;
36
+ const totals = filter?.kind === "pool" ? NO_TOTALS : await this.#strategyTotals(markets);
37
+ return markets.flatMap((market) => market.opportunities(totals, filter));
38
+ }
39
+ /**
40
+ * A single pool opportunity plus its interest rate curve and quotas.
41
+ *
42
+ * @throws If no loaded market has this pool.
43
+ **/
44
+ async getPool(key) {
45
+ return this.sdk.marketRegister.findByPool(key.pool).poolOpportunityDetail();
46
+ }
47
+ /**
48
+ * A single strategy opportunity plus the rate curve of the pool it borrows
49
+ * from and the price feeds its liquidation price depends on.
50
+ *
51
+ * @throws If the credit manager is unknown, or does not accept the requested
52
+ * collateral as a strategy.
53
+ **/
54
+ async getStrategy(key) {
55
+ const market = this.sdk.marketRegister.findByCreditManager(key.creditManager);
56
+ const { suite } = market.mustFindStrategy(key.creditManager, key.targetCollateral);
57
+ const totals = await this.#strategyTotals([market]);
58
+ return suite.strategyOpportunityDetail(key.targetCollateral, totals(key.creditManager, key.targetCollateral));
59
+ }
60
+ /**
61
+ * Total value held by the credit accounts backing every strategy of the given
62
+ * markets.
63
+ *
64
+ * An account that holds several strategy collaterals counts in full towards
65
+ * each of them: the read model reports what a strategy's accounts are worth,
66
+ * not how that worth splits across the collaterals inside them.
67
+ **/
68
+ async #strategyTotals(markets) {
69
+ const wanted = /* @__PURE__ */ new Map();
70
+ for (const market of markets) for (const { suite, collateral } of market.strategies) {
71
+ const cm = suite.creditManager.address.toLowerCase();
72
+ const tokens = wanted.get(cm) ?? /* @__PURE__ */ new Set();
73
+ tokens.add(collateral.toLowerCase());
74
+ wanted.set(cm, tokens);
75
+ }
76
+ if (wanted.size === 0) return NO_TOTALS;
77
+ const accounts = await this.sdk.accounts.getCreditAccounts({ includeZeroDebt: true });
78
+ const totals = /* @__PURE__ */ new Map();
79
+ for (const account of accounts) {
80
+ const tokens = wanted.get(account.creditManager.toLowerCase());
81
+ if (!tokens) continue;
82
+ for (const token of account.tokens) {
83
+ if (token.balance <= 0n || !tokens.has(token.token.toLowerCase())) continue;
84
+ const key = strategyKey(account.creditManager, token.token);
85
+ const current = totals.get(key);
86
+ totals.set(key, {
87
+ value: (current?.value ?? 0n) + account.totalValue,
88
+ valueUsd: (current?.valueUsd ?? 0) + usdToNumber(account.totalValueUSD)
89
+ });
90
+ }
91
+ }
92
+ return (creditManager, collateral) => totals.get(strategyKey(creditManager, collateral));
93
+ }
94
+ };
95
+ /**
96
+ * Both halves of a strategy key folded into one map key.
97
+ **/
98
+ function strategyKey(creditManager, collateral) {
99
+ return `${creditManager.toLowerCase()}:${collateral.toLowerCase()}`;
100
+ }
101
+ //#endregion
102
+ export { OpportunitiesService };
@@ -0,0 +1,4 @@
1
+ import { additionalBorrowApyBps, borrowApyBps, maxLeverage, rayToBps, usdToNumber, utilizationBps } from "../market/math.js";
2
+ import { MultichainOpportunitiesService } from "./MultichainOpportunitiesService.js";
3
+ import { OpportunitiesService } from "./OpportunitiesService.js";
4
+ export { MultichainOpportunitiesService, OpportunitiesService, additionalBorrowApyBps, borrowApyBps, maxLeverage, rayToBps, usdToNumber, utilizationBps };
@@ -0,0 +1 @@
1
+ export {};
@@ -1,4 +1,4 @@
1
- //#region src/common-utils/utils/bigint-math.ts
1
+ //#region src/sdk/utils/bigint-math.ts
2
2
  /**
3
3
  * Utility namespace for common `bigint` operations.
4
4
  *
@@ -16,20 +16,20 @@ var BigIntMath = class {
16
16
  static abs = (x) => x < 0n ? -x : x;
17
17
  /**
18
18
  * Returns the greater of two bigint values.
19
- *
20
- * @param a First candidate value.
21
- * @param b Second candidate value.
22
- * @returns The larger value between `a` and `b`.
19
+ * @param values - The values to find the maximum of.
20
+ * @returns The maximum value.
23
21
  */
24
- static max = (a, b) => a > b ? a : b;
22
+ static max = (...values) => {
23
+ return values.reduce((max, v) => v > max ? v : max);
24
+ };
25
25
  /**
26
26
  * Returns the smaller of two bigint values.
27
- *
28
- * @param a First candidate value.
29
- * @param b Second candidate value.
30
- * @returns The smaller value between `a` and `b`.
27
+ * @param values - The values to find the minimum of.
28
+ * @returns The minimum value.
31
29
  */
32
- static min = (a, b) => a < b ? a : b;
30
+ static min = (...values) => {
31
+ return values.reduce((min, v) => v < min ? v : min);
32
+ };
33
33
  /**
34
34
  * Returns the negative form of a bigint if it is currently positive.
35
35
  *
@@ -3,6 +3,7 @@ import { AddressSet } from "./AddressSet.js";
3
3
  import { AssetsMap } from "./AssetsMap.js";
4
4
  import { json_parse, json_stringify } from "./json.js";
5
5
  import { functionArgsToMap, functionArgsToRecord, getFunctionSignature } from "./abi-decode.js";
6
+ import { BigIntMath } from "./bigint-math.js";
6
7
  import { bytes32ToString } from "./bytes32ToString.js";
7
8
  import { childLogger } from "./childLogger.js";
8
9
  import { createRawTx } from "./createRawTx.js";
@@ -15,5 +16,5 @@ import { hexEq } from "./hex.js";
15
16
  import { retry } from "./retry.js";
16
17
  import { toAddress } from "./toAddress.js";
17
18
  import "./type-utils.js";
18
- import { ZodAddress } from "./zod.js";
19
- export { AddressMap, AddressSet, AssetsMap, TypedObjectUtils, ZodAddress, bytes32ToString, childLogger, createRawTx, etherscanApiUrl, etherscanUrl, filterDust, filterDustUSD, fmtBinaryMask, formatBN, formatBNvalue, formatDuration, formatLeverage, formatNumberToString_, formatPercentage, formatTimestamp, functionArgsToMap, functionArgsToRecord, getFunctionSignature, hexEq, isDust, json_parse, json_stringify, numberWithCommas, percentFmt, rayToNumber, retry, shortAddress, shortHash, toAddress, toBN, toBigInt, toSignificant };
19
+ import { ZodAddress, ZodHex } from "./zod.js";
20
+ export { AddressMap, AddressSet, AssetsMap, BigIntMath, TypedObjectUtils, ZodAddress, ZodHex, bytes32ToString, childLogger, createRawTx, etherscanApiUrl, etherscanUrl, filterDust, filterDustUSD, fmtBinaryMask, formatBN, formatBNvalue, formatDuration, formatLeverage, formatNumberToString_, formatPercentage, formatTimestamp, functionArgsToMap, functionArgsToRecord, getFunctionSignature, hexEq, isDust, json_parse, json_stringify, numberWithCommas, percentFmt, rayToNumber, retry, shortAddress, shortHash, toAddress, toBN, toBigInt, toSignificant };
@@ -1,4 +1,4 @@
1
- import { getAddress, isAddress } from "viem";
1
+ import { getAddress, isAddress, isHex } from "viem";
2
2
  import { z } from "zod/v4";
3
3
  //#region src/sdk/utils/zod.ts
4
4
  /**
@@ -12,5 +12,16 @@ const ZodAddress = () => z.string().transform((val, ctx) => {
12
12
  });
13
13
  return getAddress(val);
14
14
  });
15
+ /**
16
+ * A `0x`-prefixed hex string, as viem's Hex.
17
+ */
18
+ const ZodHex = () => z.string().transform((val, ctx) => {
19
+ if (!isHex(val)) ctx.issues.push({
20
+ code: "custom",
21
+ message: `invalid hex string ${val}`,
22
+ input: ctx.value
23
+ });
24
+ return val;
25
+ });
15
26
  //#endregion
16
- export { ZodAddress };
27
+ export { ZodAddress, ZodHex };
@@ -1,3 +1,4 @@
1
+ import { BigIntMath } from "../sdk/utils/bigint-math.js";
1
2
  import { AxiosCache } from "./axios-cache/AxiosCache.js";
2
3
  import "./axios-cache/index.js";
3
4
  import { BigNumberish, ChartsCreditManagerPayload } from "./charts/credit-manager-payload.js";
@@ -43,7 +44,6 @@ import { getSafeBaseBorrowRate } from "./utils/apy/get-safe-base-borrow-rate.js"
43
44
  import { CalcQuotaBorrowRateProps, calcQuotaBorrowRate } from "./utils/creditAccount/calc-quota-borrow-rate.js";
44
45
  import { GetSingleQuotaBorrowRateRate, getSingleQuotaBorrowRate } from "./utils/apy/get-single-quota-borrow-rate.js";
45
46
  import { maxAPYFormula } from "./utils/apy/max-apy-formula.js";
46
- import { BigIntMath } from "./utils/bigint-math.js";
47
47
  import { EMPTY_ADDRESS, EMPTY_ARRAY, EMPTY_OBJECT } from "./utils/constants.js";
48
48
  import { CalcHealthFactorProps, calcHealthFactor } from "./utils/creditAccount/calc-health-factor.js";
49
49
  import { CalcOverallAPYProps, calcOverallAPY } from "./utils/creditAccount/calc-overall-apy.js";
@@ -1,3 +1,4 @@
1
+ import { BigIntMath } from "../../sdk/utils/bigint-math.js";
1
2
  import { AssetUtils, AssetWithAmountInTarget, AssetWithView, WrapResult } from "./assets-math.js";
2
3
  import { BONUS_APY_FROM_POINTS } from "./apy/bonus-apy-from-points.js";
3
4
  import { AppChains } from "./strategies/types/chains.js";
@@ -28,7 +29,6 @@ import { CalcQuotaBorrowRateProps, calcQuotaBorrowRate } from "./creditAccount/c
28
29
  import { GetSingleQuotaBorrowRateRate, getSingleQuotaBorrowRate } from "./apy/get-single-quota-borrow-rate.js";
29
30
  import { maxAPYFormula } from "./apy/max-apy-formula.js";
30
31
  import "./apy/index.js";
31
- import { BigIntMath } from "./bigint-math.js";
32
32
  import { EMPTY_ADDRESS, EMPTY_ARRAY, EMPTY_OBJECT } from "./constants.js";
33
33
  import { CalcHealthFactorProps, calcHealthFactor } from "./creditAccount/calc-health-factor.js";
34
34
  import { CalcOverallAPYProps, calcOverallAPY } from "./creditAccount/calc-overall-apy.js";