DeFi stablecoin
Smart contracts for a USD-style coin on Ethereum. You lock crypto as collateral, then mint or burn the stablecoin.
What this is
This is a learning project for a decentralized stablecoin. One DSC token is meant to equal one US dollar. You do not mint it from thin air. You deposit WETH or WBTC as collateral first, then mint DSC against that value. Think of it like a simplified version of MakerDAO’s DAI, but only ETH and BTC style collateral, with no governance token and no fees in this version.
The basic rules
The system should stay over-collateralized. In practice that means you need about twice as much collateral value as DSC you mint (a 200% style threshold in the engine). Chainlink-style price feeds tell the contracts what the collateral is worth. If your position gets too weak, someone else can liquidate it: they help cover the debt and get some of your collateral at a discount. That keeps the peg from relying on hope alone.
What is in the repo
There are two main contracts. DecentralizedStableCoin is the ERC20 token. DSCEngine holds the real logic: deposit collateral, mint, burn, redeem, and liquidate. I used Foundry for tests and deploy scripts, including a Sepolia path if you set environment variables.
Why I made it
I wanted to understand stablecoins from the contracts outward. The useful lesson is not “how to print a token.” It is how collateral, prices, and liquidation fit together so the dollar peg has a real rule behind it.