ODCinterfaces

IVaultFactory

Interface for a factory contract that allows anyone to reliably deploy a new IVault contract

VaultCreated

event VaultCreated(address vaultOwner, address vault)

A new Vault is deployed

MUST be triggered on a successful deployment

Parameters

NameTypeDescription
vaultOwneraddressThe vault owner
vaultaddressThe vault address

deploy

function deploy(bytes data) external returns (contract IVault)

Deploys a new Vault contract

This function creates a new Vault instance It MUST emit a VaultCreated event upon successful creation An IVault type object is returned because Vault implementations are specific to each implementation but have to follow the IVault interface

Parameters

NameTypeDescription
databytesFor any additional initialization

Return Values

NameTypeDescription
[0]contract IVaultIVault The created Vault contract following IVault interface

deployDeterministic

function deployDeterministic(bytes32 salt, bytes data) external returns (contract IVault)

Deploys a new Vault contract at a deterministic address

This function creates a new Vault instance at a deterministic address, we recommend using the Create2 opcode It MUST emit a VaultCreated event upon successful creation An IVault type object is returned because Vault implementations are specific to each implementation but have to follow the IVault interface

Parameters

NameTypeDescription
saltbytes32A unique value to ensure the deterministic address is unique
databytesFor any additional initialization

Return Values

NameTypeDescription
[0]contract IVaultIVault The created Vault contract following IVault interface

computeVaultAddress

function computeVaultAddress(address deployer, bytes32 salt, bytes data) external view returns (address)

Computes the deterministic address of a Vault contract

This function calculates the address where a Vault contract will be deployed we recommend the use of Create2 opcode, given the deployer's address and a salt

Parameters

NameTypeDescription
deployeraddressThe address of the deployer
saltbytes32A unique value to ensure the deterministic address is unique
databytesFor any additional initialization

Return Values

NameTypeDescription
[0]addressaddress The computed deterministic address of the Vault contract

On this page