A modern, responsive frontend for the Decentralized Stable Coin (DSC) protocol built with Next.js, TypeScript, and Web3 technologies.
This repository contains the frontend application for the DSC Protocol. For the complete system:
Component | Repository | Description |
---|---|---|
Smart Contracts | DSC | Core protocol logic, deployment scripts, and tests |
Frontend Application | DSC_FE | Next.js web interface for interacting with the protocol (this repository) |
π‘ Quick Start: Deploy the smart contracts from the DSC repository first, then run this frontend to interact with your deployed contracts.
- π Wallet Integration: Connect with MetaMask and other wallets via RainbowKit
- π° Collateral Management: Deposit and redeem WETH/WBTC collateral
- πͺ DSC Operations: Mint and burn DSC stablecoins
- π Health Factor Monitoring: Real-time health factor tracking with warnings
- β‘ Liquidation Interface: Liquidate undercollateralized positions
- π Protocol Statistics: Live price feeds and protocol metrics
- π Dark Mode: Full dark/light theme support
- π± Responsive Design: Works on desktop and mobile devices
Clean, modern landing page introducing the DSC Protocol
Seamless wallet integration with RainbowKit
Comprehensive dashboard showing portfolio overview, health factor, and protocol statistics
Intuitive interface for depositing and redeeming WETH/WBTC collateral
Simple DSC minting and burning interface with real-time health factor monitoring
Detailed protocol analytics and performance metrics
- Framework: Next.js 15 with App Router
- Language: TypeScript
- Styling: Tailwind CSS v4
- Web3: Wagmi v2, Viem, RainbowKit
- State Management: Zustand, TanStack Query
- UI Components: Headless UI, Heroicons
- Notifications: React Hot Toast
Before running the frontend, ensure you have the DSC protocol smart contracts deployed locally:
-
Clone and set up the smart contracts repository:
git clone https://github.com/ProngsDev/DSC.git cd DSC make install
-
Start Anvil blockchain:
make anvil
-
Deploy contracts (in a new terminal):
make deploy-local make export-frontend
-
Get test tokens:
make deposit-local
-
Install dependencies:
npm install
-
Configure environment:
- Copy
.env.local
and update contract addresses if needed - The default addresses should work with
make deploy-local
- Copy
-
Start the development server:
npm run dev
-
Open the application:
- Navigate to http://localhost:3000
- Connect your wallet (use the test account or import the private key)
- Start using the DSC protocol!
- Network Name: Anvil Local
- RPC URL: http://localhost:8545
- Chain ID: 31337
- Currency Symbol: ETH
Use the default Anvil test account:
- Private Key:
0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
- Address:
0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266
- Select WETH or WBTC
- Enter amount to deposit
- Approve token spending (first time)
- Confirm deposit transaction
- Enter DSC amount to mint
- Ensure sufficient collateral (health factor > 1.0)
- Confirm mint transaction
- Keep health factor above 1.0 to avoid liquidation
- Yellow warning appears below 1.1
- Red alert appears below 1.0 (liquidatable)
- Burn DSC to reduce debt
- Redeem collateral when health factor allows
- Maintain minimum collateralization ratio
- Find users with health factor < 1.0
- Cover their debt to earn 10% bonus
- Help maintain protocol stability
src/
βββ app/ # Next.js app router
βββ components/ # React components
β βββ providers/ # Context providers
β βββ Dashboard.tsx # Main dashboard
β βββ Header.tsx # Navigation header
β βββ UserPortfolio.tsx # Portfolio overview
β βββ CollateralManager.tsx # Collateral operations
β βββ DSCManager.tsx # DSC mint/burn
β βββ LiquidationMonitor.tsx # Liquidation interface
β βββ ProtocolStats.tsx # Protocol statistics
βββ lib/
β βββ hooks/ # Custom React hooks
β βββ abis/ # Contract ABIs
β βββ config.ts # Wagmi configuration
β βββ utils.ts # Utility functions
βββ types/ # TypeScript definitions
npm run dev
- Start development servernpm run build
- Build for productionnpm run start
- Start production servernpm run lint
- Run ESLint
Key environment variables in .env.local
:
NEXT_PUBLIC_CHAIN_ID=31337
NEXT_PUBLIC_RPC_URL=http://localhost:8545
NEXT_PUBLIC_DSC_ADDRESS=0x...
NEXT_PUBLIC_DSC_ENGINE_ADDRESS=0x...
NEXT_PUBLIC_WETH_ADDRESS=0x...
NEXT_PUBLIC_WBTC_ADDRESS=0x...
-
"Contract not deployed":
- Ensure Anvil is running
- Run
make deploy-local
in DSC directory - Check contract addresses in
.env.local
-
"Insufficient funds":
- Run
make deposit-local
to get test tokens - Ensure you're using the correct test account
- Run
-
"Transaction failed":
- Check health factor before minting
- Ensure sufficient allowances
- Verify network connection
-
"Wallet not connecting":
- Add Anvil network to MetaMask
- Import test account private key
- Refresh page and try again
If you encounter persistent issues:
-
Reset Anvil blockchain:
# Stop Anvil (Ctrl+C) and restart make anvil
-
Redeploy contracts:
make deploy-local make export-frontend
-
Clear browser cache and reconnect wallet
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
This project is licensed under the MIT License.