// SPDX-License-Identifier: MIT pragma solidity ^0.7.1; contract FastLoan { // consider using access control from openzepplin for Escrow part. struct LoanRequest { address borrower; uint projectID; string projectTitle; uint projectDuration; uint amount; //uint bonus; //uint certifications -offchain; //string description - offchain; } struct Loan { uint id; address lender; address borrower; uint amount; uint endTime; uint interest; uint projectID; string projectTitle; //uint certTarget; // Target number of certifications //uint curCert; // Current number of certifications //string description; bool done; } struct CreditHistoryOracle{ uint creditScore; uint dateCreditScoreReceived; } mapping (address => CreditHistoryOracle) borroweCreditHistory; // Request info bytes32[] public requestIDs; mapping(bytes32 => LoanRequest) public requests; // Loan info. // one loan per user. mapping(address => bytes8) public userLoan; mapping(bytes8 => Loan) public allLoans; // Aggregate Lenders info address[] public allLenders; //mapping(address => string) public userMap; // Aggregate borrowers' info address[] public allBorrowers; //mapping(address => string) public userMap; // User-specific information //mapping(address => Reputation) public reputation; //mapping (address => uint) public balanceOf; mapping(address => uint) public debt; // All projects ever started (excludes requests) bytes8[] public allProjects; mapping(address => bytes8[]) public userProjects; // Validators mapping(bytes8 => address[]) public Validators; // Super validator address public superValidator; constructor (){ superValidator = msg.sender; } event Request(address, uint256, uint); // create and submit request. function submitLoanRequest(address _borrower, uint _amount, uint _projectId, string memory _projectTitle, uint _projectDuration, bytes32 nonce) public { bytes32 _requestId = keccak256(abi.encodePacked(_borrower, _amount, nonce, address(this))); requests[_requestId] = LoanRequest( _borrower, _projectId, _projectTitle, _projectDuration, _amount ); requestIDs.push(_requestId); } // approve submitted request. Should be done by the superValidator or delegated validator function approveLoanRequest() public { } //terminate Loan when the loan is paid function terminateLoan() public{ } // record the payments of the loans / the installment process function recordPayment() public { } //default in loan payments function defaultInPayment() public { } //getters function getRequests() public { } function getBorrowes() public { } function getLenders() public { } function getProjectName() public { } // returns the borrower's debt function getDebt() public { } // returns defaulted loans function getOutStandingLoan() public { } }
0.7.1