Skip to content

Commit

Permalink
fix: example
Browse files Browse the repository at this point in the history
  • Loading branch information
yonadaaa committed May 20, 2024
1 parent c50610d commit 8153691
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion examples/minimal/packages/contracts/script/PostDeploy.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { console } from "forge-std/console.sol";
import { StoreSwitch } from "@latticexyz/store/src/StoreSwitch.sol";
import { ResourceId, WorldResourceIdLib, WorldResourceIdInstance } from "@latticexyz/world/src/WorldResourceId.sol";
import { RESOURCE_SYSTEM } from "@latticexyz/world/src/worldResourceTypes.sol";
import { SystemFunctionArgument } from "@latticexyz/world/src/modules/init/types.sol";

import { MessageTable } from "../src/codegen/index.sol";
import { IWorld } from "../src/codegen/world/IWorld.sol";
Expand Down Expand Up @@ -33,7 +34,15 @@ contract PostDeploy is Script {
});
IWorld(worldAddress).registerNamespace(systemId.getNamespaceId());
IWorld(worldAddress).registerSystem(systemId, chatNamespacedSystem, true);
IWorld(worldAddress).registerFunctionSelector(systemId, "sendMessage(string)");

SystemFunctionArgument[] memory systemFunctionArguments = new SystemFunctionArgument[](1);
systemFunctionArguments[0] = SystemFunctionArgument("", "string");
IWorld(worldAddress).registerFunctionSelector(
systemId,
"sendMessage",
systemFunctionArguments,
new SystemFunctionArgument[](0)
);

// Grant this system access to MessageTable
IWorld(worldAddress).grantAccess(MessageTable._tableId, address(chatNamespacedSystem));
Expand Down

0 comments on commit 8153691

Please sign in to comment.