This project implements a decentralized stablecoin system, allowing users to deposit wrapped ETH (WETH) and wrapped BTC (WBTC) as collateral to mint a USD-pegged token.
- About
- Getting Started
- Usage
- Deployment to Testnet or Mainnet
- Interacting with the Contracts
- Gas Estimation
- Formatting
This project enables users to deposit WETH and WBTC as collateral to mint a stablecoin pegged to the USD. The system includes functionalities for collateral management, stablecoin minting, and liquidation mechanisms to maintain stability.
- Git: Ensure Git is installed by running
git --version
. - Foundry: Verify installation with
forge --version
. - Make: For running predefined scripts in the Makefile.
git clone https://github.com/andrei2308/DeFi-Stablecoin.git
cd DeFi-Stablecoin
make build
To start a local Ethereum node:
make anvil
With the local node running, deploy the contracts:
make deploy
To deploy to a specific network, use:
make deploy ARGS="--network <network_name>"
Run the test suite:
make test
Generate a test coverage report:
make coverage
Set the following environment variables, preferably in a .env
file:
RPC_URL
: URL of the Ethereum node (e.g., from Alchemy).PRIVATE_KEY
: Your Ethereum account's private key (ensure this account does not hold real funds during development).
Acquire testnet ETH from faucets.chain.link and verify the balance in your wallet.
Deploy to a network (e.g., Sepolia):
make deploy ARGS="--network sepolia"
Use the predefined Makefile scripts or cast
commands to interact with the deployed contracts. Example commands:
-
Mint WETH:
make mint-weth
-
Approve WETH:
make approve-weth
-
Deposit and Mint Stablecoin:
make mint-stablecoin
Estimate gas costs:
make gas
Review the .gas-snapshot
file for details.
Ensure code consistency:
make fmt