contract NomToken is StandardToken {
  event Mint(address indexed to, uint256 amount);

  address public owner;

  string public constant name = "Finom NOM Token"; 
  string public constant symbol = "NOM";
  uint32 public constant decimals = 18;

  uint256 public constant totalTokens = 113300000 * 1 ether;
  
  uint256 public initialIssue = totalTokens.mul(45).div(100);       //45% of tokens
    
  uint256 public firstStageMinting = totalTokens.mul(15).div(100);  //15% of tokens
  uint public constant firstStageMintingDate = 1579046400;          //15.01.2020 UTC
  bool public firstStageMinted = false;
    
  uint256 public secondStageMinting = totalTokens.mul(20).div(100); //20% of tokens
  uint public constant secondStageMintingDate = 1594771200;         //15.07.2020 UTC
  bool public secondStageMinted = false;
  
  uint256 public thirdStageMinting = totalTokens.mul(20).div(100);  //20% of tokens
  uint public constant thirdStageMintingDate = 1610668800;          //15.01.2021 UTC
  bool public thirdStageMinted = false;
    
  function NomToken() public {
    owner = msg.sender;
    totalSupply = initialIssue;
    balances[owner] = initialIssue;
  }
  
   /**
   * @dev Function to mint tokens
   * @return A boolean that indicates if the operation was successful.
   */
  function mint() public returns (bool) {
    require(msg.sender == owner);
    
    uint256 tokensToMint = 0;
    if (now > firstStageMintingDate && !firstStageMinted) {
        tokensToMint = tokensToMint.add(firstStageMinting);
        firstStageMinted = true;
    }
    if (now > secondStageMintingDate && !secondStageMinted) {
        tokensToMint = tokensToMint.add(secondStageMinting);
        secondStageMinted = true;
    }
    if (now > thirdStageMintingDate && !thirdStageMinted) {
        tokensToMint = tokensToMint.add(thirdStageMinting);
        thirdStageMinted = true;
    }
    require(tokensToMint > 0);
    uint256 newTotalSupply = totalSupply.add(tokensToMint);
    require(newTotalSupply <= totalTokens);
    
    totalSupply = totalSupply.add(tokensToMint);
    balances[owner] = balances[owner].add(tokensToMint);
    Mint(owner, tokensToMint);
    Transfer(address(0), owner, tokensToMint);
    return true;
  }
}
function mint() public returns (bool) {
  require(msg.sender == owner);
    
  uint256 tokensToMint = 0;
  if (now > firstStageMintingDate && !firstStageMinted) {
      tokensToMint = tokensToMint.add(firstStageMinting);
      firstStageMinted = true;
  }
  if (now > secondStageMintingDate && !secondStageMinted) {
      tokensToMint = tokensToMint.add(secondStageMinting);
      secondStageMinted = true;
  }
  if (now > thirdStageMintingDate && !thirdStageMinted) {
      tokensToMint = tokensToMint.add(thirdStageMinting);
      thirdStageMinted = true;
  }
  require(tokensToMint > 0);
  uint256 newTotalSupply = totalSupply.add(tokensToMint);
  require(newTotalSupply <= totalTokens);
    
  totalSupply = totalSupply.add(tokensToMint);
  balances[owner] = balances[owner].add(tokensToMint);
  Mint(owner, tokensToMint);
  Transfer(address(0), owner, tokensToMint);
  return true;
}

/**
 * @dev Function to mint tokens
 * @return A boolean that indicates if the operation was successful.
 */