Skip to main content

RGSTYv1

Git Source

Inherits: Module

Interface for a module that can track the addresses of contracts

State Variables

_immutableContractNames

Stores the names of the registered immutable contracts

bytes5[] internal _immutableContractNames;

_contractNames

Stores the names of the registered contracts

bytes5[] internal _contractNames;

_immutableContracts

Mapping to store the immutable address of a contract

The address of an immutable contract can be retrieved by getImmutableContract(), and the names of all immutable contracts can be retrieved by getImmutableContractNames().

mapping(bytes5 => address) internal _immutableContracts;

_contracts

Mapping to store the address of a contract

The address of a registered contract can be retrieved by getContract(), and the names of all registered contracts can be retrieved by getContractNames().

mapping(bytes5 => address) internal _contracts;

Functions

registerImmutableContract

Register an immutable contract name and address

This function should be permissioned to prevent arbitrary contracts from being registered.

function registerImmutableContract(bytes5 name_, address contractAddress_) external virtual;

Parameters

NameTypeDescription
name_bytes5The name of the contract
contractAddress_addressThe address of the contract

registerContract

Register a new contract name and address

This function should be permissioned to prevent arbitrary contracts from being registered.

function registerContract(bytes5 name_, address contractAddress_) external virtual;

Parameters

NameTypeDescription
name_bytes5The name of the contract
contractAddress_addressThe address of the contract

updateContract

Update the address of an existing contract name

This function should be permissioned to prevent arbitrary contracts from being updated.

function updateContract(bytes5 name_, address contractAddress_) external virtual;

Parameters

NameTypeDescription
name_bytes5The name of the contract
contractAddress_addressThe address of the contract

deregisterContract

Deregister an existing contract name

This function should be permissioned to prevent arbitrary contracts from being deregistered.

function deregisterContract(bytes5 name_) external virtual;

Parameters

NameTypeDescription
name_bytes5The name of the contract

getImmutableContract

Get the address of a registered immutable contract

function getImmutableContract(bytes5 name_) external view virtual returns (address);

Parameters

NameTypeDescription
name_bytes5The name of the contract

Returns

NameTypeDescription
<none>addressThe address of the contract

getContract

Get the address of a registered mutable contract

function getContract(bytes5 name_) external view virtual returns (address);

Parameters

NameTypeDescription
name_bytes5The name of the contract

Returns

NameTypeDescription
<none>addressThe address of the contract

getImmutableContractNames

Get the names of all registered immutable contracts

function getImmutableContractNames() external view virtual returns (bytes5[] memory);

Returns

NameTypeDescription
<none>bytes5[]The names of all registered immutable contracts

getContractNames

Get the names of all registered mutable contracts

function getContractNames() external view virtual returns (bytes5[] memory);

Returns

NameTypeDescription
<none>bytes5[]The names of all registered mutable contracts

Events

ContractRegistered

Emitted when a contract is registered

event ContractRegistered(bytes5 indexed name, address indexed contractAddress, bool isImmutable);

ContractUpdated

Emitted when a contract is updated

event ContractUpdated(bytes5 indexed name, address indexed contractAddress);

ContractDeregistered

Emitted when a contract is deregistered

event ContractDeregistered(bytes5 indexed name);

Errors

Params_InvalidName

The provided name is invalid

error Params_InvalidName();

Params_InvalidAddress

The provided address is invalid

error Params_InvalidAddress();

Params_ContractAlreadyRegistered

The provided contract name is already registered

error Params_ContractAlreadyRegistered();

Params_ContractNotRegistered

The provided contract name is not registered

error Params_ContractNotRegistered();