Skip to Content
Liquid Quantdocs

The fee harvester

The contract that receives the token's creator fees and turns half of them into gas and holder yield, on-chain.

On Volta, every swap of a token pays a swap fee chosen at launch, between 1% and 5%. Volta keeps a protocol share (30% of the fee) and splits the rest between creator, buyback and holders as the launch configured it. The creator share is credited, in HYPE, in Volta's fee escrow to whoever holds the launch's creator NFT (one ERC-721 per launch); Volta distributes the fees during swaps once enough has accrued. For LQNT that NFT is held by a contract: FeeHarvester.

LQNT's own fee and split are set at its launch and readable on-chain: swapFeeBps(isBuy) on the router or the harvester returns the current fee in basis points.

harvest()

harvest() is permissionless. Each call:

  1. Collects the HYPE Volta's escrow holds for the harvester. If the escrow call fails, the harvest goes on with what is already there and emits CollectFailed.
  2. Splits what it collected: TEAM_SHARE_BPS = 5000, so half is owed to the team's recipient.
  3. Tops up the gas deposit. If the vault's EntryPoint deposit is below targetDeposit (0.1 HYPE by default in the deploy script), HYPE goes there first.
  4. Buys the token with what is left, and donates it to the vault.
  5. Refunds the caller's gas, within strict limits.
  6. Pays the team its accrued half.

Buys that are not worth attacking

A contract that buys on a public market is a target for sandwiching. The harvester sizes its buys so that the attack loses money:

LimitValueMeaning
MAX_IMPACT_BPS50A single buy moves the price by at most 0.5%
BUY_INTERVAL12 sAt most one buy every 12 seconds (lastBuyAt)
MAX_PREMIUM_BPS1500Never pays more than 15% above the vault's price average, after fees
MAX_HALVINGS8A buy the market does not take is halved and retried, up to 8 times

Pushing the price up before a buy and selling after costs Volta's swap fee on both legs, at least 2% in all, to capture at most the 0.5% the buy moves the price. Elysium makes about ten blocks a second, so buys are spaced by time rather than by block. The buy size comes from the pool's active liquidity, read on-chain. What does not fit waits in the contract for the next harvest.

The price average the limit refers to is the vault's own, which steps at most once every 12 seconds by a bounded amount (see the vault).

The caller's refund

Anyone can run the system. A caller is refunded the gas of a call that put HYPE to work, at no more than twice the base fee and never more than 0.5% of that work (CALLER_TIP_BPS). A call that does nothing earns nothing, so there is no reason to spam it.

Roles

RoleCanCannot
OwnerChange the team's recipient; propose or cancel a successor; hand on or renounce ownershipTouch the holders' half; change any limit; move the vault's deposit
UpgraderUpgrade the harvester (see the security model)
Anyoneharvest(), payTeam(), executeSuccessor() after the delay

A successor is a new holder of the token's creator NFT. Proposing one is public and takes effect only after SUCCESSOR_DELAY (24 hours), when anyone can execute it and the NFT moves to the successor. Fees already credited to the harvester stay withdrawable by harvest.

The creator NFT

The launch on Volta names a creator, who receives the creator NFT. If it names the harvester's planned address, the NFT is there from the start. If it names a wallet, that wallet sends the NFT to the harvester once it is deployed (handOver in the deploy script). The harvester accepts this launch's creator NFT and nothing else; until it holds it, a harvest finds nothing to collect.

The keeper

A keeper watches the chain and calls harvest() when fees have built up or the gas deposit runs low, and poke() to keep the price average close to the market. It uses only permissionless functions: if it stops, anyone else can do the same job, and the refund pays for it.

On this page