@zoralabs/limit-orders 0.2.6 → 0.2.8

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 (104) hide show
  1. package/.turbo/turbo-build$colon$js.log +45 -44
  2. package/CHANGELOG.md +17 -7
  3. package/abis/ICoin.json +5 -0
  4. package/cache/solidity-files-cache.json +1 -1
  5. package/foundry.toml +1 -0
  6. package/out/BalanceDelta.sol/BalanceDeltaLibrary.json +1 -1
  7. package/out/BeforeSwapDelta.sol/BeforeSwapDeltaLibrary.json +1 -1
  8. package/out/BitMath.sol/BitMath.json +1 -1
  9. package/out/BytesLib.sol/BytesLib.json +1 -1
  10. package/out/CoinCommon.sol/CoinCommon.json +1 -1
  11. package/out/CoinConfigurationVersions.sol/CoinConfigurationVersions.json +1 -1
  12. package/out/CoinConstants.sol/CoinConstants.json +1 -1
  13. package/out/Context.sol/Context.json +1 -1
  14. package/out/ContractVersionBase.sol/ContractVersionBase.json +1 -1
  15. package/out/Currency.sol/CurrencyLibrary.json +1 -1
  16. package/out/CurrencyReserves.sol/CurrencyReserves.json +1 -1
  17. package/out/CustomRevert.sol/CustomRevert.json +1 -1
  18. package/out/DopplerMath.sol/DopplerMath.json +1 -1
  19. package/out/FixedPoint128.sol/FixedPoint128.json +1 -1
  20. package/out/FixedPoint96.sol/FixedPoint96.json +1 -1
  21. package/out/FullMath.sol/FullMath.json +1 -1
  22. package/out/IAllowanceTransfer.sol/IAllowanceTransfer.json +1 -1
  23. package/out/ICoin.sol/ICoin.json +1 -1
  24. package/out/ICoin.sol/IHasCoinType.json +1 -1
  25. package/out/ICoin.sol/IHasPoolKey.json +1 -1
  26. package/out/ICoin.sol/IHasSwapPath.json +1 -1
  27. package/out/ICoin.sol/IHasTotalSupplyForPositions.json +1 -1
  28. package/out/IDeployedCoinVersionLookup.sol/IDeployedCoinVersionLookup.json +1 -1
  29. package/out/IDopplerErrors.sol/IDopplerErrors.json +1 -1
  30. package/out/IEIP712.sol/IEIP712.json +1 -1
  31. package/out/IERC1363.sol/IERC1363.json +1 -1
  32. package/out/IERC165.sol/IERC165.json +1 -1
  33. package/out/IERC20.sol/IERC20.json +1 -1
  34. package/out/IERC20Minimal.sol/IERC20Minimal.json +1 -1
  35. package/out/IERC6909Claims.sol/IERC6909Claims.json +1 -1
  36. package/out/IERC7572.sol/IERC7572.json +1 -1
  37. package/out/IExtsload.sol/IExtsload.json +1 -1
  38. package/out/IExttload.sol/IExttload.json +1 -1
  39. package/out/IHasRewardsRecipients.sol/IHasRewardsRecipients.json +1 -1
  40. package/out/IHooks.sol/IHooks.json +1 -1
  41. package/out/IMsgSender.sol/IMsgSender.json +1 -1
  42. package/out/IPoolManager.sol/IPoolManager.json +1 -1
  43. package/out/IProtocolFees.sol/IProtocolFees.json +1 -1
  44. package/out/ISupportsLimitOrderFill.sol/ISupportsLimitOrderFill.json +1 -1
  45. package/out/ISwapPathRouter.sol/ISwapPathRouter.json +1 -1
  46. package/out/ISwapRouter.sol/ISwapRouter.json +1 -1
  47. package/out/IUniswapV3SwapCallback.sol/IUniswapV3SwapCallback.json +1 -1
  48. package/out/IUpgradeableV4Hook.sol/IUpgradeableDestinationV4Hook.json +1 -1
  49. package/out/IUpgradeableV4Hook.sol/IUpgradeableDestinationV4HookWithUpdateableFee.json +1 -1
  50. package/out/IUpgradeableV4Hook.sol/IUpgradeableV4Hook.json +1 -1
  51. package/out/IVersionedContract.sol/IVersionedContract.json +1 -1
  52. package/out/IWETH.sol/IWETH.json +1 -1
  53. package/out/IZoraHookRegistry.sol/IZoraHookRegistry.json +1 -1
  54. package/out/IZoraLimitOrderBook.sol/IZoraLimitOrderBook.json +1 -1
  55. package/out/IZoraLimitOrderBookCoinsInterface.sol/IZoraLimitOrderBookCoinsInterface.json +1 -1
  56. package/out/IZoraV4CoinHook.sol/IZoraV4CoinHook.json +1 -1
  57. package/out/LimitOrderBitmap.sol/LimitOrderBitmap.json +1 -1
  58. package/out/LimitOrderCommon.sol/LimitOrderCommon.json +1 -1
  59. package/out/LimitOrderCreate.sol/LimitOrderCreate.json +1 -1
  60. package/out/LimitOrderFill.sol/LimitOrderFill.json +1 -1
  61. package/out/LimitOrderLiquidity.sol/LimitOrderLiquidity.json +1 -1
  62. package/out/LimitOrderQueues.sol/LimitOrderQueues.json +1 -1
  63. package/out/LimitOrderStorage.sol/LimitOrderStorage.json +1 -1
  64. package/out/LimitOrderTypes.sol/LimitOrderTypes.json +1 -1
  65. package/out/LimitOrderViews.sol/LimitOrderViews.json +1 -1
  66. package/out/LimitOrderWithdraw.sol/LimitOrderWithdraw.json +1 -1
  67. package/out/LiquidityAmounts.sol/LiquidityAmounts.json +1 -1
  68. package/out/LiquidityMath.sol/LiquidityMath.json +1 -1
  69. package/out/Lock.sol/Lock.json +1 -1
  70. package/out/NonzeroDeltaCount.sol/NonzeroDeltaCount.json +1 -1
  71. package/out/Ownable.sol/Ownable.json +1 -1
  72. package/out/Ownable2Step.sol/Ownable2Step.json +1 -1
  73. package/out/Path.sol/Path.json +1 -1
  74. package/out/PathKey.sol/PathKeyLibrary.json +1 -1
  75. package/out/Permit2Payments.sol/Permit2Payments.json +1 -1
  76. package/out/PermittedCallers.sol/PermittedCallers.json +1 -1
  77. package/out/PoolId.sol/PoolIdLibrary.json +1 -1
  78. package/out/Position.sol/Position.json +1 -1
  79. package/out/SafeCast.sol/SafeCast.json +1 -1
  80. package/out/SafeCast160.sol/SafeCast160.json +1 -1
  81. package/out/SafeERC20.sol/SafeERC20.json +1 -1
  82. package/out/SqrtPriceMath.sol/SqrtPriceMath.json +1 -1
  83. package/out/StateLibrary.sol/StateLibrary.json +1 -1
  84. package/out/SwapLimitOrders.sol/SwapLimitOrders.json +1 -1
  85. package/out/SwapWithLimitOrders.sol/SwapWithLimitOrders.json +1 -1
  86. package/out/TickBitmap.sol/TickBitmap.json +1 -1
  87. package/out/TickMath.sol/TickMath.json +1 -1
  88. package/out/TransientSlot.sol/TransientSlot.json +1 -1
  89. package/out/TransientStateLibrary.sol/TransientStateLibrary.json +1 -1
  90. package/out/UniV4SwapToCurrency.sol/UniV4SwapToCurrency.json +1 -1
  91. package/out/UnsafeMath.sol/UnsafeMath.json +1 -1
  92. package/out/V3ToV4SwapLib.sol/V3ToV4SwapLib.json +1 -1
  93. package/out/ZoraLimitOrderBook.sol/ZoraLimitOrderBook.json +1 -1
  94. package/out/build-info/{b6efea4394bdeb7d.json → 2605948752e570d1.json} +1 -1
  95. package/out/uniswap/BitMath.sol/BitMath.json +1 -1
  96. package/out/uniswap/CustomRevert.sol/CustomRevert.json +1 -1
  97. package/out/uniswap/FullMath.sol/FullMath.json +1 -1
  98. package/out/uniswap/SafeCast.sol/SafeCast.json +1 -1
  99. package/out/uniswap/TickMath.sol/TickMath.json +1 -1
  100. package/package.json +3 -3
  101. package/src/libs/LimitOrderFill.sol +4 -5
  102. package/src/version/ContractVersionBase.sol +1 -1
  103. package/test/DebugSwapWithLimitOrders.t.sol +196 -0
  104. package/test/LimitOrderFill.t.sol +118 -0
@@ -1,17 +1,17 @@
1
1
 
2
- > @zoralabs/limit-orders@0.2.6 build:js /home/runner/work/zora-protocol-private/zora-protocol-private/packages/limit-orders
2
+ > @zoralabs/limit-orders@0.2.8 build:js /home/runner/work/zora-protocol-private/zora-protocol-private/packages/limit-orders
3
3
  > pnpm run wagmi:generate && pnpm run copy-abis && pnpm run prettier:write && tsup
4
4
 
5
5
 
6
- > @zoralabs/limit-orders@0.2.6 wagmi:generate /home/runner/work/zora-protocol-private/zora-protocol-private/packages/limit-orders
6
+ > @zoralabs/limit-orders@0.2.8 wagmi:generate /home/runner/work/zora-protocol-private/zora-protocol-private/packages/limit-orders
7
7
  > pnpm run build:contracts:minimal && wagmi generate && pnpm exec rename-generated-abi-casing ./package/wagmiGenerated.ts
8
8
 
9
9
 
10
- > @zoralabs/limit-orders@0.2.6 build:contracts:minimal /home/runner/work/zora-protocol-private/zora-protocol-private/packages/limit-orders
10
+ > @zoralabs/limit-orders@0.2.8 build:contracts:minimal /home/runner/work/zora-protocol-private/zora-protocol-private/packages/limit-orders
11
11
  > forge build src/ --no-metadata
12
12
 
13
13
  Compiling 94 files with Solc 0.8.28
14
- Solc 0.8.28 finished in 8.46s
14
+ Solc 0.8.28 finished in 7.49s
15
15
  Compiler run successful!
16
16
  - Validating plugins
17
17
  ✔ Validating plugins
@@ -26,50 +26,51 @@ Compiler run successful!
26
26
  ✅ Updated ./package/wagmiGenerated.ts (3 replacements)
27
27
  ✨ All files processed successfully!
28
28
 
29
- > @zoralabs/limit-orders@0.2.6 copy-abis /home/runner/work/zora-protocol-private/zora-protocol-private/packages/limit-orders
29
+ > @zoralabs/limit-orders@0.2.8 copy-abis /home/runner/work/zora-protocol-private/zora-protocol-private/packages/limit-orders
30
30
  > pnpm exec bundle-abis
31
31
 
32
32
 
33
- > @zoralabs/limit-orders@0.2.6 prettier:write /home/runner/work/zora-protocol-private/zora-protocol-private/packages/limit-orders
33
+ > @zoralabs/limit-orders@0.2.8 prettier:write /home/runner/work/zora-protocol-private/zora-protocol-private/packages/limit-orders
34
34
  > prettier --write 'src/**/*.sol' 'test/**/*.sol'
35
35
 
36
- src/access/PermittedCallers.sol 469ms (unchanged)
37
- src/IZoraLimitOrderBook.sol 61ms (unchanged)
38
- src/libs/LimitOrderBitmap.sol 64ms (unchanged)
39
- src/libs/LimitOrderCommon.sol 259ms (unchanged)
40
- src/libs/LimitOrderCreate.sol 379ms (unchanged)
41
- src/libs/LimitOrderFill.sol 234ms (unchanged)
42
- src/libs/LimitOrderLiquidity.sol 234ms (unchanged)
43
- src/libs/LimitOrderQueues.sol 70ms (unchanged)
44
- src/libs/LimitOrderStorage.sol 15ms (unchanged)
36
+ src/access/PermittedCallers.sol 465ms (unchanged)
37
+ src/IZoraLimitOrderBook.sol 60ms (unchanged)
38
+ src/libs/LimitOrderBitmap.sol 70ms (unchanged)
39
+ src/libs/LimitOrderCommon.sol 225ms (unchanged)
40
+ src/libs/LimitOrderCreate.sol 346ms (unchanged)
41
+ src/libs/LimitOrderFill.sol 220ms (unchanged)
42
+ src/libs/LimitOrderLiquidity.sol 239ms (unchanged)
43
+ src/libs/LimitOrderQueues.sol 77ms (unchanged)
44
+ src/libs/LimitOrderStorage.sol 14ms (unchanged)
45
45
  src/libs/LimitOrderTypes.sol 2ms (unchanged)
46
- src/libs/LimitOrderViews.sol 119ms (unchanged)
47
- src/libs/LimitOrderWithdraw.sol 116ms (unchanged)
48
- src/libs/Permit2Payments.sol 17ms (unchanged)
49
- src/libs/SwapLimitOrders.sol 171ms (unchanged)
50
- src/router/SwapWithLimitOrders.sol 267ms (unchanged)
51
- src/version/ContractVersionBase.sol 4ms (unchanged)
52
- src/ZoraLimitOrderBook.sol 134ms (unchanged)
53
- test/gas/LimitOrderFillGas.t.sol 855ms (unchanged)
54
- test/gas/LimitOrderSwapGas.t.sol 320ms (unchanged)
55
- test/LimitOrderAccessControl.t.sol 421ms (unchanged)
56
- test/LimitOrderBitmap.t.sol 226ms (unchanged)
57
- test/LimitOrderCreate.t.sol 398ms (unchanged)
58
- test/LimitOrderFill.t.sol 1114ms (unchanged)
59
- test/LimitOrderLibraries.t.sol 404ms (unchanged)
60
- test/LimitOrderLiquidityPayouts.t.sol 459ms (unchanged)
61
- test/LimitOrderV4Pools.t.sol 156ms (unchanged)
62
- test/LimitOrderWithdraw.t.sol 679ms (unchanged)
63
- test/SwapWithLimitOrders.t.sol 92ms (unchanged)
64
- test/SwapWithLimitOrdersRouter.t.sol 677ms (unchanged)
65
- test/unit/LimitOrderBitmapUnit.t.sol 96ms (unchanged)
66
- test/unit/LimitOrderCreateUnit.t.sol 176ms (unchanged)
67
- test/unit/SwapLimitOrdersUnit.t.sol 676ms (unchanged)
68
- test/unit/SwapLimitOrdersValidation.t.sol 278ms (unchanged)
69
- test/unit/SwapWithLimitOrdersUnit.t.sol 83ms (unchanged)
70
- test/utils/BaseTest.sol 663ms (unchanged)
71
- test/utils/MockWETH.sol 34ms (unchanged)
72
- test/utils/TestableZoraLimitOrderBook.sol 20ms (unchanged)
46
+ src/libs/LimitOrderViews.sol 105ms (unchanged)
47
+ src/libs/LimitOrderWithdraw.sol 105ms (unchanged)
48
+ src/libs/Permit2Payments.sol 16ms (unchanged)
49
+ src/libs/SwapLimitOrders.sol 145ms (unchanged)
50
+ src/router/SwapWithLimitOrders.sol 263ms (unchanged)
51
+ src/version/ContractVersionBase.sol 6ms (unchanged)
52
+ src/ZoraLimitOrderBook.sol 144ms (unchanged)
53
+ test/DebugSwapWithLimitOrders.t.sol 132ms (unchanged)
54
+ test/gas/LimitOrderFillGas.t.sol 773ms (unchanged)
55
+ test/gas/LimitOrderSwapGas.t.sol 298ms (unchanged)
56
+ test/LimitOrderAccessControl.t.sol 366ms (unchanged)
57
+ test/LimitOrderBitmap.t.sol 201ms (unchanged)
58
+ test/LimitOrderCreate.t.sol 364ms (unchanged)
59
+ test/LimitOrderFill.t.sol 1072ms (unchanged)
60
+ test/LimitOrderLibraries.t.sol 374ms (unchanged)
61
+ test/LimitOrderLiquidityPayouts.t.sol 373ms (unchanged)
62
+ test/LimitOrderV4Pools.t.sol 131ms (unchanged)
63
+ test/LimitOrderWithdraw.t.sol 623ms (unchanged)
64
+ test/SwapWithLimitOrders.t.sol 88ms (unchanged)
65
+ test/SwapWithLimitOrdersRouter.t.sol 590ms (unchanged)
66
+ test/unit/LimitOrderBitmapUnit.t.sol 85ms (unchanged)
67
+ test/unit/LimitOrderCreateUnit.t.sol 161ms (unchanged)
68
+ test/unit/SwapLimitOrdersUnit.t.sol 662ms (unchanged)
69
+ test/unit/SwapLimitOrdersValidation.t.sol 240ms (unchanged)
70
+ test/unit/SwapWithLimitOrdersUnit.t.sol 72ms (unchanged)
71
+ test/utils/BaseTest.sol 596ms (unchanged)
72
+ test/utils/MockWETH.sol 32ms (unchanged)
73
+ test/utils/TestableZoraLimitOrderBook.sol 37ms (unchanged)
73
74
  CLI Building entry: package/index.ts
74
75
  CLI Using tsconfig: tsconfig.json
75
76
  CLI tsup v8.5.1
@@ -80,7 +81,7 @@ Compiler run successful!
80
81
  ESM Build start
81
82
  ESM dist/index.js 24.82 KB
82
83
  ESM dist/index.js.map 44.67 KB
83
- ESM ⚡️ Build success in 42ms
84
+ ESM ⚡️ Build success in 36ms
84
85
  CJS dist/index.cjs 25.99 KB
85
86
  CJS dist/index.cjs.map 44.79 KB
86
- CJS ⚡️ Build success in 42ms
87
+ CJS ⚡️ Build success in 38ms
package/CHANGELOG.md CHANGED
@@ -1,11 +1,27 @@
1
1
  # @zoralabs/limit-orders
2
2
 
3
+ ## 0.2.8
4
+
5
+ ### Patch Changes
6
+
7
+ - fbb389583: Bump viem to 2.53.1
8
+
9
+ Raise the pinned viem version from 2.22.12 to 2.53.1 across the monorepo to pick up newer chain definitions and support the latest x402 v2 client packages.
10
+
11
+ ## 0.2.7
12
+
13
+ ### Patch Changes
14
+
15
+ - ee8921b7: Fix multi-hop payout path for content coin limit orders
16
+ - Pass `coinIn` instead of `coinOut` to `burnAndPayout` in `LimitOrderFill._fillOrder`
17
+ - This ensures content coin orders pay out in the ultimate backing currency (ZORA) via the multi-hop path
18
+ - Previously, content coin orders would fall back to single-hop and pay out in creator coin instead of ZORA
19
+
3
20
  ## 0.2.6
4
21
 
5
22
  ### Patch Changes
6
23
 
7
24
  - df0b0a1d: Add ContractVersionBase inheritance to ZoraLimitOrderBook and SwapWithLimitOrders
8
-
9
25
  - Both contracts now inherit from ContractVersionBase for consistent version tracking
10
26
  - Implements IVersionedContract interface with contractVersion() returning "0.2.5"
11
27
 
@@ -31,7 +47,6 @@
31
47
  ### Patch Changes
32
48
 
33
49
  - 98e02520: Fix dual positive deltas consolidation in burnAndRefund
34
-
35
50
  - Consolidate payouts to single currency when burning limit orders with dual positive deltas
36
51
  - Extract path-building logic into reusable `_buildSingleHopPath` helper function
37
52
  - Ensure users receive proceeds in their original deposit currency by swapping counter-assets
@@ -47,7 +62,6 @@
47
62
  ### Patch Changes
48
63
 
49
64
  - bb2c2b76: Replace AccessManager with PermittedCallers + Ownable2Step for access control in ZoraLimitOrderBook and SwapWithLimitOrders contracts.
50
-
51
65
  - Remove AccessManager and SimpleAccessManaged pattern
52
66
  - Use OpenZeppelin Ownable2Step for two-step ownership transfer
53
67
  - Add `permittedCallers` mapping to gate `create()` access (public by default, owner can restrict)
@@ -92,7 +106,6 @@
92
106
  - 2cb9cb30: Remove fixed MIN_LIMIT_ORDER_SIZE threshold that made many tokens unusable. Limit orders now accept any positive amount instead of requiring at least 1e18 tokens, fixing compatibility issues with tokens using different decimal configurations.
93
107
  - eec53af3: Remove unnecessary Permit2Payments inheritance and use direct PERMIT2 immutable reference instead. This simplifies the contract structure by eliminating unused inherited functions while maintaining identical functionality.
94
108
  - 83726a0e: Remove unused settle negative deltas logic
95
-
96
109
  - Remove redundant `_settleNegativeDeltas` function that was never executed
97
110
  - Simplify limit order closure logic by removing unnecessary delta settlement
98
111
 
@@ -122,19 +135,16 @@
122
135
  - c59a6fac: Initial release of limit orders protocol
123
136
 
124
137
  Introduces a limit order system built on top of Uniswap V4 concentrated liquidity positions:
125
-
126
138
  - **Orders as V4 Positions**: Each limit order is a single-tick-wide Uniswap V4 liquidity position, enabling makers to place orders at specific price points
127
139
  - **FIFO Queue System**: Orders are organized in queues by `(poolKeyHash, coin, tick)` with bitmap-based tick tracking for efficient iteration
128
140
  - **Epoch-Based Fill Protection**: Orders cannot be filled in the same epoch they were created, preventing same-transaction manipulation
129
141
 
130
142
  **Fill Integration Modes:**
131
-
132
143
  - **Auto-fill via Hook**: The Zora hook now calls `fill()` on the limit order book during `afterSwap`, automatically filling orders as swaps cross through their tick ranges
133
144
  - **Router Fallback**: For legacy hooks, the router can call `fill()` post-swap
134
145
  - **Third-party Fill**: Anyone can call `fill()` when the PoolManager is locked, incentivized by LP fee collection
135
146
 
136
147
  **Fee Model:**
137
-
138
148
  - Fill referrals receive accrued LP fees from filled positions
139
149
  - Makers receive full proceeds on withdrawal
140
150
  - Makers can cancel their limit orders to withdraw the backing currency
package/abis/ICoin.json CHANGED
@@ -968,6 +968,11 @@
968
968
  "name": "InsufficientLiquidity",
969
969
  "inputs": []
970
970
  },
971
+ {
972
+ "type": "error",
973
+ "name": "InvalidCurrency",
974
+ "inputs": []
975
+ },
971
976
  {
972
977
  "type": "error",
973
978
  "name": "InvalidCurrencyLowerTick",