-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathf_inv_c.sol
More file actions
51 lines (35 loc) · 1.99 KB
/
Copy pathf_inv_c.sol
File metadata and controls
51 lines (35 loc) · 1.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.6.0 <0.9.0;
contract farmerInvestorContract {
/**
Requirements in the contract
1. Address of the contract for receiving transfers from investors
2. Investor address from which funds would be pushed to the contract address
3. Total amount of required investment for the particular farm season
3a. In cases where only one investor is interested in the farm, he/she
then pays the total required amount and is guaranteed the total returns
from the farm at the end of the farm season
This amount is converted from Ethereum into USD/Fiat currency.
3b. In cases where there are multiple investors interested in the same farm,
the farmland is tokenized with respect to total required investment amount
This amount is then converted from Ethereum into USD/Fiat currency.
4. A simulated time duration for the farm season; at the end of this season,
the produce harvested is recorded
5. An estimate of the returns from selling the produce harvested is then converted
into its equivalent worth in ethereum and sent to the respective investor(s)
6. The contract is then closed from receiving any payments; it is reopened at the beginning of
a new farm season if the conditions remain same as the previous farm season.
*/
// keep track of all investors who send funding to this contract
mapping(address => uint256) public investorAddressAndAmountInvested;
address[] public investors;
address public contractOwner;
constructor() {
contractOwner = msg.sender;
}
function checkInvestorInvestment(address _investor) public payable returns (uint256) {
// We check the amount of investment made by each investor
investorAddressAndAmountInvested[msg.sender] += msg.value;
return investorAddressAndAmountInvested[_investor];
}
}