On-chain limit orders, stops and DCA: escrow, keepers and price floors
A swap fills now. An order waits for your terms. How on-chain limit, stop and DCA orders work, who fills them, what the contract guarantees and what it costs.
A market swap takes whatever price the pools offer right now. Often that is what you want. Sometimes you would rather say "sell my BNB if it reaches 800 USDT" or "buy $100 of BNB every week" and walk away. On a centralised exchange that is an order on the book. On a DEX, someone has to watch the market for you and send the transaction at the right moment, and a contract has to make sure they cannot cheat.
This guide explains the two common designs, what a price floor really guarantees, how stops and DCA differ from a plain limit order, and the costs involved.
Two ways to build an on-chain order
Escrow plus a keeper
You send the tokens you want to sell into an order contract, together with your terms. An off-chain bot, usually called a keeper, watches prices. When the market reaches your terms, it sends a transaction that fills the order through the DEX liquidity, and the contract checks the terms before it pays you.
This is the pattern behind many automation systems. Chainlink's documentation on automation even names "only executing limit orders when their levels are met" as an example. It also gives the key safety rule: the on-chain function must re-check the conditions itself, because whatever the bot saw off chain may already be stale.
Signed orders plus fillers
The other design keeps your tokens in your wallet. You sign a message stating the minimum you accept, and it is published off chain. Third parties, often called fillers or solvers, compete to settle it, pay the gas and recover it through the price. A settlement contract checks your signature and that you received at least what you asked for.
How they compare
| Escrow and keeper | Signed order and fillers | |
|---|---|---|
| Your tokens while the order is open | in the order contract | in your wallet |
| Placing and cancelling | on-chain transactions | free signature, cancelling may need a transaction to be certain |
| Who pays gas for a fill | the keeper | the filler, inside the price |
| Order visible on chain | yes | no, until it fills |
| Balance guaranteed at fill time | yes | only if you still hold it |
Neither design is strictly better. Escrow makes the order a public, self-contained object on chain that does not depend on an off-chain order book. Signed orders cost nothing to place and leave your tokens free until the fill. What matters most in both is the same thing: what the contract enforces when the fill happens.
The floor is the guarantee
Every well-built order carries a floor, the minimum the contract will accept on your behalf. The keeper or filler chooses when to fill and which route to use. The contract checks the floor. If the fill would pay less, it reverts.
A worked example. You place a limit order to sell 2 BNB at a minimum of 800 USDT each. The floor is 1,600 USDT.
Now add a fee. Suppose the order contract takes 10 bps of each fill and the floor is net of fees, as it is in Tirio's Orders contract. Then the route must deliver at least 1,600 ÷ 0.999 = 1,601.60 USDT before the fee for the fill to go through. If the keeper finds a route paying 1,612 USDT, the fee is 1.61 USDT and you receive 1,610.39. Everything above your floor reaches you.
Two details make floors trustworthy:
- They scale with partial fills. If an order allows partial fills and half of it fills, that half must pay at least half the floor.
- Net of fees means a fee change cannot hurt you. If the fee were raised later, the floor you set would still be what you receive at minimum.
Stops: a trigger and a worst price
A stop-loss is a different kind of order. It does not wait for a better price. It waits for a worse one and then sells.
That needs two numbers, because the trigger is not the price you will get:
- Stop price. The level that triggers the sale, say 700 USDT per BNB.
- Worst price. The lowest price you accept once triggered, say 665 USDT.
In a calm market the stop sells near 700. In a fast fall it may sell well below 700, but never below 665. If the price gaps straight from 710 to 650, the order stays open instead of selling into the hole. That is a protection and a risk at the same time, so choose the worst price with both in mind. A take-profit leg can sit above the stop on the same tokens, and whichever leg fills first closes the order.
Without an oracle, a stop has to decide from on-chain prices, and a single pool can be pushed for a moment. A careful design waits for the trigger to hold across several checks and simulates the full route before it sells.
DCA: the same trade, spread over time
Dollar-cost averaging means investing equal amounts at regular intervals regardless of what the market does. The SEC's investor glossary notes that you buy more when the price is low and less when it is high.
A small example. You spend $300 on BNB in three $100 slices, at prices of 760, 700 and 800 USDT:
| Slice | Price | BNB bought |
|---|---|---|
| 1 | 760 | 0.1316 |
| 2 | 700 | 0.1429 |
| 3 | 800 | 0.1250 |
| Total | 0.3994 |
Your average cost is $300 ÷ 0.3994 = about 751 USDT per BNB, a little below the simple average of the three prices, 753. That small edge comes from buying more in the cheap slice.
DCA is not magic. FINRA's overview points out that spreading money out gradually often returns less than investing a lump sum over long periods, and that per-trade fees add up. On chain, every slice pays pool fees, and in an escrow design someone has to pay the keeper's gas, usually through the order fee. What DCA gives you is a schedule and less timing risk, not a better expected price.
On chain, each slice should also have a price protection: a bound beyond which the slice waits instead of filling. Otherwise a slice could fill into a moment of terrible liquidity.
Keepers: what they can and cannot do
In an escrow design, the keeper decides timing and route. A good contract limits it to exactly that. It cannot move your tokens except into a fill that meets your floor, it cannot change your terms, and it cannot stop you from cancelling.
What a keeper can affect is when a fill happens. If it is slow, your order fills later. That is why it is worth asking what happens when the keeper is not around. In Tirio's Orders contract, the keeper checks in regularly, and if it has not checked in for 15 minutes, anyone may fill limit orders and take-profit legs, still at no less than their floors. Stop legs and DCA slices wait for the keeper, because letting anyone fill those at their worst-case bound could cost the maker far more than a delay.
How Tirio's orders work
Limit, stop with take-profit and DCA orders have been live on BNB Chain since 2026-09-30. In short:
- Escrow. Placing an order moves the tokens you sell into the Orders contract in one transaction. Cancel any time and the rest returns to your wallet in the same transaction. Expired orders are refunded.
- Net floors. Every fill must give you at least your price after fees, in proportion to the amount filled.
- Fees. 10 bps of what each fill receives, 3 bps between stablecoins, charged only when an order fills. The keeper pays the gas of fills.
- Price improvement. When the keeper fills, everything the route pays above your price is yours.
- An optional order book. A limit order can be listed so that any Tirio swap can take it at exactly your limit price, as if it were a pool. Listed orders tend to fill sooner and always fill at exactly your price.
- Limits. Tokens with a transfer tax are refused, and the app suggests at least $10 per order or per DCA slice.
The orders documentation covers every field, and you can place orders from the Limit and DCA tabs on /swap or from the trade page.
Before you place an order
- Set the floor to a price you would genuinely accept. It is the worst case, not a target.
- For stops, think about gaps. A worst price that is too close to the stop may never fill in a crash. One that is too far may fill badly.
- Check the fee and the minimum size. Small orders pay relatively more.
- Know who fills and what happens if they do not. Read the fallback rules of whatever system you use.
- Remember the escrow. Tokens in an open order are not in your wallet until you cancel or the order ends.