Skip to content

Instantly share code, notes, and snippets.

@lazzarello
Created February 7, 2018 21:55
Show Gist options
  • Save lazzarello/d7bf851d469084a8be4be96cae234fdb to your computer and use it in GitHub Desktop.
Save lazzarello/d7bf851d469084a8be4be96cae234fdb to your computer and use it in GitHub Desktop.
dao solidity
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