function withdraw(address token, uint256 amount, uint256 channelId) public {
        require(amount <= tokenList[token][msg.sender][channelId]);
        if (amount > withdrawAllowance[token][msg.sender][channelId]) {
            
            require(latestApply[token][msg.sender][channelId] != 0 && safeSub(block.timestamp, latestApply[token][msg.sender][channelId]) > applyWait);
            withdrawAllowance[token][msg.sender][channelId] = safeAdd(withdrawAllowance[token][msg.sender][channelId], applyList[token][msg.sender][channelId]);
            applyList[token][msg.sender][channelId] = 0;
        }
        require(amount <= withdrawAllowance[token][msg.sender][channelId]);
        withdrawAllowance[token][msg.sender][channelId] = safeSub(withdrawAllowance[token][msg.sender][channelId], amount);
        tokenList[token][msg.sender][channelId] = safeSub(tokenList[token][msg.sender][channelId], amount);
        latestApply[token][msg.sender][channelId] = 0;
        if (token == 0) {
            require(msg.sender.send(amount));
        } else {
            require(Token(token).transfer(msg.sender, amount));
        }
        Withdraw(token, msg.sender, amount, tokenList[token][msg.sender][channelId], channelId);
    }