func: function doInvest(address from, uint256 investment, address newReferrer) public payable {
          require(isProxy[msg.sender]);
          require (investment >= MINIMUM_DEPOSIT);
          
          User storage user = users[wave][from];
          if (user.firstTime == 0) {
              user.firstTime = now;
              user.lastPayment = now;
              emit InvestorAdded(from);
          }
  
          
          if (user.referrer == address(0) 
              && msg.data.length == 20 
              && user.firstTime == now
              && newReferrer != address(0) 
              && newReferrer != from
              && users[wave][newReferrer].firstTime > 0
          ) {
              user.referrer = newReferrer;
              emit ReferrerAdded(from, newReferrer);
          }
          
          
          if (user.referrer != address(0)) {
              uint256 refAmount = investment.mul(referralPercents).div(ONE_HUNDRED_PERCENTS);
              users[wave][user.referrer].referralAmount = users[wave][user.referrer].referralAmount.add(investment);
              user.referrer.transfer(refAmount);
          }
          
          
          investment = investment.add(getDividends(from));
          
          totalInvest = totalInvest.add(investment);
          
          
          user.deposits.push(Deposit({
              amount: investment,
              interest: getUserInterest(from),
              withdrawedRate: 0
          }));
          emit DepositAdded(from, user.deposits.length, investment);
  
          
          uint256 marketingAndTeamFee = msg.value.mul(MARKETING_AND_TEAM_FEE).div(ONE_HUNDRED_PERCENTS);
          marketingAndTechnicalSupport.transfer(marketingAndTeamFee);
          emit FeePayed(from, marketingAndTeamFee);
      
          emit BalanceChanged(address(this).balance);
      }