Bible Network Crypto DeFi Onchain RWA AI Agent Stablecoin Chain SAFU CryptoTax DeFAI AGI Claude Me Claude Skill Claude Design Claude Cowork
Independent Media
Not affiliated with any project
The Deepest Stablecoin Knowledge Base
stablecoin-bible.com
LATEST
The GENIUS Act Is Law: What America’s First Stablecoin Legislation Actually Changes — and What It Means for Your USDT and USDC  ·  Why DeFi Stablecoins Require 150%+ Collateral: Collateral Ratios, Liquidation Thresholds, and the Buffer That Keeps $1 at $1  ·  Where to Keep Your Stablecoins Safely: CEX, Self-Custody, or DeFi — A Beginner’s Guide to Choosing the Right Custodian  ·  The Day Your Stablecoin Isn’t $1: USDC, DAI, and UST Depeg Case Studies — How to React, and What Not to Do  ·  MiCA Made USDT Disappear from Europe: Coinbase and Binance Delist in Turn — How the EU Stablecoin Map Was Redrawn in One Year  ·  How Algorithmic Stablecoins Try to Hold $1: The Mint-and-Burn Loop — and Why Once Confidence Breaks There Is No Floor
Glossary · depegging-risk

Smart Contract Risk

depegging-risk Intermediate

Full Explanation +
01 · What is this?

What is a reentrancy attack and why is it so dangerous?

Reentrancy is one of the most classic and dangerous smart contract vulnerabilities. Imagine a contract's 'withdraw' function: user calls withdraw → contract transfers funds → then updates balance. An attacker can call withdraw again in the window after the transfer but before the balance update, draining the contract repeatedly while the ledger still shows full balance. The most famous example: the 2016 DAO hack via reentrancy stole ~3.6M ETH, directly causing Ethereum to hard-fork into ETH and ETC. Modern audits prioritize checking reentrancy, but new protocols still fall victim — Euler Finance's 2023 $197M exploit involved similar logic vulnerabilities.

02 · Why does it exist?

How do I assess whether a DeFi protocol's smart contracts are safe? What specific indicators?

Several publicly checkable metrics. First, audit count and quality: look for independent audits from OpenZeppelin, Trail of Bits, Certik, or Sherlock — how many, how recent, and whether post-upgrade audits exist. Multiple audits far outperform a single one. Second, TVL and history: sustained high TVL (hundreds of millions+) with no exploits is the best time-pressure test — hackers have looked many times and found no entry. Third, admin control: does the protocol have a timelock (upgrades need 24-72h before taking effect, giving community reaction time) and multisig (at least 3/5 or 4/7)? Fourth, bug bounty: a large Immunefi bounty signals the protocol takes security seriously.

03 · How does it affect your decisions?

If an audit says 'no critical vulnerabilities,' why do hacks still happen?

Several reasons why 'audited' doesn't mean 'definitely safe.' First, audits are static snapshots — after a protocol upgrades, the prior audit is invalid if the new version wasn't audited. Second, auditors are human; complex business logic vulnerabilities can be subtle even for top firms. Third, composability creates new attack surfaces: individually audited contracts may be fine, but their combined behavior can introduce vulnerabilities — flash loan attacks exploit unexpected behaviors across multiple protocols. Audits are necessary, not sufficient. The hardest protection is time-tested live history without exploits, plus a substantial Bug Bounty that makes it more profitable for whitehats to report than to steal.

04 · What should you do?

Advanced: is formal verification a stricter security measure than auditing?

Yes, but with limitations. Formal verification uses mathematical methods to rigorously prove that code logic behaves as specified under all possible inputs — not 'I tested some cases and found nothing' but 'I mathematically proved it can't misbehave in any case.' Stricter and more comprehensive than traditional code audits. Downsides: extremely costly (only top DeFi protocols can afford it), requires properties to be formally specified precisely (getting the specification right is hard), and can only guarantee the specification's correctness — if the spec itself is wrong, verification doesn't help. DAI/USDS core contracts and some Aave components use formal verification, but it remains a complementary tool, not a replacement for human audits and Bug Bounties.

Real-World Example +

Euler Finance March 2023: ~$197M drained via a logic bug in the donate-to-reserve function combined with flash loans. Euler had reputable audits. The specific edge case wasn't fully covered. After lengthy negotiations, the attacker returned ~95% of funds, but users couldn't access assets for weeks. Even a blue-chip protocol with audits can be exploited. Only put into DeFi what you can afford to lose — a more fundamental principle than 'pick a good protocol.'

Diagram
Smart Contract Risk Categories in DeFi: Code Bugs, Oracle Attack, Admin Key, Liquidity RiskDeFi 穩定幣智能合約四大風險類別圖:四個紅框分類「程式碼漏洞(重入攻擊、整數溢出、邏輯錯誤)」、「預言機攻擊(閃電貸+價格操縱)」、「管理員私鑰風險(多簽被攻破、升級掏空)」、「流動性危機(擠兌)」,各附緩解措施;中段綠框為降低曝險的具體指標(≥2 次獨立審計、長期高 TVL、無單一管理員私鑰、Timelock);Smart Contract Risk Categories in DeFi StablecoinsWhen you deposit into a DeFi protocol, the code is your custodian — and code can be wrongCode BugsReentrancy attackInteger overflowLogic errors incollateral / liquidationMitigate: multi-auditOracle AttackFlash loan + pricemanipulationFalse collateral valuetriggers overborrowMitigate: TWAP, ChainlinkAdmin Key RiskMultisig compromisedUpgrade drains poolRug pull via ownerfunctionMitigate: timelock, DAOLiquidity RiskBank-run drains poolbefore you withdrawWithdrawal queuein illiquid marketsMitigate: liquidity bufferHow to reduce exposureUse protocols with ≥2 independent audits · long live history · high TVL · no single admin key · timelockHistorical examplesEuler Finance 2023: $197M drained via logic bug in donate() functionCurve Finance 2023: $70M at risk from Vyper compiler bug · partly recovered via whitehat bountyStablecoin Bible · stablecoin-bible.com
Feel free to share. Please credit the source.
The Missing Link +
Direct Impact

DeFi's core advantage is removing the bank intermediary: your money interacts directly with code, and no one can proactively misappropriate your deposit or block withdrawals (if the contract runs normally). The cost: when the code is wrong, there's also no one accountable to fix it — no deposit insurance, no legal compensation obligation, no customer service. Smart contract risk is the other face of this trade-off. The more decentralized and auto-executing a protocol, the harder it is to patch afterward; the more conservative and well-governed a protocol, the faster it can respond to security incidents.

Ask a Question
Please enter at least 10 characters
Related Articles
You Think Stablecoins Are Safe? These Five Risks 99% of Holders Never Consider
risk · Jun 10