Sub topic 7
Honeypots and Rug Pull Patterns
This chapter assumes you can read a block explorer page, know what a DEX liquidity pool is, and understand the earlier chapters on liquidity locks and owner powers. Here you will connect those pieces into the patterns that actually take money from buyers. This is education, not financial advice.
Two Names for Two Different Failures
A honeypot is a token you can buy but cannot sell, or can sell only under terms the deployer controls. The trap is in the token's code. Buyers see the price rise on a chart, because only buys succeed, and believe they are in profit.
A rug pull is an exit by insiders. They remove liquidity, dump a large hidden allocation, or mint new supply and sell it into the pool. Buyers are left holding a token with no market behind it.
The two overlap. A honeypot can be a rug pull that was built into the code from the start. A rug pull can also happen with a clean token whose liquidity was never locked. Keeping them separate helps because the checks differ. A honeypot is found by examining code and simulating a sale. A liquidity rug is found by examining who controls the pool.
The Main Patterns
| Pattern | Mechanism | Where it shows up |
|---|---|---|
| Sell-blocking honeypot | Transfers to the pair revert, or only whitelisted addresses can sell | Token code, sell simulation |
| Confiscatory sell tax | Owner raises the sell tax toward 100% | Tax setter functions |
| Blacklist trap | Owner blacklists buyers after they buy | Blacklist or "bot" mappings |
| Liquidity pull | Deployer removes LP tokens from the pool | LP token holder, lock status |
| Mint and dump | Owner mints new supply and sells it | `mint` function, supply changes |
| Proxy swap | Upgradeable proxy is pointed at malicious code | EIP-1967 slot, admin address |
| Slow rug | Insiders sell gradually through many wallets | Holder and trade history |
Anatomy of a Honeypot in Code
The example below is simplified. It shows how little code is needed to turn a normal-looking token into a trap.
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
// Simplified illustration of risky owner powers. Not a complete ERC-20.
contract RiskyToken {
address public owner = msg.sender;
address public pair;
uint256 public sellTaxBps;
mapping(address => bool) public blacklisted;
mapping(address => uint256) public balanceOf;
modifier onlyOwner() {
require(msg.sender == owner, "not owner");
_;
}
function setPair(address p) external onlyOwner { pair = p; }
function setSellTax(uint256 bps) external onlyOwner { sellTaxBps = bps; }
function setBlacklist(address a, bool b) external onlyOwner { blacklisted[a] = b; }
function transfer(address to, uint256 amount) external returns (bool) {
require(!blacklisted[msg.sender], "blacklisted");
uint256 fee = to == pair ? (amount * sellTaxBps) / 10_000 : 0;
balanceOf[msg.sender] -= amount;
balanceOf[to] += amount - fee;
balanceOf[owner] += fee;
return true;
}
}Three behaviors matter here:
- Selling is identified by destination. The code treats a transfer to
pairas a sell. Buying is a transfer from the pair, so the fee is zero. This is why buys always succeed. - The tax has no ceiling. Tax is expressed in basis points (bps), where 10,000 bps is 100%. If the owner sets a value above 10,000, the fee exceeds the amount and
amount - feeunderflows. Solidity 0.8 reverts on underflow, so every sale to the pair fails. At exactly 10,000 the seller receives nothing and the owner collects everything. - The blacklist is checked on the sender. An owner can wait until a buyer holds tokens, then block that address from transferring.
Note that the owner can change all of these after you buy. A sell simulation that passes today says nothing about tomorrow unless the owner can no longer call these functions.
Liquidity Rugs
In a typical launch, the deployer pairs tokens with ETH or a stablecoin in a pool and receives LP tokens, which are claims on that pool. Whoever holds the LP tokens can withdraw the paired asset that buyers deposited.
If the deployer holds unlocked LP tokens, one transaction can drain the pool. Price drops to near zero, and holders cannot sell for anything of value. The token contract itself may be perfectly clean, so a code scan alone will not catch this.
What to check:
- Which address holds the LP tokens? A burn address, a locker contract, or a deployer wallet?
- If locked, when does the lock expire? A lock of seven days only delays the rug by a week.
- What share of the LP supply is locked? A lock on 20% of LP tokens leaves 80% removable.
- Does the lock contract allow the owner to withdraw early or extend, and is that contract itself reputable?
As the previous chapter explained, a lock proves only that this LP position cannot be withdrawn until the date. It does not stop minting, tax changes, or blacklisting.
Upgradeable Proxies and Hidden Control
A proxy contract forwards calls to an implementation contract. If the admin can change which implementation the proxy points to, the token's behavior can be rewritten at any time. A token that was safe at launch can gain a sell block after it has attracted liquidity.
This script reads the owner and the EIP-1967 implementation slot using ethers v6.
import { ethers } from "ethers";
const provider = new ethers.JsonRpcProvider(process.env.RPC_URL);
const tokenAddress = process.env.TOKEN_ADDRESS;
const abi = [
"function owner() view returns (address)",
"function totalSupply() view returns (uint256)",
];
const token = new ethers.Contract(tokenAddress, abi, provider);
// EIP-1967 implementation slot: a non-zero value means the contract is an upgradeable proxy.
const IMPL_SLOT =
"0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc";
const [owner, impl] = await Promise.all([
token.owner().catch(() => null),
provider.getStorage(tokenAddress, IMPL_SLOT),
]);
console.log("owner:", owner);
console.log("ownership renounced:", owner === ethers.ZeroAddress);
console.log("upgradeable proxy:", BigInt(impl) !== 0n);Read the output carefully:
ownerequal to the zero address means theOwnablerole was renounced. Functions guarded by it can no longer be called.- A non-zero implementation slot means the code can be swapped by whoever controls the proxy admin. Renouncing
owner()on the token does not remove that power, because the upgrade right is usually held by a separate admin address or a ProxyAdmin contract. - If
owner()fails, the script printsnull. That means the token has noowner()function with that signature, not that it is safe. It may use another access-control scheme.
How a Rug Unfolds
The timeline below shows a typical sequence for a liquidity and mint-based exit.
Practical Checks Before You Buy
Run these in order. Any failure is a reason to stop, and passing all of them reduces risk without removing it.
- Simulate a sell. Use a reputable honeypot checker or a simulated swap that calls the router with your amount. Treat the result as a snapshot. Check whether the tax figures it reports are high.
- Read the verified source. On the block explorer, confirm the contract is verified. An unverified token hides its logic, which is itself a red flag.
- List privileged functions. Search for
onlyOwner,mint,blacklist,setTax,pause, andsetPair. Ask who can call them and whether any bound is enforced, such as a hard cap on tax. - Check ownership and upgradeability. Run the script above. Renounced ownership plus a non-proxy contract is the strongest position. Be cautious of renounced tokens that still contain an unrenounced second admin role.
- Inspect the LP position. Find the LP token holder and any lock expiry.
- Look at early trades. Check whether the deployer or linked wallets sold soon after launch, and whether many buyers have the same funding source.
Edge Cases and Common Mistakes
- A passing sell simulation is not a guarantee. The owner can change tax or blacklist status after your test. Honeypot checkers also miss cases where selling fails only after a time delay or a number of blocks.
- Small test buys can mislead. Some contracts allow sales below a threshold, or for the first few blocks, and block larger sales. Max-sell limits can make a large position impossible to exit in one trade.
- A high tax is not always a honeypot. Some legitimate tokens charge 5% or more. The danger lies in an unbounded setter, not in the current number.
- Renounced ownership can be faked. Some contracts hand ownership to a controlled address that looks unrelated, or keep a hidden role. Read the code instead of trusting the label.
- Verified does not mean safe. Verification shows the source matches the deployed bytecode. It says nothing about whether the logic is fair.
- Trading stats can be manufactured. Wash trading between linked wallets creates volume and chart momentum without real demand.
Summary of Decision Criteria
Treat a token as high risk when any of the following is true: the deployer can change sell tax without a cap, the deployer can blacklist arbitrary addresses, LP tokens sit in a deployer wallet, a proxy admin can swap code, or the source is unverified. Several of these together are close to conclusive.
Exercise
A token's owner() returns the zero address, and your script shows a non-zero EIP-1967 implementation slot. A friend says the token is safe because ownership was renounced. What is wrong with that conclusion, and what would you check next?
Show answer
Renouncing owner() only removes functions guarded by that Ownable role. The non-zero implementation slot shows the token is an upgradeable proxy, and the right to change the implementation usually belongs to a separate proxy admin or ProxyAdmin contract. That admin could point the proxy to code that blocks sales or mints supply. Next, find the proxy admin address (the EIP-1967 admin slot), see whether it is an externally owned account, a multisig, or a timelock contract, and review the current implementation's source for privileged functions.
Exercise
In the RiskyToken contract, why does setting sellTaxBps above 10,000 make every sale to the pair revert, and why do buys still work?
Show answer
A sale is a transfer where to equals pair, so the fee is amount * sellTaxBps / 10,000. Above 10,000 bps the fee is larger than amount, and the expression amount - fee underflows. Solidity 0.8 checks arithmetic and reverts on underflow, so the sale fails. Buys are transfers from the pair to the buyer, where to is not the pair, so the fee is zero and the transfer succeeds. Buyers see successful buys and a rising price but cannot exit.
Exercise
A token passes a honeypot checker, its contract is verified, and 100% of its LP tokens are locked for 14 days. List two ways buyers could still lose money.
Show answer
The owner may still hold powers that the lock does not cover, such as an uncapped sell tax setter, a blacklist, or a mint function, so the owner can raise the tax, block sellers, or mint and dump supply. The lock also expires in 14 days, after which the LP tokens can be withdrawn unless the lock is extended. A proxy admin who can swap the implementation is another valid answer.