nearswaps

Learn · NEAR trading

How auto orders fire on NEAR: the keeper and sealed triggers

When you place an auto order, your tokens go into the orders contract with a hash of your trigger, not the level itself. A keeper server checks open orders about every second, and when your level is met it reveals the trigger to the contract. The contract checks the hash, quotes the pool itself, swaps and pays you.

Last checked

From placing to filling

  1. Seal. The panel picks a random salt and stores a hash of your owner, level, direction and salt in the contract nekoorders.near. The real level goes to the keeper's store, checked against the hash, and stays in your browser so your list shows it.
  2. Watch. The keeper reads the open orders and quotes each order's pool with the same maths as the contract, about every second while its server runs. If the server stops, a backup keeper takes over every minute.
  3. Reveal. When a level is met, the keeper sends execute with the revealed trigger. The contract checks it against the stored hash first.
  4. Re-quote. The contract quotes the order's reference pool itself. The keeper can't set the price.
  5. Swap. The keeper may propose a better route from the swap router, used only when it beats the reference by 0.1% or more. The contract checks every leg and splits your minimum across them, so a worse route fails.
  6. Pay. On Rhea and DCL pools the swap pays you directly; the site fee goes to the fee wallet and 0.01 NEAR to whoever executed.

Sealed or Open

Sealed (default)Open
On chaintoken, amount, side; a hash of the leveltoken, amount, side and the level
Who can fire itthe keeper, which holds the levelanyone, at your price or better
Depends on the keeperyesno
If the keeper loses the levelthe order can only expire or be cancellednot applicable

What the keeper can't do

  • Move your tokens anywhere except the exchange and back to you.
  • Fill below the contract's own quote less your maximum slippage.
  • Reuse a revealed trigger on someone else's order: secrets are bound to the owner and the pair.

The keeper's operator does know the levels of sealed orders; that is what sealing trades for keeping them off a public chain.

When an order does not fill

  • The chart touched your level but the pool did not: charts show trades across venues, the trigger reads the order's own pool.
  • Another fill or 1-click trade was moving the same token: it waits a moment and tries again.
  • The pool can't fill within your slippage: the order reseals and stays open.
  • The order expired (30 days at most) or the token's tax is above 10%.

An order that holds a token lock for over 24 hours unaccounted is closed as stuck, and a payout that bounces becomes a claim you can collect from the Auto orders card.

Questions people ask

What happens if the keeper is down?

A backup keeper checks every minute instead of every second. Open-trigger orders can also be filled by anyone. You can always cancel, and every order expires.

Can the keeper front-run my order?

It can't change the price the contract quotes or send your tokens elsewhere, and a worse route fails. Its operator does know sealed levels, which is the trade-off for keeping them off chain.

Why didn't my order fill when the chart touched my level?

The trigger reads the order's own pool, not the chart, which mixes trades from several venues. It also waits if the same token is mid-fill, or if the pool can't fill within your slippage.

Who pays gas for the fill?

The executor. Each order's 0.02 NEAR deposit includes a 0.01 NEAR bounty for whoever executes it; the other 0.01 comes back to you.

How often are NEAR auto orders checked?

About every second while the keeper server runs; every minute when only the backup keeper is running. The panel shows which.