Curriculum·G306 The Handoff: Learning to Build Safely·about 33 min
The practices and tools real builders live by
By the end of this lesson you can
- →Explain that mature engineering practices exist because integrations behave in ways naive code does not expect
- →Describe how an ERC-777 callback let an attacker re-enter Lendf.me and inflate their balance
- →Reason that patterns like checks-effects-interactions and reentrancy guards are defenses against exactly this class
- →Recognize that real builders live by practices and tools, not by cleverness, to catch what they cannot foresee
Graduate · enrolled learners
This lesson opens with dForce / Lendf.me, April 2020.
- What happened
- Lendf.me, run by dForce, was a lending market, and it listed imBTC, a token built on the ERC-777 standard. Unlike a plain ERC-20 token, ERC-777 includes a callback: when the token is transferred, it can call a function on the parties involved before the transfer fully completes. Lendf.me's supply-and-withdraw logic assumed a simple transfer that just moves tokens and returns, so it updated balances in an order that a callback could interrupt. The attacker used the ERC-777 callback to re-enter Lendf.me's own functions in the middle of a transfer, before its accounting had settled, and inflate their recorded balance, then drained about 25 million dollars, nearly all of which was later returned after the attacker was partly deanonymized through leaked metadata. The flaw was not a strange one; it was reentrancy arriving through a token standard, and the interaction of ERC-777's callback with lending logic written for ordinary ERC-20 transfers is exactly the kind of thing mature engineering practice, understanding the standards you integrate, ordering state changes before external calls, guarding against reentrancy, exists to catch. The team was clever enough to build a lending market and not disciplined enough to defend against a known pattern arriving through a token they had listed.
- The decision point
- Smart contract systems fail most often not at the frontier of novel attacks but at the seams where a contract integrates something, a token standard, another protocol, an external call, that behaves in a way the contract's author did not expect, and the established engineering practices, ordering state changes before external calls (checks-effects-interactions), reentrancy guards, understanding every standard you integrate, static analysis and thorough testing, exist precisely because those seams are where the loss happens. Lendf.me is the case: lending logic written for ordinary ERC-20 transfers met an ERC-777 token whose callback let the attacker re-enter mid-transfer and inflate a balance, draining about 25 million dollars, a reentrancy through a token standard that the standard practices are built to prevent. This lesson matters in the handoff course because it names what real building actually is: not cleverness, which the Lendf.me team had, but discipline, the consistent application of practices and tools that catch the failures a builder cannot foresee by intuition alone. A clever builder relies on being smart enough to see the problem; a real builder relies on practices that catch the problem even when they do not see it, because the seams where integrations misbehave are exactly the places intuition misses. So the discipline, and the reason this bridge hands you off to rigorous, hands-on education rather than pretending to make you a builder, is that these practices and tools are learned by doing, deeply, under instruction, not by reading a summary. Lendf.me is what cleverness without discipline costs at a seam: about 25 million dollars to a known pattern arriving through a token the team themselves had listed, caught by none of the practices they had not adopted.
- Recorded loss
- $25,000,000
What you will be able to answer
- →How was Lendf.me (dForce) drained (April 2020)?
- →Where do smart contract systems most often fail?
- →Why do checks-effects-interactions and reentrancy guards exist?
- →Clever builder vs real builder
Orientation and Year One are open: anyone can read them without an account. From Year Two onward the lessons are for enrolled learners, because progress through the later years only means anything if it is tracked against a record.
It is free. We do not sell the list and there is nothing to buy at the end of it.
Sources and review
- https://rekt.news/lendf-me-rekt/
- https://consensys.github.io/smart-contract-best-practices/attacks/reentrancy/
Confidence high·Volatility low·Reviewed 2026-09-17·Owner unassigned
Contested
The roughly 25 million dollar figure is the approximate amount drained; nearly all was later returned after the attacker was partly deanonymized through leaked metadata, so the net loss was far smaller. The lesson uses the integration-seam mechanism, not a precise net loss.
The precise ERC-777 callback and reentrancy mechanics are documented separately; this lesson uses only the fact that a known reentrancy pattern arrived through a token standard the lending logic did not account for, which is the transferable point about practices and seams.
