Hartii developer docs

HartiiSwap

Farms

HartiiFarm is a port of Synthetix StakingRewards — the contract behind Uniswap's liquidity mining. One farm = one staking token (a HartiiSwap LP token) + one reward token (for QUAI rewards, WQUAI). Farms are deployed per pool when a reward is funded; the live list is shown on hartiilabs.com → Farms and in the site's configuration. No farm is funded yet (2026-09-23).

How rewards accrue

When the owner funds a period with notifyRewardAmount(reward, duration), the farm pays rewardRate = reward / duration tokens per second, split among stakers pro-rata to their stake at each moment:

text
rewardPerToken += (elapsed seconds × rewardRate × 1e18) / totalStaked
earned(user)    = stake(user) × (rewardPerToken − userPaid(user)) / 1e18 + stored(user)

Funding again before the period ends rolls the unpaid remainder into the new period. While nobody is staked, nothing is distributed and rewardPerToken does not move.

Staker functions

FunctionDescription
stake(uint256 amount)Pull amount LP (approve the farm first). Credits what actually arrived.
withdraw(uint256 amount)Return LP. Always available — no lock-up, no pause.
getReward()Pay accrued rewards.
exit()withdraw(all) + getReward().
earned(address), balanceOf(address), totalSupply()Views.
rewardRate(), periodFinish(), rewardsDuration(), getRewardForDuration()Period info.

Owner powers (the treasury) — and their limits

Owner canOwner cannot
Fund / extend a reward period (notifyRewardAmount pulls the tokens in)Touch staked LP
Recover unrelated tokens sent by mistake (recoverERC20)Recover the staking token or the reward token
Hand ownership over in two stepsPause, lock or blacklist stakers

An independent review proved the funding check keeps the farm solvent across repeated funding rounds: the balance always covers every staker's accrued reward.

APR

The site shows an APR only when both the reward token and the LP token can be priced in QUAI from on-chain reserves; otherwise it shows "—". Rewards are not a promise of any value.

Verified

Orchard rehearsal 2026-09-23: staked LP, funded 10 WQUAI over 1 hour, accrued, exit() returned the LP plus the accrued WQUAI. Gas: stake 109,797, exit 126,807.

Quai Network mainnet · chain 9 · Cyprus-1. Figures marked "read on" a date were read from the chain that day; re-read before relying on them.