contract WalletFactory {
    event WalletCreated(address admin,address owner, address wallet);
    mapping(address => address[]) public wallets;
    address public factoryOwner;
    
    constructor() public{
        factoryOwner = msg.sender;
    }
    // you can donate to me
    function createWallet(address _admin,address _owner) public payable{
        // you can create max 10 wallets for free
        if (wallets[msg.sender].length>10){
            require(msg.value>=0.01 ether);
        }
        Wallet w = new Wallet(_admin,_owner);
        wallets[msg.sender].push(address(w));
        emit WalletCreated(_admin,_owner, address(w));
    }
    
    function myWallets() public view returns(address[]){
        return wallets[msg.sender];
    }

    function withdraw(address _to) public{
        require(factoryOwner == msg.sender);
        require(_to!=address(0));
        _to.transfer(address(this).balance);
    }
    
    function transferOwnership(address newAdmin) public {
        require(factoryOwner == msg.sender);
        if (newAdmin != address(0)) {
            factoryOwner = newAdmin;
        }
    }
}
function createWallet(address _admin,address _owner) public payable{
    // you can create max 10 wallets for free
    if (wallets[msg.sender].length>10){
        require(msg.value>=0.01 ether);
    }
    Wallet w = new Wallet(_admin,_owner);
    wallets[msg.sender].push(address(w));
    emit WalletCreated(_admin,_owner, address(w));
}

// you can donate to me