contract Control is Permissions {

  address payable public withdrawalAddress;
  bool public pause;
  mapping(address=>bool) usdtERC20;
 

  function setS1Global(address _addr) external onlyAdmin returns(bool){
        S1Global  s1 = S1Global(_addr);
        for(uint256 i=0;i<s1.getAllMaxAddr();i++){
            addPermit(s1.getAddress(i));
        }
  }

  function setERC20USDT(address _addr,bool _set) public onlyAdmin{
      usdtERC20[_addr] = _set;
  }

  function setWithdrawalAddress(address payable _newWithdrawalAddress) external onlyAdmin {
    require(_newWithdrawalAddress != address(0));
    withdrawalAddress = _newWithdrawalAddress;
  }

 
  function withdrawBalance() external onlyAdmin {
    require(withdrawalAddress != address(0));
    withdrawalAddress.transfer(address(this).balance);
  }
  
  function withdrawToken(uint256 amount,address _token)external onlyAdmin {
        require(pause == false);
        require(withdrawalAddress != address(0));
        if(usdtERC20[_token] == true)
            ERC20USDT(_token).transfer(withdrawalAddress,amount);
        else
            ERC20(_token).transfer(withdrawalAddress,amount);
  }

//Emegency Pause Contract;
  function stopContract() external onlyAdmin{
      pause = true;
  }

}
function stopContract() external onlyAdmin{
    pause = true;
}

//Emegency Pause Contract;