contract MintableToken is StandardToken, Ownable, LiqnetExtToken {
    
  event Mint(address indexed to, uint256 amount);
  
  event MintFinished();
 
  bool public mintingFinished = false;
 
  address public saleAgent;
  
  constructor () public {
      saleAgent = msg.sender;
  }
  
  /**
   * @dev Allows the current owner to approve control of the minting to additional address.
   * @param newSaleAgent The address to approve minting control.
   */
  function setSaleAgent(address newSaleAgent) public {
    require(msg.sender == saleAgent || msg.sender == owner);
    saleAgent = newSaleAgent;
  }
  
  /**
   * @dev Allows the current owner or saleAgent mint some coins to address.
   * @param _to The address for new coins.
   * @param _amount amount of coin to mint.
   * @return true if mint is successful.
   */
  function mint(address _to, uint256 _amount) public canMint(_amount) returns (bool) {
    require((msg.sender == saleAgent || msg.sender == owner) && !mintingFinished);
    totalSupply = totalSupply.add(_amount);
    totalMinted = totalMinted.add(_amount); //**************************LiqnetExtToken
    balances[_to] = balances[_to].add(_amount);
    emit Mint(_to, _amount);
    if (isMintFinished()) { finishMinting(); } //***********LiqnetExtToken
    return true;
  }
 
  /**
   * @dev Function to stop minting new tokens.
   * @return True if the operation was successful.
   */
  function finishMinting() public returns (bool) {
    require((msg.sender == saleAgent || msg.sender == owner) && !mintingFinished);
    mintingFinished = true;
    emit MintFinished();
    return true;
  }
}
/**
 * @title Mintable token
 * @dev Simple ERC20 Token example, with mintable token creation
 * @dev Issue: * https://github.com/OpenZeppelin/zeppelin-solidity/issues/120
 * Based on code by TokenMarketNet: https://github.com/TokenMarketNet/ico/blob/master/contracts/MintableToken.sol
 */
function finishMinting() public returns (bool) {
  require((msg.sender == saleAgent || msg.sender == owner) && !mintingFinished);
  mintingFinished = true;
  emit MintFinished();
  return true;
}

/**
 * @dev Function to stop minting new tokens.
 * @return True if the operation was successful.
 */