ZooBC wiki
Tokens and markets

Swap offers

You are looking at an old version of this page: revision #78 by zoobc.how, 2026-10-26 20:39 UTC. See the current version

A swap offer is the simplest way to trade on ZooBC. A maker locks an amount of one asset and names the amount of another asset it wants in return; a single taker pays exactly that, and both sides move at once. Swap offers work with any pair of assets (ZBC, genesis coins or user tokens) whatever their decimals, so they also serve tokens that cannot go on an order-book market.

The three transactions

Three steps: the maker locks its give side with a want tag, a taker pays the want side and both move at once; the maker may cancel and take the give side back, and expiry only blocks acceptance
Three steps: the maker locks its give side with a want tag, a taker pays the want side and both move at once; the maker may cancel and take the give side back, and expiry only blocks acceptance
  • CreateSwapOffer (type 18) names the give side (an asset and an amount), the want side (an asset and an amount), an optional expiry time in Unix seconds, and an optional designated counterparty, the only address that may accept. The give side leaves the maker's balance at once and is held in the offer, so a taker knows it is really there.
  • AcceptSwapOffer (type 19) lets one taker pay the whole want side. In the same step the maker receives the want side and the taker receives the give side. A maker cannot accept its own offer.
  • CancelSwapOffer (type 20) returns the give side to the maker, at any time while the offer is open.

All or nothing

There are no partial fills: one taker takes the whole offer, or nothing happens. Nothing is lent either: both legs move at once and for good, so nobody owes anything afterwards. Filling bit by bit against many counterparties is what market orders do.

If two takers try to accept the same offer, the first one applied wins. The second has become pointless and is a paid no-op: it pays its fee and changes nothing (see one transaction per account per block, and batches).

Expiry and cancelling

An expiry only stops acceptance. The chain never sweeps offers away, so an expired offer stays locked until its maker cancels it and recovers the give side. Swap offers pay no rent.

Swap offers and market orders

Swap offerMarket order
Assetsany two, any decimalstokens with 8 decimals
Counterpartiesone taker, all or nothingfills against many orders
Pricefixed by the maker's two amountseach fill at the resting order's price
Rentnonethe market pays rent

With other features

  • The assets a maker or a taker receives are incoming credits, so they pass through the receiver's split policy (see split and transact policies).
  • An account whose transact policy refuses the Exchange category can neither make nor accept offers.
  • If a token in an open offer expires, the units locked in the offer still count for the maker when the token's ZBC backing is shared out (see token upkeep (persistence)).

See also