contract StandardToken is BasicToken, ERC20 {
    // Owner of account approves the transfer of an amount to another account
    mapping (address => mapping (address => uint256)) allowed;

    /**
     * @dev Returns the amount of tokens approved by the owner that can be transferred to the spender's account
     * @param _owner The address which owns the funds.
     * @param _spender The address which will spend the funds.
     * @return An uint256 specifying the amount of tokens still available for the spender.
     */
    function allowance(address _owner, address _spender) public constant returns(uint256 theAllowance){
        return allowed[_owner][_spender];
    }

    /**
     * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
     *
     * To change the approve amount you first have to reduce the addresses`
     * allowance to zero by calling `approve(_spender, 0)` if it is not
     * already 0 to mitigate the race condition described here:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * @param _spender The address which will spend the funds.
     * @param _value The amount of tokens to be spent.
     */
    function approve(address _spender, uint256 _value) public returns(bool success){
        require(allowed[msg.sender][_spender] == 0 || _value == 0);

        allowed[msg.sender][_spender] = _value;
        emit Approval(msg.sender, _spender, _value);

        return true;
    }

    /**
     * Transfer from `from` account to `to` account using allowance in `from` account to the sender
     *
     * @param _from  Origin address
     * @param _to    Destination address
     * @param _value Amount of CHR tokens to send
     */
    function transferFrom(address _from, address _to, uint256 _value) public returns(bool success) {
        require(_to != address(0));
        require(_value <= balances[_from]);
        require(_value <= allowed[_from][msg.sender]);

        balances[_from] = balances[_from].sub(_value);
        balances[_to] = balances[_to].add(_value);

        allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);

        emit Transfer(_from, _to, _value);

        return true;
    }
}
/**
 * @title Standard ERC20 token
 *
 * @dev Implementation of the basic standard token.
 * @dev https://github.com/ethereum/EIPs/issues/20
 */
function allowance(address _owner, address _spender) public constant returns(uint256 theAllowance){
    return allowed[_owner][_spender];
}

/**
 * @dev Returns the amount of tokens approved by the owner that can be transferred to the spender's account
 * @param _owner The address which owns the funds.
 * @param _spender The address which will spend the funds.
 * @return An uint256 specifying the amount of tokens still available for the spender.
 */