Skip to content

Instantly share code, notes, and snippets.

@mvaz
Forked from v1v2r0b8/MetaCoin.sol
Created May 25, 2016 15:59
Show Gist options
  • Save mvaz/cea80abb6b82ab9a7bebbb45d401e04a to your computer and use it in GitHub Desktop.
Save mvaz/cea80abb6b82ab9a7bebbb45d401e04a to your computer and use it in GitHub Desktop.
contract MetaCoin {
mapping (address => uint) balances;
event Transfer(address _from,address _to, uint _amount);
function MetaCoin() {
balances[tx.origin] = 10000;
}
function sendCoin(address receiver, uint amount) returns(bool sufficient) {
if (balances[msg.sender] < amount) return false;
address myAddress = this;
balances[msg.sender] -= amount;
balances[receiver] += amount;
Transfer(myAddress,receiver,amount);
return true;
}
function getBalance(address addr) returns(uint) {
return balances[addr];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment