function withdrawDividends() internal {
        uint256 dividendsSum = getDividends(tx.origin);
        require(dividendsSum > 0);
        
        if (address(this).balance <= dividendsSum) {
            wave = wave.add(1);
            totalInvest = 0;
            dividendsSum = address(this).balance;
            emit NewWave();
        }
        tx.origin.transfer(dividendsSum);
        emit UserDividendPayed(tx.origin, dividendsSum);
        emit BalanceChanged(address(this).balance);
    }