Sub topic 6
Liquidity removal, hidden minting, and honeypots
This chapter assumes you know how an automated market maker (AMM) pool prices swaps, what an owner address on a token contract can do, and how to read a short Solidity function. It covers the three main technical ways insiders take money out of a token without any market buying pressure: pulling the pool's liquidity, minting new supply, and blocking holders from selling.
The three mechanisms at a glance
A rug pull needs the insider to hold something other holders cannot get: control over the pool, the supply, or the transfer rules. Each mechanism maps to one of those three.
| Mechanism | What the insider controls | What victims see | Typical signature |
|---|---|---|---|
| Liquidity removal | LP tokens of the trading pool | Price falls to near zero, sells return almost nothing | Large liquidity withdrawal transaction |
| Hidden minting | Ability to create new tokens | Supply grows, price collapses as minted tokens are sold | Mint events to the owner or a fresh wallet |
| Honeypot | Transfer rules | Buys succeed, sells revert or lose nearly all value | Blacklist, trading switch, or extreme sell tax |
Liquidity removal
When someone adds liquidity to a Uniswap v2-style pool, they receive LP tokens. Those tokens are a claim on a proportional share of both reserves. Whoever holds the LP tokens can burn them and withdraw the underlying ETH and project tokens at any time.
In many scam launches the deployer supplies most of the ETH in the pool and keeps the LP tokens. Buyers' ETH flows into the pool and raises the price. The deployer then burns the LP tokens and takes the ETH, which includes everything the buyers paid in.
What it does to the price you can sell at
The function below is the constant-product formula with a 0.3% fee. It shows how much ETH a fixed sale returns before and after 90% of the pool is withdrawn.
def amount_out(amount_in, reserve_in, reserve_out, fee=0.003):
"""Constant-product (x * y = k) swap output, as in Uniswap v2-style pools."""
amount_in_after_fee = amount_in * (1 - fee)
return reserve_out * amount_in_after_fee / (reserve_in + amount_in_after_fee)
# A pool holding 100 ETH and 1,000,000 tokens.
eth_reserve = 100.0
token_reserve = 1_000_000.0
# ETH received for selling 100,000 tokens into the pool.
print(amount_out(100_000, token_reserve, eth_reserve))
# The same sale after the creator has withdrawn 90% of the liquidity.
print(amount_out(100_000, token_reserve * 0.1, eth_reserve * 0.1))The first sale returns about 9.07 ETH. The second returns about 4.99 ETH. The price quoted for the first token was the same in both cases, but the sale now moves the price far more, because the reserves are ten times smaller. If the creator withdraws 100% of the liquidity, there is nothing left to swap against.
Hard rug and soft rug
- A hard rug removes liquidity in one transaction. It is visible on-chain as a burn of LP tokens followed by a transfer of ETH to the deployer.
- A soft rug leaves a thin pool in place. The insider sells their own large token balance in stages, or removes liquidity in portions, so the price bleeds down. This is harder to spot because each transaction looks like ordinary trading.
Liquidity locks and their limits
A lock sends LP tokens to a time-lock contract that releases them after a set date. It is a useful signal, but check these points before you trust it:
- What share of the LP tokens is locked? A lock on 5% of the supply protects nothing.
- When does it unlock? A 7-day lock ends before most scams finish.
- Is the locked token actually the LP token of the pool that holds the liquidity? A project can lock tokens from a small side pool and leave the main pool unlocked.
- Can the lock contract itself be trusted? Use a well-known locker, and open the lock on its page to confirm the numbers.
- Burned LP tokens, sent to a dead address, are permanent. That is stronger than a timed lock.
Hidden minting
Minting creates new tokens and assigns them to an address. Legitimate tokens may mint on a schedule or under governance rules. In a scam, the owner keeps an unrestricted mint function, or hides one behind a vague name such as rewardDistribution or _update.
The extraction works in three steps. The owner mints a large amount to their own wallet. They then sell those tokens into the pool, taking out the ETH that buyers deposited. Existing holders are left with a share of a much larger supply.
def amount_out(amount_in, reserve_in, reserve_out, fee=0.003):
after_fee = amount_in * (1 - fee)
return reserve_out * after_fee / (reserve_in + after_fee)
eth_reserve = 100.0
token_reserve = 1_000_000.0
holder_tokens = 10_000 # 1% of the original supply
minted = 9_000_000 # secretly minted by the owner
eth_taken = amount_out(minted, token_reserve, eth_reserve)
print(f"ETH the owner extracts: {eth_taken:.2f}")
print(f"ETH left in pool: {eth_reserve - eth_taken:.2f}")
new_supply = 1_000_000 + minted
print(f"Holder share before: {holder_tokens / 1_000_000:.4%}")
print(f"Holder share after: {holder_tokens / new_supply:.4%}")The owner extracts about 89.97 ETH of the 100 ETH in the pool. A holder with 1% of the supply is diluted to 0.1%, and the tokens they hold now trade against about 10 ETH.
Variants to know
- Direct mint: a public function guarded only by
onlyOwner. - Role-based mint: a minter role that the owner can grant to any address, including a hidden one.
- Upgradeable proxy: the contract you read today can be replaced by a new implementation that adds minting. Check who controls the proxy admin.
- Balance edits: functions that set balances directly, which skip any
Transferevent and make the supply hard to audit.
Renouncing ownership is often cited as proof of safety. It removes onlyOwner powers only if the code has no other privileged paths, such as a second admin variable or a proxy admin that remains active.
Honeypots
A honeypot lets you buy but blocks or cripples your sale. The deployer, and sometimes a few allowlisted wallets, can still sell. Buyers see the price rise and cannot cash out.
This simplified contract shows the simplest control, an owner-managed blacklist.
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
// Simplified, not a full ERC-20. It shows a red-flag pattern to recognize:
// one address can stop any holder from transferring.
contract RedFlagToken {
address public owner;
mapping(address => bool) public blocked;
mapping(address => uint256) public balanceOf;
constructor() {
owner = msg.sender;
}
function setBlocked(address account, bool value) external {
require(msg.sender == owner, "not owner");
blocked[account] = value;
}
function transfer(address to, uint256 amount) external returns (bool) {
require(!blocked[msg.sender], "blocked");
balanceOf[msg.sender] -= amount;
balanceOf[to] += amount;
return true;
}
}The owner can call setBlocked on any buyer after they purchase. The buyer's next transfer reverts. A real honeypot rarely uses such a clear name, and it may block only transfers to the pool address.
Other honeypot forms
- Trading switch: a flag such as
tradingEnabledorcanSellthat the owner can turn off. - Sell tax with no cap:
setSellTax(99). Sells succeed but return 1% of the value. - Max transaction or max wallet limits that the owner can change, so a limit of zero blocks sells.
- Pool-specific rules: the
transferfunction checks whethertois the pair address and reverts for everyone except the owner. - Gas traps: transfer logic that loops over a growing array until sells run out of gas.
Honeypot or just a bad token?
A token with a 10% tax or low liquidity is costly, but it is not a honeypot. A honeypot has a rule that treats buyers and insiders differently. The practical test is simulation: run a sell without sending real funds, or sell a very small amount first. Simulation tools can report the effective buy tax, sell tax, and whether a sell reverts. They are only a snapshot, because an owner can change the rules after the check passes.
Common errors when assessing these risks
- Treating a verified contract as a safe contract. Verification means the source matches the deployed code, not that the code is fair.
- Reading only the token contract. Liquidity risk sits in the pool and LP token holdings, not in the token code.
- Trusting "ownership renounced" without checking for proxies, secondary admin roles, or a mint function not guarded by
owner. - Checking the state once. Rules and balances change, so recheck before buying more.
- Confusing a low sell price with a honeypot. Thin liquidity, high tax, and a blocked sell are different failures with different fixes.
Exercise
A token's pool holds 50 ETH and 500,000 tokens. The deployer holds 100% of the LP tokens, and the contract has an onlyOwner function mint(address to, uint256 amount). Name the two distinct ways the owner could take your ETH out, and one check for each that you can do before buying.
Show answer
First, liquidity removal: the owner burns the LP tokens and withdraws the ETH and tokens. Check who holds the LP tokens and how much is locked or burned, and for how long. Second, hidden minting: the owner mints a large amount to themselves and sells into the pool. Check whether the mint function exists and who can call it, including any proxy admin, and look for mint events on a block explorer.
Exercise
A scanner reports a clean token with no blacklist and a 2% sell tax. A week later you cannot sell. What contract features could explain this even though the scan was accurate when you ran it?
Show answer
The owner kept control of changeable settings, such as a sell tax setter with no cap, a trading switch, a max-transaction limit, or an upgradeable proxy that can swap in new code. The scan reflected the state at that moment. Any of these can be changed afterward, so the right check is what the owner is still able to change.