Wallet Creation and Management
- Users can create and manage blockchain wallets directly through the platform.
- Wallets support multiple tokens, including ETH, USDC, and DAI.
- Wallet details, balances, and borrowed loans are displayed in a simple dashboard.
Loan Application for Borrowers
- Borrowers can apply for loans using either crypto assets or tokenized real-world assets as collateral.
- Crypto Assets: Borrowers can pledge cryptocurrencies such as ETH or USDT as collateral.
- Real-World Assets: Borrowers pledge real world assets as colletary and system tokenize it to NFT in order to represent in digital realm.
- We combine the behavioral, personal and cryptocurrency data along with the collateral to dynamically calculate maximum available loan for each borrower using Artifical Intelligence.
- Our AI model has 98% accuracy.
- Loans are tied to specific collateral, with smart contracts managing the collateral and loan terms.
Lending Requests for Lenders
- Lenders can create lending requests specifying the token they wish to lend, interest rates, and loan terms.
- Borrowers are matched with lenders based on token compatibility and available loan amounts.
- Lenders can accept repayment in different tokens through the platform's exchange mechanism.
Loan Repayment for Borrowers
- Borrowers can repay loans partially or fully.
- Repayments can be made in tokens other than the loan token, with exchange rates calculated automatically.
- Smart contracts update loan statuses, reduce the loan amount, and release collateral upon full repayment.
Smart Contract Integration
- Loans, collateral management, and repayments are handled via secure smart contracts.
- Smart contracts ensure transparency and automate processes like repayment validation and collateral release.
This project focuses on creating a decentralized peer to peer lending and borrowing platform with a clear emphasis on flexibility, transparency, and ease of use. Here's how the platform was built, reflecting only the components and technologies we actually implemented together:
Technologies Used
Frontend
- Svelte: Used for building a responsive and interactive user interface, including wallet management, loan application forms, and repayment workflows.
- Custom Styling: Developed a clean and functional interface with lightweight custom CSS for a seamless user experience.
Backend
- FastAPI: Served as the core backend framework for handling API requests, managing loan and repayment operations, and performing token-related logic.
- JSON Files: Used as a lightweight, temporary data storage solution to prototype and test features like loan approvals and repayments.
Blockchain Integrations
- cdp-sdk: The central library used for interacting with blockchain functionalities, including:
Wallet creation and management.
- Token deployment and swapping.
- Fund transfers between wallets.
- ERC-20 Smart Contracts: Used to handle token-based transactions and ensure transparency for loan agreements and repayments.
Exchange Rates
- Custom API Implementation: Built an exchange rate API that calculates the value of tokens using USD as a bridge, supporting flexible repayments in multiple tokens by leveraging chainlink data feed.
Custom AI Model
- Random Forest Algorithm: Used to predict the maximum available loan for borrowers based on their collateral and personal, behavioral, and cryptocurrency data.
How Components Are Connected
Wallet Management
- Wallets are created using cdp-sdk and can also display balance information for tokens like ETH, USDC, and DAI.
- Wallet data is dynamically fetched and displayed in a user-friendly dashboard.
Loan Application and Approval
- Borrowers apply for loans by specifying the token type, collateral type, and amount.
- Collateral and loan values are calculated based on custom exchange rate logic.
- Lenders' offers are matched to borrowers based on token type and valuation using a custom algorithm.
Loan Repayment
- Borrowers can repay loans flexibly in any supported token.
- If the repayment token differs from the loan token, a swap is performed using cdp-sdk.
- The smart contract is updated with repayment details, and the funds are transferred to the lender’s wallet.
Smart Contracts
- Smart contracts (ERC-20) are deployed dynamically to manage loan terms.
- Contracts track balances and ensure repayment updates are recorded on-chain for transparency.
Notable Hacks & Customizations
Dynamic Loan Matching
- Implemented a custom algorithm to prioritize matching based on the same token type, with fallback logic for cross-token conversions.
- Flexible Repayment Options
Designed a repayment system that allows borrowers to pay in any supported token, using real-time exchange rates to calculate equivalent repayment amounts.
- Prototyping with JSON
Prototyped key functionalities, like loan applications and repayments, using JSON files before scaling up with more complex integrations.
- Direct Blockchain Interactions
Used cdp-sdk for essential blockchain operations, such as deploying tokens, executing trades, and transferring funds, without relying on third-party wallet providers or protocols.