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
| Fee | Charged on | Rate | Paid in | Goes to |
|---|---|---|---|---|
| Clearing fee | The output of every filled order | clearing_fee_bps, one rate for the whole exchange | The token the order buys | The solver that proved the batch and its stakers, less the protocol share |
| Liquidity fee | What a pair's liquidity pays out in a batch | fee_bps, set per pair | The token the pair pays out | The 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:
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:
protocol = floor(total * protocol_fee_share_bps / 10000) solver = total - protocol commission = floor(solver * commission_bps / 10000) stakers = solver - commission
| Part | Where it goes | When |
|---|---|---|
protocol | Transferred to the fee recipient's token account for that token. | In the prove_batch transaction. |
commission | Credited to the solver's operator, who claims it with claim_rewards. | Credited in the same transaction. |
stakers | Credited 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:
| Line | Arithmetic | Atoms |
|---|---|---|
| Clearing fee | 400,000,000,000 × 5 / 10000 | 200,000,000 |
| Protocol share | 200,000,000 × 2000 / 10000 | 40,000,000 |
| Solver's share | 200,000,000 − 40,000,000 | 160,000,000 |
| Commission | 160,000,000 × 500 / 10000 | 8,000,000 |
| Stakers | 160,000,000 − 8,000,000 | 152,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:
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.
The share arrives
Every
prove_batchtransfers 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 byuna.protocol()asfeeRecipient. Each transfer is an inner instruction of a proof transaction, linked from the batch's page.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.
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 check | Read |
|---|---|
| The rate of the protocol share | protocol_fee_share_bps in the Config account, or protocolFeeShareBps from GET /v1/protocol |
| The fee recipient | fee_recipient in Config, or feeRecipient from the API |
| The share paid by one batch | The token transfers inside its prove_batch transaction, from each token's vault to the fee recipient |
| The clearing fees of one batch | feeAmount per token on the batch |
| The swaps and the burns | The fee recipient's transactions: a Jupiter swap into UNA, then a burn of the same amount |
| UNA's mint | unaMint from GET /v1/protocol |