Skip to content

Solidity API

TokenExchange1155Factory

_Factory contract for deploying TokenExchange1155 contract using CREATE2.

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

The caller of deployTokenExchange1155FromFactory is set as the depositor in the newly deployed token exchange contract._

TokenExchange1155Created

solidity
event TokenExchange1155Created(address deployedAddress, bytes32 salt)

Emitted when a new TokenExchange1155 contract is created.

This event is triggered upon the successful creation of a new TokenExchange1155 contract, providing the address of the newly deployed contract and the salt used during its deployment.

Parameters

NameTypeDescription
deployedAddressaddressThe address of the newly deployed TokenExchange1155 contract.
saltbytes32The salt value used in the CREATE2 deployment, which helps ensure deterministic contract address generation.

TokenExchange1155Create2DeploymentFailed

solidity
error TokenExchange1155Create2DeploymentFailed(bytes32 salt)

Error thrown when the CREATE2 deployment fails

deployTokenExchange1155FromFactory

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

Deploys a new TokenExchange1155 contract using CREATE2.

_This function creates a new TokenExchange1155 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
_initialDepositoraddressThe address of initial depositor of the contract
_initialOwneraddressThe address of initial Owner of the contract
_erc1155UristringThe uri to be set for the undlying erc-1155 contract of token exchange contract
saltbytes32A unique value used to determine the contract address

Return Values

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