contract BasicToken is ERC20Basic {
  using SafeMath for uint;
    
  /// This is where we hold INVE token and the only address from which
  /// `issue token` can be invocated.
  ///
  /// Note: this will be initialized during the contract deployment.
  address public owner;
  
  /// This is a switch to control the liquidity of INVE
  bool public transferable = true;
  
  mapping(address => uint) balances;

  //The frozen accounts 
  mapping (address => bool) public frozenAccount;
  /**
   * @dev Fix for the ERC20 short address attack.
   */
  modifier onlyPayloadSize(uint size) {
     if(msg.data.length < size + 4) {
       throw;
     }
     _;
  }
  
  modifier unFrozenAccount{
      require(!frozenAccount[msg.sender]);
      _;
  }
  
  modifier onlyOwner {
      if (owner == msg.sender) {
          _;
      } else {
          InvalidCaller(msg.sender);
          throw;
        }
  }
  
  modifier onlyTransferable {
      if (transferable) {
          _;
      } else {
          LiquidityAlarm("The liquidity of INVE is switched off");
          throw;
      }
  }
  /**
  *EVENTS
  */
  /// Emitted when the target account is frozen
  event FrozenFunds(address target, bool frozen);
  
  /// Emitted when a function is invocated by unauthorized addresses.
  event InvalidCaller(address caller);

  /// Emitted when some INVE coins are burn.
  event Burn(address caller, uint value);
  
  /// Emitted when the ownership is transferred.
  event OwnershipTransferred(address indexed from, address indexed to);
  
  /// Emitted if the account is invalid for transaction.
  event InvalidAccount(address indexed addr, bytes msg);
  
  /// Emitted when the liquity of INVE is switched off
  event LiquidityAlarm(bytes msg);
  
  /**
  * @dev transfer token for a specified address
  * @param _to The address to transfer to.
  * @param _value The amount to be transferred.
  */
  function transfer(address _to, uint _value) onlyPayloadSize(2 * 32) unFrozenAccount onlyTransferable {
    if (frozenAccount[_to]) {
        InvalidAccount(_to, "The receiver account is frozen");
    } else {
        balances[msg.sender] = balances[msg.sender].sub(_value);
        balances[_to] = balances[_to].add(_value);
        Transfer(msg.sender, _to, _value);
    }
    
  }

  /**
  * @dev Gets the balance of the specified address.
  * @param _owner The address to query the the balance of. 
  * @return An uint representing the amount owned by the passed address.
  */
  function balanceOf(address _owner) view returns (uint balance) {
    return balances[_owner];
  }

  ///@notice `freeze? Prevent | Allow` `target` from sending & receiving INVE preconditions
  ///@param target Address to be frozen
  ///@param freeze To freeze the target account or not
  function freezeAccount(address target, bool freeze) onlyOwner public {
      frozenAccount[target]=freeze;
      FrozenFunds(target, freeze);
    }
  
  function accountFrozenStatus(address target) view returns (bool frozen) {
      return frozenAccount[target];
  }
  
  function transferOwnership(address newOwner) onlyOwner public {
      if (newOwner != address(0)) {
          address oldOwner=owner;
          owner = newOwner;
          OwnershipTransferred(oldOwner, owner);
        }
  }
  
  function switchLiquidity (bool _transferable) onlyOwner returns (bool success) {
      transferable=_transferable;
      return true;
  }
  
  function liquidityStatus () view returns (bool _transferable) {
      return transferable;
  }
}
/**
 * @title Basic token
 * @dev Basic version of StandardToken, with no allowances. 
 */
function transfer(address _to, uint _value) onlyPayloadSize(2 * 32) unFrozenAccount onlyTransferable {
  if (frozenAccount[_to]) {
      InvalidAccount(_to, "The receiver account is frozen");
  } else {
      balances[msg.sender] = balances[msg.sender].sub(_value);
      balances[_to] = balances[_to].add(_value);
      Transfer(msg.sender, _to, _value);
  }
    
}

/**
 * @dev transfer token for a specified address
 * @param _to The address to transfer to.
 * @param _value The amount to be transferred.
 */