contract Tether { address public owner; uint public supply; /* Address Table */ mapping (address => uint) public coinBalanceOf; /* Public Blockchain Events */ event CoinTransfer(address sender, address receiver, uint amount); event CoinIssue(address to, uint value); event CoinRevoke(address addrs, uint amount); /* Initializes contract with initial supply tokens to the creator of the contract */ function Tether() { supply = 10000; coinBalanceOf[msg.sender] = supply; owner = msg.sender; } /* Very simple trade function */ function sendCoin(address receiver, uint amount) returns(bool sufficient) { if (coinBalanceOf[msg.sender] < amount) return false; coinBalanceOf[msg.sender] -= amount; coinBalanceOf[receiver] += amount; CoinTransfer(msg.sender, receiver, amount); return true; } /* Change contract owner */ function changeOwner(address newOwner) returns(bool changed) { if (msg.sender != owner) return false; owner = newOwner; return true; } - /* Subtract an amount from an addresses balance (only available to owner) */ - function grantCoin(address grantee, uint amount) returns(uint balance) { - if (msg.sender != owner) return coinBalanceOf[grantee]; - coinBalanceOf[grantee] += amount; - supply += amount; - CoinIssue(grantee, amount); - return coinBalanceOf[grantee]; - } function revokeCoin(uint amount) returns(uint balance) { if (coinBalanceOf[msg.sender] < amount) return coinBalanceOf[msg.sender]; coinBalanceOf[msg.sender] -= amount; supply -= amount; CoinRevoke(msg.sender, amount); return coinBalanceOf[msg.sender]; } /* Get total tethers in existence */ function getSupply() constant returns (uint total) { return supply; } /* Returns the current address of owner */ function getOwner() returns (address owner) { return owner; } }