@zoralabs/limit-orders 0.2.2 → 0.2.5
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.
- package/.abi-stability +70 -0
- package/.turbo/turbo-build$colon$js.log +44 -45
- package/AUDIT_NOTES.md +0 -1
- package/CHANGELOG.md +29 -0
- package/README.md +6 -9
- package/SPEC.md +5 -5
- package/cache/solidity-files-cache.json +1 -1
- package/out/CoinConfigurationVersions.sol/CoinConfigurationVersions.json +1 -1
- package/out/CoinConstants.sol/CoinConstants.json +1 -1
- package/out/DopplerMath.sol/DopplerMath.json +1 -1
- package/out/LimitOrderBitmap.sol/LimitOrderBitmap.json +1 -1
- package/out/LimitOrderCommon.sol/LimitOrderCommon.json +1 -1
- package/out/LimitOrderCreate.sol/LimitOrderCreate.json +1 -1
- package/out/LimitOrderFill.sol/LimitOrderFill.json +1 -1
- package/out/LimitOrderLiquidity.sol/LimitOrderLiquidity.json +1 -1
- package/out/LimitOrderWithdraw.sol/LimitOrderWithdraw.json +1 -1
- package/out/PermittedCallers.sol/PermittedCallers.json +1 -1
- package/out/SwapLimitOrders.sol/SwapLimitOrders.json +1 -1
- package/out/SwapWithLimitOrders.sol/SwapWithLimitOrders.json +1 -1
- package/out/UniV4SwapToCurrency.sol/UniV4SwapToCurrency.json +1 -1
- package/out/V3ToV4SwapLib.sol/V3ToV4SwapLib.json +1 -1
- package/out/ZoraLimitOrderBook.sol/ZoraLimitOrderBook.json +1 -1
- package/out/build-info/{37e0124d88d60569.json → c9f7ee5726bfbd48.json} +1 -1
- package/package.json +4 -2
- package/src/access/PermittedCallers.sol +5 -1
- package/src/libs/LimitOrderBitmap.sol +0 -1
- package/src/libs/LimitOrderCommon.sol +14 -0
- package/src/libs/LimitOrderCreate.sol +6 -0
- package/src/libs/LimitOrderFill.sol +3 -20
- package/src/libs/LimitOrderLiquidity.sol +61 -38
- package/src/libs/LimitOrderWithdraw.sol +2 -6
- package/src/libs/SwapLimitOrders.sol +13 -7
- package/src/router/SwapWithLimitOrders.sol +2 -2
- package/test/LimitOrderLiquidityPayouts.t.sol +14 -14
- package/test/SwapWithLimitOrdersRouter.t.sol +4 -0
- package/test/unit/LimitOrderCreateUnit.t.sol +17 -17
- package/test/unit/SwapLimitOrdersUnit.t.sol +47 -86
- package/test/unit/SwapLimitOrdersValidation.t.sol +3 -11
- package/test/utils/BaseTest.sol +1 -1
- package/AUDIT_RFP.md +0 -408
- package/abis/ISetLimitOrderConfig.json +0 -27
- package/out/ISetLimitOrderConfig.sol/ISetLimitOrderConfig.json +0 -1
- package/src/router/ISetLimitOrderConfig.sol +0 -12
package/AUDIT_RFP.md
DELETED
|
@@ -1,408 +0,0 @@
|
|
|
1
|
-
# Zora Protocol Limit Orders (aka "Autosell") - Audit Scope Document
|
|
2
|
-
|
|
3
|
-
**Version**: 1.2
|
|
4
|
-
**Date**: 2025-12-12
|
|
5
|
-
**Branch**: `autosell`
|
|
6
|
-
**Purpose**: Audit scope and technical reference for engaged auditors
|
|
7
|
-
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
## Executive Summary
|
|
11
|
-
|
|
12
|
-
Zora has implemented a limit orders system that enables users to create onchain
|
|
13
|
-
orders that automatically execute when Uniswap V4 pool prices reach
|
|
14
|
-
predetermined ticks. This document provides complete scope, technical analysis,
|
|
15
|
-
and security considerations for the audit engagement.
|
|
16
|
-
|
|
17
|
-
**Scope**: ~2,758 lines of Solidity across 16 new files
|
|
18
|
-
**Focus Areas**: Linked list integrity, epoch-based execution isolation, bitmap optimization, access control
|
|
19
|
-
**Ideal Auditor Profile**: Strong familiarity with DeFi protocols and Uniswap V4 architecture (liquidity positions, hook patterns, unlock callbacks, transient storage)
|
|
20
|
-
|
|
21
|
-
---
|
|
22
|
-
|
|
23
|
-
## Technical Architecture Reference
|
|
24
|
-
|
|
25
|
-
**Supporting docs**
|
|
26
|
-
|
|
27
|
-
- [`README.md`](./README.md) — architecture, diagrams, execution paths
|
|
28
|
-
- [`SPEC.md`](./SPEC.md) — normative behavior and invariants (“what must be true”)
|
|
29
|
-
- [`AUDIT_NOTES.md`](./AUDIT_NOTES.md) — threat model + audit checklist
|
|
30
|
-
|
|
31
|
-
This RFP focuses on audit scope, security considerations, and deliverables.
|
|
32
|
-
|
|
33
|
-
---
|
|
34
|
-
|
|
35
|
-
## Quick Navigation
|
|
36
|
-
|
|
37
|
-
### Part 1: Audit Scope & Process
|
|
38
|
-
|
|
39
|
-
- [Audit Scope](#part-1-audit-scope) - What's in/out of scope
|
|
40
|
-
- [Areas of Technical Complexity](#areas-of-technical-complexity) - Implementation details
|
|
41
|
-
- [Audit Deliverables](#audit-deliverables)
|
|
42
|
-
- [Timeline & Process](#timeline-and-process)
|
|
43
|
-
- [Clarifications Needed](#clarifications-needed)
|
|
44
|
-
|
|
45
|
-
### Part 2: Technical Implementation
|
|
46
|
-
|
|
47
|
-
- [File Structure](#file-structure) - All 15 files documented
|
|
48
|
-
- [Data Structures](#data-structures) - LimitOrder, Queue, Order IDs
|
|
49
|
-
- [Storage Organization](#storage-organization) - Storage layout
|
|
50
|
-
- [External Functions](#external-functions) - create, fill, withdraw
|
|
51
|
-
|
|
52
|
-
### Part 3: Additional Information
|
|
53
|
-
|
|
54
|
-
- [Known Limitations](#known-limitations)
|
|
55
|
-
|
|
56
|
-
---
|
|
57
|
-
|
|
58
|
-
# PART 1: AUDIT SCOPE
|
|
59
|
-
|
|
60
|
-
## Overview
|
|
61
|
-
|
|
62
|
-
_For detailed architecture, see [README: Overview](./README.md#1-overview) and [Limit Orders Architecture](./README.md#3-limit-orders-architecture-overview)_
|
|
63
|
-
|
|
64
|
-
The limit orders system allows users to:
|
|
65
|
-
|
|
66
|
-
1. **Create orders** by adding Uniswap V4 liquidity positions across a one-tick-spacing range
|
|
67
|
-
2. **Fill orders** automatically when pool price crosses into the order's range
|
|
68
|
-
3. **Withdraw orders** by cancelling specific orders by ID and withdrawing the resulting funds to a recipient.
|
|
69
|
-
- The call cancels orders in the order provided until `minAmountOut` is reached (or cancels all provided orders if `minAmountOut == 0`).
|
|
70
|
-
- Cancellation is whole-order only (no proportional/partial cancellation).
|
|
71
|
-
|
|
72
|
-
**Key Innovation**: Implements limit orders as single-sided Uniswap V4 liquidity positions, providing a completely native onchain approach that keeps liquidity in the pools for improved trading. Uses linked list queues, bitmap optimization, and epoch-based execution isolation for efficient order matching.
|
|
73
|
-
|
|
74
|
-
## In-Scope Contracts
|
|
75
|
-
|
|
76
|
-
### Primary Package: `packages/limit-orders/src/`
|
|
77
|
-
|
|
78
|
-
#### Core Contracts (2 files, ~418 LOC)
|
|
79
|
-
|
|
80
|
-
**ZoraLimitOrderBook.sol** (229 lines)
|
|
81
|
-
|
|
82
|
-
- Main contract implementing the order book
|
|
83
|
-
- Manages pool manager unlock/callback patterns
|
|
84
|
-
- Delegates to library contracts for execution
|
|
85
|
-
- Access control via SimpleAccessManaged
|
|
86
|
-
|
|
87
|
-
**IZoraLimitOrderBook.sol** (189 lines)
|
|
88
|
-
|
|
89
|
-
- Public API interface and event definitions
|
|
90
|
-
- 3 callback types: CREATE, FILL, WITHDRAW_ORDERS
|
|
91
|
-
- 21 error types for validation
|
|
92
|
-
- Data structure definitions for callbacks
|
|
93
|
-
|
|
94
|
-
#### Access Control (2 files, ~345 LOC)
|
|
95
|
-
|
|
96
|
-
**access/SimpleAccessManaged.sol** (76 lines)
|
|
97
|
-
|
|
98
|
-
- Lightweight fork of OpenZeppelin's [AccessManaged](https://docs.openzeppelin.com/contracts/5.x/api/access#AccessManaged) contract, reduced in complexity to minimize code size
|
|
99
|
-
- Uses the same security architecture (authority-based permissions via `IAuthority.canCall()`)
|
|
100
|
-
- Removes time-based permissions methodology (no delays, no scheduled operations)
|
|
101
|
-
- Controls `create()` and `setMaxFillCount()` functions
|
|
102
|
-
|
|
103
|
-
**access/SimpleAccessManager.sol** (268 lines)
|
|
104
|
-
|
|
105
|
-
- Full role-based access manager implementation
|
|
106
|
-
- Provides complete `IAuthority` interface implementation
|
|
107
|
-
- Supports role-based permissions with admin delegation
|
|
108
|
-
- `PUBLIC_ROLE` support for unrestricted functions
|
|
109
|
-
- Function selector mapping to specific roles
|
|
110
|
-
|
|
111
|
-
#### Type Definitions & Storage (2 files, ~79 LOC)
|
|
112
|
-
|
|
113
|
-
**LimitOrderTypes.sol** (44 lines)
|
|
114
|
-
|
|
115
|
-
- OrderStatus enum: INACTIVE, OPEN, FILLED
|
|
116
|
-
- LimitOrder struct (224 bytes / 7 storage slots with linked list pointers)
|
|
117
|
-
- Queue struct (96 bytes / 3 storage slots with head/tail/length/balance)
|
|
118
|
-
|
|
119
|
-
**LimitOrderStorage.sol** (35 lines)
|
|
120
|
-
|
|
121
|
-
- Storage slot derived from `keccak256("zora.limit.order.book.storage")`
|
|
122
|
-
- Storage slot: `0x98b43bb10ca7bc310641b07883d9e14c04b3983640df6b07dd1c99d10a3c6cec`
|
|
123
|
-
- Layout with 6 mappings for orders, queues, epochs, bitmaps, nonces, and maker balances
|
|
124
|
-
|
|
125
|
-
#### Order Lifecycle Libraries (3 files, ~722 LOC)
|
|
126
|
-
|
|
127
|
-
**LimitOrderCreate.sol** (277 lines)
|
|
128
|
-
|
|
129
|
-
- Order creation with validation
|
|
130
|
-
- Calls `poolManager.modifyLiquidity()` with positive `liquidityDelta` to add liquidity
|
|
131
|
-
- Manages callback data and execution
|
|
132
|
-
- Handles residual amount refunds
|
|
133
|
-
- Implementation details: Input validation, liquidity calculations, nonce management
|
|
134
|
-
|
|
135
|
-
**LimitOrderFill.sol** (345 lines)
|
|
136
|
-
|
|
137
|
-
- Core fill execution logic
|
|
138
|
-
- Epoch-based execution isolation mechanism
|
|
139
|
-
- Two fill modes: tick range-based and order ID-based
|
|
140
|
-
- Bitmap-based tick iteration optimization
|
|
141
|
-
- Assembly optimizations in tight loops
|
|
142
|
-
- Implementation details: Epoch checks, bitmap manipulation, linked list traversal
|
|
143
|
-
|
|
144
|
-
**LimitOrderWithdraw.sol** (100 lines)
|
|
145
|
-
|
|
146
|
-
- Cancellation and withdrawal logic
|
|
147
|
-
- Order-specific withdrawal (cancels provided order ids sequentially until `minAmountOut` is reached)
|
|
148
|
-
- Burns liquidity and issues refunds
|
|
149
|
-
- Implementation details: Owner validation, balance accounting, liquidity burning
|
|
150
|
-
|
|
151
|
-
#### Support Libraries (6 files, ~648 LOC)
|
|
152
|
-
|
|
153
|
-
**LimitOrderCommon.sol** (91 lines)
|
|
154
|
-
|
|
155
|
-
- Order metadata extraction helpers
|
|
156
|
-
- Records orders in queues and bitmaps
|
|
157
|
-
- Removes orders from queues and bitmaps
|
|
158
|
-
- Tick determination logic
|
|
159
|
-
|
|
160
|
-
**LimitOrderQueues.sol** (101 lines)
|
|
161
|
-
|
|
162
|
-
- Linked list implementation
|
|
163
|
-
- Single tick queue system
|
|
164
|
-
- Operations: enqueue, unlink, clearLinks
|
|
165
|
-
- Direct storage slot manipulation for gas optimization
|
|
166
|
-
- Implementation details: Linked list integrity, concurrent modifications
|
|
167
|
-
|
|
168
|
-
**LimitOrderBitmap.sol** (84 lines)
|
|
169
|
-
|
|
170
|
-
- Bitmap management for tick activation tracking
|
|
171
|
-
- Sets/clears bits when ticks become active/inactive
|
|
172
|
-
- `getExecutableTicks()` for efficient range queries
|
|
173
|
-
- Implementation details: Bit manipulation correctness, boundary conditions
|
|
174
|
-
|
|
175
|
-
**LimitOrderLiquidity.sol** (222 lines)
|
|
176
|
-
|
|
177
|
-
- Uniswap V4 liquidity management
|
|
178
|
-
- Helper functions for adding liquidity during order creation (`_mintLiquidity()`)
|
|
179
|
-
- Removes liquidity during fills/cancels (`burnAndPayout()`, `burnAndRefund()`)
|
|
180
|
-
- Handles fee distribution and swap paths
|
|
181
|
-
- Supports alternative payout currencies
|
|
182
|
-
- Implementation details: Liquidity calculations, fee distribution, swap execution
|
|
183
|
-
|
|
184
|
-
**SwapLimitOrders.sol** (209 lines)
|
|
185
|
-
|
|
186
|
-
- Configuration for automatic order creation post-swap
|
|
187
|
-
- Validates multiples and percentages
|
|
188
|
-
- Computes order ladders from price multiples
|
|
189
|
-
- Square root math for price alignment
|
|
190
|
-
|
|
191
|
-
**Permit2Payments.sol** (41 lines)
|
|
192
|
-
|
|
193
|
-
- Abstract contract for Permit2 token transfers
|
|
194
|
-
- Based on Uniswap's universal-router module
|
|
195
|
-
- Enables gasless token approvals
|
|
196
|
-
|
|
197
|
-
#### Router Contract (1 file, ~454 LOC)
|
|
198
|
-
|
|
199
|
-
_See [README: SwapWithLimitOrders Router](./README.md#2-swapwithlimitorders-router) for detailed architecture_
|
|
200
|
-
|
|
201
|
-
**router/SwapWithLimitOrders.sol** (454 lines)
|
|
202
|
-
|
|
203
|
-
- Standalone router for combined operations
|
|
204
|
-
- Executes V3→V4 swaps + order creation + fills
|
|
205
|
-
- Implements pool manager callback pattern
|
|
206
|
-
- Attempts to fill orders if price crosses
|
|
207
|
-
|
|
208
|
-
### Integration Points: `packages/coins/src/`
|
|
209
|
-
|
|
210
|
-
_For Zora Coins platform architecture, see [README: Coins Platform Architecture](./README.md#2-coins-platform-architecture)_
|
|
211
|
-
|
|
212
|
-
#### Modified Hook Contract
|
|
213
|
-
|
|
214
|
-
**hooks/ZoraV4CoinHook.sol** (modifications only)
|
|
215
|
-
|
|
216
|
-
- Integration point for automatic limit order fills during swaps
|
|
217
|
-
- Calls `limitOrderBook.fill()` in `afterSwap` hook
|
|
218
|
-
- Passes fill referral information
|
|
219
|
-
|
|
220
|
-
**Related Support Libraries**:
|
|
221
|
-
|
|
222
|
-
- `libs/V3ToV4SwapLib.sol` - V3 migration support
|
|
223
|
-
- `libs/CoinRewardsV4.sol` - Reward distribution
|
|
224
|
-
|
|
225
|
-
## Out-of-Scope
|
|
226
|
-
|
|
227
|
-
### Explicitly Excluded
|
|
228
|
-
|
|
229
|
-
**Deployment Scripts**:
|
|
230
|
-
|
|
231
|
-
- `packages/coins/src/deployment/CoinsDeployerBase.sol`
|
|
232
|
-
- All files in `script/` directories across all packages
|
|
233
|
-
- All deployment infrastructure and tooling
|
|
234
|
-
|
|
235
|
-
**Test Files**:
|
|
236
|
-
|
|
237
|
-
- All files in `test/` directories (except as behavioral reference)
|
|
238
|
-
- Test utilities and mocks
|
|
239
|
-
|
|
240
|
-
**Legacy Code**:
|
|
241
|
-
|
|
242
|
-
- `legacy/` directory contents
|
|
243
|
-
- Deprecated contracts from previous versions
|
|
244
|
-
|
|
245
|
-
**Documentation & Tooling**:
|
|
246
|
-
|
|
247
|
-
- `docs/` and `nft-docs/` directories
|
|
248
|
-
- Build scripts and configuration files
|
|
249
|
-
- SDK packages (`coins-sdk`, `protocol-deployments`)
|
|
250
|
-
|
|
251
|
-
**External Dependencies** (auditing the dependencies themselves is out of scope, but integration risks are a key focus):
|
|
252
|
-
|
|
253
|
-
- Uniswap V4 core contracts (`@uniswap/v4-core`) - **Integration analysis is critical**: how we interact with pool manager, liquidity operations, unlock callbacks, and balance settlements
|
|
254
|
-
- OpenZeppelin contracts (`@openzeppelin/contracts`) - Used for IAuthority, IERC20, SafeERC20, TransientSlot
|
|
255
|
-
|
|
256
|
-
**Critical Integration Patterns to Audit**:
|
|
257
|
-
|
|
258
|
-
We are particularly interested in identifying risks in how our code interacts with Uniswap V4:
|
|
259
|
-
|
|
260
|
-
- **Unlock callback patterns**: nested unlock handling when orders are created during fills (see `LimitOrderCreate.sol:44`), potential reentrancy through callbacks, unlock state verification
|
|
261
|
-
- **Liquidity position management**: salt-based position isolation using orderIds as salts (see `LimitOrderCreate.sol:200`, `LimitOrderLiquidity.sol:64`), tick range calculations, liquidity delta correctness
|
|
262
|
-
- **Balance accounting**: settle/take/sync patterns (see `LimitOrderLiquidity.sol`), currency delta tracking via `TransientStateLibrary.currencyDelta`, ETH vs ERC20 handling
|
|
263
|
-
- **Transient storage usage**: `isUnlocked` checks for access control (see `ZoraLimitOrderBook.sol:90`), currency delta reading for settlement verification
|
|
264
|
-
- **Position lifecycle**: `modifyLiquidity` calls with positive delta (mint) and negative delta (burn), fee accumulation via `feesDelta` and distribution to makers/referrals
|
|
265
|
-
|
|
266
|
-
## Areas of Technical Complexity
|
|
267
|
-
|
|
268
|
-
**Linked List Implementation** ([`LimitOrderQueues.sol`](src/libs/LimitOrderQueues.sol), [`LimitOrderCommon.sol`](src/libs/LimitOrderCommon.sol)) - See [README: Tick Queue System](./README.md#tick-queue-system): Tick-based linked lists enable O(1) insertion/removal when order ID is known. Orders are indexed by `(poolKeyHash, coin, tick)` for efficient fill operations.
|
|
269
|
-
|
|
270
|
-
**Epoch-Based Execution Isolation** ([`LimitOrderFill.sol`](src/libs/LimitOrderFill.sol), [`LimitOrderStorage.sol`](src/libs/LimitOrderStorage.sol)) - See [README: Epoch-Based Protection](./README.md#epoch-based-protection): Orders cannot be filled in the same epoch they were created. Each pool maintains an independent epoch counter (uint256) that increments at the start of each fill. Orders store uint32 createdEpoch and are skipped if `createdEpoch >= currentEpoch`. This ensures orders created during fill execution wait for the next fill operation.
|
|
271
|
-
|
|
272
|
-
**Bitmap Optimization** ([`LimitOrderBitmap.sol`](src/libs/LimitOrderBitmap.sol), [`LimitOrderCommon.sol`](src/libs/LimitOrderCommon.sol)) - See [README: Tick Discovery](./README.md#tick-discovery-bitmap-implementation): Active ticks tracked via bitmap structure for gas-efficient iteration. One bitmap per (poolKeyHash, coin) combination with word-based storage (256 ticks per uint256). Uses Uniswap's TickBitmap library for word-boundary traversal.
|
|
273
|
-
|
|
274
|
-
**Access Control** ([`SimpleAccessManaged.sol`](src/access/SimpleAccessManaged.sol)) - See [README: Access Control](./README.md#access-control-via-simpleaccessmanaged): Lightweight fork of OpenZeppelin's [AccessManaged](https://docs.openzeppelin.com/contracts/5.x/api/access#AccessManaged) that removes time-based permissions. Protects `create()` and `setMaxFillCount()` via authority contract's `canCall()` interface. Fill operations have additional restrictions during pool unlock (only registered hooks).
|
|
275
|
-
|
|
276
|
-
**Liquidity Management** ([`LimitOrderLiquidity.sol`](src/libs/LimitOrderLiquidity.sol), [`LimitOrderCreate.sol`](src/libs/LimitOrderCreate.sol), [`LimitOrderWithdraw.sol`](src/libs/LimitOrderWithdraw.sol)) - See [README: Single-Sided Liquidity](./README.md#single-sided-liquidity): Orders implemented as Uniswap V4 liquidity positions across one-tick-spacing ranges using orderID as salt. Supports ERC20 and ETH, alternative payout currencies via swap paths, residual refunds, and fee distribution to makers/referrals.
|
|
277
|
-
|
|
278
|
-
**Unlock Callback Pattern** ([`ZoraLimitOrderBook.sol`](src/ZoraLimitOrderBook.sol)) - See [README: Component Interaction Flows](./README.md#component-interaction-flows): All state-changing operations occur within Uniswap V4's unlock callback mechanism. Three callback types: CREATE, FILL, WITHDRAW_ORDERS. All balance changes must be settled atomically before unlock completes.
|
|
279
|
-
|
|
280
|
-
**Token Accounting** ([`LimitOrderLiquidity.sol`](src/libs/LimitOrderLiquidity.sol)) - See [README: Component Interaction Flows](./README.md#component-interaction-flows): Handles ERC20 and native ETH transfers through pool manager's sync/settle/take pattern with balance verification before and after transfers.
|
|
281
|
-
|
|
282
|
-
**Gas Optimization** ([`LimitOrderFill.sol`](src/libs/LimitOrderFill.sol)): `maxFillCount` parameter limits orders processed per call. Bitmap optimization skips empty ticks. Assembly optimizations in hot loops. Multiple fill calls may be needed for large queues (100+ orders).
|
|
283
|
-
|
|
284
|
-
**Security Model** - See [README: Security Model & Guarantees](./README.md#5-security-model--guarantees): Documents protocol security guarantees, actor analysis, admin capabilities/limitations, and why `create()` is access controlled.
|
|
285
|
-
|
|
286
|
-
**DOS Prevention** - See [README: Gas Limits & DOS Prevention](./README.md#6-gas-limits--dos-prevention): Details on `maxFillCount` parameter, gas analysis from testing, and Fusaka/future hard fork considerations.
|
|
287
|
-
|
|
288
|
-
**Fill Execution Paths** - See [README: Fill Execution Paths](./README.md#4-fill-execution-paths): Documents the three distinct fill paths (auto-fill from hook, router fill, third-party fill), hook migration requirements, and universal Uniswap V4 compatibility.
|
|
289
|
-
|
|
290
|
-
## Code Statistics
|
|
291
|
-
|
|
292
|
-
**Solidity Code**:
|
|
293
|
-
|
|
294
|
-
- Core implementation: ~2,758 lines
|
|
295
|
-
- Primary contract: 220 lines
|
|
296
|
-
- Libraries: ~1,689 lines
|
|
297
|
-
- Interface: 195 lines
|
|
298
|
-
- Access control: 344 lines (SimpleAccessManaged + SimpleAccessManager)
|
|
299
|
-
- Router: 454 lines
|
|
300
|
-
|
|
301
|
-
**Test Files**: 6 test contracts in `packages/limit-orders/test/`
|
|
302
|
-
|
|
303
|
-
**Modified Existing Code**:
|
|
304
|
-
|
|
305
|
-
- ZoraV4CoinHook.sol: ~50-100 lines modified for integration
|
|
306
|
-
- Supporting libraries: TBD based on actual changes
|
|
307
|
-
|
|
308
|
-
**Note for Auditors**: Understanding the integration points will require familiarity with the existing Zora Coins protocol architecture (hooks, reward distribution, coin versioning). Auditors should account for time to review relevant portions of `packages/coins/` in their proposals.
|
|
309
|
-
|
|
310
|
-
## Audit Deliverables
|
|
311
|
-
|
|
312
|
-
We are looking for a comprehensive security assessment that includes:
|
|
313
|
-
|
|
314
|
-
- **Security findings** with severity classifications, impact analysis, and remediation recommendations
|
|
315
|
-
- **Integration risk assessment** focusing on Uniswap V4 interactions and Zora Coins protocol integration
|
|
316
|
-
- **Code quality analysis** including gas optimization opportunities and best practices
|
|
317
|
-
- **Testing artifacts** such as custom test cases, fuzzing results, or static analysis outputs developed during the audit
|
|
318
|
-
|
|
319
|
-
---
|
|
320
|
-
|
|
321
|
-
# PART 2: TECHNICAL IMPLEMENTATION
|
|
322
|
-
|
|
323
|
-
## File Structure
|
|
324
|
-
|
|
325
|
-
### Complete Package Organization
|
|
326
|
-
|
|
327
|
-
```
|
|
328
|
-
packages/limit-orders/src/
|
|
329
|
-
├── ZoraLimitOrderBook.sol (220 lines) - Main contract
|
|
330
|
-
├── IZoraLimitOrderBook.sol (195 lines) - Interface
|
|
331
|
-
├── access/
|
|
332
|
-
│ ├── SimpleAccessManaged.sol (76 lines) - Access control base
|
|
333
|
-
│ └── SimpleAccessManager.sol (268 lines) - Role-based access manager
|
|
334
|
-
├── libs/
|
|
335
|
-
│ ├── LimitOrderCreate.sol (277 lines) - Creation logic
|
|
336
|
-
│ ├── LimitOrderFill.sol (345 lines) - Fill logic (MOST COMPLEX)
|
|
337
|
-
│ ├── LimitOrderWithdraw.sol (100 lines) - Withdrawal logic
|
|
338
|
-
│ ├── LimitOrderStorage.sol (34 lines) - Storage layout
|
|
339
|
-
│ ├── LimitOrderTypes.sol (41 lines) - Type definitions
|
|
340
|
-
│ ├── LimitOrderCommon.sol (91 lines) - Common utilities
|
|
341
|
-
│ ├── LimitOrderQueues.sol (101 lines) - Linked list ops
|
|
342
|
-
│ ├── LimitOrderBitmap.sol (84 lines) - Bitmap tracking
|
|
343
|
-
│ ├── LimitOrderLiquidity.sol (222 lines) - Liquidity management
|
|
344
|
-
│ ├── SwapLimitOrders.sol (209 lines) - Config helper
|
|
345
|
-
│ └── Permit2Payments.sol (41 lines) - Permit2 support
|
|
346
|
-
└── router/
|
|
347
|
-
└── SwapWithLimitOrders.sol (454 lines) - Router contract
|
|
348
|
-
```
|
|
349
|
-
|
|
350
|
-
## Data Structures
|
|
351
|
-
|
|
352
|
-
For detailed documentation of data structures (LimitOrder struct, Queue struct, OrderStatus enum) and the tick queue system, see the [README.md](./README.md#tick-queue-system).
|
|
353
|
-
|
|
354
|
-
**Order ID Generation**: Deterministic hash of `keccak256(abi.encode(poolKeyHash, coin, tick, maker, nonce))` where nonce increments per maker.
|
|
355
|
-
(_Implementation detail_: `LimitOrderCreate.sol` hashes 5x 32-byte words, equivalent to `abi.encode(...)` rather than `abi.encodePacked(...)`.)
|
|
356
|
-
|
|
357
|
-
**Callback Data Structures** ([`IZoraLimitOrderBook.sol`](src/IZoraLimitOrderBook.sol)): OrderBatch, CreateCallbackData, FillCallbackData, WithdrawOrdersCallbackData
|
|
358
|
-
|
|
359
|
-
## Storage Organization
|
|
360
|
-
|
|
361
|
-
Uses diamond storage pattern at slot `0x98b43bb10ca7bc310641b07883d9e14c04b3983640df6b07dd1c99d10a3c6cec`. For details on storage layout and the diamond pattern implementation, see [`LimitOrderStorage.sol`](src/libs/LimitOrderStorage.sol) and [README.md](./README.md#diamond-storage-pattern).
|
|
362
|
-
|
|
363
|
-
## External Functions
|
|
364
|
-
|
|
365
|
-
_See [README: Order Creation Flow](./README.md#order-creation-flow) and [Withdrawal Flow](./README.md#withdrawal-flow) for detailed interaction diagrams_
|
|
366
|
-
|
|
367
|
-
See [`IZoraLimitOrderBook.sol`](src/IZoraLimitOrderBook.sol) for full signatures and documentation.
|
|
368
|
-
|
|
369
|
-
**`create()`** ([ZoraLimitOrderBook.sol:73-82](src/ZoraLimitOrderBook.sol#L73-L82)): Creates new limit order(s) by adding liquidity via `poolManager.modifyLiquidity()`. Requires authorization via SimpleAccessManaged. Generates order IDs, records in queues, sets bitmap bits, handles residual refunds.
|
|
370
|
-
|
|
371
|
-
**`fill()` - Range-based** ([ZoraLimitOrderBook.sol:85-127](src/ZoraLimitOrderBook.sol#L85-L127)): Fills orders within a tick range. Anyone can call; restricted to registered hooks during pool unlock. Bumps epoch, traverses bitmap for active ticks, processes orders, burns liquidity, distributes payouts.
|
|
372
|
-
|
|
373
|
-
**`fill()` - Order-specific** ([ZoraLimitOrderBook.sol:129-142](src/ZoraLimitOrderBook.sol#L129-L142)): Fills specific orders by ID. Operates on explicit order ID batches.
|
|
374
|
-
|
|
375
|
-
**`withdraw()`** ([ZoraLimitOrderBook.sol:141-147](src/ZoraLimitOrderBook.sol#L141-L147)): Cancel specific orders by ID. Takes `orderIds`, `coin`, `minAmountOut`, and `recipient` parameters. Validates ownership and status, burns liquidity, issues refunds.
|
|
376
|
-
|
|
377
|
-
---
|
|
378
|
-
|
|
379
|
-
# PART 3: ADDITIONAL INFORMATION
|
|
380
|
-
|
|
381
|
-
## Known Limitations
|
|
382
|
-
|
|
383
|
-
1. **Multi-block scenarios**: Epochs only prevent same-transaction, not cross-block
|
|
384
|
-
2. **Gas Limits**: Large queues (100s/1000s of orders) may need multiple fills
|
|
385
|
-
3. **No Partial Fills**: Orders fill completely or not at all
|
|
386
|
-
4. **Tick Spacing**: Limited by pool's tick spacing
|
|
387
|
-
|
|
388
|
-
---
|
|
389
|
-
|
|
390
|
-
# CONCLUSION
|
|
391
|
-
|
|
392
|
-
The Zora Limit Orders implementation uses sophisticated data structures (linked lists, bitmaps) to provide an onchain order book integrated with Uniswap V4.
|
|
393
|
-
|
|
394
|
-
## Next Steps for Auditors
|
|
395
|
-
|
|
396
|
-
1. Review this document and supporting docs ([README.md](./README.md), [SPEC.md](./SPEC.md), [AUDIT_NOTES.md](./AUDIT_NOTES.md))
|
|
397
|
-
2. Familiarize yourself with Uniswap V4 architecture if needed
|
|
398
|
-
3. Begin review with code hotspots identified in [AUDIT_NOTES.md](./AUDIT_NOTES.md#1-code-hotspots-fast-path)
|
|
399
|
-
4. Submit questions or clarifications as needed
|
|
400
|
-
|
|
401
|
-
---
|
|
402
|
-
|
|
403
|
-
**Document Version**: 1.2
|
|
404
|
-
**Last Updated**: 2025-12-12
|
|
405
|
-
**Based On**: Actual implementation in `packages/limit-orders/`
|
|
406
|
-
**Branch**: `autosell`
|
|
407
|
-
|
|
408
|
-
For questions or clarifications, please contact [Will Binns](mailto:will.binns@ourzora.com).
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
[
|
|
2
|
-
{
|
|
3
|
-
"type": "function",
|
|
4
|
-
"name": "setLimitOrderConfig",
|
|
5
|
-
"inputs": [
|
|
6
|
-
{
|
|
7
|
-
"name": "config",
|
|
8
|
-
"type": "tuple",
|
|
9
|
-
"internalType": "struct LimitOrderConfig",
|
|
10
|
-
"components": [
|
|
11
|
-
{
|
|
12
|
-
"name": "multiples",
|
|
13
|
-
"type": "uint256[]",
|
|
14
|
-
"internalType": "uint256[]"
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
"name": "percentages",
|
|
18
|
-
"type": "uint256[]",
|
|
19
|
-
"internalType": "uint256[]"
|
|
20
|
-
}
|
|
21
|
-
]
|
|
22
|
-
}
|
|
23
|
-
],
|
|
24
|
-
"outputs": [],
|
|
25
|
-
"stateMutability": "nonpayable"
|
|
26
|
-
}
|
|
27
|
-
]
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"abi":[{"type":"function","name":"setLimitOrderConfig","inputs":[{"name":"config","type":"tuple","internalType":"struct LimitOrderConfig","components":[{"name":"multiples","type":"uint256[]","internalType":"uint256[]"},{"name":"percentages","type":"uint256[]","internalType":"uint256[]"}]}],"outputs":[],"stateMutability":"nonpayable"}],"bytecode":{"object":"0x","sourceMap":"","linkReferences":{}},"deployedBytecode":{"object":"0x","sourceMap":"","linkReferences":{}},"methodIdentifiers":{"setLimitOrderConfig((uint256[],uint256[]))":"18ed2974"},"rawMetadata":"{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"components\":[{\"internalType\":\"uint256[]\",\"name\":\"multiples\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"percentages\",\"type\":\"uint256[]\"}],\"internalType\":\"struct LimitOrderConfig\",\"name\":\"config\",\"type\":\"tuple\"}],\"name\":\"setLimitOrderConfig\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"setLimitOrderConfig((uint256[],uint256[]))\":{\"params\":{\"config\":\"The new limit order configuration\"}}},\"title\":\"ISetLimitOrderConfig\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"setLimitOrderConfig((uint256[],uint256[]))\":{\"notice\":\"Sets the canonical limit order configuration\"}},\"notice\":\"Interface for setting limit order configuration\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/router/ISetLimitOrderConfig.sol\":\"ISetLimitOrderConfig\"},\"evmVersion\":\"prague\",\"libraries\":{},\"metadata\":{\"appendCBOR\":false,\"bytecodeHash\":\"none\"},\"optimizer\":{\"enabled\":true,\"runs\":100},\"remappings\":[\":@openzeppelin/=node_modules/@openzeppelin/\",\":@uniswap/universal-router/contracts/=node_modules/@uniswap/universal-router/contracts/\",\":@uniswap/v4-core/=node_modules/@uniswap/v4-core/\",\":@uniswap/v4-periphery/=node_modules/@uniswap/v4-periphery/\",\":@zoralabs/coins/=node_modules/@zoralabs/coins/\",\":@zoralabs/shared-contracts/=node_modules/@zoralabs/shared-contracts/src/\",\":ds-test/=node_modules/ds-test/src/\",\":forge-std/=node_modules/forge-std/src/\",\":permit2/src/=node_modules/@uniswap/permit2/src/\",\":solady/=node_modules/solady/src/\",\":solmate/=node_modules/solmate/src/\"],\"viaIR\":true},\"sources\":{\"node_modules/@uniswap/v4-core/src/interfaces/IHooks.sol\":{\"keccak256\":\"0xc131ffa2d04c10a012fe715fe2c115811526b7ea34285cf0a04ce7ce8320da8d\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://3b212358897db5d99c21244d88f97b2e788527552cb430629b472a8cc6289aec\",\"dweb:/ipfs/QmQtwV4dDe2RYk2ErLpaAX7U82jWh1L6Lw2HRuKDvBi84G\"]},\"node_modules/@uniswap/v4-core/src/interfaces/external/IERC20Minimal.sol\":{\"keccak256\":\"0xeccadf1bf69ba2eb51f2fe4fa511bc7bb05bbd6b9f9a3cb8e5d83d9582613e0f\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://118757369892687b99ef46ce28d6861f62c098285bd7687a4f17f7e44e5f81de\",\"dweb:/ipfs/QmUxqbYqQtcEwwFbb9e6BBMePEaSgN8C45v6RKubD4ib8d\"]},\"node_modules/@uniswap/v4-core/src/libraries/CustomRevert.sol\":{\"keccak256\":\"0x111ed3031b6990c80a93ae35dde6b6ac0b7e6af471388fdd7461e91edda9b7de\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://c9ea883c98d6ae1829160d0977bb5195761cfd5bc81692d0a941f45717f594cd\",\"dweb:/ipfs/QmZPwxzaeMNv536wzrAMrMswu7vMHuqPVpjcqL3YvCMoxt\"]},\"node_modules/@uniswap/v4-core/src/libraries/SafeCast.sol\":{\"keccak256\":\"0x42c4a24f996a14d358be397b71f7ec9d7daf666aaec78002c63315a6ee67aa86\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://c3db86e2ba3679105fc32edec656c70282e1fede6cab11217702443f6c26fa59\",\"dweb:/ipfs/QmX4yaaSPdKQzYNRsezjTvZKsubzS8JRTEGFD3fPpTTCcj\"]},\"node_modules/@uniswap/v4-core/src/types/BalanceDelta.sol\":{\"keccak256\":\"0xa719c8fe51e0a9524280178f19f6851bcc3b3b60e73618f3d60905d35ae5569f\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://7436928dc9de35c6c7c5c636cb51adaf295cfd590da83b19a004ae33cbec9ef9\",\"dweb:/ipfs/QmRJ9yZkUpzk4433GX3LgVVL8jwpbSYSUwXcucKisf3v4H\"]},\"node_modules/@uniswap/v4-core/src/types/BeforeSwapDelta.sol\":{\"keccak256\":\"0x2a774312d91285313d569da1a718c909655da5432310417692097a1d4dc83a78\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://a2c7a0379955cff9c17ab9e61f95e42909aa5947c22740f86ce940d09856f782\",\"dweb:/ipfs/QmaAuo8UBYXsGrVuKh8iRoAAdqwtg1jDq515cW1ZRP5m9K\"]},\"node_modules/@uniswap/v4-core/src/types/Currency.sol\":{\"keccak256\":\"0x4a0b84b282577ff6f8acf13ec9f4d32dbb9348748b49611d00e68bee96609c93\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://45f9d62ab3d51b52957279e353853ba1547c3182c9a1e3d1846ada4a90263b01\",\"dweb:/ipfs/QmS8NG84ccQS1yXVD8cv3eKX7J1UKxuJhbUfHTQR2opKF5\"]},\"node_modules/@uniswap/v4-core/src/types/PoolId.sol\":{\"keccak256\":\"0x308311916ea0f5c2fd878b6a2751eb223d170a69e33f601fae56dfe3c5d392af\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://669c2cd7ac17690b5d8831e0bda72822376c3a04b36afed6d31df4d75fe60918\",\"dweb:/ipfs/QmT6EpkxqU8VF3WsgrZ66F3s1cCQRffR95z1HDYZz7ph6y\"]},\"node_modules/@uniswap/v4-core/src/types/PoolKey.sol\":{\"keccak256\":\"0xf89856e0580d7a4856d3187a76858377ccee9d59702d230c338d84388221b786\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://6f3118fa189025695c37fdf0bdd1190f085ad097484d3c88cf4c56d1db65f639\",\"dweb:/ipfs/QmamXpgtB8GV1CaFLvqefPWSoikLDhMk1yU4heBnVzU8gi\"]},\"node_modules/@uniswap/v4-core/src/types/PoolOperation.sol\":{\"keccak256\":\"0x7a1a107fc1f2208abb2c9364c8c54e56e98dca27673e9441bed2b949b6382162\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://4ad2470383bc5595d5af17840c64971f457adac68895a4db41ba5c71a4478e07\",\"dweb:/ipfs/QmdwKhBHDZFuqXrR2BfDBD9r7rB2ULGQBznsajRTkTmL4c\"]},\"node_modules/@zoralabs/coins/src/interfaces/IDopplerErrors.sol\":{\"keccak256\":\"0xf78efeb8a0d37914bae9be8c6ed70d54a1d48305b3f9e3f8b95d20f9685640ea\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://1e51cc18a8367dc9363a958f179cf2e8af662cbe41474647aa78424be781120e\",\"dweb:/ipfs/QmNrxrY2P7FMRY7tJtV2n5eiPDyM5pRhBpn9wgDfgwdDCs\"]},\"node_modules/@zoralabs/coins/src/libs/CoinConstants.sol\":{\"keccak256\":\"0x0c17b040ed707c2353e4b238bf6bac90d22a71980ff1a091f763da281b7035bf\",\"license\":\"ZORA-DELAYED-OSL-v1\",\"urls\":[\"bzz-raw://083bb0022dd69434858946ea15b55d08483913baf57b428d600ede1eb5a19f46\",\"dweb:/ipfs/QmXdNPvCm2Wv4R8Kbd7FYdnjjQCLWVGsr1DhCn5MrQj3Z7\"]},\"node_modules/@zoralabs/coins/src/libs/DopplerMath.sol\":{\"keccak256\":\"0xafa02392a303dd86c7728266484b038b933bba74cad3a0fb44848a2463626683\",\"license\":\"ZORA-DELAYED-OSL-v1\",\"urls\":[\"bzz-raw://b307a817e4a60a99b1d4ccdbae1fe65b9ce7e6753bb2bb019c8588712cfbe96b\",\"dweb:/ipfs/QmeCjTfTGADS9aU9x2zMyauak3vqSCmiWSEoSBhBVLWaAx\"]},\"node_modules/@zoralabs/coins/src/types/LpPosition.sol\":{\"keccak256\":\"0x19dfc13b9f6a831ee7a624094c17a7c0b20bbc9ef62121dd98d85a8641d53aaf\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://fe77a4cb9ff9afbf7561ed647d15729b201259ef767d6c140a0b6e9254a97fe6\",\"dweb:/ipfs/QmaieKjUcT2SG2Spdg2sHzZso8zd5YTVsMRRoDzz6Kgn1t\"]},\"node_modules/@zoralabs/coins/src/utils/uniswap/BitMath.sol\":{\"keccak256\":\"0x4b5411b3868695776c707738846c79a2dd96bf2fd29e5fe8a47818cd20e1a19d\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://3d9016ed3d9902f455ce8aba6cb4e29d7cb47e5af555de00bb802d7f01566070\",\"dweb:/ipfs/QmeHZHQsXkuCN3i1YAt9WayYTTWWtNz5F8R1EspyEER2JN\"]},\"node_modules/@zoralabs/coins/src/utils/uniswap/CustomRevert.sol\":{\"keccak256\":\"0x5c17fced6eedcacc452d65842bb5904bd26b8a72a7973a2d6fac0167700328d4\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://07044645057353591b0e9f03e0c6802d225307963b45f443c082bce0738c0c2a\",\"dweb:/ipfs/QmWPo2kbp4jkm6CETwPjpqhdVgeA3EfJAtF1SVZMGbf8xU\"]},\"node_modules/@zoralabs/coins/src/utils/uniswap/FixedPoint96.sol\":{\"keccak256\":\"0x711b83cbdbbfe19afc1df6f45f2f71abb1b75305ecb288e36a37cc286bc8de46\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://2957b0c179395705c49084b5b0c1033c0f47beeca043658a6c572226f5d07348\",\"dweb:/ipfs/QmZQD8s7u1Kjnydkw6n9FUyzVK9Loo6gYSZXic732Y7J76\"]},\"node_modules/@zoralabs/coins/src/utils/uniswap/FullMath.sol\":{\"keccak256\":\"0xc6b0d61b8d60acb295d196a72f81e577007e822f63c737ae0fa87d63e228f074\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://643ddf8897f3d2610ce5ac45c0571e86cd2a97542c2599121fa39a06daa95509\",\"dweb:/ipfs/QmZ74RCf31apWy8UukKUrFi98kgSK6sRH68MFMGudPVpqx\"]},\"node_modules/@zoralabs/coins/src/utils/uniswap/LiquidityAmounts.sol\":{\"keccak256\":\"0x4811d0187e6ccf97d6323c597355967e481392cbdc65dea804f770dec91cece7\",\"license\":\"UNLICENSED\",\"urls\":[\"bzz-raw://8d41f633f2a92b4caeb0430096851b62b0be1f68915603ff8c5b220c693e9755\",\"dweb:/ipfs/QmY9c5EwQVKi2Ak7xude2iUe7TGAdwmChUtwzwWcGb62PE\"]},\"node_modules/@zoralabs/coins/src/utils/uniswap/SafeCast.sol\":{\"keccak256\":\"0x5ec831c0fbdcb16091d35eee2e49d54eaadf7ce72d971aec9ea30f379cba258a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://9440106f4a5ff5d829ed68c82de4f92e171c4e9306e89d28fe75b4ca30b5f298\",\"dweb:/ipfs/QmdLJitnGXNMZxG6XZxhvCMjoNEKzpZVJ2dnzGVXtWUSFf\"]},\"node_modules/@zoralabs/coins/src/utils/uniswap/SqrtPriceMath.sol\":{\"keccak256\":\"0x45ed757203ba04c7337435dd32e6231b768abf1709917b1d5e81ae1333513f75\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://2fa319aa9c92b8da5a9634407ff487cbf0e0e6e234a99146f49c9ded06e8fd74\",\"dweb:/ipfs/QmcqHrXBGpcfgMyb8DqyPYuafBKuESGcvJo1tfCAUrYokb\"]},\"node_modules/@zoralabs/coins/src/utils/uniswap/TickMath.sol\":{\"keccak256\":\"0xb8d86efe55d877582bdd2d2580d5c57c0fd955fdfb08116dba033f2e8f429e2e\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://997e7fc24b30ff5464a5d3db14ac17eb07bed862bbce553a060f38affd8cb6f7\",\"dweb:/ipfs/QmfQ8bo8zEGT6NEDVRdWJaCWaAXMoH7eH8xz14XA1p4Ex3\"]},\"node_modules/@zoralabs/coins/src/utils/uniswap/UnsafeMath.sol\":{\"keccak256\":\"0x44ea34293d502dcff60379eff5504313d7a042ebcae72e7d82ca937f199f3d84\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://142c8209cf7ff88b88fa5fe41c0c22a59a8065e1726c0e18b0582facbead3c5c\",\"dweb:/ipfs/QmRZZfsipKck8Ja4pPCK5GYFNfD5TeZggjqLVwJi1AjBzt\"]},\"src/libs/SwapLimitOrders.sol\":{\"keccak256\":\"0xfe1d3d583d323cc9f1053b048eef645feb6d9c80744b836ecc0ee5c6fa242cd5\",\"license\":\"ZORA-DELAYED-OSL-v1\",\"urls\":[\"bzz-raw://ae59aaa5e8420e9b8a61f1ff1eaa09a3481f47223842643b66601a2b28490aaf\",\"dweb:/ipfs/QmVS6AXRNV14eaywvrYqGhLvtZfND2ydnubBoiyqeHYrKY\"]},\"src/router/ISetLimitOrderConfig.sol\":{\"keccak256\":\"0x0aa4874d3640a56782781c2822639c39b12f3267906eb3b093e3de4e38e2d054\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://286bf6d6893ae7c02e9a4e44de4cb6d60b8bc9a50248c08f3b325756dc34fdc8\",\"dweb:/ipfs/QmeKMiRmtCdZ4jRpfSxVySqchmRgW7SqUVxoqXBGQqB3UU\"]}},\"version\":1}","metadata":{"compiler":{"version":"0.8.28+commit.7893614a"},"language":"Solidity","output":{"abi":[{"inputs":[{"internalType":"struct LimitOrderConfig","name":"config","type":"tuple","components":[{"internalType":"uint256[]","name":"multiples","type":"uint256[]"},{"internalType":"uint256[]","name":"percentages","type":"uint256[]"}]}],"stateMutability":"nonpayable","type":"function","name":"setLimitOrderConfig"}],"devdoc":{"kind":"dev","methods":{"setLimitOrderConfig((uint256[],uint256[]))":{"params":{"config":"The new limit order configuration"}}},"version":1},"userdoc":{"kind":"user","methods":{"setLimitOrderConfig((uint256[],uint256[]))":{"notice":"Sets the canonical limit order configuration"}},"version":1}},"settings":{"remappings":["@openzeppelin/=node_modules/@openzeppelin/","@uniswap/universal-router/contracts/=node_modules/@uniswap/universal-router/contracts/","@uniswap/v4-core/=node_modules/@uniswap/v4-core/","@uniswap/v4-periphery/=node_modules/@uniswap/v4-periphery/","@zoralabs/coins/=node_modules/@zoralabs/coins/","@zoralabs/shared-contracts/=node_modules/@zoralabs/shared-contracts/src/","ds-test/=node_modules/ds-test/src/","forge-std/=node_modules/forge-std/src/","permit2/src/=node_modules/@uniswap/permit2/src/","solady/=node_modules/solady/src/","solmate/=node_modules/solmate/src/"],"optimizer":{"enabled":true,"runs":100},"metadata":{"bytecodeHash":"none","appendCBOR":false},"compilationTarget":{"src/router/ISetLimitOrderConfig.sol":"ISetLimitOrderConfig"},"evmVersion":"prague","libraries":{},"viaIR":true},"sources":{"node_modules/@uniswap/v4-core/src/interfaces/IHooks.sol":{"keccak256":"0xc131ffa2d04c10a012fe715fe2c115811526b7ea34285cf0a04ce7ce8320da8d","urls":["bzz-raw://3b212358897db5d99c21244d88f97b2e788527552cb430629b472a8cc6289aec","dweb:/ipfs/QmQtwV4dDe2RYk2ErLpaAX7U82jWh1L6Lw2HRuKDvBi84G"],"license":"MIT"},"node_modules/@uniswap/v4-core/src/interfaces/external/IERC20Minimal.sol":{"keccak256":"0xeccadf1bf69ba2eb51f2fe4fa511bc7bb05bbd6b9f9a3cb8e5d83d9582613e0f","urls":["bzz-raw://118757369892687b99ef46ce28d6861f62c098285bd7687a4f17f7e44e5f81de","dweb:/ipfs/QmUxqbYqQtcEwwFbb9e6BBMePEaSgN8C45v6RKubD4ib8d"],"license":"MIT"},"node_modules/@uniswap/v4-core/src/libraries/CustomRevert.sol":{"keccak256":"0x111ed3031b6990c80a93ae35dde6b6ac0b7e6af471388fdd7461e91edda9b7de","urls":["bzz-raw://c9ea883c98d6ae1829160d0977bb5195761cfd5bc81692d0a941f45717f594cd","dweb:/ipfs/QmZPwxzaeMNv536wzrAMrMswu7vMHuqPVpjcqL3YvCMoxt"],"license":"MIT"},"node_modules/@uniswap/v4-core/src/libraries/SafeCast.sol":{"keccak256":"0x42c4a24f996a14d358be397b71f7ec9d7daf666aaec78002c63315a6ee67aa86","urls":["bzz-raw://c3db86e2ba3679105fc32edec656c70282e1fede6cab11217702443f6c26fa59","dweb:/ipfs/QmX4yaaSPdKQzYNRsezjTvZKsubzS8JRTEGFD3fPpTTCcj"],"license":"MIT"},"node_modules/@uniswap/v4-core/src/types/BalanceDelta.sol":{"keccak256":"0xa719c8fe51e0a9524280178f19f6851bcc3b3b60e73618f3d60905d35ae5569f","urls":["bzz-raw://7436928dc9de35c6c7c5c636cb51adaf295cfd590da83b19a004ae33cbec9ef9","dweb:/ipfs/QmRJ9yZkUpzk4433GX3LgVVL8jwpbSYSUwXcucKisf3v4H"],"license":"MIT"},"node_modules/@uniswap/v4-core/src/types/BeforeSwapDelta.sol":{"keccak256":"0x2a774312d91285313d569da1a718c909655da5432310417692097a1d4dc83a78","urls":["bzz-raw://a2c7a0379955cff9c17ab9e61f95e42909aa5947c22740f86ce940d09856f782","dweb:/ipfs/QmaAuo8UBYXsGrVuKh8iRoAAdqwtg1jDq515cW1ZRP5m9K"],"license":"MIT"},"node_modules/@uniswap/v4-core/src/types/Currency.sol":{"keccak256":"0x4a0b84b282577ff6f8acf13ec9f4d32dbb9348748b49611d00e68bee96609c93","urls":["bzz-raw://45f9d62ab3d51b52957279e353853ba1547c3182c9a1e3d1846ada4a90263b01","dweb:/ipfs/QmS8NG84ccQS1yXVD8cv3eKX7J1UKxuJhbUfHTQR2opKF5"],"license":"MIT"},"node_modules/@uniswap/v4-core/src/types/PoolId.sol":{"keccak256":"0x308311916ea0f5c2fd878b6a2751eb223d170a69e33f601fae56dfe3c5d392af","urls":["bzz-raw://669c2cd7ac17690b5d8831e0bda72822376c3a04b36afed6d31df4d75fe60918","dweb:/ipfs/QmT6EpkxqU8VF3WsgrZ66F3s1cCQRffR95z1HDYZz7ph6y"],"license":"MIT"},"node_modules/@uniswap/v4-core/src/types/PoolKey.sol":{"keccak256":"0xf89856e0580d7a4856d3187a76858377ccee9d59702d230c338d84388221b786","urls":["bzz-raw://6f3118fa189025695c37fdf0bdd1190f085ad097484d3c88cf4c56d1db65f639","dweb:/ipfs/QmamXpgtB8GV1CaFLvqefPWSoikLDhMk1yU4heBnVzU8gi"],"license":"MIT"},"node_modules/@uniswap/v4-core/src/types/PoolOperation.sol":{"keccak256":"0x7a1a107fc1f2208abb2c9364c8c54e56e98dca27673e9441bed2b949b6382162","urls":["bzz-raw://4ad2470383bc5595d5af17840c64971f457adac68895a4db41ba5c71a4478e07","dweb:/ipfs/QmdwKhBHDZFuqXrR2BfDBD9r7rB2ULGQBznsajRTkTmL4c"],"license":"MIT"},"node_modules/@zoralabs/coins/src/interfaces/IDopplerErrors.sol":{"keccak256":"0xf78efeb8a0d37914bae9be8c6ed70d54a1d48305b3f9e3f8b95d20f9685640ea","urls":["bzz-raw://1e51cc18a8367dc9363a958f179cf2e8af662cbe41474647aa78424be781120e","dweb:/ipfs/QmNrxrY2P7FMRY7tJtV2n5eiPDyM5pRhBpn9wgDfgwdDCs"],"license":"MIT"},"node_modules/@zoralabs/coins/src/libs/CoinConstants.sol":{"keccak256":"0x0c17b040ed707c2353e4b238bf6bac90d22a71980ff1a091f763da281b7035bf","urls":["bzz-raw://083bb0022dd69434858946ea15b55d08483913baf57b428d600ede1eb5a19f46","dweb:/ipfs/QmXdNPvCm2Wv4R8Kbd7FYdnjjQCLWVGsr1DhCn5MrQj3Z7"],"license":"ZORA-DELAYED-OSL-v1"},"node_modules/@zoralabs/coins/src/libs/DopplerMath.sol":{"keccak256":"0xafa02392a303dd86c7728266484b038b933bba74cad3a0fb44848a2463626683","urls":["bzz-raw://b307a817e4a60a99b1d4ccdbae1fe65b9ce7e6753bb2bb019c8588712cfbe96b","dweb:/ipfs/QmeCjTfTGADS9aU9x2zMyauak3vqSCmiWSEoSBhBVLWaAx"],"license":"ZORA-DELAYED-OSL-v1"},"node_modules/@zoralabs/coins/src/types/LpPosition.sol":{"keccak256":"0x19dfc13b9f6a831ee7a624094c17a7c0b20bbc9ef62121dd98d85a8641d53aaf","urls":["bzz-raw://fe77a4cb9ff9afbf7561ed647d15729b201259ef767d6c140a0b6e9254a97fe6","dweb:/ipfs/QmaieKjUcT2SG2Spdg2sHzZso8zd5YTVsMRRoDzz6Kgn1t"],"license":"MIT"},"node_modules/@zoralabs/coins/src/utils/uniswap/BitMath.sol":{"keccak256":"0x4b5411b3868695776c707738846c79a2dd96bf2fd29e5fe8a47818cd20e1a19d","urls":["bzz-raw://3d9016ed3d9902f455ce8aba6cb4e29d7cb47e5af555de00bb802d7f01566070","dweb:/ipfs/QmeHZHQsXkuCN3i1YAt9WayYTTWWtNz5F8R1EspyEER2JN"],"license":"MIT"},"node_modules/@zoralabs/coins/src/utils/uniswap/CustomRevert.sol":{"keccak256":"0x5c17fced6eedcacc452d65842bb5904bd26b8a72a7973a2d6fac0167700328d4","urls":["bzz-raw://07044645057353591b0e9f03e0c6802d225307963b45f443c082bce0738c0c2a","dweb:/ipfs/QmWPo2kbp4jkm6CETwPjpqhdVgeA3EfJAtF1SVZMGbf8xU"],"license":"MIT"},"node_modules/@zoralabs/coins/src/utils/uniswap/FixedPoint96.sol":{"keccak256":"0x711b83cbdbbfe19afc1df6f45f2f71abb1b75305ecb288e36a37cc286bc8de46","urls":["bzz-raw://2957b0c179395705c49084b5b0c1033c0f47beeca043658a6c572226f5d07348","dweb:/ipfs/QmZQD8s7u1Kjnydkw6n9FUyzVK9Loo6gYSZXic732Y7J76"],"license":"MIT"},"node_modules/@zoralabs/coins/src/utils/uniswap/FullMath.sol":{"keccak256":"0xc6b0d61b8d60acb295d196a72f81e577007e822f63c737ae0fa87d63e228f074","urls":["bzz-raw://643ddf8897f3d2610ce5ac45c0571e86cd2a97542c2599121fa39a06daa95509","dweb:/ipfs/QmZ74RCf31apWy8UukKUrFi98kgSK6sRH68MFMGudPVpqx"],"license":"MIT"},"node_modules/@zoralabs/coins/src/utils/uniswap/LiquidityAmounts.sol":{"keccak256":"0x4811d0187e6ccf97d6323c597355967e481392cbdc65dea804f770dec91cece7","urls":["bzz-raw://8d41f633f2a92b4caeb0430096851b62b0be1f68915603ff8c5b220c693e9755","dweb:/ipfs/QmY9c5EwQVKi2Ak7xude2iUe7TGAdwmChUtwzwWcGb62PE"],"license":"UNLICENSED"},"node_modules/@zoralabs/coins/src/utils/uniswap/SafeCast.sol":{"keccak256":"0x5ec831c0fbdcb16091d35eee2e49d54eaadf7ce72d971aec9ea30f379cba258a","urls":["bzz-raw://9440106f4a5ff5d829ed68c82de4f92e171c4e9306e89d28fe75b4ca30b5f298","dweb:/ipfs/QmdLJitnGXNMZxG6XZxhvCMjoNEKzpZVJ2dnzGVXtWUSFf"],"license":"MIT"},"node_modules/@zoralabs/coins/src/utils/uniswap/SqrtPriceMath.sol":{"keccak256":"0x45ed757203ba04c7337435dd32e6231b768abf1709917b1d5e81ae1333513f75","urls":["bzz-raw://2fa319aa9c92b8da5a9634407ff487cbf0e0e6e234a99146f49c9ded06e8fd74","dweb:/ipfs/QmcqHrXBGpcfgMyb8DqyPYuafBKuESGcvJo1tfCAUrYokb"],"license":"MIT"},"node_modules/@zoralabs/coins/src/utils/uniswap/TickMath.sol":{"keccak256":"0xb8d86efe55d877582bdd2d2580d5c57c0fd955fdfb08116dba033f2e8f429e2e","urls":["bzz-raw://997e7fc24b30ff5464a5d3db14ac17eb07bed862bbce553a060f38affd8cb6f7","dweb:/ipfs/QmfQ8bo8zEGT6NEDVRdWJaCWaAXMoH7eH8xz14XA1p4Ex3"],"license":"MIT"},"node_modules/@zoralabs/coins/src/utils/uniswap/UnsafeMath.sol":{"keccak256":"0x44ea34293d502dcff60379eff5504313d7a042ebcae72e7d82ca937f199f3d84","urls":["bzz-raw://142c8209cf7ff88b88fa5fe41c0c22a59a8065e1726c0e18b0582facbead3c5c","dweb:/ipfs/QmRZZfsipKck8Ja4pPCK5GYFNfD5TeZggjqLVwJi1AjBzt"],"license":"MIT"},"src/libs/SwapLimitOrders.sol":{"keccak256":"0xfe1d3d583d323cc9f1053b048eef645feb6d9c80744b836ecc0ee5c6fa242cd5","urls":["bzz-raw://ae59aaa5e8420e9b8a61f1ff1eaa09a3481f47223842643b66601a2b28490aaf","dweb:/ipfs/QmVS6AXRNV14eaywvrYqGhLvtZfND2ydnubBoiyqeHYrKY"],"license":"ZORA-DELAYED-OSL-v1"},"src/router/ISetLimitOrderConfig.sol":{"keccak256":"0x0aa4874d3640a56782781c2822639c39b12f3267906eb3b093e3de4e38e2d054","urls":["bzz-raw://286bf6d6893ae7c02e9a4e44de4cb6d60b8bc9a50248c08f3b325756dc34fdc8","dweb:/ipfs/QmeKMiRmtCdZ4jRpfSxVySqchmRgW7SqUVxoqXBGQqB3UU"],"license":"MIT"}},"version":1},"id":91}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: MIT
|
|
2
|
-
pragma solidity ^0.8.20;
|
|
3
|
-
|
|
4
|
-
import {LimitOrderConfig} from "../libs/SwapLimitOrders.sol";
|
|
5
|
-
|
|
6
|
-
/// @title ISetLimitOrderConfig
|
|
7
|
-
/// @notice Interface for setting limit order configuration
|
|
8
|
-
interface ISetLimitOrderConfig {
|
|
9
|
-
/// @notice Sets the canonical limit order configuration
|
|
10
|
-
/// @param config The new limit order configuration
|
|
11
|
-
function setLimitOrderConfig(LimitOrderConfig memory config) external;
|
|
12
|
-
}
|