Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- pragma solidity >=0.4.22 <0.7.0;
- contract LoanManagementSystem {
- /*
- An investor pool contains a group of investors and a manager. The manager (poolManager) will be able to issue loans.
- The manager is also the creator of the investor pool.
- Investors can invest in the pool by sending it money. The issuance of loans is dependent on the investors' money
- When the lendees of loans pay back money, the money will be split amongst the investors.
- The manager also received a small fee for each completed loan
- */
- struct InvestorPool {
- address poolManager;
- Investment[] investors; //All the investors and their investments
- Loan[] loansIssued;
- uint256 poolBalance; // The total amount of Investment a pool can have
- uint poolId;
- }
- /*
- A loan has a few paramaters. The lendee is the person receiving the lent money. The loanTotalBalance is the amount loaned.
- The loanRemainingBalance is the balance the lendee has remaining to pay off.
- The loanInterestPerAnnum is the interest rate.
- The acceptedByLendee is set to false initially. When a lendee accepts a Loan, they will receive the balance and this bool
- will switch to true.
- */
- struct Loan {
- address lendee;
- uint256 loanTotalBalance;
- uint256 loanRemainingBalance;
- uint256 loanInterestPerAnnum;
- uint poolId;
- uint loanId;
- bool acceptedByLendee;
- }
- /*
- An investment is used to represent an investors investment in an InvestorPool
- */
- struct Investment {
- address investor;
- uint256 investmentValue;
- }
- // Hashmap of poolId to InvestorPool
- mapping (uint => InvestorPool) investorPools;
- // Hashmap of loanId to Loan
- mapping (uint => Loan) issuedLoans;
- // Hashmap of account address to money payable
- mapping (address => uint) pendingInvestmentReturns;
- //An event emitted from the blockchain when a Loan is created, making it easier for non-blockchain technologies to act on events.
- event LoanProposalCreated(uint poolId, uint loanId, address lendee, uint256 loanTotalBalance, uint256 loanInterestPerAnnum);
- function createInvestorPool(uint _poolId) public {
- return;
- }
- function investInPool(uint _poolId) public payable {
- return;
- }
- function issueLoanProposal(uint _poolId, uint _loanId, address _lendee, uint256 _loanTotalBalance, uint256 loanInterestPerAnnum) public payable{
- return;
- }
- function acceptLoanProposal(uint _loanId) public{
- return;
- }
- function makeLoanRepayment(uint _loadId) public payable {
- return;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement