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:

TypeScript
import { createUnaClient } from '@una/sdk'

const params = await createUnaClient('https://api.una.markets').protocol()

The response is a ProtocolParams.

Timing

All four are counted in slots. A slot is 200 ms.

SettingIn ConfigFrom the APIGoverns
Batch windowbatch_window_slotsbatchWindowSlotsHow 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 timeoutclearing_timeout_slotsclearingTimeoutSlotsHow long a sealed batch waits for a clearing. After this many slots with none, anyone can roll it.
Proof windowproof_window_slotsproofWindowSlotsHow long a solver has to land the proof, counted from the slot of its clearing. After it, the batch can be slashed.
Unstake cooldownunstake_cooldown_slotsunstakeCooldownSlotsThe 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.

SettingIn ConfigFrom the APIBoundsGoverns
Price bandband_bpsbandBps0 to 9,999How 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 feeclearing_fee_bpsclearingFeeBps0 to 9,999The fee on every filled order's output.
Protocol shareprotocol_fee_share_bpsprotocolFeeShareBps0 to 10,000The 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

SettingIn ConfigFrom the APIGoverns
Bond mintsbond_mints, bond_mint_countbondMintsThe 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

SettingIn ConfigGoverns
Guest verification key hashsp1_vkey_hashWhich 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 keygroth16_vk, groth16_vk_lenThe 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

SettingIn ConfigFrom the APIWhat it is
AdminadminThe key that may change these settings, list a token and create a pair.
Fee recipientfee_recipientfeeRecipientThe wallet whose token accounts receive the protocol share.

Set per pair and per solver

Two rates are outside Config.

SettingWhereFrom the APIGoverns
Liquidity feefee_bps on each Pair, fixed when the pair is created, 0 to 9,999feeBps on each pairThe fee a pair's liquidity keeps on what it pays out.
Tick spacingtick_spacing on each Pair, fixed when the pair is createdtickSpacing on each pairThe ticks a range on that pair may start and end at.
Commissioncommission_bps on each Solver, set when the solver registers, 0 to 10,000commissionBps on each solverThe 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 StateHashMismatch and solves again.
  • A new protocol share applies to the next proof.
  • A new cooldown applies to the next unstake request.