contract GetCrowdsale is MintedTokenCappedCrowdsale {
    uint public lockTime;
    FinalizeAgent presaleFinalizeAgent;
    event PresaleUpdated(uint weiAmount, uint tokenAmount);
    function GetCrowdsale(
        uint _lockTime, FinalizeAgent _presaleFinalizeAgent,
        address _token, PricingStrategy _pricingStrategy, address _multisigWallet,
        uint _start, uint _end, uint _minimumFundingGoal, uint _maximumSellableTokens)
        MintedTokenCappedCrowdsale(_token, _pricingStrategy, _multisigWallet,
            _start, _end, _minimumFundingGoal, _maximumSellableTokens)
    {
        require(_presaleFinalizeAgent.isSane());
        require(_lockTime > 0);
        lockTime = _lockTime;
        presaleFinalizeAgent = _presaleFinalizeAgent;
    }
    function logPresaleResults(uint tokenAmount, uint weiAmount) returns (bool) {
        require(msg.sender == address(presaleFinalizeAgent));
        weiRaised = weiRaised.plus(weiAmount);
        tokensSold = tokensSold.plus(tokenAmount);
        presaleWeiRaised = presaleWeiRaised.plus(weiAmount);
        PresaleUpdated(weiAmount, tokenAmount);
        return true;
    }
    // overriden because presaleWeiRaised was not altered and would mess with the TranchePricing
    function preallocate(address receiver, uint fullTokens, uint weiPrice) public onlyOwner {
        uint tokenAmount = fullTokens * 10**token.decimals();
        uint weiAmount = weiPrice * fullTokens; // This can be also 0, we give out tokens for free
        weiRaised = weiRaised.plus(weiAmount);
        tokensSold = tokensSold.plus(tokenAmount);
        presaleWeiRaised = presaleWeiRaised.plus(weiAmount);
        investedAmountOf[receiver] = investedAmountOf[receiver].plus(weiAmount);
        tokenAmountOf[receiver] = tokenAmountOf[receiver].plus(tokenAmount);
        assignTokens(receiver, tokenAmount);
        // Tell us invest was success
        Invested(receiver, weiAmount, tokenAmount, 0);
    }
    function setEarlyParicipantWhitelist(address addr, bool status) onlyOwner {
        // We don't need this function, we have external whitelist
        revert();
    }
    // added this here because it was not visible by preallocate
    function assignTokens(address receiver, uint tokenAmount) private {
        MintableToken mintableToken = MintableToken(token);
        mintableToken.mint(receiver, tokenAmount);
    }
    function finalize() public inState(State.Success) onlyOwner stopInEmergency {
        require(now > endsAt + lockTime);
        super.finalize();
    }
    function() payable {
        invest(msg.sender);
    }
}
function assignTokens(address receiver, uint tokenAmount) private {
        MintableToken mintableToken = MintableToken(token);
        mintableToken.mint(receiver, tokenAmount);
    }
// added this here because it was not visible by preallocate