Loyalty Sell Fee
BaseLoyalty Sell Fee is a Uniswap v4 hook on Base, also known as CustomHook. Deployed 1 day ago. No pool uses it yet.
- Deployed through UniHooks by
- 0xf41182e5c54d63ba48422dd73569fa5aa221884a
- Contract name
- CustomHook
How this hook works
Trading taxA trading tax hook. It takes a tax on trades and keeps rewards to claim.
Takes a tax on trades
On top of the normal pool fee, it keeps part of each trade as a tax. The tax builds up in the hook until it is collected.
The code that does this (beforeSwap):function _beforeSwap(address sender, PoolKey calldata key, SwapParams calldata params, bytes calldata) internal override returns (bytes4, BeforeSwapDelta, uint24) { bool tokenIs0 = !isPayingCoin[Currency.unwrap(key.currency0)]; bool selling = params.zeroForOne == tokenIs0; // paying in the token if (!selling) { // a buy: remember when this wallet first bought in this pool, never overwritten PoolId id = key.toId(); address buyer = _wallet(sender); if (firstBuyAt[id][buyer] == 0) firstBuyAt[id][buyer] = block.timestamp; return (this.beforeSwap.selector, BeforeSwapDeltaLibrary.ZERO_DELTA, 0); } // a sale of an exact number of tokens: the fee is a share of those tokens. // (a sale for an exact amount of the paying coin is charged in _afterSwap, once the token amount is known) if (params.amountSpecified >= 0) return (this.beforeSwap.selector, BeforeSwapDeltaLibrary.ZERO_DELTA, 0); uint256 amountIn = uint256(-params.amountSpecified); uint256 fee = amountIn * _sellFeeBps(key.toId(), _wallet(sender)) / BPS; if (fee == 0) return (this.beforeSwap.selector, BeforeSwapDeltaLibrary.ZERO_DELTA, 0); Currency tokenCurrency = tokenIs0 ? key.currency0 : key.currency1; // Kept in the hook, never sent to the treasury inside the trade. poolManager.take(tokenCurrency, address(this), fee); collected[tokenCurrency] += fee; _feeTakenBeforeSwap = fee; return (this.beforeSwap.selector, toBeforeSwapDelta(_toInt128(fee), 0), 0); // …Rewards to claim
It keeps track of what people have earned, and they claim it themselves.
The code that does this (claimRefund):function claimRefund(Currency currency) external { uint256 amount = refundOwed[currency][msg.sender]; if (amount == 0) return; refundOwed[currency][msg.sender] = 0; currency.transfer(msg.sender, amount); }
Who controls it: Nobody. The hook has no admin functions, and the code cannot be changed.
Based on the hook’s published code.What do these labels mean?
Safety report
Before you build on it. Automated checks, not an auditWhat it can do
Its code executes inside each trade in pools that use it.
It can take or add tokens during a swap. Fees, burns and custom curves work this way, and so do scams.
It runs when a pool is created, often to lock in that pool’s settings.
Hook history
Reading what this hook has recorded on-chain…
Counted from token transfers in and out of the hook. Its published code records no actions of its own. Still reading older history, so totals will grow.