@zoralabs/limit-orders 0.2.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 (208) hide show
  1. package/.turbo/turbo-build$colon$js.log +85 -0
  2. package/AUDIT_NOTES.md +33 -0
  3. package/AUDIT_RFP.md +408 -0
  4. package/CHANGELOG.md +25 -0
  5. package/GAS_COMPARISON_RESULTS.md +194 -0
  6. package/LICENSE +21 -0
  7. package/README.md +650 -0
  8. package/SPEC.md +291 -0
  9. package/abis/BalanceDeltaLibrary.json +15 -0
  10. package/abis/BeforeSwapDeltaLibrary.json +15 -0
  11. package/abis/CurrencyLibrary.json +25 -0
  12. package/abis/CustomRevert.json +28 -0
  13. package/abis/IAllowanceTransfer.json +486 -0
  14. package/abis/IAuthority.json +31 -0
  15. package/abis/ICoin.json +1074 -0
  16. package/abis/IDeployedCoinVersionLookup.json +21 -0
  17. package/abis/IDopplerErrors.json +44 -0
  18. package/abis/IEIP712.json +15 -0
  19. package/abis/IERC1363.json +373 -0
  20. package/abis/IERC165.json +21 -0
  21. package/abis/IERC20.json +185 -0
  22. package/abis/IERC20Minimal.json +172 -0
  23. package/abis/IERC6909Claims.json +288 -0
  24. package/abis/IERC7572.json +21 -0
  25. package/abis/IExtsload.json +64 -0
  26. package/abis/IExttload.json +40 -0
  27. package/abis/IHasCoinType.json +15 -0
  28. package/abis/IHasPoolKey.json +42 -0
  29. package/abis/IHasRewardsRecipients.json +54 -0
  30. package/abis/IHasSwapPath.json +60 -0
  31. package/abis/IHasTotalSupplyForPositions.json +15 -0
  32. package/abis/IHooks.json +789 -0
  33. package/abis/IMsgSender.json +15 -0
  34. package/abis/IPoolManager.json +1286 -0
  35. package/abis/IProtocolFees.json +174 -0
  36. package/abis/ISupportsLimitOrderFill.json +15 -0
  37. package/abis/ISwapPathRouter.json +92 -0
  38. package/abis/ISwapRouter.json +219 -0
  39. package/abis/IUniswapV3SwapCallback.json +25 -0
  40. package/abis/IUpgradeableDestinationV4Hook.json +84 -0
  41. package/abis/IUpgradeableDestinationV4HookWithUpdateableFee.json +95 -0
  42. package/abis/IUpgradeableV4Hook.json +112 -0
  43. package/abis/IZoraHookRegistry.json +188 -0
  44. package/abis/IZoraLimitOrderBook.json +623 -0
  45. package/abis/IZoraLimitOrderBookCoinsInterface.json +67 -0
  46. package/abis/IZoraV4CoinHook.json +610 -0
  47. package/abis/Permit2Payments.json +7 -0
  48. package/abis/Position.json +7 -0
  49. package/abis/SafeCast.json +7 -0
  50. package/abis/SafeCast160.json +7 -0
  51. package/abis/SafeERC20.json +34 -0
  52. package/abis/SimpleAccessManaged.json +57 -0
  53. package/abis/SimpleAccessManager.json +351 -0
  54. package/abis/SqrtPriceMath.json +22 -0
  55. package/abis/StateLibrary.json +80 -0
  56. package/abis/SwapLimitOrders.json +22 -0
  57. package/abis/SwapWithLimitOrders.json +457 -0
  58. package/abis/TickBitmap.json +18 -0
  59. package/abis/TickMath.json +24 -0
  60. package/abis/V3ToV4SwapLib.json +28 -0
  61. package/abis/ZoraLimitOrderBook.json +771 -0
  62. package/cache/solidity-files-cache.json +1 -0
  63. package/dist/index.cjs +760 -0
  64. package/dist/index.cjs.map +1 -0
  65. package/dist/index.d.ts +2 -0
  66. package/dist/index.d.ts.map +1 -0
  67. package/dist/index.js +731 -0
  68. package/dist/index.js.map +1 -0
  69. package/dist/wagmiGenerated.d.ts +1012 -0
  70. package/dist/wagmiGenerated.d.ts.map +1 -0
  71. package/foundry.toml +29 -0
  72. package/gas_comparison.py +49 -0
  73. package/out/BalanceDelta.sol/BalanceDeltaLibrary.json +1 -0
  74. package/out/BeforeSwapDelta.sol/BeforeSwapDeltaLibrary.json +1 -0
  75. package/out/BitMath.sol/BitMath.json +1 -0
  76. package/out/BytesLib.sol/BytesLib.json +1 -0
  77. package/out/CoinCommon.sol/CoinCommon.json +1 -0
  78. package/out/CoinConfigurationVersions.sol/CoinConfigurationVersions.json +1 -0
  79. package/out/CoinConstants.sol/CoinConstants.json +1 -0
  80. package/out/Context.sol/Context.json +1 -0
  81. package/out/Currency.sol/CurrencyLibrary.json +1 -0
  82. package/out/CurrencyReserves.sol/CurrencyReserves.json +1 -0
  83. package/out/CustomRevert.sol/CustomRevert.json +1 -0
  84. package/out/DopplerMath.sol/DopplerMath.json +1 -0
  85. package/out/FixedPoint128.sol/FixedPoint128.json +1 -0
  86. package/out/FixedPoint96.sol/FixedPoint96.json +1 -0
  87. package/out/FullMath.sol/FullMath.json +1 -0
  88. package/out/IAllowanceTransfer.sol/IAllowanceTransfer.json +1 -0
  89. package/out/IAuthority.sol/IAuthority.json +1 -0
  90. package/out/ICoin.sol/ICoin.json +1 -0
  91. package/out/ICoin.sol/IHasCoinType.json +1 -0
  92. package/out/ICoin.sol/IHasPoolKey.json +1 -0
  93. package/out/ICoin.sol/IHasSwapPath.json +1 -0
  94. package/out/ICoin.sol/IHasTotalSupplyForPositions.json +1 -0
  95. package/out/IDeployedCoinVersionLookup.sol/IDeployedCoinVersionLookup.json +1 -0
  96. package/out/IDopplerErrors.sol/IDopplerErrors.json +1 -0
  97. package/out/IEIP712.sol/IEIP712.json +1 -0
  98. package/out/IERC1363.sol/IERC1363.json +1 -0
  99. package/out/IERC165.sol/IERC165.json +1 -0
  100. package/out/IERC20.sol/IERC20.json +1 -0
  101. package/out/IERC20Minimal.sol/IERC20Minimal.json +1 -0
  102. package/out/IERC6909Claims.sol/IERC6909Claims.json +1 -0
  103. package/out/IERC7572.sol/IERC7572.json +1 -0
  104. package/out/IExtsload.sol/IExtsload.json +1 -0
  105. package/out/IExttload.sol/IExttload.json +1 -0
  106. package/out/IHasRewardsRecipients.sol/IHasRewardsRecipients.json +1 -0
  107. package/out/IHooks.sol/IHooks.json +1 -0
  108. package/out/IMsgSender.sol/IMsgSender.json +1 -0
  109. package/out/IPoolManager.sol/IPoolManager.json +1 -0
  110. package/out/IProtocolFees.sol/IProtocolFees.json +1 -0
  111. package/out/ISupportsLimitOrderFill.sol/ISupportsLimitOrderFill.json +1 -0
  112. package/out/ISwapPathRouter.sol/ISwapPathRouter.json +1 -0
  113. package/out/ISwapRouter.sol/ISwapRouter.json +1 -0
  114. package/out/IUniswapV3SwapCallback.sol/IUniswapV3SwapCallback.json +1 -0
  115. package/out/IUpgradeableV4Hook.sol/IUpgradeableDestinationV4Hook.json +1 -0
  116. package/out/IUpgradeableV4Hook.sol/IUpgradeableDestinationV4HookWithUpdateableFee.json +1 -0
  117. package/out/IUpgradeableV4Hook.sol/IUpgradeableV4Hook.json +1 -0
  118. package/out/IZoraHookRegistry.sol/IZoraHookRegistry.json +1 -0
  119. package/out/IZoraLimitOrderBook.sol/IZoraLimitOrderBook.json +1 -0
  120. package/out/IZoraLimitOrderBookCoinsInterface.sol/IZoraLimitOrderBookCoinsInterface.json +1 -0
  121. package/out/IZoraV4CoinHook.sol/IZoraV4CoinHook.json +1 -0
  122. package/out/LimitOrderBitmap.sol/LimitOrderBitmap.json +1 -0
  123. package/out/LimitOrderCommon.sol/LimitOrderCommon.json +1 -0
  124. package/out/LimitOrderCreate.sol/LimitOrderCreate.json +1 -0
  125. package/out/LimitOrderFill.sol/LimitOrderFill.json +1 -0
  126. package/out/LimitOrderLiquidity.sol/LimitOrderLiquidity.json +1 -0
  127. package/out/LimitOrderQueues.sol/LimitOrderQueues.json +1 -0
  128. package/out/LimitOrderStorage.sol/LimitOrderStorage.json +1 -0
  129. package/out/LimitOrderTypes.sol/LimitOrderTypes.json +1 -0
  130. package/out/LimitOrderWithdraw.sol/LimitOrderWithdraw.json +1 -0
  131. package/out/LiquidityAmounts.sol/LiquidityAmounts.json +1 -0
  132. package/out/LiquidityMath.sol/LiquidityMath.json +1 -0
  133. package/out/Lock.sol/Lock.json +1 -0
  134. package/out/NonzeroDeltaCount.sol/NonzeroDeltaCount.json +1 -0
  135. package/out/Path.sol/Path.json +1 -0
  136. package/out/PathKey.sol/PathKeyLibrary.json +1 -0
  137. package/out/Permit2Payments.sol/Permit2Payments.json +1 -0
  138. package/out/PoolId.sol/PoolIdLibrary.json +1 -0
  139. package/out/Position.sol/Position.json +1 -0
  140. package/out/SafeCast.sol/SafeCast.json +1 -0
  141. package/out/SafeCast160.sol/SafeCast160.json +1 -0
  142. package/out/SafeERC20.sol/SafeERC20.json +1 -0
  143. package/out/SimpleAccessManaged.sol/SimpleAccessManaged.json +1 -0
  144. package/out/SimpleAccessManager.sol/SimpleAccessManager.json +1 -0
  145. package/out/SqrtPriceMath.sol/SqrtPriceMath.json +1 -0
  146. package/out/StateLibrary.sol/StateLibrary.json +1 -0
  147. package/out/SwapLimitOrders.sol/SwapLimitOrders.json +1 -0
  148. package/out/SwapWithLimitOrders.sol/SwapWithLimitOrders.json +1 -0
  149. package/out/TickBitmap.sol/TickBitmap.json +1 -0
  150. package/out/TickMath.sol/TickMath.json +1 -0
  151. package/out/TransientSlot.sol/TransientSlot.json +1 -0
  152. package/out/TransientStateLibrary.sol/TransientStateLibrary.json +1 -0
  153. package/out/UniV4SwapToCurrency.sol/UniV4SwapToCurrency.json +1 -0
  154. package/out/UnsafeMath.sol/UnsafeMath.json +1 -0
  155. package/out/V3ToV4SwapLib.sol/V3ToV4SwapLib.json +1 -0
  156. package/out/ZoraLimitOrderBook.sol/ZoraLimitOrderBook.json +1 -0
  157. package/out/build-info/69718f10d1dc37f0.json +1 -0
  158. package/out/uniswap/BitMath.sol/BitMath.json +1 -0
  159. package/out/uniswap/CustomRevert.sol/CustomRevert.json +1 -0
  160. package/out/uniswap/FullMath.sol/FullMath.json +1 -0
  161. package/out/uniswap/SafeCast.sol/SafeCast.json +1 -0
  162. package/out/uniswap/TickMath.sol/TickMath.json +1 -0
  163. package/package/index.ts +1 -0
  164. package/package/wagmiGenerated.ts +738 -0
  165. package/package.json +57 -0
  166. package/remappings.txt +11 -0
  167. package/src/IZoraLimitOrderBook.sol +195 -0
  168. package/src/ZoraLimitOrderBook.sol +220 -0
  169. package/src/access/SimpleAccessManaged.sol +76 -0
  170. package/src/access/SimpleAccessManager.sol +268 -0
  171. package/src/libs/LimitOrderBitmap.sol +84 -0
  172. package/src/libs/LimitOrderCommon.sol +91 -0
  173. package/src/libs/LimitOrderCreate.sol +277 -0
  174. package/src/libs/LimitOrderFill.sol +362 -0
  175. package/src/libs/LimitOrderLiquidity.sol +222 -0
  176. package/src/libs/LimitOrderQueues.sol +101 -0
  177. package/src/libs/LimitOrderStorage.sol +34 -0
  178. package/src/libs/LimitOrderTypes.sol +41 -0
  179. package/src/libs/LimitOrderWithdraw.sol +100 -0
  180. package/src/libs/Permit2Payments.sol +41 -0
  181. package/src/libs/SwapLimitOrders.sol +209 -0
  182. package/src/router/SwapWithLimitOrders.sol +454 -0
  183. package/test/LimitOrderAccessControl.t.sol +461 -0
  184. package/test/LimitOrderBitmap.t.sol +194 -0
  185. package/test/LimitOrderCreate.t.sol +348 -0
  186. package/test/LimitOrderFill.t.sol +1005 -0
  187. package/test/LimitOrderLibraries.t.sol +354 -0
  188. package/test/LimitOrderLiquidityPayouts.t.sol +333 -0
  189. package/test/LimitOrderV4Pools.t.sol +157 -0
  190. package/test/LimitOrderWithdraw.t.sol +653 -0
  191. package/test/SimpleAccessManager.t.sol +420 -0
  192. package/test/SwapWithLimitOrders.t.sol +107 -0
  193. package/test/SwapWithLimitOrdersRouter.t.sol +1073 -0
  194. package/test/gas/LimitOrderFillGas.t.sol +1008 -0
  195. package/test/gas/LimitOrderSwapGas.t.sol +403 -0
  196. package/test/gas/logs/gas_benchmarks_fill_20251201.log +30 -0
  197. package/test/gas/logs/gas_benchmarks_swap_20251201.log +27 -0
  198. package/test/unit/LimitOrderBitmapUnit.t.sol +276 -0
  199. package/test/unit/LimitOrderCreateUnit.t.sol +358 -0
  200. package/test/unit/SwapLimitOrdersUnit.t.sol +672 -0
  201. package/test/unit/SwapLimitOrdersValidation.t.sol +423 -0
  202. package/test/unit/SwapWithLimitOrdersUnit.t.sol +321 -0
  203. package/test/utils/BaseTest.sol +793 -0
  204. package/test/utils/TestableZoraLimitOrderBook.sol +54 -0
  205. package/tsconfig.build.json +10 -0
  206. package/tsconfig.json +9 -0
  207. package/tsup.config.ts +11 -0
  208. package/wagmi.config.ts +18 -0
@@ -0,0 +1,738 @@
1
+ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2
+ // IZoraLimitOrderBookCoinsInterface
3
+ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
4
+
5
+ export const iZoraLimitOrderBookCoinsInterfaceABI = [
6
+ {
7
+ type: 'function',
8
+ inputs: [
9
+ {
10
+ name: 'key',
11
+ internalType: 'struct PoolKey',
12
+ type: 'tuple',
13
+ components: [
14
+ { name: 'currency0', internalType: 'Currency', type: 'address' },
15
+ { name: 'currency1', internalType: 'Currency', type: 'address' },
16
+ { name: 'fee', internalType: 'uint24', type: 'uint24' },
17
+ { name: 'tickSpacing', internalType: 'int24', type: 'int24' },
18
+ { name: 'hooks', internalType: 'contract IHooks', type: 'address' },
19
+ ],
20
+ },
21
+ { name: 'isCurrency0', internalType: 'bool', type: 'bool' },
22
+ { name: 'startTick', internalType: 'int24', type: 'int24' },
23
+ { name: 'endTick', internalType: 'int24', type: 'int24' },
24
+ { name: 'maxFillCount', internalType: 'uint256', type: 'uint256' },
25
+ { name: 'fillReferral', internalType: 'address', type: 'address' },
26
+ ],
27
+ name: 'fill',
28
+ outputs: [],
29
+ stateMutability: 'nonpayable',
30
+ },
31
+ ] as const
32
+
33
+ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
34
+ // SwapWithLimitOrders
35
+ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
36
+
37
+ export const swapWithLimitOrdersABI = [
38
+ {
39
+ type: 'constructor',
40
+ inputs: [
41
+ {
42
+ name: 'poolManager_',
43
+ internalType: 'contract IPoolManager',
44
+ type: 'address',
45
+ },
46
+ {
47
+ name: 'zoraLimitOrderBook_',
48
+ internalType: 'contract IZoraLimitOrderBook',
49
+ type: 'address',
50
+ },
51
+ {
52
+ name: 'swapRouter_',
53
+ internalType: 'contract ISwapRouter',
54
+ type: 'address',
55
+ },
56
+ { name: 'permit2_', internalType: 'address', type: 'address' },
57
+ ],
58
+ stateMutability: 'nonpayable',
59
+ },
60
+ { type: 'receive', stateMutability: 'payable' },
61
+ {
62
+ type: 'function',
63
+ inputs: [],
64
+ name: 'getLimitOrderConfig',
65
+ outputs: [
66
+ {
67
+ name: '',
68
+ internalType: 'struct LimitOrderConfig',
69
+ type: 'tuple',
70
+ components: [
71
+ { name: 'multiples', internalType: 'uint256[]', type: 'uint256[]' },
72
+ { name: 'percentages', internalType: 'uint256[]', type: 'uint256[]' },
73
+ ],
74
+ },
75
+ ],
76
+ stateMutability: 'view',
77
+ },
78
+ {
79
+ type: 'function',
80
+ inputs: [],
81
+ name: 'msgSender',
82
+ outputs: [{ name: '', internalType: 'address', type: 'address' }],
83
+ stateMutability: 'view',
84
+ },
85
+ {
86
+ type: 'function',
87
+ inputs: [],
88
+ name: 'poolManager',
89
+ outputs: [
90
+ { name: '', internalType: 'contract IPoolManager', type: 'address' },
91
+ ],
92
+ stateMutability: 'view',
93
+ },
94
+ {
95
+ type: 'function',
96
+ inputs: [
97
+ {
98
+ name: 'config',
99
+ internalType: 'struct LimitOrderConfig',
100
+ type: 'tuple',
101
+ components: [
102
+ { name: 'multiples', internalType: 'uint256[]', type: 'uint256[]' },
103
+ { name: 'percentages', internalType: 'uint256[]', type: 'uint256[]' },
104
+ ],
105
+ },
106
+ ],
107
+ name: 'setLimitOrderConfig',
108
+ outputs: [],
109
+ stateMutability: 'nonpayable',
110
+ },
111
+ {
112
+ type: 'function',
113
+ inputs: [],
114
+ name: 'swapRouter',
115
+ outputs: [
116
+ { name: '', internalType: 'contract ISwapRouter', type: 'address' },
117
+ ],
118
+ stateMutability: 'view',
119
+ },
120
+ {
121
+ type: 'function',
122
+ inputs: [
123
+ {
124
+ name: 'params',
125
+ internalType: 'struct SwapWithLimitOrders.SwapWithLimitOrdersParams',
126
+ type: 'tuple',
127
+ components: [
128
+ { name: 'recipient', internalType: 'address', type: 'address' },
129
+ {
130
+ name: 'limitOrderConfig',
131
+ internalType: 'struct LimitOrderConfig',
132
+ type: 'tuple',
133
+ components: [
134
+ {
135
+ name: 'multiples',
136
+ internalType: 'uint256[]',
137
+ type: 'uint256[]',
138
+ },
139
+ {
140
+ name: 'percentages',
141
+ internalType: 'uint256[]',
142
+ type: 'uint256[]',
143
+ },
144
+ ],
145
+ },
146
+ { name: 'inputCurrency', internalType: 'address', type: 'address' },
147
+ { name: 'inputAmount', internalType: 'uint256', type: 'uint256' },
148
+ { name: 'v3Route', internalType: 'bytes', type: 'bytes' },
149
+ {
150
+ name: 'v4Route',
151
+ internalType: 'struct PoolKey[]',
152
+ type: 'tuple[]',
153
+ components: [
154
+ { name: 'currency0', internalType: 'Currency', type: 'address' },
155
+ { name: 'currency1', internalType: 'Currency', type: 'address' },
156
+ { name: 'fee', internalType: 'uint24', type: 'uint24' },
157
+ { name: 'tickSpacing', internalType: 'int24', type: 'int24' },
158
+ {
159
+ name: 'hooks',
160
+ internalType: 'contract IHooks',
161
+ type: 'address',
162
+ },
163
+ ],
164
+ },
165
+ { name: 'minAmountOut', internalType: 'uint256', type: 'uint256' },
166
+ ],
167
+ },
168
+ ],
169
+ name: 'swapWithLimitOrders',
170
+ outputs: [{ name: 'delta', internalType: 'BalanceDelta', type: 'int256' }],
171
+ stateMutability: 'payable',
172
+ },
173
+ {
174
+ type: 'function',
175
+ inputs: [{ name: 'data', internalType: 'bytes', type: 'bytes' }],
176
+ name: 'unlockCallback',
177
+ outputs: [{ name: '', internalType: 'bytes', type: 'bytes' }],
178
+ stateMutability: 'nonpayable',
179
+ },
180
+ {
181
+ type: 'function',
182
+ inputs: [],
183
+ name: 'zoraLimitOrderBook',
184
+ outputs: [
185
+ {
186
+ name: '',
187
+ internalType: 'contract IZoraLimitOrderBook',
188
+ type: 'address',
189
+ },
190
+ ],
191
+ stateMutability: 'view',
192
+ },
193
+ {
194
+ type: 'event',
195
+ anonymous: false,
196
+ inputs: [
197
+ {
198
+ name: 'multiples',
199
+ internalType: 'uint256[]',
200
+ type: 'uint256[]',
201
+ indexed: false,
202
+ },
203
+ {
204
+ name: 'percentages',
205
+ internalType: 'uint256[]',
206
+ type: 'uint256[]',
207
+ indexed: false,
208
+ },
209
+ ],
210
+ name: 'LimitOrderConfigUpdated',
211
+ },
212
+ {
213
+ type: 'event',
214
+ anonymous: false,
215
+ inputs: [
216
+ {
217
+ name: 'sender',
218
+ internalType: 'address',
219
+ type: 'address',
220
+ indexed: true,
221
+ },
222
+ {
223
+ name: 'recipient',
224
+ internalType: 'address',
225
+ type: 'address',
226
+ indexed: true,
227
+ },
228
+ {
229
+ name: 'poolKey',
230
+ internalType: 'struct PoolKey',
231
+ type: 'tuple',
232
+ components: [
233
+ { name: 'currency0', internalType: 'Currency', type: 'address' },
234
+ { name: 'currency1', internalType: 'Currency', type: 'address' },
235
+ { name: 'fee', internalType: 'uint24', type: 'uint24' },
236
+ { name: 'tickSpacing', internalType: 'int24', type: 'int24' },
237
+ { name: 'hooks', internalType: 'contract IHooks', type: 'address' },
238
+ ],
239
+ indexed: false,
240
+ },
241
+ {
242
+ name: 'delta',
243
+ internalType: 'BalanceDelta',
244
+ type: 'int256',
245
+ indexed: false,
246
+ },
247
+ {
248
+ name: 'tickBeforeSwap',
249
+ internalType: 'int24',
250
+ type: 'int24',
251
+ indexed: false,
252
+ },
253
+ {
254
+ name: 'tickAfterSwap',
255
+ internalType: 'int24',
256
+ type: 'int24',
257
+ indexed: false,
258
+ },
259
+ {
260
+ name: 'orders',
261
+ internalType: 'struct SwapWithLimitOrders.CreatedOrder[]',
262
+ type: 'tuple[]',
263
+ components: [
264
+ { name: 'orderId', internalType: 'bytes32', type: 'bytes32' },
265
+ { name: 'multiple', internalType: 'uint256', type: 'uint256' },
266
+ { name: 'percentage', internalType: 'uint256', type: 'uint256' },
267
+ ],
268
+ indexed: false,
269
+ },
270
+ ],
271
+ name: 'SwapWithLimitOrdersExecuted',
272
+ },
273
+ { type: 'error', inputs: [], name: 'EmptyV4Route' },
274
+ { type: 'error', inputs: [], name: 'FromAddressIsNotOwner' },
275
+ {
276
+ type: 'error',
277
+ inputs: [
278
+ { name: 'inputAmount', internalType: 'uint256', type: 'uint256' },
279
+ { name: 'availableAmount', internalType: 'uint256', type: 'uint256' },
280
+ ],
281
+ name: 'InsufficientInputCurrency',
282
+ },
283
+ { type: 'error', inputs: [], name: 'InsufficientOutputAmount' },
284
+ { type: 'error', inputs: [], name: 'InsufficientTransferFunds' },
285
+ { type: 'error', inputs: [], name: 'InvalidLimitOrderConfig' },
286
+ { type: 'error', inputs: [], name: 'InvalidMultiple' },
287
+ { type: 'error', inputs: [], name: 'InvalidPercent' },
288
+ { type: 'error', inputs: [], name: 'LengthMismatch' },
289
+ { type: 'error', inputs: [], name: 'OnlyAuthority' },
290
+ { type: 'error', inputs: [], name: 'OnlyPoolManager' },
291
+ { type: 'error', inputs: [], name: 'PercentOverflow' },
292
+ {
293
+ type: 'error',
294
+ inputs: [{ name: 'token', internalType: 'address', type: 'address' }],
295
+ name: 'SafeERC20FailedOperation',
296
+ },
297
+ { type: 'error', inputs: [], name: 'UnsafeCast' },
298
+ { type: 'error', inputs: [], name: 'V3RouteDoesNotConnectToV4RouteStart' },
299
+ { type: 'error', inputs: [], name: 'ZeroSwapDelta' },
300
+ ] as const
301
+
302
+ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
303
+ // ZoraLimitOrderBook
304
+ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
305
+
306
+ export const zoraLimitOrderBookABI = [
307
+ {
308
+ type: 'constructor',
309
+ inputs: [
310
+ { name: 'poolManager_', internalType: 'address', type: 'address' },
311
+ {
312
+ name: 'zoraCoinVersionLookup_',
313
+ internalType: 'address',
314
+ type: 'address',
315
+ },
316
+ { name: 'zoraHookRegistry_', internalType: 'address', type: 'address' },
317
+ { name: 'authority_', internalType: 'address', type: 'address' },
318
+ ],
319
+ stateMutability: 'nonpayable',
320
+ },
321
+ { type: 'receive', stateMutability: 'payable' },
322
+ {
323
+ type: 'function',
324
+ inputs: [],
325
+ name: 'authority',
326
+ outputs: [{ name: '', internalType: 'address', type: 'address' }],
327
+ stateMutability: 'view',
328
+ },
329
+ {
330
+ type: 'function',
331
+ inputs: [
332
+ { name: 'maker', internalType: 'address', type: 'address' },
333
+ { name: 'coin', internalType: 'address', type: 'address' },
334
+ ],
335
+ name: 'balanceOf',
336
+ outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }],
337
+ stateMutability: 'view',
338
+ },
339
+ {
340
+ type: 'function',
341
+ inputs: [
342
+ {
343
+ name: 'key',
344
+ internalType: 'struct PoolKey',
345
+ type: 'tuple',
346
+ components: [
347
+ { name: 'currency0', internalType: 'Currency', type: 'address' },
348
+ { name: 'currency1', internalType: 'Currency', type: 'address' },
349
+ { name: 'fee', internalType: 'uint24', type: 'uint24' },
350
+ { name: 'tickSpacing', internalType: 'int24', type: 'int24' },
351
+ { name: 'hooks', internalType: 'contract IHooks', type: 'address' },
352
+ ],
353
+ },
354
+ { name: 'isCurrency0', internalType: 'bool', type: 'bool' },
355
+ { name: 'orderSizes', internalType: 'uint256[]', type: 'uint256[]' },
356
+ { name: 'orderTicks', internalType: 'int24[]', type: 'int24[]' },
357
+ { name: 'maker', internalType: 'address', type: 'address' },
358
+ ],
359
+ name: 'create',
360
+ outputs: [{ name: '', internalType: 'bytes32[]', type: 'bytes32[]' }],
361
+ stateMutability: 'payable',
362
+ },
363
+ {
364
+ type: 'function',
365
+ inputs: [
366
+ {
367
+ name: 'key',
368
+ internalType: 'struct PoolKey',
369
+ type: 'tuple',
370
+ components: [
371
+ { name: 'currency0', internalType: 'Currency', type: 'address' },
372
+ { name: 'currency1', internalType: 'Currency', type: 'address' },
373
+ { name: 'fee', internalType: 'uint24', type: 'uint24' },
374
+ { name: 'tickSpacing', internalType: 'int24', type: 'int24' },
375
+ { name: 'hooks', internalType: 'contract IHooks', type: 'address' },
376
+ ],
377
+ },
378
+ { name: 'isCurrency0', internalType: 'bool', type: 'bool' },
379
+ { name: 'startTick', internalType: 'int24', type: 'int24' },
380
+ { name: 'endTick', internalType: 'int24', type: 'int24' },
381
+ { name: 'maxFillCount', internalType: 'uint256', type: 'uint256' },
382
+ { name: 'fillReferral', internalType: 'address', type: 'address' },
383
+ ],
384
+ name: 'fill',
385
+ outputs: [],
386
+ stateMutability: 'nonpayable',
387
+ },
388
+ {
389
+ type: 'function',
390
+ inputs: [
391
+ {
392
+ name: 'batches',
393
+ internalType: 'struct IZoraLimitOrderBook.OrderBatch[]',
394
+ type: 'tuple[]',
395
+ components: [
396
+ {
397
+ name: 'key',
398
+ internalType: 'struct PoolKey',
399
+ type: 'tuple',
400
+ components: [
401
+ { name: 'currency0', internalType: 'Currency', type: 'address' },
402
+ { name: 'currency1', internalType: 'Currency', type: 'address' },
403
+ { name: 'fee', internalType: 'uint24', type: 'uint24' },
404
+ { name: 'tickSpacing', internalType: 'int24', type: 'int24' },
405
+ {
406
+ name: 'hooks',
407
+ internalType: 'contract IHooks',
408
+ type: 'address',
409
+ },
410
+ ],
411
+ },
412
+ { name: 'isCurrency0', internalType: 'bool', type: 'bool' },
413
+ { name: 'orderIds', internalType: 'bytes32[]', type: 'bytes32[]' },
414
+ ],
415
+ },
416
+ { name: 'fillReferral', internalType: 'address', type: 'address' },
417
+ ],
418
+ name: 'fill',
419
+ outputs: [],
420
+ stateMutability: 'nonpayable',
421
+ },
422
+ {
423
+ type: 'function',
424
+ inputs: [],
425
+ name: 'getMaxFillCount',
426
+ outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }],
427
+ stateMutability: 'view',
428
+ },
429
+ {
430
+ type: 'function',
431
+ inputs: [],
432
+ name: 'poolManager',
433
+ outputs: [
434
+ { name: '', internalType: 'contract IPoolManager', type: 'address' },
435
+ ],
436
+ stateMutability: 'view',
437
+ },
438
+ {
439
+ type: 'function',
440
+ inputs: [
441
+ { name: 'newAuthority', internalType: 'address', type: 'address' },
442
+ ],
443
+ name: 'setAuthority',
444
+ outputs: [],
445
+ stateMutability: 'nonpayable',
446
+ },
447
+ {
448
+ type: 'function',
449
+ inputs: [
450
+ { name: 'maxFillCount', internalType: 'uint256', type: 'uint256' },
451
+ ],
452
+ name: 'setMaxFillCount',
453
+ outputs: [],
454
+ stateMutability: 'nonpayable',
455
+ },
456
+ {
457
+ type: 'function',
458
+ inputs: [{ name: 'data', internalType: 'bytes', type: 'bytes' }],
459
+ name: 'unlockCallback',
460
+ outputs: [{ name: '', internalType: 'bytes', type: 'bytes' }],
461
+ stateMutability: 'nonpayable',
462
+ },
463
+ {
464
+ type: 'function',
465
+ inputs: [
466
+ { name: 'orderIds', internalType: 'bytes32[]', type: 'bytes32[]' },
467
+ { name: 'coin', internalType: 'address', type: 'address' },
468
+ { name: 'minAmountOut', internalType: 'uint256', type: 'uint256' },
469
+ { name: 'recipient', internalType: 'address', type: 'address' },
470
+ ],
471
+ name: 'withdraw',
472
+ outputs: [],
473
+ stateMutability: 'nonpayable',
474
+ },
475
+ {
476
+ type: 'function',
477
+ inputs: [],
478
+ name: 'zoraCoinVersionLookup',
479
+ outputs: [
480
+ {
481
+ name: '',
482
+ internalType: 'contract IDeployedCoinVersionLookup',
483
+ type: 'address',
484
+ },
485
+ ],
486
+ stateMutability: 'view',
487
+ },
488
+ {
489
+ type: 'function',
490
+ inputs: [],
491
+ name: 'zoraHookRegistry',
492
+ outputs: [
493
+ { name: '', internalType: 'contract IZoraHookRegistry', type: 'address' },
494
+ ],
495
+ stateMutability: 'view',
496
+ },
497
+ {
498
+ type: 'event',
499
+ anonymous: false,
500
+ inputs: [
501
+ {
502
+ name: 'authority',
503
+ internalType: 'address',
504
+ type: 'address',
505
+ indexed: false,
506
+ },
507
+ ],
508
+ name: 'AuthorityUpdated',
509
+ },
510
+ {
511
+ type: 'event',
512
+ anonymous: false,
513
+ inputs: [
514
+ {
515
+ name: 'maker',
516
+ internalType: 'address',
517
+ type: 'address',
518
+ indexed: true,
519
+ },
520
+ { name: 'coin', internalType: 'address', type: 'address', indexed: true },
521
+ {
522
+ name: 'poolKeyHash',
523
+ internalType: 'bytes32',
524
+ type: 'bytes32',
525
+ indexed: false,
526
+ },
527
+ {
528
+ name: 'isCurrency0',
529
+ internalType: 'bool',
530
+ type: 'bool',
531
+ indexed: false,
532
+ },
533
+ {
534
+ name: 'orderTick',
535
+ internalType: 'int24',
536
+ type: 'int24',
537
+ indexed: false,
538
+ },
539
+ {
540
+ name: 'currentTick',
541
+ internalType: 'int24',
542
+ type: 'int24',
543
+ indexed: false,
544
+ },
545
+ {
546
+ name: 'orderSize',
547
+ internalType: 'uint128',
548
+ type: 'uint128',
549
+ indexed: false,
550
+ },
551
+ {
552
+ name: 'orderId',
553
+ internalType: 'bytes32',
554
+ type: 'bytes32',
555
+ indexed: false,
556
+ },
557
+ ],
558
+ name: 'LimitOrderCreated',
559
+ },
560
+ {
561
+ type: 'event',
562
+ anonymous: false,
563
+ inputs: [
564
+ {
565
+ name: 'maker',
566
+ internalType: 'address',
567
+ type: 'address',
568
+ indexed: true,
569
+ },
570
+ {
571
+ name: 'coinIn',
572
+ internalType: 'address',
573
+ type: 'address',
574
+ indexed: true,
575
+ },
576
+ {
577
+ name: 'coinOut',
578
+ internalType: 'address',
579
+ type: 'address',
580
+ indexed: false,
581
+ },
582
+ {
583
+ name: 'amountIn',
584
+ internalType: 'uint128',
585
+ type: 'uint128',
586
+ indexed: false,
587
+ },
588
+ {
589
+ name: 'amountOut',
590
+ internalType: 'uint128',
591
+ type: 'uint128',
592
+ indexed: false,
593
+ },
594
+ {
595
+ name: 'fillReferral',
596
+ internalType: 'address',
597
+ type: 'address',
598
+ indexed: false,
599
+ },
600
+ {
601
+ name: 'fillReferralAmount',
602
+ internalType: 'uint128',
603
+ type: 'uint128',
604
+ indexed: false,
605
+ },
606
+ {
607
+ name: 'poolKeyHash',
608
+ internalType: 'bytes32',
609
+ type: 'bytes32',
610
+ indexed: false,
611
+ },
612
+ { name: 'tick', internalType: 'int24', type: 'int24', indexed: false },
613
+ {
614
+ name: 'orderId',
615
+ internalType: 'bytes32',
616
+ type: 'bytes32',
617
+ indexed: false,
618
+ },
619
+ ],
620
+ name: 'LimitOrderFilled',
621
+ },
622
+ {
623
+ type: 'event',
624
+ anonymous: false,
625
+ inputs: [
626
+ {
627
+ name: 'maker',
628
+ internalType: 'address',
629
+ type: 'address',
630
+ indexed: true,
631
+ },
632
+ { name: 'coin', internalType: 'address', type: 'address', indexed: true },
633
+ {
634
+ name: 'poolKeyHash',
635
+ internalType: 'bytes32',
636
+ type: 'bytes32',
637
+ indexed: false,
638
+ },
639
+ {
640
+ name: 'isCurrency0',
641
+ internalType: 'bool',
642
+ type: 'bool',
643
+ indexed: false,
644
+ },
645
+ { name: 'tick', internalType: 'int24', type: 'int24', indexed: false },
646
+ {
647
+ name: 'orderSize',
648
+ internalType: 'uint128',
649
+ type: 'uint128',
650
+ indexed: false,
651
+ },
652
+ {
653
+ name: 'orderId',
654
+ internalType: 'bytes32',
655
+ type: 'bytes32',
656
+ indexed: false,
657
+ },
658
+ {
659
+ name: 'isCancelled',
660
+ internalType: 'bool',
661
+ type: 'bool',
662
+ indexed: false,
663
+ },
664
+ ],
665
+ name: 'LimitOrderUpdated',
666
+ },
667
+ {
668
+ type: 'event',
669
+ anonymous: false,
670
+ inputs: [
671
+ {
672
+ name: 'maker',
673
+ internalType: 'address',
674
+ type: 'address',
675
+ indexed: true,
676
+ },
677
+ { name: 'coin', internalType: 'address', type: 'address', indexed: true },
678
+ {
679
+ name: 'newBalance',
680
+ internalType: 'uint256',
681
+ type: 'uint256',
682
+ indexed: false,
683
+ },
684
+ ],
685
+ name: 'MakerBalanceUpdated',
686
+ },
687
+ {
688
+ type: 'error',
689
+ inputs: [{ name: 'authority', internalType: 'address', type: 'address' }],
690
+ name: 'AccessManagedInvalidAuthority',
691
+ },
692
+ { type: 'error', inputs: [], name: 'AccessManagedUnauthorized' },
693
+ { type: 'error', inputs: [], name: 'AddressZero' },
694
+ { type: 'error', inputs: [], name: 'ArrayLengthMismatch' },
695
+ {
696
+ type: 'error',
697
+ inputs: [
698
+ { name: 'orderId', internalType: 'bytes32', type: 'bytes32' },
699
+ { name: 'expectedCoin', internalType: 'address', type: 'address' },
700
+ { name: 'actualCoin', internalType: 'address', type: 'address' },
701
+ ],
702
+ name: 'CoinMismatch',
703
+ },
704
+ { type: 'error', inputs: [], name: 'InsufficientForwardedFunds' },
705
+ { type: 'error', inputs: [], name: 'InsufficientTransferFunds' },
706
+ {
707
+ type: 'error',
708
+ inputs: [
709
+ { name: 'startTick', internalType: 'int24', type: 'int24' },
710
+ { name: 'endTick', internalType: 'int24', type: 'int24' },
711
+ { name: 'isCurrency0', internalType: 'bool', type: 'bool' },
712
+ ],
713
+ name: 'InvalidFillWindow',
714
+ },
715
+ { type: 'error', inputs: [], name: 'InvalidOrder' },
716
+ { type: 'error', inputs: [], name: 'InvalidPoolKey' },
717
+ { type: 'error', inputs: [], name: 'MaxFillCountCannotBeZero' },
718
+ {
719
+ type: 'error',
720
+ inputs: [
721
+ { name: 'withdrawn', internalType: 'uint256', type: 'uint256' },
722
+ { name: 'minAmountOut', internalType: 'uint256', type: 'uint256' },
723
+ ],
724
+ name: 'MinAmountNotReached',
725
+ },
726
+ { type: 'error', inputs: [], name: 'NativeValueMismatch' },
727
+ { type: 'error', inputs: [], name: 'NotPoolManager' },
728
+ { type: 'error', inputs: [], name: 'OnlyZoraHook' },
729
+ { type: 'error', inputs: [], name: 'OrderClosed' },
730
+ { type: 'error', inputs: [], name: 'OrderNotMaker' },
731
+ { type: 'error', inputs: [], name: 'PathMustHaveAtLeastOneStep' },
732
+ { type: 'error', inputs: [], name: 'RouterMsgSenderInvalid' },
733
+ { type: 'error', inputs: [], name: 'UnknownCallback' },
734
+ { type: 'error', inputs: [], name: 'UnlockedFillNotAllowed' },
735
+ { type: 'error', inputs: [], name: 'ZeroMaker' },
736
+ { type: 'error', inputs: [], name: 'ZeroOrderSize' },
737
+ { type: 'error', inputs: [], name: 'ZeroRealizedOrder' },
738
+ ] as const