Created
August 20, 2017 18:52
-
-
Save thisismsreddy/53ff2b039fb0c6b9cfc1d6347b361812 to your computer and use it in GitHub Desktop.
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
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