Skip to main content

ApplicationFactory

The ApplicationFactory contract is a tool for reliably deploying new instances of the Application contract with or without a specified salt value for address derivation.

Additionally, it provides a function to calculate the address of a potential new CartesiDApp contract based on input parameters.

This contract ensures efficient and secure deployment of Application contracts within the Cartesi Rollups framework.

Functions

newApplication()

function newApplication(
IOutputsMerkleRootValidator outputsMerkleRootValidator,
address appOwner,
bytes32 templateHash,
bytes calldata dataAvailability
) external override returns (IApplication)

Deploys a new Application contract without a salt value for address derivation.

Parameters

NameTypeDescription
outputsMerkleRootValidatorIOutputsMerkleRootValidatorThe initial outputs Merkle root validator contract
appOwneraddressAddress of the owner of the application
templateHashbytes32Hash of the template for the application
dataAvailabilitybytesThe data availability solution

Return Values

NameTypeDescription
[0]IApplicationThe deployed Application contract

newApplication() (with salt)

function newApplication(
IOutputsMerkleRootValidator outputsMerkleRootValidator,
address appOwner,
bytes32 templateHash,
bytes calldata dataAvailability,
bytes32 salt
) external override returns (IApplication)

Deploys a new Application contract with a specified salt value for address derivation.

Parameters

NameTypeDescription
outputsMerkleRootValidatorIOutputsMerkleRootValidatorThe initial outputs Merkle root validator contract
appOwneraddressAddress of the owner of the application
templateHashbytes32Hash of the template for the application
dataAvailabilitybytesThe data availability solution
saltbytes32Salt value for address derivation

Return Values

NameTypeDescription
[0]IApplicationThe deployed Application contract

calculateApplicationAddress()

function calculateApplicationAddress(
IOutputsMerkleRootValidator outputsMerkleRootValidator,
address appOwner,
bytes32 templateHash,
bytes calldata dataAvailability,
bytes32 salt
) external view override returns (address)

Calculates the address of a potential new Application contract based on input parameters.

Parameters

NameTypeDescription
outputsMerkleRootValidatorIOutputsMerkleRootValidatorThe initial outputs Merkle root validator contract
appOwneraddressAddress of the owner of the application
templateHashbytes32Hash of the template for the application
dataAvailabilitybytesThe data availability solution
saltbytes32Salt value for address derivation

Return Values

NameTypeDescription
[0]addressAddress of the potential new Application contract

Events

ApplicationCreated()

event ApplicationCreated(
IOutputsMerkleRootValidator outputsMerkleRootValidator,
address appOwner,
bytes32 templateHash,
bytes dataAvailability,
IApplication appContract
)

A new Application contract was deployed.

Parameters

NameTypeDescription
outputsMerkleRootValidatorIOutputsMerkleRootValidatorThe outputs Merkle root validator contract
appOwneraddressThe owner of the application
templateHashbytes32The template hash
dataAvailabilitybytesThe data availability solution
appContractIApplicationThe deployed Application contract

On this page

Useful resources to learn more

We use cookies to ensure that we give you the best experience on our website. By using the website, you agree to the use of cookies.