Two authorizations
Both are per maker. The signature is also per token pair and direction: selling WETH for USDC and selling USDC for WETH need separate signatures. The allowance is per token and chain, and every order that sells that token on that chain draws on it.
The order signature
The maker signs the keccak-256 hash of four addresses, packed as 20 bytes each:
The same signature works for limit orders and DCA strategies on the same pair. Address casing doesn’t change the hash, because each address is packed as its 20 raw bytes. A mixed-case address whose EIP-55 checksum is wrong is usually a typo. The helpers below reject it before they sign, and so does the API. Send
accountTo in checksummed form.
Sign a pair
Each function signs the pair, checks the result against the maker and returns the two fields a create request needs. Save the one you use assign-order-pair.ts or sign_order_pair.py. The limit order and DCA guides import signOrderPair from sign-order-pair.ts.
Check the signature before you send it
Olympex doesn’t check the signature when you create an order or a strategy. A wrong signature is accepted, and the order fails later, when Olympex tries to execute it. Each function above recovers the signer from the signature and compares it with the maker before it returns. Keep that check, and add it to any signing code you write yourself. To test your packing, hash this input and compare the result:
The signature itself depends on the maker’s private key, so it differs for every wallet. The recovery check covers it.
The maker must be an EOA
Only 65-byte ECDSA signatures are accepted, so the maker must be an externally owned account (EOA). Smart-contract wallets, such as Safe or ERC-4337 accounts, can’t sign orders. Wallet libraries such as ethers, viem and eth-account produce the right format. If you sign with a key management service or a hardware security module, make sure the result is 65 bytes (r, s, v) with a v of 27 or 28 and a low s value, not a 64-byte compact signature.
What the signature authorizes
This is the trust model for limit orders and DCA:- It authorizes swaps of one pair. It lets the Olympex order contract execute swaps of
tokenInfortokenOutfrom the maker’s wallet. - It doesn’t bind the terms. It covers no amount, price, expiry, chain or specific order. Olympex enforces the amounts, prices and expiry of your orders when it executes them.
- It outlives your orders. It stays valid after you cancel an order, and the same signature serves limit orders and DCA strategies for that pair.
- The allowance is the on-chain limit. The order contract can spend only up to the maker’s allowance of the token sold. Approve only what your open orders need, never an unlimited amount.
The allowance is the on-chain limit
The maker approves the order contract for the chain (see the table below), in base units of the token sold. Each execution spends part of the allowance. Nothing is reserved when you create an order: at execution, the maker’s wallet must still hold the tokens and the allowance, or the order can’t execute.How much to approve
To estimate a limit order’s gas cost, request a single-chain
POST /quotes for the same pair and amount with "includeGasInfo": true. dataFeeTransaction.transactionFeeInToken is the estimate in the token sold, and dataFeeTransaction.valueToApprove is amount plus that estimate. Add a generous buffer on top: the estimate leaves out the Olympex contracts, and gas can cost more when the order executes than when you quoted. Gas and fees explains the fields.
Convert human-readable amounts to base units with the token’s decimals from GET /tokens, for example with parseUnits.
One allowance per token and chain
Every open limit order and active DCA strategy that sells the same token on the same chain draws on one allowance, because they share the order contract as spender.approve sets the allowance to a new value; it doesn’t add to it. So when you create a second order that sells the same token, approve the sum:
Set the allowance
setOrderAllowance sets the order contract’s allowance for one token to an exact value. Some tokens revert when one non-zero allowance replaces another, so it resets the allowance to 0 first when both values are non-zero.
Stop everything: set the allowance to 0
Cancelling an order or a strategy through the API doesn’t change the allowance. To stop execution for a token with certainty, set the maker’s allowance to the order contract to0, for example with setOrderAllowance(token, 0n).
- It stops every limit order and every DCA strategy that sells that token on that chain for that maker, at once. It isn’t a per-order switch.
- Cancel the orders and strategies through the API as well, so they don’t stay
pendingoractive. - To resume, approve again for what your remaining orders need.
0 when you stop using limit orders or DCA for a token, and immediately if you suspect that your API credentials have leaked.
The order contract
The order contract is the spender to approve for limit orders and DCA. It is production, per chain:
Limit orders and DCA execute only on chains in this table, and you create orders only on chains that
GET /chains returns. Base and Linea use the same address: always pair an address with its chain.
Record the address for each chain you use. If a wallet asks the maker to approve a different spender for an order, stop and confirm with partners@olympex.io before anyone signs.
Not the swap spender
POST /swap returns contractToApprove: the spender for that one swap, which you approve for its exact input amount. The order contract is a different address with its own allowance. An allowance to one doesn’t cover the other: approve contractToApprove for swaps, and the order contract in the table above for limit orders and DCA.
What this means for your integration
- Sign each pair once per maker, from an EOA, over the 32 bytes of
inner, and verify the signature before you send it. - Keep the allowance to the order contract at the sum of what your open orders and active strategies still need, and never unlimited.
- Set the allowance to
0to stop every order that sells a token. Cancelling through the API doesn’t touch the allowance. - Approve the order contract for orders and
contractToApprovefor swaps, never one for the other.
Related
Limit orders
Price trigger, lifecycle and fees.
DCA strategies
Strategies, orders, price bounds and fees.
Place a limit order
Sign, approve, create and track an order.
Security model
What Olympex can and can’t do with funds and credentials.
