World
Reference
Modules

Module

Git Source (opens in a new tab)

Inherits: IModule, WorldContextConsumer

Abstract contract that implements the ERC-165 supportsInterface function for IModule.

State Variables

__self

address internal immutable __self = address(this);

Functions

supportsInterface

Checks if the given interfaceId is supported by this contract.

Overrides the functionality from IERC165 and WorldContextConsumer to check for supported interfaces.

function supportsInterface(
  bytes4 interfaceId
) public pure virtual override(IERC165, WorldContextConsumer) returns (bool);

Parameters

NameTypeDescription
interfaceIdbytes4The bytes4 identifier for the interface.

Returns

NameTypeDescription
<none>booltrue if the interface is supported, false otherwise.

isInstalled

Check if a module with the given name and arguments is installed.

function isInstalled(address moduleAddress, bytes memory encodedArgs) internal view returns (bool);

Parameters

NameTypeDescription
moduleAddressaddressThe address of the module.
encodedArgsbytesThe ABI encoded arguments for the module installation.

Returns

NameTypeDescription
<none>booltrue if the module is installed, false otherwise.

requireNotInstalled

Revert if the module with the given name and arguments is already installed.

function requireNotInstalled(address moduleAddress, bytes memory encodedArgs) internal view;

Parameters

NameTypeDescription
moduleAddressaddressThe address of the module.
encodedArgsbytesThe ABI encoded arguments for the module installation.

installRoot

Installs the module as a root module.

This function is invoked by the World contract during installRootModule process. The module expects to be called via the World contract and thus installs itself on the msg.sender.

function installRoot(bytes memory encodedArgs) public virtual;

Parameters

NameTypeDescription
encodedArgsbytesThe ABI encoded arguments that may be needed during the installation process.

install

Installs the module.

This function is invoked by the World contract during installModule process. The module expects to be called via the World contract and thus installs itself on the msg.sender. Logic might differ from installRoot, for example, this might accept namespace parameters.

function install(bytes memory encodedArgs) public virtual;

Parameters

NameTypeDescription
encodedArgsbytesThe ABI encoded arguments that may be needed during the installation process.