Skip to content

Solidity API

TokenExchangeFactory

_Factory contract for deploying TokenExchange contract using CREATE2.

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

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

TokenExchangeCreated

solidity
event TokenExchangeCreated(address _address, bytes32 _salt)

Emitted when a new TokenExchange contract is created.

Parameters

NameTypeDescription
_addressaddressThe address of the newly deployed TokenExchange contract
_saltbytes32The salt value used in CREATE2 deployment

TokenExchangeCreate2DeploymentFailed

solidity
error TokenExchangeCreate2DeploymentFailed(bytes32 salt)

Error thrown when the CREATE2 deployment fails

deployTokenExchangeFromFactory

solidity
function deployTokenExchangeFromFactory(string _erc1155uri, bytes32 _salt) public returns (address)

_Deploys a new TokenExchange contract using CREATE2.

This function creates a new TokenExchange 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
_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 TokenExchange contract