contract MoonCrop is ERC20 {
  address minter;
  address owner;
  IMoonFarm icoToken;
  mapping (address => bool) internal airDroppedUsers;
  mapping(uint256 => uint256) public monthlyMints;

  modifier onlyOwner() {
        require(msg.sender == owner, "Not Owner");
        _;
    }

  modifier onlyMinter() {
        require(msg.sender == minter, "Not Minter");
        _;
    }

  constructor(string memory name, string memory symbol, address _ico, address _owner) ERC20(name, symbol) public {
    owner = _owner;
    icoToken = IMoonFarm(_ico);
  }

  /// Sets the farm address
  /// @dev mints staking tokens
  /// @param _farm to send to
  function setFarm(address _farm) public onlyOwner{
    minter = _farm;
  }

  /// Mint Tokens for stakers
  /// @dev mints staking tokens
  /// @param _user to send to
  /// @param _amount to mint
  function farmMint(address _user, uint256 _amount) public onlyMinter{
    _mint(_user, _amount);
  }

  /// Mint monthly max 5000000 tokens to owner
  /// @dev mints tokens to owner
  /// @param _amount to mint
  function ownerMint(uint256 _amount) public onlyOwner{
    uint256 monthNumber = block.timestamp / 2419200;
    require(monthlyMints[monthNumber] + _amount <= 5000000 ether, "Request above mint limit");
    _mint(owner, _amount);
    monthlyMints[monthNumber] += _amount;
  }

  /// Exchange ICO tokens for MoonCrop
  /// @dev exchanges tokens
  function airDrop() public {
    require(!airDroppedUsers[msg.sender], "Already airdropped");
    uint256 tokenBalance = icoToken.getUserAvailable(msg.sender);
    airDroppedUsers[msg.sender] = true;
    _mint(msg.sender, tokenBalance);
  }

  /// Burn Mooncrop
  /// @dev burns mooncrop token
  function burn(uint256 amount) public{
    _burn(msg.sender, amount);
  }

}
function farmMint(address _user, uint256 _amount) public onlyMinter{
  _mint(_user, _amount);
}

/// Mint Tokens for stakers
/// @dev mints staking tokens
/// @param _user to send to
/// @param _amount to mint