Stablecoin smart contract audit: every path that mints the coin
A stablecoin smart contract audit checks every path that mints or burns the coin: whether the collateral behind each mint is priced correctly, whether a mint or borrow can pass a solvency check it should fail, who holds the mint, pause, freeze and upgrade roles, and how liquidations and redemptions behave when the peg is under stress. QuillShield audits the minting, collateral and oracle contracts as one codebase, then checks each pull request against that audit.
What goes wrong in stablecoin contracts?
A stablecoin is a promise that each coin is backed, and the code can break that promise in several places:
- Collateral priced wrong. A price read from a thin pool, a stale feed or an exchange rate that a donation can move lets someone mint more than their collateral is worth. See oracle price manipulation and stale oracle prices.
- A mint path without the solvency check. Every function that mints, borrows or releases collateral has to end with the same check, and a rate that rounds to zero can make that check pass for everyone. See rounding and precision errors.
- Privileged roles. Mint, burn, pause, freeze and upgrade functions hold the most authority in the system. CertiK treats the private keys that control minting and redemption as a risk of their own, next to the contract risks it lists: underflow and overflow, reentrancy, missing access controls, price manipulation and flash loan attacks. See access control and centralization risk.
- Liquidations under stress. When collateral falls fast, liquidations have to stay worth doing at every position size, or bad debt stays in the system. See liquidation logic bugs.
- Governance. A vote that can change collateral, oracles or mint limits is a mint path too. See governance attacks.
- Other chains. A coin minted on several chains inherits the risk of each bridge it uses, which the bridge audit page covers.
How does the peg design change what an audit checks?
The peg mechanism decides where the risk sits. A Spearbit guide to auditing stablecoin peg designs groups designs and their audit risks roughly like this:
| Design | Where the audit looks |
|---|---|
| Backed by liquid staking derivatives | Rebase rounding and timing exploits, liquidation logic, and the peg of the staking derivative underneath. |
| Anchored to real-world assets | The trust boundary: off-chain reserve checks and admin keys that can mint. |
| Algorithmic and hybrid | Reflexive death-spiral dynamics, and rounding that hands out free arbitrage. |
| Delta-neutral and hedged | Hedge execution and liquidity, and custody of counterparty and keeper keys. |
| Any design | Oracle manipulation and latency, privileged roles and upgrade safety, bridge compromise and cascading liquidations in lending markets. |
A code review covers the on-chain part of each row. Reserves held off-chain and the custody of keys need their own checks, which a smart contract audit can describe but not replace.
What has gone wrong before?
| Protocol | Resupply |
|---|---|
| Date | 26 June 2025 |
| Chain | Ethereum |
| Loss | $10M of reUSD bad debt |
| What happened | A new Resupply lending pair priced its collateral from a CurveLend vault with no deposits. The attacker donated 2,000 crvUSD to the vault's controller and deposited 2 crvUSD for 1 wei of shares. Resupply's exchange rate, 1e36 divided by the share price, rounded down to 0, every borrow passed the solvency check, and the pair was left with $10M of reUSD bad debt. |
| Sources | Resupply, BlockSec |
The vault behind the collateral did what its code said, and the loss happened in a lending pair that trusted the exchange rate of the vault without asking whether the vault was empty, then let a rate of zero through its solvency check, as the Resupply post-mortem and the BlockSec analysis describe. A stablecoin mint or borrow path should refuse a price of zero, and a new market should be seeded before it accepts collateral.
CertiK lists Resupply among its stablecoin smart contract incidents, next to Cashio, a stablecoin backed by interest-bearing Saber USD liquidity provider tokens that lost $52.8M in 2022 because the code failed to check that the banking token and the minted token matched. Both losses sat in a mint path rather than in the token contract of the coin.
Which bug classes should a stablecoin review cover?
| Bug class | Where it shows up in a stablecoin |
|---|---|
| Oracle price manipulation | Collateral priced from a pool or rate that one transaction can move. |
| Stale oracle price | A feed that stops updating while minting continues at the old price. |
| ERC-4626 inflation attack | Vault shares used as collateral while the vault is empty or nearly empty. |
| Rounding and precision | Exchange rates and collateral ratios that round toward the minter, or down to zero. |
| Liquidation logic bugs | Liquidations that stop paying at small sizes or during fast price moves. |
| Flash loan attack | Borrowed capital that moves a price, a vote or a collateral ratio for one transaction. |
| Governance attack | Votes that change collateral, oracles or mint limits without a delay. |
| Access control | Mint, burn, pause, freeze and upgrade functions without the right role check. |
| Centralization risk | One key that can mint without limit or upgrade the coin. |
| Signature replay | Permits on the coin without a nonce, a domain separator or a deadline. |
| Cross-chain message validation | Mints on another chain triggered by a message nobody proved. |
How do a full audit and pull request checks fit a stablecoin team?
Scope the coin and everything that can mint it: the token, the minter or vault manager, collateral adapters and oracle wrappers, liquidation and redemption modules, governance and timelock contracts, and any bridge adapter. QuillShield reviews them as one codebase, so an oracle adapter is read with the mint function that trusts it. As context for the audit, attach the collateral list, the feed each asset uses and who can change either, along with the whitepaper and previous audit reports.
Before a finding reaches you, a separate reviewer agent tries to disprove it. Findings that hold up carry the exact lines, the impact, a recommended fix and, on full audits, the proof of concept result, so you can see whether a mint path lets someone borrow against nothing.
Stablecoins keep adding collateral types and adapters after launch. A pull request that adds one is checked against the security graph from the audit, with five checks included in each full audit of a GitHub or GitLab.com repository, and a required check on GitHub, under branch protection or rulesets, blocks the merge while the pull request has a High or Critical finding, or one at the threshold you set. The guide to pull request checks on GitHub shows the setup.
QuillShield does not replace a manual audit. Before a stablecoin holds real value, request a manual audit from QuillAudits, and keep QuillShield on every change after it. The DeFi lending audit page covers the borrow and liquidation side in more depth.
What does a stablecoin audit cost?
A stablecoin system with its minter, adapters and governance is priced like any Solidity codebase: by the lines in scope, without comments or blank lines, from $49. As of November 2026 the pricing page lists 10,000 lines at $1,899 and 40,000 lines at $5,429, and anything larger is quoted by hand. You see the exact quote before anything is charged, and pull request checks beyond the five included with each full audit are priced on the same page. Sign-up is free. New accounts get $50 in credit, good for up to half of an order.
Run a full audit of your minting and collateral contracts, or talk to an auditor about a manual review before launch.
What should you check before you launch a stablecoin?
- Does every function that mints, borrows or releases collateral end with the same solvency check?
- For each collateral asset, which feed or rate sets its price, and what happens when it is stale, zero or moved within one transaction?
- Is every new market or collateral type seeded before it accepts deposits?
- Who can mint, burn, pause, freeze and upgrade, and does each power sit behind a timelock or a named multisig?
- Do liquidations stay worth doing at every position size, and what happens to debt the collateral can't cover?
- Can a governance vote change collateral, oracles or mint limits without a delay?
- If the coin is minted on several chains, can total supply across them exceed what backs it?
FAQ
Does a fiat-backed stablecoin need a smart contract audit?
A fiat-backed coin still needs one, because its contract holds the mint, burn, pause and freeze powers, and CertiK treats the private keys that control minting and redemption as a risk of their own. The audit covers that code and those roles, and the reserves need their own attestation.
What should be in scope for a stablecoin audit?
Put the token, the minter or vault manager, collateral and oracle adapters, liquidation and redemption modules, governance and timelock contracts, and any bridge adapter in scope. The Resupply loss came from a new lending pair and the vault it priced, not from the token contract of the coin.
How much does a stablecoin audit cost with QuillShield?
It follows the lines of Solidity in scope: as of November 2026, 10,000 lines cost $1,899 and 40,000 lines $5,429, and above that the price is quoted by hand. New accounts get $50 in credit, good for up to half of an order.
Can QuillShield check a change to collateral parameters?
If the change is Solidity in a pull request, it gets a check against the last full audit like any other change. A parameter changed only on-chain, with no code in the repository, needs its own review.
Sources
- Resupply crvUSD-wstUSR market post mortem, Resupply checked 24 November 2026
- In-depth analysis and reflections on the Resupply protocol attack incident, BlockSec checked 24 November 2026
- Security risks of stablecoins, CertiK checked 3 December 2026
- Auditing stablecoin peg designs: risks, Spearbit, on Cantina checked 3 December 2026