diff --git a/docs/pages/world/account-delegation.mdx b/docs/pages/world/account-delegation.mdx index 1064b0f82f..796086d463 100644 --- a/docs/pages/world/account-delegation.mdx +++ b/docs/pages/world/account-delegation.mdx @@ -23,7 +23,7 @@ The most common type of delegation is when a delegator address allows a specific ### Creating a user delegation -First, the delegator has to call [`registerDelegation`](https://github.com/latticexyz/mud/blob/main/packages/world/src/modules/core/implementations/WorldRegistrationSystem.sol#L234-L263). +First, the delegator has to call [`registerDelegation`](https://github.com/latticexyz/mud/blob/main/packages/world/src/modules/init/implementations/WorldRegistrationSystem.sol#L251-L284). This function takes three parameters: - `delegatee`, the address given the privileges. @@ -51,14 +51,14 @@ This means that if you need in a `World` to implement multiple delegation algori ### Removing a user delegation -You can use [`unregisterDelegation`](https://github.com/latticexyz/mud/blob/main/packages/world/src/modules/core/implementations/WorldRegistrationSystem.sol#L283-L291) to remove a delegation. +You can use [`unregisterDelegation`](https://github.com/latticexyz/mud/blob/main/packages/world/src/modules/init/implementations/WorldRegistrationSystem.sol#L286-L294) to remove a delegation. Because of `unregisterDelegation` delegations cannot be used for a delegator to commit to allow something to be done in the future. If you need a _commitment_, create a table with a `System` that lets the address that commits write the commitment and have an action that other addresses can call only if the proper commitment is there - without giving the committed address an option to delete the entry. ## Namespace delegation -The owner of a namespace can use [`registerNamespaceDelegation`](https://github.com/latticexyz/mud/blob/main/packages/world/src/modules/core/implementations/WorldRegistrationSystem.sol#L300-L332) to register a delegation that applies to all callers of systems in this namespace. +The owner of a namespace can use [`registerNamespaceDelegation`](https://github.com/latticexyz/mud/blob/main/packages/world/src/modules/init/implementations/WorldRegistrationSystem.sol#L296-L335) to register a delegation that applies to all callers of systems in this namespace. This functionality is useful, for example, to implement a trusted forwarder for the namespace. This is not a security concern because the namespace owner already has full control over any table or `System` in the namespace. diff --git a/docs/pages/world/balance.mdx b/docs/pages/world/balance.mdx index a98d692fa5..bf692257ac 100644 --- a/docs/pages/world/balance.mdx +++ b/docs/pages/world/balance.mdx @@ -203,7 +203,7 @@ uint256 balance = Balances.get(); To transfer ETH out of the `World` you need to have the `access` permission level to the namespace itself. Note that `System` contracts within the namespace do have that permission. -You use either [`transferBalanceToNamespace`](https://github.com/latticexyz/mud/blob/main/packages/world/src/modules/core/implementations/BalanceTransferSystem.sol#L23-L52), if you want to transfer between namespaces in the same `World`, or [`transferBalanceToAddress`](https://github.com/latticexyz/mud/blob/main/packages/world/src/modules/core/implementations/BalanceTransferSystem.sol#L54-L77), to transfer to a different address. +You use either [`transferBalanceToNamespace`](https://github.com/latticexyz/mud/blob/main/packages/world/src/modules/init/implementations/BalanceTransferSystem.sol#L25-L57), if you want to transfer between namespaces in the same `World`, or [`transferBalanceToAddress`](https://github.com/latticexyz/mud/blob/main/packages/world/src/modules/init/implementations/BalanceTransferSystem.sol#L59-L86), to transfer to a different address.
diff --git a/docs/pages/world/batch-calls.mdx b/docs/pages/world/batch-calls.mdx index 3a7a8abaa7..0e1208d3e7 100644 --- a/docs/pages/world/batch-calls.mdx +++ b/docs/pages/world/batch-calls.mdx @@ -1,8 +1,8 @@ # Batch calls Batch calls allow a single call to the `World` to perform multiple `System` calls. -Using [`batchCall`](https://github.com/latticexyz/mud/blob/main/packages/world/src/modules/core/implementations/BatchCallSystem.sol#L15-L33) you can issue calls on your own behalf. -If you have the proper [delegations](/world/account-delegation), you can also use [`batchCallFrom`](https://github.com/latticexyz/mud/blob/main/packages/world/src/modules/core/implementations/BatchCallSystem.sol#L35-L53) to issue `System` calls on behalf of other addresses. +Using [`batchCall`](https://github.com/latticexyz/mud/blob/main/packages/world/src/modules/init/implementations/BatchCallSystem.sol#L15-L35) you can issue calls on your own behalf. +If you have the proper [delegations](/world/account-delegation), you can also use [`batchCallFrom`](https://github.com/latticexyz/mud/blob/main/packages/world/src/modules/init/implementations/BatchCallSystem.sol#L37-L57) to issue `System` calls on behalf of other addresses. The calls take place sequentially, and after they all finish successfully you get back the return values from all of them. If any of the calls revert, so does `batchCall` / `batchCallFrom`, so all the state changes created by the previous calls are discarded. diff --git a/docs/pages/world/function-selectors.mdx b/docs/pages/world/function-selectors.mdx index 9dc757e91c..db6508b2e0 100644 --- a/docs/pages/world/function-selectors.mdx +++ b/docs/pages/world/function-selectors.mdx @@ -14,7 +14,7 @@ To improve the developer experience of calling `System` functions, the namespace This removes the need for the caller to know the system's `ResourceId`, and the need to manually encode the calldata via `abi.encodeCall`. Once the namespace owner registers a function selector for a `System` function, anybody can call the `System` via `.__()`. -To register a function selector, you use [`.registerFunctionSelector`](https://github.com/latticexyz/mud/blob/main/packages/world/src/modules/core/implementations/WorldRegistrationSystem.sol#L164-L201). +To register a function selector, you use [`.registerFunctionSelector`](https://github.com/latticexyz/mud/blob/main/packages/world/src/modules/init/implementations/WorldRegistrationSystem.sol#L180-L218). This function takes two parameters: - The `ResourceID` of the `System`. @@ -39,7 +39,7 @@ After the function selector is registered, it can be accessed directly on the Wo ## Root function selectors -The owner of the root namespace can use [`registerRootFunctionSelector`](https://github.com/latticexyz/mud/blob/main/packages/world/src/modules/core/implementations/WorldRegistrationSystem.sol#L203-L232) to register an arbitrary string as a function signature. +The owner of the root namespace can use [`registerRootFunctionSelector`](https://github.com/latticexyz/mud/blob/main/packages/world/src/modules/init/implementations/WorldRegistrationSystem.sol#L220-L249) to register an arbitrary string as a function signature. This function has three parameters: diff --git a/docs/pages/world/modules.mdx b/docs/pages/world/modules.mdx index 7c7aafc94a..e6689640b4 100644 --- a/docs/pages/world/modules.mdx +++ b/docs/pages/world/modules.mdx @@ -5,7 +5,7 @@ This is somewhat similar to one of the use cases for [foundry scripts](https://b ## Module installation -Modules can be installed using [`World.installModule(address moduleAddress, bytes memory initData)`](https://github.com/latticexyz/mud/blob/main/packages/world/src/modules/core/implementations/ModuleInstallationSystem.sol#L17-L37). +Modules can be installed using [`World.installModule(address moduleAddress, bytes memory initData)`](https://github.com/latticexyz/mud/blob/main/packages/world/src/modules/init/implementations/ModuleInstallationSystem.sol#L17-L37). When you do this, the `World` calls the module's `install` function with `initData` as the argument(s). Because this is a call, the module does not have any administrative permissions on the `World`. diff --git a/docs/pages/world/namespaces-access-control.mdx b/docs/pages/world/namespaces-access-control.mdx index 97e577e05c..2de94e047f 100644 --- a/docs/pages/world/namespaces-access-control.mdx +++ b/docs/pages/world/namespaces-access-control.mdx @@ -84,7 +84,7 @@ By default access to a namespace is granted to: Namespace access provides access to all the resources within the namespace, so there is no need, by default, for access to the resources within the namespace. -If that is insufficient, [`AccessManagementSystem`](https://github.com/latticexyz/mud/blob/main/packages/world/src/modules/core/implementations/AccessManagementSystem.sol) lets you [`grantAccess`](https://github.com/latticexyz/mud/blob/main/packages/world/src/modules/core/implementations/AccessManagementSystem.sol#L17-L29), [`revokeAccess`](https://github.com/latticexyz/mud/blob/main/packages/world/src/modules/core/implementations/AccessManagementSystem.sol#L31-L43), and [`transferOwnership`](https://github.com/latticexyz/mud/blob/main/packages/world/src/modules/core/implementations/AccessManagementSystem.sol#L45-L63) of a namespace. +If that is insufficient, [`AccessManagementSystem`](https://github.com/latticexyz/mud/blob/main/packages/world/src/modules/init/implementations/AccessManagementSystem.sol) lets you [`grantAccess`](https://github.com/latticexyz/mud/blob/main/packages/world/src/modules/init/implementations/AccessManagementSystem.sol#L18-L33), [`revokeAccess`](https://github.com/latticexyz/mud/blob/main/packages/world/src/modules/init/implementations/AccessManagementSystem.sol#L35-L47), and [`transferOwnership`](https://github.com/latticexyz/mud/blob/main/packages/world/src/modules/init/implementations/AccessManagementSystem.sol#L49-L73) of a namespace. For example, here is a script that grants access to the `Counter` table to one address and revokes it for another. diff --git a/docs/pages/world/system-hooks.mdx b/docs/pages/world/system-hooks.mdx index 9ec9e1846f..7f0e90f886 100644 --- a/docs/pages/world/system-hooks.mdx +++ b/docs/pages/world/system-hooks.mdx @@ -1,6 +1,6 @@ # System hooks -The [namespace owner](/world/namespaces-access-control#ownership) can [register](https://github.com/latticexyz/mud/blob/main/packages/world/src/modules/core/implementations/WorldRegistrationSystem.sol#L65-L81) hooks that are called before and/or after calls to a specific `System`. +The [namespace owner](/world/namespaces-access-control#ownership) can [register](https://github.com/latticexyz/mud/blob/main/packages/world/src/modules/init/implementations/WorldRegistrationSystem.sol#L68-L99) hooks that are called before and/or after calls to a specific `System`. ## System hook contracts diff --git a/docs/pages/world/systems.mdx b/docs/pages/world/systems.mdx index 81e7505c0a..84978f7ee1 100644 --- a/docs/pages/world/systems.mdx +++ b/docs/pages/world/systems.mdx @@ -120,7 +120,7 @@ If you need to call a `System` from a `System` in the root namespace you can use ## Registering systems -For a `System` to be callable from a `World` it has to be [registered](https://github.com/latticexyz/mud/blob/main/packages/world/src/modules/core/implementations/WorldRegistrationSystem.sol#L97-L201). +For a `System` to be callable from a `World` it has to be [registered](https://github.com/latticexyz/mud/blob/main/packages/world/src/modules/init/implementations/WorldRegistrationSystem.sol#L115-L178). Only the [namespace owner](./namespaces-access-control#ownership) can register a `System` in a namespace. `System`s can be registered once per `World`, but the same system can be registered in multiple `World`s.