Skip to content
Lattice

StarknetGatewayAdapterInit

Git Source

Title: StarknetGatewayAdapterInit

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

One-shot initializer for a Starknet L1 <-> L2 connector diamond — seeds AccessControl (so the L2 handler / trusted-sender setters are DEFAULT_ADMIN_ROLE-gated), the reentrancy guard (the send/cancel/consume paths are nonReentrant), and wires the Starknet core + expected ERC-7930 chain reference (registering the IStarknetGatewayAdapter interface via ERC-165). Delegatecalled by Diamond.initialize inside the initializing window (so it must NOT open its own pre/postInitializer; each __*_init guard passes because the window is already open). Reverts StarknetZeroAddress on a zero core, StarknetEmptyChainReference on an empty chain reference.

Functions

init

Runs the access-control + reentrancy-guard + Starknet-adapter initializers. MUST be invoked via the diamond's initialize _init delegatecall.

function init(address admin, address starknetCore, bytes calldata expectedChainReference) external;

Parameters

NameTypeDescription
adminaddressThe address granted DEFAULT_ADMIN_ROLE (controls every adapter setter).
starknetCoreaddressThe Starknet core (StarknetMessaging) contract on this chain.
expectedChainReferencebytesThe ERC-7930 chain reference this adapter accepts (UTF-8 chain-id string,
e.g. SN_MAIN = 0x534e5f4d41494e).