Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 45f19ca

Browse files
added contributors, and contributors can transfer fund
1 parent 5cec812 commit 45f19ca

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

‎contracts/CrowdFunding/CrowdFunding.sol‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,30 @@ contract CrowdFunding
1515
{
1616
goal = _goal;
1717
deadline = block.timestamp + _deadline;
18+
minimumContribution = 100 wei;
19+
admin = msg.sender;
20+
}
21+
22+
function contribute() public payable
23+
{
24+
require(block.timestamp < deadline, "Deadline has passed");
25+
require(msg.value >= minimumContribution, "Minimum contribution not met");
26+
if(contributors[msg.sender] == 0)
27+
{
28+
numberOfContributors++;
29+
}
30+
31+
contributors[msg.sender] += msg.value;
32+
raisedAmount += msg.value;
33+
}
34+
35+
receive() external payable
36+
{
37+
contribute();
38+
}
39+
40+
function getBalance() public view returns(uint)
41+
{
42+
return address(this).balance;
1843
}
1944
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /