Skip to content

Solidity API

SalesOrderFactory

_Factory contract for deploying SalesOrder contract using CREATE2.

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

The caller of deploySalesOrderFromFactory is set as the depositor in the newly deployed sales order contract._

SalesOrderCreated

solidity
event SalesOrderCreated(address deployedAddress, bytes32 salt)

Emitted whenever a new SalesOrder contract is successfully deployed.

Provides details about the new SalesOrder deployment: - deployed SalesOrder contract address - salt

Parameters

NameTypeDescription
deployedAddressaddressThe address of the newly deployed SalesOrder contract
saltbytes32The salt value used in CREATE2 deployment

Create2Failed

solidity
error Create2Failed()

Error thrown when the CREATE2 deployment fails

deploySalesOrderFromFactory

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

Deploys a new SalesOrder contract using CREATE2.

_This function creates a new SalesOrder 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
_committeraddressThe address of account committing payment to committee
_initialOwneraddressThe address of initial Owner of the contract
_erc1155UristringThe uri to be set for the undlying erc-1155 contract of sales order contract
saltbytes32A unique value used to determine the contract address

Return Values

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