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
Name | Type | Description |
---|---|---|
interfaceId | bytes4 | The bytes4 identifier for the interface. |
Returns
Name | Type | Description |
---|---|---|
<none> | bool | true 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
Name | Type | Description |
---|---|---|
moduleAddress | address | The address of the module. |
encodedArgs | bytes | The ABI encoded arguments for the module installation. |
Returns
Name | Type | Description |
---|---|---|
<none> | bool | true 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
Name | Type | Description |
---|---|---|
moduleAddress | address | The address of the module. |
encodedArgs | bytes | The 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
Name | Type | Description |
---|---|---|
encodedArgs | bytes | The 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
Name | Type | Description |
---|---|---|
encodedArgs | bytes | The ABI encoded arguments that may be needed during the installation process. |