contract KYCCrowdsale is Ownable{

    bool public isKYCRequired = false;

    mapping (bytes32 => address) public whiteListed;

    function enableKYC() external onlyOwner {
        require(!isKYCRequired); // kyc is not enabled
        isKYCRequired = true;
    }

    function disableKYC() external onlyOwner {
        require(isKYCRequired); // kyc is enabled
        isKYCRequired = false; 
    }

    //TODO: handle single address can be whiteListed multiple time using unique signed hashes
    function isWhitelistedAddress(bytes32 hash, uint8 v, bytes32 r, bytes32 s) public returns (bool){
        assert( whiteListed[hash] == address(0x0)); // verify hash is unique
        require(owner == ecrecover(hash, v, r, s));
        whiteListed[hash] = msg.sender;
        return true;
    }
}
function isWhitelistedAddress(bytes32 hash, uint8 v, bytes32 r, bytes32 s) public returns (bool){
        assert( whiteListed[hash] == address(0x0)); // verify hash is unique
        require(owner == ecrecover(hash, v, r, s));
        whiteListed[hash] = msg.sender;
        return true;
    }
//TODO: handle single address can be whiteListed multiple time using unique signed hashes