Skip to main content
Limit orders and DCA strategies execute after you create them: Olympex runs each swap from the maker’s wallet when the order’s conditions are met. Two authorizations from the maker’s wallet make that possible. A signature, made once per token pair, lets the Olympex order contract swap that pair for the maker. An ERC-20 allowance to the order contract sets how much of the token it can spend. This page shows how to produce the signature, what it covers, and how to manage the allowance, which is the limit the chain enforces.

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 maker appears twice. The addresses map to request fields like this: 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 the 32 bytes of inner, not its hex string. signMessage("0x5320…") signs the 66 characters as text and returns a signature that looks valid but fails when Olympex executes the order. Pass getBytes(inner) in ethers, { raw: inner } in viem, or encode_defunct(primitive=inner) in Python.

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 as sign-order-pair.ts or sign_order_pair.py. The limit order and DCA guides import signOrderPair from sign-order-pair.ts.
To authorize selling WETH for USDC on Polygon with ethers:

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 tokenIn for tokenOut from 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 order contract is an upgradeable proxy operated by Olympex. Anyone who holds your API credentials can create, change and cancel orders under your API key, so the allowance also limits what a leaked credential can reach. Security model covers both.

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:
Recompute it whenever you create, update or cancel an order or a strategy, and set the allowance to the new total.

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.
Never approve an unlimited amount to the order contract. The signature doesn’t limit amounts, so an unlimited allowance lets orders for a signed pair spend the maker’s whole balance of the token.

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 to 0, 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 pending or active.
  • To resume, approve again for what your remaining orders need.
Set the allowance to 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 0 to stop every order that sells a token. Cancelling through the API doesn’t touch the allowance.
  • Approve the order contract for orders and contractToApprove for swaps, never one for the other.

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.