-
Notifications
You must be signed in to change notification settings - Fork 1
/
MultiSigWalletFactory.sol
43 lines (37 loc) · 1.45 KB
/
MultiSigWalletFactory.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// SPDX-License-Identifier: MIT
pragma solidity 0.8.24;
import { MultiSigWallet } from "./MultiSigWallet.sol";
/**
* @title MultiSigWalletFactory contract
* @author CloudWalk Inc.
* @dev The contract factory for creating new multisig wallet contracts.
*/
contract MultiSigWalletFactory {
/**
* @dev Emitted when a new multisig wallet is deployed.
* @param deployer The address of the wallet deployer.
* @param wallet The address of the deployed wallet.
* @param id The id of the deployed wallet.
*/
event NewWallet(address indexed deployer, address indexed wallet, uint indexed id);
/// @dev An array of wallets deployed by this factory.
address[] public wallets;
/**
* @dev Deploys a new multisig wallet contract.
* @param owners An array of the owners of the deployed wallet.
* @param requiredApprovals The number of required approvals to execute transactions.
* @return The address of the deployed wallet.
*/
function deployNewWallet(address[] memory owners, uint16 requiredApprovals) external returns (address) {
address newWallet = address(new MultiSigWallet(owners, requiredApprovals));
wallets.push(newWallet);
emit NewWallet(msg.sender, newWallet, wallets.length - 1);
return newWallet;
}
/**
* @dev Returns the number of deployed wallets.
*/
function walletsCount() external view returns (uint256) {
return wallets.length;
}
}