This project implements a decentralized stablecoin protocol with:
- Collateralized stablecoin (
DecentralizedStableCoin.sol) - Core engine for minting, redeeming, and liquidations (
DSCEngine.sol) - Chainlink price feed integration (
libraries/PriceFeed.sol)
contracts/— Solidity smart contractstest/— Unit, fuzz, and invariant testsscript/— Deployment and configuration scriptslib/— Local dependencies (OpenZeppelin, Chainlink, forge-std)
cargo install --path ./crates/forge --profile release --force (imp) '' git init; forge install OpenZeppelin/[email protected]; forge install smartcontractkit/chainlink-brownie-contracts ''
git clone https://github.com/foundry-rs/foundry.git cd foundry
cargo install --path ./crates/forge --profile release --force --locked
cargo install --path ./crates/cast --profile release --force --locked
cargo install --path ./crates/anvil --profile release --force --locked
cargo install --path ./crates/chisel --profile release --force --locked
''
curl -L https://foundry.paradigm.xyz | iex Set-ExecutionPolicy RemoteSigned -Scope CurrentUser irm get.scoop.sh | iex scoop install foundry
- Install Foundry dependencies (libraries are in
lib/folder):forge install OpenZeppelin/openzeppelin-contracts forge install smartcontractkit/chainlink-brownie-contracts
- Compile contracts:
forge build
- Deploy contracts (example using Foundry script):
forge script script/DeployDSC.s.sol --rpc-url <YOUR_RPC_URL> --private-key <YOUR_PRIVATE_KEY> --broadcast
Run all tests using Foundry:
forge testInteract with the protocol using scripts, tests, or a frontend dApp:
- Deposit collateral tokens (WETH, WBTC)
- Mint and burn stablecoins
- Redeem collateral
- Liquidate unhealthy positions
You can use the contract ABIs in artifacts/ to build a frontend (see previous answers for React/Vite/Next.js setup).
For more details, see the contract comments and test files.