Protocol

Fees and UNA

The two fees Una charges, where each one goes, and what the protocol share does with UNA.

Una charges two fees. An order pays the clearing fee on what it receives. Liquidity keeps the pair's liquidity fee on what it pays out. This page follows each fee from the batch that charges it to the account it ends in, and describes UNA, the token the protocol's share buys and burns.

The two fees

FeeCharged onRatePaid inGoes to
Clearing feeThe output of every filled orderclearing_fee_bps, one rate for the whole exchangeThe token the order buysThe solver that proved the batch and its stakers, less the protocol share
Liquidity feeWhat a pair's liquidity pays out in a batchfee_bps, set per pairThe token the pair pays outThe positions in range on that pair

Placing or cancelling an order, adding or removing liquidity, staking, unstaking and claiming are charged neither fee. They cost the Solana transaction fee, and the rent of an account the first time one is created.

The live rates are read from the API: una.protocol() returns clearingFeeBps and protocolFeeShareBps, and each pair in una.pairs() carries its feeBps. Parameters lists every setting.

The clearing fee

A filled order's output is computed at the cleared price, and the fee is taken from it, rounded down:

Text
gross = floor(filled * price(sell) / price(buy))
fee   = floor(gross * clearing_fee_bps / 10000)
net   = gross - fee

The owner receives net. The fee stays in the buy token's vault, and the batch records the total per token. Fees has the trader's side with a worked order.

Nothing is paid out of that total until the batch is proven. When prove_batch verifies the proof, the program splits each token's total in three, in this order:

Text
protocol   = floor(total * protocol_fee_share_bps / 10000)
solver     = total - protocol
commission = floor(solver * commission_bps / 10000)
stakers    = solver - commission
PartWhere it goesWhen
protocolTransferred to the fee recipient's token account for that token.In the prove_batch transaction.
commissionCredited to the solver's operator, who claims it with claim_rewards.Credited in the same transaction.
stakersCredited to every stake behind the solver, in proportion to its reward weight. Each staker claims with claim_rewards.Credited in the same transaction.

Each rounding goes to the next line down: the protocol share is rounded down so the solver keeps the remainder, and the commission is rounded down so the stakers do. A solver with no stake behind it yet is credited the whole of solver as commission.

Fees are held and paid in the tokens they were charged in. A solver that proves a batch pricing three tokens credits rewards in up to three tokens. Rewards and Commission and payouts follow the two claims.

A worked split

With sample rates of 5 basis points for the clearing fee, a protocol share of 2,000 basis points and a commission of 500, a batch whose orders buy 400,000,000,000 atoms of a token in total:

LineArithmeticAtoms
Clearing fee400,000,000,000 × 5 / 10000200,000,000
Protocol share200,000,000 × 2000 / 1000040,000,000
Solver's share200,000,000 − 40,000,000160,000,000
Commission160,000,000 × 500 / 100008,000,000
Stakers160,000,000 − 8,000,000152,000,000

The three rates are sample inputs for the arithmetic.

The liquidity fee

When a batch moves a pair to its cleared price, the pair's liquidity pays out one token and takes in the other. On each stretch of the move, the fee is taken from what is paid out:

Text
fee = floor(out * fee_bps / 10000)

The fee never leaves the vault. It is credited to the positions whose range covers that stretch, in proportion to their liquidity, together with the surplus the pair earns by trading at the cleared price. The owner collects both with collect_fees. Ranges and fees and What a position earns have the provider's side.

The whole liquidity fee goes to positions. The protocol share is taken from the clearing fee only.

UNA

UNA is the token of the exchange. Its supply is 1,000,000,000. All of the supply is sold in one public launch. The developer’s allocation is a first buy in that launch.

The mechanism has three steps, and each one is public.

  1. The share arrives

    Every prove_batch transfers the protocol share of that batch's clearing fees to the fee recipient's token accounts, in the tokens the fees were charged in. The fee recipient is one wallet, named in the program's configuration and returned by una.protocol() as feeRecipient. Each transfer is an inner instruction of a proof transaction, linked from the batch's page.

  2. It buys UNA

    Once a minute, the keeper looks at the fee recipient's balance of every listed token. For each token with a balance, it swaps the whole balance for UNA on the market through Jupiter, in one transaction signed by the fee recipient.

  3. What it bought is burned

    The keeper measures the wallet's UNA before and after the swap and burns exactly the difference, in a second transaction. UNA the wallet held before the swap is never part of the burn.

So the amount of UNA burned follows the clearing fees: every proven batch with a filled order adds to the fee recipient's balances, and the next pass turns those balances into UNA and destroys it. The rate of the share is protocolFeeShareBps.

The clearing fee is charged on filled orders. Volume that trades in Una's batches is what feeds the burn.

Reading it on chain

To checkRead
The rate of the protocol shareprotocol_fee_share_bps in the Config account, or protocolFeeShareBps from GET /v1/protocol
The fee recipientfee_recipient in Config, or feeRecipient from the API
The share paid by one batchThe token transfers inside its prove_batch transaction, from each token's vault to the fee recipient
The clearing fees of one batchfeeAmount per token on the batch
The swaps and the burnsThe fee recipient's transactions: a Jupiter swap into UNA, then a burn of the same amount
UNA's mintunaMint from GET /v1/protocol