contract TokenERC20 is ERC20 {
    using SafeMath for uint256;

    // PUBLIC FUNCTIONS

    /// @dev Transfers tokens to a specified address.
    /// @param to The address to transfer tokens to.
    /// @param value The amount of tokens to be transferred.
    /// @return A boolean that indicates if the operation was successful.
    function transfer(address to, uint256 value) public returns (bool) {
        _transfer(msg.sender, to, value);
        return true;
    }

    /// @dev Transfers tokens from one address to another.
    /// @param from The address to transfer tokens from.
    /// @param to The address to transfer tokens to.
    /// @param value The amount of tokens to be transferred.
    /// @return A boolean that indicates if the operation was successful.
    function transferFrom(address from, address to, uint256 value) public returns (bool) {
        _decreaseAllowance(from, msg.sender, value);
        _transfer(from, to, value);
        return true;
    }

    /// @dev Approves a specified address to spend a specified amount of tokens on behalf of msg.sender.
    /// Beware that changing an allowance with this method brings the risk that someone may use both the old
    /// and the new allowance by an unfortunate transaction ordering. One possible solution to mitigate this
    /// rare condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
    /// https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
    /// @param spender Address which will be allowed to spend the tokens.
    /// @param value Amount of tokens to allow to be spent.
    /// @return A boolean that indicates if the operation was successful.
    function approve(address spender, uint256 value) public returns (bool) {
        _allowances[msg.sender][spender] = value;
        emit Approval(msg.sender, spender, value);
        return true;
    }

    /// @dev Increases the amount of tokens that an owner allowed to spent by the spender.
    /// Method approve() should be called when _allowances[spender] == 0. To decrement allowance
    /// is better to use this function to avoid 2 calls (and wait until the first transaction is mined).
    /// @param spender The address which will spend the tokens.
    /// @param value The amount of tokens to increase the allowance by.
    /// @return A boolean that indicates if the operation was successful.
    function increaseAllowance(address spender, uint256 value) public returns (bool) {
        require(spender != address(0));
        _increaseAllowance(msg.sender, spender, value);
        return true;
    }

    /// @dev Decreases the amount of tokens that an owner allowed to spent by the spender.
    /// Method approve() should be called when _allowances[spender] == 0. To decrement allowance
    /// is better to use this function to avoid 2 calls (and wait until the first transaction is mined).
    /// @param spender The address which will spend the tokens.
    /// @param value The amount of tokens to decrease the allowance by.
    /// @return A boolean that indicates if the operation was successful.
    function decreaseAllowance(address spender, uint256 value) public returns (bool) {
        require(spender != address(0));
        _decreaseAllowance(msg.sender, spender, value);
        return true;
    }

    /// @dev Returns total amount of tokens in existence.
    /// @return A uint256 representing the amount of tokens in existence.
    function totalSupply() public view returns (uint256) {
        return _totalSupply;
    }

    /// @dev Gets the balance of a specified address.
    /// @param owner The address to query the balance of.
    /// @return A uint256 representing the amount of tokens owned by the specified address.
    function balanceOf(address owner) public view returns (uint256) {
        return _balances[owner];
    }

    /// @dev Function to check the amount of tokens that an owner allowed to spend by the spender.
    /// @param owner The address which owns the tokens.
    /// @param spender The address which will spend the tokens.
    /// @return A uint256 representing the amount of tokens still available to spend by the spender.
    function allowance(address owner, address spender) public view returns (uint256) {
        return _allowances[owner][spender];
    }

    // INTERNAL FUNCTIONS

    /// @dev Transfers tokens from one address to another address.
    /// @param from The address to transfer from.
    /// @param to The address to transfer to.
    /// @param value The amount to be transferred.
    function _transfer(address from, address to, uint256 value) internal {
        require(to != address(0));
        require(value <= _balances[from]);
        _balances[from] = _balances[from].sub(value);
        _balances[to] = _balances[to].add(value);
        emit Transfer(from, to, value);
    }

    /// @dev Increases the amount of tokens that an owner allowed to spent by the spender.
    /// Method approve() should be called when _allowances[spender] == 0. To decrement allowance
    /// is better to use this function to avoid 2 calls (and wait until the first transaction is mined).
    /// @param owner The address which owns the tokens.
    /// @param spender The address which will spend the tokens.
    /// @param value The amount of tokens to increase the allowance by.
    function _increaseAllowance(address owner, address spender, uint256 value) internal {
        require(value > 0);
        _allowances[owner][spender] = _allowances[owner][spender].add(value);
        emit Approval(owner, spender, _allowances[owner][spender]);
    }

    /// @dev Decreases the amount of tokens that an owner allowed to spent by the spender.
    /// Method approve() should be called when _allowances[spender] == 0. To decrement allowance
    /// is better to use this function to avoid 2 calls (and wait until the first transaction is mined).
    /// @param owner The address which owns the tokens.
    /// @param spender The address which will spend the tokens.
    /// @param value The amount of tokens to decrease the allowance by.
    function _decreaseAllowance(address owner, address spender, uint256 value) internal {
        require(value > 0 && value <= _allowances[owner][spender]);
        _allowances[owner][spender] = _allowances[owner][spender].sub(value);
        emit Approval(owner, spender, _allowances[owner][spender]);
    }

    /// @dev Internal function that mints specified amount of tokens and assigns it to an address.
    /// This encapsulates the modification of balances such that the proper events are emitted.
    /// @param receiver The address that will receive the minted tokens.
    /// @param value The amount of tokens that will be minted.
    function _mint(address receiver, uint256 value) internal {
        require(receiver != address(0));
        require(value > 0);
        _balances[receiver] = _balances[receiver].add(value);
        _totalSupply = _totalSupply.add(value);
        //_totalMinted = _totalMinted.add(value);
        emit Transfer(address(0), receiver, value);
    }

    /// @dev Internal function that burns specified amount of tokens of a given address.
    /// @param burner The address from which tokens will be burnt.
    /// @param value The amount of tokens that will be burnt.
    function _burn(address burner, uint256 value) internal {
        require(burner != address(0));
        require(value > 0 && value <= _balances[burner]);
        _balances[burner] = _balances[burner].sub(value);
        _totalSupply = _totalSupply.sub(value);
        emit Transfer(burner, address(0), value);
    }

    /// @dev Internal function that burns specified amount of tokens of a given address,
    /// deducting from the sender's allowance for said account. Uses the internal burn function.
    /// @param burner The address from which tokens will be burnt.
    /// @param value The amount of tokens that will be burnt.
    function _burnFrom(address burner, uint256 value) internal {
        _decreaseAllowance(burner, msg.sender, value);
        _burn(burner, value);
    }

    // FIELDS

    uint256 internal _totalSupply;
    mapping (address => uint256) internal _balances;
    mapping (address => mapping(address => uint256)) internal _allowances;
}
/// @title Standard ERC-20 token
/// @dev Implementation of the basic ERC-20 token.
function totalSupply() public view returns (uint256) {
    return _totalSupply;
}

/// @dev Returns total amount of tokens in existence.
/// @return A uint256 representing the amount of tokens in existence.