problem · erc20 transfer hooks

ERC-20 transfer hooks

The transfer-hook problem.

ERC-20 LSP·7 LSP·1

ERC-20.transfer updates balances and emits an event. The recipient is never called.

ERC-20 transfer(to, amount)
no recipient call no data payload
LSP·7 transfer(from, to, amount, force, data)
LSP1 hook on recipient force + data
LUKSO route

If you're dealing with ERC-20 transfer hooks, the LUKSO route is LSP7 + LSP1. LSP7 makes the hook native. Every transfer can carry bytes data and triggers the recipient through LSP1 Universal Receiver — and LSP1 is one interface across LSP7, LSP8, and value transfers, so contracts stop implementing four receiver shapes.

Why this breaks

An ERC-20 transfer is two storage writes and a Transfer event. The recipient contract is never called, so it cannot run logic when tokens arrive. A vault that needs to credit a user on deposit either trusts msg.sender to call a second function, or polls Transfer events from an indexer.

This is the root cause of the “tokens stuck in contract” pattern: a user sends ERC-20 directly to a contract address, the contract has no way to react, and the tokens sit there until someone writes a rescue function.

What people try

ERC-777 tokensReceived

Added receiver awareness in 2017. Introduced reentrancy issues that led most teams to avoid it. Largely abandoned in new deployments.

ERC-1363 transferAndCall / approveAndCall

Clean opt-in design. Adoption is thin — tokens that don’t implement it still strand. Useful when you control both sides.

Wrapper contracts (deposit then call)

Moves the burden to the user and adds a transaction. Works, doesn’t compose.

Off-chain Transfer event indexers

Necessary for app state. Cannot trigger on-chain reactions. A subgraph is not a hook.

How LSP solves it

LSP7’s transfer takes a force flag and a bytes data payload, and notifies both sender and recipient through LSP1 Universal Receiver. A recipient contract that implements LSP1 receives a typeId and the transfer data, and can run accept/reject/route logic in one standard hook.

The structural point: LSP1 is one interface across LSP7, LSP8, and value transfers. A Universal Profile (or any LSP1-aware contract) handles every asset type through the same entry point. The four-receiver-interfaces problem disappears.

continue at the source