contract HashRushICO is Owned, HashRush {
    // Applies SafeMath library to uint256 operations
    using SafeMath for uint256;

    // Public Variables
    address public multiSigWallet;
    uint256 public amountRaised;
    uint256 public startTime;
    uint256 public stopTime;
    uint256 public fixedTotalSupply;
    uint256 public price;
    uint256 public minimumInvestment;
    uint256 public crowdsaleTarget;

    // Variables
    bool crowdsaleClosed = true;
    string tokenName = "HashRush";
    string tokenSymbol = "RUSH";
    uint256 multiplier = 100000000;
    uint8 decimalUnits = 8;

    // Initializes the token
    constructor()
        HashRush(tokenName, tokenSymbol, decimalUnits, multiplier) public {
            multiSigWallet = msg.sender;
            fixedTotalSupply = 70000000;
            fixedTotalSupply = fixedTotalSupply.mul(multiplier);
    }

    /**
     * @dev Fallback function creates tokens and sends to investor when crowdsale is open
     */
    function () public payable {
        require(!crowdsaleClosed
            && (now < stopTime)
            && (msg.value >= minimumInvestment)
            && (amountRaised.add(msg.value.div(1 ether)) <= crowdsaleTarget)
        );

        amountRaised = amountRaised.add(msg.value.div(1 ether));

        multiSigWallet.transfer(msg.value);
    }

    /**
     * @dev Function to mint tokens
     * @param target The address that will receive the minted tokens.
     * @param amount The amount of tokens to mint.
     * @return A boolean that indicates if the operation was successful.
     */
    function mintToken(address target, uint256 amount) onlyOwner public returns (bool) {
        require(amount > 0);
        require(totalSupply_.add(amount) <= fixedTotalSupply);
        uint256 addTokens = amount;
        balance[target] = balance[target].add(addTokens);
        totalSupply_ = totalSupply_.add(addTokens);
        emit Transfer(0, target, addTokens);
        return true;
    }

    /**
     * @dev Function to set token price
     * @param newPriceperEther New price.
     * @return A boolean that indicates if the operation was successful.
     */
    function setPrice(uint256 newPriceperEther) onlyOwner public returns (uint256) {
        require(newPriceperEther > 0);
        price = newPriceperEther;
        return price;
    }

    /**
     * @dev Function to set the multisig wallet for a crowdsale
     * @param wallet Wallet address.
     * @return A boolean that indicates if the operation was successful.
     */
    function setMultiSigWallet(address wallet) onlyOwner public returns (bool) {
        multiSigWallet = wallet;
        return true;
    }

    /**
     * @dev Function to set the minimum investment to participate in crowdsale
     * @param minimum minimum amount in wei.
     * @return A boolean that indicates if the operation was successful.
     */
    function setMinimumInvestment(uint256 minimum) onlyOwner public returns (bool) {
        minimumInvestment = minimum;
        return true;
    }

    /**
     * @dev Function to set the crowdsale target
     * @param target Target amount in ETH.
     * @return A boolean that indicates if the operation was successful.
     */
    function setCrowdsaleTarget(uint256 target) onlyOwner public returns (bool) {
        crowdsaleTarget = target;
        return true;
    }

    /**
     * @dev Function to start the crowdsale specifying startTime and stopTime
     * @param saleStart Sale start timestamp.
     * @param saleStop Sale stop timestamo.
     * @param salePrice Token price per ether.
     * @param setBeneficiary Beneficiary address.
     * @param minInvestment Minimum investment to participate in crowdsale (wei).
     * @param saleTarget Crowdsale target in ETH
     * @return A boolean that indicates if the operation was successful.
     */
    function startSale(uint256 saleStart, uint256 saleStop, uint256 salePrice, address setBeneficiary, uint256 minInvestment, uint256 saleTarget) onlyOwner public returns (bool) {
        require(saleStop > now);
        startTime = saleStart;
        stopTime = saleStop;
        amountRaised = 0;
        crowdsaleClosed = false;
        setPrice(salePrice);
        setMultiSigWallet(setBeneficiary);
        setMinimumInvestment(minInvestment);
        setCrowdsaleTarget(saleTarget);
        return true;
    }

    /**
     * @dev Function that allows owner to stop the crowdsale immediately
     * @return A boolean that indicates if the operation was successful.
     */
    function stopSale() onlyOwner public returns (bool) {
        stopTime = now;
        crowdsaleClosed = true;
        return true;
    }
}
function setCrowdsaleTarget(uint256 target) onlyOwner public returns (bool) {
        crowdsaleTarget = target;
        return true;
    }
/**
 * @dev Function to set the crowdsale target
 * @param target Target amount in ETH.
 * @return A boolean that indicates if the operation was successful.
 */