contract TapcoinCrowdsale is Crowdsale {
  
  using SafeMath for uint;

  // The default minimum funding limit 419,000 USD
  uint public minimumFundingUSD = 419 * 10**3;

  // Max of 75k ETH.
  uint public hardCapUSD = 22 * 10**6;


  function TapcoinCrowdsale(address _token, PricingStrategy _pricingStrategy, address _multisigWallet, uint _start, uint _end)
    Crowdsale(_token, _pricingStrategy, _multisigWallet, _start, _end, 0) {
  }

  /*
   * Get minimum funding goal in wei.
   */
  function getMinimumFundingGoal() public constant returns (uint goalInWei) {
    return TapcoinPricing(pricingStrategy).convertToWei(minimumFundingUSD);
  }

  /*
   * Allow reset the threshold.
   */
  function setMinimumFundingLimit(uint usd) onlyOwner {
    minimumFundingUSD = usd;
  }

  /*
   * @return true if the crowdsale has raised enough money to be a succes
   */
  function isMinimumGoalReached() public constant returns (bool reached) {
    return weiRaised >= getMinimumFundingGoal();
  }

  function getHardCap() public constant returns (uint capInWei) {
    return TapcoinPricing(pricingStrategy).convertToWei(hardCapUSD);
  }

  /*
   * Reset hard cap.
   *
   * Assigns softcap in USD
   */
  function setHardCapUSD(uint _hardCapUSD) onlyOwner {
    hardCapUSD = _hardCapUSD;
  }

  /*
   * Called from invest() to confirm if the current investment does not break our cap rule.
   */
  function isBreakingCap(uint weiAmount, uint tokenAmount, uint weiRaisedTotal, uint tokensSoldTotal) constant returns (bool limitBroken) {
    return weiRaisedTotal > getHardCap();
  }

  function isCrowdsaleFull() public constant returns (bool) {
    return weiRaised >= getHardCap();
  }

  /*
   * @return true we have reached our soft cap
   */
  function isSoftCapReached() public constant returns (bool reached) {
    return weiRaised >= TapcoinPricing(pricingStrategy).getSoftCapInWeis();
  }


  /*
   * Dynamically create tokens and assign them to the investor.
   */
  function assignTokens(address receiver, uint tokenAmount) private {
    MintableToken mintableToken = MintableToken(token);
    mintableToken.mint(receiver, tokenAmount);
  }
}
function isSoftCapReached() public constant returns (bool reached) {
  return weiRaised >= TapcoinPricing(pricingStrategy).getSoftCapInWeis();
}

/*
 * @return true we have reached our soft cap
 */