Immediate execution
Posting an offer locks what it promises in the same instruction, so every open offer is backed by what the register already holds.
An offer on Agora is posted from balances the program can see. post_offer moves the maker's side from free to locked in the same instruction that creates the Offer:
- An ask (side Sell) locks the units offered, so the maker needs that many units free.
- A bid (side Buy) locks units times price in cash, so the maker needs that much cash free.
If the free lane is short, the post fails with InsufficientFreeUnits or InsufficientFreeCash and nothing is created.
These are the two conditions the New York Fed staff report SR 1120 sets for zero settlement risk. The lock at posting is "programs must be immediately implemented". The rule that an ask is posted only from units held free is the second: programs "must involve transactions based on verifiable claims".
While an offer is open
The lock stays in the maker's position, in the locked lane, and keeps its owner's claim to income. Each fill takes part of it:
- A fill of an ask moves units out of the maker's locked lane to the taker.
- A fill of a bid moves cash out of the maker's locked lane to the taker.
The offer's units_open falls by each fill. At zero the offer closes and its rent returns to the maker.
Cancelling
cancel_offer returns whatever is still locked to the maker's free lane and closes the offer: the open units for an ask, the open units times the price for a bid. Only the maker can cancel.
Offer ids
Each member keeps a counter, next_offer_id. A new offer's address is derived from the maker's wallet and that counter, and posting raises it by one. A post built on a stale counter fails: with InvalidId, or, while an offer still sits at that address, with the System program's "already in use". Build it again; the API reads the counter when it builds.
Repo offers follow the same rule with their own counter: Repo.