mirror of https://github.com/ConsenSys/mythril
blockchainethereumsmart-contractssoliditysecurityprogram-analysissecurity-analysissymbolic-execution
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
659 B
34 lines
659 B
7 years ago
|
contract Crowdfunding {
|
||
|
|
||
|
mapping(address => uint) public balances;
|
||
|
address public owner;
|
||
|
uint256 INVEST_MIN = 1 ether;
|
||
|
uint256 INVEST_MAX = 10 ether;
|
||
|
|
||
|
modifier onlyOwner() {
|
||
|
require(msg.sender == owner);
|
||
|
_;
|
||
|
}
|
||
|
|
||
|
function crowdfunding() {
|
||
|
owner = msg.sender;
|
||
|
}
|
||
|
|
||
|
function withdrawfunds() onlyOwner {
|
||
|
msg.sender.transfer(this.balance);
|
||
|
}
|
||
|
|
||
|
function invest() public payable {
|
||
|
require(msg.value > INVEST_MIN && msg.value < INVEST_MAX);
|
||
|
|
||
|
balances[msg.sender] += msg.value;
|
||
|
}
|
||
|
|
||
|
function getBalance() public constant returns (uint) {
|
||
|
return balances[msg.sender];
|
||
|
}
|
||
|
|
||
|
function() public payable {
|
||
|
invest();
|
||
|
}
|
||
|
}
|