Recharge Your NFT Portfolio with Liquidity
Distant Finance is a decentralized peer-to-peer (P2P) NFT lending and borrowing platform built on Base blockchain. The platform enables NFT holders to unlock liquidity from their digital assets by using them as collateral for loans, while providing lenders with attractive yield opportunities.
- NFT Collateralization: Lock your ERC-721 NFTs as collateral to secure loans
- Flexible Loan Terms: Choose loan duration (7-90 days) and set your preferred interest rates
- Multiple Payment Options: Borrow in ETH or WETH
- Secure Collateral Management: NFTs are safely held in a dedicated TokenLocker contract
- Transparent Interest Calculation: Dynamic interest calculation based on block-based accrual
- Competitive Yields: Earn attractive interest rates on your capital
- Bidding System: Propose custom interest rates for loan requests
- Risk Management: Collateralized loans with liquidation mechanisms
- Portfolio Diversification: Lend across various NFT collections
- Automated Liquidation: Protection through time-based liquidation system
- Multi-Collection Support: Support for verified NFT collections
- Real-time Analytics: Protocol statistics and performance metrics
- User Dashboard: Comprehensive loan management interface
- Mobile Responsive: Seamless experience across all devices
- Dark/Light Mode: Customizable UI themes
P2PLending.sol: Main lending protocol handling loan creation, bidding, and repaymentTokenLocker.sol: Secure NFT custody and collateral managementProtocol.sol(DistantFinance): Protocol governance, fee management, and collection verification
- ReentrancyGuard: Protection against reentrancy attacks
- Pausable: Emergency pause functionality for security
- Access Control: Role-based permissions and admin functions
- Fee Management: Configurable protocol and security fees
- Interest Calculation: Block-based dynamic interest accrual
- Framework: Next.js 14 with App Router
- Styling: Tailwind CSS with custom components
- Web3 Integration: Wagmi + Viem for blockchain interactions
- Wallet Connection: Reown AppKit (formerly WalletConnect)
- UI Components: Radix UI with custom theming
- State Management: Apollo Client for GraphQL data
- Animations: Framer Motion for smooth transitions
- Landing Page: Protocol overview and statistics
- Dashboard: User loan management and NFT portfolio
- Loans Marketplace: Browse and interact with available loans
- Swap Interface: Token exchange functionality
distant--finance/
βββ contracts/ # Smart contract development
β βββ contracts/
β β βββ P2PLending.sol # Main lending contract
β β βββ TokenLocker.sol # NFT collateral management
β β βββ Protocol.sol # Protocol governance
β β βββ interfaces/ # Contract interfaces
β βββ deploy/ # Deployment scripts
β βββ deployments/base/ # Base network deployments
β βββ scripts/ # Utility scripts
βββ frontend/ # Next.js application
β βββ src/
β β βββ app/ # App router pages
β β βββ components/ # Reusable UI components
β β βββ ui/ # Page-specific components
β β βββ hooks/ # Custom React hooks
β β βββ lib/ # Utility functions
β β βββ config/ # Configuration files
β β βββ providers/ # Context providers
β βββ public/ # Static assets
βββ collections/ # NFT collection metadata
- Node.js 18+ and npm/yarn/pnpm
- Git
-
Clone the repository
git clone https://github.com/IbrahimIjai/distant--finance.git cd distant--finance -
Install Frontend Dependencies
cd frontend npm install # or yarn install # or pnpm install
-
Install Contract Dependencies
cd ../contracts npm install -
Environment Setup
# Frontend (.env.local) NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID=your_project_id NEXT_PUBLIC_GRAPHQL_ENDPOINT=your_subgraph_endpoint # Contracts (.env) DEPLOYER_PRIVATE_KEY=your_private_key BASESCAN_API_KEY=your_basescan_api_key
-
Start Frontend Development Server
cd frontend npm run devOpen http://localhost:3000 in your browser.
-
Compile Smart Contracts
cd contracts npm run compile -
Deploy Contracts (Base Testnet)
npm run deploy
- P2PLending:
0x8F4A73208f6D7ccf59cfF8f082B68F72284f7a99 - TokenLocker:
[Contract Address] - DistantFinance Protocol:
[Contract Address]
- Solidity Version: ^0.8.20
- OpenZeppelin Integration: Security and standard implementations
- Gas Optimization: Efficient contract design with optimized operations
- Upgradeable Architecture: Proxy pattern for future improvements
- Next.js 14: Modern React framework with server-side rendering
- TypeScript: Type-safe development
- Tailwind CSS: Utility-first styling framework
- Wagmi/Viem: Type-safe Ethereum development
- Apollo Client: GraphQL data management
- Framer Motion: Animation library
- Reentrancy Protection: SafeGuards against common attacks
- Access Control: Multi-level permission system
- Pausable Operations: Emergency stop functionality
- Input Validation: Comprehensive parameter checking
- Time-based Liquidation: Automated collateral recovery
We welcome contributions from the community! Here's how you can help:
-
Fork the Repository
git fork https://github.com/IbrahimIjai/distant--finance.git
-
Create a Feature Branch
git checkout -b feature/your-feature-name
-
Code Standards
- Follow existing code style and conventions
- Add comprehensive tests for new features
- Update documentation as needed
- Ensure all tests pass before submitting
-
Commit Guidelines
git commit -m "feat: add new lending feature" git commit -m "fix: resolve interest calculation bug" git commit -m "docs: update API documentation"
-
Submit Pull Request
- Provide clear description of changes
- Include screenshots for UI changes
- Reference any related issues
- Security Audits: Help review and improve contract security
- Gas Optimization: Optimize contract operations for lower gas costs
- Feature Development: Add new lending/borrowing features
- Testing: Expand test coverage and edge cases
- UI/UX Improvements: Enhance user experience and interface design
- Mobile Optimization: Improve mobile responsiveness
- Performance: Optimize loading times and interactions
- Accessibility: Improve platform accessibility features
- API Documentation: Expand technical documentation
- User Guides: Create comprehensive user tutorials
- Developer Docs: Improve development setup guides
Please use GitHub Issues to report bugs or request features:
- Bug Report: Describe the issue, steps to reproduce, and expected behavior
- Feature Request: Explain the feature, use case, and potential implementation
This project is licensed under the MIT License - see the LICENSE file for details.
- Website: https://distant-finance.vercel.app
- Documentation: [Coming Soon]
- Twitter: [Coming Soon]
- Discord: [Coming Soon]
This project is experimental and under active development. Use at your own risk. Always do your own research and never invest more than you can afford to lose.
Built with β€οΈ by the Distant Finance Team