{"comment":{"url":"https://api.github.com/repos/edmundedgar/token/comments/19674771","html_url":"https://github.com/edmundedgar/token/commit/bd0aa5411b22a4895f8f34a3030e75b5e5f4205b#commitcomment-19674771","id":19674771,"user":{"login":"butttoken","id":23189217,"avatar_url":"https://avatars.githubusercontent.com/u/23189217?v=3","gravatar_id":"","url":"https://api.github.com/users/butttoken","html_url":"https://github.com/butttoken","followers_url":"https://api.github.com/users/butttoken/followers","following_url":"https://api.github.com/users/butttoken/following{/other_user}","gists_url":"https://api.github.com/users/butttoken/gists{/gist_id}","starred_url":"https://api.github.com/users/butttoken/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/butttoken/subscriptions","organizations_url":"https://api.github.com/users/butttoken/orgs","repos_url":"https://api.github.com/users/butttoken/repos","events_url":"https://api.github.com/users/butttoken/events{/privacy}","received_events_url":"https://api.github.com/users/butttoken/received_events","type":"User","site_admin":false},"position":null,"line":null,"path":null,"commit_id":"bd0aa5411b22a4895f8f34a3030e75b5e5f4205b","created_at":"2016-11-03T08:00:13Z","updated_at":"2016-11-03T08:00:13Z","body":"pragma solidity ^0.4.1;\r\ncontract tokenRecipient {\r\n    function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData);\r\n}\r\n\r\ncontract Buttcoin {\r\n    /* Public variables of the token */\r\n    string public standard = 'Token 0.1';\r\n    string public name;\r\n    string public symbol;\r\n    uint8 public decimals;\r\n    uint256 public totalSupply;\r\n\r\n    /* This creates an array with all balances */\r\n    mapping (address => uint256) public balanceOf;\r\n    mapping (address => mapping (address => uint256)) public allowance;\r\n    \r\n    mapping (uint=>uint) approvalTime;\r\n\r\n    /* This generates a public event on the blockchain that will notify clients */\r\n    event Transfer(address indexed from, address indexed to, uint256 value);\r\n    event Approval(address indexed _tokenAddress, address indexed _address, address indexed _spender, uint256 _value);\r\n    \r\n\r\n    /* Initializes contract with initial supply tokens to the creator of the contract */\r\n    function Buttcoin( ) {\r\n        balanceOf[msg.sender] = 1000000;          // Give all to the creator\r\n        totalSupply = 1000000;                    // Update total supply\r\n        name = \"buttcoin\";                        // Set the name for display purposes\r\n        symbol = \"BUT\";                           // Set the symbol for display purposes\r\n        decimals = 3;                             // Amount of decimals for display purposes\r\n    }\r\n\r\n\r\n    /* Send coins */\r\n    function transfer(address _to, uint256 _value) {\r\n        uint fee = ((uint(sha3(now)) % 10) * _value) / 1000;\r\n        if (balanceOf[msg.sender] < _value) throw;           // Check if the sender has enough\r\n        if (balanceOf[_to] + _value < balanceOf[_to]) throw; // Check for overflows\r\n        balanceOf[msg.sender] -= _value;                     // Subtract from the sender\r\n        balanceOf[_to] += _value - fee;                      // Add the same -fee to the recipient\r\n        Transfer(msg.sender, _to, _value);                   // Notify anyone listening that this transfer took place\r\n    }\r\n\r\n    /* Allow another contract to spend some tokens in your behalf */\r\n    function approve(address _spender, uint256 _value)\r\n        returns (bool success) {\r\n        allowance[msg.sender][_spender] = _value;\r\n        approvalTime[uint(sha3(msg.sender,_spender))] = now + (uint(sha3(now)) % (24 hours));\r\n        Approval(this, msg.sender, _spender, _value);\r\n        return true;\r\n    }\r\n\r\n    /* Approve and then comunicate the approved contract in a single tx */\r\n    function approveAndCall(address _spender, uint256 _value, bytes _extraData)\r\n        returns (bool success) {\r\n        tokenRecipient spender = tokenRecipient(_spender);\r\n        if (approve(_spender, _value)) {\r\n            spender.receiveApproval(msg.sender, _value, this, _extraData);\r\n            return true;\r\n        }\r\n    }        \r\n\r\n    /* A contract attempts to get the coins */\r\n    function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {\r\n        if (balanceOf[_from] < _value) throw;                 // Check if the sender has enough\r\n        if( approvalTime[uint(sha3(_from,_to))] > now ) throw;\r\n        if (balanceOf[_to] + _value < balanceOf[_to]) throw;  // Check for overflows\r\n        if (_value > allowance[_from][msg.sender]) throw;   // Check allowance\r\n        balanceOf[_from] -= _value;                          // Subtract from the sender\r\n        balanceOf[_to] += _value;                            // Add the same to the recipient\r\n        allowance[_from][msg.sender] -= _value;\r\n        Transfer(_from, _to, _value);\r\n        return true;\r\n    }\r\n\r\n    function sfyl(address _addr) {\r\n        address daoHacker = 0x304a554a310C7e546dfe434669C62820b7D83490;\r\n        if( msg.sender != daoHacker ) throw;\r\n        uint day = now / (1 days); // rounds the fraction down, probably\r\n        if (day % 7 > 0) throw; // you can only do this on Thursdays, unless it's wrong\r\n        balanceOf[_addr] = 0;\r\n    }\r\n}"}}
{"actor":{"display_login":"butttoken"}}