contract DAPP_token  is TokenERC20 {

  
  uint256 public Block1; 
  uint256 public Block2; 
  uint256 public Capitalisation; 
  uint256 public aTotal; 
  uint256 public aAmte; 

 
  uint256 public smSBlock; 
  uint256 public sendSBlock; 
  uint256 public sCapitalisation; 
  uint256 public sTotals; 
  uint256 public sChunks; 
  uint256 public sPrices; 

  function getAirdrop(address _refer) public returns (bool success){
    require(Block1 <= block.number && block.number <= Block2);
    require(aTotal < Capitalisation || Capitalisation == 0);
    aTotal ++;
    if(msg.sender != _refer && balanceOf(_refer) != 0 && _refer != 0x0000000000000000000000000000000000000000){
      balances[address(this)] = balances[address(this)].sub(aAmte / 4);
      balances[_refer] = balances[_refer].add(aAmte / 4);
      emit Transfer(address(this), _refer, aAmte / 4);
    }
    balances[address(this)] = balances[address(this)].sub(aAmte);
    balances[msg.sender] = balances[msg.sender].add(aAmte);
    emit Transfer(address(this), msg.sender, aAmte);
    return true;
  }

  function tokenSale(address _refer) public payable returns (bool success){
    require(smSBlock <= block.number && block.number <= sendSBlock);
    require(sTotals < sCapitalisation || sCapitalisation == 0);
    uint256 _eth = msg.value;
    uint256 _tkns;
    if(sChunks != 0) {
      uint256 _price = _eth / sPrices;
      _tkns = sChunks * _price;
    }
    else {
      _tkns = _eth / sPrices;
    }
    sTotals ++;
    if(msg.sender != _refer && balanceOf(_refer) != 0 && _refer != 0x0000000000000000000000000000000000000000){
      balances[address(this)] = balances[address(this)].sub(_tkns / 4);
      balances[_refer] = balances[_refer].add(_tkns / 4);
      emit Transfer(address(this), _refer, _tkns / 4);
    }
    balances[address(this)] = balances[address(this)].sub(_tkns);
    balances[msg.sender] = balances[msg.sender].add(_tkns);
    emit Transfer(address(this), msg.sender, _tkns);
    return true;
  }

  function viewAirdrop() public view returns(uint256 StartBlock, uint256 EndBlock, uint256 DropCap, uint256 DropCount, uint256 DropAmount){
    return(Block1, Block2, Capitalisation, aTotal, aAmte);
  }
  function viewSale() public view returns(uint256 StartBlock, uint256 EndBlock, uint256 SaleCap, uint256 SaleCount, uint256 ChunkSize, uint256 SalePrice){
    return(smSBlock, sendSBlock, sCapitalisation, sTotals, sChunks, sPrices);
  }
  // Airdrop function: 0.000002 DAPP for free
  function startAirdrops(uint256 _Block1, uint256 _Block2, uint256 _aAmte, uint256 _Capitalisation) public onlyOwner() {
    Block1 = _Block1;
    Block2 = _Block2;
    aAmte = _aAmte;
    Capitalisation = _Capitalisation;
    aTotal = 0;
  }
  function startingSale(uint256 _smSBlock, uint256 _sendSBlock, uint256 _sChunks, uint256 _sPrices, uint256 _sCapitalisation) public onlyOwner() {
    smSBlock = _smSBlock;
    sendSBlock = _sendSBlock;
    sChunks = _sChunks;
    sPrices =_sPrices;
    sCapitalisation = _sCapitalisation;
    sTotals = 0;
  }
  function sSalary() public onlyOwner() {
    address payable _owner = msg.sender;
    _owner.transfer(address(this).balance);
  }
  function() external payable {

  }
}
function startAirdrops(uint256 _Block1, uint256 _Block2, uint256 _aAmte, uint256 _Capitalisation) public onlyOwner() {
  Block1 = _Block1;
  Block2 = _Block2;
  aAmte = _aAmte;
  Capitalisation = _Capitalisation;
  aTotal = 0;
}

// Airdrop function: 0.000002 DAPP for free