The DeFi lending interface for DebtHook Protocol
This is the Next.js frontend application for DebtHook Protocol, providing a user-friendly interface for:
- Creating and browsing loan offers
- Managing lending and borrowing positions
- Monitoring loan health and liquidations
- Integrating with EigenLayer AVS for optimized order matching
Live URL: https://v0-humane-banque.vercel.app
- DebtHook:
0x49e39eFDE0C93F6601d84cb5C6D24c1B23eB00C8 - DebtOrderBook:
0xce060483D67b054cACE5c90001992085b46b4f66 - USDC:
0x73CFC55f831b5DD6E5Ee4CEF02E8c05be3F069F6
- ServiceManager:
0x3333Bc77EdF180D81ff911d439F02Db9e34e8603
- Create loan offers with custom terms (amount, rate, duration)
- Sign orders off-chain (gasless via EIP-712)
- View and manage active loans
- Track interest earnings
- Browse available loan offers
- Filter by amount, rate, and duration
- Accept loans with one-click execution
- Monitor collateral health factor
- Repay loans before maturity
- Batch Matching: Submit orders to EigenLayer AVS for optimal rate discovery
- Real-time Updates: Supabase integration for live order book
- Smart Wallet Support: Works with both EOAs and account abstraction wallets
- Mobile Responsive: Full functionality on all devices
- Framework: Next.js 14 with App Router
- Language: TypeScript
- Styling: Tailwind CSS with shadcn/ui
- Web3: Privy (wallet connection), Viem (contract interactions)
- Database: Supabase for off-chain order storage
- Deployment: Vercel
- Node.js v18+
- pnpm package manager
- Environment variables (see
.env.example)
# Clone the repository
git clone <repo-url>
cd debt-hook/dapp
# Install dependencies
pnpm install
# Copy environment variables
cp .env.example .env.local
# Edit .env.local with your values
# Start development server
pnpm dev# Privy
NEXT_PUBLIC_PRIVY_APP_ID=
# Supabase
NEXT_PUBLIC_SUPABASE_URL=
NEXT_PUBLIC_SUPABASE_ANON_KEY=
# Contract Addresses (Unichain Sepolia)
NEXT_PUBLIC_DEBT_HOOK_ADDRESS=0x49e39eFDE0C93F6601d84cb5C6D24c1B23eB00C8
NEXT_PUBLIC_DEBT_ORDER_BOOK_ADDRESS=0xce060483D67b054cACE5c90001992085b46b4f66
NEXT_PUBLIC_USDC_ADDRESS=0x73CFC55f831b5DD6E5Ee4CEF02E8c05be3F069F6
# EigenLayer (Ethereum Sepolia)
NEXT_PUBLIC_SERVICE_MANAGER_ADDRESS=0x3333Bc77EdF180D81ff911d439F02Db9e34e8603
# Network
NEXT_PUBLIC_CHAIN_ID=1301
NEXT_PUBLIC_RPC_URL=https://sepolia.unichain.orgdapp/
├── app/ # Next.js app router pages
│ ├── market/ # Loan marketplace
│ ├── dashboard/ # Position management
│ └── layout.tsx # Root layout with providers
├── components/ # React components
│ ├── ui/ # shadcn/ui components
│ ├── market/ # Market-specific components
│ └── dashboard/ # Dashboard components
├── lib/ # Utilities and hooks
│ ├── contracts/ # Contract ABIs and addresses
│ ├── hooks/ # Custom React hooks
│ └── supabase/ # Supabase client
└── public/ # Static assets
- Connect wallet via Privy
- Navigate to Market page
- Click "Create Offer"
- Set terms (amount, rate, duration)
- Sign EIP-712 message
- Order stored in Supabase
- Browse available offers
- Filter/sort as needed
- Click "Accept" on desired offer
- Approve USDC (if needed)
- Confirm transaction
- Deposit collateral
- Create order with flexible parameters
- Choose "Submit to AVS" option
- Order sent to EigenLayer ServiceManager
- Operator matches and executes
- Receive notification of match
The app is automatically deployed via Vercel:
# Manual deployment
vercel --prod
# Environment variables must be set in Vercel dashboard# Build for production
pnpm build
# Run production build locally
pnpm start
# Type checking
pnpm typecheck
# Linting
pnpm lint# Run tests
pnpm test
# Run tests in watch mode
pnpm test:watch
# E2E tests
pnpm test:e2e- All contract interactions are validated client-side
- EIP-712 signatures prevent order tampering
- Supabase RLS policies protect user data
- Environment variables never exposed to client
- CORS properly configured for API routes
-
Wallet Connection Issues
- Clear browser cache
- Check Privy app ID
- Verify chain configuration
-
Transaction Failures
- Ensure sufficient gas
- Check token approvals
- Verify contract addresses
-
Order Not Appearing
- Check Supabase connection
- Verify signature format
- Check browser console for errors
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Open a Pull Request
MIT