x × y = k.
Constant-Product Formula
k (net of fees). The price of one asset in terms of the other is the ratio of reserves.
Quote Calculation
Given an input amount, the output is computed as follows:- fee_bps: pool fee in basis points. Default is 30 (0.3%).
- Fees remain in the pool reserves. They accrue to liquidity providers proportionally.
Price Impact
Price impact increases with trade size relative to pool depth. A swap that consumes a large fraction ofreserve_out will receive a significantly worse rate than the spot price.
Slippage Protection
Every swap accepts a minimum output parameter. The transaction is not constructed if the computed output falls below this minimum. This protects the user from front-running and stale quotes.LP Mechanics
Liquidity providers deposit both assets into a pool and receive LP shares representing their proportional ownership.First Deposit
Subsequent Deposits
Withdrawal (Burn)
LP-Rune
An on-chain Rune token represents LP shares for pools that have undergone LP-Rune etching. LP-Rune balances are tracked separately from the general balance ledger. LP-Rune tokens can be staked into mining pools to earn BITRUNE rewards.Protocol Fee (kLast Accrual)
The protocol fee is accrued on every LP mint or burn event. It captures a fraction of the fee growth that occurred between LP events.Calculation
root_k > root_k_last (the pool grew from swap fees):
Parameters
| Parameter | Default | Meaning |
|---|---|---|
phi | 6 | Fee split denominator |
| Protocol share | 1/6 | ~16.67% of fee growth goes to treasury |
| LP share | 5/6 | ~83.33% of fee growth stays with LPs |
k_last snapshot is updated after every mint or burn. Swap-only activity accumulates growth silently until the next LP event triggers accrual.