Create3Factory
Facilitates intent-based smart contract deployments at predictable addresses.
Write Methods
deploy()
This function deploys the smart contract that corresponds to the provided creation code and encoded constructor arguments. This deployment is only possible if the provided principal signed the message hash returned by getTransactionHash().
function deploy(
address _principal,
bytes memory _signature,
bytes memory _creationCode,
bytes memory _constructorArgsCode
) public payable {}
_principal
address
The address of the account that signed the message hash.
_creationCode
bytes
The bytecode of the contract to be deployed without the constructor arguments.
_constructorArgsCode
bytes
The encoded constructor arguments of the contract to be deployed.
Read Methods
userNonces()
Given a principal address and a contract's creation code, this mapping returns the number of times the contract has been deployed for the principal through the Create3Factory contract. For example, if the smart contract in question has never been deployed for the given principal address, the current nonce would be zero.
mapping(address => mapping(bytes32 => uint256)) public userNonces;
_principal
address
The address of the account intending to deploy the contract through the Create3Factory contract.
nonce
uint256
The number of times a given contract has been deployed for a given principal through the Create3Factory contract.
getTransactionHash()
Given a principal address and a contract's creation code, this function returns the hash the principal account needs to sign to deploy the corresponding smart contract through the Create3Factory contract.
function getTransactionHash(
address _principal,
bytes memory _creationCode
) public view returns (bytes32) {}
_principal
address
The address of the account intending to deploy the contract through the Create3Factory contract.
_creationCode
bytes
The bytecode of the contract to be deployed without the constructor arguments.
txHash
bytes32
The hash the principal account needs to sign to deploy a given smart contract through the Create3Factory contract.
getAddress()
Given a principal address and a contract's creation code, this function returns the address the corresponding smart contract would have if it is deployed through the Create3Factory contract.
function getAddress(
address _principal,
bytes memory _creationCode
) public view returns (address) {}
_principal
address
The address of the account intending to deploy the contract through the Create3Factory contract.
_creationCode
bytes
The bytecode of the contract to be deployed without the constructor arguments.
expectedAddress
address
The address that the given contract would have if it is deployed through the Create3Factory contract.
getBytecodeHash()
Given a contract's creation code, this function returns keccak256
hash of the provided bytecode.
function getBytecodeHash(
bytes memory _creationCode
) public pure returns (bytes32) {}
_creationCode
bytes
The bytecode of the contract without the constructor arguments.
bytecodeHash
bytes32
The keccak256
hash of the provided bytecode.
getDeploymentHistory()
Given a principal address, this function returns a list of contract addresses that corresponds to all the contracts that have been deployed for the provided principal through the Create3Factory contract.
function getDeploymentHistory(
address _principal
) public view returns (address[] memory) {}
_principal
address
The address of the account for whom the list of smart contracts were deployed through the Create3Factory contract.
deploymentHistory
address[]
A list of contract addresses that corresponds to all the contracts that have been deployed for the provided principal through the Create3Factory contract.
Last updated
Was this helpful?