-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathERC7540VaultFactory.sol
44 lines (37 loc) · 1.35 KB
/
ERC7540VaultFactory.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
44
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.8.26;
import {ERC7540Vault} from "src/ERC7540Vault.sol";
import {IERC7540VaultFactory} from "src/interfaces/factories/IERC7540VaultFactory.sol";
import {Auth} from "src/Auth.sol";
/// @title ERC7540 Vault Factory
/// @dev Utility for deploying new vault contracts
contract ERC7540VaultFactory is Auth, IERC7540VaultFactory {
address public immutable root;
constructor(address _root) Auth(msg.sender) {
root = _root;
}
/// @inheritdoc IERC7540VaultFactory
function newVault(
uint64 poolId,
bytes16 trancheId,
address asset,
address tranche,
address escrow,
address investmentManager,
address[] calldata wards_
) public auth returns (address) {
ERC7540Vault vault = new ERC7540Vault(poolId, trancheId, asset, tranche, root, escrow, investmentManager);
vault.rely(root);
uint256 wardsCount = wards_.length;
for (uint256 i; i < wardsCount; i++) {
vault.rely(wards_[i]);
}
Auth(investmentManager).rely(address(vault));
vault.deny(address(this));
return address(vault);
}
/// @inheritdoc IERC7540VaultFactory
function denyVault(address vault, address investmentManager) public auth {
Auth(investmentManager).deny(address(vault));
}
}