Skip to main content

CartesiDAppFactory

The CartesiDAppFactory contract is a tool for reliably deploying new instances of the CartesiDApp 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 CartesiDApp contracts within the Cartesi Rollups framework.

newApplication()

function newApplication( IConsensus consensus, IInputBox inputBox, IPortal[] memory portals, address appOwner, bytes32 templateHash ) external returns (Application)

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

Emits an ApplicationCreated event upon successful deployment.

Parameters

NameTypeDescription
consensusIConsensusInstance of the consensus interface
inputBoxIInputBoxInstance of the input box interface
portalsIPortal[]Array of portal instances
appOwneraddressAddress of the owner of the application
templateHashbytes32Hash of the template for the application

newApplication()(with salt)

function newApplication(IConsensus consensus, IInputBox inputBox, IPortal[] memory portals, address appOwner, bytes32 templateHash, bytes32 salt) external returns (Application)

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

Emits an ApplicationCreated event upon successful deployment.

Parameters

NameTypeDescription
consensusIConsensusInstance of the consensus interface
inputBoxIInputBoxInstance of the input box interface
portalsIPortal[]Array of portal instances
appOwneraddressAddress of the owner of the application
templateHashbytes32Hash of the template for the application
saltbytes32Salt value for address derivation

calculateApplicationAddress()

function calculateApplicationAddress(IConsensus consensus,IInputBox inputBox,IPortal[] memory portals,address appOwner,bytes32 templateHash,bytes32 salt ) external view returns (address)

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

Parameters

NameTypeDescription
consensusIConsensusInstance of the consensus interface
inputBoxIInputBoxInstance of the input box interface
portalsIPortal[]Array of portal instances
appOwneraddressAddress of the owner of the application
templateHashbytes32Hash of the template for the application
saltbytes32Salt value for address derivation

Returns

TypeDescription
addressAddress of the potential new Application contract

© 2024 Cartesi Foundation Ltd. All rights reserved.

The Cartesi Project is commissioned by the Cartesi Foundation.

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.