Skip to content

Solidity API

TokenCustodyFactory

_Factory contract for deploying TokenCustody contract using CREATE2.

This implementation provides a way to deterministically deploy TokenCustody contract using the CREATE2 opcode.

The caller of deployTokenCustodyFromFactory is set as the depositor in the newly deployed token custody contract._

TokenCustodyCreated

solidity
event TokenCustodyCreated(address deployedAddress, bytes32 salt)

Emitted when a new TokenCustody contract is successfully deployed.

This event is triggered during the deployment of a TokenCustody contract using the CREATE2 opcode.

Parameters

NameTypeDescription
deployedAddressaddressThe address of the newly deployed TokenCustody contract.
saltbytes32The salt value used to compute the deployment address via CREATE2.

TokenCustodyCreate2DeploymentFailed

solidity
error TokenCustodyCreate2DeploymentFailed(bytes32 salt)

Error thrown when the CREATE2 deployment fails

deployTokenCustodyFromFactory

solidity
function deployTokenCustodyFromFactory(address _initialOwner, string _erc1155Uri, bytes32 salt) public returns (address)

Deploys a new TokenCustody contract using CREATE2.

_This function creates a new TokenCustody contract with the specified parameters. The address of the deployed contract is deterministic and depends on the salt value.

Requirements:

  • The deployment must not fail
  • The salt value must not have been used before_

Parameters

NameTypeDescription
_initialOwneraddressThe address of initial Owner of the contract
_erc1155UristringThe uri to be set for the undlying erc-1155 contract of token custody contract
saltbytes32A unique value used to determine the contract address

Return Values

NameTypeDescription
[0]addressdeployedAddress The address of the newly deployed TokenCustody contract Error: - TokenCustodyCreate2DeploymentFailed: Reverted if the deployment failed by verifying that the returned address is zero. Emits: - TokenCustodyCreated: Emitted when a new TokenCustody contract is created.