0xprotocol limit orders let makers set fixed prices and expiry before onchain fills
Updated on
0xprotocol limit orders are signed ERC-20 trade offers whose token amounts set a fixed exchange price and whose expiry limits their lifetime. In Exchange V4, a maker authorizes the offer offchain, and an eligible taker later submits a fill to the Exchange Proxy. Both sides need sufficient balances and allowances at execution. Before signing a first order, the useful decisions are the assets, amounts, expiry and permitted taker; a signature alone records no completed trade.
Balances and approvals before signing
Native V4 orders require sufficient maker and taker token balances and Exchange Proxy allowances when a fill executes. The maker supplies the selling token; the taker supplies the payment token. An allowance authorizes a particular contract to spend a token. Approval granted to another contract does not establish this prerequisite. Balances can change after signing, so creation-time readiness does not reserve either side's tokens for the order.
Approval targets depend on the execution method. Swap API v2 uses AllowanceHolder or Permit2 as its spender, as indicated by the response. Its transaction entry point can differ from its spender, and Settler must never receive a token allowance. Those API rules do not replace the Exchange Proxy allowance requirement for a direct native V4 fill. Keeping an offer unsigned leaves its trade terms unauthorized.
A first fill with a defined amount
An eligible taker considers an unexpired signed native V4 order with an unfilled remainder. Both wallets have sufficient token balances and Exchange Proxy allowances. The signature is valid, and the taker and caller match any encoded restrictions. The requested fill must produce a nonzero maker-token output after rounding. The maker separately controls cancellation.
| Native V4 choice | Amount or state boundary |
|---|---|
Taker:
fillLimitOrder()
|
Fills up to the requested taker-token amount, subject to the remaining order and other conditions. |
Taker:
fillOrKillLimitOrder()
|
Fills exactly the requested taker-token amount or reverts. |
Maker:
cancelLimitOrder()
|
Stops future fills of the remainder once cancellation succeeds onchain. |
With the exact-request method, successful execution exchanges the requested payment amount at the signed ratio. That request can cover only part of the remaining order. Choosing this method therefore does not make the maker's entire offer indivisible.
If another taker consumes part of the remainder before execution, the exact request may no longer fit. The call then reverts if it cannot fill the requested amount. An earlier successful fill remains part of the order's history.
Before retrying, the taker can reassess the remainder and choose a smaller request if the interface supports it. Stopping before another submission leaves that next trade unexecuted. The maker can separately cancel any remainder it no longer wants available.
The transaction's
LimitOrderFilled
event reports actual token amounts for the call. Nonzero executed amounts establish the exchange. Meanwhile,
getLimitOrderInfo()
reports cumulative
takerTokenFilledAmount
in taker-token base units. A partial fill can leave this order
FILLABLE
;
FILLED
means its full taker amount has traded. Signing or submission alone proves neither outcome.
Token amounts and the signed price
The
makerAmount
and
takerAmount
fields establish the exchange ratio between the two named token contracts. The first describes what the maker sells; the second describes what the taker supplies. Human-readable prices require converting each amount using its token's decimals. Comparing raw integers across different tokens can misrepresent the intended price, even when both amount fields look plausible. A native limit order records an offer a taker may accept under its encoded conditions. It does not schedule an automatic transaction when a chart reaches the displayed price. Integer settlement rounds maker-token output down to base units.
Altering an amount changes the order the signature must authorize. Editing a displayed price therefore cannot preserve the original authorization for different trade terms.
Expiry and the last valid fill
The
expiry
field defines an absolute Unix timestamp in seconds, which sets the signed offer's time boundary. The contract rejects fills once expiry is reached. A frontend countdown represents that timestamp; it does not extend the signed window. Cancellation or full execution can close an order sooner. Leaving it open until expiry gives takers time to respond without promising any fill. A different deadline changes the signed terms and requires a valid signature for the changed order.
Who can fill a restricted limit order?
The
taker
field identifies the permitted taker when it contains a nonzero address; a zero address permits any taker. That zero address grants no ERC-20 allowance and arranges no counterparty.
The separate
sender
field controls which address may call the fill function. In a direct fill, the caller is the taker. A meta-transaction can separate them: the signer supplies the taker identity while another address submits the call. A nonzero restriction must match the role it governs. The sender and taker fields therefore cannot substitute for each other when the execution method separates those roles.
Why can a fillable limit order revert?
A fillable native order can revert when its signature, token balances, allowances or caller restrictions fail the execution checks. The basic
getLimitOrderInfo()
query checks fill, cancellation and expiry state. It does not validate a signature or inspect either wallet's token balances and allowances.
The
getLimitOrderRelevantState()
query also returns signature validity and a fillable amount based on the maker's balance and allowance. Its maker-side calculation does not establish the taker's available funds or future account state.
Signature validation requires valid authorization for the exact order fields. An allowance failure concerns the affected token and spender; an insufficient balance concerns the asset that side must supply. Expired, cancelled and already completed orders cannot accept another fill under their original state.
Native taker fees and the former protocol charge
Native limit orders can include an optional fee the taker pays in
takerToken
to
feeRecipient
. The
takerTokenFeeAmount
field specifies the fee for the full order.
For native V4 partial fills, the contract scales that fee by the fraction of
takerAmount
filled and rounds down to taker-token base units.
The taker needs sufficient balance and allowance for the actual fee alongside the trade payment. The signed price ratio alone therefore does not describe every token outflow.
The former protocol charge has a different scope. ZEIP-91 removed protocol fees for all order types in Exchange V3 and V4 effective September 29, 2021. That change did not remove blockchain transaction costs or optional order fees. Charges a trading application applies through an API belong to that product's pricing and request configuration.
Order hashes and signed data
An order hash identifies a specific signed offer, while a transaction hash identifies a blockchain submission. Several partial fills can refer to the same order. Retaining the original order fields and signature preserves the data a native fill requires. A dashboard label or token ticker does not reproduce those signed fields.
The
getLimitOrderHash()
function computes the native order's EIP-712 hash. The order-status query takes the order itself as input, not merely a transaction identifier. Matching event order hashes distinguishes changes to this offer from unrelated wallet activity. A submitted cancellation also needs a successful execution result before it establishes that the remaining offer has closed.
Standing offers and RFQ quotes
Native limit orders fit a maker who wants to share fixed terms for later acceptance. RFQ orders originate from market makers during swap-quote construction and use a separate order format. Swap API routing may compare liquidity without providing a frontend for composing native limit orders. Protocol support therefore does not establish which controls a particular trading interface exposes. The next choice is whether the available interface supports the desired standing offer or whether a fresh swap quote better matches the intended trade.
0xprotocol limit orders: what people ask
Can a registered signer authorize an order for the maker?
Exchange V4 allows a registered signer to authorize orders for the maker. The maker grants that authority through registerAllowedOrderSigner(). A fill still needs a valid signature and sufficient maker balance and allowance. Registration delegates signing authority; the maker's wallet continues to supply the tokens being sold.
Which signature formats does Exchange V4 accept for ERC-20 orders?
The native V4 signature struct accepts EIP712 with signatureType 2 and EthSign with signatureType 3. EIP-712 typed-data signing lets compatible wallets display the order fields for inspection. The signature format changes how the wallet signs; it does not alter the order's price, expiry or eligibility conditions.
Are ERC721 and ERC1155 trades part of the native LimitOrder format?
Native LimitOrder structs describe ERC-20-to-ERC-20 trades. Exchange V4 also has separate ERC721Order and ERC1155Order formats for NFT trades, including NFT identifiers and trade direction. Those formats use their own fill functions. NFT support elsewhere in V4 does not make an ERC-20 limit order compatible with an NFT.
Does a new salt invalidate an earlier signed order?
Changing the salt does not invalidate an earlier signed order. It creates a different order hash while leaving the earlier authorization intact. The old offer keeps its own expiry and onchain state and can remain fillable while its other conditions hold. Replacing an offer therefore requires accounting for any uncancelled remainder of the old order.
How can a maker cancel several orders for one token pair?
A maker can use cancelPairLimitOrders() to invalidate its limit orders for a specified maker-token and taker-token pair whose salts fall below a chosen threshold. This reaches multiple orders within that pair; it does not cancel every market the wallet trades. Registered signers have a separate cancelPairLimitOrdersWithSigner() method.
Why does the signing network matter for a native limit order?
The native order hash includes chainId and verifyingContract in its EIP-712 domain. A signature therefore authorizes terms within that domain. Using another network or verifying contract changes the message the signature must validate. The signing context must match the Exchange Proxy deployment handling the intended fill.