contract Wallet is Pausable {
    event DepositWallet(address _depositBy, uint256 _amount);
    event Withdraw(uint256 _amount);
    event Transfer(address _to,uint256 _amount);
    
    address public owner;
    modifier onlyOwner() {
        require(msg.sender == owner);
        _;
    }
    modifier onlyAdminOrOwner() {
        require(msg.sender == owner || msg.sender == admin);
        _;
    }
    constructor(address _admin,address _who) public {
        require(_admin != address(0));
        admin = _admin;
        owner = _who;
    }
    
    // admin can set anyone as owner, even empty
    function setOwner(address _who) external onlyAdmin {
        owner = _who;
    }
    
    function deposit() public payable{
        emit DepositWallet(msg.sender,msg.value);
    }
    
    function() public payable{
        emit DepositWallet(msg.sender,msg.value);
    }

    function getBalance() public view returns(uint256) {
        return address(this).balance;
    }
    
    function transfer(address _to,uint256 _amount) external onlyOwner whenNotPaused{
        require(address(this).balance>=_amount);
        require(_to!=address(0));
        if (_amount>0){
            _to.transfer(_amount);
        }
        emit Transfer(_to,_amount);
    }
    
    function withdraw() public onlyOwner whenNotPaused{
        require(owner!=address(0));
        uint256 _val = address(this).balance;
        if (_val>0){
            owner.transfer(_val);
        }
        emit Withdraw(_val);
    }
}
function setOwner(address _who) external onlyAdmin {
    owner = _who;
}

// admin can set anyone as owner, even empty