-
-
Save kobigurk/c19fb39a28fdd7fc15fc to your computer and use it in GitHub Desktop.
contracts
This file contains hidden or 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 token { | |
mapping (address => uint) balances; | |
// Initializes contract with 10 000 tokens to the creator of the contract | |
function token() { | |
balances[msg.sender] = 10000; | |
} | |
// Very simple trade function | |
function sendToken(address receiver, uint amount) returns(bool sufficient) { | |
if (balances[msg.sender] < amount) return false; | |
balances[msg.sender] -= amount; | |
balances[receiver] += amount; | |
return true; | |
} | |
// Check balances of any account | |
function getBalance(address account) returns(uint balance){ | |
return balances[account]; | |
} | |
} | |
This file contains hidden or 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 greeter { | |
function greet(bytes32 input) returns (bytes32) { | |
if (input == "") { return "Hello, World"; } | |
return input; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment