Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

SelfHostedApplicationFactory

Git Source

Inherits: ISelfHostedApplicationFactory, RollupsContract

Title: Self-hosted Application Factory

Allows anyone to reliably deploy a new IAuthority contract, along with an IApplication contract already linked to it.

State Variables

AUTHORITY_FACTORY

IAuthorityFactory immutable AUTHORITY_FACTORY

APPLICATION_FACTORY

IApplicationFactory immutable APPLICATION_FACTORY

Functions

constructor

constructor(
    IAuthorityFactory authorityFactory,
    IApplicationFactory applicationFactory
) ;

Parameters

NameTypeDescription
authorityFactoryIAuthorityFactoryThe authority factory
applicationFactoryIApplicationFactoryThe application factory

getAuthorityFactory

function getAuthorityFactory() external view override returns (IAuthorityFactory);

getApplicationFactory

function getApplicationFactory()
    external
    view
    override
    returns (IApplicationFactory);

deployContracts

function deployContracts(
    address authorityOwner,
    uint256 epochLength,
    uint256 claimStagingPeriod,
    bytes32 templateHash,
    IInputBox inputBox,
    WithdrawalConfig calldata withdrawalConfig,
    bytes32 salt
) external returns (IApplication application, IAuthority authority);

calculateAddresses

function calculateAddresses(
    address authorityOwner,
    uint256 epochLength,
    uint256 claimStagingPeriod,
    bytes32 templateHash,
    IInputBox inputBox,
    WithdrawalConfig calldata withdrawalConfig,
    bytes32 salt
) external view returns (address application, address authority);

_authoritySalt

Derive the authority salt from the application arguments and the user-provided salt.

Both addresses of a deployment must depend on every argument and the user-provided salt. The application address already does, so we mix the application arguments into the authority salt.

function _authoritySalt(
    bytes32 templateHash,
    IInputBox inputBox,
    WithdrawalConfig calldata withdrawalConfig,
    bytes32 salt
) internal pure returns (bytes32);