Skip to content

Bootstrap

aboudjem edited this page Jun 7, 2024 · 1 revision

Bootstrap

Git Source

Inherits: ModuleManager

Manages the installation of modules into Nexus smart accounts using delegatecalls.

Functions

initNexusWithSingleValidator

Initializes the Nexus account with a single validator.

Intended to be called by the Nexus with a delegatecall.

function initNexusWithSingleValidator(IModule validator, bytes calldata data) external;

Parameters

Name Type Description
validator IModule The address of the validator module.
data bytes The initialization data for the validator module.

Note

Use this function to quickly set up a Nexus account with a single validator for simpler configurations.

initNexus

Initializes the Nexus account with multiple modules.

Intended to be called by the Nexus with a delegatecall.

function initNexus(
    BootstrapConfig[] calldata validators,
    BootstrapConfig[] calldata executors,
    BootstrapConfig calldata hook,
    BootstrapConfig[] calldata fallbacks
)
    external;

Parameters

Name Type Description
validators BootstrapConfig[] The configuration array for validator modules.
executors BootstrapConfig[] The configuration array for executor modules.
hook BootstrapConfig The configuration for the hook module.
fallbacks BootstrapConfig[] The configuration array for fallback handler modules.

Important

This function allows for a comprehensive setup of the Nexus account with all necessary modules, ensuring robust and versatile functionality.

initNexusScoped

Initializes the Nexus account with a scoped set of modules.

Intended to be called by the Nexus with a delegatecall.

function initNexusScoped(BootstrapConfig[] calldata validators, BootstrapConfig calldata hook) external;

Parameters

Name Type Description
validators BootstrapConfig[] The configuration array for validator modules.
hook BootstrapConfig The configuration for the hook module.

Caution

This function is useful for initializing the Nexus with essential modules while leaving out non-essential ones, offering a streamlined setup.

getInitNexusCalldata

Prepares calldata for the initNexus function.

function getInitNexusCalldata(
    BootstrapConfig[] calldata validators,
    BootstrapConfig[] calldata executors,
    BootstrapConfig calldata hook,
    BootstrapConfig[] calldata fallbacks
)
    external
    view
    returns (bytes memory init);

Parameters

Name Type Description
validators BootstrapConfig[] The configuration array for validator modules.
executors BootstrapConfig[] The configuration array for executor modules.
hook BootstrapConfig The configuration for the hook module.
fallbacks BootstrapConfig[] The configuration array for fallback handler modules.

Returns

Name Type Description
init bytes The prepared calldata for initNexus.

Note

This function helps in preparing the required calldata to initialize Nexus, ensuring that the process is smooth and error-free.

getInitNexusScopedCalldata

Prepares calldata for the initNexusScoped function.

function getInitNexusScopedCalldata(BootstrapConfig[] calldata validators, BootstrapConfig calldata hook) external view returns (bytes memory init);

Parameters

Name Type Description
validators BootstrapConfig[] The configuration array for validator modules.
hook BootstrapConfig The configuration for the hook module.

Returns

Name Type Description
init bytes The prepared calldata for initNexusScoped.

getInitNexusWithSingleValidatorCalldata

Prepares calldata for the initNexusWithSingleValidator function.

function getInitNexusWithSingleValidatorCalldata(BootstrapConfig calldata validator) external view returns (bytes memory init);

Parameters

Name Type Description
validator BootstrapConfig The configuration for the validator module.

Returns

Name Type Description
init bytes The prepared calldata for initNexusWithSingleValidator.

Important

This function is crucial for setting up the initialization calldata for a single validator, facilitating the setup process.

Structs

Provides configuration and initialization for Nexus smart accounts.

struct BootstrapConfig {
    address module;
    bytes data;
}