Advertisement
Guest User

SolidityCOMP6441Rez

a guest
Apr 6th, 2020
270
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.76 KB | None | 0 0
  1. pragma solidity >=0.4.22 <0.7.0;
  2.  
  3. contract LoanManagementSystem {
  4.    
  5.     /*
  6.         An investor pool contains a group of investors and a manager. The manager (poolManager) will be able to issue loans.
  7.         The manager is also the creator of the investor pool.
  8.         Investors can invest in the pool by sending it money. The issuance of loans is dependent on the investors' money
  9.         When the lendees of loans pay back money, the money will be split amongst the investors.
  10.         The manager also received a small fee for each completed loan
  11.     */
  12.     struct InvestorPool {
  13.         address poolManager;
  14.         Investment[] investors; //All the investors and their investments
  15.         Loan[] loansIssued;
  16.         uint256 poolBalance; // The total amount of Investment a pool can have
  17.         uint poolId;
  18.     }
  19.    
  20.     /*
  21.         A loan has a few paramaters. The lendee is the person receiving the lent money. The loanTotalBalance is the amount loaned.
  22.         The loanRemainingBalance is the balance the lendee has remaining to pay off.
  23.         The loanInterestPerAnnum is the interest rate.
  24.         The acceptedByLendee is set to false initially. When a lendee accepts a Loan, they will receive the balance and this bool
  25.         will switch to true.
  26.     */
  27.     struct Loan {
  28.         address lendee;
  29.         uint256 loanTotalBalance;
  30.         uint256 loanRemainingBalance;
  31.         uint256 loanInterestPerAnnum;
  32.         uint poolId;
  33.         uint loanId;
  34.         bool acceptedByLendee;
  35.     }
  36.    
  37.     /*
  38.         An investment is used to represent an investors investment in an InvestorPool
  39.     */
  40.     struct Investment {
  41.         address investor;
  42.         uint256 investmentValue;
  43.     }
  44.    
  45.     // Hashmap of poolId to InvestorPool
  46.     mapping (uint => InvestorPool) investorPools;
  47.     // Hashmap of loanId to Loan
  48.     mapping (uint => Loan) issuedLoans;
  49.     // Hashmap of account address to money payable
  50.     mapping (address => uint) pendingInvestmentReturns;
  51.    
  52.     //An event emitted from the blockchain when a Loan is created, making it easier for non-blockchain technologies to act on events.
  53.     event LoanProposalCreated(uint poolId, uint loanId, address lendee, uint256 loanTotalBalance, uint256 loanInterestPerAnnum);
  54.  
  55.  
  56.     function createInvestorPool(uint _poolId) public {
  57.         return;
  58.     }
  59.    
  60.     function investInPool(uint _poolId) public payable {
  61.         return;
  62.     }
  63.    
  64.     function issueLoanProposal(uint _poolId, uint _loanId, address _lendee, uint256 _loanTotalBalance, uint256 loanInterestPerAnnum) public payable{
  65.         return;
  66.     }
  67.  
  68.    
  69.     function acceptLoanProposal(uint _loanId) public{
  70.         return;
  71.     }
  72.    
  73.     function makeLoanRepayment(uint _loadId) public payable {
  74.         return;
  75.     }
  76.  
  77. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement