Created
February 7, 2018 21:55
-
-
Save lazzarello/d7bf851d469084a8be4be96cae234fdb to your computer and use it in GitHub Desktop.
dao solidity
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
contract SendBalance { | |
mapping (address => uint) userBalances; | |
bool withdrawn = false; | |
function getBalance(address u) constant returns (uint) { | |
return userBalances[u]; | |
} | |
function addToBalance() { | |
userBalances[msg.sender] += msg.value; | |
} | |
function withdrawBalance() { | |
if (!(msg.sender.call.value(userBalances[msg.sender])())) { | |
throw; | |
} | |
userBalances[msg.sender] = 0; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment