Skip to content

Instantly share code, notes, and snippets.

@jnicho02
Created June 26, 2015 15:01
Show Gist options
  • Save jnicho02/26d8fa1662cf1f7371bf to your computer and use it in GitHub Desktop.
Save jnicho02/26d8fa1662cf1f7371bf to your computer and use it in GitHub Desktop.
contract jtoken {
mapping (address => uint) public balances;
address public admin;
uint tax;
function jtoken()
{
balances[msg.sender] = 1000;
admin = msg.sender;
tax = 1;
}
function sendToken(address receiver, uint amount)
{
if(balances[msg.sender] < amount + tax) return;
balances[msg.sender] -= amount;
balances[receiver] += amount;
balances[admin] += tax;
}
function setTax(uint value)
{
if (msg.sender == admin) return;
tax = value;
}
function getBalance() returns (uint)
{
return balances[msg.sender];
}
function kill() {
if (msg.sender == admin) {
suicide(admin);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment