Skip to content
Lattice

VaultCoreInit

Git Source

Title: VaultCoreInit

Author: David Dada <daveproxy80@gmail.com> (https://github.com/dadadave80)

One-shot initializer for a VaultCore diamond — an ERC-4626 vault extended with strategy hooks. Runs the module initializers in dependency order inside a single initializing window: AccessControl (grants DEFAULT_ADMIN_ROLE to admin, gating strategy-manager changes), ERC-20 (share metadata), ERC-4626 (underlying asset + offset), then VaultCore (registers IVaultCore and IVaultCoreRecovery via ERC-165). Delegatecalled by Diamond.initialize inside the initializing window — it must NOT open its own pre/postInitializer; each __*_init guard passes because the window is already open.

Functions

init

Seeds access control, the ERC-20 share metadata, the ERC-4626 vault params, and VaultCore.

function init(address asset_, string memory name_, string memory symbol_, address admin_, uint8 decimalsOffset_)
        external;

Parameters

NameTypeDescription
asset_addressThe underlying ERC-20 asset the vault holds.
name_stringThe vault share token name.
symbol_stringThe vault share token symbol.
admin_addressThe account granted DEFAULT_ADMIN_ROLE (may set the strategy manager).
decimalsOffset_uint8Virtual-share decimals offset for inflation-attack mitigation (usually 0).