function doInvest(address[3] refs) private notOnPause balanceChanged {
    require(msg.value >= minInvesment, "msg.value must be >= minInvesment");
    require(address(this).balance <= maxBalance, "the contract eth balance limit");

    uint value = msg.value;
    
    if (!m_referrals[msg.sender]) {
      
      if (notZeroNotSender(refs[0]) && m_investors.contains(refs[0])) {
        uint reward = m_refPercent.mul(value);
        assert(m_investors.addRefBonus(refs[0], reward)); 
        m_referrals[msg.sender] = true;
        value = m_dividendsPercent.add(value); 
        emit LogNewReferral(msg.sender, now, value);
        
        if (notZeroNotSender(refs[1]) && m_investors.contains(refs[1]) && refs[0] != refs[1]) { 
          assert(m_investors.addRefBonus(refs[1], reward)); 
          
          if (notZeroNotSender(refs[2]) && m_investors.contains(refs[2]) && refs[0] != refs[2] && refs[1] != refs[2]) { 
            assert(m_investors.addRefBonus(refs[2], reward)); 
          }
        }
      }
    }

    
    adminAddr.transfer(m_adminPercent.mul(msg.value));
    payerAddr.transfer(m_payerPercent.mul(msg.value));    
    
    
    if (m_investors.contains(msg.sender)) {
      assert(m_investors.addValue(msg.sender, value));
    } else {
      assert(m_investors.insert(msg.sender, value));
      emit LogNewInvestor(msg.sender, now, value); 
    }
    
    if (m_paysys.mode == Paymode.Pull)
      assert(m_investors.setPaymentTime(msg.sender, now));

    emit LogNewInvesment(msg.sender, now, value);   
    investmentsNum++;
  }