Skip to main content

Registry

The registry is a contract deployed on L1, that contains addresses for the Rollup, Inbox and Outbox. It also keeps track of the different versions that have been deployed and let you query prior deployments easily.

Links: Interface, Implementation.

numberOfVersions()

Retrieves the number of versions that have been deployed.

registry_number_of_versions
function numberOfVersions() external view returns (uint256);
Source code: l1-contracts/src/core/interfaces/messagebridge/IRegistry.sol#L41-L43
NameDescription
ReturnValueThe number of versions that have been deployed

getRollup()

Retrieves the current rollup contract.

registry_get_rollup
function getRollup() external view returns (IRollup);
Source code: l1-contracts/src/core/interfaces/messagebridge/IRegistry.sol#L14-L16
NameDescription
ReturnValueThe current rollup

getInbox()

Retrieves the current inbox contract.

registry_get_inbox
function getInbox() external view returns (IInbox);
Source code: l1-contracts/src/core/interfaces/messagebridge/IRegistry.sol#L22-L24
NameDescription
ReturnValueThe current Inbox

getOutbox()

Retrieves the current inbox contract.

registry_get_outbox
function getOutbox() external view returns (IOutbox);
Source code: l1-contracts/src/core/interfaces/messagebridge/IRegistry.sol#L26-L28
NameDescription
ReturnValueThe current Outbox

getVersionFor(address _rollup)

Retrieve the version of a specific rollup contract.

registry_get_version_for
function getVersionFor(address _rollup) external view returns (uint256);
Source code: l1-contracts/src/core/interfaces/messagebridge/IRegistry.sol#L18-L20
NameDescription
_rollupThe address of the rollup to lookup
ReturnValueThe version number of _rollup

Edge cases

Will revert with Registry__RollupNotRegistered(_rollup) if the rollup have not been registered.

getSnapshot(uint256 _version)

Retrieve the snapshot of a specific version.

registry_snapshot
/**
* @notice Struct for storing address of cross communication components and the block number when it was updated
* @param rollup - The address of the rollup contract
* @param inbox - The address of the inbox contract
* @param outbox - The address of the outbox contract
* @param blockNumber - The block number of the snapshot
*/
struct RegistrySnapshot {
address rollup;
address inbox;
address outbox;
uint256 blockNumber;
}
Source code: l1-contracts/src/core/libraries/DataStructures.sol#L66-L80
registry_get_snapshot
function getSnapshot(uint256 _version)
external
view
returns (DataStructures.RegistrySnapshot memory);
Source code: l1-contracts/src/core/interfaces/messagebridge/IRegistry.sol#L30-L35
NameDescription
_versionThe version number to fetch data for
ReturnValue.rollupThe address of the rollup for the _version
ReturnValue.inboxThe address of the inbox for the _version
ReturnValue.outboxThe address of the outbox for the _version
ReturnValue.blockNumberThe block number of the snapshot creation

getCurrentSnapshot()

Retrieves the snapshot for the current version.

registry_get_current_snapshot
function getCurrentSnapshot() external view returns (DataStructures.RegistrySnapshot memory);
Source code: l1-contracts/src/core/interfaces/messagebridge/IRegistry.sol#L37-L39
NameDescription
ReturnValue.rollupThe address of the rollup for the current _version
ReturnValue.inboxThe address of the inbox for the current _version
ReturnValue.outboxThe address of the outbox for the current _version
ReturnValue.blockNumberThe block number of the snapshot creation