IBaseWorld
Git Source (opens in a new tab)
Inherits: IStore, IWorldKernel, IRegistrationSystem, IAccessManagementSystem, IBalanceTransferSystem, IBatchCallSystem, IModuleInstallationSystem, IWorldRegistrationSystem
This interface integrates all systems and associated function selectors that are dynamically registered in the World during deployment.
.
IWorldCall
Git Source (opens in a new tab)
This interface defines the contract for executing calls on the World's systems.
Functions
call
Call the system at the given system ID.
If the system is not public, the caller must have access to the namespace or name (encoded in the system ID).
function call(ResourceId systemId, bytes memory callData) external payable returns (bytes memory);
Parameters
Name | Type | Description |
---|---|---|
systemId | ResourceId | The ID of the system to be called. |
callData | bytes | The data to pass with the call, function selector (4 bytes) followed by the ABI encoded parameters. |
Returns
Name | Type | Description |
---|---|---|
<none> | bytes | The abi encoded return data from the called system. |
callFrom
Call the system at the given system ID on behalf of the given delegator.
If the system is not public, the delegator must have access to the namespace or name (encoded in the system ID).
function callFrom(
address delegator,
ResourceId systemId,
bytes memory callData
) external payable returns (bytes memory);
Parameters
Name | Type | Description |
---|---|---|
delegator | address | The address on whose behalf the call is made. |
systemId | ResourceId | The ID of the system to be called. |
callData | bytes | The data to pass with the call, function selector (4 bytes) followed by the ABI encoded parameters. |
Returns
Name | Type | Description |
---|---|---|
<none> | bytes | The abi encoded return data from the called system. |
IWorldKernel
Git Source (opens in a new tab)
Inherits: IWorldModuleInstallation, IWorldCall, IWorldErrors, IWorldEvents, IModuleErrors
The IWorldKernel interface includes all methods that are part of the World contract's
internal bytecode. Consumers should use the IBaseWorld
interface instead, which includes dynamically
registered functions selectors from the InitModule
.
The IWorldKernel interface inherits IModuleErrors because the world can be delegatecalled with module code, so it's ABI should include these errors.
Functions
worldVersion
Retrieve the protocol version of the World.
function worldVersion() external view returns (bytes32);
Returns
Name | Type | Description |
---|---|---|
<none> | bytes32 | The protocol version of the World. |
creator
Retrieve the immutable original deployer of the World.
function creator() external view returns (address);
Returns
Name | Type | Description |
---|---|---|
<none> | address | The address of the World's creator. |
initialize
Initializes the World.
Can only be called once by the creator.
function initialize(IModule initModule) external;
Parameters
Name | Type | Description |
---|---|---|
initModule | IModule | The InitModule to be installed during initialization. |
IWorldModuleInstallation
Git Source (opens in a new tab)
This interface defines the contract responsible for managing root modules installation.
Functions
installRootModule
Install the given root module in the World.
Requires the caller to own the root namespace. The module is delegatecalled and installed in the root namespace.
function installRootModule(IModule module, bytes memory encodedArgs) external;
Parameters
Name | Type | Description |
---|---|---|
module | IModule | The module to be installed. |
encodedArgs | bytes | The ABI encoded arguments for the module installation. |
IWorldErrors
Git Source (opens in a new tab)
This interface contains custom error types for the World contract. These errors provide more informative messages for certain operations within the World contract.
Errors
World_AlreadyInitialized
Raised when trying to initialize an already initialized World.
error World_AlreadyInitialized();
World_ResourceAlreadyExists
Raised when trying to register a resource that already exists.
error World_ResourceAlreadyExists(ResourceId resourceId, string resourceIdString);
Parameters
Name | Type | Description |
---|---|---|
resourceId | ResourceId | The ID of the resource. |
resourceIdString | string | The string representation of the resource ID. |
World_ResourceNotFound
Raised when the specified resource is not found.
error World_ResourceNotFound(ResourceId resourceId, string resourceIdString);
Parameters
Name | Type | Description |
---|---|---|
resourceId | ResourceId | The ID of the resource. |
resourceIdString | string | The string representation of the resource ID. |
World_AccessDenied
Raised when a user tries to access a resource they don't have permission for.
error World_AccessDenied(string resource, address caller);
Parameters
Name | Type | Description |
---|---|---|
resource | string | The resource's identifier. |
caller | address | The address of the user trying to access the resource. |
World_InvalidResourceId
Raised when an invalid resource ID is provided.
error World_InvalidResourceId(ResourceId resourceId, string resourceIdString);
Parameters
Name | Type | Description |
---|---|---|
resourceId | ResourceId | The ID of the resource. |
resourceIdString | string | The string representation of the resource ID. |
World_InvalidNamespace
Raised when an namespace contains an invalid sequence of characters ("__").
error World_InvalidNamespace(bytes14 namespace);
Parameters
Name | Type | Description |
---|---|---|
namespace | bytes14 | The invalid namespace. |
World_SystemAlreadyExists
Raised when trying to register a system that already exists.
error World_SystemAlreadyExists(address system);
Parameters
Name | Type | Description |
---|---|---|
system | address | The address of the system. |
World_FunctionSelectorAlreadyExists
Raised when trying to register a function selector that already exists.
error World_FunctionSelectorAlreadyExists(bytes4 functionSelector);
Parameters
Name | Type | Description |
---|---|---|
functionSelector | bytes4 | The function selector in question. |
World_FunctionSelectorNotFound
Raised when the specified function selector is not found.
error World_FunctionSelectorNotFound(bytes4 functionSelector);
Parameters
Name | Type | Description |
---|---|---|
functionSelector | bytes4 | The function selector in question. |
World_DelegationNotFound
Raised when the specified delegation is not found.
error World_DelegationNotFound(address delegator, address delegatee);
Parameters
Name | Type | Description |
---|---|---|
delegator | address | The address of the delegator. |
delegatee | address | The address of the delegatee. |
World_UnlimitedDelegationNotAllowed
Raised when trying to create an unlimited delegation in a context where it is not allowed, e.g. when registering a namespace fallback delegation.
error World_UnlimitedDelegationNotAllowed();
World_InsufficientBalance
Raised when there's an insufficient balance for a particular operation.
error World_InsufficientBalance(uint256 balance, uint256 amount);
Parameters
Name | Type | Description |
---|---|---|
balance | uint256 | The current balance. |
amount | uint256 | The amount needed. |
World_InterfaceNotSupported
Raised when the specified interface is not supported by the contract.
error World_InterfaceNotSupported(address contractAddress, bytes4 interfaceId);
Parameters
Name | Type | Description |
---|---|---|
contractAddress | address | The address of the contract in question. |
interfaceId | bytes4 | The ID of the interface. |
World_InvalidResourceType
Raised when an invalid resource type is provided.
error World_InvalidResourceType(bytes2 expected, ResourceId resourceId, string resourceIdString);
Parameters
Name | Type | Description |
---|---|---|
expected | bytes2 | The expected resource type. |
resourceId | ResourceId | The ID of the resource. |
resourceIdString | string | The string representation of the resource ID. |
World_CallbackNotAllowed
Raised when the World is calling itself via an external call.
error World_CallbackNotAllowed(bytes4 functionSelector);
Parameters
Name | Type | Description |
---|---|---|
functionSelector | bytes4 | The function selector of the disallowed callback. |
IWorldEvents
Git Source (opens in a new tab)
We bundle these events in an interface (instead of at the file-level or in their corresponding library) so they can be inherited by IWorldKernel. This ensures that all events are included in the IWorldKernel ABI for proper decoding in the frontend.
Events
HelloWorld
Emitted when the World is created.
event HelloWorld(bytes32 indexed worldVersion);
Parameters
Name | Type | Description |
---|---|---|
worldVersion | bytes32 | The protocol version of the World. |
IRegistrationSystem
Git Source (opens in a new tab)
IAccessManagementSystem
Git Source (opens in a new tab)
Functions
grantAccess
function grantAccess(ResourceId resourceId, address grantee) external;
revokeAccess
function revokeAccess(ResourceId resourceId, address grantee) external;
transferOwnership
function transferOwnership(ResourceId namespaceId, address newOwner) external;
renounceOwnership
function renounceOwnership(ResourceId namespaceId) external;
IBalanceTransferSystem
Git Source (opens in a new tab)
Functions
transferBalanceToNamespace
function transferBalanceToNamespace(ResourceId fromNamespaceId, ResourceId toNamespaceId, uint256 amount) external;
transferBalanceToAddress
function transferBalanceToAddress(ResourceId fromNamespaceId, address toAddress, uint256 amount) external;
IBatchCallSystem
Git Source (opens in a new tab)
Functions
batchCall
function batchCall(SystemCallData[] calldata systemCalls) external returns (bytes[] memory returnDatas);
batchCallFrom
function batchCallFrom(SystemCallFromData[] calldata systemCalls) external returns (bytes[] memory returnDatas);
IModuleInstallationSystem
Git Source (opens in a new tab)
Functions
installModule
function installModule(IModule module, bytes memory encodedArgs) external;
IStoreRegistrationSystem
Git Source (opens in a new tab)
Functions
registerTable
function registerTable(
ResourceId tableId,
FieldLayout fieldLayout,
Schema keySchema,
Schema valueSchema,
string[] calldata keyNames,
string[] calldata fieldNames
) external;
registerStoreHook
function registerStoreHook(ResourceId tableId, IStoreHook hookAddress, uint8 enabledHooksBitmap) external;
unregisterStoreHook
function unregisterStoreHook(ResourceId tableId, IStoreHook hookAddress) external;
IWorldRegistrationSystem
Git Source (opens in a new tab)
Functions
registerNamespace
function registerNamespace(ResourceId namespaceId) external;
registerSystemHook
function registerSystemHook(ResourceId systemId, ISystemHook hookAddress, uint8 enabledHooksBitmap) external;
unregisterSystemHook
function unregisterSystemHook(ResourceId systemId, ISystemHook hookAddress) external;
registerSystem
function registerSystem(ResourceId systemId, System system, bool publicAccess) external;
registerFunctionSelector
function registerFunctionSelector(
ResourceId systemId,
string memory systemFunctionSignature
) external returns (bytes4 worldFunctionSelector);
registerRootFunctionSelector
function registerRootFunctionSelector(
ResourceId systemId,
string memory worldFunctionSignature,
string memory systemFunctionSignature
) external returns (bytes4 worldFunctionSelector);
registerDelegation
function registerDelegation(address delegatee, ResourceId delegationControlId, bytes memory initCallData) external;
unregisterDelegation
function unregisterDelegation(address delegatee) external;
registerNamespaceDelegation
function registerNamespaceDelegation(
ResourceId namespaceId,
ResourceId delegationControlId,
bytes memory initCallData
) external;
unregisterNamespaceDelegation
function unregisterNamespaceDelegation(ResourceId namespaceId) external;