AccessManagementSystem
Git Source (opens in a new tab)
Inherits: System, LimitedCallContext
This contract manages the granting and revoking of access from/to resources.
Functions
grantAccess
Grant access to the resource at the given resource ID.
Requires the caller to own the namespace.
function grantAccess(ResourceId resourceId, address grantee) public virtual onlyDelegatecall;
Parameters
Name | Type | Description |
---|---|---|
resourceId | ResourceId | The ID of the resource to grant access to. |
grantee | address | The address to which access should be granted. |
revokeAccess
Revoke access from the resource at the given resource ID.
Requires the caller to own the namespace.
function revokeAccess(ResourceId resourceId, address grantee) public virtual onlyDelegatecall;
Parameters
Name | Type | Description |
---|---|---|
resourceId | ResourceId | The ID of the resource to revoke access from. |
grantee | address | The address from which access should be revoked. |
transferOwnership
Transfer ownership of the given namespace to newOwner and manages the access.
Requires the caller to own the namespace. Revoke ResourceAccess for previous owner and grant to newOwner.
function transferOwnership(ResourceId namespaceId, address newOwner) public virtual onlyDelegatecall;
Parameters
Name | Type | Description |
---|---|---|
namespaceId | ResourceId | The ID of the namespace to transfer ownership. |
newOwner | address | The address to which ownership should be transferred. |
renounceOwnership
Renounces ownership of the given namespace
Requires the caller to own the namespace. Revoke ResourceAccess for previous owner
function renounceOwnership(ResourceId namespaceId) public virtual onlyDelegatecall;
Parameters
Name | Type | Description |
---|---|---|
namespaceId | ResourceId | The ID of the namespace to transfer ownership. |
ModuleInstallationSystem
Git Source (opens in a new tab)
Inherits: System, LimitedCallContext
A system contract to handle the installation of (non-root) modules in the World.
Functions
installModule
Installs a module into the World under a specified namespace.
Validates the given module against the IModule interface and delegates the installation process. The module is then registered in the InstalledModules table.
function installModule(IModule module, bytes memory encodedArgs) public onlyDelegatecall;
Parameters
Name | Type | Description |
---|---|---|
module | IModule | The module to be installed. |
encodedArgs | bytes | The ABI encoded arguments for module installation. |
BalanceTransferSystem
Git Source (opens in a new tab)
Inherits: System, IWorldErrors, LimitedCallContext
A system contract that facilitates balance transfers in the World and outside of the World.
Functions
transferBalanceToNamespace
Transfer balance to another namespace in the World.
Requires the caller to have access to the source namespace and ensures the destination namespace type is valid.
function transferBalanceToNamespace(
ResourceId fromNamespaceId,
ResourceId toNamespaceId,
uint256 amount
) public virtual onlyDelegatecall;
Parameters
Name | Type | Description |
---|---|---|
fromNamespaceId | ResourceId | The source namespace from which the balance will be deducted. |
toNamespaceId | ResourceId | The target namespace where the balance will be added. |
amount | uint256 | The amount to transfer. |
transferBalanceToAddress
Transfer balance out of the World to a specific address.
Requires the caller to have access to the source namespace and ensures sufficient balance before transfer.
function transferBalanceToAddress(
ResourceId fromNamespaceId,
address toAddress,
uint256 amount
) public virtual onlyDelegatecall;
Parameters
Name | Type | Description |
---|---|---|
fromNamespaceId | ResourceId | The source namespace from which the balance will be deducted. |
toAddress | address | The target address where the balance will be sent. |
amount | uint256 | The amount to transfer. |
StoreRegistrationSystem
Git Source (opens in a new tab)
Inherits: System, IWorldErrors, LimitedCallContext
This contract provides functionality for the registration of store-related resources within the World framework.
Functions
registerTable
Register a table within the World framework.
Registers a table with the specified configuration. If the namespace for the table does not exist, it's created. Existing namespaces require the caller to be the owner for table registration.
function registerTable(
ResourceId tableId,
FieldLayout fieldLayout,
Schema keySchema,
Schema valueSchema,
string[] calldata keyNames,
string[] calldata fieldNames
) public virtual onlyDelegatecall;
Parameters
Name | Type | Description |
---|---|---|
tableId | ResourceId | The resource ID of the table. |
fieldLayout | FieldLayout | The field layout structure for the table. |
keySchema | Schema | The schema for the keys of the table. |
valueSchema | Schema | The schema for the values within the table. |
keyNames | string[] | The names associated with the keys in the table. |
fieldNames | string[] | The names of the fields in the table. |
registerStoreHook
Register a storage hook for a specified table.
The caller must be the owner of the namespace to which the table belongs. The hook must conform to the IStoreHook interface.
function registerStoreHook(
ResourceId tableId,
IStoreHook hookAddress,
uint8 enabledHooksBitmap
) public virtual onlyDelegatecall;
Parameters
Name | Type | Description |
---|---|---|
tableId | ResourceId | The resource ID of the table for which the hook is being registered. |
hookAddress | IStoreHook | The address of the storage hook contract. |
enabledHooksBitmap | uint8 | A bitmap indicating which hook functionalities are enabled. |
unregisterStoreHook
Unregister a previously registered storage hook for a specified table.
The caller must be the owner of the namespace to which the table belongs.
function unregisterStoreHook(ResourceId tableId, IStoreHook hookAddress) public virtual onlyDelegatecall;
Parameters
Name | Type | Description |
---|---|---|
tableId | ResourceId | The resource ID of the table from which the hook is being unregistered. |
hookAddress | IStoreHook | The address of the storage hook contract. |
BatchCallSystem
Git Source (opens in a new tab)
Inherits: System, LimitedCallContext
A system contract that facilitates batching of calls to various systems in a single transaction.
Functions
batchCall
Make batch calls to multiple systems into a single transaction.
Iterates through an array of system calls, executes them, and returns an array of return data.
function batchCall(SystemCallData[] calldata systemCalls) public onlyDelegatecall returns (bytes[] memory returnDatas);
Parameters
Name | Type | Description |
---|---|---|
systemCalls | SystemCallData[] | An array of SystemCallData that contains systemId and callData for each call. |
Returns
Name | Type | Description |
---|---|---|
returnDatas | bytes[] | An array of bytes containing the return data for each system call. |
batchCallFrom
Make batch calls from specific addresses to multiple systems in a single transaction.
Iterates through an array of system calls with specified 'from' addresses, executes them, and returns an array of return data.
function batchCallFrom(
SystemCallFromData[] calldata systemCalls
) public onlyDelegatecall returns (bytes[] memory returnDatas);
Parameters
Name | Type | Description |
---|---|---|
systemCalls | SystemCallFromData[] | An array of SystemCallFromData that contains from, systemId, and callData for each call. |
Returns
Name | Type | Description |
---|---|---|
returnDatas | bytes[] | An array of bytes containing the return data for each system call. |
WorldRegistrationSystem
Git Source (opens in a new tab)
Inherits: System, IWorldErrors, LimitedCallContext
This contract provides functions related to registering resources other than tables in the World.
Functions
registerNamespace
Registers a new namespace
Creates a new namespace resource with the given ID
function registerNamespace(ResourceId namespaceId) public virtual onlyDelegatecall;
Parameters
Name | Type | Description |
---|---|---|
namespaceId | ResourceId | The unique identifier for the new namespace |
registerSystemHook
Registers a new system hook
Adds a new hook for the system at the provided system ID
function registerSystemHook(
ResourceId systemId,
ISystemHook hookAddress,
uint8 enabledHooksBitmap
) public virtual onlyDelegatecall;
Parameters
Name | Type | Description |
---|---|---|
systemId | ResourceId | The ID of the system |
hookAddress | ISystemHook | The address of the hook being registered |
enabledHooksBitmap | uint8 | Bitmap indicating which hooks are enabled |
unregisterSystemHook
Unregisters a system hook
Removes a hook for the system at the provided system ID
function unregisterSystemHook(ResourceId systemId, ISystemHook hookAddress) public virtual onlyDelegatecall;
Parameters
Name | Type | Description |
---|---|---|
systemId | ResourceId | The ID of the system |
hookAddress | ISystemHook | The address of the hook being unregistered |
registerSystem
Registers a system
Registers or upgrades a system at the given ID If the namespace doesn't exist yet, it is registered. The system is granted access to its namespace, so it can write to any table in the same namespace. If publicAccess is true, no access control check is performed for calling the system. This function doesn't check whether a system already exists at the given selector, making it possible to upgrade systems.
function registerSystem(ResourceId systemId, System system, bool publicAccess) public virtual onlyDelegatecall;
Parameters
Name | Type | Description |
---|---|---|
systemId | ResourceId | The unique identifier for the system |
system | System | The system being registered |
publicAccess | bool | Flag indicating if access control check is bypassed |
registerFunctionSelector
Registers a new World function selector
Creates a mapping between a World function and its associated system function
function registerFunctionSelector(
ResourceId systemId,
string memory systemFunctionSignature
) public onlyDelegatecall returns (bytes4 worldFunctionSelector);
Parameters
Name | Type | Description |
---|---|---|
systemId | ResourceId | The system ID |
systemFunctionSignature | string | The signature of the system function |
Returns
Name | Type | Description |
---|---|---|
worldFunctionSelector | bytes4 | The selector of the World function |
registerRootFunctionSelector
Registers a root World function selector
Creates a mapping for a root World function without namespace or name prefix
function registerRootFunctionSelector(
ResourceId systemId,
string memory worldFunctionSignature,
string memory systemFunctionSignature
) public onlyDelegatecall returns (bytes4 worldFunctionSelector);
Parameters
Name | Type | Description |
---|---|---|
systemId | ResourceId | The system ID |
worldFunctionSignature | string | The signature of the World function |
systemFunctionSignature | string | The signature of the system function |
Returns
Name | Type | Description |
---|---|---|
worldFunctionSelector | bytes4 | The selector of the World function |
registerDelegation
Registers a delegation for the caller
Creates a new delegation from the caller to the specified delegatee
function registerDelegation(
address delegatee,
ResourceId delegationControlId,
bytes memory initCallData
) public onlyDelegatecall;
Parameters
Name | Type | Description |
---|---|---|
delegatee | address | The address of the delegatee |
delegationControlId | ResourceId | The ID controlling the delegation |
initCallData | bytes | The initialization data for the delegation |
unregisterDelegation
Unregisters a delegation
Deletes the new delegation from the caller to the specified delegatee
function unregisterDelegation(address delegatee) public onlyDelegatecall;
Parameters
Name | Type | Description |
---|---|---|
delegatee | address | The address of the delegatee |
registerNamespaceDelegation
Registers a delegation for a namespace
Sets up a new delegation control for a specific namespace
function registerNamespaceDelegation(
ResourceId namespaceId,
ResourceId delegationControlId,
bytes memory initCallData
) public onlyDelegatecall;
Parameters
Name | Type | Description |
---|---|---|
namespaceId | ResourceId | The ID of the namespace |
delegationControlId | ResourceId | The ID controlling the delegation |
initCallData | bytes | The initialization data for the delegation |
unregisterNamespaceDelegation
Unregisters a delegation for a namespace
Deletes the delegation control for a specific namespace
function unregisterNamespaceDelegation(ResourceId namespaceId) public onlyDelegatecall;
Parameters
Name | Type | Description |
---|---|---|
namespaceId | ResourceId | The ID of the namespace |