forked from morpho-org/vault-v2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVaultV2Factory.sol
More file actions
22 lines (17 loc) · 843 Bytes
/
VaultV2Factory.sol
File metadata and controls
22 lines (17 loc) · 843 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// SPDX-License-Identifier: GPL-2.0-or-later
// Copyright (c) 2025 Morpho Association
pragma solidity 0.8.28;
import {VaultV2} from "./VaultV2.sol";
import {IVaultV2Factory} from "./interfaces/IVaultV2Factory.sol";
contract VaultV2Factory is IVaultV2Factory {
mapping(address account => bool) public isVaultV2;
mapping(address owner => mapping(address asset => mapping(bytes32 salt => address))) public vaultV2;
/// @dev Returns the address of the deployed VaultV2.
function createVaultV2(address owner, address asset, bytes32 salt) external returns (address) {
address newVaultV2 = address(new VaultV2{salt: salt}(owner, asset));
isVaultV2[newVaultV2] = true;
vaultV2[owner][asset][salt] = newVaultV2;
emit CreateVaultV2(owner, asset, salt, newVaultV2);
return newVaultV2;
}
}