Skip to main content

IInitializer

Asset Tokenization Studio Team

IInitializer

Interface for the Initializer facet, which tracks per-facet readiness and drives the token's transition to operational status.

Methods​

getFacetLastVersion​

function getFacetLastVersion(bytes32 _facetId) external view returns (uint256 lastVersion_)

Returns the latest version recorded for a facet. Zero means never registered.

Parameters​

NameTypeDescription
_facetIdbytes32Identifier of the facet to query.

Returns​

NameTypeDescription
lastVersion_uint256Most recent version stored for the facet, or zero if absent.

getFacetVersionStatus​

function getFacetVersionStatus(bytes32 _facetId, uint256 _versionId) external view returns (uint256 status_)

Returns the initialisation status of a specific facet version.

Encoding: 0 = initialisation not started, 1 = ready, >1 = initialisation in progress (intermediate value defined by the facet implementation).

Parameters​

NameTypeDescription
_facetIdbytes32Identifier of the facet to query.
_versionIduint256Version of the facet to query.

Returns​

NameTypeDescription
status_uint256Initialisation status of the requested facet version.

getMaxInitializerFacetIndex​

function getMaxInitializerFacetIndex() external view returns (uint256 maxInitializerFacetIndex_)

Returns the configured batch size for setOperationalStatus.

Returns​

NameTypeDescription
maxInitializerFacetIndex_uint256Maximum number of facets validated per call.

getOperationalStatus​

function getOperationalStatus(bytes32 _configId, uint256 _versionId) external view returns (uint256 status_)

Returns the raw operational status for a resolver-proxy configuration version.

Encoding: 0 = not started, 1 = fully operational, >1 = resume facet index + 1.

Parameters​

NameTypeDescription
_configIdbytes32Resolver-proxy configuration to query.
_versionIduint256Configuration version to query.

Returns​

NameTypeDescription
status_uint256Encoded operational status as described above.

initializeInitializer​

function initializeInitializer(uint256 _maxInitializerFacetIndex) external nonpayable

Seeds the initializer storage with the batch size used by setOperationalStatus and marks the initializer facet itself as ready for its current version.

Restricted to DEFAULT_ADMIN_ROLE and guarded against re-registration via onlyFacetNotRegistered(RESOLVER_KEY_INITIALIZER). Emits InitializerInitialized.

Parameters​

NameTypeDescription
_maxInitializerFacetIndexuint256Maximum number of facets validated per setOperationalStatus call.

setOperationalStatus​

function setOperationalStatus() external nonpayable returns (bool isOperational_, uint256 lastFacetIndex_)

Walks the facet list of the active resolver-proxy (configurationId, version), in batches of maxInitializerFacetIndex, and marks the configuration operational once every facet is ready.

Idempotent and resumable: if already operational, returns immediately; if partial progress is stored, resumes from the recorded index; otherwise starts from index 0. Emits OperationalStatusSet on completion or OperationalStatusPartialSet otherwise.

Returns​

NameTypeDescription
isOperational_boolTrue when every facet of the configuration version is ready.
lastFacetIndex_uint256Index reached in this call; on partial progress, the next call resumes here. Zero when the configuration was already operational.

updateMaxInitializerFacetIndex​

function updateMaxInitializerFacetIndex(uint256 _newMaxInitializerFacetIndex) external nonpayable

Updates the batch size used by setOperationalStatus to bound per-call gas usage.

Restricted to DEFAULT_ADMIN_ROLE. Emits MaxInitializerFacetIndexUpdated.

Parameters​

NameTypeDescription
_newMaxInitializerFacetIndexuint256New batch size, in number of facets per call.

Events​

InitializerInitialized​

event InitializerInitialized(uint256 maxInitializerFacetIndex)

Emitted on the first successful call to initializeInitializer, which seeds the initializer storage with its batch size.

Parameters​

NameTypeDescription
maxInitializerFacetIndexuint256Batch size used by setOperationalStatus to bound the number of facets checked per call.

MaxInitializerFacetIndexUpdated​

event MaxInitializerFacetIndexUpdated(address sender, uint256 newMaxInitializerFacetIndex)

Emitted when updateMaxInitializerFacetIndex changes the batch size used by setOperationalStatus.

Parameters​

NameTypeDescription
senderaddressAddress that triggered the update.
newMaxInitializerFacetIndexuint256New batch size, in number of facets per call.

OperationalStatusPartialSet​

event OperationalStatusPartialSet(address sender, bytes32 configurationId, uint256 version, uint256 lastIndex)

Emitted by setOperationalStatus when only part of the facet list could be validated in the current call. Subsequent calls resume from lastIndex.

Parameters​

NameTypeDescription
senderaddressAddress that triggered the partial set.
configurationIdbytes32Resolver-proxy configuration being validated.
versionuint256Configuration version being validated.
lastIndexuint256Index of the first facet not yet validated; the next call resumes here.

OperationalStatusSet​

event OperationalStatusSet(address sender, bytes32 configurationId, uint256 version)

Emitted by setOperationalStatus when every facet of the configuration version has been validated and the configuration becomes fully operational.

Parameters​

NameTypeDescription
senderaddressAddress that triggered the final set.
configurationIdbytes32Resolver-proxy configuration that became operational.
versionuint256Configuration version that became operational.

Errors​

AssetNotOperational​

error AssetNotOperational(bytes32 configId, uint256 versionId)

Raised by InitializerStorageWrapper.checkOperational (and the related isConfigVersionOperational helper) when an operation is attempted on a configuration version that has not yet been marked operational.

Parameters​

NameTypeDescription
configIdbytes32Resolver-proxy configuration whose operational status was checked.
versionIduint256Configuration version whose operational status was checked.

FacetAlreadyRegistered​

error FacetAlreadyRegistered(bytes32 facetId, uint256 lastVersion)

Raised when an initialiser tries to register a facet that already has a non-zero last registered version (i.e. the facet is being re-initialised on a fresh install).

Parameters​

NameTypeDescription
facetIdbytes32Identifier of the offending facet.
lastVersionuint256Last version recorded for that facet at the time of the check.

FacetPreviousVersionNotAccepted​

error FacetPreviousVersionNotAccepted(bytes32 facetId, uint256 lastVersion, uint256[] expectedVersions)

Raised when an initialiser requires the facet's previously registered version to match one of an expected set and the current lastVersion falls outside that set.

Parameters​

NameTypeDescription
facetIdbytes32Identifier of the facet being upgraded.
lastVersionuint256Last version currently stored for the facet.
expectedVersionsuint256[]List of acceptable predecessor versions.

FacetReady​

error FacetReady(bytes32 facetId, uint256 versionId)

Raised by checkFacetNotReady when a facet is already marked ready for the resolver's current version and a subsequent ready-marking attempt would be a double initialisation.

Parameters​

NameTypeDescription
facetIdbytes32Identifier of the facet already flagged as ready.
versionIduint256Version for which the facet is already ready.