Appearance
Solidity API
PaymentCommitmentFactory
Factory contract for deploying PaymentCommitment contracts deterministically.
_Leverages the CREATE2 opcode to compute the contract address based on the provided salt and bytecode.
The caller of deployPaymentCommitmentFromFactory
is assigned as the depositor in the newly deployed PaymentCommitment contract._
PaymentCommitmentCreated
solidity
event PaymentCommitmentCreated(address deployedAddress, bytes32 salt)
Emitted when a new PaymentCommitment contract is created.
Parameters
Name | Type | Description |
---|---|---|
deployedAddress | address | The address of the newly deployed PaymentCommitment contract |
salt | bytes32 | The salt value used in CREATE2 deployment |
Create2Failed
solidity
error Create2Failed()
Error thrown when the CREATE2 deployment fails
deployPaymentCommitmentFromFactory
solidity
function deployPaymentCommitmentFromFactory(address _committer, address _initialOwner, string _erc1155Uri, bytes32 salt) public returns (address)
Deploys a new PaymentCommitment contract using CREATE2.
_This function creates a new PaymentCommitment 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
Name | Type | Description |
---|---|---|
_committer | address | The address of account committing payment to committee |
_initialOwner | address | The address of initial Owner of the contract |
_erc1155Uri | string | The uri to be set for the undlying erc-1155 contract of payment commitment contract |
salt | bytes32 | A unique value used to determine the contract address |
Return Values
Name | Type | Description |
---|---|---|
[0] | address | deployedAddress The address of the newly deployed PaymentCommitment contract Error: - Create2Failed : Reverted if the deployment failed by verifying that the returned address is zero. Emits: - PaymentCommitmentCreated : Emitted when a new PaymentCommitment contract is created. |