Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
pragma solidity ^0.4.4;
import "./ConvertLib.sol";
contract MetaCoin {
mapping (address => uint) balances;
address originAddress;
event Transfer(address indexed _from, address indexed _to, uint256 _value);
function MetaCoin() {
balances[tx.origin] = 10000;
originAddress = tx.origin;
function sendCoin(address receiver, uint amount) returns(bool sufficient) {
if (balances[msg.sender] < amount) return false;
balances[msg.sender] -= amount;
balances[receiver] += amount;
Transfer(msg.sender, receiver, amount);
return true;
function getBalanceInEth(address addr) returns(uint){
return ConvertLib.convert(getBalance(addr),2);
function getBalance(address addr) returns(uint) {
return balances[addr];
function getOriginAddress() returns(address) {
return originAddress;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.