Utils
Git Source (opens in a new tab)
Various utilities
These utilities are not used by MUD itself, they are for developers using MUD.
Functions
systemNamespace
Fetches the namespace of the current system.
This function determines the system's namespace based on its interaction with the store. If the system is a root system, it returns the root namespace (an empty string). Otherwise, it retrieves the namespace using the system's registry. This function must be used within the context of a system (either directly or within libraries called by a system).
function systemNamespace() internal view returns (bytes14);
Returns
Name | Type | Description |
---|---|---|
<none> | bytes14 | Returns a bytes14 representation of the system's namespace. |
constants.sol
Git Source (opens in a new tab)
ROOT_NAMESPACE
bytes14 constant ROOT_NAMESPACE = "";
ROOT_NAME
bytes16 constant ROOT_NAME = "";
STORE_NAMESPACE_ID
ResourceId constant STORE_NAMESPACE_ID = ResourceId.wrap(
bytes32(abi.encodePacked(RESOURCE_NAMESPACE, bytes14("store"), ROOT_NAME))
);
WORLD_NAMESPACE_ID
ResourceId constant WORLD_NAMESPACE_ID = ResourceId.wrap(
bytes32(abi.encodePacked(RESOURCE_NAMESPACE, bytes14("world"), ROOT_NAME))
);
ROOT_NAMESPACE_ID
ResourceId constant ROOT_NAMESPACE_ID = ResourceId.wrap(
bytes32(abi.encodePacked(RESOURCE_NAMESPACE, ROOT_NAMESPACE, ROOT_NAME))
);
UNLIMITED_DELEGATION
ResourceId constant UNLIMITED_DELEGATION = ResourceId.wrap(
bytes32(abi.encodePacked(RESOURCE_SYSTEM, ROOT_NAMESPACE, bytes16("unlimited")))
);
revertWithBytes
Git Source (opens in a new tab)
Utility function to revert transactions with raw bytes.
Reverts the transaction using the provided raw bytes as the revert reason.
This can be especially useful when reverting with a message obtained from a low-level call or a pre-encoded error.
Uses assembly to perform the revert operation with the raw bytes.
function revertWithBytes(bytes memory reason) pure;
Parameters
Name | Type | Description |
---|---|---|
reason | bytes | The raw bytes revert reason. |
version.sol constants
Git Source (opens in a new tab)
WORLD_VERSION
World Version Constant Defines the version identifier for the World contract or module. This version identifier can be used for version checks, logging, and more.
bytes32 constant WORLD_VERSION = "1.0.0-unaudited";