A comprehensive DeFi lending and borrowing platform built on the Celo blockchain, featuring cross-currency lending, AI-powered yield optimization, and automated yield farming strategies.
CrosFi is a next-generation DeFi protocol that enables users to lend and borrow across multiple currencies on the Celo network. The platform combines traditional lending mechanics with innovative AI-driven yield optimization and automated strategies to maximize returns for users.
- Cross-Currency Lending - Lend and borrow across CELO, cUSD, USDC, cEUR, cREAL, and eXOF
- Dynamic Interest Rates - Algorithmic interest rate models based on supply and demand
- Collateral Management - Flexible collateral system with multiple supported assets
- Liquidation Protection - Automated liquidation system to maintain protocol health
- Real-time Oracle Integration - Chainlink-powered price feeds for accurate valuations
- Intelligent Recommendations - AI analyzes market data to suggest optimal lending strategies
- Risk Profiling - Personalized recommendations based on user risk tolerance
- Market Trend Analysis - Real-time analysis of DeFi trends and yield opportunities
- Yield Forecasting - Predictive models for future yield potential
- NVIDIA Nemotron Integration - Advanced AI model for market analysis
- Mento Yield Strategy - Automated yield farming through Mento protocol
- Multi-Token Vault - Unified vault for managing multiple token positions
- Strategy Optimization - Dynamic strategy adjustments based on market conditions
- Gas Optimization - Efficient transaction batching and optimization
- Modern UI/UX - Beautiful, responsive interface with dark/light themes
- Real-time Updates - Live data feeds and instant transaction updates
- Mobile-First Design - Optimized for all devices and screen sizes
- Wallet Integration - Support for MetaMask, WalletConnect, and other popular wallets
- Transaction Management - Comprehensive transaction history and status tracking
- LendingPool - Core lending and borrowing logic
- MultiTokenVault - Unified vault for yield farming strategies
- InterestModel - Dynamic interest rate calculations
- OracleAdapter - Price feed integration and management
- CollateralManager - Collateral tracking and liquidation logic
- DebtTokens - Individual debt token contracts for each supported currency
- Next.js 16 - React framework with App Router
- TypeScript - Full type safety and developer experience
- Tailwind CSS 4 - Utility-first styling framework
- Framer Motion - Smooth animations and transitions
- Recharts - Data visualization and analytics
- Ethers.js - Ethereum/Celo blockchain interaction
- Node.js/Express - API server for off-chain data
- WebSocket - Real-time data streaming
- Prisma - Database ORM for user data
- Cron Jobs - Automated maintenance tasks
- OpenRouter API - AI model integration
- CoinGecko API - Market data aggregation
- DeFiLlama API - DeFi protocol analytics
- Custom ML Models - Yield prediction and optimization
- LendingPool: 0x46e9007E67ac1fd5F63Ec817809FA15aE65F62B5
- MultiTokenVault: 0x32D94e8c16370b718041246C18ee914283DFEAa7
- InterestModel: 0x292677b28485D8d2dDF9F93D44361704C546ca4f
- OracleAdapter: 0xFE175E3377051Bd38E97b2ea2668f59214c06Db6
- CollateralManager: 0x519B3d3b3493707F4F335cbbF98B13e80C0d65B2
- MentoYieldStrategy: 0xB398742d79dfd6Bf2169891888c456B96C1257eD
- cUSD DebtToken: 0x610d8fB3E661cd58da8145448891F4A5CE4DF293
- USDC DebtToken: 0x5D28C93CC22baaac35A2F3a2a69cABC6321Edfb3
- CELO DebtToken: 0xa59844f89b26Dd46fb6eef0c5687907c41068C6D
- cUSD: 0x874069Fa1Eb16D44d622F2e0Ca25eeA172369bC1
- USDC: 0x41f4C5E67e9Ecf8C2c53d9B25C4c5B4f8C26b6e8
- CELO: 0x0000000000000000000000000000000000000000 (Native)
- cEUR: 0x10c892A6EC43a53E45D0B916B4b7D383B1b78C0F
- cREAL: 0xE4D517785D091D3c54818832dB6094bcc2744545
- eXOF: 0xE919F65739c26a42616b7b8eedC6b5524d1e3aC4
- Network: Celo Sepolia Testnet
- Deployer: 0x7140F4EEaAbeAa746dF7F743b568cC3D096161df
- Deployed At: 2025-10-25T21:55:09.008Z
- Block Explorer: CeloScan Sepolia
To verify the smart contracts, judges can:
-
Click on any contract address in the list above to view it on CeloScan Sepolia
-
Check the "Contract" tab to view the verified source code
-
Verify the contract matches the expected functionality:
- LendingPool: Core lending and borrowing logic
- MultiTokenVault: Yield farming vault with multi-token support
- InterestModel: Dynamic interest rate calculations
- OracleAdapter: Price feed integration
- CollateralManager: Collateral tracking and liquidation
- DebtTokens: Individual debt token contracts
- MentoYieldStrategy: Automated yield farming strategy
-
Verify deployment details:
- All contracts deployed by: 0x7140F4EEaAbeAa746dF7F743b568cC3D096161df
- Network: Celo Sepolia Testnet
- Deployment timestamp: 2025-10-25T21:55:09.008Z
- Node.js 18.0 or later
- npm or yarn or pnpm
- Git
- MetaMask or compatible Web3 wallet
-
Clone the repository
git clone https://github.com/your-username/crosfi.git cd crosfi -
Install dependencies
npm install # or yarn install # or pnpm install
-
Set up environment variables
cp .env.example .env.local
Configure your
.env.local:# Celo Network Configuration NEXT_PUBLIC_CELO_RPC_URL=https://sepolia-forno.celo-testnet.org NEXT_PUBLIC_CELO_CHAIN_ID=44787 # Contract Addresses (Sepolia Testnet) NEXT_PUBLIC_LENDING_POOL=0x46e9007E67ac1fd5F63Ec817809FA15aE65F62B5 NEXT_PUBLIC_VAULT=0x32D94e8c16370b718041246C18ee914283DFEAa7 NEXT_PUBLIC_INTEREST_MODEL=0x292677b28485D8d2dDF9F93D44361704C546ca4f NEXT_PUBLIC_ORACLE_ADAPTER=0xFE175E3377051Bd38E97b2ea2668f59214c06Db6 NEXT_PUBLIC_COLLATERAL_MANAGER=0x519B3d3b3493707F4F335cbbF98B13e80C0d65B2 # AI Configuration NEXT_PUBLIC_OPENROUTER_API_KEY=your_openrouter_api_key # Backend Configuration NEXT_PUBLIC_API_URL=http://localhost:3001
-
Start the development server
npm run dev # or yarn dev # or pnpm dev
-
Start the backend server (optional)
npm run backend # or run both frontend and backend npm run dev:full -
Open your browser Navigate to http://localhost:3000
- Celo Faucet: Visit Celo Faucet
- Chainlink Faucet: Chainlink Faucet
- Add to MetaMask: Use the contract addresses above to add tokens to your wallet
crosfi/
โโโ app/ # Next.js App Router
โ โโโ (lending)/ # Lending pages
โ โ โโโ borrow/ # Borrowing interface
โ โ โโโ lend/ # Lending interface
โ โโโ ai-yield/ # AI Yield Generator
โ โโโ analytics/ # Protocol analytics
โ โโโ api/ # API routes
โ โโโ dashboard/ # User dashboard
โ โโโ markets/ # Market overview
โ โโโ positions/ # User positions
โ โโโ rates/ # Interest rates
โ โโโ vault/ # Yield farming vault
โ โโโ ... # Other pages
โโโ components/ # React components
โ โโโ ai/ # AI-related components
โ โ โโโ RecommendationCard.tsx
โ โ โโโ MarketTrendAnalyzer.tsx
โ โ โโโ YieldForecastChart.tsx
โ โ โโโ RiskProfileSelector.tsx
โ โโโ currency/ # Currency components
โ โโโ lending/ # Lending components
โ โโโ vault/ # Vault components
โ โโโ ui/ # UI components
โ โโโ ... # Other components
โโโ contracts/ # Smart contracts
โ โโโ lending/ # Lending contracts
โ โโโ vault/ # Vault contracts
โ โโโ libraries/ # Contract libraries
โ โโโ mocks/ # Mock contracts
โ โโโ oracles/ # Oracle contracts
โ โโโ strategies/ # Yield strategies
โโโ lib/ # Utility libraries
โ โโโ contracts/ # Contract interactions
โ โโโ token-icons.ts # Token icon configuration
โ โโโ currency-config.ts # Currency configuration
โ โโโ api-client.ts # API client
โ โโโ ... # Other utilities
โโโ backend/ # Backend services
โ โโโ src/ # Backend source code
โ โโโ prisma/ # Database schema
โ โโโ scripts/ # Backend scripts
โโโ keeper/ # Keeper service
โ โโโ src/ # Keeper source code
โ โโโ tasks/ # Automated tasks
โโโ scripts/ # Deployment scripts
โโโ public/ # Static assets
โโโ ... # Configuration files
/* Primary Colors */
--celo-green: #35D07F
--celo-gold: #FBCC5C
--celo-blue: #4285F4
/* Semantic Colors */
--success: #10B981
--warning: #F59E0B
--error: #EF4444
--info: #3B82F6- Font Family: Inter (Google Fonts)
- Headings: Bold, responsive sizing
- Body Text: Regular weight, optimized for readability
- Code: JetBrains Mono for technical content
- Buttons: Primary, secondary, outline, and ghost variants
- Cards: Consistent padding, borders, and hover effects
- Forms: Accessible inputs with proper validation
- Navigation: Responsive header with mobile menu
- Token Icons: Official token icons with fallback support
# Frontend Development
npm run dev # Start development server
npm run build # Build for production
npm run start # Start production server
npm run lint # Run ESLint
# Backend Development
npm run backend # Start backend server
npm run dev:full # Start both frontend and backend
# Smart Contract Development
npx hardhat compile # Compile contracts
npx hardhat test # Run tests
npx hardhat deploy # Deploy contracts
npx hardhat verify # Verify contracts on block explorer-
Install Hardhat dependencies
npm install --save-dev hardhat @nomicfoundation/hardhat-toolbox
-
Compile contracts
npx hardhat compile
-
Run tests
npx hardhat test -
Deploy to Alfajores
npx hardhat run scripts/deploy-alfajores.js --network sepolia
- ESLint - Code linting and error detection
- Prettier - Code formatting
- TypeScript - Type checking
- Conventional Commits - Commit message format
- Connect repository to Vercel
- Configure build settings:
- Build Command:
npm run build - Output Directory:
.next
- Build Command:
- Set environment variables in Vercel dashboard
- Deploy - Automatic deployments on push
-
Set up environment variables
PRIVATE_KEY=your_private_key CELO_RPC_URL=https://sepolia-forno.celo-testnet.org CELOSCAN_API_KEY=your_celoscan_api_key
-
Deploy contracts
npx hardhat run scripts/deploy-alfajores.js --network sepolia
-
Verify contracts
npx hardhat verify --network sepolia <CONTRACT_ADDRESS>
The backend can be deployed to any Node.js hosting platform:
- Railway
- Heroku
- DigitalOcean App Platform
- AWS EC2
The AI Yield Generator uses advanced machine learning to analyze market conditions and provide personalized yield recommendations:
- Market Analysis: Real-time analysis of DeFi protocols, yield rates, and market trends
- Risk Assessment: Comprehensive risk profiling based on volatility, liquidity, and market conditions
- Yield Forecasting: Predictive models for future yield potential using historical data
- Personalization: Recommendations tailored to user risk tolerance and investment goals
CrosFi enables seamless lending and borrowing across multiple currencies:
- Multi-Asset Support: CELO, cUSD, USDC, cEUR, cREAL, eXOF
- Dynamic Interest Rates: Algorithmic rates based on supply and demand
- Flexible Collateral: Use any supported asset as collateral
- Liquidation Protection: Automated liquidation system with health factor monitoring
- Mento Integration: Automated yield farming through Mento protocol
- Strategy Optimization: Dynamic adjustments based on market conditions
- Gas Optimization: Efficient transaction batching and optimization
- Risk Management: Automated risk assessment and position management
- OpenZeppelin Libraries - Battle-tested security patterns
- Reentrancy Protection - Protection against reentrancy attacks
- Access Control - Role-based access control for administrative functions
- Oracle Integration - Secure price feed integration with Chainlink
- Liquidation Logic - Robust liquidation system to maintain protocol health
- Input Validation - Comprehensive form validation
- XSS Protection - Content Security Policy implementation
- HTTPS Only - Secure connections enforced
- Wallet Security - Secure wallet integration with proper error handling
# Run all tests
npx hardhat test
# Run specific test file
npx hardhat test test/LendingPool.test.js
# Run tests with coverage
npx hardhat coverage# Run component tests
npm run test
# Run E2E tests
npm run test:e2e- Image Optimization - Next.js Image component with WebP support
- Code Splitting - Automatic route-based splitting
- Lazy Loading - Components loaded on demand
- Bundle Analysis - Optimized bundle sizes
- Caching - Proper cache headers and service worker
- Lighthouse Score: 95+ across all categories
- Core Web Vitals: Excellent performance
- Bundle Size: Optimized for fast loading
- Accessibility: WCAG 2.1 AA compliant
We welcome contributions! Please follow these steps:
- Fork the repository
- Create a feature branch
git checkout -b feature/amazing-feature
- Make your changes
- Add tests if applicable
- Commit your changes
git commit -m 'Add amazing feature' - Push to the branch
git push origin feature/amazing-feature
- Submit a pull request
- Follow the existing code style
- Write meaningful commit messages
- Add documentation for new features
- Test your changes thoroughly
- Update README if needed
This project is licensed under the MIT License - see the LICENSE file for details.
- Celo Foundation - For the amazing blockchain platform
- Next.js Team - For the excellent React framework
- Tailwind CSS - For the utility-first CSS framework
- OpenZeppelin - For secure smart contract libraries
- Chainlink - For reliable oracle services
- NVIDIA - For AI model integration
- shadcn/ui - For the component library
- Documentation: docs.crosfi.com
- Community: Discord
- Issues: GitHub Issues
- Email: support@crosfi.com
- Core lending protocol
- Multi-token vault
- Basic UI/UX
- Smart contract deployment
- AI Yield Generator
- Advanced analytics
- Mobile optimization
- Backend services
- Governance token
- Advanced strategies
- Cross-chain integration
- Mobile app
- Institutional features
- Advanced AI models
- Layer 2 integration
- Global expansion
Built with โค๏ธ for the Celo ecosystem
CrosFi - Revolutionizing cross-currency lending in DeFi