Concepts › Swap mechanics
There are two execution venues. The Swap page, the quote API and the SDK query both and pick the one that gives the user more.
ClpPools — 201 THORChain-style pools
Each pool pairs one asset (USDw, a crypto price-tracker token or a stock price-tracker token) with BTCw. It uses THORChain's CLP (continuous liquidity pool) formula:
y = x · X · Y / (x + X)²
x : amount in X : input-side depth
y : amount out Y : output-side depth
The difference from the mid price x · Y / X is the slip fee: the larger the trade relative to pool depth, the higher the fee. The minimum fee
minFeeBps is 5 bps (0.05%) — every trade pays at least this, however small. Fees stay in the pool.
- Token → token takes two hops through BTCw (
swapAssetForAsset) in a single transaction and pays fees in both pools. - Recipient is optional (the
toparameter) — you can pay out directly to another wallet. - Every swap function takes
minOut; if the price moves too far it reverts withSlippageExceeded.
OracleAMM — BTCw ⇄ USDw at the oracle price
No curve: trades fill at the BTC/USD oracle price ± spreadBps.
sell BTCw : USDw out = x · p · (1 − spread)
buy BTCw : BTCw out = u / p · (1 − spread)
| Parameter | Current | Meaning |
|---|---|---|
spreadBps | 30 (0.3%) | fixed spread in each direction |
maxTradeBtcw | 10 BTCw | maximum per trade (in BTCw terms) |
maxAgeSec | 300 seconds | rejects trades when the oracle price is older (StalePrice) |
OracleAMM only pays the sender. To pay another wallet, use the ClpPools route. OracleAMM liquidity is deposited and withdrawn by the Owner.
ETHw oracle-priced vault
Address 0xFd6d78A3b60175D37146793396A2FA7864039D54 (OracleTokenAMM). Works like OracleAMM but for ETHw ⇄ USDw,
priced at the PriceHub price of ETHw ± spreadBps:
| Parameter | Current | Meaning |
|---|---|---|
spreadBps | 30 (0.3%) | fixed spread in each direction |
maxTradeToken | 300 ETHw | maximum per trade |
maxAgeSec | 300 seconds | rejects trades when the price is older (StalePrice) |
The vault was seeded by the Owner with 12,280 ETHw + 33,100,000 USDw. buyToken / sellToken take a to parameter — you can pay out directly to another wallet.
The Bridge page uses this vault when the user chooses to receive or send ETHw.
Route selection
For the BTCw ⇄ USDw pair, the quote queries both the CLP pool and OracleAMM and picks the larger output (route=best). You can force one venue with
route=clp or route=amm. All other pairs use ClpPools only.
How pool prices are pulled back to the oracle
Price-tracker tokens have no external market, so pool prices would drift away from the oracle if nothing pulled them back. Two mechanisms do that:
- OracleRebalancer (200 token pools — 100 crypto and 100 US stocks, same mechanism): when a pool deviates from the oracle by more than 30 bps, the contract trades to close 90% of the gap, at most 5 BTCw per trade. Pool above oracle → it sells tokens it holds, minting more if short; pool below oracle → it buys with the contract's BTCw. Safeguards: no action when the oracle price is older than 300 seconds; a mint-value cap of 300 BTCw per day (shared across all 200 tokens); a cumulative mint cap per token; pausable. The keeper reads the pool list straight from ClpPools every round and calls the Rebalancer in batches of 25 tokens — new pools are picked up automatically.
- Treasury bot (USDw pool): trades to pull the USDw pool back to the oracle price.
Stock pools outside market hours
Outside US regular trading hours and on weekends, the oracle holds the closing price, and the Rebalancer keeps pools near that price. Stock pools remain tradable 24/7;
when BTC moves, the BTCw-denominated price of stock pools drifts too and is pulled back just like crypto pools. At market open, if the opening price is far from the close,
the keeper moves the pool gradually (at most 5 BTCw per trade). A price update that moves more than 10% is blocked by the oracle — that symbol stays frozen until the Owner confirms the new price (ownerSubmit).
What this means for integrators: pool prices usually sit within a few dozen bps of the oracle price. The volume of these two wallets is reported separately on the Dashboard and in /api/v2/stats (of_which_treasury).
Providing liquidity
Pool liquidity is currently provided by the Owner. These docs do not cover third-party liquidity provision.