contract CAR is ERC20,owned {
    mapping(address => bool) public frozenAccount;//声明冻结或者解冻的帐号 
    event AddSupply(uint256 amount);//声明增发事件 
    event FrozenFunds(address target,bool freeze);//声明冻结或者解冻事件
    event Burn(address account,uint256 values);
    /**"Test FQ","TFQC",18,1000 */
    constructor(string _name,string _symbol,uint8 _decimals,uint _totalSupply) ERC20 ( _name,_symbol, _decimals,_totalSupply) public{
    }
    //代币增发函数 
    function mine(address target,uint256 amount) public onlyOwner{
        totalSupply+=amount;
        balanceOf[target]+=amount;
        emit AddSupply(amount);//触发事件
        emit Transfer(0,target,amount);
    }
    //冻结函数
    function freezeAccount(address target,bool freeze) public onlyOwner{
        frozenAccount[target]=freeze;
        emit FrozenFunds(target,freeze);
    }
       //调用transfer函数将自己的token转账给_to地址，_value为转账个数
  function transfer(address _to, uint256 _value) public returns (bool success){
      require(!frozenAccount[msg.sender]);//判断账户是否冻结 
      require(_to!=address(0));//检测目标帐号不等于空帐号 
      require(balanceOf[msg.sender] >= _value);
      require(balanceOf[_to] + _value >=balanceOf[_to]);
      balanceOf[msg.sender]-=_value;
      balanceOf[_to]+=_value;
      emit Transfer(msg.sender,_to,_value);//触发事件
      return true;
  }
  //调用transferFrom函数来转移token。
  function transferFrom(address _from, address _to, uint256 _value) public returns (bool success){
      require(!frozenAccount[msg.sender]);//判断账户是否冻结 
      require(_to!=address(0));
      require(balanceOf[_from]>=_value);
      require(balanceOf[_to]+_value>balanceOf[_to]);
      require(allowed[_from][msg.sender]>_value);
      balanceOf[_from]-=_value;
      balanceOf[_to]+=_value;
      allowed[_from][msg.sender]-=_value;
      emit Transfer(_from,_to,_value);
      return true;
  }
  //销毁函数 
  function burn(uint256 values) public returns(bool success){
      require(balanceOf[msg.sender]>=values);
      totalSupply-=values;
      balanceOf[msg.sender]-=values;
      emit Burn(msg.sender,values);
      return true;
  }
}
//高级代币继承自前两个合约
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success){
      require(!frozenAccount[msg.sender]);//判断账户是否冻结 
      require(_to!=address(0));
      require(balanceOf[_from]>=_value);
      require(balanceOf[_to]+_value>balanceOf[_to]);
      require(allowed[_from][msg.sender]>_value);
      balanceOf[_from]-=_value;
      balanceOf[_to]+=_value;
      allowed[_from][msg.sender]-=_value;
      emit Transfer(_from,_to,_value);
      return true;
  }
//调用transferFrom函数来转移token。