@nradko/metric-omm-sdk-v1 0.2.0 → 0.4.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 (202) hide show
  1. package/README.md +123 -49
  2. package/dist/abis/DepositAllowlistExtension.d.ts +440 -0
  3. package/dist/abis/DepositAllowlistExtension.d.ts.map +1 -0
  4. package/dist/abis/DepositAllowlistExtension.js +572 -0
  5. package/dist/abis/DepositAllowlistExtension.js.map +1 -0
  6. package/dist/abis/MetricOmmPool.d.ts +150 -30
  7. package/dist/abis/MetricOmmPool.d.ts.map +1 -1
  8. package/dist/abis/MetricOmmPool.js +186 -34
  9. package/dist/abis/MetricOmmPool.js.map +1 -1
  10. package/dist/abis/MetricOmmPoolDataProvider.d.ts +1 -137
  11. package/dist/abis/MetricOmmPoolDataProvider.d.ts.map +1 -1
  12. package/dist/abis/MetricOmmPoolDataProvider.js +1 -178
  13. package/dist/abis/MetricOmmPoolDataProvider.js.map +1 -1
  14. package/dist/abis/MetricOmmPoolFactory.d.ts +76 -18
  15. package/dist/abis/MetricOmmPoolFactory.d.ts.map +1 -1
  16. package/dist/abis/MetricOmmPoolFactory.js +93 -19
  17. package/dist/abis/MetricOmmPoolFactory.js.map +1 -1
  18. package/dist/abis/MetricOmmPoolLiquidityAdder.d.ts +68 -8
  19. package/dist/abis/MetricOmmPoolLiquidityAdder.d.ts.map +1 -1
  20. package/dist/abis/MetricOmmPoolLiquidityAdder.js +85 -9
  21. package/dist/abis/MetricOmmPoolLiquidityAdder.js.map +1 -1
  22. package/dist/abis/MetricOmmPoolStateView.d.ts +238 -0
  23. package/dist/abis/MetricOmmPoolStateView.d.ts.map +1 -0
  24. package/dist/abis/MetricOmmPoolStateView.js +315 -0
  25. package/dist/abis/MetricOmmPoolStateView.js.map +1 -0
  26. package/dist/abis/MetricOmmSimpleRouter.d.ts +619 -0
  27. package/dist/abis/MetricOmmSimpleRouter.d.ts.map +1 -0
  28. package/dist/abis/MetricOmmSimpleRouter.js +805 -0
  29. package/dist/abis/MetricOmmSimpleRouter.js.map +1 -0
  30. package/dist/abis/MetricOmmSwapQuoter.d.ts +576 -0
  31. package/dist/abis/MetricOmmSwapQuoter.d.ts.map +1 -0
  32. package/dist/abis/MetricOmmSwapQuoter.js +748 -0
  33. package/dist/abis/MetricOmmSwapQuoter.js.map +1 -0
  34. package/dist/abis/OracleProvider.d.ts +106 -0
  35. package/dist/abis/OracleProvider.d.ts.map +1 -0
  36. package/dist/abis/OracleProvider.js +62 -0
  37. package/dist/abis/OracleProvider.js.map +1 -0
  38. package/dist/abis/OracleValueStopLossExtension.d.ts +936 -0
  39. package/dist/abis/{MetricOmmPoolSwapper.d.ts.map → OracleValueStopLossExtension.d.ts.map} +1 -1
  40. package/dist/abis/OracleValueStopLossExtension.js +1214 -0
  41. package/dist/abis/OracleValueStopLossExtension.js.map +1 -0
  42. package/dist/abis/PriceProvider.d.ts +6 -112
  43. package/dist/abis/PriceProvider.d.ts.map +1 -1
  44. package/dist/abis/PriceProvider.js +6 -143
  45. package/dist/abis/PriceProvider.js.map +1 -1
  46. package/dist/abis/PriceVelocityGuardExtension.d.ts +454 -0
  47. package/dist/abis/PriceVelocityGuardExtension.d.ts.map +1 -0
  48. package/dist/abis/PriceVelocityGuardExtension.js +590 -0
  49. package/dist/abis/PriceVelocityGuardExtension.js.map +1 -0
  50. package/dist/abis/SwapAllowlistExtension.d.ts +440 -0
  51. package/dist/abis/{PriceProviderUi.d.ts.map → SwapAllowlistExtension.d.ts.map} +1 -1
  52. package/dist/abis/SwapAllowlistExtension.js +572 -0
  53. package/dist/abis/SwapAllowlistExtension.js.map +1 -0
  54. package/dist/abis/index.d.ts +8 -2
  55. package/dist/abis/index.d.ts.map +1 -1
  56. package/dist/abis/index.js +8 -2
  57. package/dist/abis/index.js.map +1 -1
  58. package/dist/addresses.d.ts +16 -9
  59. package/dist/addresses.d.ts.map +1 -1
  60. package/dist/addresses.js +33 -16
  61. package/dist/addresses.js.map +1 -1
  62. package/dist/constants.d.ts +4 -1
  63. package/dist/constants.d.ts.map +1 -1
  64. package/dist/constants.js +7 -2
  65. package/dist/constants.js.map +1 -1
  66. package/dist/extensions/admin/depositAllowlist.d.ts +8 -0
  67. package/dist/extensions/admin/depositAllowlist.d.ts.map +1 -0
  68. package/dist/extensions/admin/depositAllowlist.js +10 -0
  69. package/dist/extensions/admin/depositAllowlist.js.map +1 -0
  70. package/dist/extensions/admin/oracleStopLoss.d.ts +56 -0
  71. package/dist/extensions/admin/oracleStopLoss.d.ts.map +1 -0
  72. package/dist/extensions/admin/oracleStopLoss.js +87 -0
  73. package/dist/extensions/admin/oracleStopLoss.js.map +1 -0
  74. package/dist/extensions/admin/priceVelocityGuard.d.ts +12 -0
  75. package/dist/extensions/admin/priceVelocityGuard.d.ts.map +1 -0
  76. package/dist/extensions/admin/priceVelocityGuard.js +17 -0
  77. package/dist/extensions/admin/priceVelocityGuard.js.map +1 -0
  78. package/dist/extensions/admin/swapAllowlist.d.ts +8 -0
  79. package/dist/extensions/admin/swapAllowlist.d.ts.map +1 -0
  80. package/dist/extensions/admin/swapAllowlist.js +10 -0
  81. package/dist/extensions/admin/swapAllowlist.js.map +1 -0
  82. package/dist/extensions/index.d.ts +8 -0
  83. package/dist/extensions/index.d.ts.map +1 -0
  84. package/dist/extensions/index.js +8 -0
  85. package/dist/extensions/index.js.map +1 -0
  86. package/dist/extensions/init/index.d.ts +13 -0
  87. package/dist/extensions/init/index.d.ts.map +1 -0
  88. package/dist/extensions/init/index.js +12 -0
  89. package/dist/extensions/init/index.js.map +1 -0
  90. package/dist/extensions/orders.d.ts +7 -0
  91. package/dist/extensions/orders.d.ts.map +1 -0
  92. package/dist/extensions/orders.js +24 -0
  93. package/dist/extensions/orders.js.map +1 -0
  94. package/dist/extensions/types.d.ts +23 -0
  95. package/dist/extensions/types.d.ts.map +1 -0
  96. package/dist/extensions/types.js +10 -0
  97. package/dist/extensions/types.js.map +1 -0
  98. package/dist/index.d.ts +7 -4
  99. package/dist/index.d.ts.map +1 -1
  100. package/dist/index.js +10 -4
  101. package/dist/index.js.map +1 -1
  102. package/dist/oracle/index.d.ts +5 -0
  103. package/dist/oracle/index.d.ts.map +1 -0
  104. package/dist/oracle/index.js +5 -0
  105. package/dist/oracle/index.js.map +1 -0
  106. package/dist/oracle/registry.d.ts +53 -0
  107. package/dist/oracle/registry.d.ts.map +1 -0
  108. package/dist/oracle/registry.js +70 -0
  109. package/dist/oracle/registry.js.map +1 -0
  110. package/dist/pool/create.d.ts +11 -6
  111. package/dist/pool/create.d.ts.map +1 -1
  112. package/dist/pool/create.js +5 -3
  113. package/dist/pool/create.js.map +1 -1
  114. package/dist/pool/index.d.ts +1 -1
  115. package/dist/pool/index.d.ts.map +1 -1
  116. package/dist/pool/index.js.map +1 -1
  117. package/dist/pool/liquidity.d.ts +13 -5
  118. package/dist/pool/liquidity.d.ts.map +1 -1
  119. package/dist/pool/liquidity.js +25 -10
  120. package/dist/pool/liquidity.js.map +1 -1
  121. package/dist/pool/read.d.ts +0 -6
  122. package/dist/pool/read.d.ts.map +1 -1
  123. package/dist/pool/read.js +21 -14
  124. package/dist/pool/read.js.map +1 -1
  125. package/dist/quoter/index.d.ts +6 -0
  126. package/dist/quoter/index.d.ts.map +1 -0
  127. package/dist/quoter/index.js +6 -0
  128. package/dist/quoter/index.js.map +1 -0
  129. package/dist/quoter/quote.d.ts +58 -0
  130. package/dist/quoter/quote.d.ts.map +1 -0
  131. package/dist/quoter/quote.js +74 -0
  132. package/dist/quoter/quote.js.map +1 -0
  133. package/dist/quoter/quotePath.d.ts +65 -0
  134. package/dist/quoter/quotePath.d.ts.map +1 -0
  135. package/dist/quoter/quotePath.js +108 -0
  136. package/dist/quoter/quotePath.js.map +1 -0
  137. package/dist/router/index.d.ts +2 -1
  138. package/dist/router/index.d.ts.map +1 -1
  139. package/dist/router/index.js +2 -1
  140. package/dist/router/index.js.map +1 -1
  141. package/dist/router/swap.d.ts +37 -92
  142. package/dist/router/swap.d.ts.map +1 -1
  143. package/dist/router/swap.js +97 -299
  144. package/dist/router/swap.js.map +1 -1
  145. package/dist/router/swapPath.d.ts +56 -0
  146. package/dist/router/swapPath.d.ts.map +1 -0
  147. package/dist/router/swapPath.js +98 -0
  148. package/dist/router/swapPath.js.map +1 -0
  149. package/dist/swap/path.d.ts +13 -0
  150. package/dist/swap/path.d.ts.map +1 -0
  151. package/dist/swap/path.js +74 -0
  152. package/dist/swap/path.js.map +1 -0
  153. package/dist/types.d.ts +3 -4
  154. package/dist/types.d.ts.map +1 -1
  155. package/package.json +5 -7
  156. package/src/abis/DepositAllowlistExtension.ts +571 -0
  157. package/src/abis/MetricOmmPool.ts +186 -34
  158. package/src/abis/MetricOmmPoolDataProvider.ts +1 -178
  159. package/src/abis/MetricOmmPoolFactory.ts +93 -19
  160. package/src/abis/MetricOmmPoolLiquidityAdder.ts +85 -9
  161. package/src/abis/MetricOmmPoolStateView.ts +314 -0
  162. package/src/abis/MetricOmmSimpleRouter.ts +804 -0
  163. package/src/abis/MetricOmmSwapQuoter.ts +747 -0
  164. package/src/abis/OracleProvider.ts +61 -0
  165. package/src/abis/OracleValueStopLossExtension.ts +1213 -0
  166. package/src/abis/PriceProvider.ts +6 -143
  167. package/src/abis/PriceVelocityGuardExtension.ts +589 -0
  168. package/src/abis/SwapAllowlistExtension.ts +571 -0
  169. package/src/abis/index.ts +8 -2
  170. package/src/addresses.ts +47 -21
  171. package/src/constants.ts +7 -2
  172. package/src/extensions/admin/depositAllowlist.ts +16 -0
  173. package/src/extensions/admin/oracleStopLoss.ts +141 -0
  174. package/src/extensions/admin/priceVelocityGuard.ts +27 -0
  175. package/src/extensions/admin/swapAllowlist.ts +16 -0
  176. package/src/extensions/index.ts +31 -0
  177. package/src/extensions/init/index.ts +21 -0
  178. package/src/extensions/orders.ts +33 -0
  179. package/src/extensions/types.ts +33 -0
  180. package/src/index.ts +95 -23
  181. package/src/oracle/index.ts +14 -0
  182. package/src/oracle/registry.ts +146 -0
  183. package/src/pool/create.ts +12 -8
  184. package/src/pool/index.ts +1 -0
  185. package/src/pool/liquidity.ts +41 -15
  186. package/src/pool/read.ts +34 -16
  187. package/src/quoter/index.ts +28 -0
  188. package/src/quoter/quote.ts +193 -0
  189. package/src/quoter/quotePath.ts +240 -0
  190. package/src/router/index.ts +24 -25
  191. package/src/router/swap.ts +143 -481
  192. package/src/router/swapPath.ts +181 -0
  193. package/src/swap/path.ts +107 -0
  194. package/src/types.ts +3 -4
  195. package/dist/abis/MetricOmmPoolSwapper.d.ts +0 -917
  196. package/dist/abis/MetricOmmPoolSwapper.js +0 -1185
  197. package/dist/abis/MetricOmmPoolSwapper.js.map +0 -1
  198. package/dist/abis/PriceProviderUi.d.ts +0 -433
  199. package/dist/abis/PriceProviderUi.js +0 -318
  200. package/dist/abis/PriceProviderUi.js.map +0 -1
  201. package/src/abis/MetricOmmPoolSwapper.ts +0 -1184
  202. package/src/abis/PriceProviderUi.ts +0 -317
package/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # @nradko/metric-omm-sdk-v1
2
2
 
3
- TypeScript SDK for **v1** Metric OMM contracts: **Swapper**, **LiquidityAdder**, pool `addLiquidity` / `removeLiquidity`, and factory-backed reads.
3
+ TypeScript SDK for **v1** Metric OMM contracts: **SimpleRouter**, **SwapQuoter**, **LiquidityAdder**, pool `addLiquidity` / `removeLiquidity`, **extensions**, and factory-backed reads.
4
4
 
5
- Pinned to the same commits as [`dev_metric-deploy/versions.env`](../../../dev_metric-deploy/versions.env).
5
+ Pinned **metric-periphery** `dccbda7970da36d55a86108e3dbcce1e794c9634` (core via periphery `lib/metric-core`).
6
6
 
7
7
  ## Installation
8
8
 
@@ -16,72 +16,150 @@ Or via the combined package:
16
16
  import { v1 } from "@nradko/metric-omm-sdk";
17
17
  ```
18
18
 
19
- ## Ethereum mainnet addresses
19
+ ## Ethereum mainnet and Base addresses
20
+
21
+ Protocol contracts use the **same addresses** on Ethereum mainnet and Base (CREATE2). Wrapped native differs per chain (WETH).
20
22
 
21
23
  | Contract | Address |
22
24
  | -------- | ------- |
23
- | MetricOmmPoolFactory | `0xDd41F182630A395E2ED8b9c1D5f1E22F1f9b133a` |
24
- | MetricOmmPoolDeployer | `0xb9bb9364FEA5170713709Ba67Aec649eF043e885` |
25
- | MetricOmmPoolLiquidityAdder | `0x9de47a0C84c7F9486Af77C8135CE7f480d121B44` |
26
- | MetricOmmPoolDataProvider | `0xf06454dB7E9b8BCa2FC77bF6e88f9B98dF0b52e8` |
27
- | MetricOmmPoolStateView | `0x124C2853E316d1585621560E35D4dcC8318F97FF` |
28
- | MetricOmmSimpleRouter | `0x94DD3A9308A1060f4BD9A95dE65F27f0F048f863` |
29
- | MetricOmmPoolSwapper | `0xc73407A1d240e08EB34654e706cc3B19E356b8C4` |
30
- | WETH | `0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2` |
31
-
32
- `MetricOmmPoolDataProvider` is the deployed lens: pool reads (`slot0`, `binStates`, `positionBinShares`, …) plus swap depth and revert-based quotes. Pass `addresses.dataProvider` to read helpers and liquidity builders (`dataProviderAddress` param).
25
+ | MetricOmmPoolFactory | `0x567C7205107257650dC73a73d87b879a45F5b6F6` |
26
+ | MetricOmmPoolDeployer | `0xBe34D0cEb6CF1acbf55dEf35E4dC3e17BDfb6AE4` |
27
+ | MetricOmmPoolLiquidityAdder | `0x323B95ABcE8b3025829980bb19d1Fd819808FCB2` |
28
+ | MetricOmmPoolDataProvider | `0x5A100da447833D94b8e50AeD1916D7488D15D3fc` |
29
+ | MetricOmmSimpleRouter | `0x18f85056444452E718cD680A08f219B2347FE672` |
30
+ | DepositAllowlistExtension | `0x088B0CCBdb17531132173a30428f66c1d5A73794` |
31
+ | SwapAllowlistExtension | `0x952D844e166E6FAaF73a5e56F0fB0C54543a0f69` |
32
+ | OracleValueStopLossExtension | `0x9694959a452283d86eBF4EF4eB5651dEAa1eCec1` |
33
+ | PriceVelocityGuardExtension | `0xa53E5db6c18Ce258b3090F1470c5fE7f2e0215Fc` |
34
+ | WETH (Ethereum) | `0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2` |
35
+ | WETH (Base) | `0x4200000000000000000000000000000000000006` |
36
+
37
+ `addresses.quoter` is a zero placeholder until a public SwapQuoter deployment is wired in this SDK release. Pass `quoterAddress` to quote helpers or set the bundled address when available.
38
+
39
+ `MetricOmmPoolDataProvider` is the deployed lens: pool reads (`slot0`, `binStates`, `positionBinShares`, …). Pass `addresses.dataProvider` to read helpers and liquidity builders (`dataProviderAddress` param).
33
40
 
34
41
  ```typescript
35
42
  import { getAddressesOrThrow, ChainId, isChainSupported } from "@nradko/metric-omm-sdk-v1";
36
43
 
37
44
  const a = getAddressesOrThrow(ChainId.ETHEREUM);
38
- // isChainSupported(ChainId.BASE) === false use DeployedChainId / getSupportedChainIds() for bundled addresses
45
+ // getAddressesOrThrow(ChainId.BASE) — same protocol addresses as Ethereum
46
+ // isChainSupported(ChainId.ARBITRUM) === false — use DeployedChainId / getSupportedChainIds()
39
47
  ```
40
48
 
41
- `ChainId` lists future chain IDs for typing; **only Ethereum mainnet** has entries in `ADDRESSES` for this release. Use `getSupportedChainIds()`, `isChainSupported()`, or `DeployedChainId` when you need compile-time guarantees.
49
+ ChainId lists future chain IDs for typing; **Ethereum mainnet and Base** have entries in ADDRESSES for this release.
50
+
51
+ ## Swaps (SimpleRouter)
42
52
 
43
- ## Swaps (Swapper)
53
+ ### Single hop
44
54
 
45
55
  ```typescript
46
56
  import {
47
- buildArgsAndExpectedAmountsForSwapExactInput,
57
+ buildExactInputSingleParams,
48
58
  getAddressesOrThrow,
49
59
  ChainId,
50
60
  } from "@nradko/metric-omm-sdk-v1";
51
- import { MetricOmmPoolSwapperAbi } from "@nradko/metric-omm-sdk-v1/abis";
61
+ import { MetricOmmSimpleRouterAbi } from "@nradko/metric-omm-sdk-v1/abis";
52
62
 
53
63
  const addresses = getAddressesOrThrow(ChainId.ETHEREUM);
54
64
 
55
- const { args, expectedInput, expectedOutput } =
56
- await buildArgsAndExpectedAmountsForSwapExactInput({
57
- publicClient,
58
- factoryAddress: addresses.factory,
59
- swapperAddress: addresses.swapper,
60
- pool: poolAddress,
61
- recipient: account,
62
- zeroForOne: true,
63
- amountIn: 1_000_000_000_000_000_000n,
64
- slippagePercent: 0.5,
65
- deadline: BigInt(Math.floor(Date.now() / 1000) + 1200),
66
- });
65
+ const params = await buildExactInputSingleParams({
66
+ publicClient,
67
+ pool: poolAddress,
68
+ tokenIn,
69
+ tokenOut,
70
+ recipient: account,
71
+ amountIn: 1_000_000_000_000_000_000n,
72
+ slippagePercent: 0.5,
73
+ deadline: BigInt(Math.floor(Date.now() / 1000) + 1200),
74
+ quoterAddress, // required until addresses.quoter is set
75
+ });
67
76
 
68
77
  await walletClient.writeContract({
69
- address: addresses.swapper,
70
- abi: MetricOmmPoolSwapperAbi,
71
- functionName: "swapExactInput",
72
- args,
78
+ address: addresses.simpleRouter,
79
+ abi: MetricOmmSimpleRouterAbi,
80
+ functionName: "exactInputSingle",
81
+ args: [params],
82
+ account,
83
+ });
84
+ ```
85
+
86
+ ### Multihop
87
+
88
+ ```typescript
89
+ import { buildExactInputParams, encodeExactInputCalldata } from "@nradko/metric-omm-sdk-v1";
90
+
91
+ const pathParams = await buildExactInputParams({
92
+ publicClient,
93
+ tokenIn,
94
+ tokenOut,
95
+ pools: [poolA, poolB],
96
+ recipient: account,
97
+ amountIn,
98
+ slippagePercent: 0.5,
99
+ deadline,
100
+ quoterAddress,
101
+ });
102
+
103
+ await walletClient.sendTransaction({
104
+ to: addresses.simpleRouter,
105
+ data: encodeExactInputCalldata(pathParams),
73
106
  account,
74
107
  });
75
108
  ```
76
109
 
77
- Quote without building tx args: `quoteSwap` (read-only pool quote), `quoteExpectedAmountsForSwapExactInput` / `quoteExpectedAmountsForSwapExactOutput` (Swapper-aligned estimates for slippage math).
110
+ Approve the **SimpleRouter** for input tokens (ERC-20 path). Swap allowlist extensions gate the **router contract address**, not the end-user EOA.
111
+
112
+ ## Quotes (SwapQuoter)
113
+
114
+ Live quotes simulate the quoter contract (eth_call). Pass `quoterAddress` when `addresses.quoter` is unset.
115
+
116
+ ```typescript
117
+ import { quoteLiveExactInSingle, quoteLiveExactIn } from "@nradko/metric-omm-sdk-v1";
118
+
119
+ const single = await quoteLiveExactInSingle({
120
+ publicClient,
121
+ pool: poolAddress,
122
+ tokenIn,
123
+ tokenOut,
124
+ recipient: account,
125
+ amountIn,
126
+ quoterAddress,
127
+ });
128
+
129
+ const path = await quoteLiveExactIn({
130
+ publicClient,
131
+ tokenIn,
132
+ tokenOut,
133
+ pools: [poolA, poolB],
134
+ recipient: account,
135
+ amountIn,
136
+ quoterAddress,
137
+ });
138
+ ```
139
+
140
+ Hypothetical quotes: `quoteHypotheticalExactInputSingle`, `quoteHypotheticalExactInput`, and exact-output variants with per-pool bid/ask prices.
78
141
 
79
142
  ## Liquidity
80
143
 
81
144
  - **Add (EOA):** approve **LiquidityAdder**, then `addLiquidityExactShares` / `addLiquidityWeighted` on the adder (see `encodeAddLiquidity*` helpers).
82
145
  - **Remove:** `removeLiquidity` on the pool — build deltas with `buildModifyLiquidityArgsForRemoval` / `encodeRemoveLiquidityCalldata`.
83
146
 
84
- SDK builders still use internal names like `buildModifyLiquidityArgsForUniformAddition` where the math is shared; encoders target v1 pool/adder ABIs.
147
+ ## Extensions
148
+
149
+ Pools support up to seven **extensions** (periphery contracts) configured at creation via `extensions`, `extensionOrders`, and `extensionInitData`. Swap and liquidity encoders forward optional **`extensionData`** (defaults to `0x`).
150
+
151
+ See extension admin encoders (`encodeSetAllowedToDepositCalldata`, `encodeSetAllowedToSwapCalldata`, …) and [HOW_TO.md](../metric-omm-sdk/HOW_TO.md) for pool-creation examples.
152
+
153
+ ## Oracle registration
154
+
155
+ For providers-oracle price feeds, register pools before attributed reads:
156
+
157
+ ```typescript
158
+ import { getPoolOracleStatus, registerPool } from "@nradko/metric-omm-sdk-v1";
159
+
160
+ const status = await getPoolOracleStatus(publicClient, oracleAddress, feedId, poolAddress);
161
+ await registerPool({ publicClient, walletClient, oracleAddress, feedId, pool: poolAddress, factory, account });
162
+ ```
85
163
 
86
164
  ## Pool reads
87
165
 
@@ -100,8 +178,14 @@ const slot0 = await getSlot0(publicClient, addresses.dataProvider, poolAddress);
100
178
  import {
101
179
  MetricOmmPoolAbi,
102
180
  MetricOmmPoolDataProviderAbi,
103
- MetricOmmPoolSwapperAbi,
181
+ MetricOmmSimpleRouterAbi,
182
+ MetricOmmSwapQuoterAbi,
104
183
  MetricOmmPoolLiquidityAdderAbi,
184
+ DepositAllowlistExtensionAbi,
185
+ SwapAllowlistExtensionAbi,
186
+ PriceVelocityGuardExtensionAbi,
187
+ OracleValueStopLossExtensionAbi,
188
+ OracleProviderAbi,
105
189
  } from "@nradko/metric-omm-sdk-v1/abis";
106
190
  ```
107
191
 
@@ -111,30 +195,20 @@ Regenerate from pinned contracts:
111
195
  npm run setup:contracts # init submodules, hardhat build, sync ABIs
112
196
  ```
113
197
 
114
- All pinned contracts (including `MetricOmmPoolDataProvider`) are compiled by Hardhat from the pinned `@metric/core` and `@metric/periphery` git dependencies (periphery remappings use core's libs via `lib/metric-core`).
115
-
116
198
  ## Development
117
199
 
118
200
  ```bash
119
201
  npm run build # tsc only (default prepare)
120
202
  npm run setup:contracts # refresh ABIs from pinned git deps (maintainers)
121
203
  npm test # Hardhat tests (needs matching @metric/* in node_modules)
204
+ npm run verify # lint, format, typecheck, test — publish gate
122
205
  ```
123
206
 
124
- In the monorepo, run v1 tests with an isolated install (same pattern as v0):
125
-
126
207
  ```bash
127
- # from dev_sdk/
128
208
  cd v1
129
209
  npm ci
130
- npm run sync:contracts # required before first test run
210
+ npm run setup:contracts
131
211
  npm test
132
212
  ```
133
213
 
134
- ## Tests
135
-
136
- ```bash
137
- npm run sync:contracts && npm test
138
- ```
139
-
140
214
  Fork tests: set `ETHEREUM_RPC_URL` (optional `ETHEREUM_FORK_BLOCK_NUMBER`).
@@ -0,0 +1,440 @@
1
+ export declare const DepositAllowlistExtensionAbi: readonly [{
2
+ readonly inputs: readonly [{
3
+ readonly internalType: "address";
4
+ readonly name: "factory_";
5
+ readonly type: "address";
6
+ }];
7
+ readonly stateMutability: "nonpayable";
8
+ readonly type: "constructor";
9
+ }, {
10
+ readonly inputs: readonly [];
11
+ readonly name: "ExtensionNotImplemented";
12
+ readonly type: "error";
13
+ }, {
14
+ readonly inputs: readonly [];
15
+ readonly name: "NotAllowedToDeposit";
16
+ readonly type: "error";
17
+ }, {
18
+ readonly inputs: readonly [{
19
+ readonly internalType: "address";
20
+ readonly name: "caller";
21
+ readonly type: "address";
22
+ }, {
23
+ readonly internalType: "address";
24
+ readonly name: "factory";
25
+ readonly type: "address";
26
+ }];
27
+ readonly name: "OnlyFactory";
28
+ readonly type: "error";
29
+ }, {
30
+ readonly inputs: readonly [{
31
+ readonly internalType: "address";
32
+ readonly name: "caller";
33
+ readonly type: "address";
34
+ }, {
35
+ readonly internalType: "address";
36
+ readonly name: "factory";
37
+ readonly type: "address";
38
+ }];
39
+ readonly name: "OnlyPool";
40
+ readonly type: "error";
41
+ }, {
42
+ readonly inputs: readonly [{
43
+ readonly internalType: "address";
44
+ readonly name: "pool";
45
+ readonly type: "address";
46
+ }, {
47
+ readonly internalType: "address";
48
+ readonly name: "caller";
49
+ readonly type: "address";
50
+ }, {
51
+ readonly internalType: "address";
52
+ readonly name: "admin";
53
+ readonly type: "address";
54
+ }];
55
+ readonly name: "OnlyPoolAdmin";
56
+ readonly type: "error";
57
+ }, {
58
+ readonly anonymous: false;
59
+ readonly inputs: readonly [{
60
+ readonly indexed: true;
61
+ readonly internalType: "address";
62
+ readonly name: "pool";
63
+ readonly type: "address";
64
+ }, {
65
+ readonly indexed: true;
66
+ readonly internalType: "address";
67
+ readonly name: "depositor";
68
+ readonly type: "address";
69
+ }, {
70
+ readonly indexed: false;
71
+ readonly internalType: "bool";
72
+ readonly name: "allowed";
73
+ readonly type: "bool";
74
+ }];
75
+ readonly name: "AllowedToDepositSet";
76
+ readonly type: "event";
77
+ }, {
78
+ readonly inputs: readonly [];
79
+ readonly name: "FACTORY";
80
+ readonly outputs: readonly [{
81
+ readonly internalType: "address";
82
+ readonly name: "";
83
+ readonly type: "address";
84
+ }];
85
+ readonly stateMutability: "view";
86
+ readonly type: "function";
87
+ }, {
88
+ readonly inputs: readonly [{
89
+ readonly internalType: "address";
90
+ readonly name: "";
91
+ readonly type: "address";
92
+ }, {
93
+ readonly internalType: "address";
94
+ readonly name: "";
95
+ readonly type: "address";
96
+ }, {
97
+ readonly internalType: "uint80";
98
+ readonly name: "";
99
+ readonly type: "uint80";
100
+ }, {
101
+ readonly components: readonly [{
102
+ readonly internalType: "int256[]";
103
+ readonly name: "binIdxs";
104
+ readonly type: "int256[]";
105
+ }, {
106
+ readonly internalType: "uint256[]";
107
+ readonly name: "shares";
108
+ readonly type: "uint256[]";
109
+ }];
110
+ readonly internalType: "struct LiquidityDelta";
111
+ readonly name: "";
112
+ readonly type: "tuple";
113
+ }, {
114
+ readonly internalType: "uint256";
115
+ readonly name: "";
116
+ readonly type: "uint256";
117
+ }, {
118
+ readonly internalType: "uint256";
119
+ readonly name: "";
120
+ readonly type: "uint256";
121
+ }, {
122
+ readonly internalType: "bytes";
123
+ readonly name: "";
124
+ readonly type: "bytes";
125
+ }];
126
+ readonly name: "afterAddLiquidity";
127
+ readonly outputs: readonly [{
128
+ readonly internalType: "bytes4";
129
+ readonly name: "";
130
+ readonly type: "bytes4";
131
+ }];
132
+ readonly stateMutability: "nonpayable";
133
+ readonly type: "function";
134
+ }, {
135
+ readonly inputs: readonly [{
136
+ readonly internalType: "address";
137
+ readonly name: "";
138
+ readonly type: "address";
139
+ }, {
140
+ readonly internalType: "address";
141
+ readonly name: "";
142
+ readonly type: "address";
143
+ }, {
144
+ readonly internalType: "uint80";
145
+ readonly name: "";
146
+ readonly type: "uint80";
147
+ }, {
148
+ readonly components: readonly [{
149
+ readonly internalType: "int256[]";
150
+ readonly name: "binIdxs";
151
+ readonly type: "int256[]";
152
+ }, {
153
+ readonly internalType: "uint256[]";
154
+ readonly name: "shares";
155
+ readonly type: "uint256[]";
156
+ }];
157
+ readonly internalType: "struct LiquidityDelta";
158
+ readonly name: "";
159
+ readonly type: "tuple";
160
+ }, {
161
+ readonly internalType: "uint256";
162
+ readonly name: "";
163
+ readonly type: "uint256";
164
+ }, {
165
+ readonly internalType: "uint256";
166
+ readonly name: "";
167
+ readonly type: "uint256";
168
+ }, {
169
+ readonly internalType: "bytes";
170
+ readonly name: "";
171
+ readonly type: "bytes";
172
+ }];
173
+ readonly name: "afterRemoveLiquidity";
174
+ readonly outputs: readonly [{
175
+ readonly internalType: "bytes4";
176
+ readonly name: "";
177
+ readonly type: "bytes4";
178
+ }];
179
+ readonly stateMutability: "nonpayable";
180
+ readonly type: "function";
181
+ }, {
182
+ readonly inputs: readonly [{
183
+ readonly internalType: "address";
184
+ readonly name: "";
185
+ readonly type: "address";
186
+ }, {
187
+ readonly internalType: "address";
188
+ readonly name: "";
189
+ readonly type: "address";
190
+ }, {
191
+ readonly internalType: "bool";
192
+ readonly name: "";
193
+ readonly type: "bool";
194
+ }, {
195
+ readonly internalType: "int128";
196
+ readonly name: "";
197
+ readonly type: "int128";
198
+ }, {
199
+ readonly internalType: "uint128";
200
+ readonly name: "";
201
+ readonly type: "uint128";
202
+ }, {
203
+ readonly internalType: "uint256";
204
+ readonly name: "";
205
+ readonly type: "uint256";
206
+ }, {
207
+ readonly internalType: "uint256";
208
+ readonly name: "";
209
+ readonly type: "uint256";
210
+ }, {
211
+ readonly internalType: "uint128";
212
+ readonly name: "";
213
+ readonly type: "uint128";
214
+ }, {
215
+ readonly internalType: "uint128";
216
+ readonly name: "";
217
+ readonly type: "uint128";
218
+ }, {
219
+ readonly internalType: "int128";
220
+ readonly name: "";
221
+ readonly type: "int128";
222
+ }, {
223
+ readonly internalType: "int128";
224
+ readonly name: "";
225
+ readonly type: "int128";
226
+ }, {
227
+ readonly internalType: "uint256";
228
+ readonly name: "";
229
+ readonly type: "uint256";
230
+ }, {
231
+ readonly internalType: "bytes";
232
+ readonly name: "";
233
+ readonly type: "bytes";
234
+ }];
235
+ readonly name: "afterSwap";
236
+ readonly outputs: readonly [{
237
+ readonly internalType: "bytes4";
238
+ readonly name: "";
239
+ readonly type: "bytes4";
240
+ }];
241
+ readonly stateMutability: "nonpayable";
242
+ readonly type: "function";
243
+ }, {
244
+ readonly inputs: readonly [{
245
+ readonly internalType: "address";
246
+ readonly name: "pool";
247
+ readonly type: "address";
248
+ }, {
249
+ readonly internalType: "address";
250
+ readonly name: "depositor";
251
+ readonly type: "address";
252
+ }];
253
+ readonly name: "allowedDepositor";
254
+ readonly outputs: readonly [{
255
+ readonly internalType: "bool";
256
+ readonly name: "";
257
+ readonly type: "bool";
258
+ }];
259
+ readonly stateMutability: "view";
260
+ readonly type: "function";
261
+ }, {
262
+ readonly inputs: readonly [{
263
+ readonly internalType: "address";
264
+ readonly name: "";
265
+ readonly type: "address";
266
+ }, {
267
+ readonly internalType: "address";
268
+ readonly name: "owner";
269
+ readonly type: "address";
270
+ }, {
271
+ readonly internalType: "uint80";
272
+ readonly name: "";
273
+ readonly type: "uint80";
274
+ }, {
275
+ readonly components: readonly [{
276
+ readonly internalType: "int256[]";
277
+ readonly name: "binIdxs";
278
+ readonly type: "int256[]";
279
+ }, {
280
+ readonly internalType: "uint256[]";
281
+ readonly name: "shares";
282
+ readonly type: "uint256[]";
283
+ }];
284
+ readonly internalType: "struct LiquidityDelta";
285
+ readonly name: "";
286
+ readonly type: "tuple";
287
+ }, {
288
+ readonly internalType: "bytes";
289
+ readonly name: "";
290
+ readonly type: "bytes";
291
+ }];
292
+ readonly name: "beforeAddLiquidity";
293
+ readonly outputs: readonly [{
294
+ readonly internalType: "bytes4";
295
+ readonly name: "";
296
+ readonly type: "bytes4";
297
+ }];
298
+ readonly stateMutability: "view";
299
+ readonly type: "function";
300
+ }, {
301
+ readonly inputs: readonly [{
302
+ readonly internalType: "address";
303
+ readonly name: "";
304
+ readonly type: "address";
305
+ }, {
306
+ readonly internalType: "address";
307
+ readonly name: "";
308
+ readonly type: "address";
309
+ }, {
310
+ readonly internalType: "uint80";
311
+ readonly name: "";
312
+ readonly type: "uint80";
313
+ }, {
314
+ readonly components: readonly [{
315
+ readonly internalType: "int256[]";
316
+ readonly name: "binIdxs";
317
+ readonly type: "int256[]";
318
+ }, {
319
+ readonly internalType: "uint256[]";
320
+ readonly name: "shares";
321
+ readonly type: "uint256[]";
322
+ }];
323
+ readonly internalType: "struct LiquidityDelta";
324
+ readonly name: "";
325
+ readonly type: "tuple";
326
+ }, {
327
+ readonly internalType: "bytes";
328
+ readonly name: "";
329
+ readonly type: "bytes";
330
+ }];
331
+ readonly name: "beforeRemoveLiquidity";
332
+ readonly outputs: readonly [{
333
+ readonly internalType: "bytes4";
334
+ readonly name: "";
335
+ readonly type: "bytes4";
336
+ }];
337
+ readonly stateMutability: "nonpayable";
338
+ readonly type: "function";
339
+ }, {
340
+ readonly inputs: readonly [{
341
+ readonly internalType: "address";
342
+ readonly name: "";
343
+ readonly type: "address";
344
+ }, {
345
+ readonly internalType: "address";
346
+ readonly name: "";
347
+ readonly type: "address";
348
+ }, {
349
+ readonly internalType: "bool";
350
+ readonly name: "";
351
+ readonly type: "bool";
352
+ }, {
353
+ readonly internalType: "int128";
354
+ readonly name: "";
355
+ readonly type: "int128";
356
+ }, {
357
+ readonly internalType: "uint128";
358
+ readonly name: "";
359
+ readonly type: "uint128";
360
+ }, {
361
+ readonly internalType: "uint256";
362
+ readonly name: "";
363
+ readonly type: "uint256";
364
+ }, {
365
+ readonly internalType: "uint128";
366
+ readonly name: "";
367
+ readonly type: "uint128";
368
+ }, {
369
+ readonly internalType: "uint128";
370
+ readonly name: "";
371
+ readonly type: "uint128";
372
+ }, {
373
+ readonly internalType: "bytes";
374
+ readonly name: "";
375
+ readonly type: "bytes";
376
+ }];
377
+ readonly name: "beforeSwap";
378
+ readonly outputs: readonly [{
379
+ readonly internalType: "bytes4";
380
+ readonly name: "";
381
+ readonly type: "bytes4";
382
+ }];
383
+ readonly stateMutability: "nonpayable";
384
+ readonly type: "function";
385
+ }, {
386
+ readonly inputs: readonly [{
387
+ readonly internalType: "address";
388
+ readonly name: "";
389
+ readonly type: "address";
390
+ }, {
391
+ readonly internalType: "bytes";
392
+ readonly name: "";
393
+ readonly type: "bytes";
394
+ }];
395
+ readonly name: "initialize";
396
+ readonly outputs: readonly [{
397
+ readonly internalType: "bytes4";
398
+ readonly name: "";
399
+ readonly type: "bytes4";
400
+ }];
401
+ readonly stateMutability: "nonpayable";
402
+ readonly type: "function";
403
+ }, {
404
+ readonly inputs: readonly [{
405
+ readonly internalType: "address";
406
+ readonly name: "pool_";
407
+ readonly type: "address";
408
+ }, {
409
+ readonly internalType: "address";
410
+ readonly name: "depositor";
411
+ readonly type: "address";
412
+ }];
413
+ readonly name: "isAllowedToDeposit";
414
+ readonly outputs: readonly [{
415
+ readonly internalType: "bool";
416
+ readonly name: "";
417
+ readonly type: "bool";
418
+ }];
419
+ readonly stateMutability: "view";
420
+ readonly type: "function";
421
+ }, {
422
+ readonly inputs: readonly [{
423
+ readonly internalType: "address";
424
+ readonly name: "pool_";
425
+ readonly type: "address";
426
+ }, {
427
+ readonly internalType: "address";
428
+ readonly name: "depositor";
429
+ readonly type: "address";
430
+ }, {
431
+ readonly internalType: "bool";
432
+ readonly name: "allowed";
433
+ readonly type: "bool";
434
+ }];
435
+ readonly name: "setAllowedToDeposit";
436
+ readonly outputs: readonly [];
437
+ readonly stateMutability: "nonpayable";
438
+ readonly type: "function";
439
+ }];
440
+ //# sourceMappingURL=DepositAllowlistExtension.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DepositAllowlistExtension.d.ts","sourceRoot":"","sources":["../../src/abis/DepositAllowlistExtension.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0jB/B,CAAC"}