Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(world): move codegen files #1537

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions packages/world/mud.config.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { mudConfig } from "./ts/register";

export default mudConfig({
worldImportPath: "../",
worldImportPath: "../../",
worldgenDirectory: "interfaces",
worldInterfaceName: "IBaseWorld",
codegenDirectory: "",
tables: {
/************************************************************************
*
Expand Down Expand Up @@ -172,15 +171,15 @@ export default mudConfig({
*
************************************************************************/
Bool: {
directory: "../test/tables",
directory: "test/tables",
keySchema: {},
valueSchema: {
value: "bool",
},
tableIdArgument: true,
},
AddressArray: {
directory: "../test/tables",
directory: "test/tables",
valueSchema: "address[]",
tableIdArgument: true,
},
Expand Down
3 changes: 1 addition & 2 deletions packages/world/src/AccessControl.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ pragma solidity >=0.8.0;
import { ResourceSelector } from "./ResourceSelector.sol";
import { IWorldErrors } from "./interfaces/IWorldErrors.sol";

import { ResourceAccess } from "./tables/ResourceAccess.sol";
import { NamespaceOwner } from "./tables/NamespaceOwner.sol";
import { ResourceAccess, NamespaceOwner } from "./codegen/index.sol";

library AccessControl {
using ResourceSelector for bytes32;
Expand Down
5 changes: 1 addition & 4 deletions packages/world/src/SystemCall.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,7 @@ import { BEFORE_CALL_SYSTEM, AFTER_CALL_SYSTEM } from "./systemHookTypes.sol";
import { IWorldErrors } from "./interfaces/IWorldErrors.sol";
import { ISystemHook } from "./interfaces/ISystemHook.sol";

import { FunctionSelectors } from "./modules/core/tables/FunctionSelectors.sol";
import { Systems } from "./modules/core/tables/Systems.sol";
import { SystemHooks } from "./modules/core/tables/SystemHooks.sol";
import { Balances } from "./modules/core/tables/Balances.sol";
import { FunctionSelectors, Systems, SystemHooks, Balances } from "./codegen/index.sol";

library SystemCall {
using ResourceSelector for bytes32;
Expand Down
23 changes: 0 additions & 23 deletions packages/world/src/Tables.sol

This file was deleted.

10 changes: 0 additions & 10 deletions packages/world/src/Types.sol

This file was deleted.

2 changes: 1 addition & 1 deletion packages/world/src/Utils.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pragma solidity >=0.8.0;

import { StoreSwitch } from "@latticexyz/store/src/StoreSwitch.sol";
import { ResourceSelector } from "./ResourceSelector.sol";
import { SystemRegistry } from "./Tables.sol";
import { SystemRegistry } from "./codegen/index.sol";

library Utils {
/**
Expand Down
9 changes: 1 addition & 8 deletions packages/world/src/World.sol
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,11 @@ import { revertWithBytes } from "./revertWithBytes.sol";
import { Delegation } from "./Delegation.sol";
import { requireInterface } from "./requireInterface.sol";

import { NamespaceOwner } from "./tables/NamespaceOwner.sol";
import { InstalledModules } from "./tables/InstalledModules.sol";
import { Delegations } from "./tables/Delegations.sol";

import { IModule, MODULE_INTERFACE_ID } from "./interfaces/IModule.sol";
import { IWorldKernel } from "./interfaces/IWorldKernel.sol";
import { IDelegationControl } from "./interfaces/IDelegationControl.sol";

import { Systems } from "./modules/core/tables/Systems.sol";
import { SystemHooks } from "./modules/core/tables/SystemHooks.sol";
import { FunctionSelectors } from "./modules/core/tables/FunctionSelectors.sol";
import { Balances } from "./modules/core/tables/Balances.sol";
import { NamespaceOwner, InstalledModules, Delegations, Systems, SystemHooks, FunctionSelectors, Balances } from "./codegen/index.sol";
import { CORE_MODULE_NAME } from "./modules/core/constants.sol";

contract World is StoreRead, IStoreData, IWorldKernel {
Expand Down
File renamed without changes.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/world/src/factories/WorldFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pragma solidity >=0.8.0;
import { Create2 } from "./Create2.sol";
import { World } from "../World.sol";
import { IWorldFactory } from "./IWorldFactory.sol";
import { IBaseWorld } from "../interfaces/IBaseWorld.sol";
import { IBaseWorld } from "../codegen/interfaces/IBaseWorld.sol";
import { IModule } from "../interfaces/IModule.sol";
import { ROOT_NAMESPACE } from "../constants.sol";

Expand Down
16 changes: 3 additions & 13 deletions packages/world/src/modules/core/CoreModule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,20 @@ pragma solidity >=0.8.0;

import { WorldContextProvider } from "../../WorldContext.sol";
import { ROOT_NAMESPACE } from "../../constants.sol";
import { Resource } from "../../common.sol";
import { Resource } from "../../codegen/common.sol";
import { Module } from "../../Module.sol";

import { IBaseWorld } from "../../interfaces/IBaseWorld.sol";
import { IBaseWorld } from "../../codegen/interfaces/IBaseWorld.sol";

import { IStoreEphemeral } from "@latticexyz/store/src/IStore.sol";
import { StoreCore } from "@latticexyz/store/src/StoreCore.sol";
import { ResourceSelector } from "../../ResourceSelector.sol";

import { NamespaceOwner } from "../../tables/NamespaceOwner.sol";
import { ResourceAccess } from "../../tables/ResourceAccess.sol";
import { InstalledModules } from "../../tables/InstalledModules.sol";
import { Delegations } from "../../tables/Delegations.sol";
import { NamespaceOwner, ResourceAccess, InstalledModules, Delegations, Systems, FunctionSelectors, ResourceType, SystemHooks, SystemRegistry, Balances } from "../../codegen/index.sol";

import { CoreSystem } from "./CoreSystem.sol";
import { CORE_MODULE_NAME, CORE_SYSTEM_NAME } from "./constants.sol";

import { Systems } from "./tables/Systems.sol";
import { FunctionSelectors } from "./tables/FunctionSelectors.sol";
import { ResourceType } from "./tables/ResourceType.sol";
import { SystemHooks } from "./tables/SystemHooks.sol";
import { SystemRegistry } from "./tables/SystemRegistry.sol";
import { Balances } from "./tables/Balances.sol";

import { AccessManagementSystem } from "./implementations/AccessManagementSystem.sol";
import { BalanceTransferSystem } from "./implementations/BalanceTransferSystem.sol";
import { EphemeralRecordSystem } from "./implementations/EphemeralRecordSystem.sol";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ import { IModule } from "../../../interfaces/IModule.sol";
import { System } from "../../../System.sol";
import { AccessControl } from "../../../AccessControl.sol";
import { ResourceSelector } from "../../../ResourceSelector.sol";
import { ResourceAccess } from "../../../tables/ResourceAccess.sol";
import { InstalledModules } from "../../../tables/InstalledModules.sol";
import { NamespaceOwner } from "../../../tables/NamespaceOwner.sol";
import { ResourceAccess, InstalledModules, NamespaceOwner } from "../../../codegen/index.sol";

/**
* Granting and revoking access from/to resources.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { ResourceSelector } from "../../../ResourceSelector.sol";
import { AccessControl } from "../../../AccessControl.sol";
import { IWorldErrors } from "../../../interfaces/IWorldErrors.sol";

import { Balances } from "../tables/Balances.sol";
import { Balances } from "../../../codegen/index.sol";

contract BalanceTransferSystem is System, IWorldErrors {
using ResourceSelector for bytes32;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ import { IModule, MODULE_INTERFACE_ID } from "../../../interfaces/IModule.sol";
import { System } from "../../../System.sol";
import { AccessControl } from "../../../AccessControl.sol";
import { WorldContextProvider } from "../../../WorldContext.sol";
import { ResourceAccess } from "../../../tables/ResourceAccess.sol";
import { InstalledModules } from "../../../tables/InstalledModules.sol";
import { ResourceAccess, InstalledModules } from "../../../codegen/index.sol";
import { requireInterface } from "../../../requireInterface.sol";

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,14 @@ import { Schema } from "@latticexyz/store/src/Schema.sol";

import { System } from "../../../System.sol";
import { ResourceSelector } from "../../../ResourceSelector.sol";
import { Resource } from "../../../common.sol";
import { Resource } from "../../../codegen/common.sol";
import { ROOT_NAMESPACE, ROOT_NAME } from "../../../constants.sol";
import { AccessControl } from "../../../AccessControl.sol";
import { requireInterface } from "../../../requireInterface.sol";
import { WorldContextProvider } from "../../../WorldContext.sol";
import { NamespaceOwner } from "../../../tables/NamespaceOwner.sol";
import { ResourceAccess } from "../../../tables/ResourceAccess.sol";
import { NamespaceOwner, ResourceAccess, ResourceType, SystemHooks, SystemRegistry, Systems, FunctionSelectors } from "../../../codegen/index.sol";
import { IWorldErrors } from "../../../interfaces/IWorldErrors.sol";

import { ResourceType } from "../tables/ResourceType.sol";
import { SystemHooks } from "../tables/SystemHooks.sol";
import { SystemRegistry } from "../tables/SystemRegistry.sol";
import { Systems } from "../tables/Systems.sol";
import { FunctionSelectors } from "../tables/FunctionSelectors.sol";

import { CORE_SYSTEM_NAME } from "../constants.sol";

import { WorldRegistrationSystem } from "./WorldRegistrationSystem.sol";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,16 @@ import { Hook, HookLib } from "@latticexyz/store/src/Hook.sol";
import { System } from "../../../System.sol";
import { WorldContextConsumer, WORLD_CONTEXT_CONSUMER_INTERFACE_ID } from "../../../WorldContext.sol";
import { ResourceSelector } from "../../../ResourceSelector.sol";
import { Resource } from "../../../common.sol";
import { Resource } from "../../../codegen/common.sol";
import { SystemCall } from "../../../SystemCall.sol";
import { ROOT_NAMESPACE, ROOT_NAME, UNLIMITED_DELEGATION } from "../../../constants.sol";
import { AccessControl } from "../../../AccessControl.sol";
import { requireInterface } from "../../../requireInterface.sol";
import { NamespaceOwner } from "../../../tables/NamespaceOwner.sol";
import { ResourceAccess } from "../../../tables/ResourceAccess.sol";
import { Delegations } from "../../../tables/Delegations.sol";
import { NamespaceOwner, ResourceAccess, Delegations, ResourceType, SystemHooks, SystemHooksTableId, SystemRegistry, Systems, FunctionSelectors } from "../../../codegen/index.sol";
import { ISystemHook, SYSTEM_HOOK_INTERFACE_ID } from "../../../interfaces/ISystemHook.sol";
import { IWorldErrors } from "../../../interfaces/IWorldErrors.sol";
import { IDelegationControl, DELEGATION_CONTROL_INTERFACE_ID } from "../../../interfaces/IDelegationControl.sol";

import { ResourceType } from "../tables/ResourceType.sol";
import { SystemHooks, SystemHooksTableId } from "../tables/SystemHooks.sol";
import { SystemRegistry } from "../tables/SystemRegistry.sol";
import { Systems } from "../tables/Systems.sol";
import { FunctionSelectors } from "../tables/FunctionSelectors.sol";

/**
* Functions related to registering resources other than tables in the World.
* Registering tables is implemented in StoreRegistrationSystem.sol
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ import { PackedCounter } from "@latticexyz/store/src/PackedCounter.sol";
import { FieldLayout } from "@latticexyz/store/src/FieldLayout.sol";
import { StoreHook } from "@latticexyz/store/src/StoreHook.sol";

import { KeysInTable } from "./tables/KeysInTable.sol";
import { UsedKeysIndex } from "./tables/UsedKeysIndex.sol";
import { KeysInTable, UsedKeysIndex } from "../../codegen/index.sol";

/**
* Note: if a table with composite keys is used, only the first five keys of the tuple are indexed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,16 @@ pragma solidity >=0.8.0;

import { BEFORE_SET_RECORD, AFTER_SET_FIELD, BEFORE_DELETE_RECORD } from "@latticexyz/store/src/storeHookTypes.sol";

import { ResourceType } from "../core/tables/ResourceType.sol";
import { Resource } from "../../common.sol";
import { ResourceType, KeysInTable, KeysInTableTableId, UsedKeysIndex, UsedKeysIndexTableId } from "../../codegen/index.sol";
import { Resource } from "../../codegen/common.sol";
import { Module } from "../../Module.sol";

import { IBaseWorld } from "../../interfaces/IBaseWorld.sol";
import { IBaseWorld } from "../../codegen/interfaces/IBaseWorld.sol";

import { ResourceSelector } from "../../ResourceSelector.sol";
import { revertWithBytes } from "../../revertWithBytes.sol";

import { KeysInTableHook } from "./KeysInTableHook.sol";
import { KeysInTable, KeysInTableTableId } from "./tables/KeysInTable.sol";
import { UsedKeysIndex, UsedKeysIndexTableId } from "./tables/UsedKeysIndex.sol";

/**
* This module deploys a hook that is called when a value is set in the `sourceTableId`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { IStore } from "@latticexyz/store/src/IStore.sol";
import { Schema } from "@latticexyz/store/src/Schema.sol";
import { StoreSwitch } from "@latticexyz/store/src/StoreSwitch.sol";

import { KeysInTable } from "./tables/KeysInTable.sol";
import { KeysInTable } from "../../codegen/index.sol";

/**
* Get a list of keys in the given table.
Expand Down
2 changes: 1 addition & 1 deletion packages/world/src/modules/keysintable/hasKey.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pragma solidity >=0.8.0;

import { IStore } from "@latticexyz/store/src/IStore.sol";

import { UsedKeysIndex } from "./tables/UsedKeysIndex.sol";
import { UsedKeysIndex } from "../../codegen/index.sol";

/**
* Get whether the keyTuple is in the given table.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import { Bytes } from "@latticexyz/store/src/Bytes.sol";
import { FieldLayout } from "@latticexyz/store/src/FieldLayout.sol";
import { StoreSwitch } from "@latticexyz/store/src/StoreSwitch.sol";
import { PackedCounter } from "@latticexyz/store/src/PackedCounter.sol";
import { IBaseWorld } from "../../interfaces/IBaseWorld.sol";
import { IBaseWorld } from "../../codegen/interfaces/IBaseWorld.sol";

import { ResourceSelector } from "../../ResourceSelector.sol";

import { MODULE_NAMESPACE } from "./constants.sol";
import { KeysWithValue } from "./tables/KeysWithValue.sol";
import { KeysWithValue } from "../../codegen/index.sol";
import { ArrayLib } from "../utils/ArrayLib.sol";
import { getTargetTableSelector } from "../utils/getTargetTableSelector.sol";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ import { StoreSwitch } from "@latticexyz/store/src/StoreSwitch.sol";
import { BEFORE_SET_RECORD, BEFORE_SET_FIELD, AFTER_SET_FIELD, BEFORE_DELETE_RECORD } from "@latticexyz/store/src/storeHookTypes.sol";
import { Module } from "../../Module.sol";

import { IBaseWorld } from "../../interfaces/IBaseWorld.sol";
import { IBaseWorld } from "../../codegen/interfaces/IBaseWorld.sol";

import { WorldContextConsumer } from "../../WorldContext.sol";
import { ResourceSelector } from "../../ResourceSelector.sol";
import { revertWithBytes } from "../../revertWithBytes.sol";

import { MODULE_NAMESPACE } from "./constants.sol";
import { KeysWithValueHook } from "./KeysWithValueHook.sol";
import { KeysWithValue } from "./tables/KeysWithValue.sol";
import { KeysWithValue } from "../../codegen/index.sol";
import { getTargetTableSelector } from "../utils/getTargetTableSelector.sol";

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { IStore } from "@latticexyz/store/src/IStore.sol";
import { PackedCounter } from "@latticexyz/store/src/PackedCounter.sol";

import { MODULE_NAMESPACE } from "./constants.sol";
import { KeysWithValue } from "./tables/KeysWithValue.sol";
import { KeysWithValue } from "../../codegen/index.sol";
import { getTargetTableSelector } from "../utils/getTargetTableSelector.sol";

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
pragma solidity >=0.8.0;

import { DelegationControl } from "../../DelegationControl.sol";
import { CallboundDelegations } from "./tables/CallboundDelegations.sol";
import { CallboundDelegations } from "../../codegen/index.sol";

contract CallboundDelegationControl is DelegationControl {
/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;

import { IBaseWorld } from "../../interfaces/IBaseWorld.sol";
import { IBaseWorld } from "../../codegen/interfaces/IBaseWorld.sol";

import { Module } from "../../Module.sol";
import { WorldContextConsumer } from "../../WorldContext.sol";
Expand All @@ -12,8 +12,7 @@ import { CallboundDelegationControl } from "./CallboundDelegationControl.sol";
import { TimeboundDelegationControl } from "./TimeboundDelegationControl.sol";
import { MODULE_NAME, CALLBOUND_DELEGATION, TIMEBOUND_DELEGATION } from "./constants.sol";

import { CallboundDelegations } from "./tables/CallboundDelegations.sol";
import { TimeboundDelegations } from "./tables/TimeboundDelegations.sol";
import { CallboundDelegations, TimeboundDelegations } from "../../codegen/index.sol";

/**
* This module registers tables and delegation control systems required for standard delegations
Expand Down
Loading