├── BitcollarERC20.sol └── README.md /BitcollarERC20.sol: -------------------------------------------------------------------------------- 1 | /** 2 | *Submitted for verification at Etherscan.io on 2019-06-16 3 | */ 4 | 5 | pragma solidity ^0.4.16; 6 | 7 | interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) public; } 8 | 9 | contract TokenERC20 { 10 | string public name; 11 | string public symbol; 12 | uint8 public decimals = 18; 13 | uint256 public totalSupply; 14 | mapping (address => uint256) public balanceOf; 15 | mapping (address => mapping (address => uint256)) public allowance; 16 | event Transfer(address indexed from, address indexed to, uint256 value); 17 | event Burn(address indexed from, uint256 value); 18 | 19 | 20 | function TokenERC20(uint256 initialSupply, string tokenName, string tokenSymbol) public { 21 | totalSupply = initialSupply * 10 ** uint256(decimals); 22 | balanceOf[msg.sender] = totalSupply; 23 | name = tokenName; 24 | symbol = tokenSymbol; 25 | } 26 | 27 | 28 | function _transfer(address _from, address _to, uint _value) internal { 29 | require(_to != 0x0); 30 | require(balanceOf[_from] >= _value); 31 | require(balanceOf[_to] + _value > balanceOf[_to]); 32 | 33 | 34 | uint previousBalances = balanceOf[_from] + balanceOf[_to]; 35 | balanceOf[_from] -= _value; 36 | balanceOf[_to] += _value; 37 | Transfer(_from, _to, _value); 38 | assert(balanceOf[_from] + balanceOf[_to] == previousBalances); 39 | } 40 | 41 | 42 | function transfer(address _to, uint256 _value) public { 43 | _transfer(msg.sender, _to, _value); 44 | } 45 | 46 | 47 | function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { 48 | require(_value <= allowance[_from][msg.sender]); // Check allowance 49 | allowance[_from][msg.sender] -= _value; 50 | _transfer(_from, _to, _value); 51 | return true; 52 | } 53 | 54 | 55 | function approve(address _spender, uint256 _value) public 56 | returns (bool success) { 57 | allowance[msg.sender][_spender] = _value; 58 | return true; 59 | } 60 | 61 | 62 | function approveAndCall(address _spender, uint256 _value, bytes _extraData) 63 | public 64 | returns (bool success) { 65 | tokenRecipient spender = tokenRecipient(_spender); 66 | if (approve(_spender, _value)) { 67 | spender.receiveApproval(msg.sender, _value, this, _extraData); 68 | return true; 69 | } 70 | } 71 | 72 | 73 | function burn(uint256 _value) public returns (bool success) { 74 | require(balanceOf[msg.sender] >= _value); // Check if the sender has enough 75 | balanceOf[msg.sender] -= _value; // Subtract from the sender 76 | totalSupply -= _value; // Updates totalSupply 77 | Burn(msg.sender, _value); 78 | return true; 79 | } 80 | 81 | 82 | function burnFrom(address _from, uint256 _value) public returns (bool success) { 83 | require(balanceOf[_from] >= _value); // Check if the targeted balance is enough 84 | require(_value <= allowance[_from][msg.sender]); // Check allowance 85 | balanceOf[_from] -= _value; // Subtract from the targeted balance 86 | allowance[_from][msg.sender] -= _value; // Subtract from the sender's allowance 87 | totalSupply -= _value; // Update totalSupply 88 | Burn(_from, _value); 89 | return true; 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Tokeninformation --------------------------------------------------------------------------------