How halts work
The five-state machine that gates every risk-increasing action.
The five states#
Every market sits in exactly one state at a time, held by its own HaltController. The state decides which actions the market will accept.
| State | Supply / Borrow | Liquidate | Repay | Interest |
|---|---|---|---|---|
| OPEN | Yes | Yes | Yes | Accruing |
| HALTING | No | No | Yes | Accruing |
| HALTED | No | No | Yes | Frozen |
| RESUMING | No | No | Yes | Accruing |
| SETTLING | No | No | Yes | Frozen |
Repayment is available in all five. That is deliberate and it is the single most important row in the table: a borrower must never be trapped in a position they are trying to get out of.
Why there are five and not two#
A plain on/off switch would be enough to stop the damage, but not enough to reopen safely. The extra states exist to handle the edges of a halt rather than its middle.
HALTING
A corporate action is known to be coming. New borrowing and new supply stop before the price actually goes bad, rather than after. Nobody gets to open a fresh position into a window that is about to become unpriceable.
RESUMING
A fresh price has arrived, but liquidations do not reopen in the same instant. If they did, every position that drifted underwater during the freeze would be liquidatable at once, at a price borrowers had no opportunity to react to. RESUMING is a grace window: the price is live, repayment and top-ups work, and only then do liquidations come back.
SETTLING
The terminal case, covered in full on Settlement. It exists so that a halt which never resolves cannot trap lender capital indefinitely.
How a halt is detected#
The oracle exposes a pause flag. Anyone can call sync() on a market's halt controller, which reads that flag and moves the state accordingly. It is permissionless on purpose: the protocol should not depend on a privileged keeper noticing in time.
Separately, every price-dependent function checks freshness directly against maxOracleStaleness, currently 24 hours. This matters because the halt controller only updates when somebody calls sync(), so it can still report OPEN while the underlying feed has gone stale. The independent check means a stale feed blocks borrowing even if nobody has synced yet.
How the corporate action itself is spotted#
Automatically, from the issuer's own schedule. Backed, the issuer of xStocks, records every upcoming corporate action on the token contract before it happens: newMultiplierActivationTime() says when the new share multiplier takes effect, and multiplier() switches to it at that second. A keeper service reads that schedule for every stock, cross-checks it against the xStocks API, and drives the matching market through the halt on time. Nobody has to be watching the news.
| When | What the keeper does | Market |
|---|---|---|
| 2 hours before | beginHalting() | HALTING |
| 15 minutes before | Pauses the oracle, then sync() | HALTED |
| The activation | Nothing: the multiplier changes on its own | HALTED |
| 15 minutes after, once the new multiplier is in place | Resumes the oracle at a fresh price, then sync() | RESUMING |
| 30 minutes later, if solvent and the price is fresh | completeResume() | OPEN |
How much warning is there? Measured across every action the issuer has scheduled this way, usually four to nine hours. Once it was only nine minutes, so a keeper that first sees an action inside the final window skips straight to HALTED rather than missing it.
What the keeper will and won't do
- It only reopens halts it started. A halt it can't match to a scheduled action is reported and left alone.
- It never reopens on a guess. It needs the new multiplier in place, a price published after the action, the cooldown, and
isSystemSolvent(). If solvency fails, the market stays in RESUMING. - It never touches SETTLING, and a data source going quiet is never read as "the action was cancelled".
- It isn't the only safety net. A separate watchdog, with its own key, calls
sync()on any market that has drifted from its oracle. And the staleness check below blocks borrowing on a dead feed whether or not anybody acts at all.
Once the oracle is paused, everything is trustless: anyone can call sync(), so nobody can sit on a halt. What still requires trust is the keeper deciding when to pause. On testnet that is unavoidable, because the real schedule lives on X Layer mainnet and a testnet contract can't read it. The roadmap removes it on mainnet: there the halt controller reads the schedule itself, so any caller can halt a market on time, with CF Benchmarks' licensed corporate-action feed as an independent second source.
One layer is automatic regardless. The staleness check blocks borrowing on a feed that has stopped publishing, whether or not anybody noticed or synced. Its limitation is precision rather than reliability: a stale feed cannot be distinguished from a weekend.
HaltGate is the response, not the detector
Worth knowing: not every corporate action needs a halt at all. xStocks handles splits and dividends through a rebasing multiplier, so a two-for-one split doubles token balances while halving the price and passes through cleanly if a protocol reads both consistently. The window a halt actually protects is the narrower one where price and multiplier disagree.
Two layers, on purpose
What freezes, and why interest is one of them#
Interest freezes in HALTED and SETTLING only, not in every non-OPEN state. The test is whether a trustworthy price exists. In those two there is none, so a borrower cannot judge their own position, cannot be liquidated, and would be accruing debt against something they are locked out of managing. The borrow index stops advancing and resumes from exactly where it left off.
HALTING and RESUMING keep accruing. In both, the price is still usable: HALTING is a pre-warning before the feed goes, and by RESUMING a fresh price has already landed. A borrower can repay or top up in either, so the loan is genuinely live and charging for it is fair.
The consequence for lenders is that yield pauses whenever interest does. That is the honest trade: the same event that protects borrowers from a bad liquidation also stops the meter for the people funding them.
What a halt does not do#
- It does not seize anything. No position changes hands because of a halt.
- It does not cancel debt. Balances are exactly where they were when the halt began.
- It does not affect other markets. Each stock has its own controller, so halting NVIDIA leaves Tesla, Apple, Microsoft and the S&P 500 market untouched.
- It does not block repayment, and it does not block repaying a fixed-term loan either.