Skip to content

Instantly share code, notes, and snippets.

@thisismsreddy
Created August 20, 2017 18:52
Show Gist options
  • Save thisismsreddy/53ff2b039fb0c6b9cfc1d6347b361812 to your computer and use it in GitHub Desktop.
Save thisismsreddy/53ff2b039fb0c6b9cfc1d6347b361812 to your computer and use it in GitHub Desktop.
pragma solidity ^0.4.0;
contract HelloWorld {
address public owener;
mapping (address => uint) balances;
function HelloWorld(){
owener = msg.sender;
balances[owener] = 1000;
}
function transfer(address _to, uint _value) returns (bool success){
if ( balances[msg.sender] < _value) {
revert();
return false;
}
else {
balances[msg.sender] -= _value;
balances[_to] += _value;
return true;
}
}
function getBalance(address _user) constant returns (uint) {
return balances[_user];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment