World
Reference
Miscellaneous

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

NameTypeDescription
<none>bytes14Returns 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)

Reverts the transaction using the provided raw bytes as the revert reason.

Uses assembly to perform the revert operation with the raw bytes.

function revertWithBytes(bytes memory reason) pure;

Parameters

NameTypeDescription
reasonbytesThe raw bytes revert reason.

version.sol constants

Git Source (opens in a new tab)

WORLD_VERSION

Contains a constant representing the version of the World protocol.

Identifier for the current World protocol version.

bytes32 constant WORLD_VERSION = "2.0.2";