🇺🇸 English version
UpskillFi is a DeFi platform designed to provide microloans to unemployed individuals for skill development and job search activities. Here's how it works in detail:
- Loan Application:
- Unemployed individuals create a profile on the UpskillFi platform.
- They specify the amount they need to borrow and the purpose (e.g., online course, certification, job search expenses).
- They also provide information about their employment history and future earning potential.
- Lender Participation:
- Lenders can browse loan requests and choose to fund them partially or fully.
- Lenders are incentivized by the potential return on investment through income-sharing agreements.
- Smart Contract Creation:
- When a loan is fully funded, a smart contract is created.
- This contract outlines the loan terms, including the amount, duration, and income-sharing percentage.
- Fund Disbursement:
- Funds are released to the borrower, either directly or to the training provider.
- Skill Acquisition and NFT Minting:
- As the borrower completes courses or obtains certifications, these achievements are minted as NFTs.
- These NFTs serve as proof of skill acquisition and act as collateral for the loan.
- Employment and Repayment:
- Once the borrower finds employment, the income-sharing agreement kicks in.
- A percentage of their salary is automatically deducted and distributed to lenders through the smart contract.
- Loan Closure:
- The loan is considered repaid when either the full amount plus interest is returned, or a predetermined time limit is reached.
Now, let's illustrate this concept with some Ethereum code examples, as this might make clearer the purposed design:
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; contract UpskillFi is Ownable { struct Loan { address borrower; uint256 amount; uint256 repaidAmount; uint256 incomeSharePercentage; uint256 durationInMonths; bool isActive; address[] lenders; mapping(address => uint256) lenderContributions; } struct SkillNFT { string skillName; string certificationAuthority; uint256 completionDate; } mapping(uint256 => Loan) public loans; uint256 public loanCounter; ERC721 public skillNFTs; constructor() { skillNFTs = new ERC721("UpskillFi Skill NFTs", "USNFT"); } function requestLoan(uint256 _amount, uint256 _incomeSharePercentage, uint256 _durationInMonths) external { loanCounter++; Loan storage newLoan = loans[loanCounter]; newLoan.borrower = msg.sender; newLoan.amount = _amount; newLoan.incomeSharePercentage = _incomeSharePercentage; newLoan.durationInMonths = _durationInMonths; newLoan.isActive = true; } function fundLoan(uint256 _loanId) external payable { Loan storage loan = loans[_loanId]; require(loan.isActive, "Loan is not active"); require(msg.value > 0, "Must send some ETH"); loan.lenders.push(msg.sender); loan.lenderContributions[msg.sender] += msg.value; if (address(this).balance >= loan.amount) { payable(loan.borrower).transfer(loan.amount); } } function repayLoan(uint256 _loanId) external payable { Loan storage loan = loans[_loanId]; require(loan.isActive, "Loan is not active"); require(msg.sender == loan.borrower, "Only borrower can repay"); loan.repaidAmount += msg.value; // Distribute repayment to lenders for (uint i = 0; i < loan.lenders.length; i++) { address lender = loan.lenders[i]; uint256 lenderShare = (msg.value * loan.lenderContributions[lender]) / loan.amount; payable(lender).transfer(lenderShare); } if (loan.repaidAmount >= loan.amount) { loan.isActive = false; } } function mintSkillNFT(uint256 _loanId, string memory _skillName, string memory _certificationAuthority) external { Loan storage loan = loans[_loanId]; require(msg.sender == loan.borrower, "Only borrower can mint skill NFT"); uint256 tokenId = skillNFTs.totalSupply() + 1; skillNFTs.mint(msg.sender, tokenId); SkillNFT memory newSkillNFT = SkillNFT({ skillName: _skillName, certificationAuthority: _certificationAuthority, completionDate: block.timestamp }); // In a real implementation, we would store this SkillNFT data, possibly off-chain or using IPFS } }
Note that this is a simplified implementation and would need additional features and security measures for a real-world application, such as:
- Oracle integration for verifying employment status and income
- More sophisticated repayment calculations and schedules
- Enhanced access control and security features
- Integration with decentralized exchanges for handling multiple tokens
- Improved NFT functionality, possibly using IPFS for storing metadata