Skip to content

Commit b774ab2

Browse files
vdrgfrolic
andauthored
feat(world-consumer): convert store-consumer package into world-consumer (#3584)
Co-authored-by: Kevin Ingersoll <kingersoll@gmail.com>
1 parent 3067075 commit b774ab2

37 files changed

Lines changed: 275 additions & 695 deletions

.changeset/chatty-coats-destroy.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@latticexyz/world-module-erc20": patch
3+
---
4+
5+
Migrated from `store-consumer` to `world-consumer`.

.changeset/shy-terms-walk.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@latticexyz/world-consumer": patch
3+
---
4+
5+
Renamed `store-consumer` package to `world-consumer`. The `world-consumer` package now only includes a single `WorldConsumer` contract that is bound to a `World`.

docs/pages/world/modules/erc20.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ The advantage of doing this, rather than creating a separate [ERC-20 contract](h
1414

1515
The token contract can be seen as a hybrid system contract which contains functions directly callable from outside the world (ERC20 functions like `transfer`, `balanceOf`, etc), and restricted functions that must be called as a system function through the World (`mint`, `pause`, etc).
1616

17-
The ERC20Module receives the namespace, name and symbol of the token as parameters, and deploys the new token. Currently it installs a [default ERC20](https://github.com/latticexyz/mud/tree/main/packages/world-module-erc20/src/examples/ERC20WithWorld.sol) with the following features:
17+
The ERC20Module receives the namespace, name and symbol of the token as parameters, and deploys the new token. Currently it installs a [default ERC20](https://github.com/latticexyz/mud/tree/main/packages/world-module-erc20/src/examples/ERC20PausableBurnable.sol) with the following features:
1818

1919
- ERC20Burnable: Allows users to burn their tokens (or the ones approved to them) using the `burn` and `burnFrom` function.
2020
- ERC20Pausable: Supports pausing and unpausing token operations. This is combined with the `pause` and `unpause` public functions that can be called by addresses and systems with access to the token's namespace. Must be done through a World call.
@@ -70,7 +70,7 @@ import { IWorldCall } from "@latticexyz/world/src/IWorldKernel.sol";
7070
import { WorldResourceIdLib } from "@latticexyz/world/src/WorldResourceId.sol";
7171
import { SystemRegistry } from "@latticexyz/world/src/codegen/tables/SystemRegistry.sol";
7272
import { ERC20Registry } from "@latticexyz/world-module-erc20/src/codegen/index.sol";
73-
import { ERC20WithWorld as ERC20 } from "@latticexyz/world-module-erc20/src/examples/ERC20WithWorld.sol";
73+
import { ERC20PausableBurnable as ERC20 } from "@latticexyz/world-module-erc20/src/examples/ERC20PausableBurnable.sol";
7474
7575
import { IWorld } from "../src/codegen/world/IWorld.sol";
7676
@@ -98,7 +98,7 @@ contract ManageERC20 is Script {
9898
9999
// Get the ERC-20 token address
100100
ResourceId namespaceResource = WorldResourceIdLib.encodeNamespace(bytes14("erc20Namespace"));
101-
ResourceId erc20RegistryResource = WorldResourceIdLib.encode(RESOURCE_TABLE, "erc20-module", "ERC20_REGISTRY");
101+
ResourceId erc20RegistryResource = WorldResourceIdLib.encode(RESOURCE_TABLE, "erc20-module", "ERC20Registry");
102102
address tokenAddress = ERC20Registry.getTokenAddress(erc20RegistryResource, namespaceResource);
103103
ResourceId tokenSystem = SystemRegistry.get(tokenAddress);
104104
console.log("Token address", tokenAddress);
@@ -142,7 +142,7 @@ contract ManageERC20 is Script {
142142
```solidity
143143
// Get the ERC-20 token address
144144
ResourceId namespaceResource = WorldResourceIdLib.encodeNamespace(bytes14("erc20Namespace"));
145-
ResourceId erc20RegistryResource = WorldResourceIdLib.encode(RESOURCE_TABLE, "erc20-module", "ERC20_REGISTRY");
145+
ResourceId erc20RegistryResource = WorldResourceIdLib.encode(RESOURCE_TABLE, "erc20-module", "ERC20Registry");
146146
address tokenAddress = ERC20Registry.getTokenAddress(erc20RegistryResource, namespaceResource);
147147
ResourceId tokenSystem = SystemRegistry.get(tokenAddress);
148148
console.log("Token address", tokenAddress);

docs/pages/world/reference/world-context.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ function _msgSender() public view virtual returns (address sender);
3434
Extract the `msg.value` from the context appended to the calldata.
3535

3636
```solidity
37-
function _msgValue() public pure returns (uint256 value);
37+
function _msgValue() public view virtual returns (uint256 value);
3838
```
3939

4040
**Returns**

packages/store-consumer/README.md

Lines changed: 0 additions & 11 deletions
This file was deleted.

packages/store-consumer/src/experimental/Context.sol

Lines changed: 0 additions & 10 deletions
This file was deleted.

packages/store-consumer/src/experimental/StoreConsumer.sol

Lines changed: 0 additions & 24 deletions
This file was deleted.

packages/store-consumer/src/experimental/WithStore.sol

Lines changed: 0 additions & 22 deletions
This file was deleted.

packages/store-consumer/src/experimental/WithWorld.sol

Lines changed: 0 additions & 80 deletions
This file was deleted.

packages/store/ts/flattenStoreLogs.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,8 @@ describe("flattenStoreLogs", async () => {
134134
"Store_SetRecord store__ResourceIds (0x746200000000000000000000000000005465727261696e000000000000000000)",
135135
"Store_SetRecord store__ResourceIds (0x737900000000000000000000000000004d6f766553797374656d000000000000)",
136136
"Store_SetRecord world__Systems (0x737900000000000000000000000000004d6f766553797374656d000000000000)",
137-
"Store_SetRecord world__SystemRegistry (0x0000000000000000000000006eb355773196079fe643ed78724140adb1f86c11)",
138-
"Store_SetRecord world__ResourceAccess (0x6e73000000000000000000000000000000000000000000000000000000000000,0x0000000000000000000000006eb355773196079fe643ed78724140adb1f86c11)",
137+
"Store_SetRecord world__SystemRegistry (0x000000000000000000000000cbcdc66f9301ccf30b6b46efba8a3015d332dc13)",
138+
"Store_SetRecord world__ResourceAccess (0x6e73000000000000000000000000000000000000000000000000000000000000,0x000000000000000000000000cbcdc66f9301ccf30b6b46efba8a3015d332dc13)",
139139
"Store_SetRecord world__FunctionSelector (0xb591186e00000000000000000000000000000000000000000000000000000000)",
140140
"Store_SetRecord world__FunctionSignatur (0xb591186e00000000000000000000000000000000000000000000000000000000)",
141141
"Store_SetRecord store__Tables (0x7462000000000000000000000000000043616c6c576974685369676e61747572)",

0 commit comments

Comments
 (0)