StocktopusV4FeeHook on Ink
Uniswap v4 Hook Contract 0x9c691e91b23317471b0e01fecd9df55ef8a340cc on Ink · Fee sharing · Verified contract
- Volume (24h)
- $0
- Value locked (TVL)
- $380
- All-time volume
- $108.72K
- Pools using this hook
- 8
- Swaps (24h)
- 0 (0 traders)
- Total swaps
- 718
What it does
A Uniswap v4 fee hook for pools that charges a 1.50% fee on the input token of every swap, splitting it between a creator claim balance (1.00%) and the protocol treasury (0.50%), with creators able to withdraw accrued fees directly or via a signed X-account claim.
How it works step by step
- Charges a total of 1.50% (150 bps) on the input currency of each swap, for both exact-input and exact-output swaps, with pools configured at a zero LP fee.
- Splits each charge into 1.00% accrued to the pool's creator and 0.50% minted to the protocol treasury address read from the factory.
- Mints ERC-6909 claims inside the Uniswap v4 PoolManager for the creator and treasury amounts rather than transferring tokens to them directly.
- Tracks creator balances per pool in claimableCreatorQuote and claimableCreatorToken, which creators can redeem via claimCreatorFees (only the registered creator address) or claimCreatorFeesWithX (a withdrawal authorised by an EIP-712 signature from xClaimSigner).
- After each swap, calls checkGraduation() on the pool's token contract, an external hook into a separate graduation mechanism.
- Swap behaviour
- beforeSwap computes the 1.50% fee on exact-input swaps from the specified input amount and returns it as a before-swap delta, charging the input currency and minting creator and treasury claims. afterSwap handles exact-output swaps by grossing up the pool's input and charging the same 1.50% split, then calls checkGraduation() on the token and returns the fee as an after-swap delta. Swaps revert if the pool is not registered with the hook.
- Liquidity behaviour
- No liquidity callbacks.
- Fee behaviour
- Fees are fixed constants: 150 bps total, of which 100 bps goes to the creator and 50 bps to the protocol treasury, taken from the input currency. Pools themselves are required to have a zero LP fee at registration. The fee rates cannot be changed by any admin.
- Owner & admin controls
- The owner (Ownable2Step) can set the factory address once via setFactory and can transfer or renounce ownership. The owner cannot change fee rates, pause swaps or move funds. xClaimSigner is an immutable address whose signatures authorise X-account creator withdrawals. The treasury address is read from the factory contract, which the owner controls only through its one-time setFactory call.
Enabled Uniswap v4 callbacks
beforeSwap, afterSwap, beforeSwapReturnDelta, afterSwapReturnDelta
beforeSwap charges the fee from the input amount and registers it as a return delta on the swap. afterSwap charges fees on exact-output swaps and calls the token's checkGraduation hook. beforeSwapReturnDelta and afterSwapReturnDelta allow the hook to take a share of swap amounts, which is how the fee is collected.
Security & trust assessment
Risk level: medium (verified source, high confidence).
Who controls it: The owner can set the factory once and transfer ownership, but cannot alter fees or pause trading. The main privileged risk is the immutable xClaimSigner, which can authorise withdrawals of any pool's accrued creator balances, and the factory-controlled treasury address that receives protocol fees.
Risk to user funds: The hook does not custody pool liquidity directly but takes a 1.50% share of every swap's input and holds it as ERC-6909 claims inside the PoolManager. It can move these claims to the creator, the signed X recipient, or the treasury, and its afterSwap call to the token's checkGraduation can block swaps on the pool.
Security findings
- [medium] Treasury address controlled by external factory: Protocol fee mints go to IStocktopusV4FactoryView(factory).treasury() on every swap. The factory address is set once by the owner, and its treasury() return value is not validated, so the treasury destination depends entirely on the factory's implementation, which was not part of the provided source.
- [medium] Off-chain signer can withdraw creator balances: claimCreatorFeesWithX releases quote and token balances to any recipient when presented with a valid signature from the immutable xClaimSigner. Compromise or misuse of that key would let an attacker drain accrued creator fees across all pools, and the key cannot be rotated because it is immutable.
- [low] External call in afterSwap can revert swaps: afterSwap calls checkGraduation() on the pool's token contract for every swap. If that external call reverts or was written to be malicious, swaps on the pool will fail, so the token contract can effectively block trading.
- [info] Claim-as-mint accounting in PoolManager: Creator and treasury fees are held as ERC-6909 claims on the PoolManager and redeemed via unlockCallback, which burns the claims and takes the underlying tokens to the recipient. Solvency depends on the PoolManager's accounting and on the claim balances tracked by this contract staying in sync with minted amounts.
- [info] Creator fee claims via the creator address: claimCreatorFees lets the creator address withdraw accrued balances to any recipient, and the creator is set at pool registration by the factory. Creator key compromise would expose that pool's accrued fees.
Contract details
- Verified source
- Yes (StocktopusV4FeeHook)
- Compiler
- solc 0.8.26+commit.8a97fa7a
- Bytecode size
- 10,689 bytes
- Upgradeable proxy
- No
- Detected patterns
- moves-currency, ownable, return-delta, self-unlock
Pools using StocktopusV4FeeHook
- WETH / STOCKTOPUS (0.00% fee) — 24h volume $0, TVL $380, 0 swaps today
- wNVDAx / AI (0.00% fee) — 24h volume $0, TVL $0, 0 swaps today
- ICAT / wNVDAx (0.00% fee) — 24h volume $0, TVL $0, 0 swaps today
- INKINU / wNVDAx (0.00% fee) — 24h volume $0, TVL $0, 0 swaps today
- wNVDAx / FONE (0.00% fee) — 24h volume $0, TVL $0, 0 swaps today
- GOPRO / wNVDAx (0.00% fee) — 24h volume $0, TVL $0, 0 swaps today
- wAAPLx / WORM (0.00% fee) — 24h volume $0, TVL $0, 0 swaps today
- BEAR / wNVDAx (0.00% fee) — 24h volume $0, TVL $0, 0 swaps today