contract AllowanceCrowdsale is Crowdsale {
  using SafeMath for uint256;

  address public tokenWallet;

  /**
   * @dev Constructor, takes token wallet address. 
   * @param _tokenWallet Address holding the tokens, which has approved allowance to the crowdsale
   */
  function AllowanceCrowdsale(address _tokenWallet) public {
    require(_tokenWallet != address(0));
    tokenWallet = _tokenWallet;
  }

  /**
   * @dev Checks the amount of tokens left in the allowance.
   * @return Amount of tokens left in the allowance
   */
  function remainingTokens() public view returns (uint256) {
    return token.balanceOf(tokenWallet);
  }

  /**
   * @dev Overrides parent behavior by transferring tokens from wallet.
   * @param _beneficiary Token purchaser
   * @param _tokenAmount Amount of tokens purchased
   */
  function _deliverTokens(address _beneficiary, uint256 _tokenAmount) internal {
    token.saleTokens(_beneficiary, _tokenAmount);
  }
}
function AllowanceCrowdsale(address _tokenWallet) public {
  require(_tokenWallet != address(0));
  tokenWallet = _tokenWallet;
}

/**
 * @dev Constructor, takes token wallet address. 
 * @param _tokenWallet Address holding the tokens, which has approved allowance to the crowdsale
 */