Protocol
Parameters
Every setting of the protocol, its unit, its bounds, what it governs and where to read its live value.
Una's settings live in one account, the program's Config. This page lists each one. The live values are one read away:
import { createUnaClient } from '@una/sdk'
const params = await createUnaClient('https://api.una.markets').protocol()GET /v1/protocolRead the account at the address derived from the seed "config" under the program. Its fields are in the program reference.
The response is a ProtocolParams.
Timing
All four are counted in slots. A slot is 200 ms.
| Setting | In Config | From the API | Governs |
|---|---|---|---|
| Batch window | batch_window_slots | batchWindowSlots | How long a batch collects orders. A batch can be sealed once this many slots have passed since its window started and an order has entered it. The window starts when the batch opens, and again at the first order into a batch that sat empty past it. |
| Clearing timeout | clearing_timeout_slots | clearingTimeoutSlots | How long a sealed batch waits for a clearing. After this many slots with none, anyone can roll it. |
| Proof window | proof_window_slots | proofWindowSlots | How long a solver has to land the proof, counted from the slot of its clearing. After it, the batch can be slashed. |
| Unstake cooldown | unstake_cooldown_slots | unstakeCooldownSlots | The wait between request_unstake and withdraw_stake. |
Each is above 0. The batch window defaults to 10 slots, 2 seconds, and the proof window to 300 slots, about 60 seconds.
Prices and fees
All three are in basis points, hundredths of a percent.
| Setting | In Config | From the API | Bounds | Governs |
|---|---|---|---|---|
| Price band | band_bps | bandBps | 0 to 9,999 | How far a batch may price a token from its last proven price, up or down. It also bounds the value a solver's bond is measured at. See The bond invariant. |
| Clearing fee | clearing_fee_bps | clearingFeeBps | 0 to 9,999 | The fee on every filled order's output. |
| Protocol share | protocol_fee_share_bps | protocolFeeShareBps | 0 to 10,000 | The part of the clearing fee paid to the fee recipient. See Fees and UNA. |
A token's band for the next batch is on each token from una.tokens(), as bandLoQ64 and bandHiQ64.
Bond
| Setting | In Config | From the API | Governs |
|---|---|---|---|
| Bond mints | bond_mints, bond_mint_count | bondMints | The tokens a stake can be in, 4 at most. Each entry holds the mint, its token program, its decimals and its SPL Stake Pool. wSOL has no stake pool and counts one lamport per atom. A liquid staking token counts at its pool's total_lamports / pool_token_supply. |
bondMints from the API carries each mint's current rate as solPerTokenQ64.
Proof
| Setting | In Config | Governs |
|---|---|---|
| Guest verification key hash | sp1_vkey_hash | Which guest program a proof must come from. It is the first public input of every proof. A different build of the guest has a different hash. |
| Groth16 verifying key | groth16_vk, groth16_vk_len | The SP1 Groth16 verifying key proofs are checked against. A proof's first 4 bytes name the key it was made for. |
The guest program and verifying a batch yourself shows how to match the first to the guest's source.
Addresses
| Setting | In Config | From the API | What it is |
|---|---|---|---|
| Admin | admin | The key that may change these settings, list a token and create a pair. | |
| Fee recipient | fee_recipient | feeRecipient | The wallet whose token accounts receive the protocol share. |
Set per pair and per solver
Two rates are outside Config.
| Setting | Where | From the API | Governs |
|---|---|---|---|
| Liquidity fee | fee_bps on each Pair, fixed when the pair is created, 0 to 9,999 | feeBps on each pair | The fee a pair's liquidity keeps on what it pays out. |
| Tick spacing | tick_spacing on each Pair, fixed when the pair is created | tickSpacing on each pair | The ticks a range on that pair may start and end at. |
| Commission | commission_bps on each Solver, set when the solver registers, 0 to 10,000 | commissionBps on each solver | The part of a solver's clearing fees its operator keeps. |
Fixed in the program
How many tokens can be listed, how many a batch can price, how many ticks a pair can hold and how many bond mints there can be are constants of the program. The program reference has the table.
How a setting changes
The admin changes any setting with set_config, which emits a ConfigUpdated event carrying the timing and rate settings as they now stand. A change applies from the next instruction that reads it:
- A new batch window sets the seal slot of the next batch to open, and of the open batch if its window starts again at a first order.
- A new proof window sets the deadline of the next clearing.
- A new band and a new clearing fee enter the state hash of the next clearing, so a solver solving at that moment is refused with
StateHashMismatchand solves again. - A new protocol share applies to the next proof.
- A new cooldown applies to the next unstake request.