FarmHook on Ethereum

Uniswap v4 Hook Contract 0xd0414f6c84f0361aede126ad25872b1cd73ceacc on Ethereum · Rewards · Verified contract

Volume (24h)
$0
Value locked (TVL)
$21
All-time volume
$521.57K
Pools using this hook
6
Swaps (24h)
0 (0 traders)
Total swaps
7,078

What it does

A Uniswap v4 yield-farm hook that routes full-range liquidity through itself, emits a REWARD token to LPs over time, takes a 1% base-token swap fee to a fee recipient, and redistributes a 10% claim tax back to LPs.

How it works step by step

  • Restricts farm liquidity to full-range positions added and removed only through the hook's addLiquidity and removeLiquidity functions
  • Distributes REWARD emissions to LPs via a reward-per-liquidity accumulator, split across pools by allocPoint, with a 6.6M/day bootstrap for 14 days then 660k/day
  • Takes a 1% swap fee in the base token on swaps and sends it to feeRecipient
  • Charges a 10% tax on REWARD claims and redistributes it to current eligible LPs through the accumulator
  • Excludes a genesis seed position from rewards so only real farmers earn emissions
  • Restricts pool initialization to the hook itself to prevent launch-price front-running
Swap behaviour
Takes a 1% fee in the base (non-REWARD) token on swaps, paid to feeRecipient, charged in beforeSwap for exact-input buys and in afterSwap when base is the unspecified currency. Exact-output sells of base are uncharged.
Liquidity behaviour
Liquidity is only accepted through the hook's addLiquidity, which places full-range positions owned by the hook. External liquidity additions and removals are rejected in beforeAddLiquidity and beforeRemoveLiquidity. Deposits earn REWARD pro rata to liquidity; removeLiquidity does not auto-claim rewards. A genesis seed position is excluded from rewards.
Fee behaviour
Charges a fixed 1% inline swap fee (SWAP_FEE_BPS = 100) in the base (non-REWARD) token on swaps, sent to feeRecipient via take(). Charged in beforeSwap for exact-input buys with base as input, otherwise in afterSwap. Exact-output sells of the base token are not charged. A 10% tax (TAX_BPS = 1000) applies to REWARD claims and is redistributed to eligible LPs through the reward accumulator. Pools must have LP fee 0.
Owner & admin controls
Owner (set to deployer) can: initializePool, seedAndEnable and seedAndEnableToken (mint seed REWARD), enablePool, setAllocPoint (reweights emissions across pools), withdrawSeed (removes genesis seed liquidity), setFeeRecipient (redirects the 1% swap fee), setRewardToken (one-time), and transferOwnership. Owner cannot mint REWARD directly; RewardToken minter is immutably the hook. No pause or upgrade mechanism found.

Enabled Uniswap v4 callbacks

beforeInitialize, beforeAddLiquidity, beforeRemoveLiquidity, beforeSwap, afterSwap, beforeSwapReturnDelta, afterSwapReturnDelta

beforeInitialize: restricts pool initialization to calls from the hook itself, preventing third-party launch-price front-running. beforeAddLiquidity and beforeRemoveLiquidity: block non-hook liquidity changes and enforce full-range farm liquidity. beforeSwap: takes the 1% base-token fee on exact-input buys. afterSwap: takes the 1% base-token fee when base is the unspecified currency. beforeSwapReturnDelta and afterSwapReturnDelta: allow the hook to take fee amounts that alter the swap delta.

Security & trust assessment

Risk level: medium (verified source, high confidence).

Who controls it: The owner can reweight or remove emissions for any pool via setAllocPoint, withdraw the genesis seed liquidity, redirect all swap fees via setFeeRecipient, and seed or enable pools with arbitrary parameters. Owner cannot directly mint, pause, or block user withdrawals, and the reward token's minter is fixed to the hook.

Risk to user funds: The hook does not custody user LP positions directly, since liquidity is held as hook-owned positions in the PoolManager and tracked per user. The owner's seed withdrawal and fee-recipient powers could affect pool depth and where fees are routed, but a standard user cannot have their deposited funds blocked. Users' accrued REWARD is minted on claim and is not withheld by the owner. The 10% claim tax is redistributed to LPs, not taken by the owner.

Security findings

  • [medium] Owner can withdraw seed liquidity: Owner can call withdrawSeed to remove the genesis seed liquidity from any pool at any time, which can drain depth and shift price-sensitive liquidity away from users.
  • [low] Owner controls swap fee destination: setFeeRecipient lets the owner redirect the 1% swap fee on every pool to any address, and the owner can set any recipient at any time.
  • [low] Owner can reweight or stop emissions per pool: setAllocPoint allows the owner to change emission weights for enabled pools at any time, including setting a pool's weight to zero and stopping its rewards.
  • [info] Hook holds swap-level token movement rights: The hook takes swap fees via return deltas (beforeSwapReturnDelta and afterSwapReturnDelta) and moves base tokens to feeRecipient, so swaps on these pools always pay the fee on the base side.
  • [low] Single-step ownership transfer: Ownership is transferable with a single transferOwnership call with no two-step acceptance, so a mistaken transfer to a wrong address is irreversible.

Contract details

Verified source
Yes (FarmHook)
Compiler
solc 0.8.30+commit.73712a01
Bytecode size
16,901 bytes
Upgradeable proxy
No
Detected patterns
dynamic-fee, moves-currency, ownable, return-delta, rewards, self-unlock, tax

Pools using FarmHook