@gearbox-protocol/sdk 18.1.0 → 18.2.0-aave.1

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 (297) hide show
  1. package/dist/cjs/abi/310/iKillSwitchProxy.js +130 -0
  2. package/dist/cjs/abi/compressors/subcompressors/liquidation/treehouseLiquidationSubcompressor.js +179 -0
  3. package/dist/cjs/abi/compressors/subcompressors/withdrawal/treehouseWithdrawalSubcompressor.js +534 -0
  4. package/dist/cjs/abi/router/treehouseWorker.js +885 -0
  5. package/dist/cjs/model/aave.js +1 -0
  6. package/dist/cjs/model/index.js +1 -0
  7. package/dist/cjs/onchain/accounts/intents/index.js +1 -0
  8. package/dist/cjs/onchain/accounts/intents/operations.js +21 -0
  9. package/dist/cjs/onchain/accounts/intents/plan.js +33 -0
  10. package/dist/cjs/onchain/accounts/intents/realize.js +44 -0
  11. package/dist/cjs/onchain/accounts/intents/testing/market.js +1 -0
  12. package/dist/cjs/onchain/accounts/intents/testing/sdk-mock.js +2 -1
  13. package/dist/cjs/onchain/accounts/intents/utils/ledger.js +8 -0
  14. package/dist/cjs/onchain/chain/chains.js +4 -0
  15. package/dist/cjs/onchain/index.js +30 -0
  16. package/dist/cjs/onchain/market/adapters/abi/aave/iAaveHorizonBridge.js +94 -0
  17. package/dist/cjs/onchain/market/adapters/abi/aave/iAaveV3Pool.js +112 -0
  18. package/dist/cjs/onchain/market/adapters/abi/aave/index.js +5 -0
  19. package/dist/cjs/onchain/market/adapters/abi/actionAbi.js +2 -0
  20. package/dist/cjs/onchain/market/adapters/abi/adapters/iAaveHorizonBridgeAdapter.js +197 -0
  21. package/dist/cjs/onchain/market/adapters/abi/adapters/iAaveV3PoolAdapter.js +177 -0
  22. package/dist/cjs/onchain/market/adapters/abi/adapters/iTreehouseFastlaneAdapter.js +113 -0
  23. package/dist/cjs/onchain/market/adapters/abi/adapters/iTreehouseRedemptionGatewayAdapter.js +258 -0
  24. package/dist/cjs/onchain/market/adapters/abi/adapters/iTreehouseRouterAdapter.js +161 -0
  25. package/dist/cjs/onchain/market/adapters/abi/adapters/index.js +10 -0
  26. package/dist/cjs/onchain/market/adapters/abi/conctructorAbi.js +5 -0
  27. package/dist/cjs/onchain/market/adapters/abi/index.js +22 -0
  28. package/dist/cjs/onchain/market/adapters/abi/treehouse/iTreehouseFastlane.js +39 -0
  29. package/dist/cjs/onchain/market/adapters/abi/treehouse/iTreehouseRedemptionGateway.js +230 -0
  30. package/dist/cjs/onchain/market/adapters/abi/treehouse/iTreehouseRouter.js +29 -0
  31. package/dist/cjs/onchain/market/adapters/abi/treehouse/index.js +7 -0
  32. package/dist/cjs/onchain/market/adapters/contracts/AaveHorizonBridgeAdapterContract.js +130 -0
  33. package/dist/cjs/onchain/market/adapters/contracts/AaveV3PoolAdapterContract.js +205 -0
  34. package/dist/cjs/onchain/market/adapters/contracts/AbstractAdapter.js +8 -0
  35. package/dist/cjs/onchain/market/adapters/contracts/TreehouseFastlaneAdapterContract.js +72 -0
  36. package/dist/cjs/onchain/market/adapters/contracts/TreehouseRedemptionGatewayAdapterContract.js +117 -0
  37. package/dist/cjs/onchain/market/adapters/contracts/TreehouseRouterAdapterContract.js +61 -0
  38. package/dist/cjs/onchain/market/adapters/contracts/index.js +10 -0
  39. package/dist/cjs/onchain/market/adapters/createAdapter.js +10 -0
  40. package/dist/cjs/onchain/market/adapters/index.js +30 -0
  41. package/dist/cjs/onchain/market/adapters/types.js +5 -0
  42. package/dist/cjs/onchain/market/index.js +30 -0
  43. package/dist/cjs/onchain/positions/projectAavePosition.js +40 -0
  44. package/dist/cjs/onchain/preview/preview/loadAdapterReplayState.js +17 -0
  45. package/dist/cjs/onchain/preview/preview/previewOperation.js +2 -0
  46. package/dist/cjs/permissionless/api/GearboxPermissionless.js +12 -5
  47. package/dist/cjs/permissionless/api/analytics/PermissionlessAnalytics.js +50 -0
  48. package/dist/cjs/permissionless/api/analytics/index.js +4 -0
  49. package/dist/cjs/permissionless/api/analytics/schemas.js +27 -0
  50. package/dist/cjs/permissionless/api/analytics/types.js +1 -0
  51. package/dist/cjs/permissionless/api/index.js +34 -0
  52. package/dist/cjs/permissionless/api/oracles/PermissionlessOracles.js +715 -27
  53. package/dist/cjs/permissionless/api/oracles/enrich.js +99 -0
  54. package/dist/cjs/permissionless/api/oracles/index.js +33 -0
  55. package/dist/cjs/permissionless/api/oracles/onchain-feed.js +25 -0
  56. package/dist/cjs/permissionless/api/oracles/schemas.js +119 -16
  57. package/dist/cjs/permissionless/api/oracles/score/formula.js +56 -0
  58. package/dist/cjs/permissionless/api/oracles/score/index.js +11 -0
  59. package/dist/cjs/permissionless/api/oracles/score/run.js +252 -0
  60. package/dist/cjs/permissionless/api/oracles/score/types.js +1 -0
  61. package/dist/cjs/permissionless/api/oracles/stress/classify.js +258 -0
  62. package/dist/cjs/permissionless/api/oracles/stress/index.js +24 -0
  63. package/dist/cjs/permissionless/api/oracles/stress/override.js +125 -0
  64. package/dist/cjs/permissionless/api/oracles/stress/run.js +485 -0
  65. package/dist/cjs/permissionless/api/oracles/stress/score.js +98 -0
  66. package/dist/cjs/permissionless/api/oracles/stress/types.js +1 -0
  67. package/dist/cjs/permissionless/api/schemas.js +0 -3
  68. package/dist/cjs/permissionless/api/transactions/InstanceOwnerTransactions.js +14 -3
  69. package/dist/cjs/permissionless/api/transactions/lp-price-feeds.js +10 -4
  70. package/dist/cjs/permissionless/bindings/bytecode-repository.js +8 -0
  71. package/dist/cjs/permissionless/bindings/governance/governor.js +1 -1
  72. package/dist/cjs/permissionless/bindings/index.js +8 -3
  73. package/dist/cjs/permissionless/bindings/kill-switch-proxy.js +188 -0
  74. package/dist/cjs/permissionless/bindings/market-configurator-factory.js +39 -1
  75. package/dist/cjs/permissionless/bindings/market-configurator.js +142 -0
  76. package/dist/cjs/permissionless/index.js +44 -3
  77. package/dist/cjs/permissionless/utils/index.js +3 -0
  78. package/dist/cjs/permissionless/utils/literals.js +2 -0
  79. package/dist/cjs/permissionless/utils/price-update/get-prices.js +64 -0
  80. package/dist/cjs/permissionless/utils/price-update/index.js +2 -0
  81. package/dist/cjs/sdk/prepare/PrepareApi.js +39 -0
  82. package/dist/cjs/sdk/preview/PreviewNamespace.js +33 -0
  83. package/dist/cjs/testnets/TestnetsAPI.js +179 -0
  84. package/dist/cjs/testnets/errors/TestnetNotFoundError.js +15 -0
  85. package/dist/cjs/testnets/errors/TestnetRequestFailedError.js +24 -0
  86. package/dist/cjs/testnets/errors/TestnetStatusError.js +19 -0
  87. package/dist/cjs/testnets/errors/TestnetValidationError.js +24 -0
  88. package/dist/cjs/testnets/errors/TestnetWaitTimeoutError.js +30 -0
  89. package/dist/cjs/testnets/errors/TestnetsError.js +34 -0
  90. package/dist/cjs/testnets/errors/index.js +13 -0
  91. package/dist/cjs/testnets/index.js +32 -0
  92. package/dist/cjs/testnets/package.json +1 -0
  93. package/dist/cjs/testnets/schemas.js +242 -0
  94. package/dist/cjs/testnets/types.js +1 -0
  95. package/dist/esm/abi/310/iKillSwitchProxy.js +129 -0
  96. package/dist/esm/abi/compressors/subcompressors/liquidation/treehouseLiquidationSubcompressor.js +178 -0
  97. package/dist/esm/abi/compressors/subcompressors/withdrawal/treehouseWithdrawalSubcompressor.js +533 -0
  98. package/dist/esm/abi/router/treehouseWorker.js +884 -0
  99. package/dist/esm/model/aave.js +1 -0
  100. package/dist/esm/model/index.js +1 -0
  101. package/dist/esm/onchain/accounts/intents/index.js +2 -1
  102. package/dist/esm/onchain/accounts/intents/operations.js +20 -1
  103. package/dist/esm/onchain/accounts/intents/plan.js +33 -1
  104. package/dist/esm/onchain/accounts/intents/realize.js +46 -2
  105. package/dist/esm/onchain/accounts/intents/testing/market.js +1 -0
  106. package/dist/esm/onchain/accounts/intents/testing/sdk-mock.js +2 -1
  107. package/dist/esm/onchain/accounts/intents/utils/ledger.js +8 -0
  108. package/dist/esm/onchain/chain/chains.js +4 -0
  109. package/dist/esm/onchain/index.js +16 -1
  110. package/dist/esm/onchain/market/adapters/abi/aave/iAaveHorizonBridge.js +93 -0
  111. package/dist/esm/onchain/market/adapters/abi/aave/iAaveV3Pool.js +111 -0
  112. package/dist/esm/onchain/market/adapters/abi/aave/index.js +3 -0
  113. package/dist/esm/onchain/market/adapters/abi/actionAbi.js +2 -0
  114. package/dist/esm/onchain/market/adapters/abi/adapters/iAaveHorizonBridgeAdapter.js +196 -0
  115. package/dist/esm/onchain/market/adapters/abi/adapters/iAaveV3PoolAdapter.js +176 -0
  116. package/dist/esm/onchain/market/adapters/abi/adapters/iTreehouseFastlaneAdapter.js +112 -0
  117. package/dist/esm/onchain/market/adapters/abi/adapters/iTreehouseRedemptionGatewayAdapter.js +257 -0
  118. package/dist/esm/onchain/market/adapters/abi/adapters/iTreehouseRouterAdapter.js +160 -0
  119. package/dist/esm/onchain/market/adapters/abi/adapters/index.js +6 -1
  120. package/dist/esm/onchain/market/adapters/abi/conctructorAbi.js +5 -0
  121. package/dist/esm/onchain/market/adapters/abi/index.js +13 -1
  122. package/dist/esm/onchain/market/adapters/abi/treehouse/iTreehouseFastlane.js +38 -0
  123. package/dist/esm/onchain/market/adapters/abi/treehouse/iTreehouseRedemptionGateway.js +229 -0
  124. package/dist/esm/onchain/market/adapters/abi/treehouse/iTreehouseRouter.js +28 -0
  125. package/dist/esm/onchain/market/adapters/abi/treehouse/index.js +4 -0
  126. package/dist/esm/onchain/market/adapters/contracts/AaveHorizonBridgeAdapterContract.js +129 -0
  127. package/dist/esm/onchain/market/adapters/contracts/AaveV3PoolAdapterContract.js +204 -0
  128. package/dist/esm/onchain/market/adapters/contracts/AbstractAdapter.js +8 -0
  129. package/dist/esm/onchain/market/adapters/contracts/TreehouseFastlaneAdapterContract.js +71 -0
  130. package/dist/esm/onchain/market/adapters/contracts/TreehouseRedemptionGatewayAdapterContract.js +116 -0
  131. package/dist/esm/onchain/market/adapters/contracts/TreehouseRouterAdapterContract.js +60 -0
  132. package/dist/esm/onchain/market/adapters/contracts/index.js +6 -1
  133. package/dist/esm/onchain/market/adapters/createAdapter.js +10 -0
  134. package/dist/esm/onchain/market/adapters/index.js +16 -1
  135. package/dist/esm/onchain/market/adapters/types.js +5 -0
  136. package/dist/esm/onchain/market/index.js +16 -1
  137. package/dist/esm/onchain/positions/projectAavePosition.js +39 -0
  138. package/dist/esm/onchain/preview/preview/loadAdapterReplayState.js +16 -0
  139. package/dist/esm/onchain/preview/preview/previewOperation.js +2 -0
  140. package/dist/esm/permissionless/api/GearboxPermissionless.js +12 -5
  141. package/dist/esm/permissionless/api/analytics/PermissionlessAnalytics.js +49 -0
  142. package/dist/esm/permissionless/api/analytics/index.js +2 -0
  143. package/dist/esm/permissionless/api/analytics/schemas.js +25 -0
  144. package/dist/esm/permissionless/api/analytics/types.js +1 -0
  145. package/dist/esm/permissionless/api/index.js +9 -1
  146. package/dist/esm/permissionless/api/oracles/PermissionlessOracles.js +717 -29
  147. package/dist/esm/permissionless/api/oracles/enrich.js +94 -0
  148. package/dist/esm/permissionless/api/oracles/index.js +10 -1
  149. package/dist/esm/permissionless/api/oracles/onchain-feed.js +24 -0
  150. package/dist/esm/permissionless/api/oracles/schemas.js +109 -17
  151. package/dist/esm/permissionless/api/oracles/score/formula.js +51 -0
  152. package/dist/esm/permissionless/api/oracles/score/index.js +4 -0
  153. package/dist/esm/permissionless/api/oracles/score/run.js +250 -0
  154. package/dist/esm/permissionless/api/oracles/score/types.js +1 -0
  155. package/dist/esm/permissionless/api/oracles/stress/classify.js +256 -0
  156. package/dist/esm/permissionless/api/oracles/stress/index.js +6 -0
  157. package/dist/esm/permissionless/api/oracles/stress/override.js +119 -0
  158. package/dist/esm/permissionless/api/oracles/stress/run.js +478 -0
  159. package/dist/esm/permissionless/api/oracles/stress/score.js +95 -0
  160. package/dist/esm/permissionless/api/oracles/stress/types.js +1 -0
  161. package/dist/esm/permissionless/api/schemas.js +2 -4
  162. package/dist/esm/permissionless/api/transactions/InstanceOwnerTransactions.js +14 -3
  163. package/dist/esm/permissionless/api/transactions/lp-price-feeds.js +10 -4
  164. package/dist/esm/permissionless/bindings/bytecode-repository.js +8 -0
  165. package/dist/esm/permissionless/bindings/governance/governor.js +1 -1
  166. package/dist/esm/permissionless/bindings/index.js +5 -4
  167. package/dist/esm/permissionless/bindings/kill-switch-proxy.js +184 -0
  168. package/dist/esm/permissionless/bindings/market-configurator-factory.js +37 -0
  169. package/dist/esm/permissionless/bindings/market-configurator.js +143 -1
  170. package/dist/esm/permissionless/index.js +14 -6
  171. package/dist/esm/permissionless/utils/index.js +3 -3
  172. package/dist/esm/permissionless/utils/literals.js +2 -1
  173. package/dist/esm/permissionless/utils/price-update/get-prices.js +63 -1
  174. package/dist/esm/permissionless/utils/price-update/index.js +2 -2
  175. package/dist/esm/sdk/GearboxSDK.js +2 -2
  176. package/dist/esm/sdk/prepare/PrepareApi.js +39 -0
  177. package/dist/esm/sdk/preview/PreviewNamespace.js +33 -0
  178. package/dist/esm/testnets/TestnetsAPI.js +178 -0
  179. package/dist/esm/testnets/errors/TestnetNotFoundError.js +14 -0
  180. package/dist/esm/testnets/errors/TestnetRequestFailedError.js +23 -0
  181. package/dist/esm/testnets/errors/TestnetStatusError.js +18 -0
  182. package/dist/esm/testnets/errors/TestnetValidationError.js +23 -0
  183. package/dist/esm/testnets/errors/TestnetWaitTimeoutError.js +29 -0
  184. package/dist/esm/testnets/errors/TestnetsError.js +33 -0
  185. package/dist/esm/testnets/errors/index.js +7 -0
  186. package/dist/esm/testnets/index.js +11 -0
  187. package/dist/esm/testnets/package.json +1 -0
  188. package/dist/esm/testnets/schemas.js +228 -0
  189. package/dist/esm/testnets/types.js +1 -0
  190. package/dist/types/abi/310/iKillSwitchProxy.d.ts +114 -0
  191. package/dist/types/abi/compressors/subcompressors/liquidation/treehouseLiquidationSubcompressor.d.ts +148 -0
  192. package/dist/types/abi/compressors/subcompressors/withdrawal/treehouseWithdrawalSubcompressor.d.ts +440 -0
  193. package/dist/types/abi/router/treehouseWorker.d.ts +728 -0
  194. package/dist/types/model/aave.d.ts +32 -0
  195. package/dist/types/model/analytics.d.ts +2 -2
  196. package/dist/types/model/index.d.ts +6 -5
  197. package/dist/types/model/opportunities.d.ts +1 -1
  198. package/dist/types/model/positions.d.ts +1 -1
  199. package/dist/types/model/previews.d.ts +15 -0
  200. package/dist/types/offchain/AbstractOffchainNamespace.d.ts +1 -1
  201. package/dist/types/offchain/analytics/OffchainAnalytics.d.ts +1 -1
  202. package/dist/types/offchain/analytics/types.d.ts +1 -1
  203. package/dist/types/offchain/opportunities/OffchainOpportunities.d.ts +1 -1
  204. package/dist/types/offchain/opportunities/types.d.ts +1 -1
  205. package/dist/types/offchain/positions/OffchainPositions.d.ts +1 -1
  206. package/dist/types/offchain/positions/types.d.ts +1 -1
  207. package/dist/types/onchain/accounts/intents/operations.d.ts +37 -1
  208. package/dist/types/onchain/accounts/intents/plan.d.ts +26 -1
  209. package/dist/types/onchain/accounts/intents/testing/market.d.ts +4 -0
  210. package/dist/types/onchain/accounts/intents/testing/sdk-mock.d.ts +4 -0
  211. package/dist/types/onchain/accounts/intents/types.d.ts +20 -1
  212. package/dist/types/onchain/index.d.ts +16 -1
  213. package/dist/types/onchain/market/adapters/abi/aave/iAaveHorizonBridge.d.ts +83 -0
  214. package/dist/types/onchain/market/adapters/abi/aave/iAaveV3Pool.d.ts +90 -0
  215. package/dist/types/onchain/market/adapters/abi/aave/index.d.ts +3 -0
  216. package/dist/types/onchain/market/adapters/abi/adapters/iAaveHorizonBridgeAdapter.d.ts +186 -0
  217. package/dist/types/onchain/market/adapters/abi/adapters/iAaveV3PoolAdapter.d.ts +172 -0
  218. package/dist/types/onchain/market/adapters/abi/adapters/iTreehouseFastlaneAdapter.d.ts +101 -0
  219. package/dist/types/onchain/market/adapters/abi/adapters/iTreehouseRedemptionGatewayAdapter.d.ts +237 -0
  220. package/dist/types/onchain/market/adapters/abi/adapters/iTreehouseRouterAdapter.d.ts +146 -0
  221. package/dist/types/onchain/market/adapters/abi/adapters/index.d.ts +6 -1
  222. package/dist/types/onchain/market/adapters/abi/index.d.ts +13 -1
  223. package/dist/types/onchain/market/adapters/abi/treehouse/iTreehouseFastlane.d.ts +33 -0
  224. package/dist/types/onchain/market/adapters/abi/treehouse/iTreehouseRedemptionGateway.d.ts +207 -0
  225. package/dist/types/onchain/market/adapters/abi/treehouse/iTreehouseRouter.d.ts +27 -0
  226. package/dist/types/onchain/market/adapters/abi/treehouse/index.d.ts +4 -0
  227. package/dist/types/onchain/market/adapters/contracts/AaveHorizonBridgeAdapterContract.d.ts +312 -0
  228. package/dist/types/onchain/market/adapters/contracts/AaveV3PoolAdapterContract.d.ts +312 -0
  229. package/dist/types/onchain/market/adapters/contracts/AbstractAdapter.d.ts +8 -0
  230. package/dist/types/onchain/market/adapters/contracts/TreehouseFastlaneAdapterContract.d.ts +156 -0
  231. package/dist/types/onchain/market/adapters/contracts/TreehouseRedemptionGatewayAdapterContract.d.ts +481 -0
  232. package/dist/types/onchain/market/adapters/contracts/TreehouseRouterAdapterContract.d.ts +193 -0
  233. package/dist/types/onchain/market/adapters/contracts/index.d.ts +6 -1
  234. package/dist/types/onchain/market/adapters/index.d.ts +16 -1
  235. package/dist/types/onchain/market/adapters/types.d.ts +6 -1
  236. package/dist/types/onchain/market/index.d.ts +16 -1
  237. package/dist/types/onchain/positions/projectAavePosition.d.ts +16 -0
  238. package/dist/types/onchain/preview/preview/loadAdapterReplayState.d.ts +13 -0
  239. package/dist/types/permissionless/api/GearboxPermissionless.d.ts +11 -5
  240. package/dist/types/permissionless/api/analytics/PermissionlessAnalytics.d.ts +38 -0
  241. package/dist/types/permissionless/api/analytics/index.d.ts +3 -0
  242. package/dist/types/permissionless/api/analytics/schemas.d.ts +32 -0
  243. package/dist/types/permissionless/api/analytics/types.d.ts +38 -0
  244. package/dist/types/permissionless/api/index.d.ts +13 -2
  245. package/dist/types/permissionless/api/oracles/PermissionlessOracles.d.ts +303 -22
  246. package/dist/types/permissionless/api/oracles/enrich.d.ts +59 -0
  247. package/dist/types/permissionless/api/oracles/index.d.ts +12 -2
  248. package/dist/types/permissionless/api/oracles/onchain-feed.d.ts +15 -0
  249. package/dist/types/permissionless/api/oracles/schemas.d.ts +249 -7
  250. package/dist/types/permissionless/api/oracles/score/formula.d.ts +36 -0
  251. package/dist/types/permissionless/api/oracles/score/index.d.ts +4 -0
  252. package/dist/types/permissionless/api/oracles/score/run.d.ts +42 -0
  253. package/dist/types/permissionless/api/oracles/score/types.d.ts +118 -0
  254. package/dist/types/permissionless/api/oracles/stress/classify.d.ts +57 -0
  255. package/dist/types/permissionless/api/oracles/stress/index.d.ts +6 -0
  256. package/dist/types/permissionless/api/oracles/stress/override.d.ts +59 -0
  257. package/dist/types/permissionless/api/oracles/stress/run.d.ts +100 -0
  258. package/dist/types/permissionless/api/oracles/stress/score.d.ts +57 -0
  259. package/dist/types/permissionless/api/oracles/stress/types.d.ts +272 -0
  260. package/dist/types/permissionless/api/oracles/types.d.ts +468 -22
  261. package/dist/types/permissionless/api/schemas.d.ts +0 -2
  262. package/dist/types/permissionless/api/transactions/lp-price-feeds.d.ts +9 -1
  263. package/dist/types/permissionless/bindings/bytecode-repository.d.ts +10 -1
  264. package/dist/types/permissionless/bindings/index.d.ts +4 -3
  265. package/dist/types/permissionless/bindings/kill-switch-proxy.d.ts +205 -0
  266. package/dist/types/permissionless/bindings/market-configurator-factory.d.ts +30 -0
  267. package/dist/types/permissionless/bindings/market-configurator.d.ts +30 -1
  268. package/dist/types/permissionless/bindings/types.d.ts +27 -0
  269. package/dist/types/permissionless/index.d.ts +17 -6
  270. package/dist/types/permissionless/utils/index.d.ts +3 -3
  271. package/dist/types/permissionless/utils/literals.d.ts +1 -0
  272. package/dist/types/permissionless/utils/price-update/get-prices.d.ts +33 -0
  273. package/dist/types/permissionless/utils/price-update/index.d.ts +2 -2
  274. package/dist/types/sdk/analytics/AnalyticsNamespace.d.ts +1 -1
  275. package/dist/types/sdk/analytics/types.d.ts +1 -1
  276. package/dist/types/sdk/index.d.ts +2 -2
  277. package/dist/types/sdk/opportunities/OpportunitiesNamespace.d.ts +1 -1
  278. package/dist/types/sdk/opportunities/types.d.ts +1 -1
  279. package/dist/types/sdk/positions/PositionsNamespace.d.ts +1 -1
  280. package/dist/types/sdk/positions/types.d.ts +1 -1
  281. package/dist/types/sdk/prepare/PrepareApi.d.ts +11 -3
  282. package/dist/types/sdk/prepare/index.d.ts +2 -2
  283. package/dist/types/sdk/prepare/types.d.ts +56 -1
  284. package/dist/types/sdk/preview/PreviewNamespace.d.ts +5 -1
  285. package/dist/types/sdk/preview/types.d.ts +10 -1
  286. package/dist/types/testnets/TestnetsAPI.d.ts +108 -0
  287. package/dist/types/testnets/errors/TestnetNotFoundError.d.ts +12 -0
  288. package/dist/types/testnets/errors/TestnetRequestFailedError.d.ts +11 -0
  289. package/dist/types/testnets/errors/TestnetStatusError.d.ts +15 -0
  290. package/dist/types/testnets/errors/TestnetValidationError.d.ts +16 -0
  291. package/dist/types/testnets/errors/TestnetWaitTimeoutError.d.ts +21 -0
  292. package/dist/types/testnets/errors/TestnetsError.d.ts +47 -0
  293. package/dist/types/testnets/errors/index.d.ts +7 -0
  294. package/dist/types/testnets/index.d.ts +11 -0
  295. package/dist/types/testnets/schemas.d.ts +554 -0
  296. package/dist/types/testnets/types.d.ts +717 -0
  297. package/package.json +9 -3
@@ -17,7 +17,18 @@ export declare const priceFeedSchema: z.ZodObject<{
17
17
  stalenessPeriod: z.ZodNumber;
18
18
  name: z.ZodString;
19
19
  }, z.core.$loose>;
20
- /** {@link PermissionlessAsset} */
20
+ /**
21
+ * {@link PermissionlessPriceFeedAsset}
22
+ *
23
+ * What identifies an asset, which is all a feed's own listing of one says.
24
+ **/
25
+ export declare const priceFeedAssetSchema: z.ZodObject<{
26
+ address: z.ZodCustom<`0x${string}`, `0x${string}`>;
27
+ symbol: z.ZodString;
28
+ name: z.ZodString;
29
+ decimals: z.ZodNumber;
30
+ }, z.core.$loose>;
31
+ /** {@link PermissionlessAsset} — identified as above, plus what prices it. */
21
32
  export declare const assetSchema: z.ZodObject<{
22
33
  address: z.ZodCustom<`0x${string}`, `0x${string}`>;
23
34
  symbol: z.ZodString;
@@ -33,7 +44,12 @@ export declare const assetSchema: z.ZodObject<{
33
44
  name: z.ZodString;
34
45
  }, z.core.$loose>>;
35
46
  }, z.core.$loose>;
36
- /** {@link PermissionlessPriceFeedStore} */
47
+ /**
48
+ * {@link PermissionlessPriceFeedStore}
49
+ *
50
+ * A store is a chain's, and is described by the same five fields the chain
51
+ * list answers with, so those are extended rather than restated.
52
+ **/
37
53
  export declare const priceFeedStoreSchema: z.ZodObject<{
38
54
  chainId: z.ZodNumber;
39
55
  name: z.ZodString;
@@ -64,10 +80,236 @@ export declare const priceFeedStoreSchema: z.ZodObject<{
64
80
  name: z.ZodString;
65
81
  }, z.core.$loose>>;
66
82
  }, z.core.$loose>;
67
- /** {@link PermissionlessPrices} */
68
- export declare const pricesSchema: z.ZodObject<{
69
- prices: z.ZodType<Record<`0x${string}`, string | null>, unknown, z.core.$ZodTypeInternals<Record<`0x${string}`, string | null>, unknown>>;
70
- marketCaps: z.ZodType<Record<`0x${string}`, Record<`0x${string}`, string | null>>, unknown, z.core.$ZodTypeInternals<Record<`0x${string}`, Record<`0x${string}`, string | null>>, unknown>>;
71
- time: z.ZodNumber;
83
+ /** Every chain's {@link PermissionlessPriceFeedStore}, one per chain. */
84
+ export declare const priceFeedStoresSchema: z.ZodArray<z.ZodObject<{
85
+ chainId: z.ZodNumber;
86
+ name: z.ZodString;
87
+ isPublic: z.ZodBoolean;
88
+ isActivated: z.ZodBoolean;
89
+ explorerUrl: z.ZodString;
90
+ assets: z.ZodArray<z.ZodObject<{
91
+ address: z.ZodCustom<`0x${string}`, `0x${string}`>;
92
+ symbol: z.ZodString;
93
+ name: z.ZodString;
94
+ decimals: z.ZodNumber;
95
+ owner: z.ZodCustom<`0x${string}`, `0x${string}`>;
96
+ priceFeeds: z.ZodArray<z.ZodObject<{
97
+ address: z.ZodCustom<`0x${string}`, `0x${string}`>;
98
+ contractType: z.ZodString;
99
+ version: z.ZodNumber;
100
+ deployedBy: z.ZodCustom<`0x${string}`, `0x${string}`>;
101
+ stalenessPeriod: z.ZodNumber;
102
+ name: z.ZodString;
103
+ }, z.core.$loose>>;
104
+ }, z.core.$loose>>;
105
+ priceFeeds: z.ZodArray<z.ZodObject<{
106
+ address: z.ZodCustom<`0x${string}`, `0x${string}`>;
107
+ contractType: z.ZodString;
108
+ version: z.ZodNumber;
109
+ deployedBy: z.ZodCustom<`0x${string}`, `0x${string}`>;
110
+ stalenessPeriod: z.ZodNumber;
111
+ name: z.ZodString;
112
+ }, z.core.$loose>>;
113
+ }, z.core.$loose>>;
114
+ /**
115
+ * {@link PermissionlessIndexedPriceFeedMarket} — the market as the feed's slot
116
+ * in it, before the oracle is asked what period it holds for the slot.
117
+ **/
118
+ export declare const priceFeedMarketSchema: z.ZodObject<{
119
+ market: z.ZodCustom<`0x${string}`, `0x${string}`>;
120
+ marketConfigurator: z.ZodCustom<`0x${string}`, `0x${string}`>;
121
+ curatorName: z.ZodNullable<z.ZodString>;
122
+ marketName: z.ZodNullable<z.ZodString>;
123
+ underlyingSymbol: z.ZodNullable<z.ZodString>;
124
+ isUnderlying: z.ZodBoolean;
125
+ quotaLimit: z.ZodNullable<z.ZodNumber>;
126
+ quotaUsed: z.ZodNullable<z.ZodNumber>;
127
+ token: z.ZodCustom<`0x${string}`, `0x${string}`>;
128
+ tokenSymbol: z.ZodNullable<z.ZodString>;
129
+ reserve: z.ZodBoolean;
130
+ priceOracle: z.ZodCustom<`0x${string}`, `0x${string}`>;
131
+ }, z.core.$loose>;
132
+ /**
133
+ * {@link PermissionlessMarketSlot} — the same slot read from the chain's end,
134
+ * so the feed is a column rather than what was asked for.
135
+ **/
136
+ export declare const marketSlotSchema: z.ZodObject<{
137
+ market: z.ZodCustom<`0x${string}`, `0x${string}`>;
138
+ marketConfigurator: z.ZodCustom<`0x${string}`, `0x${string}`>;
139
+ curatorName: z.ZodNullable<z.ZodString>;
140
+ marketName: z.ZodNullable<z.ZodString>;
141
+ underlyingSymbol: z.ZodNullable<z.ZodString>;
142
+ isUnderlying: z.ZodBoolean;
143
+ quotaLimit: z.ZodNullable<z.ZodNumber>;
144
+ quotaUsed: z.ZodNullable<z.ZodNumber>;
145
+ token: z.ZodCustom<`0x${string}`, `0x${string}`>;
146
+ tokenSymbol: z.ZodNullable<z.ZodString>;
147
+ reserve: z.ZodBoolean;
148
+ priceOracle: z.ZodCustom<`0x${string}`, `0x${string}`>;
149
+ chainId: z.ZodNumber;
150
+ underlyingToken: z.ZodCustom<`0x${string}`, `0x${string}`>;
151
+ isShutdown: z.ZodBoolean;
152
+ priceFeed: z.ZodCustom<`0x${string}`, `0x${string}`>;
153
+ priceFeedName: z.ZodNullable<z.ZodString>;
154
+ priceFeedInStore: z.ZodBoolean;
155
+ underlyingPriceFeed: z.ZodNullable<z.ZodCustom<`0x${string}`, `0x${string}`>>;
72
156
  }, z.core.$loose>;
157
+ /** Every slot in scope, across whichever chains the read covered. */
158
+ export declare const marketSlotsSchema: z.ZodArray<z.ZodObject<{
159
+ market: z.ZodCustom<`0x${string}`, `0x${string}`>;
160
+ marketConfigurator: z.ZodCustom<`0x${string}`, `0x${string}`>;
161
+ curatorName: z.ZodNullable<z.ZodString>;
162
+ marketName: z.ZodNullable<z.ZodString>;
163
+ underlyingSymbol: z.ZodNullable<z.ZodString>;
164
+ isUnderlying: z.ZodBoolean;
165
+ quotaLimit: z.ZodNullable<z.ZodNumber>;
166
+ quotaUsed: z.ZodNullable<z.ZodNumber>;
167
+ token: z.ZodCustom<`0x${string}`, `0x${string}`>;
168
+ tokenSymbol: z.ZodNullable<z.ZodString>;
169
+ reserve: z.ZodBoolean;
170
+ priceOracle: z.ZodCustom<`0x${string}`, `0x${string}`>;
171
+ chainId: z.ZodNumber;
172
+ underlyingToken: z.ZodCustom<`0x${string}`, `0x${string}`>;
173
+ isShutdown: z.ZodBoolean;
174
+ priceFeed: z.ZodCustom<`0x${string}`, `0x${string}`>;
175
+ priceFeedName: z.ZodNullable<z.ZodString>;
176
+ priceFeedInStore: z.ZodBoolean;
177
+ underlyingPriceFeed: z.ZodNullable<z.ZodCustom<`0x${string}`, `0x${string}`>>;
178
+ }, z.core.$loose>>;
179
+ /** {@link PermissionlessIndexedPriceFeedDetails} */
180
+ export declare const priceFeedDetailsSchema: z.ZodObject<{
181
+ chainId: z.ZodNumber;
182
+ priceFeed: z.ZodObject<{
183
+ address: z.ZodCustom<`0x${string}`, `0x${string}`>;
184
+ contractType: z.ZodString;
185
+ version: z.ZodNumber;
186
+ deployedBy: z.ZodCustom<`0x${string}`, `0x${string}`>;
187
+ stalenessPeriod: z.ZodNumber;
188
+ name: z.ZodString;
189
+ }, z.core.$loose>;
190
+ assets: z.ZodArray<z.ZodObject<{
191
+ address: z.ZodCustom<`0x${string}`, `0x${string}`>;
192
+ symbol: z.ZodString;
193
+ name: z.ZodString;
194
+ decimals: z.ZodNumber;
195
+ }, z.core.$loose>>;
196
+ markets: z.ZodArray<z.ZodObject<{
197
+ market: z.ZodCustom<`0x${string}`, `0x${string}`>;
198
+ marketConfigurator: z.ZodCustom<`0x${string}`, `0x${string}`>;
199
+ curatorName: z.ZodNullable<z.ZodString>;
200
+ marketName: z.ZodNullable<z.ZodString>;
201
+ underlyingSymbol: z.ZodNullable<z.ZodString>;
202
+ isUnderlying: z.ZodBoolean;
203
+ quotaLimit: z.ZodNullable<z.ZodNumber>;
204
+ quotaUsed: z.ZodNullable<z.ZodNumber>;
205
+ token: z.ZodCustom<`0x${string}`, `0x${string}`>;
206
+ tokenSymbol: z.ZodNullable<z.ZodString>;
207
+ reserve: z.ZodBoolean;
208
+ priceOracle: z.ZodCustom<`0x${string}`, `0x${string}`>;
209
+ }, z.core.$loose>>;
210
+ }, z.core.$loose>;
211
+ /** {@link PermissionlessAssetMarketFeed} */
212
+ export declare const assetMarketFeedSchema: z.ZodObject<{
213
+ address: z.ZodCustom<`0x${string}`, `0x${string}`>;
214
+ name: z.ZodNullable<z.ZodString>;
215
+ inStore: z.ZodBoolean;
216
+ }, z.core.$loose>;
217
+ /** {@link PermissionlessAssetMarket} — the market as what prices the asset in it. */
218
+ export declare const assetMarketSchema: z.ZodObject<{
219
+ market: z.ZodCustom<`0x${string}`, `0x${string}`>;
220
+ marketConfigurator: z.ZodCustom<`0x${string}`, `0x${string}`>;
221
+ curatorName: z.ZodNullable<z.ZodString>;
222
+ marketName: z.ZodNullable<z.ZodString>;
223
+ underlyingSymbol: z.ZodNullable<z.ZodString>;
224
+ isUnderlying: z.ZodBoolean;
225
+ quotaLimit: z.ZodNullable<z.ZodNumber>;
226
+ quotaUsed: z.ZodNullable<z.ZodNumber>;
227
+ underlyingToken: z.ZodCustom<`0x${string}`, `0x${string}`>;
228
+ underlyingPriceFeed: z.ZodNullable<z.ZodCustom<`0x${string}`, `0x${string}`>>;
229
+ isShutdown: z.ZodBoolean;
230
+ mainFeed: z.ZodNullable<z.ZodObject<{
231
+ address: z.ZodCustom<`0x${string}`, `0x${string}`>;
232
+ name: z.ZodNullable<z.ZodString>;
233
+ inStore: z.ZodBoolean;
234
+ }, z.core.$loose>>;
235
+ reserveFeed: z.ZodNullable<z.ZodObject<{
236
+ address: z.ZodCustom<`0x${string}`, `0x${string}`>;
237
+ name: z.ZodNullable<z.ZodString>;
238
+ inStore: z.ZodBoolean;
239
+ }, z.core.$loose>>;
240
+ }, z.core.$loose>;
241
+ /** {@link PermissionlessIndexedAssetDetails} */
242
+ export declare const assetDetailsSchema: z.ZodObject<{
243
+ chainId: z.ZodNumber;
244
+ asset: z.ZodObject<{
245
+ address: z.ZodCustom<`0x${string}`, `0x${string}`>;
246
+ symbol: z.ZodString;
247
+ name: z.ZodString;
248
+ decimals: z.ZodNumber;
249
+ }, z.core.$loose>;
250
+ priceFeeds: z.ZodArray<z.ZodObject<{
251
+ address: z.ZodCustom<`0x${string}`, `0x${string}`>;
252
+ contractType: z.ZodString;
253
+ version: z.ZodNumber;
254
+ deployedBy: z.ZodCustom<`0x${string}`, `0x${string}`>;
255
+ stalenessPeriod: z.ZodNumber;
256
+ name: z.ZodString;
257
+ }, z.core.$loose>>;
258
+ markets: z.ZodArray<z.ZodObject<{
259
+ market: z.ZodCustom<`0x${string}`, `0x${string}`>;
260
+ marketConfigurator: z.ZodCustom<`0x${string}`, `0x${string}`>;
261
+ curatorName: z.ZodNullable<z.ZodString>;
262
+ marketName: z.ZodNullable<z.ZodString>;
263
+ underlyingSymbol: z.ZodNullable<z.ZodString>;
264
+ isUnderlying: z.ZodBoolean;
265
+ quotaLimit: z.ZodNullable<z.ZodNumber>;
266
+ quotaUsed: z.ZodNullable<z.ZodNumber>;
267
+ underlyingToken: z.ZodCustom<`0x${string}`, `0x${string}`>;
268
+ underlyingPriceFeed: z.ZodNullable<z.ZodCustom<`0x${string}`, `0x${string}`>>;
269
+ isShutdown: z.ZodBoolean;
270
+ mainFeed: z.ZodNullable<z.ZodObject<{
271
+ address: z.ZodCustom<`0x${string}`, `0x${string}`>;
272
+ name: z.ZodNullable<z.ZodString>;
273
+ inStore: z.ZodBoolean;
274
+ }, z.core.$loose>>;
275
+ reserveFeed: z.ZodNullable<z.ZodObject<{
276
+ address: z.ZodCustom<`0x${string}`, `0x${string}`>;
277
+ name: z.ZodNullable<z.ZodString>;
278
+ inStore: z.ZodBoolean;
279
+ }, z.core.$loose>>;
280
+ }, z.core.$loose>>;
281
+ }, z.core.$loose>;
282
+ /** {@link PermissionlessAssetQuota} */
283
+ export declare const assetQuotaSchema: z.ZodObject<{
284
+ quotaLimit: z.ZodNullable<z.ZodNumber>;
285
+ quotaUsed: z.ZodNullable<z.ZodNumber>;
286
+ isShutdown: z.ZodBoolean;
287
+ underlyingPriceFeed: z.ZodNullable<z.ZodCustom<`0x${string}`, `0x${string}`>>;
288
+ }, z.core.$loose>;
289
+ /** {@link PermissionlessIndexedAssetSummary} */
290
+ export declare const assetSummarySchema: z.ZodObject<{
291
+ chainId: z.ZodNumber;
292
+ address: z.ZodCustom<`0x${string}`, `0x${string}`>;
293
+ symbol: z.ZodString;
294
+ underlyingMarketCount: z.ZodNumber;
295
+ marketQuotas: z.ZodArray<z.ZodObject<{
296
+ quotaLimit: z.ZodNullable<z.ZodNumber>;
297
+ quotaUsed: z.ZodNullable<z.ZodNumber>;
298
+ isShutdown: z.ZodBoolean;
299
+ underlyingPriceFeed: z.ZodNullable<z.ZodCustom<`0x${string}`, `0x${string}`>>;
300
+ }, z.core.$loose>>;
301
+ }, z.core.$loose>;
302
+ /** The list of {@link PermissionlessAssetSummary}, already ordered. */
303
+ export declare const assetSummariesSchema: z.ZodArray<z.ZodObject<{
304
+ chainId: z.ZodNumber;
305
+ address: z.ZodCustom<`0x${string}`, `0x${string}`>;
306
+ symbol: z.ZodString;
307
+ underlyingMarketCount: z.ZodNumber;
308
+ marketQuotas: z.ZodArray<z.ZodObject<{
309
+ quotaLimit: z.ZodNullable<z.ZodNumber>;
310
+ quotaUsed: z.ZodNullable<z.ZodNumber>;
311
+ isShutdown: z.ZodBoolean;
312
+ underlyingPriceFeed: z.ZodNullable<z.ZodCustom<`0x${string}`, `0x${string}`>>;
313
+ }, z.core.$loose>>;
314
+ }, z.core.$loose>>;
73
315
  //#endregion
@@ -0,0 +1,36 @@
1
+ import { GroupImpact } from "./types.js";
2
+ //#region src/permissionless/api/oracles/score/formula.d.ts
3
+ /** What every source of a group is made to answer, as a multiple of now. */
4
+ export declare const SCORE_MULTIPLIER = 10;
5
+ /**
6
+ * How far the final price moved, as a multiple of where it was, either way:
7
+ * 1 for a price that did not move, 1.04 for one 4% off, and
8
+ * {@link SCORE_MULTIPLIER} for one that took the whole lie — the most it can
9
+ * take from one leg, and where a price over two legs of one group, moved
10
+ * further, is held too.
11
+ *
12
+ * `null` for a price that stopped answering, which is not a move.
13
+ */
14
+ export declare function scoreOfFactor(factor: number | null): number | null;
15
+ /**
16
+ * The price a market settles on: the lower of main and reserve, or the main
17
+ * feed's alone where there is no reserve to compare it with. `null` where a
18
+ * feed it needs does not answer.
19
+ */
20
+ export declare function finalPrice(main: bigint | null, reserve: bigint | null | undefined): bigint | null;
21
+ /** `stressed / base` as a float, `null` where the stressed price is gone. */
22
+ export declare function factorOf(base: bigint, stressed: bigint | null): number | null;
23
+ /**
24
+ * The market's score and the group it comes from: the furthest any group
25
+ * moved its price. 1 where nothing moved it — no group did, or no source
26
+ * feeds the price at all.
27
+ *
28
+ * A group under which the price stops answering moves nothing and does not
29
+ * set the score; it is listed after those that do, for a reader to see.
30
+ */
31
+ export declare function worstOf(impacts: GroupImpact[]): {
32
+ score: number;
33
+ impacts: GroupImpact[];
34
+ worst: GroupImpact | null;
35
+ };
36
+ //#endregion
@@ -0,0 +1,4 @@
1
+ import { AssetScore, AssetScoresArgs, FeedPairScore, FeedPairScoreArgs, GroupImpact, MarketScore, ScoredFeed } from "./types.js";
2
+ import { SCORE_MULTIPLIER, factorOf, finalPrice, scoreOfFactor, worstOf } from "./formula.js";
3
+ import { runAssetScores, runFeedPairScore } from "./run.js";
4
+ export { AssetScore, AssetScoresArgs, FeedPairScore, FeedPairScoreArgs, GroupImpact, MarketScore, SCORE_MULTIPLIER, ScoredFeed, factorOf, finalPrice, runAssetScores, runFeedPairScore, scoreOfFactor, worstOf };
@@ -0,0 +1,42 @@
1
+ import { AssetScore, FeedPairScore } from "./types.js";
2
+ import { PermissionlessMarketSlot } from "../types.js";
3
+ import { Address, Chain, PublicClient, Transport } from "viem";
4
+ //#region src/permissionless/api/oracles/score/run.d.ts
5
+ type Logger = {
6
+ warn(message: string): void;
7
+ };
8
+ /**
9
+ * Every asset of one chain, scored by what each of its source groups can do
10
+ * to the price its running markets hold for it.
11
+ *
12
+ * One read of the oracles' feed trees, then the simulation of every market's
13
+ * main and reserve pair at once — see {@link simulatePairs}.
14
+ **/
15
+ export declare function runAssetScores({ client, chainId, slots, compressor, logger }: {
16
+ client: PublicClient<Transport, Chain>;
17
+ chainId: number;
18
+ slots: PermissionlessMarketSlot[];
19
+ compressor: Address;
20
+ logger?: Logger;
21
+ }): Promise<AssetScore[]>;
22
+ /**
23
+ * Any main feed and reserve on a chain, scored the way a market holding them
24
+ * would be — whether or not any market does yet.
25
+ *
26
+ * The two trees are read off the compressor by feed rather than by oracle,
27
+ * so a feed the curator has only just deployed scores as well as one in use.
28
+ *
29
+ * @throws Where there is nothing to score: the compressor cannot read a
30
+ * feed, the main feed is a `ZeroPriceFeed`, or the final price does not
31
+ * answer even with every pull feed under it freshened.
32
+ **/
33
+ export declare function runFeedPairScore({ client, chainId, compressor, main, reserve, logger }: {
34
+ client: PublicClient<Transport, Chain>;
35
+ chainId: number;
36
+ compressor: Address;
37
+ main: Address;
38
+ reserve?: Address;
39
+ logger?: Logger;
40
+ }): Promise<FeedPairScore>;
41
+ //#endregion
42
+ export {};
@@ -0,0 +1,118 @@
1
+ import { Address } from "viem";
2
+ //#region src/permissionless/api/oracles/score/types.d.ts
3
+ /**
4
+ * One of a market's two feeds for a token, as the score reads it.
5
+ **/
6
+ export interface ScoredFeed {
7
+ feed: Address;
8
+ /**
9
+ * The store's name for the feed, `null` where it has none or where the
10
+ * feed was named by address alone, as a pair to score is.
11
+ */
12
+ name: string | null;
13
+ /** Gearbox contract type of the feed itself, `""` for one it never deployed. */
14
+ contractType: string;
15
+ /**
16
+ * Every source group beneath the feed: `"Chainlink"`, `"Lido"`, or the
17
+ * description of a source nothing could name.
18
+ */
19
+ sources: string[];
20
+ }
21
+ /**
22
+ * What one source group, lying, does to the price a market holds for an
23
+ * asset.
24
+ **/
25
+ export interface GroupImpact {
26
+ group: string;
27
+ /** The group was recognised rather than inferred from one feed's name. */
28
+ identified: boolean;
29
+ /**
30
+ * The group's sources this market's feeds read, by what they say they are:
31
+ * `"stETH / ETH"`, `"ETH / USD"`.
32
+ */
33
+ feeds: string[];
34
+ /** Which of the market's feeds read the group. */
35
+ reaches: "main" | "reserve" | "both";
36
+ /**
37
+ * The final price under the lie over the final price now, in USD. `null` is
38
+ * a price that stopped answering.
39
+ */
40
+ factor: number | null;
41
+ /** 1 to 10, by {@link scoreOfFactor}; `null` where the price stopped answering. */
42
+ score: number | null;
43
+ }
44
+ /**
45
+ * How far the price a main and a reserve feed give together can be pushed:
46
+ * their manipulation resistance, from 1 (does not move) to 10 (takes the
47
+ * whole lie).
48
+ *
49
+ * Every source group behind the two feeds is made, one group at a time, to
50
+ * answer {@link SCORE_MULTIPLIER} times what it answers now. The pair scores
51
+ * by the group that moves its final price — `min(main, reserve)` — the
52
+ * furthest, as a multiple either way.
53
+ **/
54
+ export interface FeedPairScore {
55
+ main: ScoredFeed;
56
+ /** `null` where there is no reserve at all. */
57
+ reserve: ScoredFeed | null;
58
+ /**
59
+ * The final price is `min(main, reserve)`: a reserve is present, is not a
60
+ * `ZeroPriceFeed`, and answers. Where it is not, the final price is the
61
+ * main feed's alone.
62
+ */
63
+ hasReserve: boolean;
64
+ /** The final price now, in USD. */
65
+ price: number;
66
+ /** Every group behind the two feeds, the most damaging first. */
67
+ impacts: GroupImpact[];
68
+ /** The group the score comes from; `null` where no group moves the price. */
69
+ worst: GroupImpact | null;
70
+ /**
71
+ * The score rests on a source nothing could name.
72
+ *
73
+ * Such a source is a group of its own and is perturbed alone, so where one
74
+ * feed reads it and the other does not, the other is taken to hold — which
75
+ * it would not if one operator stood behind both.
76
+ */
77
+ unverified: boolean;
78
+ score: number;
79
+ /** How the pair is set up, where that explains its score. */
80
+ notes: string[];
81
+ }
82
+ /** One market's price for one asset, scored as the pair of feeds it holds. */
83
+ export interface MarketScore extends FeedPairScore {
84
+ market: Address;
85
+ marketName: string | null;
86
+ marketConfigurator: Address;
87
+ curatorName: string | null;
88
+ }
89
+ /**
90
+ * One asset's score: its worst market's.
91
+ *
92
+ * The maximum, not an average, because the asset is only as well guarded as
93
+ * the most exposed market that prices it.
94
+ **/
95
+ export interface AssetScore {
96
+ chainId: number;
97
+ asset: Address;
98
+ symbol: string | null;
99
+ /** `null` for an asset no running market prices: it is switched off in all. */
100
+ score: number | null;
101
+ /** Some market's score rests on a source nothing could name. */
102
+ unverified: boolean;
103
+ /** The market the score comes from. */
104
+ worst: MarketScore | null;
105
+ /** Every running market pricing the asset, worst first. */
106
+ markets: MarketScore[];
107
+ }
108
+ export interface AssetScoresArgs {
109
+ /** Omitted scores every chain the backend serves markets for. */
110
+ chainId?: number;
111
+ }
112
+ export interface FeedPairScoreArgs {
113
+ chainId: number;
114
+ main: Address;
115
+ /** Omitted scores the main feed alone, as a market with no reserve. */
116
+ reserve?: Address;
117
+ }
118
+ //#endregion
@@ -0,0 +1,57 @@
1
+ import { StressSource } from "./types.js";
2
+ import { Address } from "viem";
3
+ //#region src/permissionless/api/oracles/stress/classify.d.ts
4
+ /**
5
+ * Who a price ultimately comes from, worked out from what the chain says
6
+ * about the feed reporting it.
7
+ *
8
+ * There is no registry on chain of which aggregator belongs to whom, so this
9
+ * is a reading of three things the chain does carry: the Gearbox contract
10
+ * type, which names the provider outright for the feeds Gearbox deploys; the
11
+ * `description()` every Chainlink-shaped feed returns; and the interface
12
+ * version, which separates Chainlink's own proxies from the many contracts
13
+ * that imitate them.
14
+ *
15
+ * Every rule is open to inspection and every unmatched feed is reported as
16
+ * unmatched, because the alternative — guessing from a symbol, or sweeping
17
+ * the remainder into one bucket — would understate exactly the part of the
18
+ * answer a reader should distrust.
19
+ **/
20
+ /** One node of an oracle's feed tree, as the compressor reports it. */
21
+ export interface TreeNode {
22
+ address: Address;
23
+ /** Gearbox contract type, `""` for a contract it never deployed. */
24
+ contractType: string;
25
+ /** `AggregatorV3Interface.version()`, or 0 where there is none. */
26
+ version: number;
27
+ description: string;
28
+ /** The feeds it reads, lowercased. Empty makes it a leaf. */
29
+ underlyingFeeds: Address[];
30
+ }
31
+ /**
32
+ * Every source behind a chain's feed trees.
33
+ *
34
+ * A source per contract, not per feed: two of an oracle's trees carrying the
35
+ * same aggregator is one source read twice, and the test varies it once.
36
+ *
37
+ * `rateTargets` says which contract each rate-bearing feed reads its rate
38
+ * from — the feed's own `lpContract`, read separately because the compressor
39
+ * does not report it. A feed missing from it is left out with a reason, since
40
+ * perturbing the whole feed instead would charge its protocol with a failure
41
+ * of whatever prices the thing the rate is denominated in.
42
+ **/
43
+ export declare function classifySources(chainId: number, nodes: TreeNode[], rateTargets: Map<Address, Address>, baselineOf: (target: Address) => bigint | null): {
44
+ sources: StressSource[];
45
+ unresolved: TreeNode[];
46
+ };
47
+ /**
48
+ * The sources each of the given feeds is priced through, following the trees
49
+ * down from every one of them.
50
+ *
51
+ * A feed is reached by a source when the source sits anywhere beneath it, at
52
+ * any depth: a market reading a composite of a composite of a Chainlink
53
+ * aggregator is a market Chainlink can move. Memoised over the whole forest,
54
+ * so a node shared by twenty trees is walked once.
55
+ **/
56
+ export declare function sourcesByFeed(roots: Address[], nodes: Map<Address, TreeNode>, sources: StressSource[]): Map<Address, Set<Address>>;
57
+ //#endregion
@@ -0,0 +1,6 @@
1
+ import { BreakingPoint, FeedOutcome, GroupReport, GroupScenarioOutcome, SlotOutcome, StressReport, StressScenario, StressSource, StressSourceKind, StressTestArgs } from "./types.js";
2
+ import { TreeNode, classifySources, sourcesByFeed } from "./classify.js";
3
+ import { UNBOUNDED_DOWN, UNBOUNDED_UP, groupOverride, perturb, rateStub, roundDataStub } from "./override.js";
4
+ import { DEFAULT_SCENARIOS, RATE_FEED_TYPE, readFeedTrees, readForest, readRateTargets, readUnder, runStressTest } from "./run.js";
5
+ import { scoreGroup, slotHarm, verdictOf } from "./score.js";
6
+ export { BreakingPoint, DEFAULT_SCENARIOS, FeedOutcome, GroupReport, GroupScenarioOutcome, RATE_FEED_TYPE, SlotOutcome, StressReport, StressScenario, StressSource, StressSourceKind, StressTestArgs, TreeNode, UNBOUNDED_DOWN, UNBOUNDED_UP, classifySources, groupOverride, perturb, rateStub, readFeedTrees, readForest, readRateTargets, readUnder, roundDataStub, runStressTest, scoreGroup, slotHarm, sourcesByFeed, verdictOf };
@@ -0,0 +1,59 @@
1
+ import { StressSource } from "./types.js";
2
+ import { Hex, StateOverride } from "viem";
3
+ //#region src/permissionless/api/oracles/stress/override.d.ts
4
+ /**
5
+ * Runtime code answering every call with the same five words.
6
+ *
7
+ * Deliberately selector-blind. A price feed is read through more than
8
+ * `latestRoundData` — `decimals`, `version`, sometimes `latestAnswer` — and
9
+ * dispatching on each would mean knowing which of them every caller in a tree
10
+ * reaches for. Five words decode as the round data; a caller expecting one
11
+ * word reads the first, which is why `roundId` is set to the 8 decimals every
12
+ * Gearbox feed reports rather than to a round number.
13
+ *
14
+ * `answeredInRound` is the same 8, so the `answeredInRound >= roundId` check
15
+ * the older consumers make passes.
16
+ **/
17
+ export declare function roundDataStub(answer: bigint, updatedAt: bigint): Hex;
18
+ /**
19
+ * Runtime code answering every call with one word.
20
+ *
21
+ * What an exchange rate getter returns, whichever of them the feed calls:
22
+ * `stEthPerToken`, `convertToAssets`, `get_virtual_price`, `pricePerShare`
23
+ * and `getRate` all answer a single `uint256`, so the stub does not need to
24
+ * know which.
25
+ **/
26
+ export declare function rateStub(rate: bigint): Hex;
27
+ /**
28
+ * The two unbounded ends, as far as the types involved can carry them.
29
+ *
30
+ * "Infinitely large" has to stop somewhere: a price is an `int256` and the
31
+ * arithmetic above it multiplies, so a genuinely enormous answer overflows
32
+ * inside the composite feed and reverts — which would be scored as the
33
+ * oracle resisting, when all that happened is that the test asked something
34
+ * the type cannot hold. `1e12` times the current answer is past any bound,
35
+ * any sanity check and any collateral ratio, and still multiplies.
36
+ */
37
+ export declare const UNBOUNDED_UP = 1000000000000;
38
+ /** The other end: a thousandth of a trillionth, which is as near zero. */
39
+ export declare const UNBOUNDED_DOWN = 1e-12;
40
+ /**
41
+ * What a source should answer under a multiplier, given what it answers now.
42
+ *
43
+ * Floored at one rather than at zero: a multiplier small enough to round the
44
+ * baseline away would be testing a feed reporting nothing, which is the revert
45
+ * case and is a different scenario with a different meaning.
46
+ */
47
+ export declare function perturb(baseline: bigint, multiplier: number): bigint;
48
+ /**
49
+ * The state override that makes every source of a group answer a multiple of
50
+ * what it answers now.
51
+ *
52
+ * One override per contract, so a group whose sources share an aggregator
53
+ * perturbs it once. Sources with nothing behind them and sources that are not
54
+ * answering are both left out, for the reasons on
55
+ * {@link StressSource.perturbable} and {@link StressSource.baseline} — an
56
+ * empty result is a group there is nothing to simulate about.
57
+ **/
58
+ export declare function groupOverride(sources: StressSource[], multiplier: number, updatedAt: bigint): StateOverride;
59
+ //#endregion