contract SPACETokenFundraiser is MintableTokenFundraiser, PresaleFundraiser, IndividualCapsFundraiser, ForwardFundsFundraiser, TieredFundraiser, GasPriceLimitFundraiser {
    SPACETokenSafe public tokenSafe;

    constructor()
        HasOwner(msg.sender)
        public
    {
        token = new SPACEToken(
        
        address(this)  // The fundraiser is the minter
        );

        tokenSafe = new SPACETokenSafe(token);
        MintableToken(token).mint(address(tokenSafe), 315000000000000000000000);

        initializeBasicFundraiser(
            1543622400, // Start date = 2018-12-01 00:00 UTC
            1564617540,  // End date = 2019-07-31 23:59 UTC
            1, // Conversion rate = 1 SP per 1 ether
            0x413C7299268466e2E68A179750EBB7aC2d1D9160     // Beneficiary
        );

        initializeIndividualCapsFundraiser(
            (0 ether), // Minimum contribution
            (0 ether)  // Maximum individual cap
        );

        initializeGasPriceLimitFundraiser(
            0 // Gas price limit in wei
        );

        initializePresaleFundraiser(
            900000000000000000000000,
            1541030400, // Start = 2018-11-01 00:00 UTC
            1543622340,   // End = 2018-11-30 23:59 UTC
            1
        );

        

        

        
    }
    
    /**
      * @dev Define conversion rates based on the tier start and end date
      */
    function getConversionRate() public view returns (uint256) {
        uint256 rate = super.getConversionRate();
        if (now >= 1543622400 && now < 1546300740)
            return rate.mul(110).div(100);
        
        if (now >= 1546300800 && now < 1554076740)
            return rate.mul(105).div(100);
        
        if (now >= 1554076800 && now < 1564617540)
            return rate.mul(105).div(100);
        

        return rate;
    }

    /**
      * @dev Fundraiser with mintable token allows the owner to mint through the Fundraiser contract
      */
    function mint(address _to, uint256 _value) public onlyOwner {
        MintableToken(token).mint(_to, _value);
    }

    /**
      * @dev Irreversibly disable minting
      */
    function disableMinting() public onlyOwner {
        MintableToken(token).disableMinting();
    }
    
}
/**
 * @title SPACETokenFundraiser
 */
function mint(address _to, uint256 _value) public onlyOwner {
    MintableToken(token).mint(_to, _value);
}

/**
 * @dev Fundraiser with mintable token allows the owner to mint through the Fundraiser contract
 */