Appearance
Yield farming
KnyxFarm distributes KNP to users who stake their LP tokens.
| Farm | 0xC2682e516E64D0e6Df83D5d97FC70725E2414999 |
| Reward token | KNP — 0x95f79e7d12BBC353991f856C5330D0424E2BA7FD |
Not yet funded
KNP total supply is currently 0 and the farm holds none, so pools exist but cannot pay rewards. Staking works; the reward accrual will read zero until KNP is minted and the farm funded.
This affects farming only. Swaps, liquidity provision and LP tokens are unaffected.
Pools
| pid | Pool | Allocation |
|---|---|---|
| 0 | KNP staking | — |
| 1 | KNP / WKNYX | 4000 |
| 2 | KNP / KUSD | 3000 |
| 3 | KUSD / WKNYX | 2000 |
totalAllocPoint is 12,000. A pool's share of emissions is its allocation divided by that total, so pid 1 receives one third.
How it works
The farm is a MasterChef-style contract. It tracks reward-per-share, accumulating as blocks pass, and each staker's debt at the point they staked. Your pending reward is your share of accumulated rewards minus that debt, so staking later does not entitle you to earlier emissions.
Staking LP tokens
js
const farm = new ethers.Contract(FARM, [
'function deposit(uint256 pid, uint256 amount)',
'function withdraw(uint256 pid, uint256 amount)',
'function pendingKNP(uint256 pid, address user) view returns (uint256)',
'function userInfo(uint256 pid, address user) view returns (uint256 amount, uint256 rewardDebt)',
'function emergencyWithdraw(uint256 pid)',
], signer);
// approve the LP token for the farm first
await farm.deposit(1, lpAmount);Depositing zero harvests pending rewards without changing your stake — the usual MasterChef idiom for claiming.
js
await farm.deposit(1, 0); // harvest onlyWithdrawing
js
await farm.withdraw(1, lpAmount);emergencyWithdraw returns your LP tokens and forfeits pending rewards. Use it only if the reward logic is stuck.
Known limitation for integrators
massUpdatePools reverts if a pool's pair does not exist
A farm pool whose LP address holds no contract makes updatePool revert on lpToken.balanceOf. That means massUpdatePools() and its callers — add(..., true), set(..., true), updateEmissionRate — revert until every configured pool's pair exists on chain.
The KNP/WKNYX and KNP/KUSD pairs are not yet seeded, so this currently applies.
Reading farm state
js
const farm = new ethers.Contract(FARM, [
'function poolLength() view returns (uint256)',
'function totalAllocPoint() view returns (uint256)',
'function poolInfo(uint256) view returns (address lpToken, uint256 allocPoint, uint256 lastRewardBlock, uint256 accKNPPerShare)',
], provider);