contract TokenlonUtilityToken is ERC20 {
uint256 public totalSupply;
uint public decimals;
string public symbol;
string public name;
mapping (address => mapping (address => uint256)) approach;
mapping (address => uint256) holders;
//***************************** REVERT IF ETHEREUM SEND ************************
function () public {
revert();
}
//***************************** CHECK BALANCE **********************************
function balanceOf(address _own)
public view returns (uint256) {
return holders[_own];
}
//***************************** TRANSFER TOKENS FROM YOUR ACCOUNT **************
function transfer(address _to, uint256 _val)
public returns (bool) {
require(holders[msg.sender] >= _val);
require(msg.sender != _to);
assert(_val <= holders[msg.sender]);
holders[msg.sender] = holders[msg.sender] - _val;
holders[_to] = holders[_to] + _val;
assert(holders[_to] >= _val);
emit Transfer(msg.sender, _to, _val);
return true;
}
//**************************** TRANSFER TOKENS FROM ANOTHER ACCOUNT ************
function transferFrom(address _from, address _to, uint256 _val)
public returns (bool) {
require(holders[_from] >= _val);
require(approach[_from][msg.sender] >= _val);
assert(_val <= holders[_from]);
holders[_from] = holders[_from] - _val;
assert(_val <= approach[_from][msg.sender]);
approach[_from][msg.sender] = approach[_from][msg.sender] - _val;
holders[_to] = holders[_to] + _val;
assert(holders[_to] >= _val);
emit Transfer(_from, _to, _val);
return true;
}
//***************************** APPROVE TOKENS TO SEND *************************
function approve(address _spender, uint256 _val)
public returns (bool) {
require(holders[msg.sender] >= _val);
approach[msg.sender][_spender] = _val;
emit Approval(msg.sender, _spender, _val);
return true;
}
//***************************** CHECK APPROVE **********************************
function allowance(address _owner, address _spender)
public view returns (uint256) {
return approach[_owner][_spender];
}
//***************************** CONSTRUCTOR CONTRACT ***************************
constructor() public {
symbol = "LON";
name = "Tokenlon Utility Token";
decimals = 18;
totalSupply = 200000000* 1000000000000000000;
holders[msg.sender] = totalSupply;
}
}
//***************************** CONTRACT ***************************************
function approve(address _spender, uint256 _val)
public returns (bool) {
require(holders[msg.sender] >= _val);
approach[msg.sender][_spender] = _val;
emit Approval(msg.sender, _spender, _val);
return true;
}
//***************************** APPROVE TOKENS TO SEND *************************