# 工厂合约

By [web3zoom](https://paragraph.com/@web3zoom) · 2025-07-19

---

    // SPDX-License-Identifier: GPL-3.0
    
    pragma solidity ^0.8.30;
    
    contract Account{
        address public bank;
        address public owner;
    
        constructor(address _owner) payable{
            bank = msg.sender;
            owner = _owner;
        }
    }
    
    contract AccountFactory{
        Account[] public accounts;
    
        function createAccount(address _owner) external payable{
            Account account = new Account{value: 111}(_owner);
            accounts.push(account);
        }
    }
    

通过工厂合约地址创建账户合约

---

*Originally published on [web3zoom](https://paragraph.com/@web3zoom/dtKSHIHhP8AXrMNwscMH)*
