A decentralized lending protocol with multi-asset collateral support, automatic rebalancing, and anti-liquidation protection. Built on Arbitrum Sepolia.
- β Multi-Asset Collateral: Deposit USDC, Yield tokens, and RWA tokens
- β Flexible Lending: Borrow USDC with customizable loan durations
- β Risk-Weighted Assets: Different collateral types have different risk weights
- β Real-Time Oracle: Dynamic price feeds for all assets
- β Anti-Liquidation Protection: Automatic protection during market volatility
- β Automated Rebalancing: Portfolio optimization across asset types
- β Yield Management: Earn yield on deposited assets
- π¨ Modern UI: Clean, responsive interface with dark mode
- π Wallet Integration: MetaMask, WalletConnect, and more
- π Real-Time Dashboard: Live position tracking and health factor monitoring
- β‘ Instant Updates: Automatic data refresh every 10 seconds
- π― User-Friendly: Simple deposit, borrow, and repay flows
- π° Built-in Faucet: Get test tokens directly from the interface
secp-protocol/
βββ smart-contracts/ # Solidity contracts and deployment scripts
β βββ contracts/ # Smart contract source files
β βββ scripts/ # Deployment and interaction scripts
β βββ test/ # Contract tests
β βββ deployments/ # Deployed contract addresses
β
βββ frontend/ # Next.js frontend application
βββ src/
β βββ app/ # Next.js pages
β βββ components/ # React components
β βββ config/ # Configuration (contracts, wagmi)
β βββ hooks/ # Custom React hooks
βββ public/ # Static assets
- Node.js 18 or higher
- Git
- MetaMask or another Web3 wallet
- Arbitrum Sepolia testnet ETH
The contracts are already deployed on Arbitrum Sepolia testnet:
cd smart-contracts
npm install
# View deployment addresses
cat deployments/arbitrum-sepolia.jsonDeployed Contracts:
- SmartVault:
0x2e8026bc45fe0fae2b159a3c82cada12670769e2 - LoanManager:
0xba5be20d3d96e89ffbf20f9812df73cada28e376 - CollateralManager:
0xfa7e1a8e4be412b9c7efcbb5f14ddcc5820da599 - See all 10 contracts
cd frontend
npm install
npm run devπ Detailed Guide: See frontend/QUICKSTART.md
-
Connect Wallet
- Click "Connect Wallet" button
- Select MetaMask
- Switch to Arbitrum Sepolia network
-
Get Test Tokens
- Use the Token Faucet on the page
- Click "Get 1,000 tokens" for each token type
- Approve transactions in your wallet
-
Deposit Collateral
- Select a token (USDC, Yield, or RWA)
- Enter amount
- Approve and deposit
-
Borrow USDC
- View your max borrowable amount (75% of collateral)
- Enter borrow amount and duration
- Confirm transaction
-
Monitor Position
- Watch your health factor (keep it above 1.0)
- Track collateral value and debt
- View real-time updates
Your position's safety indicator:
- > 1.5: Safe β
- 1.0 - 1.5: Moderate
β οΈ - < 1.0: At Risk β (risk of liquidation)
Different assets have different risk weights affecting their collateral value:
- RWA Token: 100% (best)
- USDC: 90%
- Yield Token: 80%
You can borrow up to 75% of your collateral value, leaving a safety buffer.
Deposit: 1,000 USDC
Collateral Value: $900 (90% weight)
Max Borrow: $675 (75% of collateral)
Health Factor: >2.0 β
Deposit: 600 RWA tokens @ $1.50 each
Collateral Value: $900 (100% weight)
Max Borrow: $675
Health Factor: >2.0 β
Deposit:
- 400 USDC = $360 collateral
- 300 RWA = $450 collateral
- 200 Yield = $168 collateral
Total Collateral: $978
Max Borrow: $733.50
cd smart-contracts
# Compile contracts
npm run compile
# Run tests
npm test
# Deploy (already done)
npm run deploy:arbitrum
# Setup protocol
npm run setup:arbitrum
# Interact with protocol
npm run interact:arbitrumcd frontend
# Install dependencies
npm install
# Run development server
npm run dev
# Build for production
npm run build
# Start production server
npm start-
Smart Contract Security
- OpenZeppelin battle-tested contracts
- Comprehensive testing
- Access control mechanisms
-
Anti-Liquidation Protection
- Automatic protection activation
- Time-based protection windows
- Gradual debt repayment
-
Risk Management
- Multiple collateral types
- Dynamic risk assessment
- Real-time health factor monitoring
- Network: Arbitrum Sepolia (Testnet)
- Chain ID: 421614
- RPC: https://sepolia-rollup.arbitrum.io/rpc
- Explorer: https://sepolia.arbiscan.io
- Open MetaMask
- Click network dropdown
- "Add Network" β "Add network manually"
- Enter Arbitrum Sepolia details above
cd smart-contracts
npm test- Connect wallet
- Mint test tokens
- Deposit collateral
- Borrow USDC
- Check health factor
- Verify all UI updates correctly
- Solidity 0.8.28
- Hardhat 3.1.8
- OpenZeppelin 5.4.0
- Viem for TypeScript integration
- Next.js 14 (App Router)
- TypeScript
- Tailwind CSS
- Wagmi (React Hooks for Ethereum)
- RainbowKit (Wallet Connection)
- Viem (Ethereum Library)
Issue: Wallet won't connect
- Solution: Refresh page, ensure MetaMask is unlocked
Issue: Transactions failing
- Solution: Check you have testnet ETH for gas fees
Issue: Can't deposit
- Solution: Make sure to approve token spending first
Issue: Data not loading
- Solution: Verify you're on Arbitrum Sepolia network
See QUICKSTART.md for more troubleshooting tips.
- Mainnet deployment
- Additional token support
- Advanced analytics dashboard
- Mobile app
- Governance token
- Cross-chain support
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
MIT License - see LICENSE file for details
- OpenZeppelin for secure contract libraries
- Arbitrum for the L2 infrastructure
- Hardhat for development tools
- Next.js and Vercel for frontend framework
Need help?
- π Check the documentation
- π Open an issue on GitHub
- π¬ Review troubleshooting guides
- π Search on Arbitrum Sepolia explorer
Built with β€οΈ for the DeFi community
π Star this repo if you found it helpful!