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.
23 lines
491 B
23 lines
491 B
7 years ago
|
contract Reentrancy {
|
||
|
|
||
|
mapping(address => uint) public balances;
|
||
|
|
||
|
function donate(address _to) public payable {
|
||
|
balances[_to] += msg.value;
|
||
|
}
|
||
|
|
||
|
function balanceOf(address _who) public constant returns (uint balance) {
|
||
|
return balances[_who];
|
||
|
}
|
||
|
|
||
|
function withdraw(uint _amount) public {
|
||
|
if(balances[msg.sender] >= _amount) {
|
||
|
if(msg.sender.call.value(_amount)()) {
|
||
|
_amount;
|
||
|
}
|
||
|
balances[msg.sender] -= _amount;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function() payable {}
|
||
|
}
|