This project is implements a stablecoin where users can deposit WETH and WBTC in exchange for a token that will be pegged to the USD. The main Contract is called DSCEngine.sol and it severves as the execution protocol of this project. Included is the DecentralizedStableCoin, which is a burnable ERC20 Token.
This system is designed as a minimal system and features the Token maintaining a peg of 1 Token == 1 US$
This stablecoin has the properties:
- Exogenous collateral
- US Dollar pegging
- Stabilization Algorithm
This system should always be over collateralized. At no point should the value of all collateral <= US$ backed value of all DSC
- Relative Stability: Anchored (or Pegged) -> $1.00
- Chainlink Price feed.
- Function to exchange ETH & BTC -> $$$
- Stability Mechanism (Minting): Algorithmic (Decentralized)
- People can only mint the stablecoin with enough collateral (coded)
- Collateral: Exogenous (Crypto)
- wETH
- wBTC
- Solidity (Programming Language)
- Foundry (Smart Contract Development Tool)
- Chainlink-Pricefeeds (Price Oracle)
- Openzeppelin (Smart Contract Library)
$ forge build$ forge testRun local tests on Sepolia by forking
$ forge test --fork-url $SEPOLIA_RPC_URL$ forge fmt$ forge snapshotAnvil is Foundrys local dev blockchain
$ anvil- Setup environment variables Set your SEPOLIA_RPC_URL and PRIVATE_KEY as environment variables. You can add them to a .env file, similar to what you see in .env.example.
- PRIVATE_KEY: The private key of your account (like from metamask). NOTE: FOR DEVELOPMENT, PLEASE USE A KEY THAT DOESN'T HAVE ANY REAL FUNDS ASSOCIATED WITH IT.
- SEPOLIA_RPC_URL: This is url of the sepolia testnet node you're working with. You can get setup with one for free from Alchemy. Optionally, add your ETHERSCAN_API_KEY if you want to verify your contract on Etherscan.
-
Get testnet ETH Head over to faucets.chain.link and get some testnet ETH. You should see the ETH show up in your metamask.
-
Deploy
$ forge script script/DeployDSC.s.sol --rpc-url $SEPOLIA_RPC_URL --private-key $PRIVATE_KEY