@gearbox-protocol/sdk 17.0.0-next.3 → 17.0.0

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 (370) hide show
  1. package/dist/cjs/dev/abi.js +14 -15
  2. package/dist/cjs/dev/claimFromFaucet.js +4 -8
  3. package/dist/cjs/dev/createAnvilClient.js +35 -17
  4. package/dist/cjs/dev/index.js +7 -2
  5. package/dist/cjs/dev/kycUtils.js +66 -58
  6. package/dist/cjs/dev/midasUtils.js +113 -16
  7. package/dist/cjs/dev/securitizeUtils.js +82 -42
  8. package/dist/cjs/dev/withdrawalUtils.js +3 -6
  9. package/dist/cjs/model/errors/index.js +2 -0
  10. package/dist/cjs/model/errors/operation-errors.js +19 -1
  11. package/dist/cjs/model/index.js +4 -2
  12. package/dist/cjs/model/rwa.js +4 -4
  13. package/dist/cjs/model/rwa.schema.js +4 -4
  14. package/dist/cjs/offchain/opportunities/OffchainOpportunities.js +1 -1
  15. package/dist/cjs/onchain/OnchainSDK.js +3 -3
  16. package/dist/cjs/onchain/accounts/CreditAccountsServiceV310.js +2 -17
  17. package/dist/cjs/onchain/accounts/intents/borrow.js +140 -0
  18. package/dist/cjs/onchain/accounts/intents/collateral-valuation.js +41 -0
  19. package/dist/cjs/onchain/accounts/intents/guards.js +19 -7
  20. package/dist/cjs/onchain/accounts/intents/index.js +107 -20
  21. package/dist/cjs/onchain/accounts/intents/leverage-band.js +2 -12
  22. package/dist/cjs/onchain/accounts/intents/maxBorrow.js +89 -0
  23. package/dist/cjs/onchain/accounts/intents/maxWithdrawCollateral.js +15 -41
  24. package/dist/cjs/onchain/accounts/intents/open-strategy.js +8 -46
  25. package/dist/cjs/onchain/accounts/intents/operations.js +0 -1
  26. package/dist/cjs/onchain/accounts/intents/realize.js +61 -4
  27. package/dist/cjs/onchain/accounts/intents/tail.js +1 -1
  28. package/dist/cjs/onchain/accounts/intents/testing/sdk-mock.js +1 -0
  29. package/dist/cjs/onchain/accounts/intents/utils/common.js +19 -0
  30. package/dist/cjs/onchain/accounts/intents/utils/credit-account-slice.js +21 -0
  31. package/dist/cjs/onchain/accounts/intents/utils/index.js +2 -0
  32. package/dist/cjs/onchain/accounts/intents/utils/price-impact.js +12 -9
  33. package/dist/cjs/onchain/accounts/intents/utils/router-path.js +4 -5
  34. package/dist/cjs/onchain/accounts/intents/withdraw-limits.js +97 -0
  35. package/dist/cjs/onchain/accounts/liquidations/LiquidationsService.js +1 -1
  36. package/dist/cjs/onchain/constants/address-provider.js +0 -2
  37. package/dist/cjs/onchain/constants/index.js +0 -1
  38. package/dist/cjs/onchain/core/createAddressProvider.js +2 -5
  39. package/dist/cjs/onchain/index.js +60 -43
  40. package/dist/cjs/onchain/market/adapters/abi/conctructorAbi.js +2 -2
  41. package/dist/cjs/onchain/market/adapters/contracts/AbstractAdapter.js +6 -0
  42. package/dist/cjs/onchain/market/adapters/contracts/MidasGatewayAdapterContract.js +49 -5
  43. package/dist/cjs/onchain/market/credit/CreditSuite.js +33 -12
  44. package/dist/cjs/onchain/market/index.js +50 -38
  45. package/dist/cjs/onchain/market/oracle/PriceOracleBaseContract.js +3 -3
  46. package/dist/cjs/onchain/market/pricefeeds/AbstractPriceFeed.js +0 -5
  47. package/dist/cjs/onchain/market/pricefeeds/PriceFeedRegistry.js +127 -0
  48. package/dist/cjs/onchain/market/pricefeeds/{BalancerStablePriceFeed.js → feeds/BalancerStablePriceFeed.js} +4 -4
  49. package/dist/cjs/onchain/market/pricefeeds/{BalancerWeightedPriceFeed.js → feeds/BalancerWeightedPriceFeed.js} +4 -4
  50. package/dist/cjs/onchain/market/pricefeeds/{BoundedPriceFeed.js → feeds/BoundedPriceFeed.js} +4 -4
  51. package/dist/cjs/onchain/market/pricefeeds/{CompositePriceFeed.js → feeds/CompositePriceFeed.js} +4 -4
  52. package/dist/cjs/onchain/market/pricefeeds/{ConstantPriceFeed.js → feeds/ConstantPriceFeed.js} +3 -3
  53. package/dist/cjs/onchain/market/pricefeeds/{CurveCryptoPriceFeed.js → feeds/CurveCryptoPriceFeed.js} +4 -4
  54. package/dist/cjs/onchain/market/pricefeeds/{CurveStablePriceFeed.js → feeds/CurveStablePriceFeed.js} +4 -4
  55. package/dist/cjs/onchain/market/pricefeeds/{CurveUSDPriceFeed.js → feeds/CurveUSDPriceFeed.js} +4 -4
  56. package/dist/cjs/onchain/market/pricefeeds/{Erc4626PriceFeed.js → feeds/Erc4626PriceFeed.js} +4 -4
  57. package/dist/cjs/onchain/market/pricefeeds/{ExternalPriceFeed.js → feeds/ExternalPriceFeed.js} +4 -4
  58. package/dist/cjs/onchain/market/pricefeeds/{MellowLRTPriceFeed.js → feeds/MellowLRTPriceFeed.js} +4 -4
  59. package/dist/cjs/onchain/market/pricefeeds/{PendleTWAPPTPriceFeed.js → feeds/PendleTWAPPTPriceFeed.js} +4 -4
  60. package/dist/cjs/onchain/market/pricefeeds/{PythPriceFeed.js → feeds/PythPriceFeed.js} +3 -3
  61. package/dist/cjs/onchain/market/pricefeeds/{RedstonePriceFeed.js → feeds/RedstonePriceFeed.js} +6 -6
  62. package/dist/cjs/onchain/market/pricefeeds/{WstETHPriceFeed.js → feeds/WstETHPriceFeed.js} +4 -4
  63. package/dist/cjs/onchain/market/pricefeeds/{YearnPriceFeed.js → feeds/YearnPriceFeed.js} +4 -4
  64. package/dist/cjs/onchain/market/pricefeeds/{ZeroPriceFeed.js → feeds/ZeroPriceFeed.js} +4 -4
  65. package/dist/cjs/onchain/market/pricefeeds/feeds/index.js +35 -0
  66. package/dist/cjs/onchain/market/pricefeeds/index.js +51 -39
  67. package/dist/cjs/onchain/market/pricefeeds/updates/UpdatablePriceFeedRegistry.js +189 -0
  68. package/dist/cjs/onchain/market/pricefeeds/{getRawPriceUpdates.js → updates/getRawPriceUpdates.js} +2 -2
  69. package/dist/cjs/onchain/market/pricefeeds/updates/index.js +8 -0
  70. package/dist/cjs/onchain/market/pricefeeds/{isUpdatablePriceFeed.js → updates/isUpdatablePriceFeed.js} +1 -1
  71. package/dist/cjs/onchain/market/pricefeeds/updates/updatableDependencies.js +14 -0
  72. package/dist/cjs/onchain/market/rwa/RWARegistry.js +4 -7
  73. package/dist/cjs/onchain/market/rwa/index.js +1 -0
  74. package/dist/cjs/onchain/market/rwa/midas/MidasDegenNFT.js +45 -5
  75. package/dist/cjs/onchain/market/rwa/securitize/SecuritizeDegenNFT.js +56 -12
  76. package/dist/cjs/onchain/market/rwa/securitize/SecuritizeRWAFactory.js +0 -37
  77. package/dist/cjs/onchain/opportunities/MultichainOpportunitiesService.js +8 -2
  78. package/dist/cjs/onchain/opportunities/OpportunitiesService.js +16 -4
  79. package/dist/cjs/onchain/positions/calcHealthFactor.js +3 -3
  80. package/dist/cjs/onchain/preview/index.js +2 -0
  81. package/dist/cjs/onchain/preview/parse/parseRWAFactoryOperationCalldata.js +2 -2
  82. package/dist/cjs/onchain/preview/preview/index.js +2 -0
  83. package/dist/cjs/onchain/preview/preview/midasGreenlistsAccount.js +17 -0
  84. package/dist/cjs/onchain/preview/preview/previewOpenStrategyPosition.js +13 -16
  85. package/dist/cjs/onchain/preview/preview/previewOperation.js +19 -11
  86. package/dist/cjs/onchain/preview/preview/replayMulticall.js +4 -3
  87. package/dist/cjs/onchain/validation/bundles/checkCollateralFunding.js +3 -3
  88. package/dist/cjs/onchain/validation/bundles/checkCreditOperation.js +12 -10
  89. package/dist/cjs/onchain/validation/bundles/checkIncreaseDebt.js +28 -0
  90. package/dist/cjs/onchain/validation/bundles/{checkQuotasAsked.js → checkIncreaseQuota.js} +3 -3
  91. package/dist/cjs/onchain/validation/bundles/checkMidasAccountGreenlist.js +44 -0
  92. package/dist/cjs/onchain/validation/bundles/checkRWAOpenRequirements.js +9 -9
  93. package/dist/cjs/onchain/validation/bundles/checkRWAOpening.js +18 -8
  94. package/dist/cjs/onchain/validation/bundles/index.js +6 -4
  95. package/dist/cjs/onchain/validation/checkOperation.js +0 -1
  96. package/dist/cjs/onchain/validation/checkSimulation.js +1 -1
  97. package/dist/cjs/onchain/validation/checks/checkBorrowLimit.js +1 -1
  98. package/dist/cjs/onchain/validation/checks/checkDebtLimits.js +2 -5
  99. package/dist/cjs/onchain/validation/checks/checkPoolLiquidity.js +1 -1
  100. package/dist/cjs/onchain/validation/checks/checkReservePriceLimited.js +30 -0
  101. package/dist/cjs/onchain/validation/checks/index.js +2 -0
  102. package/dist/cjs/onchain/validation/index.js +8 -4
  103. package/dist/cjs/permissionless/utils/price-update/get-price-update-tx.js +2 -2
  104. package/dist/cjs/permissionless/utils/price-update/get-updatable-feeds.js +2 -2
  105. package/dist/cjs/sdk/execute/ExecuteApi.js +67 -7
  106. package/dist/cjs/sdk/opportunities/OpportunitiesNamespace.js +9 -3
  107. package/dist/cjs/sdk/prepare/PrepareApi.js +89 -14
  108. package/dist/esm/dev/abi.js +14 -15
  109. package/dist/esm/dev/claimFromFaucet.js +4 -8
  110. package/dist/esm/dev/createAnvilClient.js +36 -19
  111. package/dist/esm/dev/index.js +4 -4
  112. package/dist/esm/dev/kycUtils.js +66 -59
  113. package/dist/esm/dev/midasUtils.js +112 -18
  114. package/dist/esm/dev/securitizeUtils.js +84 -44
  115. package/dist/esm/dev/withdrawalUtils.js +3 -6
  116. package/dist/esm/model/errors/index.js +2 -2
  117. package/dist/esm/model/errors/operation-errors.js +18 -2
  118. package/dist/esm/model/index.js +4 -4
  119. package/dist/esm/model/rwa.js +4 -4
  120. package/dist/esm/model/rwa.schema.js +5 -5
  121. package/dist/esm/offchain/opportunities/OffchainOpportunities.js +1 -1
  122. package/dist/esm/onchain/OnchainSDK.js +3 -3
  123. package/dist/esm/onchain/accounts/CreditAccountsServiceV310.js +2 -17
  124. package/dist/esm/onchain/accounts/intents/borrow.js +138 -0
  125. package/dist/esm/onchain/accounts/intents/collateral-valuation.js +40 -0
  126. package/dist/esm/onchain/accounts/intents/guards.js +19 -7
  127. package/dist/esm/onchain/accounts/intents/index.js +107 -20
  128. package/dist/esm/onchain/accounts/intents/leverage-band.js +2 -12
  129. package/dist/esm/onchain/accounts/intents/maxBorrow.js +87 -0
  130. package/dist/esm/onchain/accounts/intents/maxWithdrawCollateral.js +15 -41
  131. package/dist/esm/onchain/accounts/intents/open-strategy.js +8 -46
  132. package/dist/esm/onchain/accounts/intents/operations.js +0 -1
  133. package/dist/esm/onchain/accounts/intents/realize.js +61 -4
  134. package/dist/esm/onchain/accounts/intents/tail.js +1 -1
  135. package/dist/esm/onchain/accounts/intents/testing/sdk-mock.js +1 -0
  136. package/dist/esm/onchain/accounts/intents/utils/common.js +19 -1
  137. package/dist/esm/onchain/accounts/intents/utils/credit-account-slice.js +21 -1
  138. package/dist/esm/onchain/accounts/intents/utils/index.js +3 -3
  139. package/dist/esm/onchain/accounts/intents/utils/price-impact.js +12 -9
  140. package/dist/esm/onchain/accounts/intents/utils/router-path.js +4 -5
  141. package/dist/esm/onchain/accounts/intents/withdraw-limits.js +95 -0
  142. package/dist/esm/onchain/accounts/liquidations/LiquidationsService.js +1 -1
  143. package/dist/esm/onchain/constants/address-provider.js +1 -2
  144. package/dist/esm/onchain/constants/index.js +2 -2
  145. package/dist/esm/onchain/core/createAddressProvider.js +2 -5
  146. package/dist/esm/onchain/index.js +32 -24
  147. package/dist/esm/onchain/market/adapters/abi/conctructorAbi.js +2 -2
  148. package/dist/esm/onchain/market/adapters/contracts/AbstractAdapter.js +6 -0
  149. package/dist/esm/onchain/market/adapters/contracts/MidasGatewayAdapterContract.js +50 -6
  150. package/dist/esm/onchain/market/credit/CreditSuite.js +33 -12
  151. package/dist/esm/onchain/market/index.js +26 -21
  152. package/dist/esm/onchain/market/oracle/PriceOracleBaseContract.js +1 -1
  153. package/dist/esm/onchain/market/pricefeeds/AbstractPriceFeed.js +0 -5
  154. package/dist/esm/onchain/market/pricefeeds/PriceFeedRegistry.js +126 -0
  155. package/dist/esm/onchain/market/pricefeeds/{BalancerStablePriceFeed.js → feeds/BalancerStablePriceFeed.js} +4 -4
  156. package/dist/esm/onchain/market/pricefeeds/{BalancerWeightedPriceFeed.js → feeds/BalancerWeightedPriceFeed.js} +4 -4
  157. package/dist/esm/onchain/market/pricefeeds/{BoundedPriceFeed.js → feeds/BoundedPriceFeed.js} +4 -4
  158. package/dist/esm/onchain/market/pricefeeds/{CompositePriceFeed.js → feeds/CompositePriceFeed.js} +4 -4
  159. package/dist/esm/onchain/market/pricefeeds/{ConstantPriceFeed.js → feeds/ConstantPriceFeed.js} +3 -3
  160. package/dist/esm/onchain/market/pricefeeds/{CurveCryptoPriceFeed.js → feeds/CurveCryptoPriceFeed.js} +4 -4
  161. package/dist/esm/onchain/market/pricefeeds/{CurveStablePriceFeed.js → feeds/CurveStablePriceFeed.js} +4 -4
  162. package/dist/esm/onchain/market/pricefeeds/{CurveUSDPriceFeed.js → feeds/CurveUSDPriceFeed.js} +4 -4
  163. package/dist/esm/onchain/market/pricefeeds/{Erc4626PriceFeed.js → feeds/Erc4626PriceFeed.js} +4 -4
  164. package/dist/esm/onchain/market/pricefeeds/{ExternalPriceFeed.js → feeds/ExternalPriceFeed.js} +4 -4
  165. package/dist/esm/onchain/market/pricefeeds/{MellowLRTPriceFeed.js → feeds/MellowLRTPriceFeed.js} +4 -4
  166. package/dist/esm/onchain/market/pricefeeds/{PendleTWAPPTPriceFeed.js → feeds/PendleTWAPPTPriceFeed.js} +4 -4
  167. package/dist/esm/onchain/market/pricefeeds/{PythPriceFeed.js → feeds/PythPriceFeed.js} +3 -3
  168. package/dist/esm/onchain/market/pricefeeds/{RedstonePriceFeed.js → feeds/RedstonePriceFeed.js} +6 -6
  169. package/dist/esm/onchain/market/pricefeeds/{WstETHPriceFeed.js → feeds/WstETHPriceFeed.js} +4 -4
  170. package/dist/esm/onchain/market/pricefeeds/{YearnPriceFeed.js → feeds/YearnPriceFeed.js} +4 -4
  171. package/dist/esm/onchain/market/pricefeeds/{ZeroPriceFeed.js → feeds/ZeroPriceFeed.js} +4 -4
  172. package/dist/esm/onchain/market/pricefeeds/feeds/index.js +18 -0
  173. package/dist/esm/onchain/market/pricefeeds/index.js +27 -21
  174. package/dist/esm/onchain/market/pricefeeds/updates/UpdatablePriceFeedRegistry.js +188 -0
  175. package/dist/esm/onchain/market/pricefeeds/{getRawPriceUpdates.js → updates/getRawPriceUpdates.js} +2 -2
  176. package/dist/esm/onchain/market/pricefeeds/updates/index.js +5 -1
  177. package/dist/esm/onchain/market/pricefeeds/{isUpdatablePriceFeed.js → updates/isUpdatablePriceFeed.js} +1 -1
  178. package/dist/esm/onchain/market/pricefeeds/updates/updatableDependencies.js +13 -0
  179. package/dist/esm/onchain/market/rwa/RWARegistry.js +4 -8
  180. package/dist/esm/onchain/market/rwa/index.js +2 -2
  181. package/dist/esm/onchain/market/rwa/midas/MidasDegenNFT.js +45 -5
  182. package/dist/esm/onchain/market/rwa/securitize/SecuritizeDegenNFT.js +55 -10
  183. package/dist/esm/onchain/market/rwa/securitize/SecuritizeRWAFactory.js +0 -37
  184. package/dist/esm/onchain/opportunities/MultichainOpportunitiesService.js +8 -2
  185. package/dist/esm/onchain/opportunities/OpportunitiesService.js +16 -4
  186. package/dist/esm/onchain/positions/calcHealthFactor.js +3 -3
  187. package/dist/esm/onchain/preview/index.js +2 -1
  188. package/dist/esm/onchain/preview/parse/parseRWAFactoryOperationCalldata.js +2 -2
  189. package/dist/esm/onchain/preview/preview/index.js +2 -1
  190. package/dist/esm/onchain/preview/preview/midasGreenlistsAccount.js +16 -0
  191. package/dist/esm/onchain/preview/preview/previewOpenStrategyPosition.js +14 -17
  192. package/dist/esm/onchain/preview/preview/previewOperation.js +19 -11
  193. package/dist/esm/onchain/preview/preview/replayMulticall.js +4 -3
  194. package/dist/esm/onchain/validation/bundles/checkCollateralFunding.js +3 -3
  195. package/dist/esm/onchain/validation/bundles/checkCreditOperation.js +12 -10
  196. package/dist/esm/onchain/validation/bundles/checkIncreaseDebt.js +27 -0
  197. package/dist/esm/onchain/validation/bundles/{checkQuotasAsked.js → checkIncreaseQuota.js} +3 -3
  198. package/dist/esm/onchain/validation/bundles/checkMidasAccountGreenlist.js +43 -0
  199. package/dist/esm/onchain/validation/bundles/checkRWAOpenRequirements.js +9 -9
  200. package/dist/esm/onchain/validation/bundles/checkRWAOpening.js +18 -8
  201. package/dist/esm/onchain/validation/bundles/index.js +4 -3
  202. package/dist/esm/onchain/validation/checkOperation.js +0 -1
  203. package/dist/esm/onchain/validation/checkSimulation.js +1 -1
  204. package/dist/esm/onchain/validation/checks/checkBorrowLimit.js +1 -1
  205. package/dist/esm/onchain/validation/checks/checkDebtLimits.js +2 -5
  206. package/dist/esm/onchain/validation/checks/checkPoolLiquidity.js +1 -1
  207. package/dist/esm/onchain/validation/checks/checkReservePriceLimited.js +29 -0
  208. package/dist/esm/onchain/validation/checks/index.js +2 -1
  209. package/dist/esm/onchain/validation/index.js +5 -3
  210. package/dist/esm/permissionless/utils/price-update/get-price-update-tx.js +1 -1
  211. package/dist/esm/permissionless/utils/price-update/get-updatable-feeds.js +1 -1
  212. package/dist/esm/sdk/execute/ExecuteApi.js +67 -7
  213. package/dist/esm/sdk/opportunities/OpportunitiesNamespace.js +9 -3
  214. package/dist/esm/sdk/prepare/PrepareApi.js +94 -19
  215. package/dist/types/dev/abi.d.ts +13 -15
  216. package/dist/types/dev/claimFromFaucet.d.ts +0 -1
  217. package/dist/types/dev/createAnvilClient.d.ts +10 -3
  218. package/dist/types/dev/index.d.ts +4 -4
  219. package/dist/types/dev/kycUtils.d.ts +15 -24
  220. package/dist/types/dev/midasUtils.d.ts +35 -4
  221. package/dist/types/dev/securitizeUtils.d.ts +3 -9
  222. package/dist/types/model/errors/index.d.ts +2 -2
  223. package/dist/types/model/errors/operation-errors.d.ts +65 -11
  224. package/dist/types/model/index.d.ts +5 -5
  225. package/dist/types/model/opportunities.d.ts +6 -7
  226. package/dist/types/model/previews.d.ts +25 -19
  227. package/dist/types/model/rwa.d.ts +47 -27
  228. package/dist/types/model/rwa.schema.d.ts +3 -3
  229. package/dist/types/offchain/opportunities/OffchainOpportunities.d.ts +1 -2
  230. package/dist/types/offchain/opportunities/types.d.ts +1 -4
  231. package/dist/types/onchain/OnchainSDK.d.ts +2 -2
  232. package/dist/types/onchain/accounts/index.d.ts +5 -4
  233. package/dist/types/onchain/accounts/intents/borrow.d.ts +141 -0
  234. package/dist/types/onchain/accounts/intents/collateral-valuation.d.ts +42 -0
  235. package/dist/types/onchain/accounts/intents/guards.d.ts +18 -2
  236. package/dist/types/onchain/accounts/intents/index.d.ts +103 -15
  237. package/dist/types/onchain/accounts/intents/maxBorrow.d.ts +54 -0
  238. package/dist/types/onchain/accounts/intents/maxWithdrawCollateral.d.ts +3 -8
  239. package/dist/types/onchain/accounts/intents/open-strategy.d.ts +3 -17
  240. package/dist/types/onchain/accounts/intents/testing/sdk-mock.d.ts +2 -0
  241. package/dist/types/onchain/accounts/intents/tests/open-strategy.fixtures.d.ts +2 -2
  242. package/dist/types/onchain/accounts/intents/types.d.ts +51 -6
  243. package/dist/types/onchain/accounts/intents/utils/common.d.ts +15 -1
  244. package/dist/types/onchain/accounts/intents/utils/credit-account-slice.d.ts +14 -1
  245. package/dist/types/onchain/accounts/intents/utils/index.d.ts +3 -3
  246. package/dist/types/onchain/accounts/intents/utils/price-impact.d.ts +4 -1
  247. package/dist/types/onchain/accounts/intents/utils/router-path.d.ts +2 -5
  248. package/dist/types/onchain/accounts/intents/withdraw-limits.d.ts +80 -0
  249. package/dist/types/onchain/accounts/types.d.ts +4 -2
  250. package/dist/types/onchain/constants/address-provider.d.ts +1 -2
  251. package/dist/types/onchain/constants/index.d.ts +2 -2
  252. package/dist/types/onchain/index.d.ts +40 -31
  253. package/dist/types/onchain/market/adapters/contracts/AbstractAdapter.d.ts +6 -0
  254. package/dist/types/onchain/market/adapters/contracts/MidasGatewayAdapterContract.d.ts +20 -4
  255. package/dist/types/onchain/market/adapters/types.d.ts +8 -0
  256. package/dist/types/onchain/market/credit/CreditSuite.d.ts +13 -3
  257. package/dist/types/onchain/market/credit/types.d.ts +2 -2
  258. package/dist/types/onchain/market/index.d.ts +29 -24
  259. package/dist/types/onchain/market/oracle/PriceOracleBaseContract.d.ts +2 -1
  260. package/dist/types/onchain/market/oracle/types.d.ts +2 -1
  261. package/dist/types/onchain/market/pool/types.d.ts +1 -1
  262. package/dist/types/onchain/market/pricefeeds/AbstractPriceFeed.d.ts +1 -2
  263. package/dist/types/onchain/market/pricefeeds/PriceFeedRegistry.d.ts +60 -0
  264. package/dist/types/onchain/market/pricefeeds/feeds/BalancerStablePriceFeed.d.ts +12 -0
  265. package/dist/types/onchain/market/pricefeeds/{BalancerWeightedPriceFeed.d.ts → feeds/BalancerWeightedPriceFeed.d.ts} +7 -7
  266. package/dist/types/onchain/market/pricefeeds/feeds/BoundedPriceFeed.d.ts +15 -0
  267. package/dist/types/onchain/market/pricefeeds/{CompositePriceFeed.d.ts → feeds/CompositePriceFeed.d.ts} +6 -6
  268. package/dist/types/onchain/market/pricefeeds/{ConstantPriceFeed.d.ts → feeds/ConstantPriceFeed.d.ts} +6 -6
  269. package/dist/types/onchain/market/pricefeeds/feeds/CurveCryptoPriceFeed.d.ts +12 -0
  270. package/dist/types/onchain/market/pricefeeds/feeds/CurveStablePriceFeed.d.ts +12 -0
  271. package/dist/types/onchain/market/pricefeeds/feeds/CurveUSDPriceFeed.d.ts +12 -0
  272. package/dist/types/onchain/market/pricefeeds/feeds/Erc4626PriceFeed.d.ts +12 -0
  273. package/dist/types/onchain/market/pricefeeds/feeds/ExternalPriceFeed.d.ts +11 -0
  274. package/dist/types/onchain/market/pricefeeds/feeds/MellowLRTPriceFeed.d.ts +12 -0
  275. package/dist/types/onchain/market/pricefeeds/{PendleTWAPPTPriceFeed.d.ts → feeds/PendleTWAPPTPriceFeed.d.ts} +3 -3
  276. package/dist/types/onchain/market/pricefeeds/{PythPriceFeed.d.ts → feeds/PythPriceFeed.d.ts} +3 -3
  277. package/dist/types/onchain/market/pricefeeds/{RedstonePriceFeed.d.ts → feeds/RedstonePriceFeed.d.ts} +9 -9
  278. package/dist/types/onchain/market/pricefeeds/feeds/WstETHPriceFeed.d.ts +12 -0
  279. package/dist/types/onchain/market/pricefeeds/feeds/YearnPriceFeed.d.ts +12 -0
  280. package/dist/types/onchain/market/pricefeeds/feeds/ZeroPriceFeed.d.ts +11 -0
  281. package/dist/types/onchain/market/pricefeeds/feeds/index.d.ts +18 -0
  282. package/dist/types/onchain/market/pricefeeds/index.d.ts +28 -22
  283. package/dist/types/onchain/market/pricefeeds/types.d.ts +1 -31
  284. package/dist/types/onchain/market/pricefeeds/updates/RedstoneUpdater.d.ts +1 -1
  285. package/dist/types/onchain/market/pricefeeds/updates/UpdatablePriceFeedRegistry.d.ts +106 -0
  286. package/dist/types/onchain/market/pricefeeds/updates/getRawPriceUpdates.d.ts +6 -0
  287. package/dist/types/onchain/market/pricefeeds/updates/index.d.ts +7 -3
  288. package/dist/types/onchain/market/pricefeeds/updates/isUpdatablePriceFeed.d.ts +6 -0
  289. package/dist/types/onchain/market/pricefeeds/updates/types.d.ts +56 -2
  290. package/dist/types/onchain/market/pricefeeds/updates/updatableDependencies.d.ts +10 -0
  291. package/dist/types/onchain/market/rwa/RWARegistry.d.ts +2 -1
  292. package/dist/types/onchain/market/rwa/index.d.ts +3 -3
  293. package/dist/types/onchain/market/rwa/midas/MidasDegenNFT.d.ts +19 -4
  294. package/dist/types/onchain/market/rwa/securitize/SecuritizeDegenNFT.d.ts +24 -4
  295. package/dist/types/onchain/market/rwa/securitize/SecuritizeRWAFactory.d.ts +2 -14
  296. package/dist/types/onchain/market/rwa/types.d.ts +39 -37
  297. package/dist/types/onchain/opportunities/MultichainOpportunitiesService.d.ts +5 -1
  298. package/dist/types/onchain/opportunities/OpportunitiesService.d.ts +10 -3
  299. package/dist/types/onchain/opportunities/types.d.ts +6 -1
  300. package/dist/types/onchain/preview/index.d.ts +2 -1
  301. package/dist/types/onchain/preview/preview/index.d.ts +2 -1
  302. package/dist/types/onchain/preview/preview/midasGreenlistsAccount.d.ts +13 -0
  303. package/dist/types/onchain/preview/preview/previewOpenStrategyPosition.d.ts +5 -3
  304. package/dist/types/onchain/preview/preview/replayMulticall.d.ts +8 -7
  305. package/dist/types/onchain/validation/bundles/checkCreditOperation.d.ts +5 -4
  306. package/dist/types/onchain/validation/bundles/{checkDraw.d.ts → checkIncreaseDebt.d.ts} +7 -7
  307. package/dist/types/onchain/validation/bundles/{checkQuotasAsked.d.ts → checkIncreaseQuota.d.ts} +3 -3
  308. package/dist/types/onchain/validation/bundles/checkMidasAccountGreenlist.d.ts +22 -0
  309. package/dist/types/onchain/validation/bundles/checkRWAOpenRequirements.d.ts +2 -2
  310. package/dist/types/onchain/validation/bundles/checkRWAOpening.d.ts +9 -7
  311. package/dist/types/onchain/validation/bundles/index.d.ts +5 -4
  312. package/dist/types/onchain/validation/checks/checkBorrowLimit.d.ts +1 -1
  313. package/dist/types/onchain/validation/checks/checkDebtLimits.d.ts +3 -3
  314. package/dist/types/onchain/validation/checks/checkPoolLiquidity.d.ts +1 -1
  315. package/dist/types/onchain/validation/checks/checkReservePriceLimited.d.ts +31 -0
  316. package/dist/types/onchain/validation/checks/index.d.ts +2 -1
  317. package/dist/types/onchain/validation/index.d.ts +6 -4
  318. package/dist/types/onchain/validation/raise.d.ts +2 -2
  319. package/dist/types/sdk/execute/index.d.ts +2 -2
  320. package/dist/types/sdk/execute/types.d.ts +48 -6
  321. package/dist/types/sdk/index.d.ts +5 -4
  322. package/dist/types/sdk/opportunities/OpportunitiesNamespace.d.ts +5 -1
  323. package/dist/types/sdk/opportunities/types.d.ts +9 -3
  324. package/dist/types/sdk/prepare/PrepareApi.d.ts +16 -4
  325. package/dist/types/sdk/prepare/index.d.ts +4 -3
  326. package/dist/types/sdk/prepare/types.d.ts +200 -66
  327. package/package.json +1 -1
  328. package/dist/cjs/onchain/accounts/utils/midasUtils.js +0 -70
  329. package/dist/cjs/onchain/market/pricefeeds/PriceFeedsRegister.js +0 -301
  330. package/dist/cjs/onchain/validation/bundles/checkDraw.js +0 -28
  331. package/dist/cjs/plugins/degen-distributors/DegenDistributorsPlugin.js +0 -61
  332. package/dist/cjs/plugins/degen-distributors/index.js +0 -4
  333. package/dist/cjs/plugins/degen-distributors/package.json +0 -1
  334. package/dist/cjs/plugins/degen-distributors/types.js +0 -1
  335. package/dist/cjs/plugins/delayed-withdrawal/DelayedWithdrawalPlugin.js +0 -114
  336. package/dist/cjs/plugins/delayed-withdrawal/index.js +0 -4
  337. package/dist/cjs/plugins/delayed-withdrawal/package.json +0 -1
  338. package/dist/cjs/plugins/delayed-withdrawal/types.js +0 -1
  339. package/dist/esm/onchain/accounts/utils/midasUtils.js +0 -69
  340. package/dist/esm/onchain/market/pricefeeds/PriceFeedsRegister.js +0 -300
  341. package/dist/esm/onchain/validation/bundles/checkDraw.js +0 -27
  342. package/dist/esm/plugins/degen-distributors/DegenDistributorsPlugin.js +0 -60
  343. package/dist/esm/plugins/degen-distributors/index.js +0 -3
  344. package/dist/esm/plugins/degen-distributors/package.json +0 -1
  345. package/dist/esm/plugins/degen-distributors/types.js +0 -1
  346. package/dist/esm/plugins/delayed-withdrawal/DelayedWithdrawalPlugin.js +0 -113
  347. package/dist/esm/plugins/delayed-withdrawal/index.js +0 -3
  348. package/dist/esm/plugins/delayed-withdrawal/package.json +0 -1
  349. package/dist/esm/plugins/delayed-withdrawal/types.js +0 -1
  350. package/dist/types/onchain/accounts/utils/midasUtils.d.ts +0 -38
  351. package/dist/types/onchain/market/pricefeeds/BalancerStablePriceFeed.d.ts +0 -12
  352. package/dist/types/onchain/market/pricefeeds/BoundedPriceFeed.d.ts +0 -15
  353. package/dist/types/onchain/market/pricefeeds/CurveCryptoPriceFeed.d.ts +0 -12
  354. package/dist/types/onchain/market/pricefeeds/CurveStablePriceFeed.d.ts +0 -12
  355. package/dist/types/onchain/market/pricefeeds/CurveUSDPriceFeed.d.ts +0 -12
  356. package/dist/types/onchain/market/pricefeeds/Erc4626PriceFeed.d.ts +0 -12
  357. package/dist/types/onchain/market/pricefeeds/ExternalPriceFeed.d.ts +0 -11
  358. package/dist/types/onchain/market/pricefeeds/MellowLRTPriceFeed.d.ts +0 -12
  359. package/dist/types/onchain/market/pricefeeds/PriceFeedsRegister.d.ts +0 -180
  360. package/dist/types/onchain/market/pricefeeds/WstETHPriceFeed.d.ts +0 -12
  361. package/dist/types/onchain/market/pricefeeds/YearnPriceFeed.d.ts +0 -12
  362. package/dist/types/onchain/market/pricefeeds/ZeroPriceFeed.d.ts +0 -11
  363. package/dist/types/onchain/market/pricefeeds/getRawPriceUpdates.d.ts +0 -5
  364. package/dist/types/onchain/market/pricefeeds/isUpdatablePriceFeed.d.ts +0 -5
  365. package/dist/types/plugins/degen-distributors/DegenDistributorsPlugin.d.ts +0 -25
  366. package/dist/types/plugins/degen-distributors/index.d.ts +0 -3
  367. package/dist/types/plugins/degen-distributors/types.d.ts +0 -8
  368. package/dist/types/plugins/delayed-withdrawal/DelayedWithdrawalPlugin.d.ts +0 -25
  369. package/dist/types/plugins/delayed-withdrawal/index.d.ts +0 -3
  370. package/dist/types/plugins/delayed-withdrawal/types.d.ts +0 -10
@@ -11,10 +11,11 @@ import { classifyCloseOrRepay, isCloseOrRepay } from "./preview/detectCloseOrRep
11
11
  import { detectDelayedClaim, resolveDelayedClaimIntent } from "./preview/detectDelayedClaim.js";
12
12
  import { detectDelayedOperation } from "./preview/detectDelayedOperation.js";
13
13
  import { estimateClaimableAt } from "./preview/estimateClaimableAt.js";
14
+ import { midasGreenlistsAccount } from "./preview/midasGreenlistsAccount.js";
14
15
  import { previewAdjustStrategyPosition } from "./preview/previewAdjustStrategyPosition.js";
15
16
  import { previewExitOrRepayStrategyPosition } from "./preview/previewExitOrRepayStrategyPosition.js";
16
17
  import { makeReplayState, replayInnerOperations } from "./preview/replayInnerOperations.js";
17
18
  import { replayMulticall } from "./preview/replayMulticall.js";
18
19
  import { previewOperation } from "./preview/previewOperation.js";
19
20
  import "./preview/index.js";
20
- export { CreditAccountState, buildDelayedStrategyPositionOperationPreview, classifyCloseOrRepay, classifyInnerOperations, detectDelayedClaim, detectDelayedOperation, estimateClaimableAt, isCloseOrRepay, isPoolOperation, isRWAOperation, makeReplayState, parseFacadeOperationCalldata, parseOperationCalldata, parsePoolOperationCalldata, parseRWAFactoryOperationCalldata, previewAdjustStrategyPosition, previewExitOrRepayStrategyPosition, previewOperation, replayInnerOperations, replayMulticall, resolveDelayedClaimIntent };
21
+ export { CreditAccountState, buildDelayedStrategyPositionOperationPreview, classifyCloseOrRepay, classifyInnerOperations, detectDelayedClaim, detectDelayedOperation, estimateClaimableAt, isCloseOrRepay, isPoolOperation, isRWAOperation, makeReplayState, midasGreenlistsAccount, parseFacadeOperationCalldata, parseOperationCalldata, parsePoolOperationCalldata, parseRWAFactoryOperationCalldata, previewAdjustStrategyPosition, previewExitOrRepayStrategyPosition, previewOperation, replayInnerOperations, replayMulticall, resolveDelayedClaimIntent };
@@ -1,7 +1,7 @@
1
1
  import { hexEq } from "../../utils/hex.js";
2
2
  import { AbstractAdapterContract } from "../../market/adapters/contracts/AbstractAdapter.js";
3
3
  import { CreditFacadeV310Contract } from "../../market/credit/CreditFacadeV310Contract.js";
4
- import { RWA_FACTORY_SECURITIZE } from "../../../model/rwa.js";
4
+ import "../../../model/rwa.js";
5
5
  import "../../../model/index.js";
6
6
  import { isRWAFactory } from "../../market/rwa/types.js";
7
7
  import { classifyInnerOperations } from "./classifyInnerOperations.js";
@@ -32,7 +32,7 @@ function parseSecuritizeOperationCalldata(sdk, factory, calldata) {
32
32
  const { rawArgs } = parsed;
33
33
  const innerCalls = rawArgs.calls ?? [];
34
34
  const args = {
35
- type: RWA_FACTORY_SECURITIZE,
35
+ protocol: "securitize",
36
36
  tokensToRegister: [...rawArgs.tokensToRegister ?? []],
37
37
  signaturesToCache: [...rawArgs.signaturesToCache ?? []]
38
38
  };
@@ -4,9 +4,10 @@ import { classifyCloseOrRepay, isCloseOrRepay } from "./detectCloseOrRepay.js";
4
4
  import { detectDelayedClaim, resolveDelayedClaimIntent } from "./detectDelayedClaim.js";
5
5
  import { detectDelayedOperation } from "./detectDelayedOperation.js";
6
6
  import { estimateClaimableAt } from "./estimateClaimableAt.js";
7
+ import { midasGreenlistsAccount } from "./midasGreenlistsAccount.js";
7
8
  import { previewAdjustStrategyPosition } from "./previewAdjustStrategyPosition.js";
8
9
  import { previewExitOrRepayStrategyPosition } from "./previewExitOrRepayStrategyPosition.js";
9
10
  import { makeReplayState, replayInnerOperations } from "./replayInnerOperations.js";
10
11
  import { replayMulticall } from "./replayMulticall.js";
11
12
  import { previewOperation } from "./previewOperation.js";
12
- export { CreditAccountState, buildDelayedStrategyPositionOperationPreview, classifyCloseOrRepay, detectDelayedClaim, detectDelayedOperation, estimateClaimableAt, isCloseOrRepay, makeReplayState, previewAdjustStrategyPosition, previewExitOrRepayStrategyPosition, previewOperation, replayInnerOperations, replayMulticall, resolveDelayedClaimIntent };
13
+ export { CreditAccountState, buildDelayedStrategyPositionOperationPreview, classifyCloseOrRepay, detectDelayedClaim, detectDelayedOperation, estimateClaimableAt, isCloseOrRepay, makeReplayState, midasGreenlistsAccount, previewAdjustStrategyPosition, previewExitOrRepayStrategyPosition, previewOperation, replayInnerOperations, replayMulticall, resolveDelayedClaimIntent };
@@ -0,0 +1,16 @@
1
+ import { MidasGatewayAdapterContract } from "../../market/adapters/contracts/MidasGatewayAdapterContract.js";
2
+ //#region src/onchain/preview/preview/midasGreenlistsAccount.ts
3
+ /**
4
+ * Whether the multicall grants the Midas greenlisted role to the credit
5
+ * account via `receiveGreenlist()`.
6
+ */
7
+ function midasGreenlistsAccount(sdk, multicall) {
8
+ for (const op of multicall) {
9
+ if (op.operation !== "Execute") continue;
10
+ const adapter = sdk.getContract(op.adapter);
11
+ if (adapter instanceof MidasGatewayAdapterContract && adapter.isReceiveGreenlist(op.calldata)) return true;
12
+ }
13
+ return false;
14
+ }
15
+ //#endregion
16
+ export { midasGreenlistsAccount };
@@ -1,26 +1,24 @@
1
1
  import { AP_WETH_TOKEN } from "../../constants/address-provider.js";
2
2
  import { asEstimated } from "../../../model/previews.js";
3
- import { sdkErr, sdkOk } from "../../../model/result.js";
3
+ import { sdkOk } from "../../../model/result.js";
4
4
  import "../../../model/index.js";
5
- import { CreditAccountState } from "./CreditAccountState.js";
5
+ import { midasGreenlistsAccount } from "./midasGreenlistsAccount.js";
6
6
  import { unwrapNativeCollateral } from "./unwrapNativeCollateral.js";
7
- import { makeReplayState, replayInnerOperations } from "./replayInnerOperations.js";
8
7
  //#region src/onchain/preview/preview/previewOpenStrategyPosition.ts
9
- function previewOpenStrategyPosition(sdk, input, operation) {
8
+ function previewOpenStrategyPosition(sdk, input, operation, replay) {
10
9
  const { value = 0n } = input;
11
10
  const market = sdk.marketRegister.findByCreditManager(operation.creditManager);
12
11
  const oracle = market.priceOracle;
13
- const state = makeReplayState(CreditAccountState.beforeOpen(operation.creditManager, market.underlying));
14
- const replayError = replayInnerOperations(sdk, operation.multicall, state);
15
- if (replayError) return sdkErr(replayError);
16
- const account = state.account;
12
+ const { before, after } = replay;
13
+ const account = after.account;
17
14
  let warning;
18
- const netValue = state.collateralAdded.sum((token, balance) => {
15
+ const price = (token, balance) => {
19
16
  const priced = oracle.safeConvert(token, market.underlying, balance);
20
17
  warning ??= priced.error;
21
18
  return priced.value;
22
- });
23
- const unwrapped = unwrapNativeCollateral(state.collateralAdded.toAssets(), value, sdk.addressProvider.getAddress(AP_WETH_TOKEN, 0));
19
+ };
20
+ const netValue = before.balances.sum(price) + after.collateralAdded.sum(price) - after.collateralWithdrawn.sum(price);
21
+ const unwrapped = unwrapNativeCollateral(after.collateralAdded.toAssets(), value, sdk.addressProvider.getAddress(AP_WETH_TOKEN, 0));
24
22
  if (!unwrapped.ok) return unwrapped;
25
23
  const collateral = unwrapped.data;
26
24
  const snap = account.toSnapshot(netValue + account.totalDebt);
@@ -29,16 +27,15 @@ function previewOpenStrategyPosition(sdk, input, operation) {
29
27
  ...asEstimated(sdk.positions.projection(snap, { availableLiquidityChange: -account.totalDebt })),
30
28
  targetCollateral: targetAsset ? oracle.toTokenAmount(targetAsset.token, targetAsset.balance) : void 0,
31
29
  collateralAdded: collateral.map((a) => oracle.toTokenAmount(a.token, a.balance)),
30
+ collateralWithdrawn: after.collateralWithdrawn.toAssets().map((a) => oracle.toTokenAmount(a.token, a.balance)),
32
31
  warning
33
32
  };
34
- if (operation.operation === "RWAOpenCreditAccount") return sdkOk({
35
- ...projection,
36
- operation: "RWAOpenCreditAccount",
37
- rwaArgs: operation.args
38
- });
39
33
  return sdkOk({
40
34
  ...projection,
41
- operation: "OpenCreditAccount"
35
+ operation: "OpenCreditAccount",
36
+ ...operation.operation === "MultiCall" || operation.operation === "BotMulticall" || operation.operation === "RWAMulticall" ? { creditAccount: operation.creditAccount } : {},
37
+ ..."args" in operation ? { rwaArgs: operation.args } : {},
38
+ midasGreenlistsAccount: midasGreenlistsAccount(sdk, operation.multicall)
42
39
  });
43
40
  }
44
41
  /**
@@ -33,9 +33,13 @@ async function previewOperation(sdk, input, options, creditAccount) {
33
33
  if (!parsed.ok) return parsed;
34
34
  const operation = parsed.data;
35
35
  if (isPoolOperation(operation)) return previewPoolPositionOperation(sdk, operation, options);
36
- if (operation.operation === "OpenCreditAccount" || operation.operation === "RWAOpenCreditAccount") return previewOpenStrategyPosition(sdk, input, operation);
36
+ if (operation.operation === "OpenCreditAccount" || operation.operation === "RWAOpenCreditAccount") {
37
+ const replayed = replayMulticall(sdk, operation);
38
+ if (!replayed.ok) return replayed;
39
+ return previewOpenStrategyPosition(sdk, input, operation, replayed.data);
40
+ }
37
41
  if (operation.operation === "CloseCreditAccount") {
38
- const resolved = await resolveCreditAccount(sdk, operation, options, creditAccount);
42
+ const resolved = await resolveCreditAccount(sdk, operation.creditAccount, options, creditAccount);
39
43
  if (!resolved.ok) return resolved;
40
44
  const replayed = replayMulticall(sdk, operation, resolved.data);
41
45
  if (!replayed.ok) return replayed;
@@ -47,7 +51,7 @@ async function previewOperation(sdk, input, options, creditAccount) {
47
51
  return preview;
48
52
  }
49
53
  if (operation.operation === "MultiCall" || operation.operation === "BotMulticall" || operation.operation === "RWAMulticall") {
50
- const resolved = await resolveCreditAccount(sdk, operation, options, creditAccount);
54
+ const resolved = await resolveCreditAccount(sdk, operation.creditAccount, options, creditAccount);
51
55
  if (!resolved.ok) return resolved;
52
56
  const replayed = replayMulticall(sdk, operation, resolved.data);
53
57
  if (!replayed.ok) return replayed;
@@ -64,20 +68,24 @@ async function previewOperation(sdk, input, options, creditAccount) {
64
68
  * injected state when present, otherwise fetches it from the credit account
65
69
  * compressor.
66
70
  */
67
- async function resolveCreditAccount(sdk, operation, options, creditAccount) {
68
- let resolved = creditAccount;
69
- if (!resolved) resolved = await sdk.accounts.getCreditAccountData(operation.creditAccount, options?.blockNumber);
70
- if (!resolved) return sdkErr(creditAccountNotFound(operation.creditAccount));
71
+ async function resolveCreditAccount(sdk, address, options, data) {
72
+ let resolved = data;
73
+ if (!resolved) resolved = await sdk.accounts.getCreditAccountData(address, options?.blockNumber);
74
+ if (!resolved) return sdkErr(creditAccountNotFound(address));
71
75
  return sdkOk(resolved);
72
76
  }
73
77
  /**
74
78
  * Previews a plain/bot/RWA multicall: classifies the instant preview
75
- * (zero-debt closure/repay vs adjustment) and, when the multicall requests a
76
- * delayed withdrawal, wraps the instant preview into a
77
- * `DelayedCreditAccountOperation` together with the best-effort preview of
78
- * the state after the withdrawal is claimed.
79
+ * (reopening a zero-debt account, zero-debt closure/repay, or adjustment)
80
+ * and, when the multicall requests a delayed withdrawal, wraps the instant
81
+ * preview into a `DelayedCreditAccountOperation` together with the
82
+ * best-effort preview of the state after the withdrawal is claimed.
83
+ *
84
+ * A reopening is reported as `OpenCreditAccount` and never as a delayed
85
+ * withdrawal: an opening requests no redemption.
79
86
  */
80
87
  async function previewMulticallOperation(sdk, input, operation, replay, blockNumber) {
88
+ if (replay.before.totalDebt === 0n && replay.before.quotas.toAssets(0n).length === 0 && replay.after.account.totalDebt > 0n) return previewOpenStrategyPosition(sdk, input, operation, replay);
81
89
  let instantPreview;
82
90
  if (isCloseOrRepay(operation.multicall)) {
83
91
  const instant = previewExitOrRepayStrategyPosition(sdk, input, operation, false, replay);
@@ -4,11 +4,12 @@ import { CreditAccountState } from "./CreditAccountState.js";
4
4
  import { makeReplayState, replayInnerOperations } from "./replayInnerOperations.js";
5
5
  //#region src/onchain/preview/preview/replayMulticall.ts
6
6
  /**
7
- * Replays the operation's multicall over the account's pre-resolved
8
- * pre-state via {@link replayInnerOperations}.
7
+ * Replays the operation's multicall via {@link replayInnerOperations}.
8
+ * When `creditAccount` is omitted, the seed is
9
+ * {@link CreditAccountState.beforeOpen} (a fresh opening).
9
10
  */
10
11
  function replayMulticall(sdk, operation, creditAccount) {
11
- const before = CreditAccountState.fromCreditAccountData(creditAccount);
12
+ const before = creditAccount ? CreditAccountState.fromCreditAccountData(creditAccount) : CreditAccountState.beforeOpen(operation.creditManager, sdk.marketRegister.findByCreditManager(operation.creditManager).underlying);
12
13
  const after = makeReplayState(before.clone());
13
14
  const error = replayInnerOperations(sdk, operation.multicall, after);
14
15
  if (error) return sdkErr(error);
@@ -22,13 +22,13 @@ async function checkCollateralFunding(input) {
22
22
  if (held.size === 0) return [];
23
23
  let spender;
24
24
  try {
25
- if (preview.operation === "OpenCreditAccount" || preview.operation === "RWAOpenCreditAccount") spender = await sdk.accounts.getApprovalAddress({
25
+ if (preview.creditAccount) spender = await sdk.accounts.getApprovalAddress({
26
26
  creditManager: preview.creditManager,
27
- borrower: sender
27
+ creditAccount: preview.creditAccount
28
28
  });
29
29
  else spender = await sdk.accounts.getApprovalAddress({
30
30
  creditManager: preview.creditManager,
31
- creditAccount: preview.creditAccount
31
+ borrower: sender
32
32
  });
33
33
  } catch (cause) {
34
34
  return [unexpectedFailure(cause, "resolve the approval address")];
@@ -4,11 +4,11 @@ import { checkDebtLimits } from "../checks/checkDebtLimits.js";
4
4
  import "../checks/index.js";
5
5
  import { checkAccountQuotas } from "./checkAccountQuotas.js";
6
6
  import { checkCollateralFunding } from "./checkCollateralFunding.js";
7
- import { checkDraw } from "./checkDraw.js";
8
7
  import { checkHealthFactors } from "./checkHealthFactors.js";
8
+ import { checkIncreaseDebt } from "./checkIncreaseDebt.js";
9
+ import { checkIncreaseQuota } from "./checkIncreaseQuota.js";
9
10
  import { checkMarket } from "./checkMarket.js";
10
11
  import { checkObtained } from "./checkObtained.js";
11
- import { checkQuotasAsked } from "./checkQuotasAsked.js";
12
12
  import { checkRWAOpening } from "./checkRWAOpening.js";
13
13
  //#region src/onchain/validation/bundles/checkCreditOperation.ts
14
14
  /**
@@ -16,15 +16,17 @@ import { checkRWAOpening } from "./checkRWAOpening.js";
16
16
  * has to hold, approve or sign.
17
17
  *
18
18
  * The array is in check order, most fundamental first: the market's own state,
19
- * then what the facade would revert on, then what the operation asks the
20
- * market for, then the account it leaves behind, and last the wallet's side.
19
+ * then what the facade would revert on, then what the operation borrows and the
20
+ * quota it increases, then the account it leaves behind, and last the wallet's
21
+ * side.
21
22
  */
22
23
  async function checkCreditOperation(args) {
23
24
  const { sdk, preview, sender, blockNumber, ...thresholds } = args;
24
25
  const suite = sdk.marketRegister.findCreditManager(preview.creditManager);
25
26
  const market = suite.market;
26
27
  const underlying = toToken(sdk, market.pool.underlying);
27
- const isOpening = preview.operation === "OpenCreditAccount" || preview.operation === "RWAOpenCreditAccount";
28
+ const isOpening = preview.operation === "OpenCreditAccount";
29
+ const isEmptyOpening = preview.operation === "OpenCreditAccount" && preview.totalDebt.value === 0n && preview.collateralAdded.length === 0 && preview.quotas.length === 0;
28
30
  const protocol = [
29
31
  ...checkMarket(suite),
30
32
  ...checkDebtLimits({
@@ -32,13 +34,13 @@ async function checkCreditOperation(args) {
32
34
  minDebt: suite.creditFacade.minDebt,
33
35
  maxDebt: suite.creditFacade.maxDebt,
34
36
  underlying,
35
- allowZero: !isOpening,
36
- ceiling: suite.maxBorrowAmount()
37
+ allowZero: !isOpening || isEmptyOpening,
38
+ maxBorrowAmount: suite.maxBorrowAmount()
37
39
  }),
38
- ...checkDraw(suite, preview, underlying),
40
+ ...checkIncreaseDebt(suite, preview, underlying),
39
41
  ...checkObtained(suite, preview),
40
42
  ...checkAccountQuotas(suite, preview),
41
- ...checkQuotasAsked(market, preview, underlying),
43
+ ...checkIncreaseQuota(market, preview, underlying),
42
44
  ...checkHealthFactors({
43
45
  totalDebt: preview.totalDebt,
44
46
  healthFactor: preview.estHealthFactor,
@@ -50,7 +52,7 @@ async function checkCreditOperation(args) {
50
52
  preview,
51
53
  sender,
52
54
  blockNumber
53
- }), preview.operation === "RWAOpenCreditAccount" ? checkRWAOpening({
55
+ }), isOpening ? checkRWAOpening({
54
56
  sdk,
55
57
  preview,
56
58
  sender
@@ -0,0 +1,27 @@
1
+ import { checkBorrowLimit } from "../checks/checkBorrowLimit.js";
2
+ import "../checks/index.js";
3
+ //#region src/onchain/validation/bundles/checkIncreaseDebt.ts
4
+ /**
5
+ * What the transaction borrows, against what the market can lend right now.
6
+ *
7
+ * Only a debt increase is weighed: repaying, or leaving the debt alone, can
8
+ * never exceed the borrow limit. Opening borrows the whole debt; adjusting
9
+ * borrows `totalDebtChange`.
10
+ *
11
+ * The engine holds every simulation to this already (`assertCanBorrow`), so
12
+ * this is here for the transactions it never saw — a pasted calldata reaches
13
+ * the confirm screen with nothing else standing between it and a revert.
14
+ */
15
+ function checkIncreaseDebt(suite, preview, underlying) {
16
+ const debtIncrease = preview.operation === "AdjustCreditAccount" ? preview.totalDebtChange.value : preview.totalDebt.value;
17
+ if (debtIncrease <= 0n) return [];
18
+ const maxBorrowAmount = suite.maxBorrowAmount();
19
+ return checkBorrowLimit({
20
+ requested: debtIncrease,
21
+ available: maxBorrowAmount.amount.value,
22
+ limit: maxBorrowAmount.limit,
23
+ underlying
24
+ });
25
+ }
26
+ //#endregion
27
+ export { checkIncreaseDebt };
@@ -1,8 +1,8 @@
1
1
  import { checkQuotaLimit } from "../checks/checkQuotaLimit.js";
2
2
  import "../checks/index.js";
3
- //#region src/onchain/validation/bundles/checkQuotasAsked.ts
3
+ //#region src/onchain/validation/bundles/checkIncreaseQuota.ts
4
4
  /** Every quota the operation raises, against the room the keeper has left. */
5
- function checkQuotasAsked(market, preview, underlying) {
5
+ function checkIncreaseQuota(market, preview, underlying) {
6
6
  const increases = preview.operation === "AdjustCreditAccount" ? preview.quotasChange : preview.quotas;
7
7
  const { pqk } = market.pool;
8
8
  return increases.filter((q) => q.value > 0n).flatMap((q) => {
@@ -16,4 +16,4 @@ function checkQuotasAsked(market, preview, underlying) {
16
16
  });
17
17
  }
18
18
  //#endregion
19
- export { checkQuotasAsked };
19
+ export { checkIncreaseQuota };
@@ -0,0 +1,43 @@
1
+ import { accountNotMidasGreenlisted } from "../../../model/errors/operation-errors.js";
2
+ import { unexpectedFailure } from "../../../model/errors/prepare-errors.js";
3
+ import "../../../model/index.js";
4
+ import { toToken } from "../helpers/token.js";
5
+ import "../helpers/index.js";
6
+ //#region src/onchain/validation/bundles/checkMidasAccountGreenlist.ts
7
+ /**
8
+ * Whether the credit account already holds the Midas greenlisted role
9
+ * this permissioned mToken requires of its holder.
10
+ */
11
+ async function checkMidasAccountGreenlist(input) {
12
+ const { sdk, preview, nft, tokens } = input;
13
+ if (nft.protocol !== "midas") return [];
14
+ if (tokens.length === 0) return [];
15
+ const account = preview.creditAccount;
16
+ if (!account) return tokens.map((token) => accountNotMidasGreenlisted({
17
+ token: toToken(sdk, token),
18
+ creditManager: preview.creditManager
19
+ }));
20
+ return (await Promise.all(tokens.map((token) => checkAccountRole({
21
+ sdk,
22
+ nft,
23
+ account,
24
+ token,
25
+ preview
26
+ })))).flat();
27
+ }
28
+ async function checkAccountRole(input) {
29
+ const { sdk, nft, account, token, preview } = input;
30
+ try {
31
+ const requirements = await nft.getOpenAccountRequirements(account, { tokenOutAddress: token });
32
+ if (nft.isRegistered(requirements)) return [];
33
+ return [accountNotMidasGreenlisted({
34
+ token: toToken(sdk, token),
35
+ creditManager: preview.creditManager,
36
+ creditAccount: account
37
+ })];
38
+ } catch (cause) {
39
+ return [unexpectedFailure(cause, "read the Midas account greenlist")];
40
+ }
41
+ }
42
+ //#endregion
43
+ export { checkMidasAccountGreenlist };
@@ -5,24 +5,24 @@ import { toToken } from "../helpers/token.js";
5
5
  import "../helpers/index.js";
6
6
  //#region src/onchain/validation/bundles/checkRWAOpenRequirements.ts
7
7
  /**
8
- * The RWA factory is satisfied that `wallet` may open on `token` with the
8
+ * The degen NFT is satisfied that `wallet` may open on `token` with the
9
9
  * registration args already on the transaction.
10
10
  */
11
11
  async function checkRWAOpenRequirements(input) {
12
12
  const { sdk, wallet, creditManager, token, providedArgs } = input;
13
13
  try {
14
- const requirements = await sdk.accounts.getOpenAccountRequirements(wallet, creditManager, { tokenOutAddress: token });
15
- if (!requirements) return [];
16
- const { rwaFactory } = sdk.marketRegister.findByCreditManager(creditManager);
17
- if (!rwaFactory) throw new Error(`no RWA factory for credit manager ${creditManager}`);
18
- const missing = rwaFactory.getMissingRequirements(requirements, providedArgs);
19
- if (!missing && requirements.securitizeTokensToRegister.length === 0) return [];
14
+ const nft = await sdk.marketRegister.findCreditManager(creditManager).degenNFT();
15
+ if (!nft) return [];
16
+ const requirements = await nft.getOpenAccountRequirements(wallet, { tokenOutAddress: token });
17
+ const missing = nft.getMissingRequirements(requirements, providedArgs);
18
+ if (!missing && nft.isRegistered(requirements)) return [];
20
19
  return [rwaOpenRequirementsNotMet({
21
20
  token: toToken(sdk, token),
22
21
  creditManager,
23
- factory: rwaFactory.address,
22
+ protocol: nft.protocol,
23
+ registrationLink: nft.registrationLink,
24
24
  requirements,
25
- ...missing === void 0 ? {} : { missing }
25
+ missing
26
26
  })];
27
27
  } catch (cause) {
28
28
  return [unexpectedFailure(cause, "read the RWA opening requirements")];
@@ -1,23 +1,33 @@
1
1
  import { AddressSet } from "../../utils/AddressSet.js";
2
+ import { checkMidasAccountGreenlist } from "./checkMidasAccountGreenlist.js";
2
3
  import { checkRWAOpenRequirements } from "./checkRWAOpenRequirements.js";
3
4
  //#region src/onchain/validation/bundles/checkRWAOpening.ts
4
5
  /**
5
- * Per factory-gated token among `collateralAdded ∪ quotas`, whether the
6
- * borrower still has to register or sign before this opening can land.
6
+ * Per KYC-gated token among `collateralAdded ∪ quotas`, whether the
7
+ * borrower still has to register or sign before this opening can land,
8
+ * and whether a Midas credit account may hold the mToken.
7
9
  */
8
10
  async function checkRWAOpening(input) {
9
11
  const { sdk, preview, sender } = input;
10
- const { rwaFactory } = sdk.marketRegister.findByCreditManager(preview.creditManager);
11
- if (!rwaFactory) return [];
12
- const gated = new AddressSet(rwaFactory.getTokens());
13
- const candidates = new AddressSet([...preview.collateralAdded.map((a) => a.token.address), ...preview.quotas.map((q) => q.token.address)]);
14
- return (await Promise.all([...candidates].filter((token) => gated.has(token)).map((token) => checkRWAOpenRequirements({
12
+ const nft = await sdk.marketRegister.findCreditManager(preview.creditManager).degenNFT();
13
+ if (!nft) return [];
14
+ const nftTokens = new AddressSet(await nft.getTokens());
15
+ let candidates = new AddressSet([...preview.collateralAdded.map((a) => a.token.address), ...preview.quotas.map((q) => q.token.address)]).asArray();
16
+ candidates = candidates.filter((token) => nftTokens.has(token));
17
+ let tokensToCheck = candidates;
18
+ if (tokensToCheck.length === 0 && !preview.creditAccount && nft.protocol === "midas") tokensToCheck = nftTokens.asArray();
19
+ return (await Promise.all([...tokensToCheck.map((token) => checkRWAOpenRequirements({
15
20
  sdk,
16
21
  wallet: sender,
17
22
  creditManager: preview.creditManager,
18
23
  token,
19
24
  providedArgs: preview.rwaArgs
20
- })))).flat();
25
+ })), checkMidasAccountGreenlist({
26
+ sdk,
27
+ preview,
28
+ nft,
29
+ tokens: candidates
30
+ })])).flat();
21
31
  }
22
32
  //#endregion
23
33
  export { checkRWAOpening };
@@ -2,11 +2,12 @@ import { checkAccountQuotas } from "./checkAccountQuotas.js";
2
2
  import { checkWalletAllowance } from "./checkWalletAllowance.js";
3
3
  import { checkWalletBalance } from "./checkWalletBalance.js";
4
4
  import { checkCollateralFunding } from "./checkCollateralFunding.js";
5
- import { checkDraw } from "./checkDraw.js";
6
5
  import { checkHealthFactors } from "./checkHealthFactors.js";
6
+ import { checkIncreaseDebt } from "./checkIncreaseDebt.js";
7
+ import { checkIncreaseQuota } from "./checkIncreaseQuota.js";
7
8
  import { checkMarket } from "./checkMarket.js";
8
9
  import { checkObtained } from "./checkObtained.js";
9
- import { checkQuotasAsked } from "./checkQuotasAsked.js";
10
+ import { checkMidasAccountGreenlist } from "./checkMidasAccountGreenlist.js";
10
11
  import { checkRWAOpenRequirements } from "./checkRWAOpenRequirements.js";
11
12
  import { checkRWAOpening } from "./checkRWAOpening.js";
12
13
  import { checkCreditOperation } from "./checkCreditOperation.js";
@@ -15,4 +16,4 @@ import { checkLiquidationFunding } from "./checkLiquidationFunding.js";
15
16
  import { checkWallet } from "./checkWallet.js";
16
17
  import { checkPoolFunding } from "./checkPoolFunding.js";
17
18
  import { checkPoolOperation } from "./checkPoolOperation.js";
18
- export { checkAccountQuotas, checkCollateralFunding, checkCreditOperation, checkDraw, checkHealthFactors, checkLiquidationEligibility, checkLiquidationFunding, checkMarket, checkObtained, checkPoolFunding, checkPoolOperation, checkQuotasAsked, checkRWAOpenRequirements, checkRWAOpening, checkWallet, checkWalletAllowance, checkWalletBalance };
19
+ export { checkAccountQuotas, checkCollateralFunding, checkCreditOperation, checkHealthFactors, checkIncreaseDebt, checkIncreaseQuota, checkLiquidationEligibility, checkLiquidationFunding, checkMarket, checkMidasAccountGreenlist, checkObtained, checkPoolFunding, checkPoolOperation, checkRWAOpenRequirements, checkRWAOpening, checkWallet, checkWalletAllowance, checkWalletBalance };
@@ -42,7 +42,6 @@ async function checkOperation(input, options = {}) {
42
42
  sender
43
43
  }, options);
44
44
  case "OpenCreditAccount":
45
- case "RWAOpenCreditAccount":
46
45
  case "AdjustCreditAccount": return checkCreditOperation({
47
46
  sdk,
48
47
  preview,
@@ -43,7 +43,7 @@ function checkSimulation(sdk, input, options = {}) {
43
43
  maxDebt: suite.creditFacade.maxDebt,
44
44
  underlying: toToken(sdk, suite.market.pool.underlying),
45
45
  allowZero: true,
46
- ceiling: suite.maxBorrowAmount()
46
+ maxBorrowAmount: suite.maxBorrowAmount()
47
47
  }),
48
48
  ..."averageQuota" in state ? checkQuotaCount({
49
49
  count: state.averageQuota.filter((q) => q.balance > 0n).length,
@@ -4,7 +4,7 @@ import { amountOf } from "../helpers/amount.js";
4
4
  import "../helpers/index.js";
5
5
  //#region src/onchain/validation/checks/checkBorrowLimit.ts
6
6
  /**
7
- * What the pool will hand over, against what is asked for.
7
+ * What the pool will hand over, against the amount requested.
8
8
  *
9
9
  * `available` and `limit` are the caller's reading of which limit is in the
10
10
  * way; this check only compares. `maxBorrowAmount` is the largest debt still
@@ -5,16 +5,13 @@ import "../helpers/index.js";
5
5
  //#region src/onchain/validation/checks/checkDebtLimits.ts
6
6
  /** A debt the facade would revert on. */
7
7
  function checkDebtLimits(args) {
8
- const { debt, minDebt, maxDebt, underlying, allowZero, ceiling } = args;
8
+ const { debt, minDebt, maxDebt, underlying, allowZero, maxBorrowAmount } = args;
9
9
  if (!(debt > maxDebt || debt < minDebt && !(allowZero && debt === 0n))) return [];
10
10
  return [debtOutOfRange({
11
11
  requested: amountOf(underlying, debt),
12
12
  minDebt: amountOf(underlying, minDebt),
13
13
  maxDebt: amountOf(underlying, maxDebt),
14
- ceiling: ceiling && {
15
- amount: amountOf(underlying, ceiling.value),
16
- limit: ceiling.limit
17
- }
14
+ maxBorrowAmount
18
15
  })];
19
16
  }
20
17
  //#endregion
@@ -7,7 +7,7 @@ import "../helpers/index.js";
7
7
  * What the pool holds, against what is being taken out of it.
8
8
  *
9
9
  * The operator is not `checkBorrowLimit`'s: a pool holding exactly the amount
10
- * asked for still cannot serve it, so equality is already a refusal. That is
10
+ * requested still cannot serve it, so equality is already a refusal. That is
11
11
  * the rule the legacy withdrawal validator enforced and it is preserved to the
12
12
  * unit.
13
13
  */
@@ -0,0 +1,29 @@
1
+ import { reservePriceLimited } from "../../../model/errors/operation-errors.js";
2
+ import "../../../model/index.js";
3
+ //#region src/onchain/validation/checks/checkReservePriceLimited.ts
4
+ /**
5
+ * Whether a failed collateral check is the reserve price feed's doing.
6
+ *
7
+ * A call that hands funds over is weighed at safe prices — `min` of a token's
8
+ * two feeds, and nothing at all where governance registered no reserve feed —
9
+ * so an account that covers its debt at the main feed can still be refused.
10
+ * The two are worth telling apart: a position that is genuinely too small is
11
+ * fixed by adding collateral or requesting less, while this one is a valuation
12
+ * the account does not control, and requesting less only helps as far as
13
+ * `withdrawable` says it does.
14
+ *
15
+ * Runs after `checkCollateralised` and answers only when that one refused, so
16
+ * the caller keeps its own threshold rather than restating it here.
17
+ */
18
+ function checkReservePriceLimited(args) {
19
+ const { healthFactor, atMainPrices, healthFactorThreshold, withdrawable } = args;
20
+ if (healthFactor >= healthFactorThreshold || atMainPrices < healthFactorThreshold) return [];
21
+ return [reservePriceLimited({
22
+ healthFactor,
23
+ atMainPrices,
24
+ healthFactorThreshold,
25
+ withdrawable
26
+ })];
27
+ }
28
+ //#endregion
29
+ export { checkReservePriceLimited };
@@ -13,4 +13,5 @@ import { checkPoolPaused } from "./checkPoolPaused.js";
13
13
  import { checkPoolSunset } from "./checkPoolSunset.js";
14
14
  import { checkQuotaCount } from "./checkQuotaCount.js";
15
15
  import { checkQuotaLimit } from "./checkQuotaLimit.js";
16
- export { checkBorrowLimit, checkCollateralised, checkCreditAccountFrozen, checkCreditManagerPaused, checkDebtLimits, checkEmergencyLiquidator, checkForbiddenToken, checkLeverage, checkLiquidatorEligible, checkMarketExpired, checkPoolLiquidity, checkPoolPaused, checkPoolSunset, checkQuotaCount, checkQuotaLimit };
16
+ import { checkReservePriceLimited } from "./checkReservePriceLimited.js";
17
+ export { checkBorrowLimit, checkCollateralised, checkCreditAccountFrozen, checkCreditManagerPaused, checkDebtLimits, checkEmergencyLiquidator, checkForbiddenToken, checkLeverage, checkLiquidatorEligible, checkMarketExpired, checkPoolLiquidity, checkPoolPaused, checkPoolSunset, checkQuotaCount, checkQuotaLimit, checkReservePriceLimited };
@@ -17,16 +17,18 @@ import { checkPoolPaused } from "./checks/checkPoolPaused.js";
17
17
  import { checkPoolSunset } from "./checks/checkPoolSunset.js";
18
18
  import { checkQuotaCount } from "./checks/checkQuotaCount.js";
19
19
  import { checkQuotaLimit } from "./checks/checkQuotaLimit.js";
20
+ import { checkReservePriceLimited } from "./checks/checkReservePriceLimited.js";
20
21
  import "./checks/index.js";
21
22
  import { checkAccountQuotas } from "./bundles/checkAccountQuotas.js";
22
23
  import { checkWalletAllowance } from "./bundles/checkWalletAllowance.js";
23
24
  import { checkWalletBalance } from "./bundles/checkWalletBalance.js";
24
25
  import { checkCollateralFunding } from "./bundles/checkCollateralFunding.js";
25
- import { checkDraw } from "./bundles/checkDraw.js";
26
26
  import { checkHealthFactors } from "./bundles/checkHealthFactors.js";
27
+ import { checkIncreaseDebt } from "./bundles/checkIncreaseDebt.js";
28
+ import { checkIncreaseQuota } from "./bundles/checkIncreaseQuota.js";
27
29
  import { checkMarket } from "./bundles/checkMarket.js";
28
30
  import { checkObtained } from "./bundles/checkObtained.js";
29
- import { checkQuotasAsked } from "./bundles/checkQuotasAsked.js";
31
+ import { checkMidasAccountGreenlist } from "./bundles/checkMidasAccountGreenlist.js";
30
32
  import { checkRWAOpenRequirements } from "./bundles/checkRWAOpenRequirements.js";
31
33
  import { checkRWAOpening } from "./bundles/checkRWAOpening.js";
32
34
  import { checkCreditOperation } from "./bundles/checkCreditOperation.js";
@@ -40,4 +42,4 @@ import { checkLiquidation } from "./checkLiquidation.js";
40
42
  import { checkOperation } from "./checkOperation.js";
41
43
  import { checkSimulation } from "./checkSimulation.js";
42
44
  import { raise } from "./raise.js";
43
- export { MIN_HEALTH_FACTOR_FACADE, MIN_HEALTH_FACTOR_FORM, MIN_HF_LIMITED, MIN_SAFE_HEALTH_FACTOR_FORM, amountOf, checkAccountQuotas, checkBorrowLimit, checkCollateralFunding, checkCollateralised, checkCreditAccountFrozen, checkCreditManagerPaused, checkCreditOperation, checkDebtLimits, checkDraw, checkEmergencyLiquidator, checkForbiddenToken, checkHealthFactors, checkLeverage, checkLiquidation, checkLiquidationEligibility, checkLiquidationFunding, checkLiquidatorEligible, checkMarket, checkMarketExpired, checkObtained, checkOperation, checkPoolFunding, checkPoolLiquidity, checkPoolOperation, checkPoolPaused, checkPoolSunset, checkQuotaCount, checkQuotaLimit, checkQuotasAsked, checkRWAOpenRequirements, checkRWAOpening, checkSimulation, checkWallet, checkWalletAllowance, checkWalletBalance, raise, toToken, toTokenAmount };
45
+ export { MIN_HEALTH_FACTOR_FACADE, MIN_HEALTH_FACTOR_FORM, MIN_HF_LIMITED, MIN_SAFE_HEALTH_FACTOR_FORM, amountOf, checkAccountQuotas, checkBorrowLimit, checkCollateralFunding, checkCollateralised, checkCreditAccountFrozen, checkCreditManagerPaused, checkCreditOperation, checkDebtLimits, checkEmergencyLiquidator, checkForbiddenToken, checkHealthFactors, checkIncreaseDebt, checkIncreaseQuota, checkLeverage, checkLiquidation, checkLiquidationEligibility, checkLiquidationFunding, checkLiquidatorEligible, checkMarket, checkMarketExpired, checkMidasAccountGreenlist, checkObtained, checkOperation, checkPoolFunding, checkPoolLiquidity, checkPoolOperation, checkPoolPaused, checkPoolSunset, checkQuotaCount, checkQuotaLimit, checkRWAOpenRequirements, checkRWAOpening, checkReservePriceLimited, checkSimulation, checkWallet, checkWalletAllowance, checkWalletBalance, raise, toToken, toTokenAmount };
@@ -1,5 +1,5 @@
1
1
  import { createRawTx } from "../../../onchain/utils/createRawTx.js";
2
- import { getRawPriceUpdates } from "../../../onchain/market/pricefeeds/getRawPriceUpdates.js";
2
+ import { getRawPriceUpdates } from "../../../onchain/market/pricefeeds/updates/getRawPriceUpdates.js";
3
3
  import { OnchainSDK } from "../../../onchain/OnchainSDK.js";
4
4
  import "../../../onchain/index.js";
5
5
  import "../../deployment/addresses.js";
@@ -1,6 +1,6 @@
1
1
  import { bytes32ToString } from "../../../onchain/utils/bytes32ToString.js";
2
2
  import { priceFeedCompressorAbi } from "../../../abi/compressors/priceFeedCompressor.js";
3
- import { RedstonePriceFeedContract } from "../../../onchain/market/pricefeeds/RedstonePriceFeed.js";
3
+ import { RedstonePriceFeedContract } from "../../../onchain/market/pricefeeds/feeds/RedstonePriceFeed.js";
4
4
  import "../../../onchain/index.js";
5
5
  import { getContract } from "viem";
6
6
  //#region src/permissionless/utils/price-update/get-updatable-feeds.ts