diff --git a/.changeset/grumpy-geckos-raise.md b/.changeset/grumpy-geckos-raise.md new file mode 100644 index 0000000000..7a39454259 --- /dev/null +++ b/.changeset/grumpy-geckos-raise.md @@ -0,0 +1,13 @@ +--- +"@latticexyz/cli": major +"@latticexyz/world": major +--- + +- All `World` function selectors that previously had `bytes16 namespace, bytes16 name` arguments now use `bytes32 resourceSelector` instead. + This includes `setRecord`, `setField`, `pushToField`, `popFromField`, `updateInField`, `deleteRecord`, `call`, `grantAccess`, `revokeAccess`, `registerTable`, + `registerStoreHook`, `registerSystemHook`, `registerFunctionSelector`, `registerSystem` and `registerRootFunctionSelector`. + This change aligns the `World` function selectors with the `Store` function selectors, reduces clutter, reduces gas cost and reduces the `World`'s contract size. + +- The `World`'s `registerHook` function is removed. Use `registerStoreHook` or `registerSystemHook` instead. + +- The `deploy` script is updated to integrate the World interface changes diff --git a/e2e/packages/contracts/types/ethers-contracts/IWorld.ts b/e2e/packages/contracts/types/ethers-contracts/IWorld.ts index d71872c609..ff02756749 100644 --- a/e2e/packages/contracts/types/ethers-contracts/IWorld.ts +++ b/e2e/packages/contracts/types/ethers-contracts/IWorld.ts @@ -30,10 +30,8 @@ import type { export interface IWorldInterface extends utils.Interface { functions: { - "call(bytes16,bytes16,bytes)": FunctionFragment; + "call(bytes32,bytes)": FunctionFragment; "deleteRecord(bytes32,bytes32[],bytes32)": FunctionFragment; - "deleteRecord(bytes16,bytes16,bytes32[],bytes32)": FunctionFragment; - "emitEphemeralRecord(bytes16,bytes16,bytes32[],bytes,bytes32)": FunctionFragment; "emitEphemeralRecord(bytes32,bytes32[],bytes,bytes32)": FunctionFragment; "getField(bytes32,bytes32[],uint8,bytes32)": FunctionFragment; "getFieldLength(bytes32,bytes32[],uint8,bytes32)": FunctionFragment; @@ -41,44 +39,34 @@ export interface IWorldInterface extends utils.Interface { "getKeySchema(bytes32)": FunctionFragment; "getRecord(bytes32,bytes32[],bytes32)": FunctionFragment; "getValueSchema(bytes32)": FunctionFragment; - "grantAccess(bytes16,bytes16,address)": FunctionFragment; + "grantAccess(bytes32,address)": FunctionFragment; "installModule(address,bytes)": FunctionFragment; "installRootModule(address,bytes)": FunctionFragment; "pop()": FunctionFragment; "popFromField(bytes32,bytes32[],uint8,uint256,bytes32)": FunctionFragment; - "popFromField(bytes16,bytes16,bytes32[],uint8,uint256,bytes32)": FunctionFragment; "push(uint32)": FunctionFragment; "pushRange(uint32,uint32)": FunctionFragment; "pushToField(bytes32,bytes32[],uint8,bytes,bytes32)": FunctionFragment; - "pushToField(bytes16,bytes16,bytes32[],uint8,bytes,bytes32)": FunctionFragment; - "registerFunctionSelector(bytes16,bytes16,string,string)": FunctionFragment; - "registerHook(bytes16,bytes16,address)": FunctionFragment; + "registerFunctionSelector(bytes32,string,string)": FunctionFragment; "registerNamespace(bytes16)": FunctionFragment; - "registerRootFunctionSelector(bytes16,bytes16,bytes4,bytes4)": FunctionFragment; + "registerRootFunctionSelector(bytes32,bytes4,bytes4)": FunctionFragment; "registerStoreHook(bytes32,address)": FunctionFragment; - "registerSystem(bytes16,bytes16,address,bool)": FunctionFragment; - "registerSystemHook(bytes16,bytes16,address)": FunctionFragment; - "registerTable(bytes16,bytes16,bytes32,bytes32,string[],string[])": FunctionFragment; + "registerSystem(bytes32,address,bool)": FunctionFragment; + "registerSystemHook(bytes32,address)": FunctionFragment; "registerTable(bytes32,bytes32,bytes32,string[],string[])": FunctionFragment; - "registerTableHook(bytes16,bytes16,address)": FunctionFragment; - "revokeAccess(bytes16,bytes16,address)": FunctionFragment; + "revokeAccess(bytes32,address)": FunctionFragment; "set(uint32[])": FunctionFragment; - "setField(bytes16,bytes16,bytes32[],uint8,bytes,bytes32)": FunctionFragment; "setField(bytes32,bytes32[],uint8,bytes,bytes32)": FunctionFragment; "setRecord(bytes32,bytes32[],bytes,bytes32)": FunctionFragment; - "setRecord(bytes16,bytes16,bytes32[],bytes,bytes32)": FunctionFragment; "stub(uint256)": FunctionFragment; "updateInField(bytes32,bytes32[],uint8,uint256,bytes,bytes32)": FunctionFragment; - "updateInField(bytes16,bytes16,bytes32[],uint8,uint256,bytes,bytes32)": FunctionFragment; }; getFunction( nameOrSignatureOrTopic: | "call" - | "deleteRecord(bytes32,bytes32[],bytes32)" - | "deleteRecord(bytes16,bytes16,bytes32[],bytes32)" - | "emitEphemeralRecord(bytes16,bytes16,bytes32[],bytes,bytes32)" - | "emitEphemeralRecord(bytes32,bytes32[],bytes,bytes32)" + | "deleteRecord" + | "emitEphemeralRecord" | "getField" | "getFieldLength" | "getFieldSlice" @@ -89,70 +77,39 @@ export interface IWorldInterface extends utils.Interface { | "installModule" | "installRootModule" | "pop" - | "popFromField(bytes32,bytes32[],uint8,uint256,bytes32)" - | "popFromField(bytes16,bytes16,bytes32[],uint8,uint256,bytes32)" + | "popFromField" | "push" | "pushRange" - | "pushToField(bytes32,bytes32[],uint8,bytes,bytes32)" - | "pushToField(bytes16,bytes16,bytes32[],uint8,bytes,bytes32)" + | "pushToField" | "registerFunctionSelector" - | "registerHook" | "registerNamespace" | "registerRootFunctionSelector" | "registerStoreHook" | "registerSystem" | "registerSystemHook" - | "registerTable(bytes16,bytes16,bytes32,bytes32,string[],string[])" - | "registerTable(bytes32,bytes32,bytes32,string[],string[])" - | "registerTableHook" + | "registerTable" | "revokeAccess" | "set" - | "setField(bytes16,bytes16,bytes32[],uint8,bytes,bytes32)" - | "setField(bytes32,bytes32[],uint8,bytes,bytes32)" - | "setRecord(bytes32,bytes32[],bytes,bytes32)" - | "setRecord(bytes16,bytes16,bytes32[],bytes,bytes32)" + | "setField" + | "setRecord" | "stub" - | "updateInField(bytes32,bytes32[],uint8,uint256,bytes,bytes32)" - | "updateInField(bytes16,bytes16,bytes32[],uint8,uint256,bytes,bytes32)" + | "updateInField" ): FunctionFragment; encodeFunctionData( functionFragment: "call", - values: [ - PromiseOrValue, - PromiseOrValue, - PromiseOrValue - ] - ): string; - encodeFunctionData( - functionFragment: "deleteRecord(bytes32,bytes32[],bytes32)", - values: [ - PromiseOrValue, - PromiseOrValue[], - PromiseOrValue - ] - ): string; - encodeFunctionData( - functionFragment: "deleteRecord(bytes16,bytes16,bytes32[],bytes32)", - values: [ - PromiseOrValue, - PromiseOrValue, - PromiseOrValue[], - PromiseOrValue - ] + values: [PromiseOrValue, PromiseOrValue] ): string; encodeFunctionData( - functionFragment: "emitEphemeralRecord(bytes16,bytes16,bytes32[],bytes,bytes32)", + functionFragment: "deleteRecord", values: [ - PromiseOrValue, PromiseOrValue, PromiseOrValue[], - PromiseOrValue, PromiseOrValue ] ): string; encodeFunctionData( - functionFragment: "emitEphemeralRecord(bytes32,bytes32[],bytes,bytes32)", + functionFragment: "emitEphemeralRecord", values: [ PromiseOrValue, PromiseOrValue[], @@ -207,11 +164,7 @@ export interface IWorldInterface extends utils.Interface { ): string; encodeFunctionData( functionFragment: "grantAccess", - values: [ - PromiseOrValue, - PromiseOrValue, - PromiseOrValue - ] + values: [PromiseOrValue, PromiseOrValue] ): string; encodeFunctionData( functionFragment: "installModule", @@ -223,19 +176,8 @@ export interface IWorldInterface extends utils.Interface { ): string; encodeFunctionData(functionFragment: "pop", values?: undefined): string; encodeFunctionData( - functionFragment: "popFromField(bytes32,bytes32[],uint8,uint256,bytes32)", - values: [ - PromiseOrValue, - PromiseOrValue[], - PromiseOrValue, - PromiseOrValue, - PromiseOrValue - ] - ): string; - encodeFunctionData( - functionFragment: "popFromField(bytes16,bytes16,bytes32[],uint8,uint256,bytes32)", + functionFragment: "popFromField", values: [ - PromiseOrValue, PromiseOrValue, PromiseOrValue[], PromiseOrValue, @@ -252,19 +194,8 @@ export interface IWorldInterface extends utils.Interface { values: [PromiseOrValue, PromiseOrValue] ): string; encodeFunctionData( - functionFragment: "pushToField(bytes32,bytes32[],uint8,bytes,bytes32)", - values: [ - PromiseOrValue, - PromiseOrValue[], - PromiseOrValue, - PromiseOrValue, - PromiseOrValue - ] - ): string; - encodeFunctionData( - functionFragment: "pushToField(bytes16,bytes16,bytes32[],uint8,bytes,bytes32)", + functionFragment: "pushToField", values: [ - PromiseOrValue, PromiseOrValue, PromiseOrValue[], PromiseOrValue, @@ -275,20 +206,11 @@ export interface IWorldInterface extends utils.Interface { encodeFunctionData( functionFragment: "registerFunctionSelector", values: [ - PromiseOrValue, PromiseOrValue, PromiseOrValue, PromiseOrValue ] ): string; - encodeFunctionData( - functionFragment: "registerHook", - values: [ - PromiseOrValue, - PromiseOrValue, - PromiseOrValue - ] - ): string; encodeFunctionData( functionFragment: "registerNamespace", values: [PromiseOrValue] @@ -296,7 +218,6 @@ export interface IWorldInterface extends utils.Interface { encodeFunctionData( functionFragment: "registerRootFunctionSelector", values: [ - PromiseOrValue, PromiseOrValue, PromiseOrValue, PromiseOrValue @@ -309,7 +230,6 @@ export interface IWorldInterface extends utils.Interface { encodeFunctionData( functionFragment: "registerSystem", values: [ - PromiseOrValue, PromiseOrValue, PromiseOrValue, PromiseOrValue @@ -317,25 +237,10 @@ export interface IWorldInterface extends utils.Interface { ): string; encodeFunctionData( functionFragment: "registerSystemHook", - values: [ - PromiseOrValue, - PromiseOrValue, - PromiseOrValue - ] - ): string; - encodeFunctionData( - functionFragment: "registerTable(bytes16,bytes16,bytes32,bytes32,string[],string[])", - values: [ - PromiseOrValue, - PromiseOrValue, - PromiseOrValue, - PromiseOrValue, - PromiseOrValue[], - PromiseOrValue[] - ] + values: [PromiseOrValue, PromiseOrValue] ): string; encodeFunctionData( - functionFragment: "registerTable(bytes32,bytes32,bytes32,string[],string[])", + functionFragment: "registerTable", values: [ PromiseOrValue, PromiseOrValue, @@ -344,39 +249,16 @@ export interface IWorldInterface extends utils.Interface { PromiseOrValue[] ] ): string; - encodeFunctionData( - functionFragment: "registerTableHook", - values: [ - PromiseOrValue, - PromiseOrValue, - PromiseOrValue - ] - ): string; encodeFunctionData( functionFragment: "revokeAccess", - values: [ - PromiseOrValue, - PromiseOrValue, - PromiseOrValue - ] + values: [PromiseOrValue, PromiseOrValue] ): string; encodeFunctionData( functionFragment: "set", values: [PromiseOrValue[]] ): string; encodeFunctionData( - functionFragment: "setField(bytes16,bytes16,bytes32[],uint8,bytes,bytes32)", - values: [ - PromiseOrValue, - PromiseOrValue, - PromiseOrValue[], - PromiseOrValue, - PromiseOrValue, - PromiseOrValue - ] - ): string; - encodeFunctionData( - functionFragment: "setField(bytes32,bytes32[],uint8,bytes,bytes32)", + functionFragment: "setField", values: [ PromiseOrValue, PromiseOrValue[], @@ -386,18 +268,8 @@ export interface IWorldInterface extends utils.Interface { ] ): string; encodeFunctionData( - functionFragment: "setRecord(bytes32,bytes32[],bytes,bytes32)", - values: [ - PromiseOrValue, - PromiseOrValue[], - PromiseOrValue, - PromiseOrValue - ] - ): string; - encodeFunctionData( - functionFragment: "setRecord(bytes16,bytes16,bytes32[],bytes,bytes32)", + functionFragment: "setRecord", values: [ - PromiseOrValue, PromiseOrValue, PromiseOrValue[], PromiseOrValue, @@ -409,20 +281,8 @@ export interface IWorldInterface extends utils.Interface { values: [PromiseOrValue] ): string; encodeFunctionData( - functionFragment: "updateInField(bytes32,bytes32[],uint8,uint256,bytes,bytes32)", - values: [ - PromiseOrValue, - PromiseOrValue[], - PromiseOrValue, - PromiseOrValue, - PromiseOrValue, - PromiseOrValue - ] - ): string; - encodeFunctionData( - functionFragment: "updateInField(bytes16,bytes16,bytes32[],uint8,uint256,bytes,bytes32)", + functionFragment: "updateInField", values: [ - PromiseOrValue, PromiseOrValue, PromiseOrValue[], PromiseOrValue, @@ -434,19 +294,11 @@ export interface IWorldInterface extends utils.Interface { decodeFunctionResult(functionFragment: "call", data: BytesLike): Result; decodeFunctionResult( - functionFragment: "deleteRecord(bytes32,bytes32[],bytes32)", - data: BytesLike - ): Result; - decodeFunctionResult( - functionFragment: "deleteRecord(bytes16,bytes16,bytes32[],bytes32)", + functionFragment: "deleteRecord", data: BytesLike ): Result; decodeFunctionResult( - functionFragment: "emitEphemeralRecord(bytes16,bytes16,bytes32[],bytes,bytes32)", - data: BytesLike - ): Result; - decodeFunctionResult( - functionFragment: "emitEphemeralRecord(bytes32,bytes32[],bytes,bytes32)", + functionFragment: "emitEphemeralRecord", data: BytesLike ): Result; decodeFunctionResult(functionFragment: "getField", data: BytesLike): Result; @@ -481,31 +333,19 @@ export interface IWorldInterface extends utils.Interface { ): Result; decodeFunctionResult(functionFragment: "pop", data: BytesLike): Result; decodeFunctionResult( - functionFragment: "popFromField(bytes32,bytes32[],uint8,uint256,bytes32)", - data: BytesLike - ): Result; - decodeFunctionResult( - functionFragment: "popFromField(bytes16,bytes16,bytes32[],uint8,uint256,bytes32)", + functionFragment: "popFromField", data: BytesLike ): Result; decodeFunctionResult(functionFragment: "push", data: BytesLike): Result; decodeFunctionResult(functionFragment: "pushRange", data: BytesLike): Result; decodeFunctionResult( - functionFragment: "pushToField(bytes32,bytes32[],uint8,bytes,bytes32)", - data: BytesLike - ): Result; - decodeFunctionResult( - functionFragment: "pushToField(bytes16,bytes16,bytes32[],uint8,bytes,bytes32)", + functionFragment: "pushToField", data: BytesLike ): Result; decodeFunctionResult( functionFragment: "registerFunctionSelector", data: BytesLike ): Result; - decodeFunctionResult( - functionFragment: "registerHook", - data: BytesLike - ): Result; decodeFunctionResult( functionFragment: "registerNamespace", data: BytesLike @@ -527,15 +367,7 @@ export interface IWorldInterface extends utils.Interface { data: BytesLike ): Result; decodeFunctionResult( - functionFragment: "registerTable(bytes16,bytes16,bytes32,bytes32,string[],string[])", - data: BytesLike - ): Result; - decodeFunctionResult( - functionFragment: "registerTable(bytes32,bytes32,bytes32,string[],string[])", - data: BytesLike - ): Result; - decodeFunctionResult( - functionFragment: "registerTableHook", + functionFragment: "registerTable", data: BytesLike ): Result; decodeFunctionResult( @@ -543,29 +375,11 @@ export interface IWorldInterface extends utils.Interface { data: BytesLike ): Result; decodeFunctionResult(functionFragment: "set", data: BytesLike): Result; - decodeFunctionResult( - functionFragment: "setField(bytes16,bytes16,bytes32[],uint8,bytes,bytes32)", - data: BytesLike - ): Result; - decodeFunctionResult( - functionFragment: "setField(bytes32,bytes32[],uint8,bytes,bytes32)", - data: BytesLike - ): Result; - decodeFunctionResult( - functionFragment: "setRecord(bytes32,bytes32[],bytes,bytes32)", - data: BytesLike - ): Result; - decodeFunctionResult( - functionFragment: "setRecord(bytes16,bytes16,bytes32[],bytes,bytes32)", - data: BytesLike - ): Result; + decodeFunctionResult(functionFragment: "setField", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "setRecord", data: BytesLike): Result; decodeFunctionResult(functionFragment: "stub", data: BytesLike): Result; decodeFunctionResult( - functionFragment: "updateInField(bytes32,bytes32[],uint8,uint256,bytes,bytes32)", - data: BytesLike - ): Result; - decodeFunctionResult( - functionFragment: "updateInField(bytes16,bytes16,bytes32[],uint8,uint256,bytes,bytes32)", + functionFragment: "updateInField", data: BytesLike ): Result; @@ -667,37 +481,19 @@ export interface IWorld extends BaseContract { functions: { call( - namespace: PromiseOrValue, - name: PromiseOrValue, + resourceSelector: PromiseOrValue, funcSelectorAndArgs: PromiseOrValue, overrides?: PayableOverrides & { from?: PromiseOrValue } ): Promise; - "deleteRecord(bytes32,bytes32[],bytes32)"( + deleteRecord( table: PromiseOrValue, key: PromiseOrValue[], valueSchema: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - "deleteRecord(bytes16,bytes16,bytes32[],bytes32)"( - namespace: PromiseOrValue, - name: PromiseOrValue, - key: PromiseOrValue[], - valueSchema: PromiseOrValue, - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; - - "emitEphemeralRecord(bytes16,bytes16,bytes32[],bytes,bytes32)"( - namespace: PromiseOrValue, - name: PromiseOrValue, - key: PromiseOrValue[], - data: PromiseOrValue, - valueSchema: PromiseOrValue, - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; - - "emitEphemeralRecord(bytes32,bytes32[],bytes,bytes32)"( + emitEphemeralRecord( table: PromiseOrValue, key: PromiseOrValue[], data: PromiseOrValue, @@ -749,8 +545,7 @@ export interface IWorld extends BaseContract { ): Promise<[string] & { schema: string }>; grantAccess( - namespace: PromiseOrValue, - name: PromiseOrValue, + resourceSelector: PromiseOrValue, grantee: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } ): Promise; @@ -771,7 +566,7 @@ export interface IWorld extends BaseContract { overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - "popFromField(bytes32,bytes32[],uint8,uint256,bytes32)"( + popFromField( table: PromiseOrValue, key: PromiseOrValue[], schemaIndex: PromiseOrValue, @@ -780,16 +575,6 @@ export interface IWorld extends BaseContract { overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - "popFromField(bytes16,bytes16,bytes32[],uint8,uint256,bytes32)"( - namespace: PromiseOrValue, - name: PromiseOrValue, - key: PromiseOrValue[], - schemaIndex: PromiseOrValue, - byteLengthToPop: PromiseOrValue, - valueSchema: PromiseOrValue, - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; - push( num: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } @@ -801,7 +586,7 @@ export interface IWorld extends BaseContract { overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - "pushToField(bytes32,bytes32[],uint8,bytes,bytes32)"( + pushToField( table: PromiseOrValue, key: PromiseOrValue[], schemaIndex: PromiseOrValue, @@ -810,39 +595,20 @@ export interface IWorld extends BaseContract { overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - "pushToField(bytes16,bytes16,bytes32[],uint8,bytes,bytes32)"( - namespace: PromiseOrValue, - name: PromiseOrValue, - key: PromiseOrValue[], - schemaIndex: PromiseOrValue, - dataToPush: PromiseOrValue, - valueSchema: PromiseOrValue, - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; - registerFunctionSelector( - namespace: PromiseOrValue, - name: PromiseOrValue, + resourceSelector: PromiseOrValue, systemFunctionName: PromiseOrValue, systemFunctionArguments: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - registerHook( - namespace: PromiseOrValue, - name: PromiseOrValue, - hook: PromiseOrValue, - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; - registerNamespace( namespace: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } ): Promise; registerRootFunctionSelector( - namespace: PromiseOrValue, - name: PromiseOrValue, + resourceSelector: PromiseOrValue, worldFunctionSelector: PromiseOrValue, systemFunctionSelector: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } @@ -855,31 +621,19 @@ export interface IWorld extends BaseContract { ): Promise; registerSystem( - namespace: PromiseOrValue, - name: PromiseOrValue, + resourceSelector: PromiseOrValue, system: PromiseOrValue, publicAccess: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } ): Promise; registerSystemHook( - namespace: PromiseOrValue, - name: PromiseOrValue, + resourceSelector: PromiseOrValue, hook: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - "registerTable(bytes16,bytes16,bytes32,bytes32,string[],string[])"( - namespace: PromiseOrValue, - name: PromiseOrValue, - keySchema: PromiseOrValue, - valueSchema: PromiseOrValue, - keyNames: PromiseOrValue[], - fieldNames: PromiseOrValue[], - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; - - "registerTable(bytes32,bytes32,bytes32,string[],string[])"( + registerTable( table: PromiseOrValue, keySchema: PromiseOrValue, valueSchema: PromiseOrValue, @@ -888,16 +642,8 @@ export interface IWorld extends BaseContract { overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - registerTableHook( - namespace: PromiseOrValue, - name: PromiseOrValue, - hook: PromiseOrValue, - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; - revokeAccess( - namespace: PromiseOrValue, - name: PromiseOrValue, + resourceSelector: PromiseOrValue, grantee: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } ): Promise; @@ -907,17 +653,7 @@ export interface IWorld extends BaseContract { overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - "setField(bytes16,bytes16,bytes32[],uint8,bytes,bytes32)"( - namespace: PromiseOrValue, - name: PromiseOrValue, - key: PromiseOrValue[], - schemaIndex: PromiseOrValue, - data: PromiseOrValue, - valueSchema: PromiseOrValue, - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; - - "setField(bytes32,bytes32[],uint8,bytes,bytes32)"( + setField( table: PromiseOrValue, key: PromiseOrValue[], schemaIndex: PromiseOrValue, @@ -926,7 +662,7 @@ export interface IWorld extends BaseContract { overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - "setRecord(bytes32,bytes32[],bytes,bytes32)"( + setRecord( table: PromiseOrValue, key: PromiseOrValue[], data: PromiseOrValue, @@ -934,21 +670,12 @@ export interface IWorld extends BaseContract { overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - "setRecord(bytes16,bytes16,bytes32[],bytes,bytes32)"( - namespace: PromiseOrValue, - name: PromiseOrValue, - key: PromiseOrValue[], - data: PromiseOrValue, - valueSchema: PromiseOrValue, - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; - stub( arg: PromiseOrValue, overrides?: CallOverrides ): Promise<[BigNumber]>; - "updateInField(bytes32,bytes32[],uint8,uint256,bytes,bytes32)"( + updateInField( table: PromiseOrValue, key: PromiseOrValue[], schemaIndex: PromiseOrValue, @@ -957,51 +684,22 @@ export interface IWorld extends BaseContract { valueSchema: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - - "updateInField(bytes16,bytes16,bytes32[],uint8,uint256,bytes,bytes32)"( - namespace: PromiseOrValue, - name: PromiseOrValue, - key: PromiseOrValue[], - schemaIndex: PromiseOrValue, - startByteIndex: PromiseOrValue, - dataToSet: PromiseOrValue, - valueSchema: PromiseOrValue, - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; }; call( - namespace: PromiseOrValue, - name: PromiseOrValue, + resourceSelector: PromiseOrValue, funcSelectorAndArgs: PromiseOrValue, overrides?: PayableOverrides & { from?: PromiseOrValue } ): Promise; - "deleteRecord(bytes32,bytes32[],bytes32)"( + deleteRecord( table: PromiseOrValue, key: PromiseOrValue[], valueSchema: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - "deleteRecord(bytes16,bytes16,bytes32[],bytes32)"( - namespace: PromiseOrValue, - name: PromiseOrValue, - key: PromiseOrValue[], - valueSchema: PromiseOrValue, - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; - - "emitEphemeralRecord(bytes16,bytes16,bytes32[],bytes,bytes32)"( - namespace: PromiseOrValue, - name: PromiseOrValue, - key: PromiseOrValue[], - data: PromiseOrValue, - valueSchema: PromiseOrValue, - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; - - "emitEphemeralRecord(bytes32,bytes32[],bytes,bytes32)"( + emitEphemeralRecord( table: PromiseOrValue, key: PromiseOrValue[], data: PromiseOrValue, @@ -1053,8 +751,7 @@ export interface IWorld extends BaseContract { ): Promise; grantAccess( - namespace: PromiseOrValue, - name: PromiseOrValue, + resourceSelector: PromiseOrValue, grantee: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } ): Promise; @@ -1075,7 +772,7 @@ export interface IWorld extends BaseContract { overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - "popFromField(bytes32,bytes32[],uint8,uint256,bytes32)"( + popFromField( table: PromiseOrValue, key: PromiseOrValue[], schemaIndex: PromiseOrValue, @@ -1084,16 +781,6 @@ export interface IWorld extends BaseContract { overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - "popFromField(bytes16,bytes16,bytes32[],uint8,uint256,bytes32)"( - namespace: PromiseOrValue, - name: PromiseOrValue, - key: PromiseOrValue[], - schemaIndex: PromiseOrValue, - byteLengthToPop: PromiseOrValue, - valueSchema: PromiseOrValue, - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; - push( num: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } @@ -1105,7 +792,7 @@ export interface IWorld extends BaseContract { overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - "pushToField(bytes32,bytes32[],uint8,bytes,bytes32)"( + pushToField( table: PromiseOrValue, key: PromiseOrValue[], schemaIndex: PromiseOrValue, @@ -1114,39 +801,20 @@ export interface IWorld extends BaseContract { overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - "pushToField(bytes16,bytes16,bytes32[],uint8,bytes,bytes32)"( - namespace: PromiseOrValue, - name: PromiseOrValue, - key: PromiseOrValue[], - schemaIndex: PromiseOrValue, - dataToPush: PromiseOrValue, - valueSchema: PromiseOrValue, - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; - registerFunctionSelector( - namespace: PromiseOrValue, - name: PromiseOrValue, + resourceSelector: PromiseOrValue, systemFunctionName: PromiseOrValue, systemFunctionArguments: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - registerHook( - namespace: PromiseOrValue, - name: PromiseOrValue, - hook: PromiseOrValue, - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; - registerNamespace( namespace: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } ): Promise; registerRootFunctionSelector( - namespace: PromiseOrValue, - name: PromiseOrValue, + resourceSelector: PromiseOrValue, worldFunctionSelector: PromiseOrValue, systemFunctionSelector: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } @@ -1159,31 +827,19 @@ export interface IWorld extends BaseContract { ): Promise; registerSystem( - namespace: PromiseOrValue, - name: PromiseOrValue, + resourceSelector: PromiseOrValue, system: PromiseOrValue, publicAccess: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } ): Promise; registerSystemHook( - namespace: PromiseOrValue, - name: PromiseOrValue, + resourceSelector: PromiseOrValue, hook: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - "registerTable(bytes16,bytes16,bytes32,bytes32,string[],string[])"( - namespace: PromiseOrValue, - name: PromiseOrValue, - keySchema: PromiseOrValue, - valueSchema: PromiseOrValue, - keyNames: PromiseOrValue[], - fieldNames: PromiseOrValue[], - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; - - "registerTable(bytes32,bytes32,bytes32,string[],string[])"( + registerTable( table: PromiseOrValue, keySchema: PromiseOrValue, valueSchema: PromiseOrValue, @@ -1192,16 +848,8 @@ export interface IWorld extends BaseContract { overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - registerTableHook( - namespace: PromiseOrValue, - name: PromiseOrValue, - hook: PromiseOrValue, - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; - revokeAccess( - namespace: PromiseOrValue, - name: PromiseOrValue, + resourceSelector: PromiseOrValue, grantee: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } ): Promise; @@ -1211,17 +859,7 @@ export interface IWorld extends BaseContract { overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - "setField(bytes16,bytes16,bytes32[],uint8,bytes,bytes32)"( - namespace: PromiseOrValue, - name: PromiseOrValue, - key: PromiseOrValue[], - schemaIndex: PromiseOrValue, - data: PromiseOrValue, - valueSchema: PromiseOrValue, - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; - - "setField(bytes32,bytes32[],uint8,bytes,bytes32)"( + setField( table: PromiseOrValue, key: PromiseOrValue[], schemaIndex: PromiseOrValue, @@ -1230,7 +868,7 @@ export interface IWorld extends BaseContract { overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - "setRecord(bytes32,bytes32[],bytes,bytes32)"( + setRecord( table: PromiseOrValue, key: PromiseOrValue[], data: PromiseOrValue, @@ -1238,21 +876,12 @@ export interface IWorld extends BaseContract { overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - "setRecord(bytes16,bytes16,bytes32[],bytes,bytes32)"( - namespace: PromiseOrValue, - name: PromiseOrValue, - key: PromiseOrValue[], - data: PromiseOrValue, - valueSchema: PromiseOrValue, - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; - stub( arg: PromiseOrValue, overrides?: CallOverrides ): Promise; - "updateInField(bytes32,bytes32[],uint8,uint256,bytes,bytes32)"( + updateInField( table: PromiseOrValue, key: PromiseOrValue[], schemaIndex: PromiseOrValue, @@ -1262,50 +891,21 @@ export interface IWorld extends BaseContract { overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - "updateInField(bytes16,bytes16,bytes32[],uint8,uint256,bytes,bytes32)"( - namespace: PromiseOrValue, - name: PromiseOrValue, - key: PromiseOrValue[], - schemaIndex: PromiseOrValue, - startByteIndex: PromiseOrValue, - dataToSet: PromiseOrValue, - valueSchema: PromiseOrValue, - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; - callStatic: { call( - namespace: PromiseOrValue, - name: PromiseOrValue, + resourceSelector: PromiseOrValue, funcSelectorAndArgs: PromiseOrValue, overrides?: CallOverrides ): Promise; - "deleteRecord(bytes32,bytes32[],bytes32)"( + deleteRecord( table: PromiseOrValue, key: PromiseOrValue[], valueSchema: PromiseOrValue, overrides?: CallOverrides ): Promise; - "deleteRecord(bytes16,bytes16,bytes32[],bytes32)"( - namespace: PromiseOrValue, - name: PromiseOrValue, - key: PromiseOrValue[], - valueSchema: PromiseOrValue, - overrides?: CallOverrides - ): Promise; - - "emitEphemeralRecord(bytes16,bytes16,bytes32[],bytes,bytes32)"( - namespace: PromiseOrValue, - name: PromiseOrValue, - key: PromiseOrValue[], - data: PromiseOrValue, - valueSchema: PromiseOrValue, - overrides?: CallOverrides - ): Promise; - - "emitEphemeralRecord(bytes32,bytes32[],bytes,bytes32)"( + emitEphemeralRecord( table: PromiseOrValue, key: PromiseOrValue[], data: PromiseOrValue, @@ -1357,8 +957,7 @@ export interface IWorld extends BaseContract { ): Promise; grantAccess( - namespace: PromiseOrValue, - name: PromiseOrValue, + resourceSelector: PromiseOrValue, grantee: PromiseOrValue, overrides?: CallOverrides ): Promise; @@ -1377,7 +976,7 @@ export interface IWorld extends BaseContract { pop(overrides?: CallOverrides): Promise; - "popFromField(bytes32,bytes32[],uint8,uint256,bytes32)"( + popFromField( table: PromiseOrValue, key: PromiseOrValue[], schemaIndex: PromiseOrValue, @@ -1386,16 +985,6 @@ export interface IWorld extends BaseContract { overrides?: CallOverrides ): Promise; - "popFromField(bytes16,bytes16,bytes32[],uint8,uint256,bytes32)"( - namespace: PromiseOrValue, - name: PromiseOrValue, - key: PromiseOrValue[], - schemaIndex: PromiseOrValue, - byteLengthToPop: PromiseOrValue, - valueSchema: PromiseOrValue, - overrides?: CallOverrides - ): Promise; - push( num: PromiseOrValue, overrides?: CallOverrides @@ -1407,7 +996,7 @@ export interface IWorld extends BaseContract { overrides?: CallOverrides ): Promise; - "pushToField(bytes32,bytes32[],uint8,bytes,bytes32)"( + pushToField( table: PromiseOrValue, key: PromiseOrValue[], schemaIndex: PromiseOrValue, @@ -1416,39 +1005,20 @@ export interface IWorld extends BaseContract { overrides?: CallOverrides ): Promise; - "pushToField(bytes16,bytes16,bytes32[],uint8,bytes,bytes32)"( - namespace: PromiseOrValue, - name: PromiseOrValue, - key: PromiseOrValue[], - schemaIndex: PromiseOrValue, - dataToPush: PromiseOrValue, - valueSchema: PromiseOrValue, - overrides?: CallOverrides - ): Promise; - registerFunctionSelector( - namespace: PromiseOrValue, - name: PromiseOrValue, + resourceSelector: PromiseOrValue, systemFunctionName: PromiseOrValue, systemFunctionArguments: PromiseOrValue, overrides?: CallOverrides ): Promise; - registerHook( - namespace: PromiseOrValue, - name: PromiseOrValue, - hook: PromiseOrValue, - overrides?: CallOverrides - ): Promise; - registerNamespace( namespace: PromiseOrValue, overrides?: CallOverrides ): Promise; registerRootFunctionSelector( - namespace: PromiseOrValue, - name: PromiseOrValue, + resourceSelector: PromiseOrValue, worldFunctionSelector: PromiseOrValue, systemFunctionSelector: PromiseOrValue, overrides?: CallOverrides @@ -1461,31 +1031,19 @@ export interface IWorld extends BaseContract { ): Promise; registerSystem( - namespace: PromiseOrValue, - name: PromiseOrValue, + resourceSelector: PromiseOrValue, system: PromiseOrValue, publicAccess: PromiseOrValue, overrides?: CallOverrides - ): Promise; + ): Promise; registerSystemHook( - namespace: PromiseOrValue, - name: PromiseOrValue, + resourceSelector: PromiseOrValue, hook: PromiseOrValue, overrides?: CallOverrides ): Promise; - "registerTable(bytes16,bytes16,bytes32,bytes32,string[],string[])"( - namespace: PromiseOrValue, - name: PromiseOrValue, - keySchema: PromiseOrValue, - valueSchema: PromiseOrValue, - keyNames: PromiseOrValue[], - fieldNames: PromiseOrValue[], - overrides?: CallOverrides - ): Promise; - - "registerTable(bytes32,bytes32,bytes32,string[],string[])"( + registerTable( table: PromiseOrValue, keySchema: PromiseOrValue, valueSchema: PromiseOrValue, @@ -1494,16 +1052,8 @@ export interface IWorld extends BaseContract { overrides?: CallOverrides ): Promise; - registerTableHook( - namespace: PromiseOrValue, - name: PromiseOrValue, - hook: PromiseOrValue, - overrides?: CallOverrides - ): Promise; - revokeAccess( - namespace: PromiseOrValue, - name: PromiseOrValue, + resourceSelector: PromiseOrValue, grantee: PromiseOrValue, overrides?: CallOverrides ): Promise; @@ -1513,17 +1063,7 @@ export interface IWorld extends BaseContract { overrides?: CallOverrides ): Promise; - "setField(bytes16,bytes16,bytes32[],uint8,bytes,bytes32)"( - namespace: PromiseOrValue, - name: PromiseOrValue, - key: PromiseOrValue[], - schemaIndex: PromiseOrValue, - data: PromiseOrValue, - valueSchema: PromiseOrValue, - overrides?: CallOverrides - ): Promise; - - "setField(bytes32,bytes32[],uint8,bytes,bytes32)"( + setField( table: PromiseOrValue, key: PromiseOrValue[], schemaIndex: PromiseOrValue, @@ -1532,7 +1072,7 @@ export interface IWorld extends BaseContract { overrides?: CallOverrides ): Promise; - "setRecord(bytes32,bytes32[],bytes,bytes32)"( + setRecord( table: PromiseOrValue, key: PromiseOrValue[], data: PromiseOrValue, @@ -1540,21 +1080,12 @@ export interface IWorld extends BaseContract { overrides?: CallOverrides ): Promise; - "setRecord(bytes16,bytes16,bytes32[],bytes,bytes32)"( - namespace: PromiseOrValue, - name: PromiseOrValue, - key: PromiseOrValue[], - data: PromiseOrValue, - valueSchema: PromiseOrValue, - overrides?: CallOverrides - ): Promise; - stub( arg: PromiseOrValue, overrides?: CallOverrides ): Promise; - "updateInField(bytes32,bytes32[],uint8,uint256,bytes,bytes32)"( + updateInField( table: PromiseOrValue, key: PromiseOrValue[], schemaIndex: PromiseOrValue, @@ -1563,17 +1094,6 @@ export interface IWorld extends BaseContract { valueSchema: PromiseOrValue, overrides?: CallOverrides ): Promise; - - "updateInField(bytes16,bytes16,bytes32[],uint8,uint256,bytes,bytes32)"( - namespace: PromiseOrValue, - name: PromiseOrValue, - key: PromiseOrValue[], - schemaIndex: PromiseOrValue, - startByteIndex: PromiseOrValue, - dataToSet: PromiseOrValue, - valueSchema: PromiseOrValue, - overrides?: CallOverrides - ): Promise; }; filters: { @@ -1624,37 +1144,19 @@ export interface IWorld extends BaseContract { estimateGas: { call( - namespace: PromiseOrValue, - name: PromiseOrValue, + resourceSelector: PromiseOrValue, funcSelectorAndArgs: PromiseOrValue, overrides?: PayableOverrides & { from?: PromiseOrValue } ): Promise; - "deleteRecord(bytes32,bytes32[],bytes32)"( + deleteRecord( table: PromiseOrValue, key: PromiseOrValue[], valueSchema: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - "deleteRecord(bytes16,bytes16,bytes32[],bytes32)"( - namespace: PromiseOrValue, - name: PromiseOrValue, - key: PromiseOrValue[], - valueSchema: PromiseOrValue, - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; - - "emitEphemeralRecord(bytes16,bytes16,bytes32[],bytes,bytes32)"( - namespace: PromiseOrValue, - name: PromiseOrValue, - key: PromiseOrValue[], - data: PromiseOrValue, - valueSchema: PromiseOrValue, - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; - - "emitEphemeralRecord(bytes32,bytes32[],bytes,bytes32)"( + emitEphemeralRecord( table: PromiseOrValue, key: PromiseOrValue[], data: PromiseOrValue, @@ -1706,8 +1208,7 @@ export interface IWorld extends BaseContract { ): Promise; grantAccess( - namespace: PromiseOrValue, - name: PromiseOrValue, + resourceSelector: PromiseOrValue, grantee: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } ): Promise; @@ -1728,7 +1229,7 @@ export interface IWorld extends BaseContract { overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - "popFromField(bytes32,bytes32[],uint8,uint256,bytes32)"( + popFromField( table: PromiseOrValue, key: PromiseOrValue[], schemaIndex: PromiseOrValue, @@ -1737,16 +1238,6 @@ export interface IWorld extends BaseContract { overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - "popFromField(bytes16,bytes16,bytes32[],uint8,uint256,bytes32)"( - namespace: PromiseOrValue, - name: PromiseOrValue, - key: PromiseOrValue[], - schemaIndex: PromiseOrValue, - byteLengthToPop: PromiseOrValue, - valueSchema: PromiseOrValue, - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; - push( num: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } @@ -1758,7 +1249,7 @@ export interface IWorld extends BaseContract { overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - "pushToField(bytes32,bytes32[],uint8,bytes,bytes32)"( + pushToField( table: PromiseOrValue, key: PromiseOrValue[], schemaIndex: PromiseOrValue, @@ -1767,39 +1258,20 @@ export interface IWorld extends BaseContract { overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - "pushToField(bytes16,bytes16,bytes32[],uint8,bytes,bytes32)"( - namespace: PromiseOrValue, - name: PromiseOrValue, - key: PromiseOrValue[], - schemaIndex: PromiseOrValue, - dataToPush: PromiseOrValue, - valueSchema: PromiseOrValue, - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; - registerFunctionSelector( - namespace: PromiseOrValue, - name: PromiseOrValue, + resourceSelector: PromiseOrValue, systemFunctionName: PromiseOrValue, systemFunctionArguments: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - registerHook( - namespace: PromiseOrValue, - name: PromiseOrValue, - hook: PromiseOrValue, - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; - registerNamespace( namespace: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } ): Promise; registerRootFunctionSelector( - namespace: PromiseOrValue, - name: PromiseOrValue, + resourceSelector: PromiseOrValue, worldFunctionSelector: PromiseOrValue, systemFunctionSelector: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } @@ -1812,31 +1284,19 @@ export interface IWorld extends BaseContract { ): Promise; registerSystem( - namespace: PromiseOrValue, - name: PromiseOrValue, + resourceSelector: PromiseOrValue, system: PromiseOrValue, publicAccess: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } ): Promise; registerSystemHook( - namespace: PromiseOrValue, - name: PromiseOrValue, + resourceSelector: PromiseOrValue, hook: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - "registerTable(bytes16,bytes16,bytes32,bytes32,string[],string[])"( - namespace: PromiseOrValue, - name: PromiseOrValue, - keySchema: PromiseOrValue, - valueSchema: PromiseOrValue, - keyNames: PromiseOrValue[], - fieldNames: PromiseOrValue[], - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; - - "registerTable(bytes32,bytes32,bytes32,string[],string[])"( + registerTable( table: PromiseOrValue, keySchema: PromiseOrValue, valueSchema: PromiseOrValue, @@ -1845,16 +1305,8 @@ export interface IWorld extends BaseContract { overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - registerTableHook( - namespace: PromiseOrValue, - name: PromiseOrValue, - hook: PromiseOrValue, - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; - revokeAccess( - namespace: PromiseOrValue, - name: PromiseOrValue, + resourceSelector: PromiseOrValue, grantee: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } ): Promise; @@ -1864,17 +1316,7 @@ export interface IWorld extends BaseContract { overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - "setField(bytes16,bytes16,bytes32[],uint8,bytes,bytes32)"( - namespace: PromiseOrValue, - name: PromiseOrValue, - key: PromiseOrValue[], - schemaIndex: PromiseOrValue, - data: PromiseOrValue, - valueSchema: PromiseOrValue, - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; - - "setField(bytes32,bytes32[],uint8,bytes,bytes32)"( + setField( table: PromiseOrValue, key: PromiseOrValue[], schemaIndex: PromiseOrValue, @@ -1883,7 +1325,7 @@ export interface IWorld extends BaseContract { overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - "setRecord(bytes32,bytes32[],bytes,bytes32)"( + setRecord( table: PromiseOrValue, key: PromiseOrValue[], data: PromiseOrValue, @@ -1891,21 +1333,12 @@ export interface IWorld extends BaseContract { overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - "setRecord(bytes16,bytes16,bytes32[],bytes,bytes32)"( - namespace: PromiseOrValue, - name: PromiseOrValue, - key: PromiseOrValue[], - data: PromiseOrValue, - valueSchema: PromiseOrValue, - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; - stub( arg: PromiseOrValue, overrides?: CallOverrides ): Promise; - "updateInField(bytes32,bytes32[],uint8,uint256,bytes,bytes32)"( + updateInField( table: PromiseOrValue, key: PromiseOrValue[], schemaIndex: PromiseOrValue, @@ -1914,52 +1347,23 @@ export interface IWorld extends BaseContract { valueSchema: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - - "updateInField(bytes16,bytes16,bytes32[],uint8,uint256,bytes,bytes32)"( - namespace: PromiseOrValue, - name: PromiseOrValue, - key: PromiseOrValue[], - schemaIndex: PromiseOrValue, - startByteIndex: PromiseOrValue, - dataToSet: PromiseOrValue, - valueSchema: PromiseOrValue, - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; }; populateTransaction: { call( - namespace: PromiseOrValue, - name: PromiseOrValue, + resourceSelector: PromiseOrValue, funcSelectorAndArgs: PromiseOrValue, overrides?: PayableOverrides & { from?: PromiseOrValue } ): Promise; - "deleteRecord(bytes32,bytes32[],bytes32)"( + deleteRecord( table: PromiseOrValue, key: PromiseOrValue[], valueSchema: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - "deleteRecord(bytes16,bytes16,bytes32[],bytes32)"( - namespace: PromiseOrValue, - name: PromiseOrValue, - key: PromiseOrValue[], - valueSchema: PromiseOrValue, - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; - - "emitEphemeralRecord(bytes16,bytes16,bytes32[],bytes,bytes32)"( - namespace: PromiseOrValue, - name: PromiseOrValue, - key: PromiseOrValue[], - data: PromiseOrValue, - valueSchema: PromiseOrValue, - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; - - "emitEphemeralRecord(bytes32,bytes32[],bytes,bytes32)"( + emitEphemeralRecord( table: PromiseOrValue, key: PromiseOrValue[], data: PromiseOrValue, @@ -2011,8 +1415,7 @@ export interface IWorld extends BaseContract { ): Promise; grantAccess( - namespace: PromiseOrValue, - name: PromiseOrValue, + resourceSelector: PromiseOrValue, grantee: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } ): Promise; @@ -2033,7 +1436,7 @@ export interface IWorld extends BaseContract { overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - "popFromField(bytes32,bytes32[],uint8,uint256,bytes32)"( + popFromField( table: PromiseOrValue, key: PromiseOrValue[], schemaIndex: PromiseOrValue, @@ -2042,16 +1445,6 @@ export interface IWorld extends BaseContract { overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - "popFromField(bytes16,bytes16,bytes32[],uint8,uint256,bytes32)"( - namespace: PromiseOrValue, - name: PromiseOrValue, - key: PromiseOrValue[], - schemaIndex: PromiseOrValue, - byteLengthToPop: PromiseOrValue, - valueSchema: PromiseOrValue, - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; - push( num: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } @@ -2063,7 +1456,7 @@ export interface IWorld extends BaseContract { overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - "pushToField(bytes32,bytes32[],uint8,bytes,bytes32)"( + pushToField( table: PromiseOrValue, key: PromiseOrValue[], schemaIndex: PromiseOrValue, @@ -2072,39 +1465,20 @@ export interface IWorld extends BaseContract { overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - "pushToField(bytes16,bytes16,bytes32[],uint8,bytes,bytes32)"( - namespace: PromiseOrValue, - name: PromiseOrValue, - key: PromiseOrValue[], - schemaIndex: PromiseOrValue, - dataToPush: PromiseOrValue, - valueSchema: PromiseOrValue, - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; - registerFunctionSelector( - namespace: PromiseOrValue, - name: PromiseOrValue, + resourceSelector: PromiseOrValue, systemFunctionName: PromiseOrValue, systemFunctionArguments: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - registerHook( - namespace: PromiseOrValue, - name: PromiseOrValue, - hook: PromiseOrValue, - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; - registerNamespace( namespace: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } ): Promise; registerRootFunctionSelector( - namespace: PromiseOrValue, - name: PromiseOrValue, + resourceSelector: PromiseOrValue, worldFunctionSelector: PromiseOrValue, systemFunctionSelector: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } @@ -2117,31 +1491,19 @@ export interface IWorld extends BaseContract { ): Promise; registerSystem( - namespace: PromiseOrValue, - name: PromiseOrValue, + resourceSelector: PromiseOrValue, system: PromiseOrValue, publicAccess: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } ): Promise; registerSystemHook( - namespace: PromiseOrValue, - name: PromiseOrValue, + resourceSelector: PromiseOrValue, hook: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - "registerTable(bytes16,bytes16,bytes32,bytes32,string[],string[])"( - namespace: PromiseOrValue, - name: PromiseOrValue, - keySchema: PromiseOrValue, - valueSchema: PromiseOrValue, - keyNames: PromiseOrValue[], - fieldNames: PromiseOrValue[], - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; - - "registerTable(bytes32,bytes32,bytes32,string[],string[])"( + registerTable( table: PromiseOrValue, keySchema: PromiseOrValue, valueSchema: PromiseOrValue, @@ -2150,16 +1512,8 @@ export interface IWorld extends BaseContract { overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - registerTableHook( - namespace: PromiseOrValue, - name: PromiseOrValue, - hook: PromiseOrValue, - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; - revokeAccess( - namespace: PromiseOrValue, - name: PromiseOrValue, + resourceSelector: PromiseOrValue, grantee: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } ): Promise; @@ -2169,17 +1523,7 @@ export interface IWorld extends BaseContract { overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - "setField(bytes16,bytes16,bytes32[],uint8,bytes,bytes32)"( - namespace: PromiseOrValue, - name: PromiseOrValue, - key: PromiseOrValue[], - schemaIndex: PromiseOrValue, - data: PromiseOrValue, - valueSchema: PromiseOrValue, - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; - - "setField(bytes32,bytes32[],uint8,bytes,bytes32)"( + setField( table: PromiseOrValue, key: PromiseOrValue[], schemaIndex: PromiseOrValue, @@ -2188,7 +1532,7 @@ export interface IWorld extends BaseContract { overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - "setRecord(bytes32,bytes32[],bytes,bytes32)"( + setRecord( table: PromiseOrValue, key: PromiseOrValue[], data: PromiseOrValue, @@ -2196,21 +1540,12 @@ export interface IWorld extends BaseContract { overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - "setRecord(bytes16,bytes16,bytes32[],bytes,bytes32)"( - namespace: PromiseOrValue, - name: PromiseOrValue, - key: PromiseOrValue[], - data: PromiseOrValue, - valueSchema: PromiseOrValue, - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; - stub( arg: PromiseOrValue, overrides?: CallOverrides ): Promise; - "updateInField(bytes32,bytes32[],uint8,uint256,bytes,bytes32)"( + updateInField( table: PromiseOrValue, key: PromiseOrValue[], schemaIndex: PromiseOrValue, @@ -2219,16 +1554,5 @@ export interface IWorld extends BaseContract { valueSchema: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - - "updateInField(bytes16,bytes16,bytes32[],uint8,uint256,bytes,bytes32)"( - namespace: PromiseOrValue, - name: PromiseOrValue, - key: PromiseOrValue[], - schemaIndex: PromiseOrValue, - startByteIndex: PromiseOrValue, - dataToSet: PromiseOrValue, - valueSchema: PromiseOrValue, - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; }; } diff --git a/e2e/packages/contracts/types/ethers-contracts/factories/IWorld__factory.ts b/e2e/packages/contracts/types/ethers-contracts/factories/IWorld__factory.ts index 238458566a..9fd58269ee 100644 --- a/e2e/packages/contracts/types/ethers-contracts/factories/IWorld__factory.ts +++ b/e2e/packages/contracts/types/ethers-contracts/factories/IWorld__factory.ts @@ -358,14 +358,9 @@ const _abi = [ { inputs: [ { - internalType: "bytes16", - name: "namespace", - type: "bytes16", - }, - { - internalType: "bytes16", - name: "name", - type: "bytes16", + internalType: "bytes32", + name: "resourceSelector", + type: "bytes32", }, { internalType: "bytes", @@ -407,67 +402,6 @@ const _abi = [ stateMutability: "nonpayable", type: "function", }, - { - inputs: [ - { - internalType: "bytes16", - name: "namespace", - type: "bytes16", - }, - { - internalType: "bytes16", - name: "name", - type: "bytes16", - }, - { - internalType: "bytes32[]", - name: "key", - type: "bytes32[]", - }, - { - internalType: "Schema", - name: "valueSchema", - type: "bytes32", - }, - ], - name: "deleteRecord", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "bytes16", - name: "namespace", - type: "bytes16", - }, - { - internalType: "bytes16", - name: "name", - type: "bytes16", - }, - { - internalType: "bytes32[]", - name: "key", - type: "bytes32[]", - }, - { - internalType: "bytes", - name: "data", - type: "bytes", - }, - { - internalType: "Schema", - name: "valueSchema", - type: "bytes32", - }, - ], - name: "emitEphemeralRecord", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, { inputs: [ { @@ -678,14 +612,9 @@ const _abi = [ { inputs: [ { - internalType: "bytes16", - name: "namespace", - type: "bytes16", - }, - { - internalType: "bytes16", - name: "name", - type: "bytes16", + internalType: "bytes32", + name: "resourceSelector", + type: "bytes32", }, { internalType: "address", @@ -774,44 +703,6 @@ const _abi = [ stateMutability: "nonpayable", type: "function", }, - { - inputs: [ - { - internalType: "bytes16", - name: "namespace", - type: "bytes16", - }, - { - internalType: "bytes16", - name: "name", - type: "bytes16", - }, - { - internalType: "bytes32[]", - name: "key", - type: "bytes32[]", - }, - { - internalType: "uint8", - name: "schemaIndex", - type: "uint8", - }, - { - internalType: "uint256", - name: "byteLengthToPop", - type: "uint256", - }, - { - internalType: "Schema", - name: "valueSchema", - type: "bytes32", - }, - ], - name: "popFromField", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, { inputs: [ { @@ -879,53 +770,10 @@ const _abi = [ { inputs: [ { - internalType: "bytes16", - name: "namespace", - type: "bytes16", - }, - { - internalType: "bytes16", - name: "name", - type: "bytes16", - }, - { - internalType: "bytes32[]", - name: "key", - type: "bytes32[]", - }, - { - internalType: "uint8", - name: "schemaIndex", - type: "uint8", - }, - { - internalType: "bytes", - name: "dataToPush", - type: "bytes", - }, - { - internalType: "Schema", - name: "valueSchema", + internalType: "bytes32", + name: "resourceSelector", type: "bytes32", }, - ], - name: "pushToField", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "bytes16", - name: "namespace", - type: "bytes16", - }, - { - internalType: "bytes16", - name: "name", - type: "bytes16", - }, { internalType: "string", name: "systemFunctionName", @@ -948,29 +796,6 @@ const _abi = [ stateMutability: "nonpayable", type: "function", }, - { - inputs: [ - { - internalType: "bytes16", - name: "namespace", - type: "bytes16", - }, - { - internalType: "bytes16", - name: "name", - type: "bytes16", - }, - { - internalType: "address", - name: "hook", - type: "address", - }, - ], - name: "registerHook", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, { inputs: [ { @@ -987,14 +812,9 @@ const _abi = [ { inputs: [ { - internalType: "bytes16", - name: "namespace", - type: "bytes16", - }, - { - internalType: "bytes16", - name: "name", - type: "bytes16", + internalType: "bytes32", + name: "resourceSelector", + type: "bytes32", }, { internalType: "bytes4", @@ -1039,14 +859,9 @@ const _abi = [ { inputs: [ { - internalType: "bytes16", - name: "namespace", - type: "bytes16", - }, - { - internalType: "bytes16", - name: "name", - type: "bytes16", + internalType: "bytes32", + name: "resourceSelector", + type: "bytes32", }, { internalType: "contract System", @@ -1060,27 +875,16 @@ const _abi = [ }, ], name: "registerSystem", - outputs: [ - { - internalType: "bytes32", - name: "resourceSelector", - type: "bytes32", - }, - ], + outputs: [], stateMutability: "nonpayable", type: "function", }, { inputs: [ { - internalType: "bytes16", - name: "namespace", - type: "bytes16", - }, - { - internalType: "bytes16", - name: "name", - type: "bytes16", + internalType: "bytes32", + name: "resourceSelector", + type: "bytes32", }, { internalType: "contract ISystemHook", @@ -1093,50 +897,6 @@ const _abi = [ stateMutability: "nonpayable", type: "function", }, - { - inputs: [ - { - internalType: "bytes16", - name: "namespace", - type: "bytes16", - }, - { - internalType: "bytes16", - name: "name", - type: "bytes16", - }, - { - internalType: "Schema", - name: "keySchema", - type: "bytes32", - }, - { - internalType: "Schema", - name: "valueSchema", - type: "bytes32", - }, - { - internalType: "string[]", - name: "keyNames", - type: "string[]", - }, - { - internalType: "string[]", - name: "fieldNames", - type: "string[]", - }, - ], - name: "registerTable", - outputs: [ - { - internalType: "bytes32", - name: "resourceSelector", - type: "bytes32", - }, - ], - stateMutability: "nonpayable", - type: "function", - }, { inputs: [ { @@ -1173,37 +933,9 @@ const _abi = [ { inputs: [ { - internalType: "bytes16", - name: "namespace", - type: "bytes16", - }, - { - internalType: "bytes16", - name: "name", - type: "bytes16", - }, - { - internalType: "contract IStoreHook", - name: "hook", - type: "address", - }, - ], - name: "registerTableHook", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "bytes16", - name: "namespace", - type: "bytes16", - }, - { - internalType: "bytes16", - name: "name", - type: "bytes16", + internalType: "bytes32", + name: "resourceSelector", + type: "bytes32", }, { internalType: "address", @@ -1229,44 +961,6 @@ const _abi = [ stateMutability: "nonpayable", type: "function", }, - { - inputs: [ - { - internalType: "bytes16", - name: "namespace", - type: "bytes16", - }, - { - internalType: "bytes16", - name: "name", - type: "bytes16", - }, - { - internalType: "bytes32[]", - name: "key", - type: "bytes32[]", - }, - { - internalType: "uint8", - name: "schemaIndex", - type: "uint8", - }, - { - internalType: "bytes", - name: "data", - type: "bytes", - }, - { - internalType: "Schema", - name: "valueSchema", - type: "bytes32", - }, - ], - name: "setField", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, { inputs: [ { @@ -1328,39 +1022,6 @@ const _abi = [ stateMutability: "nonpayable", type: "function", }, - { - inputs: [ - { - internalType: "bytes16", - name: "namespace", - type: "bytes16", - }, - { - internalType: "bytes16", - name: "name", - type: "bytes16", - }, - { - internalType: "bytes32[]", - name: "key", - type: "bytes32[]", - }, - { - internalType: "bytes", - name: "data", - type: "bytes", - }, - { - internalType: "Schema", - name: "valueSchema", - type: "bytes32", - }, - ], - name: "setRecord", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, { inputs: [ { @@ -1418,49 +1079,6 @@ const _abi = [ stateMutability: "nonpayable", type: "function", }, - { - inputs: [ - { - internalType: "bytes16", - name: "namespace", - type: "bytes16", - }, - { - internalType: "bytes16", - name: "name", - type: "bytes16", - }, - { - internalType: "bytes32[]", - name: "key", - type: "bytes32[]", - }, - { - internalType: "uint8", - name: "schemaIndex", - type: "uint8", - }, - { - internalType: "uint256", - name: "startByteIndex", - type: "uint256", - }, - { - internalType: "bytes", - name: "dataToSet", - type: "bytes", - }, - { - internalType: "Schema", - name: "valueSchema", - type: "bytes32", - }, - ], - name: "updateInField", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, ] as const; export class IWorld__factory { diff --git a/e2e/packages/contracts/worlds.json b/e2e/packages/contracts/worlds.json index 7f54955b0d..caf66719c4 100644 --- a/e2e/packages/contracts/worlds.json +++ b/e2e/packages/contracts/worlds.json @@ -1,5 +1,5 @@ { "31337": { - "address": "0xD84379CEae14AA33C123Af12424A37803F885889" + "address": "0xAA292E8611aDF267e563f334Ee42320aC96D0463" } } \ No newline at end of file diff --git a/e2e/packages/sync-test/data/setContractData.ts b/e2e/packages/sync-test/data/setContractData.ts index 160a7ae114..5ca090cae8 100644 --- a/e2e/packages/sync-test/data/setContractData.ts +++ b/e2e/packages/sync-test/data/setContractData.ts @@ -2,8 +2,7 @@ import { Page } from "@playwright/test"; import { Data } from "./types"; import { encodeTestData } from "./encodeTestData"; import { callWorld } from "./callWorld"; -import { stringToBytes16 } from "@latticexyz/utils"; -import { toHex } from "viem"; +import { tableIdToHex } from "@latticexyz/common"; /** * Writes contract data by calling `world.setRecord` via the client @@ -15,8 +14,7 @@ export async function setContractData(page: Page, data: Data) { for (const record of records) { const promise = await callWorld(page, "setRecord", [ // TODO: add support for multiple namespaces after https://github.com/latticexyz/mud/issues/994 is resolved - toHex(stringToBytes16("")), - toHex(stringToBytes16(table)), + tableIdToHex("", table), record.key, record.value, record.valueSchema, diff --git a/e2e/packages/sync-test/package.json b/e2e/packages/sync-test/package.json index 4f06547347..f17ad472bc 100644 --- a/e2e/packages/sync-test/package.json +++ b/e2e/packages/sync-test/package.json @@ -8,6 +8,7 @@ }, "devDependencies": { "@latticexyz/cli": "link:../../../packages/cli", + "@latticexyz/common": "link:../../../packages/common", "@latticexyz/protocol-parser": "link:../../../packages/protocol-parser", "@latticexyz/recs": "link:../../../packages/recs", "@latticexyz/schema-type": "link:../../../packages/schema-type", diff --git a/e2e/pnpm-lock.yaml b/e2e/pnpm-lock.yaml index 4d413dc374..0a2ba0fbab 100644 --- a/e2e/pnpm-lock.yaml +++ b/e2e/pnpm-lock.yaml @@ -144,6 +144,9 @@ importers: '@latticexyz/cli': specifier: link:../../../packages/cli version: link:../../../packages/cli + '@latticexyz/common': + specifier: link:../../../packages/common + version: link:../../../packages/common '@latticexyz/protocol-parser': specifier: link:../../../packages/protocol-parser version: link:../../../packages/protocol-parser diff --git a/examples/minimal/packages/contracts/script/PostDeploy.s.sol b/examples/minimal/packages/contracts/script/PostDeploy.s.sol index 10ab5bf924..d540e882e2 100644 --- a/examples/minimal/packages/contracts/script/PostDeploy.s.sol +++ b/examples/minimal/packages/contracts/script/PostDeploy.s.sol @@ -19,14 +19,18 @@ contract PostDeploy is Script { // Manually deploy a system with another namespace ChatNamespacedSystem chatNamespacedSystem = new ChatNamespacedSystem(); - IWorld(worldAddress).registerSystem("namespace", "ChatNamespaced", chatNamespacedSystem, true); - IWorld(worldAddress).registerFunctionSelector("namespace", "ChatNamespaced", "sendMessage", "(string)"); - // Grant this system access to MessageTable - IWorld(worldAddress).grantAccess( - ResourceSelector.getNamespace(MessageTableTableId), - ResourceSelector.getName(MessageTableTableId), - address(chatNamespacedSystem) + IWorld(worldAddress).registerSystem( + ResourceSelector.from("namespace", "ChatNamespaced"), + chatNamespacedSystem, + true + ); + IWorld(worldAddress).registerFunctionSelector( + ResourceSelector.from("namespace", "ChatNamespaced"), + "sendMessage", + "(string)" ); + // Grant this system access to MessageTable + IWorld(worldAddress).grantAccess(MessageTableTableId, address(chatNamespacedSystem)); // ------------------ EXAMPLES ------------------ diff --git a/examples/minimal/packages/contracts/types/ethers-contracts/IWorld.ts b/examples/minimal/packages/contracts/types/ethers-contracts/IWorld.ts index a66dde03e0..f717810764 100644 --- a/examples/minimal/packages/contracts/types/ethers-contracts/IWorld.ts +++ b/examples/minimal/packages/contracts/types/ethers-contracts/IWorld.ts @@ -38,12 +38,10 @@ export type StringStructStructOutput = [string] & { value: string }; export interface IWorldInterface extends utils.Interface { functions: { - "call(bytes16,bytes16,bytes)": FunctionFragment; + "call(bytes32,bytes)": FunctionFragment; "deleteRecord(bytes32,bytes32[],bytes32)": FunctionFragment; - "deleteRecord(bytes16,bytes16,bytes32[],bytes32)": FunctionFragment; "dynamicArrayBytesStruct((bytes)[])": FunctionFragment; "dynamicArrayStringStruct((string)[])": FunctionFragment; - "emitEphemeralRecord(bytes16,bytes16,bytes32[],bytes,bytes32)": FunctionFragment; "emitEphemeralRecord(bytes32,bytes32[],bytes,bytes32)": FunctionFragment; "getField(bytes32,bytes32[],uint8,bytes32)": FunctionFragment; "getFieldLength(bytes32,bytes32[],uint8,bytes32)": FunctionFragment; @@ -51,47 +49,37 @@ export interface IWorldInterface extends utils.Interface { "getKeySchema(bytes32)": FunctionFragment; "getRecord(bytes32,bytes32[],bytes32)": FunctionFragment; "getValueSchema(bytes32)": FunctionFragment; - "grantAccess(bytes16,bytes16,address)": FunctionFragment; + "grantAccess(bytes32,address)": FunctionFragment; "increment()": FunctionFragment; "installModule(address,bytes)": FunctionFragment; "installRootModule(address,bytes)": FunctionFragment; "pickUp(uint32,uint32)": FunctionFragment; "popFromField(bytes32,bytes32[],uint8,uint256,bytes32)": FunctionFragment; - "popFromField(bytes16,bytes16,bytes32[],uint8,uint256,bytes32)": FunctionFragment; "pushToField(bytes32,bytes32[],uint8,bytes,bytes32)": FunctionFragment; - "pushToField(bytes16,bytes16,bytes32[],uint8,bytes,bytes32)": FunctionFragment; - "registerFunctionSelector(bytes16,bytes16,string,string)": FunctionFragment; - "registerHook(bytes16,bytes16,address)": FunctionFragment; + "registerFunctionSelector(bytes32,string,string)": FunctionFragment; "registerNamespace(bytes16)": FunctionFragment; - "registerRootFunctionSelector(bytes16,bytes16,bytes4,bytes4)": FunctionFragment; + "registerRootFunctionSelector(bytes32,bytes4,bytes4)": FunctionFragment; "registerStoreHook(bytes32,address)": FunctionFragment; - "registerSystem(bytes16,bytes16,address,bool)": FunctionFragment; - "registerSystemHook(bytes16,bytes16,address)": FunctionFragment; - "registerTable(bytes16,bytes16,bytes32,bytes32,string[],string[])": FunctionFragment; + "registerSystem(bytes32,address,bool)": FunctionFragment; + "registerSystemHook(bytes32,address)": FunctionFragment; "registerTable(bytes32,bytes32,bytes32,string[],string[])": FunctionFragment; - "registerTableHook(bytes16,bytes16,address)": FunctionFragment; - "revokeAccess(bytes16,bytes16,address)": FunctionFragment; + "revokeAccess(bytes32,address)": FunctionFragment; "sendMessage(string)": FunctionFragment; - "setField(bytes16,bytes16,bytes32[],uint8,bytes,bytes32)": FunctionFragment; "setField(bytes32,bytes32[],uint8,bytes,bytes32)": FunctionFragment; "setRecord(bytes32,bytes32[],bytes,bytes32)": FunctionFragment; - "setRecord(bytes16,bytes16,bytes32[],bytes,bytes32)": FunctionFragment; "staticArrayBytesStruct(tuple[1])": FunctionFragment; "staticArrayStringStruct(tuple[1])": FunctionFragment; "updateInField(bytes32,bytes32[],uint8,uint256,bytes,bytes32)": FunctionFragment; - "updateInField(bytes16,bytes16,bytes32[],uint8,uint256,bytes,bytes32)": FunctionFragment; "willRevert()": FunctionFragment; }; getFunction( nameOrSignatureOrTopic: | "call" - | "deleteRecord(bytes32,bytes32[],bytes32)" - | "deleteRecord(bytes16,bytes16,bytes32[],bytes32)" + | "deleteRecord" | "dynamicArrayBytesStruct" | "dynamicArrayStringStruct" - | "emitEphemeralRecord(bytes16,bytes16,bytes32[],bytes,bytes32)" - | "emitEphemeralRecord(bytes32,bytes32[],bytes,bytes32)" + | "emitEphemeralRecord" | "getField" | "getFieldLength" | "getFieldSlice" @@ -103,53 +91,32 @@ export interface IWorldInterface extends utils.Interface { | "installModule" | "installRootModule" | "pickUp" - | "popFromField(bytes32,bytes32[],uint8,uint256,bytes32)" - | "popFromField(bytes16,bytes16,bytes32[],uint8,uint256,bytes32)" - | "pushToField(bytes32,bytes32[],uint8,bytes,bytes32)" - | "pushToField(bytes16,bytes16,bytes32[],uint8,bytes,bytes32)" + | "popFromField" + | "pushToField" | "registerFunctionSelector" - | "registerHook" | "registerNamespace" | "registerRootFunctionSelector" | "registerStoreHook" | "registerSystem" | "registerSystemHook" - | "registerTable(bytes16,bytes16,bytes32,bytes32,string[],string[])" - | "registerTable(bytes32,bytes32,bytes32,string[],string[])" - | "registerTableHook" + | "registerTable" | "revokeAccess" | "sendMessage" - | "setField(bytes16,bytes16,bytes32[],uint8,bytes,bytes32)" - | "setField(bytes32,bytes32[],uint8,bytes,bytes32)" - | "setRecord(bytes32,bytes32[],bytes,bytes32)" - | "setRecord(bytes16,bytes16,bytes32[],bytes,bytes32)" + | "setField" + | "setRecord" | "staticArrayBytesStruct" | "staticArrayStringStruct" - | "updateInField(bytes32,bytes32[],uint8,uint256,bytes,bytes32)" - | "updateInField(bytes16,bytes16,bytes32[],uint8,uint256,bytes,bytes32)" + | "updateInField" | "willRevert" ): FunctionFragment; encodeFunctionData( functionFragment: "call", - values: [ - PromiseOrValue, - PromiseOrValue, - PromiseOrValue - ] - ): string; - encodeFunctionData( - functionFragment: "deleteRecord(bytes32,bytes32[],bytes32)", - values: [ - PromiseOrValue, - PromiseOrValue[], - PromiseOrValue - ] + values: [PromiseOrValue, PromiseOrValue] ): string; encodeFunctionData( - functionFragment: "deleteRecord(bytes16,bytes16,bytes32[],bytes32)", + functionFragment: "deleteRecord", values: [ - PromiseOrValue, PromiseOrValue, PromiseOrValue[], PromiseOrValue @@ -164,17 +131,7 @@ export interface IWorldInterface extends utils.Interface { values: [StringStructStruct[]] ): string; encodeFunctionData( - functionFragment: "emitEphemeralRecord(bytes16,bytes16,bytes32[],bytes,bytes32)", - values: [ - PromiseOrValue, - PromiseOrValue, - PromiseOrValue[], - PromiseOrValue, - PromiseOrValue - ] - ): string; - encodeFunctionData( - functionFragment: "emitEphemeralRecord(bytes32,bytes32[],bytes,bytes32)", + functionFragment: "emitEphemeralRecord", values: [ PromiseOrValue, PromiseOrValue[], @@ -229,11 +186,7 @@ export interface IWorldInterface extends utils.Interface { ): string; encodeFunctionData( functionFragment: "grantAccess", - values: [ - PromiseOrValue, - PromiseOrValue, - PromiseOrValue - ] + values: [PromiseOrValue, PromiseOrValue] ): string; encodeFunctionData(functionFragment: "increment", values?: undefined): string; encodeFunctionData( @@ -249,19 +202,8 @@ export interface IWorldInterface extends utils.Interface { values: [PromiseOrValue, PromiseOrValue] ): string; encodeFunctionData( - functionFragment: "popFromField(bytes32,bytes32[],uint8,uint256,bytes32)", - values: [ - PromiseOrValue, - PromiseOrValue[], - PromiseOrValue, - PromiseOrValue, - PromiseOrValue - ] - ): string; - encodeFunctionData( - functionFragment: "popFromField(bytes16,bytes16,bytes32[],uint8,uint256,bytes32)", + functionFragment: "popFromField", values: [ - PromiseOrValue, PromiseOrValue, PromiseOrValue[], PromiseOrValue, @@ -270,19 +212,8 @@ export interface IWorldInterface extends utils.Interface { ] ): string; encodeFunctionData( - functionFragment: "pushToField(bytes32,bytes32[],uint8,bytes,bytes32)", - values: [ - PromiseOrValue, - PromiseOrValue[], - PromiseOrValue, - PromiseOrValue, - PromiseOrValue - ] - ): string; - encodeFunctionData( - functionFragment: "pushToField(bytes16,bytes16,bytes32[],uint8,bytes,bytes32)", + functionFragment: "pushToField", values: [ - PromiseOrValue, PromiseOrValue, PromiseOrValue[], PromiseOrValue, @@ -293,20 +224,11 @@ export interface IWorldInterface extends utils.Interface { encodeFunctionData( functionFragment: "registerFunctionSelector", values: [ - PromiseOrValue, PromiseOrValue, PromiseOrValue, PromiseOrValue ] ): string; - encodeFunctionData( - functionFragment: "registerHook", - values: [ - PromiseOrValue, - PromiseOrValue, - PromiseOrValue - ] - ): string; encodeFunctionData( functionFragment: "registerNamespace", values: [PromiseOrValue] @@ -314,7 +236,6 @@ export interface IWorldInterface extends utils.Interface { encodeFunctionData( functionFragment: "registerRootFunctionSelector", values: [ - PromiseOrValue, PromiseOrValue, PromiseOrValue, PromiseOrValue @@ -327,7 +248,6 @@ export interface IWorldInterface extends utils.Interface { encodeFunctionData( functionFragment: "registerSystem", values: [ - PromiseOrValue, PromiseOrValue, PromiseOrValue, PromiseOrValue @@ -335,25 +255,10 @@ export interface IWorldInterface extends utils.Interface { ): string; encodeFunctionData( functionFragment: "registerSystemHook", - values: [ - PromiseOrValue, - PromiseOrValue, - PromiseOrValue - ] - ): string; - encodeFunctionData( - functionFragment: "registerTable(bytes16,bytes16,bytes32,bytes32,string[],string[])", - values: [ - PromiseOrValue, - PromiseOrValue, - PromiseOrValue, - PromiseOrValue, - PromiseOrValue[], - PromiseOrValue[] - ] + values: [PromiseOrValue, PromiseOrValue] ): string; encodeFunctionData( - functionFragment: "registerTable(bytes32,bytes32,bytes32,string[],string[])", + functionFragment: "registerTable", values: [ PromiseOrValue, PromiseOrValue, @@ -362,39 +267,16 @@ export interface IWorldInterface extends utils.Interface { PromiseOrValue[] ] ): string; - encodeFunctionData( - functionFragment: "registerTableHook", - values: [ - PromiseOrValue, - PromiseOrValue, - PromiseOrValue - ] - ): string; encodeFunctionData( functionFragment: "revokeAccess", - values: [ - PromiseOrValue, - PromiseOrValue, - PromiseOrValue - ] + values: [PromiseOrValue, PromiseOrValue] ): string; encodeFunctionData( functionFragment: "sendMessage", values: [PromiseOrValue] ): string; encodeFunctionData( - functionFragment: "setField(bytes16,bytes16,bytes32[],uint8,bytes,bytes32)", - values: [ - PromiseOrValue, - PromiseOrValue, - PromiseOrValue[], - PromiseOrValue, - PromiseOrValue, - PromiseOrValue - ] - ): string; - encodeFunctionData( - functionFragment: "setField(bytes32,bytes32[],uint8,bytes,bytes32)", + functionFragment: "setField", values: [ PromiseOrValue, PromiseOrValue[], @@ -404,18 +286,8 @@ export interface IWorldInterface extends utils.Interface { ] ): string; encodeFunctionData( - functionFragment: "setRecord(bytes32,bytes32[],bytes,bytes32)", - values: [ - PromiseOrValue, - PromiseOrValue[], - PromiseOrValue, - PromiseOrValue - ] - ): string; - encodeFunctionData( - functionFragment: "setRecord(bytes16,bytes16,bytes32[],bytes,bytes32)", + functionFragment: "setRecord", values: [ - PromiseOrValue, PromiseOrValue, PromiseOrValue[], PromiseOrValue, @@ -431,20 +303,8 @@ export interface IWorldInterface extends utils.Interface { values: [[StringStructStruct]] ): string; encodeFunctionData( - functionFragment: "updateInField(bytes32,bytes32[],uint8,uint256,bytes,bytes32)", - values: [ - PromiseOrValue, - PromiseOrValue[], - PromiseOrValue, - PromiseOrValue, - PromiseOrValue, - PromiseOrValue - ] - ): string; - encodeFunctionData( - functionFragment: "updateInField(bytes16,bytes16,bytes32[],uint8,uint256,bytes,bytes32)", + functionFragment: "updateInField", values: [ - PromiseOrValue, PromiseOrValue, PromiseOrValue[], PromiseOrValue, @@ -460,11 +320,7 @@ export interface IWorldInterface extends utils.Interface { decodeFunctionResult(functionFragment: "call", data: BytesLike): Result; decodeFunctionResult( - functionFragment: "deleteRecord(bytes32,bytes32[],bytes32)", - data: BytesLike - ): Result; - decodeFunctionResult( - functionFragment: "deleteRecord(bytes16,bytes16,bytes32[],bytes32)", + functionFragment: "deleteRecord", data: BytesLike ): Result; decodeFunctionResult( @@ -476,11 +332,7 @@ export interface IWorldInterface extends utils.Interface { data: BytesLike ): Result; decodeFunctionResult( - functionFragment: "emitEphemeralRecord(bytes16,bytes16,bytes32[],bytes,bytes32)", - data: BytesLike - ): Result; - decodeFunctionResult( - functionFragment: "emitEphemeralRecord(bytes32,bytes32[],bytes,bytes32)", + functionFragment: "emitEphemeralRecord", data: BytesLike ): Result; decodeFunctionResult(functionFragment: "getField", data: BytesLike): Result; @@ -516,29 +368,17 @@ export interface IWorldInterface extends utils.Interface { ): Result; decodeFunctionResult(functionFragment: "pickUp", data: BytesLike): Result; decodeFunctionResult( - functionFragment: "popFromField(bytes32,bytes32[],uint8,uint256,bytes32)", - data: BytesLike - ): Result; - decodeFunctionResult( - functionFragment: "popFromField(bytes16,bytes16,bytes32[],uint8,uint256,bytes32)", - data: BytesLike - ): Result; - decodeFunctionResult( - functionFragment: "pushToField(bytes32,bytes32[],uint8,bytes,bytes32)", + functionFragment: "popFromField", data: BytesLike ): Result; decodeFunctionResult( - functionFragment: "pushToField(bytes16,bytes16,bytes32[],uint8,bytes,bytes32)", + functionFragment: "pushToField", data: BytesLike ): Result; decodeFunctionResult( functionFragment: "registerFunctionSelector", data: BytesLike ): Result; - decodeFunctionResult( - functionFragment: "registerHook", - data: BytesLike - ): Result; decodeFunctionResult( functionFragment: "registerNamespace", data: BytesLike @@ -560,15 +400,7 @@ export interface IWorldInterface extends utils.Interface { data: BytesLike ): Result; decodeFunctionResult( - functionFragment: "registerTable(bytes16,bytes16,bytes32,bytes32,string[],string[])", - data: BytesLike - ): Result; - decodeFunctionResult( - functionFragment: "registerTable(bytes32,bytes32,bytes32,string[],string[])", - data: BytesLike - ): Result; - decodeFunctionResult( - functionFragment: "registerTableHook", + functionFragment: "registerTable", data: BytesLike ): Result; decodeFunctionResult( @@ -579,22 +411,8 @@ export interface IWorldInterface extends utils.Interface { functionFragment: "sendMessage", data: BytesLike ): Result; - decodeFunctionResult( - functionFragment: "setField(bytes16,bytes16,bytes32[],uint8,bytes,bytes32)", - data: BytesLike - ): Result; - decodeFunctionResult( - functionFragment: "setField(bytes32,bytes32[],uint8,bytes,bytes32)", - data: BytesLike - ): Result; - decodeFunctionResult( - functionFragment: "setRecord(bytes32,bytes32[],bytes,bytes32)", - data: BytesLike - ): Result; - decodeFunctionResult( - functionFragment: "setRecord(bytes16,bytes16,bytes32[],bytes,bytes32)", - data: BytesLike - ): Result; + decodeFunctionResult(functionFragment: "setField", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "setRecord", data: BytesLike): Result; decodeFunctionResult( functionFragment: "staticArrayBytesStruct", data: BytesLike @@ -604,11 +422,7 @@ export interface IWorldInterface extends utils.Interface { data: BytesLike ): Result; decodeFunctionResult( - functionFragment: "updateInField(bytes32,bytes32[],uint8,uint256,bytes,bytes32)", - data: BytesLike - ): Result; - decodeFunctionResult( - functionFragment: "updateInField(bytes16,bytes16,bytes32[],uint8,uint256,bytes,bytes32)", + functionFragment: "updateInField", data: BytesLike ): Result; decodeFunctionResult(functionFragment: "willRevert", data: BytesLike): Result; @@ -711,27 +525,18 @@ export interface IWorld extends BaseContract { functions: { call( - namespace: PromiseOrValue, - name: PromiseOrValue, + resourceSelector: PromiseOrValue, funcSelectorAndArgs: PromiseOrValue, overrides?: PayableOverrides & { from?: PromiseOrValue } ): Promise; - "deleteRecord(bytes32,bytes32[],bytes32)"( + deleteRecord( table: PromiseOrValue, key: PromiseOrValue[], valueSchema: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - "deleteRecord(bytes16,bytes16,bytes32[],bytes32)"( - namespace: PromiseOrValue, - name: PromiseOrValue, - key: PromiseOrValue[], - valueSchema: PromiseOrValue, - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; - dynamicArrayBytesStruct( arg0: BytesStructStruct[], overrides?: Overrides & { from?: PromiseOrValue } @@ -742,16 +547,7 @@ export interface IWorld extends BaseContract { overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - "emitEphemeralRecord(bytes16,bytes16,bytes32[],bytes,bytes32)"( - namespace: PromiseOrValue, - name: PromiseOrValue, - key: PromiseOrValue[], - data: PromiseOrValue, - valueSchema: PromiseOrValue, - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; - - "emitEphemeralRecord(bytes32,bytes32[],bytes,bytes32)"( + emitEphemeralRecord( table: PromiseOrValue, key: PromiseOrValue[], data: PromiseOrValue, @@ -803,8 +599,7 @@ export interface IWorld extends BaseContract { ): Promise<[string] & { schema: string }>; grantAccess( - namespace: PromiseOrValue, - name: PromiseOrValue, + resourceSelector: PromiseOrValue, grantee: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } ): Promise; @@ -831,7 +626,7 @@ export interface IWorld extends BaseContract { overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - "popFromField(bytes32,bytes32[],uint8,uint256,bytes32)"( + popFromField( table: PromiseOrValue, key: PromiseOrValue[], schemaIndex: PromiseOrValue, @@ -840,17 +635,7 @@ export interface IWorld extends BaseContract { overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - "popFromField(bytes16,bytes16,bytes32[],uint8,uint256,bytes32)"( - namespace: PromiseOrValue, - name: PromiseOrValue, - key: PromiseOrValue[], - schemaIndex: PromiseOrValue, - byteLengthToPop: PromiseOrValue, - valueSchema: PromiseOrValue, - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; - - "pushToField(bytes32,bytes32[],uint8,bytes,bytes32)"( + pushToField( table: PromiseOrValue, key: PromiseOrValue[], schemaIndex: PromiseOrValue, @@ -859,39 +644,20 @@ export interface IWorld extends BaseContract { overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - "pushToField(bytes16,bytes16,bytes32[],uint8,bytes,bytes32)"( - namespace: PromiseOrValue, - name: PromiseOrValue, - key: PromiseOrValue[], - schemaIndex: PromiseOrValue, - dataToPush: PromiseOrValue, - valueSchema: PromiseOrValue, - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; - registerFunctionSelector( - namespace: PromiseOrValue, - name: PromiseOrValue, + resourceSelector: PromiseOrValue, systemFunctionName: PromiseOrValue, systemFunctionArguments: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - registerHook( - namespace: PromiseOrValue, - name: PromiseOrValue, - hook: PromiseOrValue, - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; - registerNamespace( namespace: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } ): Promise; registerRootFunctionSelector( - namespace: PromiseOrValue, - name: PromiseOrValue, + resourceSelector: PromiseOrValue, worldFunctionSelector: PromiseOrValue, systemFunctionSelector: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } @@ -904,31 +670,19 @@ export interface IWorld extends BaseContract { ): Promise; registerSystem( - namespace: PromiseOrValue, - name: PromiseOrValue, + resourceSelector: PromiseOrValue, system: PromiseOrValue, publicAccess: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } ): Promise; registerSystemHook( - namespace: PromiseOrValue, - name: PromiseOrValue, + resourceSelector: PromiseOrValue, hook: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - "registerTable(bytes16,bytes16,bytes32,bytes32,string[],string[])"( - namespace: PromiseOrValue, - name: PromiseOrValue, - keySchema: PromiseOrValue, - valueSchema: PromiseOrValue, - keyNames: PromiseOrValue[], - fieldNames: PromiseOrValue[], - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; - - "registerTable(bytes32,bytes32,bytes32,string[],string[])"( + registerTable( table: PromiseOrValue, keySchema: PromiseOrValue, valueSchema: PromiseOrValue, @@ -937,16 +691,8 @@ export interface IWorld extends BaseContract { overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - registerTableHook( - namespace: PromiseOrValue, - name: PromiseOrValue, - hook: PromiseOrValue, - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; - revokeAccess( - namespace: PromiseOrValue, - name: PromiseOrValue, + resourceSelector: PromiseOrValue, grantee: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } ): Promise; @@ -956,17 +702,7 @@ export interface IWorld extends BaseContract { overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - "setField(bytes16,bytes16,bytes32[],uint8,bytes,bytes32)"( - namespace: PromiseOrValue, - name: PromiseOrValue, - key: PromiseOrValue[], - schemaIndex: PromiseOrValue, - data: PromiseOrValue, - valueSchema: PromiseOrValue, - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; - - "setField(bytes32,bytes32[],uint8,bytes,bytes32)"( + setField( table: PromiseOrValue, key: PromiseOrValue[], schemaIndex: PromiseOrValue, @@ -975,7 +711,7 @@ export interface IWorld extends BaseContract { overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - "setRecord(bytes32,bytes32[],bytes,bytes32)"( + setRecord( table: PromiseOrValue, key: PromiseOrValue[], data: PromiseOrValue, @@ -983,15 +719,6 @@ export interface IWorld extends BaseContract { overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - "setRecord(bytes16,bytes16,bytes32[],bytes,bytes32)"( - namespace: PromiseOrValue, - name: PromiseOrValue, - key: PromiseOrValue[], - data: PromiseOrValue, - valueSchema: PromiseOrValue, - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; - staticArrayBytesStruct( arg0: [BytesStructStruct], overrides?: Overrides & { from?: PromiseOrValue } @@ -1002,7 +729,7 @@ export interface IWorld extends BaseContract { overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - "updateInField(bytes32,bytes32[],uint8,uint256,bytes,bytes32)"( + updateInField( table: PromiseOrValue, key: PromiseOrValue[], schemaIndex: PromiseOrValue, @@ -1012,44 +739,24 @@ export interface IWorld extends BaseContract { overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - "updateInField(bytes16,bytes16,bytes32[],uint8,uint256,bytes,bytes32)"( - namespace: PromiseOrValue, - name: PromiseOrValue, - key: PromiseOrValue[], - schemaIndex: PromiseOrValue, - startByteIndex: PromiseOrValue, - dataToSet: PromiseOrValue, - valueSchema: PromiseOrValue, - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; - willRevert( overrides?: Overrides & { from?: PromiseOrValue } ): Promise; }; call( - namespace: PromiseOrValue, - name: PromiseOrValue, + resourceSelector: PromiseOrValue, funcSelectorAndArgs: PromiseOrValue, overrides?: PayableOverrides & { from?: PromiseOrValue } ): Promise; - "deleteRecord(bytes32,bytes32[],bytes32)"( + deleteRecord( table: PromiseOrValue, key: PromiseOrValue[], valueSchema: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - "deleteRecord(bytes16,bytes16,bytes32[],bytes32)"( - namespace: PromiseOrValue, - name: PromiseOrValue, - key: PromiseOrValue[], - valueSchema: PromiseOrValue, - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; - dynamicArrayBytesStruct( arg0: BytesStructStruct[], overrides?: Overrides & { from?: PromiseOrValue } @@ -1060,16 +767,7 @@ export interface IWorld extends BaseContract { overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - "emitEphemeralRecord(bytes16,bytes16,bytes32[],bytes,bytes32)"( - namespace: PromiseOrValue, - name: PromiseOrValue, - key: PromiseOrValue[], - data: PromiseOrValue, - valueSchema: PromiseOrValue, - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; - - "emitEphemeralRecord(bytes32,bytes32[],bytes,bytes32)"( + emitEphemeralRecord( table: PromiseOrValue, key: PromiseOrValue[], data: PromiseOrValue, @@ -1121,8 +819,7 @@ export interface IWorld extends BaseContract { ): Promise; grantAccess( - namespace: PromiseOrValue, - name: PromiseOrValue, + resourceSelector: PromiseOrValue, grantee: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } ): Promise; @@ -1149,7 +846,7 @@ export interface IWorld extends BaseContract { overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - "popFromField(bytes32,bytes32[],uint8,uint256,bytes32)"( + popFromField( table: PromiseOrValue, key: PromiseOrValue[], schemaIndex: PromiseOrValue, @@ -1158,17 +855,7 @@ export interface IWorld extends BaseContract { overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - "popFromField(bytes16,bytes16,bytes32[],uint8,uint256,bytes32)"( - namespace: PromiseOrValue, - name: PromiseOrValue, - key: PromiseOrValue[], - schemaIndex: PromiseOrValue, - byteLengthToPop: PromiseOrValue, - valueSchema: PromiseOrValue, - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; - - "pushToField(bytes32,bytes32[],uint8,bytes,bytes32)"( + pushToField( table: PromiseOrValue, key: PromiseOrValue[], schemaIndex: PromiseOrValue, @@ -1177,39 +864,20 @@ export interface IWorld extends BaseContract { overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - "pushToField(bytes16,bytes16,bytes32[],uint8,bytes,bytes32)"( - namespace: PromiseOrValue, - name: PromiseOrValue, - key: PromiseOrValue[], - schemaIndex: PromiseOrValue, - dataToPush: PromiseOrValue, - valueSchema: PromiseOrValue, - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; - registerFunctionSelector( - namespace: PromiseOrValue, - name: PromiseOrValue, + resourceSelector: PromiseOrValue, systemFunctionName: PromiseOrValue, systemFunctionArguments: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - registerHook( - namespace: PromiseOrValue, - name: PromiseOrValue, - hook: PromiseOrValue, - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; - registerNamespace( namespace: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } ): Promise; registerRootFunctionSelector( - namespace: PromiseOrValue, - name: PromiseOrValue, + resourceSelector: PromiseOrValue, worldFunctionSelector: PromiseOrValue, systemFunctionSelector: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } @@ -1222,31 +890,19 @@ export interface IWorld extends BaseContract { ): Promise; registerSystem( - namespace: PromiseOrValue, - name: PromiseOrValue, + resourceSelector: PromiseOrValue, system: PromiseOrValue, publicAccess: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } ): Promise; registerSystemHook( - namespace: PromiseOrValue, - name: PromiseOrValue, + resourceSelector: PromiseOrValue, hook: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - "registerTable(bytes16,bytes16,bytes32,bytes32,string[],string[])"( - namespace: PromiseOrValue, - name: PromiseOrValue, - keySchema: PromiseOrValue, - valueSchema: PromiseOrValue, - keyNames: PromiseOrValue[], - fieldNames: PromiseOrValue[], - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; - - "registerTable(bytes32,bytes32,bytes32,string[],string[])"( + registerTable( table: PromiseOrValue, keySchema: PromiseOrValue, valueSchema: PromiseOrValue, @@ -1255,16 +911,8 @@ export interface IWorld extends BaseContract { overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - registerTableHook( - namespace: PromiseOrValue, - name: PromiseOrValue, - hook: PromiseOrValue, - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; - revokeAccess( - namespace: PromiseOrValue, - name: PromiseOrValue, + resourceSelector: PromiseOrValue, grantee: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } ): Promise; @@ -1274,17 +922,7 @@ export interface IWorld extends BaseContract { overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - "setField(bytes16,bytes16,bytes32[],uint8,bytes,bytes32)"( - namespace: PromiseOrValue, - name: PromiseOrValue, - key: PromiseOrValue[], - schemaIndex: PromiseOrValue, - data: PromiseOrValue, - valueSchema: PromiseOrValue, - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; - - "setField(bytes32,bytes32[],uint8,bytes,bytes32)"( + setField( table: PromiseOrValue, key: PromiseOrValue[], schemaIndex: PromiseOrValue, @@ -1293,7 +931,7 @@ export interface IWorld extends BaseContract { overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - "setRecord(bytes32,bytes32[],bytes,bytes32)"( + setRecord( table: PromiseOrValue, key: PromiseOrValue[], data: PromiseOrValue, @@ -1301,15 +939,6 @@ export interface IWorld extends BaseContract { overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - "setRecord(bytes16,bytes16,bytes32[],bytes,bytes32)"( - namespace: PromiseOrValue, - name: PromiseOrValue, - key: PromiseOrValue[], - data: PromiseOrValue, - valueSchema: PromiseOrValue, - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; - staticArrayBytesStruct( arg0: [BytesStructStruct], overrides?: Overrides & { from?: PromiseOrValue } @@ -1320,7 +949,7 @@ export interface IWorld extends BaseContract { overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - "updateInField(bytes32,bytes32[],uint8,uint256,bytes,bytes32)"( + updateInField( table: PromiseOrValue, key: PromiseOrValue[], schemaIndex: PromiseOrValue, @@ -1330,44 +959,24 @@ export interface IWorld extends BaseContract { overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - "updateInField(bytes16,bytes16,bytes32[],uint8,uint256,bytes,bytes32)"( - namespace: PromiseOrValue, - name: PromiseOrValue, - key: PromiseOrValue[], - schemaIndex: PromiseOrValue, - startByteIndex: PromiseOrValue, - dataToSet: PromiseOrValue, - valueSchema: PromiseOrValue, - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; - willRevert( overrides?: Overrides & { from?: PromiseOrValue } ): Promise; callStatic: { call( - namespace: PromiseOrValue, - name: PromiseOrValue, + resourceSelector: PromiseOrValue, funcSelectorAndArgs: PromiseOrValue, overrides?: CallOverrides ): Promise; - "deleteRecord(bytes32,bytes32[],bytes32)"( + deleteRecord( table: PromiseOrValue, key: PromiseOrValue[], valueSchema: PromiseOrValue, overrides?: CallOverrides ): Promise; - "deleteRecord(bytes16,bytes16,bytes32[],bytes32)"( - namespace: PromiseOrValue, - name: PromiseOrValue, - key: PromiseOrValue[], - valueSchema: PromiseOrValue, - overrides?: CallOverrides - ): Promise; - dynamicArrayBytesStruct( arg0: BytesStructStruct[], overrides?: CallOverrides @@ -1378,16 +987,7 @@ export interface IWorld extends BaseContract { overrides?: CallOverrides ): Promise; - "emitEphemeralRecord(bytes16,bytes16,bytes32[],bytes,bytes32)"( - namespace: PromiseOrValue, - name: PromiseOrValue, - key: PromiseOrValue[], - data: PromiseOrValue, - valueSchema: PromiseOrValue, - overrides?: CallOverrides - ): Promise; - - "emitEphemeralRecord(bytes32,bytes32[],bytes,bytes32)"( + emitEphemeralRecord( table: PromiseOrValue, key: PromiseOrValue[], data: PromiseOrValue, @@ -1439,8 +1039,7 @@ export interface IWorld extends BaseContract { ): Promise; grantAccess( - namespace: PromiseOrValue, - name: PromiseOrValue, + resourceSelector: PromiseOrValue, grantee: PromiseOrValue, overrides?: CallOverrides ): Promise; @@ -1465,7 +1064,7 @@ export interface IWorld extends BaseContract { overrides?: CallOverrides ): Promise; - "popFromField(bytes32,bytes32[],uint8,uint256,bytes32)"( + popFromField( table: PromiseOrValue, key: PromiseOrValue[], schemaIndex: PromiseOrValue, @@ -1474,17 +1073,7 @@ export interface IWorld extends BaseContract { overrides?: CallOverrides ): Promise; - "popFromField(bytes16,bytes16,bytes32[],uint8,uint256,bytes32)"( - namespace: PromiseOrValue, - name: PromiseOrValue, - key: PromiseOrValue[], - schemaIndex: PromiseOrValue, - byteLengthToPop: PromiseOrValue, - valueSchema: PromiseOrValue, - overrides?: CallOverrides - ): Promise; - - "pushToField(bytes32,bytes32[],uint8,bytes,bytes32)"( + pushToField( table: PromiseOrValue, key: PromiseOrValue[], schemaIndex: PromiseOrValue, @@ -1493,39 +1082,20 @@ export interface IWorld extends BaseContract { overrides?: CallOverrides ): Promise; - "pushToField(bytes16,bytes16,bytes32[],uint8,bytes,bytes32)"( - namespace: PromiseOrValue, - name: PromiseOrValue, - key: PromiseOrValue[], - schemaIndex: PromiseOrValue, - dataToPush: PromiseOrValue, - valueSchema: PromiseOrValue, - overrides?: CallOverrides - ): Promise; - registerFunctionSelector( - namespace: PromiseOrValue, - name: PromiseOrValue, + resourceSelector: PromiseOrValue, systemFunctionName: PromiseOrValue, systemFunctionArguments: PromiseOrValue, overrides?: CallOverrides ): Promise; - registerHook( - namespace: PromiseOrValue, - name: PromiseOrValue, - hook: PromiseOrValue, - overrides?: CallOverrides - ): Promise; - registerNamespace( namespace: PromiseOrValue, overrides?: CallOverrides ): Promise; registerRootFunctionSelector( - namespace: PromiseOrValue, - name: PromiseOrValue, + resourceSelector: PromiseOrValue, worldFunctionSelector: PromiseOrValue, systemFunctionSelector: PromiseOrValue, overrides?: CallOverrides @@ -1538,31 +1108,19 @@ export interface IWorld extends BaseContract { ): Promise; registerSystem( - namespace: PromiseOrValue, - name: PromiseOrValue, + resourceSelector: PromiseOrValue, system: PromiseOrValue, publicAccess: PromiseOrValue, overrides?: CallOverrides - ): Promise; + ): Promise; registerSystemHook( - namespace: PromiseOrValue, - name: PromiseOrValue, + resourceSelector: PromiseOrValue, hook: PromiseOrValue, overrides?: CallOverrides ): Promise; - "registerTable(bytes16,bytes16,bytes32,bytes32,string[],string[])"( - namespace: PromiseOrValue, - name: PromiseOrValue, - keySchema: PromiseOrValue, - valueSchema: PromiseOrValue, - keyNames: PromiseOrValue[], - fieldNames: PromiseOrValue[], - overrides?: CallOverrides - ): Promise; - - "registerTable(bytes32,bytes32,bytes32,string[],string[])"( + registerTable( table: PromiseOrValue, keySchema: PromiseOrValue, valueSchema: PromiseOrValue, @@ -1571,16 +1129,8 @@ export interface IWorld extends BaseContract { overrides?: CallOverrides ): Promise; - registerTableHook( - namespace: PromiseOrValue, - name: PromiseOrValue, - hook: PromiseOrValue, - overrides?: CallOverrides - ): Promise; - revokeAccess( - namespace: PromiseOrValue, - name: PromiseOrValue, + resourceSelector: PromiseOrValue, grantee: PromiseOrValue, overrides?: CallOverrides ): Promise; @@ -1590,17 +1140,7 @@ export interface IWorld extends BaseContract { overrides?: CallOverrides ): Promise; - "setField(bytes16,bytes16,bytes32[],uint8,bytes,bytes32)"( - namespace: PromiseOrValue, - name: PromiseOrValue, - key: PromiseOrValue[], - schemaIndex: PromiseOrValue, - data: PromiseOrValue, - valueSchema: PromiseOrValue, - overrides?: CallOverrides - ): Promise; - - "setField(bytes32,bytes32[],uint8,bytes,bytes32)"( + setField( table: PromiseOrValue, key: PromiseOrValue[], schemaIndex: PromiseOrValue, @@ -1609,7 +1149,7 @@ export interface IWorld extends BaseContract { overrides?: CallOverrides ): Promise; - "setRecord(bytes32,bytes32[],bytes,bytes32)"( + setRecord( table: PromiseOrValue, key: PromiseOrValue[], data: PromiseOrValue, @@ -1617,15 +1157,6 @@ export interface IWorld extends BaseContract { overrides?: CallOverrides ): Promise; - "setRecord(bytes16,bytes16,bytes32[],bytes,bytes32)"( - namespace: PromiseOrValue, - name: PromiseOrValue, - key: PromiseOrValue[], - data: PromiseOrValue, - valueSchema: PromiseOrValue, - overrides?: CallOverrides - ): Promise; - staticArrayBytesStruct( arg0: [BytesStructStruct], overrides?: CallOverrides @@ -1636,7 +1167,7 @@ export interface IWorld extends BaseContract { overrides?: CallOverrides ): Promise; - "updateInField(bytes32,bytes32[],uint8,uint256,bytes,bytes32)"( + updateInField( table: PromiseOrValue, key: PromiseOrValue[], schemaIndex: PromiseOrValue, @@ -1646,17 +1177,6 @@ export interface IWorld extends BaseContract { overrides?: CallOverrides ): Promise; - "updateInField(bytes16,bytes16,bytes32[],uint8,uint256,bytes,bytes32)"( - namespace: PromiseOrValue, - name: PromiseOrValue, - key: PromiseOrValue[], - schemaIndex: PromiseOrValue, - startByteIndex: PromiseOrValue, - dataToSet: PromiseOrValue, - valueSchema: PromiseOrValue, - overrides?: CallOverrides - ): Promise; - willRevert(overrides?: CallOverrides): Promise; }; @@ -1708,27 +1228,18 @@ export interface IWorld extends BaseContract { estimateGas: { call( - namespace: PromiseOrValue, - name: PromiseOrValue, + resourceSelector: PromiseOrValue, funcSelectorAndArgs: PromiseOrValue, overrides?: PayableOverrides & { from?: PromiseOrValue } ): Promise; - "deleteRecord(bytes32,bytes32[],bytes32)"( + deleteRecord( table: PromiseOrValue, key: PromiseOrValue[], valueSchema: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - "deleteRecord(bytes16,bytes16,bytes32[],bytes32)"( - namespace: PromiseOrValue, - name: PromiseOrValue, - key: PromiseOrValue[], - valueSchema: PromiseOrValue, - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; - dynamicArrayBytesStruct( arg0: BytesStructStruct[], overrides?: Overrides & { from?: PromiseOrValue } @@ -1739,16 +1250,7 @@ export interface IWorld extends BaseContract { overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - "emitEphemeralRecord(bytes16,bytes16,bytes32[],bytes,bytes32)"( - namespace: PromiseOrValue, - name: PromiseOrValue, - key: PromiseOrValue[], - data: PromiseOrValue, - valueSchema: PromiseOrValue, - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; - - "emitEphemeralRecord(bytes32,bytes32[],bytes,bytes32)"( + emitEphemeralRecord( table: PromiseOrValue, key: PromiseOrValue[], data: PromiseOrValue, @@ -1800,8 +1302,7 @@ export interface IWorld extends BaseContract { ): Promise; grantAccess( - namespace: PromiseOrValue, - name: PromiseOrValue, + resourceSelector: PromiseOrValue, grantee: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } ): Promise; @@ -1828,7 +1329,7 @@ export interface IWorld extends BaseContract { overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - "popFromField(bytes32,bytes32[],uint8,uint256,bytes32)"( + popFromField( table: PromiseOrValue, key: PromiseOrValue[], schemaIndex: PromiseOrValue, @@ -1837,17 +1338,7 @@ export interface IWorld extends BaseContract { overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - "popFromField(bytes16,bytes16,bytes32[],uint8,uint256,bytes32)"( - namespace: PromiseOrValue, - name: PromiseOrValue, - key: PromiseOrValue[], - schemaIndex: PromiseOrValue, - byteLengthToPop: PromiseOrValue, - valueSchema: PromiseOrValue, - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; - - "pushToField(bytes32,bytes32[],uint8,bytes,bytes32)"( + pushToField( table: PromiseOrValue, key: PromiseOrValue[], schemaIndex: PromiseOrValue, @@ -1856,39 +1347,20 @@ export interface IWorld extends BaseContract { overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - "pushToField(bytes16,bytes16,bytes32[],uint8,bytes,bytes32)"( - namespace: PromiseOrValue, - name: PromiseOrValue, - key: PromiseOrValue[], - schemaIndex: PromiseOrValue, - dataToPush: PromiseOrValue, - valueSchema: PromiseOrValue, - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; - registerFunctionSelector( - namespace: PromiseOrValue, - name: PromiseOrValue, + resourceSelector: PromiseOrValue, systemFunctionName: PromiseOrValue, systemFunctionArguments: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - registerHook( - namespace: PromiseOrValue, - name: PromiseOrValue, - hook: PromiseOrValue, - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; - registerNamespace( namespace: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } ): Promise; registerRootFunctionSelector( - namespace: PromiseOrValue, - name: PromiseOrValue, + resourceSelector: PromiseOrValue, worldFunctionSelector: PromiseOrValue, systemFunctionSelector: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } @@ -1901,31 +1373,19 @@ export interface IWorld extends BaseContract { ): Promise; registerSystem( - namespace: PromiseOrValue, - name: PromiseOrValue, + resourceSelector: PromiseOrValue, system: PromiseOrValue, publicAccess: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } ): Promise; registerSystemHook( - namespace: PromiseOrValue, - name: PromiseOrValue, + resourceSelector: PromiseOrValue, hook: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - "registerTable(bytes16,bytes16,bytes32,bytes32,string[],string[])"( - namespace: PromiseOrValue, - name: PromiseOrValue, - keySchema: PromiseOrValue, - valueSchema: PromiseOrValue, - keyNames: PromiseOrValue[], - fieldNames: PromiseOrValue[], - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; - - "registerTable(bytes32,bytes32,bytes32,string[],string[])"( + registerTable( table: PromiseOrValue, keySchema: PromiseOrValue, valueSchema: PromiseOrValue, @@ -1934,16 +1394,8 @@ export interface IWorld extends BaseContract { overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - registerTableHook( - namespace: PromiseOrValue, - name: PromiseOrValue, - hook: PromiseOrValue, - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; - revokeAccess( - namespace: PromiseOrValue, - name: PromiseOrValue, + resourceSelector: PromiseOrValue, grantee: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } ): Promise; @@ -1953,17 +1405,7 @@ export interface IWorld extends BaseContract { overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - "setField(bytes16,bytes16,bytes32[],uint8,bytes,bytes32)"( - namespace: PromiseOrValue, - name: PromiseOrValue, - key: PromiseOrValue[], - schemaIndex: PromiseOrValue, - data: PromiseOrValue, - valueSchema: PromiseOrValue, - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; - - "setField(bytes32,bytes32[],uint8,bytes,bytes32)"( + setField( table: PromiseOrValue, key: PromiseOrValue[], schemaIndex: PromiseOrValue, @@ -1972,7 +1414,7 @@ export interface IWorld extends BaseContract { overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - "setRecord(bytes32,bytes32[],bytes,bytes32)"( + setRecord( table: PromiseOrValue, key: PromiseOrValue[], data: PromiseOrValue, @@ -1980,15 +1422,6 @@ export interface IWorld extends BaseContract { overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - "setRecord(bytes16,bytes16,bytes32[],bytes,bytes32)"( - namespace: PromiseOrValue, - name: PromiseOrValue, - key: PromiseOrValue[], - data: PromiseOrValue, - valueSchema: PromiseOrValue, - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; - staticArrayBytesStruct( arg0: [BytesStructStruct], overrides?: Overrides & { from?: PromiseOrValue } @@ -1999,7 +1432,7 @@ export interface IWorld extends BaseContract { overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - "updateInField(bytes32,bytes32[],uint8,uint256,bytes,bytes32)"( + updateInField( table: PromiseOrValue, key: PromiseOrValue[], schemaIndex: PromiseOrValue, @@ -2009,17 +1442,6 @@ export interface IWorld extends BaseContract { overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - "updateInField(bytes16,bytes16,bytes32[],uint8,uint256,bytes,bytes32)"( - namespace: PromiseOrValue, - name: PromiseOrValue, - key: PromiseOrValue[], - schemaIndex: PromiseOrValue, - startByteIndex: PromiseOrValue, - dataToSet: PromiseOrValue, - valueSchema: PromiseOrValue, - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; - willRevert( overrides?: Overrides & { from?: PromiseOrValue } ): Promise; @@ -2027,27 +1449,18 @@ export interface IWorld extends BaseContract { populateTransaction: { call( - namespace: PromiseOrValue, - name: PromiseOrValue, + resourceSelector: PromiseOrValue, funcSelectorAndArgs: PromiseOrValue, overrides?: PayableOverrides & { from?: PromiseOrValue } ): Promise; - "deleteRecord(bytes32,bytes32[],bytes32)"( + deleteRecord( table: PromiseOrValue, key: PromiseOrValue[], valueSchema: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - "deleteRecord(bytes16,bytes16,bytes32[],bytes32)"( - namespace: PromiseOrValue, - name: PromiseOrValue, - key: PromiseOrValue[], - valueSchema: PromiseOrValue, - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; - dynamicArrayBytesStruct( arg0: BytesStructStruct[], overrides?: Overrides & { from?: PromiseOrValue } @@ -2058,16 +1471,7 @@ export interface IWorld extends BaseContract { overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - "emitEphemeralRecord(bytes16,bytes16,bytes32[],bytes,bytes32)"( - namespace: PromiseOrValue, - name: PromiseOrValue, - key: PromiseOrValue[], - data: PromiseOrValue, - valueSchema: PromiseOrValue, - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; - - "emitEphemeralRecord(bytes32,bytes32[],bytes,bytes32)"( + emitEphemeralRecord( table: PromiseOrValue, key: PromiseOrValue[], data: PromiseOrValue, @@ -2119,8 +1523,7 @@ export interface IWorld extends BaseContract { ): Promise; grantAccess( - namespace: PromiseOrValue, - name: PromiseOrValue, + resourceSelector: PromiseOrValue, grantee: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } ): Promise; @@ -2147,7 +1550,7 @@ export interface IWorld extends BaseContract { overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - "popFromField(bytes32,bytes32[],uint8,uint256,bytes32)"( + popFromField( table: PromiseOrValue, key: PromiseOrValue[], schemaIndex: PromiseOrValue, @@ -2156,17 +1559,7 @@ export interface IWorld extends BaseContract { overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - "popFromField(bytes16,bytes16,bytes32[],uint8,uint256,bytes32)"( - namespace: PromiseOrValue, - name: PromiseOrValue, - key: PromiseOrValue[], - schemaIndex: PromiseOrValue, - byteLengthToPop: PromiseOrValue, - valueSchema: PromiseOrValue, - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; - - "pushToField(bytes32,bytes32[],uint8,bytes,bytes32)"( + pushToField( table: PromiseOrValue, key: PromiseOrValue[], schemaIndex: PromiseOrValue, @@ -2175,39 +1568,20 @@ export interface IWorld extends BaseContract { overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - "pushToField(bytes16,bytes16,bytes32[],uint8,bytes,bytes32)"( - namespace: PromiseOrValue, - name: PromiseOrValue, - key: PromiseOrValue[], - schemaIndex: PromiseOrValue, - dataToPush: PromiseOrValue, - valueSchema: PromiseOrValue, - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; - registerFunctionSelector( - namespace: PromiseOrValue, - name: PromiseOrValue, + resourceSelector: PromiseOrValue, systemFunctionName: PromiseOrValue, systemFunctionArguments: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - registerHook( - namespace: PromiseOrValue, - name: PromiseOrValue, - hook: PromiseOrValue, - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; - registerNamespace( namespace: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } ): Promise; registerRootFunctionSelector( - namespace: PromiseOrValue, - name: PromiseOrValue, + resourceSelector: PromiseOrValue, worldFunctionSelector: PromiseOrValue, systemFunctionSelector: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } @@ -2220,31 +1594,19 @@ export interface IWorld extends BaseContract { ): Promise; registerSystem( - namespace: PromiseOrValue, - name: PromiseOrValue, + resourceSelector: PromiseOrValue, system: PromiseOrValue, publicAccess: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } ): Promise; registerSystemHook( - namespace: PromiseOrValue, - name: PromiseOrValue, + resourceSelector: PromiseOrValue, hook: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - "registerTable(bytes16,bytes16,bytes32,bytes32,string[],string[])"( - namespace: PromiseOrValue, - name: PromiseOrValue, - keySchema: PromiseOrValue, - valueSchema: PromiseOrValue, - keyNames: PromiseOrValue[], - fieldNames: PromiseOrValue[], - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; - - "registerTable(bytes32,bytes32,bytes32,string[],string[])"( + registerTable( table: PromiseOrValue, keySchema: PromiseOrValue, valueSchema: PromiseOrValue, @@ -2253,16 +1615,8 @@ export interface IWorld extends BaseContract { overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - registerTableHook( - namespace: PromiseOrValue, - name: PromiseOrValue, - hook: PromiseOrValue, - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; - revokeAccess( - namespace: PromiseOrValue, - name: PromiseOrValue, + resourceSelector: PromiseOrValue, grantee: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } ): Promise; @@ -2272,17 +1626,7 @@ export interface IWorld extends BaseContract { overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - "setField(bytes16,bytes16,bytes32[],uint8,bytes,bytes32)"( - namespace: PromiseOrValue, - name: PromiseOrValue, - key: PromiseOrValue[], - schemaIndex: PromiseOrValue, - data: PromiseOrValue, - valueSchema: PromiseOrValue, - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; - - "setField(bytes32,bytes32[],uint8,bytes,bytes32)"( + setField( table: PromiseOrValue, key: PromiseOrValue[], schemaIndex: PromiseOrValue, @@ -2291,7 +1635,7 @@ export interface IWorld extends BaseContract { overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - "setRecord(bytes32,bytes32[],bytes,bytes32)"( + setRecord( table: PromiseOrValue, key: PromiseOrValue[], data: PromiseOrValue, @@ -2299,15 +1643,6 @@ export interface IWorld extends BaseContract { overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - "setRecord(bytes16,bytes16,bytes32[],bytes,bytes32)"( - namespace: PromiseOrValue, - name: PromiseOrValue, - key: PromiseOrValue[], - data: PromiseOrValue, - valueSchema: PromiseOrValue, - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; - staticArrayBytesStruct( arg0: [BytesStructStruct], overrides?: Overrides & { from?: PromiseOrValue } @@ -2318,7 +1653,7 @@ export interface IWorld extends BaseContract { overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - "updateInField(bytes32,bytes32[],uint8,uint256,bytes,bytes32)"( + updateInField( table: PromiseOrValue, key: PromiseOrValue[], schemaIndex: PromiseOrValue, @@ -2328,17 +1663,6 @@ export interface IWorld extends BaseContract { overrides?: Overrides & { from?: PromiseOrValue } ): Promise; - "updateInField(bytes16,bytes16,bytes32[],uint8,uint256,bytes,bytes32)"( - namespace: PromiseOrValue, - name: PromiseOrValue, - key: PromiseOrValue[], - schemaIndex: PromiseOrValue, - startByteIndex: PromiseOrValue, - dataToSet: PromiseOrValue, - valueSchema: PromiseOrValue, - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; - willRevert( overrides?: Overrides & { from?: PromiseOrValue } ): Promise; diff --git a/examples/minimal/packages/contracts/types/ethers-contracts/factories/IWorld__factory.ts b/examples/minimal/packages/contracts/types/ethers-contracts/factories/IWorld__factory.ts index 41d884b448..c9ac6862ea 100644 --- a/examples/minimal/packages/contracts/types/ethers-contracts/factories/IWorld__factory.ts +++ b/examples/minimal/packages/contracts/types/ethers-contracts/factories/IWorld__factory.ts @@ -320,14 +320,9 @@ const _abi = [ { inputs: [ { - internalType: "bytes16", - name: "namespace", - type: "bytes16", - }, - { - internalType: "bytes16", - name: "name", - type: "bytes16", + internalType: "bytes32", + name: "resourceSelector", + type: "bytes32", }, { internalType: "bytes", @@ -369,34 +364,6 @@ const _abi = [ stateMutability: "nonpayable", type: "function", }, - { - inputs: [ - { - internalType: "bytes16", - name: "namespace", - type: "bytes16", - }, - { - internalType: "bytes16", - name: "name", - type: "bytes16", - }, - { - internalType: "bytes32[]", - name: "key", - type: "bytes32[]", - }, - { - internalType: "Schema", - name: "valueSchema", - type: "bytes32", - }, - ], - name: "deleteRecord", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, { inputs: [ { @@ -437,39 +404,6 @@ const _abi = [ stateMutability: "nonpayable", type: "function", }, - { - inputs: [ - { - internalType: "bytes16", - name: "namespace", - type: "bytes16", - }, - { - internalType: "bytes16", - name: "name", - type: "bytes16", - }, - { - internalType: "bytes32[]", - name: "key", - type: "bytes32[]", - }, - { - internalType: "bytes", - name: "data", - type: "bytes", - }, - { - internalType: "Schema", - name: "valueSchema", - type: "bytes32", - }, - ], - name: "emitEphemeralRecord", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, { inputs: [ { @@ -680,14 +614,9 @@ const _abi = [ { inputs: [ { - internalType: "bytes16", - name: "namespace", - type: "bytes16", - }, - { - internalType: "bytes16", - name: "name", - type: "bytes16", + internalType: "bytes32", + name: "resourceSelector", + type: "bytes32", }, { internalType: "address", @@ -800,44 +729,6 @@ const _abi = [ stateMutability: "nonpayable", type: "function", }, - { - inputs: [ - { - internalType: "bytes16", - name: "namespace", - type: "bytes16", - }, - { - internalType: "bytes16", - name: "name", - type: "bytes16", - }, - { - internalType: "bytes32[]", - name: "key", - type: "bytes32[]", - }, - { - internalType: "uint8", - name: "schemaIndex", - type: "uint8", - }, - { - internalType: "uint256", - name: "byteLengthToPop", - type: "uint256", - }, - { - internalType: "Schema", - name: "valueSchema", - type: "bytes32", - }, - ], - name: "popFromField", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, { inputs: [ { @@ -874,53 +765,10 @@ const _abi = [ { inputs: [ { - internalType: "bytes16", - name: "namespace", - type: "bytes16", - }, - { - internalType: "bytes16", - name: "name", - type: "bytes16", - }, - { - internalType: "bytes32[]", - name: "key", - type: "bytes32[]", - }, - { - internalType: "uint8", - name: "schemaIndex", - type: "uint8", - }, - { - internalType: "bytes", - name: "dataToPush", - type: "bytes", - }, - { - internalType: "Schema", - name: "valueSchema", + internalType: "bytes32", + name: "resourceSelector", type: "bytes32", }, - ], - name: "pushToField", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "bytes16", - name: "namespace", - type: "bytes16", - }, - { - internalType: "bytes16", - name: "name", - type: "bytes16", - }, { internalType: "string", name: "systemFunctionName", @@ -943,29 +791,6 @@ const _abi = [ stateMutability: "nonpayable", type: "function", }, - { - inputs: [ - { - internalType: "bytes16", - name: "namespace", - type: "bytes16", - }, - { - internalType: "bytes16", - name: "name", - type: "bytes16", - }, - { - internalType: "address", - name: "hook", - type: "address", - }, - ], - name: "registerHook", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, { inputs: [ { @@ -982,14 +807,9 @@ const _abi = [ { inputs: [ { - internalType: "bytes16", - name: "namespace", - type: "bytes16", - }, - { - internalType: "bytes16", - name: "name", - type: "bytes16", + internalType: "bytes32", + name: "resourceSelector", + type: "bytes32", }, { internalType: "bytes4", @@ -1034,14 +854,9 @@ const _abi = [ { inputs: [ { - internalType: "bytes16", - name: "namespace", - type: "bytes16", - }, - { - internalType: "bytes16", - name: "name", - type: "bytes16", + internalType: "bytes32", + name: "resourceSelector", + type: "bytes32", }, { internalType: "contract System", @@ -1055,27 +870,16 @@ const _abi = [ }, ], name: "registerSystem", - outputs: [ - { - internalType: "bytes32", - name: "resourceSelector", - type: "bytes32", - }, - ], + outputs: [], stateMutability: "nonpayable", type: "function", }, { inputs: [ { - internalType: "bytes16", - name: "namespace", - type: "bytes16", - }, - { - internalType: "bytes16", - name: "name", - type: "bytes16", + internalType: "bytes32", + name: "resourceSelector", + type: "bytes32", }, { internalType: "contract ISystemHook", @@ -1088,50 +892,6 @@ const _abi = [ stateMutability: "nonpayable", type: "function", }, - { - inputs: [ - { - internalType: "bytes16", - name: "namespace", - type: "bytes16", - }, - { - internalType: "bytes16", - name: "name", - type: "bytes16", - }, - { - internalType: "Schema", - name: "keySchema", - type: "bytes32", - }, - { - internalType: "Schema", - name: "valueSchema", - type: "bytes32", - }, - { - internalType: "string[]", - name: "keyNames", - type: "string[]", - }, - { - internalType: "string[]", - name: "fieldNames", - type: "string[]", - }, - ], - name: "registerTable", - outputs: [ - { - internalType: "bytes32", - name: "resourceSelector", - type: "bytes32", - }, - ], - stateMutability: "nonpayable", - type: "function", - }, { inputs: [ { @@ -1168,37 +928,9 @@ const _abi = [ { inputs: [ { - internalType: "bytes16", - name: "namespace", - type: "bytes16", - }, - { - internalType: "bytes16", - name: "name", - type: "bytes16", - }, - { - internalType: "contract IStoreHook", - name: "hook", - type: "address", - }, - ], - name: "registerTableHook", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "bytes16", - name: "namespace", - type: "bytes16", - }, - { - internalType: "bytes16", - name: "name", - type: "bytes16", + internalType: "bytes32", + name: "resourceSelector", + type: "bytes32", }, { internalType: "address", @@ -1224,44 +956,6 @@ const _abi = [ stateMutability: "nonpayable", type: "function", }, - { - inputs: [ - { - internalType: "bytes16", - name: "namespace", - type: "bytes16", - }, - { - internalType: "bytes16", - name: "name", - type: "bytes16", - }, - { - internalType: "bytes32[]", - name: "key", - type: "bytes32[]", - }, - { - internalType: "uint8", - name: "schemaIndex", - type: "uint8", - }, - { - internalType: "bytes", - name: "data", - type: "bytes", - }, - { - internalType: "Schema", - name: "valueSchema", - type: "bytes32", - }, - ], - name: "setField", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, { inputs: [ { @@ -1323,39 +1017,6 @@ const _abi = [ stateMutability: "nonpayable", type: "function", }, - { - inputs: [ - { - internalType: "bytes16", - name: "namespace", - type: "bytes16", - }, - { - internalType: "bytes16", - name: "name", - type: "bytes16", - }, - { - internalType: "bytes32[]", - name: "key", - type: "bytes32[]", - }, - { - internalType: "bytes", - name: "data", - type: "bytes", - }, - { - internalType: "Schema", - name: "valueSchema", - type: "bytes32", - }, - ], - name: "setRecord", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, { inputs: [ { @@ -1434,49 +1095,6 @@ const _abi = [ stateMutability: "nonpayable", type: "function", }, - { - inputs: [ - { - internalType: "bytes16", - name: "namespace", - type: "bytes16", - }, - { - internalType: "bytes16", - name: "name", - type: "bytes16", - }, - { - internalType: "bytes32[]", - name: "key", - type: "bytes32[]", - }, - { - internalType: "uint8", - name: "schemaIndex", - type: "uint8", - }, - { - internalType: "uint256", - name: "startByteIndex", - type: "uint256", - }, - { - internalType: "bytes", - name: "dataToSet", - type: "bytes", - }, - { - internalType: "Schema", - name: "valueSchema", - type: "bytes32", - }, - ], - name: "updateInField", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, { inputs: [], name: "willRevert", diff --git a/packages/cli/src/utils/deploy.ts b/packages/cli/src/utils/deploy.ts index 6d57d65f29..90b2f94ebf 100644 --- a/packages/cli/src/utils/deploy.ts +++ b/packages/cli/src/utils/deploy.ts @@ -18,6 +18,8 @@ import CoreModuleData from "@latticexyz/world/abi/CoreModule.sol/CoreModule.json import KeysWithValueModuleData from "@latticexyz/world/abi/KeysWithValueModule.sol/KeysWithValueModule.json" assert { type: "json" }; import KeysInTableModuleData from "@latticexyz/world/abi/KeysInTableModule.sol/KeysInTableModule.json" assert { type: "json" }; import UniqueEntityModuleData from "@latticexyz/world/abi/UniqueEntityModule.sol/UniqueEntityModule.json" assert { type: "json" }; +import { tableIdToHex } from "@latticexyz/common"; +import { abiTypesToSchema, schemaToHex } from "@latticexyz/protocol-parser"; export interface DeployConfig { profile?: string; @@ -163,10 +165,9 @@ export async function deploy( await fastTxExecute( WorldContract, - "registerTable(bytes16,bytes16,bytes32,bytes32,string[],string[])", + "registerTable", [ - toBytes16(namespace), - toBytes16(name), + tableIdToHex(namespace, name), encodeSchema(keyTypes), encodeSchema(schemaTypes), Object.keys(keySchema), @@ -189,7 +190,7 @@ export async function deploy( await fastTxExecute( WorldContract, "registerSystem", - [toBytes16(namespace), toBytes16(name), await contractPromises[systemName], openAccess], + [tableIdToHex(namespace, name), await contractPromises[systemName], openAccess], confirmations ); console.log(chalk.green(`Registered system ${systemName} at ${namespace}/${name}`)); @@ -216,14 +217,14 @@ export async function deploy( await fastTxExecute( WorldContract, "registerRootFunctionSelector", - [toBytes16(namespace), toBytes16(name), worldFunctionSelector, systemFunctionSelector], + [tableIdToHex(namespace, name), worldFunctionSelector, systemFunctionSelector], confirmations ); } else { await fastTxExecute( WorldContract, "registerFunctionSelector", - [toBytes16(namespace), toBytes16(name), functionName, functionArgs], + [tableIdToHex(namespace, name), functionName, functionArgs], confirmations ); } @@ -248,12 +249,7 @@ export async function deploy( ...promises, ...accessListAddresses.map(async (address) => { console.log(chalk.blue(`Grant ${address} access to ${systemName} (${resourceSelector})`)); - await fastTxExecute( - WorldContract, - "grantAccess", - [toBytes16(namespace), toBytes16(name), address], - confirmations - ); + await fastTxExecute(WorldContract, "grantAccess", [tableIdToHex(namespace, name), address], confirmations); console.log(chalk.green(`Granted ${address} access to ${systemName} (${namespace}/${name})`)); }), ]; @@ -266,7 +262,7 @@ export async function deploy( await fastTxExecute( WorldContract, "grantAccess", - [toBytes16(namespace), toBytes16(name), await contractPromises[granteeSystem]], + [tableIdToHex(namespace, name), await contractPromises[granteeSystem]], confirmations ); console.log(chalk.green(`Granted ${granteeSystem} access to ${systemName} (${resourceSelector})`)); diff --git a/packages/common/src/tableIdToHex.ts b/packages/common/src/tableIdToHex.ts index 00e9143e0a..f3cddef064 100644 --- a/packages/common/src/tableIdToHex.ts +++ b/packages/common/src/tableIdToHex.ts @@ -1,5 +1,6 @@ import { Hex, stringToHex, concatHex } from "viem"; +// TODO: rename to `resourceIdToHex` or `resourceSelectorToHex` since it can be used with other resources than tables export function tableIdToHex(namespace: string, name: string): Hex { return concatHex([ stringToHex(namespace.substring(0, 16), { size: 16 }), diff --git a/packages/world/abi/AccessManagementSystem.sol/AccessManagementSystem.abi.json b/packages/world/abi/AccessManagementSystem.sol/AccessManagementSystem.abi.json index e4a2d6f65b..5fe389fa1a 100644 --- a/packages/world/abi/AccessManagementSystem.sol/AccessManagementSystem.abi.json +++ b/packages/world/abi/AccessManagementSystem.sol/AccessManagementSystem.abi.json @@ -71,14 +71,9 @@ { "inputs": [ { - "internalType": "bytes16", - "name": "namespace", - "type": "bytes16" - }, - { - "internalType": "bytes16", - "name": "name", - "type": "bytes16" + "internalType": "bytes32", + "name": "resourceSelector", + "type": "bytes32" }, { "internalType": "address", @@ -94,14 +89,9 @@ { "inputs": [ { - "internalType": "bytes16", - "name": "namespace", - "type": "bytes16" - }, - { - "internalType": "bytes16", - "name": "name", - "type": "bytes16" + "internalType": "bytes32", + "name": "resourceSelector", + "type": "bytes32" }, { "internalType": "address", diff --git a/packages/world/abi/CoreSystem.sol/CoreSystem.abi.json b/packages/world/abi/CoreSystem.sol/CoreSystem.abi.json index acc9523276..d72a6654c0 100644 --- a/packages/world/abi/CoreSystem.sol/CoreSystem.abi.json +++ b/packages/world/abi/CoreSystem.sol/CoreSystem.abi.json @@ -223,44 +223,11 @@ "name": "StoreEphemeralRecord", "type": "event" }, - { - "inputs": [ - { - "internalType": "bytes16", - "name": "namespace", - "type": "bytes16" - }, - { - "internalType": "bytes16", - "name": "name", - "type": "bytes16" - }, - { - "internalType": "bytes32[]", - "name": "key", - "type": "bytes32[]" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - }, - { - "internalType": "Schema", - "name": "valueSchema", - "type": "bytes32" - } - ], - "name": "emitEphemeralRecord", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, { "inputs": [ { "internalType": "bytes32", - "name": "tableId", + "name": "resourceSelector", "type": "bytes32" }, { @@ -287,14 +254,9 @@ { "inputs": [ { - "internalType": "bytes16", - "name": "namespace", - "type": "bytes16" - }, - { - "internalType": "bytes16", - "name": "name", - "type": "bytes16" + "internalType": "bytes32", + "name": "resourceSelector", + "type": "bytes32" }, { "internalType": "address", @@ -328,14 +290,9 @@ { "inputs": [ { - "internalType": "bytes16", - "name": "namespace", - "type": "bytes16" - }, - { - "internalType": "bytes16", - "name": "name", - "type": "bytes16" + "internalType": "bytes32", + "name": "resourceSelector", + "type": "bytes32" }, { "internalType": "string", @@ -359,29 +316,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [ - { - "internalType": "bytes16", - "name": "namespace", - "type": "bytes16" - }, - { - "internalType": "bytes16", - "name": "name", - "type": "bytes16" - }, - { - "internalType": "address", - "name": "hook", - "type": "address" - } - ], - "name": "registerHook", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, { "inputs": [ { @@ -398,14 +332,9 @@ { "inputs": [ { - "internalType": "bytes16", - "name": "namespace", - "type": "bytes16" - }, - { - "internalType": "bytes16", - "name": "name", - "type": "bytes16" + "internalType": "bytes32", + "name": "resourceSelector", + "type": "bytes32" }, { "internalType": "bytes4", @@ -450,14 +379,9 @@ { "inputs": [ { - "internalType": "bytes16", - "name": "namespace", - "type": "bytes16" - }, - { - "internalType": "bytes16", - "name": "name", - "type": "bytes16" + "internalType": "bytes32", + "name": "resourceSelector", + "type": "bytes32" }, { "internalType": "contract System", @@ -471,27 +395,16 @@ } ], "name": "registerSystem", - "outputs": [ - { - "internalType": "bytes32", - "name": "resourceSelector", - "type": "bytes32" - } - ], + "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { - "internalType": "bytes16", - "name": "namespace", - "type": "bytes16" - }, - { - "internalType": "bytes16", - "name": "name", - "type": "bytes16" + "internalType": "bytes32", + "name": "resourceSelector", + "type": "bytes32" }, { "internalType": "contract ISystemHook", @@ -506,54 +419,10 @@ }, { "inputs": [ - { - "internalType": "bytes16", - "name": "namespace", - "type": "bytes16" - }, - { - "internalType": "bytes16", - "name": "name", - "type": "bytes16" - }, - { - "internalType": "Schema", - "name": "keySchema", - "type": "bytes32" - }, - { - "internalType": "Schema", - "name": "valueSchema", - "type": "bytes32" - }, - { - "internalType": "string[]", - "name": "keyNames", - "type": "string[]" - }, - { - "internalType": "string[]", - "name": "fieldNames", - "type": "string[]" - } - ], - "name": "registerTable", - "outputs": [ { "internalType": "bytes32", "name": "resourceSelector", "type": "bytes32" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "tableId", - "type": "bytes32" }, { "internalType": "Schema", @@ -584,37 +453,9 @@ { "inputs": [ { - "internalType": "bytes16", - "name": "namespace", - "type": "bytes16" - }, - { - "internalType": "bytes16", - "name": "name", - "type": "bytes16" - }, - { - "internalType": "contract IStoreHook", - "name": "hook", - "type": "address" - } - ], - "name": "registerTableHook", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes16", - "name": "namespace", - "type": "bytes16" - }, - { - "internalType": "bytes16", - "name": "name", - "type": "bytes16" + "internalType": "bytes32", + "name": "resourceSelector", + "type": "bytes32" }, { "internalType": "address", diff --git a/packages/world/abi/EphemeralRecordSystem.sol/EphemeralRecordSystem.abi.json b/packages/world/abi/EphemeralRecordSystem.sol/EphemeralRecordSystem.abi.json index 8ff8f51443..3b31063c2b 100644 --- a/packages/world/abi/EphemeralRecordSystem.sol/EphemeralRecordSystem.abi.json +++ b/packages/world/abi/EphemeralRecordSystem.sol/EphemeralRecordSystem.abi.json @@ -93,44 +93,11 @@ "name": "StoreEphemeralRecord", "type": "event" }, - { - "inputs": [ - { - "internalType": "bytes16", - "name": "namespace", - "type": "bytes16" - }, - { - "internalType": "bytes16", - "name": "name", - "type": "bytes16" - }, - { - "internalType": "bytes32[]", - "name": "key", - "type": "bytes32[]" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - }, - { - "internalType": "Schema", - "name": "valueSchema", - "type": "bytes32" - } - ], - "name": "emitEphemeralRecord", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, { "inputs": [ { "internalType": "bytes32", - "name": "tableId", + "name": "resourceSelector", "type": "bytes32" }, { diff --git a/packages/world/abi/IAccessManagementSystem.sol/IAccessManagementSystem.abi.json b/packages/world/abi/IAccessManagementSystem.sol/IAccessManagementSystem.abi.json index abada2c7a6..6f82058a6b 100644 --- a/packages/world/abi/IAccessManagementSystem.sol/IAccessManagementSystem.abi.json +++ b/packages/world/abi/IAccessManagementSystem.sol/IAccessManagementSystem.abi.json @@ -2,14 +2,9 @@ { "inputs": [ { - "internalType": "bytes16", - "name": "namespace", - "type": "bytes16" - }, - { - "internalType": "bytes16", - "name": "name", - "type": "bytes16" + "internalType": "bytes32", + "name": "resourceSelector", + "type": "bytes32" }, { "internalType": "address", @@ -25,14 +20,9 @@ { "inputs": [ { - "internalType": "bytes16", - "name": "namespace", - "type": "bytes16" - }, - { - "internalType": "bytes16", - "name": "name", - "type": "bytes16" + "internalType": "bytes32", + "name": "resourceSelector", + "type": "bytes32" }, { "internalType": "address", diff --git a/packages/world/abi/IBaseWorld.sol/IBaseWorld.abi.json b/packages/world/abi/IBaseWorld.sol/IBaseWorld.abi.json index 760cba3ce8..a71695ddf8 100644 --- a/packages/world/abi/IBaseWorld.sol/IBaseWorld.abi.json +++ b/packages/world/abi/IBaseWorld.sol/IBaseWorld.abi.json @@ -307,14 +307,9 @@ { "inputs": [ { - "internalType": "bytes16", - "name": "namespace", - "type": "bytes16" - }, - { - "internalType": "bytes16", - "name": "name", - "type": "bytes16" + "internalType": "bytes32", + "name": "resourceSelector", + "type": "bytes32" }, { "internalType": "bytes", @@ -356,67 +351,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [ - { - "internalType": "bytes16", - "name": "namespace", - "type": "bytes16" - }, - { - "internalType": "bytes16", - "name": "name", - "type": "bytes16" - }, - { - "internalType": "bytes32[]", - "name": "key", - "type": "bytes32[]" - }, - { - "internalType": "Schema", - "name": "valueSchema", - "type": "bytes32" - } - ], - "name": "deleteRecord", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes16", - "name": "namespace", - "type": "bytes16" - }, - { - "internalType": "bytes16", - "name": "name", - "type": "bytes16" - }, - { - "internalType": "bytes32[]", - "name": "key", - "type": "bytes32[]" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - }, - { - "internalType": "Schema", - "name": "valueSchema", - "type": "bytes32" - } - ], - "name": "emitEphemeralRecord", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, { "inputs": [ { @@ -627,14 +561,9 @@ { "inputs": [ { - "internalType": "bytes16", - "name": "namespace", - "type": "bytes16" - }, - { - "internalType": "bytes16", - "name": "name", - "type": "bytes16" + "internalType": "bytes32", + "name": "resourceSelector", + "type": "bytes32" }, { "internalType": "address", @@ -716,44 +645,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [ - { - "internalType": "bytes16", - "name": "namespace", - "type": "bytes16" - }, - { - "internalType": "bytes16", - "name": "name", - "type": "bytes16" - }, - { - "internalType": "bytes32[]", - "name": "key", - "type": "bytes32[]" - }, - { - "internalType": "uint8", - "name": "schemaIndex", - "type": "uint8" - }, - { - "internalType": "uint256", - "name": "byteLengthToPop", - "type": "uint256" - }, - { - "internalType": "Schema", - "name": "valueSchema", - "type": "bytes32" - } - ], - "name": "popFromField", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, { "inputs": [ { @@ -790,52 +681,9 @@ { "inputs": [ { - "internalType": "bytes16", - "name": "namespace", - "type": "bytes16" - }, - { - "internalType": "bytes16", - "name": "name", - "type": "bytes16" - }, - { - "internalType": "bytes32[]", - "name": "key", - "type": "bytes32[]" - }, - { - "internalType": "uint8", - "name": "schemaIndex", - "type": "uint8" - }, - { - "internalType": "bytes", - "name": "dataToPush", - "type": "bytes" - }, - { - "internalType": "Schema", - "name": "valueSchema", + "internalType": "bytes32", + "name": "resourceSelector", "type": "bytes32" - } - ], - "name": "pushToField", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes16", - "name": "namespace", - "type": "bytes16" - }, - { - "internalType": "bytes16", - "name": "name", - "type": "bytes16" }, { "internalType": "string", @@ -859,29 +707,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [ - { - "internalType": "bytes16", - "name": "namespace", - "type": "bytes16" - }, - { - "internalType": "bytes16", - "name": "name", - "type": "bytes16" - }, - { - "internalType": "address", - "name": "hook", - "type": "address" - } - ], - "name": "registerHook", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, { "inputs": [ { @@ -898,14 +723,9 @@ { "inputs": [ { - "internalType": "bytes16", - "name": "namespace", - "type": "bytes16" - }, - { - "internalType": "bytes16", - "name": "name", - "type": "bytes16" + "internalType": "bytes32", + "name": "resourceSelector", + "type": "bytes32" }, { "internalType": "bytes4", @@ -950,14 +770,9 @@ { "inputs": [ { - "internalType": "bytes16", - "name": "namespace", - "type": "bytes16" - }, - { - "internalType": "bytes16", - "name": "name", - "type": "bytes16" + "internalType": "bytes32", + "name": "resourceSelector", + "type": "bytes32" }, { "internalType": "contract System", @@ -971,27 +786,16 @@ } ], "name": "registerSystem", - "outputs": [ - { - "internalType": "bytes32", - "name": "resourceSelector", - "type": "bytes32" - } - ], + "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { - "internalType": "bytes16", - "name": "namespace", - "type": "bytes16" - }, - { - "internalType": "bytes16", - "name": "name", - "type": "bytes16" + "internalType": "bytes32", + "name": "resourceSelector", + "type": "bytes32" }, { "internalType": "contract ISystemHook", @@ -1004,50 +808,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [ - { - "internalType": "bytes16", - "name": "namespace", - "type": "bytes16" - }, - { - "internalType": "bytes16", - "name": "name", - "type": "bytes16" - }, - { - "internalType": "Schema", - "name": "keySchema", - "type": "bytes32" - }, - { - "internalType": "Schema", - "name": "valueSchema", - "type": "bytes32" - }, - { - "internalType": "string[]", - "name": "keyNames", - "type": "string[]" - }, - { - "internalType": "string[]", - "name": "fieldNames", - "type": "string[]" - } - ], - "name": "registerTable", - "outputs": [ - { - "internalType": "bytes32", - "name": "resourceSelector", - "type": "bytes32" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, { "inputs": [ { @@ -1084,37 +844,9 @@ { "inputs": [ { - "internalType": "bytes16", - "name": "namespace", - "type": "bytes16" - }, - { - "internalType": "bytes16", - "name": "name", - "type": "bytes16" - }, - { - "internalType": "contract IStoreHook", - "name": "hook", - "type": "address" - } - ], - "name": "registerTableHook", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes16", - "name": "namespace", - "type": "bytes16" - }, - { - "internalType": "bytes16", - "name": "name", - "type": "bytes16" + "internalType": "bytes32", + "name": "resourceSelector", + "type": "bytes32" }, { "internalType": "address", @@ -1127,44 +859,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [ - { - "internalType": "bytes16", - "name": "namespace", - "type": "bytes16" - }, - { - "internalType": "bytes16", - "name": "name", - "type": "bytes16" - }, - { - "internalType": "bytes32[]", - "name": "key", - "type": "bytes32[]" - }, - { - "internalType": "uint8", - "name": "schemaIndex", - "type": "uint8" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - }, - { - "internalType": "Schema", - "name": "valueSchema", - "type": "bytes32" - } - ], - "name": "setField", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, { "inputs": [ { @@ -1226,39 +920,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [ - { - "internalType": "bytes16", - "name": "namespace", - "type": "bytes16" - }, - { - "internalType": "bytes16", - "name": "name", - "type": "bytes16" - }, - { - "internalType": "bytes32[]", - "name": "key", - "type": "bytes32[]" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - }, - { - "internalType": "Schema", - "name": "valueSchema", - "type": "bytes32" - } - ], - "name": "setRecord", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, { "inputs": [ { @@ -1296,48 +957,5 @@ "outputs": [], "stateMutability": "nonpayable", "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes16", - "name": "namespace", - "type": "bytes16" - }, - { - "internalType": "bytes16", - "name": "name", - "type": "bytes16" - }, - { - "internalType": "bytes32[]", - "name": "key", - "type": "bytes32[]" - }, - { - "internalType": "uint8", - "name": "schemaIndex", - "type": "uint8" - }, - { - "internalType": "uint256", - "name": "startByteIndex", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "dataToSet", - "type": "bytes" - }, - { - "internalType": "Schema", - "name": "valueSchema", - "type": "bytes32" - } - ], - "name": "updateInField", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" } ] \ No newline at end of file diff --git a/packages/world/abi/IStoreRegistrationSystem.sol/IStoreRegistrationSystem.abi.json b/packages/world/abi/IStoreRegistrationSystem.sol/IStoreRegistrationSystem.abi.json deleted file mode 100644 index ff79802f59..0000000000 --- a/packages/world/abi/IStoreRegistrationSystem.sol/IStoreRegistrationSystem.abi.json +++ /dev/null @@ -1,66 +0,0 @@ -[ - { - "inputs": [ - { - "internalType": "bytes32", - "name": "tableId", - "type": "bytes32" - }, - { - "internalType": "Schema", - "name": "valueSchema", - "type": "bytes32" - }, - { - "internalType": "Schema", - "name": "keySchema", - "type": "bytes32" - } - ], - "name": "registerSchema", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "tableId", - "type": "bytes32" - }, - { - "internalType": "contract IStoreHook", - "name": "hook", - "type": "address" - } - ], - "name": "registerStoreHook", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "tableId", - "type": "bytes32" - }, - { - "internalType": "string", - "name": "tableName", - "type": "string" - }, - { - "internalType": "string[]", - "name": "fieldNames", - "type": "string[]" - } - ], - "name": "setMetadata", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } -] \ No newline at end of file diff --git a/packages/world/abi/IWorldEphemeral.sol/IWorldEphemeral.abi.json b/packages/world/abi/IWorldEphemeral.sol/IWorldEphemeral.abi.json deleted file mode 100644 index c4d7e548b0..0000000000 --- a/packages/world/abi/IWorldEphemeral.sol/IWorldEphemeral.abi.json +++ /dev/null @@ -1,35 +0,0 @@ -[ - { - "inputs": [ - { - "internalType": "bytes16", - "name": "namespace", - "type": "bytes16" - }, - { - "internalType": "bytes16", - "name": "name", - "type": "bytes16" - }, - { - "internalType": "bytes32[]", - "name": "key", - "type": "bytes32[]" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - }, - { - "internalType": "Schema", - "name": "valueSchema", - "type": "bytes32" - } - ], - "name": "emitEphemeralRecord", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } -] \ No newline at end of file diff --git a/packages/world/abi/IWorldKernel.sol/IWorldCall.abi.json b/packages/world/abi/IWorldKernel.sol/IWorldCall.abi.json index 06fe9b75ca..9cc8e76434 100644 --- a/packages/world/abi/IWorldKernel.sol/IWorldCall.abi.json +++ b/packages/world/abi/IWorldKernel.sol/IWorldCall.abi.json @@ -2,14 +2,9 @@ { "inputs": [ { - "internalType": "bytes16", - "name": "namespace", - "type": "bytes16" - }, - { - "internalType": "bytes16", - "name": "name", - "type": "bytes16" + "internalType": "bytes32", + "name": "resourceSelector", + "type": "bytes32" }, { "internalType": "bytes", diff --git a/packages/world/abi/IWorldKernel.sol/IWorldData.abi.json b/packages/world/abi/IWorldKernel.sol/IWorldData.abi.json deleted file mode 100644 index 9be0c880bd..0000000000 --- a/packages/world/abi/IWorldKernel.sol/IWorldData.abi.json +++ /dev/null @@ -1,220 +0,0 @@ -[ - { - "inputs": [ - { - "internalType": "bytes16", - "name": "namespace", - "type": "bytes16" - }, - { - "internalType": "bytes16", - "name": "name", - "type": "bytes16" - }, - { - "internalType": "bytes32[]", - "name": "key", - "type": "bytes32[]" - }, - { - "internalType": "Schema", - "name": "valueSchema", - "type": "bytes32" - } - ], - "name": "deleteRecord", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes16", - "name": "namespace", - "type": "bytes16" - }, - { - "internalType": "bytes16", - "name": "name", - "type": "bytes16" - }, - { - "internalType": "bytes32[]", - "name": "key", - "type": "bytes32[]" - }, - { - "internalType": "uint8", - "name": "schemaIndex", - "type": "uint8" - }, - { - "internalType": "uint256", - "name": "byteLengthToPop", - "type": "uint256" - }, - { - "internalType": "Schema", - "name": "valueSchema", - "type": "bytes32" - } - ], - "name": "popFromField", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes16", - "name": "namespace", - "type": "bytes16" - }, - { - "internalType": "bytes16", - "name": "name", - "type": "bytes16" - }, - { - "internalType": "bytes32[]", - "name": "key", - "type": "bytes32[]" - }, - { - "internalType": "uint8", - "name": "schemaIndex", - "type": "uint8" - }, - { - "internalType": "bytes", - "name": "dataToPush", - "type": "bytes" - }, - { - "internalType": "Schema", - "name": "valueSchema", - "type": "bytes32" - } - ], - "name": "pushToField", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes16", - "name": "namespace", - "type": "bytes16" - }, - { - "internalType": "bytes16", - "name": "name", - "type": "bytes16" - }, - { - "internalType": "bytes32[]", - "name": "key", - "type": "bytes32[]" - }, - { - "internalType": "uint8", - "name": "schemaIndex", - "type": "uint8" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - }, - { - "internalType": "Schema", - "name": "valueSchema", - "type": "bytes32" - } - ], - "name": "setField", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes16", - "name": "namespace", - "type": "bytes16" - }, - { - "internalType": "bytes16", - "name": "name", - "type": "bytes16" - }, - { - "internalType": "bytes32[]", - "name": "key", - "type": "bytes32[]" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - }, - { - "internalType": "Schema", - "name": "valueSchema", - "type": "bytes32" - } - ], - "name": "setRecord", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes16", - "name": "namespace", - "type": "bytes16" - }, - { - "internalType": "bytes16", - "name": "name", - "type": "bytes16" - }, - { - "internalType": "bytes32[]", - "name": "key", - "type": "bytes32[]" - }, - { - "internalType": "uint8", - "name": "schemaIndex", - "type": "uint8" - }, - { - "internalType": "uint256", - "name": "startByteIndex", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "dataToSet", - "type": "bytes" - }, - { - "internalType": "Schema", - "name": "valueSchema", - "type": "bytes32" - } - ], - "name": "updateInField", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } -] \ No newline at end of file diff --git a/packages/world/abi/IWorldKernel.sol/IWorldKernel.abi.json b/packages/world/abi/IWorldKernel.sol/IWorldKernel.abi.json index 860b7a890e..c8ebaa6cd7 100644 --- a/packages/world/abi/IWorldKernel.sol/IWorldKernel.abi.json +++ b/packages/world/abi/IWorldKernel.sol/IWorldKernel.abi.json @@ -101,14 +101,9 @@ { "inputs": [ { - "internalType": "bytes16", - "name": "namespace", - "type": "bytes16" - }, - { - "internalType": "bytes16", - "name": "name", - "type": "bytes16" + "internalType": "bytes32", + "name": "resourceSelector", + "type": "bytes32" }, { "internalType": "bytes", @@ -127,34 +122,6 @@ "stateMutability": "payable", "type": "function" }, - { - "inputs": [ - { - "internalType": "bytes16", - "name": "namespace", - "type": "bytes16" - }, - { - "internalType": "bytes16", - "name": "name", - "type": "bytes16" - }, - { - "internalType": "bytes32[]", - "name": "key", - "type": "bytes32[]" - }, - { - "internalType": "Schema", - "name": "valueSchema", - "type": "bytes32" - } - ], - "name": "deleteRecord", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, { "inputs": [ { @@ -172,195 +139,5 @@ "outputs": [], "stateMutability": "nonpayable", "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes16", - "name": "namespace", - "type": "bytes16" - }, - { - "internalType": "bytes16", - "name": "name", - "type": "bytes16" - }, - { - "internalType": "bytes32[]", - "name": "key", - "type": "bytes32[]" - }, - { - "internalType": "uint8", - "name": "schemaIndex", - "type": "uint8" - }, - { - "internalType": "uint256", - "name": "byteLengthToPop", - "type": "uint256" - }, - { - "internalType": "Schema", - "name": "valueSchema", - "type": "bytes32" - } - ], - "name": "popFromField", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes16", - "name": "namespace", - "type": "bytes16" - }, - { - "internalType": "bytes16", - "name": "name", - "type": "bytes16" - }, - { - "internalType": "bytes32[]", - "name": "key", - "type": "bytes32[]" - }, - { - "internalType": "uint8", - "name": "schemaIndex", - "type": "uint8" - }, - { - "internalType": "bytes", - "name": "dataToPush", - "type": "bytes" - }, - { - "internalType": "Schema", - "name": "valueSchema", - "type": "bytes32" - } - ], - "name": "pushToField", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes16", - "name": "namespace", - "type": "bytes16" - }, - { - "internalType": "bytes16", - "name": "name", - "type": "bytes16" - }, - { - "internalType": "bytes32[]", - "name": "key", - "type": "bytes32[]" - }, - { - "internalType": "uint8", - "name": "schemaIndex", - "type": "uint8" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - }, - { - "internalType": "Schema", - "name": "valueSchema", - "type": "bytes32" - } - ], - "name": "setField", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes16", - "name": "namespace", - "type": "bytes16" - }, - { - "internalType": "bytes16", - "name": "name", - "type": "bytes16" - }, - { - "internalType": "bytes32[]", - "name": "key", - "type": "bytes32[]" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - }, - { - "internalType": "Schema", - "name": "valueSchema", - "type": "bytes32" - } - ], - "name": "setRecord", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes16", - "name": "namespace", - "type": "bytes16" - }, - { - "internalType": "bytes16", - "name": "name", - "type": "bytes16" - }, - { - "internalType": "bytes32[]", - "name": "key", - "type": "bytes32[]" - }, - { - "internalType": "uint8", - "name": "schemaIndex", - "type": "uint8" - }, - { - "internalType": "uint256", - "name": "startByteIndex", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "dataToSet", - "type": "bytes" - }, - { - "internalType": "Schema", - "name": "valueSchema", - "type": "bytes32" - } - ], - "name": "updateInField", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" } ] \ No newline at end of file diff --git a/packages/world/abi/IWorldRegistrationSystem.sol/IWorldRegistrationSystem.abi.json b/packages/world/abi/IWorldRegistrationSystem.sol/IWorldRegistrationSystem.abi.json index 6c5efc1fd5..79efd8e7e0 100644 --- a/packages/world/abi/IWorldRegistrationSystem.sol/IWorldRegistrationSystem.abi.json +++ b/packages/world/abi/IWorldRegistrationSystem.sol/IWorldRegistrationSystem.abi.json @@ -2,14 +2,9 @@ { "inputs": [ { - "internalType": "bytes16", - "name": "namespace", - "type": "bytes16" - }, - { - "internalType": "bytes16", - "name": "name", - "type": "bytes16" + "internalType": "bytes32", + "name": "resourceSelector", + "type": "bytes32" }, { "internalType": "string", @@ -33,29 +28,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [ - { - "internalType": "bytes16", - "name": "namespace", - "type": "bytes16" - }, - { - "internalType": "bytes16", - "name": "name", - "type": "bytes16" - }, - { - "internalType": "address", - "name": "hook", - "type": "address" - } - ], - "name": "registerHook", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, { "inputs": [ { @@ -72,14 +44,9 @@ { "inputs": [ { - "internalType": "bytes16", - "name": "namespace", - "type": "bytes16" - }, - { - "internalType": "bytes16", - "name": "name", - "type": "bytes16" + "internalType": "bytes32", + "name": "resourceSelector", + "type": "bytes32" }, { "internalType": "bytes4", @@ -106,14 +73,9 @@ { "inputs": [ { - "internalType": "bytes16", - "name": "namespace", - "type": "bytes16" - }, - { - "internalType": "bytes16", - "name": "name", - "type": "bytes16" + "internalType": "bytes32", + "name": "resourceSelector", + "type": "bytes32" }, { "internalType": "contract System", @@ -127,102 +89,24 @@ } ], "name": "registerSystem", - "outputs": [ - { - "internalType": "bytes32", - "name": "resourceSelector", - "type": "bytes32" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes16", - "name": "namespace", - "type": "bytes16" - }, - { - "internalType": "bytes16", - "name": "name", - "type": "bytes16" - }, - { - "internalType": "contract ISystemHook", - "name": "hook", - "type": "address" - } - ], - "name": "registerSystemHook", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ - { - "internalType": "bytes16", - "name": "namespace", - "type": "bytes16" - }, - { - "internalType": "bytes16", - "name": "name", - "type": "bytes16" - }, - { - "internalType": "Schema", - "name": "keySchema", - "type": "bytes32" - }, - { - "internalType": "Schema", - "name": "valueSchema", - "type": "bytes32" - }, - { - "internalType": "string[]", - "name": "keyNames", - "type": "string[]" - }, - { - "internalType": "string[]", - "name": "fieldNames", - "type": "string[]" - } - ], - "name": "registerTable", - "outputs": [ { "internalType": "bytes32", "name": "resourceSelector", "type": "bytes32" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes16", - "name": "namespace", - "type": "bytes16" }, { - "internalType": "bytes16", - "name": "name", - "type": "bytes16" - }, - { - "internalType": "contract IStoreHook", + "internalType": "contract ISystemHook", "name": "hook", "type": "address" } ], - "name": "registerTableHook", + "name": "registerSystemHook", "outputs": [], "stateMutability": "nonpayable", "type": "function" diff --git a/packages/world/abi/StoreRegistrationSystem.sol/StoreRegistrationSystem.abi.json b/packages/world/abi/StoreRegistrationSystem.sol/StoreRegistrationSystem.abi.json index fb6658c07a..7b5c1500ce 100644 --- a/packages/world/abi/StoreRegistrationSystem.sol/StoreRegistrationSystem.abi.json +++ b/packages/world/abi/StoreRegistrationSystem.sol/StoreRegistrationSystem.abi.json @@ -1,4 +1,86 @@ [ + { + "inputs": [ + { + "internalType": "string", + "name": "resource", + "type": "string" + }, + { + "internalType": "address", + "name": "caller", + "type": "address" + } + ], + "name": "AccessDenied", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "functionSelector", + "type": "bytes4" + } + ], + "name": "FunctionSelectorExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "functionSelector", + "type": "bytes4" + } + ], + "name": "FunctionSelectorNotFound", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "resource", + "type": "string" + } + ], + "name": "InvalidSelector", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "module", + "type": "string" + } + ], + "name": "ModuleAlreadyInstalled", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "resource", + "type": "string" + } + ], + "name": "ResourceExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "resource", + "type": "string" + } + ], + "name": "ResourceNotFound", + "type": "error" + }, { "inputs": [ { @@ -15,6 +97,107 @@ "name": "SchemaLib_StaticTypeAfterDynamicType", "type": "error" }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "start", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "end", + "type": "uint256" + } + ], + "name": "Slice_OutOfBounds", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "expected", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "received", + "type": "uint256" + } + ], + "name": "StoreCore_InvalidDataLength", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "expected", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "received", + "type": "uint256" + } + ], + "name": "StoreCore_InvalidFieldNamesLength", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "expected", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "received", + "type": "uint256" + } + ], + "name": "StoreCore_InvalidKeyNamesLength", + "type": "error" + }, + { + "inputs": [], + "name": "StoreCore_NotDynamicField", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "tableId", + "type": "bytes32" + }, + { + "internalType": "string", + "name": "tableIdString", + "type": "string" + } + ], + "name": "StoreCore_TableAlreadyExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "system", + "type": "address" + } + ], + "name": "SystemExists", + "type": "error" + }, { "inputs": [ { @@ -37,7 +220,7 @@ "inputs": [ { "internalType": "bytes32", - "name": "tableId", + "name": "resourceSelector", "type": "bytes32" }, { diff --git a/packages/world/abi/World.sol/World.abi.json b/packages/world/abi/World.sol/World.abi.json index 24c4c756dc..e146910aad 100644 --- a/packages/world/abi/World.sol/World.abi.json +++ b/packages/world/abi/World.sol/World.abi.json @@ -323,14 +323,9 @@ { "inputs": [ { - "internalType": "bytes16", - "name": "namespace", - "type": "bytes16" - }, - { - "internalType": "bytes16", - "name": "name", - "type": "bytes16" + "internalType": "bytes32", + "name": "resourceSelector", + "type": "bytes32" }, { "internalType": "bytes", @@ -372,34 +367,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [ - { - "internalType": "bytes16", - "name": "namespace", - "type": "bytes16" - }, - { - "internalType": "bytes16", - "name": "name", - "type": "bytes16" - }, - { - "internalType": "bytes32[]", - "name": "key", - "type": "bytes32[]" - }, - { - "internalType": "Schema", - "name": "valueSchema", - "type": "bytes32" - } - ], - "name": "deleteRecord", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, { "inputs": [ { @@ -630,44 +597,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [ - { - "internalType": "bytes16", - "name": "namespace", - "type": "bytes16" - }, - { - "internalType": "bytes16", - "name": "name", - "type": "bytes16" - }, - { - "internalType": "bytes32[]", - "name": "key", - "type": "bytes32[]" - }, - { - "internalType": "uint8", - "name": "schemaIndex", - "type": "uint8" - }, - { - "internalType": "uint256", - "name": "byteLengthToPop", - "type": "uint256" - }, - { - "internalType": "Schema", - "name": "valueSchema", - "type": "bytes32" - } - ], - "name": "popFromField", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, { "inputs": [ { @@ -701,82 +630,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [ - { - "internalType": "bytes16", - "name": "namespace", - "type": "bytes16" - }, - { - "internalType": "bytes16", - "name": "name", - "type": "bytes16" - }, - { - "internalType": "bytes32[]", - "name": "key", - "type": "bytes32[]" - }, - { - "internalType": "uint8", - "name": "schemaIndex", - "type": "uint8" - }, - { - "internalType": "bytes", - "name": "dataToPush", - "type": "bytes" - }, - { - "internalType": "Schema", - "name": "valueSchema", - "type": "bytes32" - } - ], - "name": "pushToField", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes16", - "name": "namespace", - "type": "bytes16" - }, - { - "internalType": "bytes16", - "name": "name", - "type": "bytes16" - }, - { - "internalType": "bytes32[]", - "name": "key", - "type": "bytes32[]" - }, - { - "internalType": "uint8", - "name": "schemaIndex", - "type": "uint8" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - }, - { - "internalType": "Schema", - "name": "valueSchema", - "type": "bytes32" - } - ], - "name": "setField", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, { "inputs": [ { @@ -838,39 +691,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [ - { - "internalType": "bytes16", - "name": "namespace", - "type": "bytes16" - }, - { - "internalType": "bytes16", - "name": "name", - "type": "bytes16" - }, - { - "internalType": "bytes32[]", - "name": "key", - "type": "bytes32[]" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - }, - { - "internalType": "Schema", - "name": "valueSchema", - "type": "bytes32" - } - ], - "name": "setRecord", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, { "inputs": [ { @@ -909,49 +729,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [ - { - "internalType": "bytes16", - "name": "namespace", - "type": "bytes16" - }, - { - "internalType": "bytes16", - "name": "name", - "type": "bytes16" - }, - { - "internalType": "bytes32[]", - "name": "key", - "type": "bytes32[]" - }, - { - "internalType": "uint8", - "name": "schemaIndex", - "type": "uint8" - }, - { - "internalType": "uint256", - "name": "startByteIndex", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "dataToSet", - "type": "bytes" - }, - { - "internalType": "Schema", - "name": "valueSchema", - "type": "bytes32" - } - ], - "name": "updateInField", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, { "stateMutability": "payable", "type": "receive" diff --git a/packages/world/abi/WorldRegistrationSystem.sol/WorldRegistrationSystem.abi.json b/packages/world/abi/WorldRegistrationSystem.sol/WorldRegistrationSystem.abi.json index 7bf047f4f4..fefed7e161 100644 --- a/packages/world/abi/WorldRegistrationSystem.sol/WorldRegistrationSystem.abi.json +++ b/packages/world/abi/WorldRegistrationSystem.sol/WorldRegistrationSystem.abi.json @@ -134,59 +134,11 @@ "name": "StoreCore_InvalidDataLength", "type": "error" }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "expected", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "received", - "type": "uint256" - } - ], - "name": "StoreCore_InvalidFieldNamesLength", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "expected", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "received", - "type": "uint256" - } - ], - "name": "StoreCore_InvalidKeyNamesLength", - "type": "error" - }, { "inputs": [], "name": "StoreCore_NotDynamicField", "type": "error" }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "tableId", - "type": "bytes32" - }, - { - "internalType": "string", - "name": "tableIdString", - "type": "string" - } - ], - "name": "StoreCore_TableAlreadyExists", - "type": "error" - }, { "inputs": [ { @@ -201,14 +153,9 @@ { "inputs": [ { - "internalType": "bytes16", - "name": "namespace", - "type": "bytes16" - }, - { - "internalType": "bytes16", - "name": "name", - "type": "bytes16" + "internalType": "bytes32", + "name": "resourceSelector", + "type": "bytes32" }, { "internalType": "string", @@ -232,29 +179,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [ - { - "internalType": "bytes16", - "name": "namespace", - "type": "bytes16" - }, - { - "internalType": "bytes16", - "name": "name", - "type": "bytes16" - }, - { - "internalType": "address", - "name": "hook", - "type": "address" - } - ], - "name": "registerHook", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, { "inputs": [ { @@ -271,14 +195,9 @@ { "inputs": [ { - "internalType": "bytes16", - "name": "namespace", - "type": "bytes16" - }, - { - "internalType": "bytes16", - "name": "name", - "type": "bytes16" + "internalType": "bytes32", + "name": "resourceSelector", + "type": "bytes32" }, { "internalType": "bytes4", @@ -305,14 +224,9 @@ { "inputs": [ { - "internalType": "bytes16", - "name": "namespace", - "type": "bytes16" - }, - { - "internalType": "bytes16", - "name": "name", - "type": "bytes16" + "internalType": "bytes32", + "name": "resourceSelector", + "type": "bytes32" }, { "internalType": "contract System", @@ -326,102 +240,24 @@ } ], "name": "registerSystem", - "outputs": [ - { - "internalType": "bytes32", - "name": "resourceSelector", - "type": "bytes32" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes16", - "name": "namespace", - "type": "bytes16" - }, - { - "internalType": "bytes16", - "name": "name", - "type": "bytes16" - }, - { - "internalType": "contract ISystemHook", - "name": "hook", - "type": "address" - } - ], - "name": "registerSystemHook", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ - { - "internalType": "bytes16", - "name": "namespace", - "type": "bytes16" - }, - { - "internalType": "bytes16", - "name": "name", - "type": "bytes16" - }, - { - "internalType": "Schema", - "name": "keySchema", - "type": "bytes32" - }, - { - "internalType": "Schema", - "name": "valueSchema", - "type": "bytes32" - }, - { - "internalType": "string[]", - "name": "keyNames", - "type": "string[]" - }, - { - "internalType": "string[]", - "name": "fieldNames", - "type": "string[]" - } - ], - "name": "registerTable", - "outputs": [ { "internalType": "bytes32", "name": "resourceSelector", "type": "bytes32" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes16", - "name": "namespace", - "type": "bytes16" - }, - { - "internalType": "bytes16", - "name": "name", - "type": "bytes16" }, { - "internalType": "contract IStoreHook", + "internalType": "contract ISystemHook", "name": "hook", "type": "address" } ], - "name": "registerTableHook", + "name": "registerSystemHook", "outputs": [], "stateMutability": "nonpayable", "type": "function" diff --git a/packages/world/gas-report.json b/packages/world/gas-report.json index 5a1369fc66..71728ce602 100644 --- a/packages/world/gas-report.json +++ b/packages/world/gas-report.json @@ -3,73 +3,73 @@ "file": "test/KeysInTableModule.t.sol", "test": "testInstallComposite", "name": "install keys in table module", - "gasUsed": 1489422 + "gasUsed": 1448122 }, { "file": "test/KeysInTableModule.t.sol", "test": "testInstallGas", "name": "install keys in table module", - "gasUsed": 1489422 + "gasUsed": 1448122 }, { "file": "test/KeysInTableModule.t.sol", "test": "testInstallGas", "name": "set a record on a table with keysInTableModule installed", - "gasUsed": 192180 + "gasUsed": 191498 }, { "file": "test/KeysInTableModule.t.sol", "test": "testInstallSingleton", "name": "install keys in table module", - "gasUsed": 1489422 + "gasUsed": 1448122 }, { "file": "test/KeysInTableModule.t.sol", "test": "testSetAndDeleteRecordHookCompositeGas", "name": "install keys in table module", - "gasUsed": 1489422 + "gasUsed": 1448122 }, { "file": "test/KeysInTableModule.t.sol", "test": "testSetAndDeleteRecordHookCompositeGas", "name": "change a composite record on a table with keysInTableModule installed", - "gasUsed": 28011 + "gasUsed": 27618 }, { "file": "test/KeysInTableModule.t.sol", "test": "testSetAndDeleteRecordHookCompositeGas", "name": "delete a composite record on a table with keysInTableModule installed", - "gasUsed": 284310 + "gasUsed": 282449 }, { "file": "test/KeysInTableModule.t.sol", "test": "testSetAndDeleteRecordHookGas", "name": "install keys in table module", - "gasUsed": 1489422 + "gasUsed": 1448122 }, { "file": "test/KeysInTableModule.t.sol", "test": "testSetAndDeleteRecordHookGas", "name": "change a record on a table with keysInTableModule installed", - "gasUsed": 26631 + "gasUsed": 26338 }, { "file": "test/KeysInTableModule.t.sol", "test": "testSetAndDeleteRecordHookGas", "name": "delete a record on a table with keysInTableModule installed", - "gasUsed": 146068 + "gasUsed": 144972 }, { "file": "test/KeysWithValueModule.t.sol", "test": "testGetKeysWithValueGas", "name": "install keys with value module", - "gasUsed": 682738 + "gasUsed": 672214 }, { "file": "test/KeysWithValueModule.t.sol", "test": "testGetKeysWithValueGas", "name": "Get list of keys with a given value", - "gasUsed": 7485 + "gasUsed": 7463 }, { "file": "test/KeysWithValueModule.t.sol", @@ -81,222 +81,222 @@ "file": "test/KeysWithValueModule.t.sol", "test": "testInstall", "name": "install keys with value module", - "gasUsed": 682738 + "gasUsed": 672214 }, { "file": "test/KeysWithValueModule.t.sol", "test": "testInstall", "name": "set a record on a table with KeysWithValueModule installed", - "gasUsed": 158900 + "gasUsed": 158204 }, { "file": "test/KeysWithValueModule.t.sol", "test": "testSetAndDeleteRecordHook", "name": "install keys with value module", - "gasUsed": 682738 + "gasUsed": 672214 }, { "file": "test/KeysWithValueModule.t.sol", "test": "testSetAndDeleteRecordHook", "name": "change a record on a table with KeysWithValueModule installed", - "gasUsed": 125858 + "gasUsed": 125193 }, { "file": "test/KeysWithValueModule.t.sol", "test": "testSetAndDeleteRecordHook", "name": "delete a record on a table with KeysWithValueModule installed", - "gasUsed": 47849 + "gasUsed": 47302 }, { "file": "test/KeysWithValueModule.t.sol", "test": "testSetField", "name": "install keys with value module", - "gasUsed": 682738 + "gasUsed": 672214 }, { "file": "test/KeysWithValueModule.t.sol", "test": "testSetField", "name": "set a field on a table with KeysWithValueModule installed", - "gasUsed": 165968 + "gasUsed": 165221 }, { "file": "test/KeysWithValueModule.t.sol", "test": "testSetField", "name": "change a field on a table with KeysWithValueModule installed", - "gasUsed": 128225 + "gasUsed": 127479 }, { "file": "test/query.t.sol", "test": "testCombinedHasHasValueNotQuery", "name": "CombinedHasHasValueNotQuery", - "gasUsed": 189957 + "gasUsed": 189738 }, { "file": "test/query.t.sol", "test": "testCombinedHasHasValueQuery", "name": "CombinedHasHasValueQuery", - "gasUsed": 85236 + "gasUsed": 85117 }, { "file": "test/query.t.sol", "test": "testCombinedHasNotQuery", "name": "CombinedHasNotQuery", - "gasUsed": 268520 + "gasUsed": 268269 }, { "file": "test/query.t.sol", "test": "testCombinedHasQuery", "name": "CombinedHasQuery", - "gasUsed": 178262 + "gasUsed": 178067 }, { "file": "test/query.t.sol", "test": "testCombinedHasValueNotQuery", "name": "CombinedHasValueNotQuery", - "gasUsed": 166573 + "gasUsed": 166401 }, { "file": "test/query.t.sol", "test": "testCombinedHasValueQuery", "name": "CombinedHasValueQuery", - "gasUsed": 19104 + "gasUsed": 19057 }, { "file": "test/query.t.sol", "test": "testHasQuery", "name": "HasQuery", - "gasUsed": 41272 + "gasUsed": 41223 }, { "file": "test/query.t.sol", "test": "testHasQuery1000Keys", "name": "HasQuery with 1000 keys", - "gasUsed": 10397005 + "gasUsed": 10395747 }, { "file": "test/query.t.sol", "test": "testHasQuery100Keys", "name": "HasQuery with 100 keys", - "gasUsed": 977548 + "gasUsed": 977380 }, { "file": "test/query.t.sol", "test": "testHasValueQuery", "name": "HasValueQuery", - "gasUsed": 9228 + "gasUsed": 9205 }, { "file": "test/query.t.sol", "test": "testNotValueQuery", "name": "NotValueQuery", - "gasUsed": 78830 + "gasUsed": 78711 }, { "file": "test/UniqueEntityModule.t.sol", "test": "testInstall", "name": "install unique entity module", - "gasUsed": 769429 + "gasUsed": 753458 }, { "file": "test/UniqueEntityModule.t.sol", "test": "testInstall", "name": "get a unique entity nonce (non-root module)", - "gasUsed": 70471 + "gasUsed": 69375 }, { "file": "test/UniqueEntityModule.t.sol", "test": "testInstallRoot", "name": "installRoot unique entity module", - "gasUsed": 744949 + "gasUsed": 729850 }, { "file": "test/UniqueEntityModule.t.sol", "test": "testInstallRoot", "name": "get a unique entity nonce (root module)", - "gasUsed": 70471 + "gasUsed": 69375 }, { "file": "test/World.t.sol", "test": "testDeleteRecord", "name": "Delete record", - "gasUsed": 13595 + "gasUsed": 13320 }, { "file": "test/World.t.sol", "test": "testPushToField", "name": "Push data to the table", - "gasUsed": 93742 + "gasUsed": 93469 }, { "file": "test/World.t.sol", "test": "testRegisterFallbackSystem", "name": "Register a fallback system", - "gasUsed": 84303 + "gasUsed": 74905 }, { "file": "test/World.t.sol", "test": "testRegisterFallbackSystem", "name": "Register a root fallback system", - "gasUsed": 77463 + "gasUsed": 68398 }, { "file": "test/World.t.sol", "test": "testRegisterFunctionSelector", "name": "Register a function selector", - "gasUsed": 104894 + "gasUsed": 95499 }, { "file": "test/World.t.sol", "test": "testRegisterNamespace", "name": "Register a new namespace", - "gasUsed": 146789 + "gasUsed": 145824 }, { "file": "test/World.t.sol", "test": "testRegisterRootFunctionSelector", "name": "Register a root function selector", - "gasUsed": 93378 + "gasUsed": 84309 }, { "file": "test/World.t.sol", "test": "testRegisterTable", "name": "Register a new table in the namespace", - "gasUsed": 660749 + "gasUsed": 665054 }, { "file": "test/World.t.sol", "test": "testSetField", "name": "Write data to a table field", - "gasUsed": 42202 + "gasUsed": 41910 }, { "file": "test/World.t.sol", "test": "testSetRecord", "name": "Write data to the table", - "gasUsed": 41397 + "gasUsed": 41238 }, { "file": "test/WorldDynamicUpdate.t.sol", "test": "testPopFromField", "name": "pop 1 address (cold)", - "gasUsed": 33297 + "gasUsed": 33166 }, { "file": "test/WorldDynamicUpdate.t.sol", "test": "testPopFromField", "name": "pop 1 address (warm)", - "gasUsed": 20088 + "gasUsed": 19956 }, { "file": "test/WorldDynamicUpdate.t.sol", "test": "testUpdateInField", "name": "updateInField 1 item (cold)", - "gasUsed": 34963 + "gasUsed": 34850 }, { "file": "test/WorldDynamicUpdate.t.sol", "test": "testUpdateInField", "name": "updateInField 1 item (warm)", - "gasUsed": 22167 + "gasUsed": 22054 } ] diff --git a/packages/world/mud.config.ts b/packages/world/mud.config.ts index f000ace062..df45eb446b 100644 --- a/packages/world/mud.config.ts +++ b/packages/world/mud.config.ts @@ -89,8 +89,7 @@ export default mudConfig({ functionSelector: "bytes4", }, schema: { - namespace: "bytes16", - name: "bytes16", + resourceSelector: "bytes32", systemFunctionSelector: "bytes4", }, dataStruct: false, diff --git a/packages/world/src/AccessControl.sol b/packages/world/src/AccessControl.sol index 7701fc3392..ae42b34b02 100644 --- a/packages/world/src/AccessControl.sol +++ b/packages/world/src/AccessControl.sol @@ -13,39 +13,31 @@ library AccessControl { /** * Returns true if the caller has access to the namespace or name, false otherwise. */ - function hasAccess(bytes16 namespace, bytes16 name, address caller) internal view returns (bool) { + function hasAccess(bytes32 resourceSelector, address caller) internal view returns (bool) { return address(this) == caller || // First check if the World is calling itself - ResourceAccess.get(ResourceSelector.from(namespace, 0), caller) || // Then check access based on the namespace - ResourceAccess.get(ResourceSelector.from(namespace, name), caller); // If caller has no namespace access, check access on the name + ResourceAccess.get(resourceSelector.getNamespace(), caller) || // Then check access based on the namespace + ResourceAccess.get(resourceSelector, caller); // If caller has no namespace access, check access on the name } /** * Check for access at the given namespace or name. - * Returns the resourceSelector if the caller has access. * Reverts with AccessDenied if the caller has no access. */ - function requireAccess( - bytes16 namespace, - bytes16 name, - address caller - ) internal view returns (bytes32 resourceSelector) { - resourceSelector = ResourceSelector.from(namespace, name); - + function requireAccess(bytes32 resourceSelector, address caller) internal view { // Check if the given caller has access to the given namespace or name - if (!hasAccess(namespace, name, caller)) { + if (!hasAccess(resourceSelector, caller)) { revert IWorldErrors.AccessDenied(resourceSelector.toString(), caller); } } - function requireOwnerOrSelf( - bytes16 namespace, - bytes16 name, - address caller - ) internal view returns (bytes32 resourceSelector) { - resourceSelector = ResourceSelector.from(namespace, name); - - if (address(this) != caller && NamespaceOwner.get(namespace) != caller) { + /** + * Check for ownership of the namespace of the given resource selector + * or identity of the caller to this contract's own address. + * Reverts with AccessDenied if the check fails. + */ + function requireOwnerOrSelf(bytes32 resourceSelector, address caller) internal view { + if (address(this) != caller && NamespaceOwner.get(resourceSelector.getNamespace()) != caller) { revert IWorldErrors.AccessDenied(resourceSelector.toString(), caller); } } diff --git a/packages/world/src/World.sol b/packages/world/src/World.sol index 9ef8361508..da03421008 100644 --- a/packages/world/src/World.sol +++ b/packages/world/src/World.sol @@ -45,7 +45,7 @@ contract World is StoreRead, IStoreData, IWorldKernel { * The module is delegatecalled and installed in the root namespace. */ function installRootModule(IModule module, bytes memory args) public { - AccessControl.requireOwnerOrSelf(ROOT_NAMESPACE, ROOT_NAME, msg.sender); + AccessControl.requireOwnerOrSelf(ROOT_NAMESPACE, msg.sender); Call.withSender({ msgSender: msg.sender, @@ -66,87 +66,77 @@ contract World is StoreRead, IStoreData, IWorldKernel { ************************************************************************/ /** - * Write a record in the table at the given namespace and name. - * Requires the caller to have access to the namespace or name. + * Write a record in the table at the given tableId. + * Requires the caller to have access to the table's namespace or name (encoded in the tableId). */ - function setRecord( - bytes16 namespace, - bytes16 name, - bytes32[] calldata key, - bytes calldata data, - Schema valueSchema - ) public virtual { + function setRecord(bytes32 tableId, bytes32[] calldata key, bytes calldata data, Schema valueSchema) public virtual { // Require access to the namespace or name - bytes32 resourceSelector = AccessControl.requireAccess(namespace, name, msg.sender); + AccessControl.requireAccess(tableId, msg.sender); // Set the record - StoreCore.setRecord(resourceSelector, key, data, valueSchema); + StoreCore.setRecord(tableId, key, data, valueSchema); } /** - * Write a field in the table at the given namespace and name. - * Requires the caller to have access to the namespace or name. + * Write a field in the table at the given tableId. + * Requires the caller to have access to the table's namespace or name (encoded in the tableId). */ function setField( - bytes16 namespace, - bytes16 name, + bytes32 tableId, bytes32[] calldata key, uint8 schemaIndex, bytes calldata data, Schema valueSchema ) public virtual { // Require access to namespace or name - bytes32 resourceSelector = AccessControl.requireAccess(namespace, name, msg.sender); + AccessControl.requireAccess(tableId, msg.sender); // Set the field - StoreCore.setField(resourceSelector, key, schemaIndex, data, valueSchema); + StoreCore.setField(tableId, key, schemaIndex, data, valueSchema); } /** - * Push data to the end of a field in the table at the given namespace and name. - * Requires the caller to have access to the namespace or name. + * Push data to the end of a field in the table at the given tableId. + * Requires the caller to have access to the table's namespace or name (encoded in the tableId). */ function pushToField( - bytes16 namespace, - bytes16 name, + bytes32 tableId, bytes32[] calldata key, uint8 schemaIndex, bytes calldata dataToPush, Schema valueSchema ) public virtual { // Require access to namespace or name - bytes32 resourceSelector = AccessControl.requireAccess(namespace, name, msg.sender); + AccessControl.requireAccess(tableId, msg.sender); // Push to the field - StoreCore.pushToField(resourceSelector, key, schemaIndex, dataToPush, valueSchema); + StoreCore.pushToField(tableId, key, schemaIndex, dataToPush, valueSchema); } /** - * Pop data from the end of a field in the table at the given namespace and name. - * Requires the caller to have access to the namespace or name. + * Pop data from the end of a field in the table at the given tableId. + * Requires the caller to have access to the table's namespace or name (encoded in the tableId). */ function popFromField( - bytes16 namespace, - bytes16 name, + bytes32 tableId, bytes32[] calldata key, uint8 schemaIndex, uint256 byteLengthToPop, Schema valueSchema ) public virtual { // Require access to namespace or name - bytes32 resourceSelector = AccessControl.requireAccess(namespace, name, msg.sender); + AccessControl.requireAccess(tableId, msg.sender); // Push to the field - StoreCore.popFromField(resourceSelector, key, schemaIndex, byteLengthToPop, valueSchema); + StoreCore.popFromField(tableId, key, schemaIndex, byteLengthToPop, valueSchema); } /** - * Update data at `startByteIndex` of a field in the table at the given namespace and name. - * Requires the caller to have access to the namespace or name. + * Update data at `startByteIndex` of a field in the table at the given tableId. + * Requires the caller to have access to the table's namespace or name (encoded in the tableId). */ function updateInField( - bytes16 namespace, - bytes16 name, + bytes32 tableId, bytes32[] calldata key, uint8 schemaIndex, uint256 startByteIndex, @@ -154,107 +144,22 @@ contract World is StoreRead, IStoreData, IWorldKernel { Schema valueSchema ) public virtual { // Require access to namespace or name - bytes32 resourceSelector = AccessControl.requireAccess(namespace, name, msg.sender); + AccessControl.requireAccess(tableId, msg.sender); // Update data in the field - StoreCore.updateInField(resourceSelector, key, schemaIndex, startByteIndex, dataToSet, valueSchema); + StoreCore.updateInField(tableId, key, schemaIndex, startByteIndex, dataToSet, valueSchema); } /** - * Delete a record in the table at the given namespace and name. + * Delete a record in the table at the given tableId. * Requires the caller to have access to the namespace or name. */ - function deleteRecord(bytes16 namespace, bytes16 name, bytes32[] calldata key, Schema valueSchema) public virtual { + function deleteRecord(bytes32 tableId, bytes32[] calldata key, Schema valueSchema) public virtual { // Require access to namespace or name - bytes32 resourceSelector = AccessControl.requireAccess(namespace, name, msg.sender); + AccessControl.requireAccess(tableId, msg.sender); // Delete the record - StoreCore.deleteRecord(resourceSelector, key, valueSchema); - } - - /************************************************************************ - * - * STORE OVERRIDE METHODS - * - ************************************************************************/ - - /** - * Write a record in the table at the given tableId. - * This overload exists to conform with the `IStore` interface. - * Access is checked based on the namespace or name (encoded in the tableId). - */ - function setRecord(bytes32 tableId, bytes32[] calldata key, bytes calldata data, Schema valueSchema) public virtual { - setRecord(tableId.getNamespace(), tableId.getName(), key, data, valueSchema); - } - - /** - * Write a field in the table at the given tableId. - * This overload exists to conform with the `IStore` interface. - * Access is checked based on the namespace or name (encoded in the tableId). - */ - function setField( - bytes32 tableId, - bytes32[] calldata key, - uint8 schemaIndex, - bytes calldata data, - Schema valueSchema - ) public virtual override { - setField(tableId.getNamespace(), tableId.getName(), key, schemaIndex, data, valueSchema); - } - - /** - * Push data to the end of a field in the table at the given tableId. - * This overload exists to conform with the `IStore` interface. - * Access is checked based on the namespace or name (encoded in the tableId). - */ - function pushToField( - bytes32 tableId, - bytes32[] calldata key, - uint8 schemaIndex, - bytes calldata dataToPush, - Schema valueSchema - ) public override { - pushToField(tableId.getNamespace(), tableId.getName(), key, schemaIndex, dataToPush, valueSchema); - } - - /** - * Pop data from the end of a field in the table at the given tableId. - * This overload exists to conform with the `IStore` interface. - * Access is checked based on the namespace or name (encoded in the tableId). - */ - function popFromField( - bytes32 tableId, - bytes32[] calldata key, - uint8 schemaIndex, - uint256 byteLengthToPop, - Schema valueSchema - ) public override { - popFromField(tableId.getNamespace(), tableId.getName(), key, schemaIndex, byteLengthToPop, valueSchema); - } - - /** - * Update data at `startByteIndex` of a field in the table at the given tableId. - * This overload exists to conform with the `IStore` interface. - * Access is checked based on the namespace or name (encoded in the tableId). - */ - function updateInField( - bytes32 tableId, - bytes32[] calldata key, - uint8 schemaIndex, - uint256 startByteIndex, - bytes calldata dataToSet, - Schema valueSchema - ) public virtual { - updateInField(tableId.getNamespace(), tableId.getName(), key, schemaIndex, startByteIndex, dataToSet, valueSchema); - } - - /** - * Delete a record in the table at the given tableId. - * This overload exists to conform with the `IStore` interface. - * Access is checked based on the namespace or name (encoded in the tableId). - */ - function deleteRecord(bytes32 tableId, bytes32[] calldata key, Schema valueSchema) public virtual override { - deleteRecord(tableId.getNamespace(), tableId.getName(), key, valueSchema); + StoreCore.deleteRecord(tableId, key, valueSchema); } /************************************************************************ @@ -264,15 +169,14 @@ contract World is StoreRead, IStoreData, IWorldKernel { ************************************************************************/ /** - * Call the system at the given namespace and name. - * If the system is not public, the caller must have access to the namespace or name. + * Call the system at the given resourceSelector. + * If the system is not public, the caller must have access to the namespace or name (encoded in the resourceSelector). */ function call( - bytes16 namespace, - bytes16 name, + bytes32 resourceSelector, bytes memory funcSelectorAndArgs ) external payable virtual returns (bytes memory) { - return _call(namespace, name, funcSelectorAndArgs, msg.value); + return _call(resourceSelector, funcSelectorAndArgs, msg.value); } /** @@ -280,20 +184,18 @@ contract World is StoreRead, IStoreData, IWorldKernel { * If the system is not public, the caller must have access to the namespace or name. */ function _call( - bytes16 namespace, - bytes16 name, + bytes32 resourceSelector, bytes memory funcSelectorAndArgs, uint256 value ) internal virtual returns (bytes memory data) { // Load the system data - bytes32 resourceSelector = ResourceSelector.from(namespace, name); (address systemAddress, bool publicAccess) = Systems.get(resourceSelector); // Check if the system exists if (systemAddress == address(0)) revert ResourceNotFound(resourceSelector.toString()); // Allow access if the system is public or the caller has access to the namespace or name - if (!publicAccess) AccessControl.requireAccess(namespace, name, msg.sender); + if (!publicAccess) AccessControl.requireAccess(resourceSelector, msg.sender); // Get system hooks address[] memory hooks = SystemHooks.get(resourceSelector); @@ -309,7 +211,7 @@ contract World is StoreRead, IStoreData, IWorldKernel { msgSender: msg.sender, target: systemAddress, funcSelectorAndArgs: funcSelectorAndArgs, - delegate: namespace == ROOT_NAMESPACE, // Use delegatecall for root systems (= registered in the root namespace) + delegate: resourceSelector.getNamespace() == ROOT_NAMESPACE, // Use delegatecall for root systems (= registered in the root namespace) value: value }); @@ -335,15 +237,15 @@ contract World is StoreRead, IStoreData, IWorldKernel { * Fallback function to call registered function selectors */ fallback() external payable { - (bytes16 namespace, bytes16 name, bytes4 systemFunctionSelector) = FunctionSelectors.get(msg.sig); + (bytes32 resourceSelector, bytes4 systemFunctionSelector) = FunctionSelectors.get(msg.sig); - if (namespace == 0 && name == 0) revert FunctionSelectorNotFound(msg.sig); + if (resourceSelector == 0) revert FunctionSelectorNotFound(msg.sig); // Replace function selector in the calldata with the system function selector bytes memory callData = Bytes.setBytes4(msg.data, 0, systemFunctionSelector); - // Call the function and forward the call value - bytes memory returnData = _call(namespace, name, callData, msg.value); + // Call the function and forward the calldata and returndata + bytes memory returnData = _call(resourceSelector, callData, msg.value); assembly { return(add(returnData, 0x20), mload(returnData)) } diff --git a/packages/world/src/interfaces/IAccessManagementSystem.sol b/packages/world/src/interfaces/IAccessManagementSystem.sol index 640de4ed61..ea754bd2f5 100644 --- a/packages/world/src/interfaces/IAccessManagementSystem.sol +++ b/packages/world/src/interfaces/IAccessManagementSystem.sol @@ -4,7 +4,7 @@ pragma solidity >=0.8.0; /* Autogenerated file. Do not edit manually. */ interface IAccessManagementSystem { - function grantAccess(bytes16 namespace, bytes16 name, address grantee) external; + function grantAccess(bytes32 resourceSelector, address grantee) external; - function revokeAccess(bytes16 namespace, bytes16 name, address grantee) external; + function revokeAccess(bytes32 resourceSelector, address grantee) external; } diff --git a/packages/world/src/interfaces/IBaseWorld.sol b/packages/world/src/interfaces/IBaseWorld.sol index 1588fe2265..88806d4364 100644 --- a/packages/world/src/interfaces/IBaseWorld.sol +++ b/packages/world/src/interfaces/IBaseWorld.sol @@ -5,7 +5,6 @@ pragma solidity >=0.8.0; import { IStore } from "@latticexyz/store/src/IStore.sol"; import { IWorldKernel } from "../interfaces/IWorldKernel.sol"; -import { IWorldEphemeral } from "../interfaces/IWorldEphemeral.sol"; import { ICoreSystem } from "./ICoreSystem.sol"; import { IAccessManagementSystem } from "./IAccessManagementSystem.sol"; @@ -19,7 +18,6 @@ import { IWorldRegistrationSystem } from "./IWorldRegistrationSystem.sol"; interface IBaseWorld is IStore, IWorldKernel, - IWorldEphemeral, ICoreSystem, IAccessManagementSystem, IModuleInstallationSystem, diff --git a/packages/world/src/interfaces/IStoreRegistrationSystem.sol b/packages/world/src/interfaces/IStoreRegistrationSystem.sol deleted file mode 100644 index 2f6bf63a2c..0000000000 --- a/packages/world/src/interfaces/IStoreRegistrationSystem.sol +++ /dev/null @@ -1,14 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity >=0.8.0; - -/* Autogenerated file. Do not edit manually. */ - -import { Schema, IStoreHook } from "../modules/core/implementations/StoreRegistrationSystem.sol"; - -interface IStoreRegistrationSystem { - function registerSchema(bytes32 tableId, Schema valueSchema, Schema keySchema) external; - - function setMetadata(bytes32 tableId, string calldata tableName, string[] calldata fieldNames) external; - - function registerStoreHook(bytes32 tableId, IStoreHook hook) external; -} diff --git a/packages/world/src/interfaces/IWorldEphemeral.sol b/packages/world/src/interfaces/IWorldEphemeral.sol deleted file mode 100644 index 7616962411..0000000000 --- a/packages/world/src/interfaces/IWorldEphemeral.sol +++ /dev/null @@ -1,22 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity >=0.8.0; - -import { Schema } from "@latticexyz/store/src/Schema.sol"; - -/** - * Necessary in addition to `IStoreEphemeral` - * because 2 functions with the same name need 2 separate interfaces to allow referencing their selector - */ -interface IWorldEphemeral { - /** - * Emit the ephemeral event without modifying storage at the given namespace and name. - * Requires the caller to have access to the namespace or name. - */ - function emitEphemeralRecord( - bytes16 namespace, - bytes16 name, - bytes32[] calldata key, - bytes calldata data, - Schema valueSchema - ) external; -} diff --git a/packages/world/src/interfaces/IWorldKernel.sol b/packages/world/src/interfaces/IWorldKernel.sol index 7890c7bfd1..49763c2170 100644 --- a/packages/world/src/interfaces/IWorldKernel.sol +++ b/packages/world/src/interfaces/IWorldKernel.sol @@ -5,84 +5,6 @@ import { Schema } from "@latticexyz/store/src/Schema.sol"; import { IWorldErrors } from "./IWorldErrors.sol"; import { IModule } from "./IModule.sol"; -/** - * The IWorldData interface includes methods for reading and writing table values. - * These methods are frequently invoked during runtime, so it is essential to prioritize - * optimizing their gas cost, and they are part of the World contract's internal bytecode. - */ -interface IWorldData { - /** - * Write a record in the table at the given namespace and name. - * Requires the caller to have access to the namespace or name. - */ - function setRecord( - bytes16 namespace, - bytes16 name, - bytes32[] calldata key, - bytes calldata data, - Schema valueSchema - ) external; - - /** - * Write a field in the table at the given namespace and name. - * Requires the caller to have access to the namespace or name. - */ - function setField( - bytes16 namespace, - bytes16 name, - bytes32[] calldata key, - uint8 schemaIndex, - bytes calldata data, - Schema valueSchema - ) external; - - /** - * Push data to the end of a field in the table at the given namespace and name. - * Requires the caller to have access to the namespace or name. - */ - function pushToField( - bytes16 namespace, - bytes16 name, - bytes32[] calldata key, - uint8 schemaIndex, - bytes calldata dataToPush, - Schema valueSchema - ) external; - - /** - * Pop data from the end of a field in the table at the given namespace and name. - * Requires the caller to have access to the namespace or name. - */ - function popFromField( - bytes16 namespace, - bytes16 name, - bytes32[] calldata key, - uint8 schemaIndex, - uint256 byteLengthToPop, - Schema valueSchema - ) external; - - /** - * Update data at `startByteIndex` of a field in the table at the given namespace and name. - * Requires the caller to have access to the namespace or name. - */ - function updateInField( - bytes16 namespace, - bytes16 name, - bytes32[] calldata key, - uint8 schemaIndex, - uint256 startByteIndex, - bytes calldata dataToSet, - Schema valueSchema - ) external; - - /** - * Delete a record in the table at the given namespace and name. - * Requires the caller to have access to the namespace or name. - */ - function deleteRecord(bytes16 namespace, bytes16 name, bytes32[] calldata key, Schema valueSchema) external; -} - interface IWorldModuleInstallation { /** * Install the given root module in the World. @@ -94,14 +16,10 @@ interface IWorldModuleInstallation { interface IWorldCall { /** - * Call the system at the given namespace and name. + * Call the system at the given resource selector (namespace + name) * If the system is not public, the caller must have access to the namespace or name. */ - function call( - bytes16 namespace, - bytes16 name, - bytes memory funcSelectorAndArgs - ) external payable returns (bytes memory); + function call(bytes32 resourceSelector, bytes memory funcSelectorAndArgs) external payable returns (bytes memory); } /** @@ -111,6 +29,6 @@ interface IWorldCall { * Consumers should use the `IBaseWorld` interface instead, which includes dynamically * registered functions selectors from the `CoreModule`. */ -interface IWorldKernel is IWorldData, IWorldModuleInstallation, IWorldCall, IWorldErrors { +interface IWorldKernel is IWorldModuleInstallation, IWorldCall, IWorldErrors { event HelloWorld(); } diff --git a/packages/world/src/interfaces/IWorldRegistrationSystem.sol b/packages/world/src/interfaces/IWorldRegistrationSystem.sol index 63b7273234..bed728265a 100644 --- a/packages/world/src/interfaces/IWorldRegistrationSystem.sol +++ b/packages/world/src/interfaces/IWorldRegistrationSystem.sol @@ -3,46 +3,24 @@ pragma solidity >=0.8.0; /* Autogenerated file. Do not edit manually. */ -import { Schema } from "@latticexyz/store/src/Schema.sol"; -import { IStoreHook } from "@latticexyz/store/src/IStore.sol"; import { ISystemHook } from "./ISystemHook.sol"; import { System } from "./../System.sol"; interface IWorldRegistrationSystem { function registerNamespace(bytes16 namespace) external; - function registerTable( - bytes16 namespace, - bytes16 name, - Schema keySchema, - Schema valueSchema, - string[] calldata keyNames, - string[] calldata fieldNames - ) external returns (bytes32 resourceSelector); + function registerSystemHook(bytes32 resourceSelector, ISystemHook hook) external; - function registerHook(bytes16 namespace, bytes16 name, address hook) external; - - function registerTableHook(bytes16 namespace, bytes16 name, IStoreHook hook) external; - - function registerSystemHook(bytes16 namespace, bytes16 name, ISystemHook hook) external; - - function registerSystem( - bytes16 namespace, - bytes16 name, - System system, - bool publicAccess - ) external returns (bytes32 resourceSelector); + function registerSystem(bytes32 resourceSelector, System system, bool publicAccess) external; function registerFunctionSelector( - bytes16 namespace, - bytes16 name, + bytes32 resourceSelector, string memory systemFunctionName, string memory systemFunctionArguments ) external returns (bytes4 worldFunctionSelector); function registerRootFunctionSelector( - bytes16 namespace, - bytes16 name, + bytes32 resourceSelector, bytes4 worldFunctionSelector, bytes4 systemFunctionSelector ) external returns (bytes4); diff --git a/packages/world/src/modules/core/CoreModule.sol b/packages/world/src/modules/core/CoreModule.sol index c6fe5b0875..88ebc319b9 100644 --- a/packages/world/src/modules/core/CoreModule.sol +++ b/packages/world/src/modules/core/CoreModule.sol @@ -10,7 +10,7 @@ import { IBaseWorld } from "../../interfaces/IBaseWorld.sol"; import { IModule } from "../../interfaces/IModule.sol"; import { IStoreEphemeral } from "@latticexyz/store/src/IStore.sol"; -import { IWorldEphemeral } from "../../interfaces/IWorldEphemeral.sol"; +import { ResourceSelector } from "../../ResourceSelector.sol"; import { NamespaceOwner } from "../../tables/NamespaceOwner.sol"; import { ResourceAccess } from "../../tables/ResourceAccess.sol"; @@ -81,8 +81,7 @@ contract CoreModule is IModule, WorldContext { value: 0, funcSelectorAndArgs: abi.encodeWithSelector( WorldRegistrationSystem.registerSystem.selector, - ROOT_NAMESPACE, - CORE_SYSTEM_NAME, + ResourceSelector.from(ROOT_NAMESPACE, CORE_SYSTEM_NAME), coreSystem, true ) @@ -93,12 +92,9 @@ contract CoreModule is IModule, WorldContext { * Register function selectors for all CoreSystem functions in the World */ function _registerFunctionSelectors() internal { - bytes4[15] memory functionSelectors = [ + bytes4[11] memory functionSelectors = [ // --- WorldRegistrationSystem --- WorldRegistrationSystem.registerNamespace.selector, - WorldRegistrationSystem.registerTable.selector, - WorldRegistrationSystem.registerHook.selector, - WorldRegistrationSystem.registerTableHook.selector, WorldRegistrationSystem.registerSystemHook.selector, WorldRegistrationSystem.registerSystem.selector, WorldRegistrationSystem.registerFunctionSelector.selector, @@ -112,8 +108,7 @@ contract CoreModule is IModule, WorldContext { AccessManagementSystem.grantAccess.selector, AccessManagementSystem.revokeAccess.selector, // --- EphemeralRecordSystem --- - IStoreEphemeral.emitEphemeralRecord.selector, - IWorldEphemeral.emitEphemeralRecord.selector + IStoreEphemeral.emitEphemeralRecord.selector ]; for (uint256 i = 0; i < functionSelectors.length; i++) { @@ -126,8 +121,7 @@ contract CoreModule is IModule, WorldContext { value: 0, funcSelectorAndArgs: abi.encodeWithSelector( WorldRegistrationSystem.registerRootFunctionSelector.selector, - ROOT_NAMESPACE, - CORE_SYSTEM_NAME, + ResourceSelector.from(ROOT_NAMESPACE, CORE_SYSTEM_NAME), functionSelectors[i], functionSelectors[i] ) diff --git a/packages/world/src/modules/core/CoreSystem.sol b/packages/world/src/modules/core/CoreSystem.sol index 8a9a7df7a5..368558f929 100644 --- a/packages/world/src/modules/core/CoreSystem.sol +++ b/packages/world/src/modules/core/CoreSystem.sol @@ -3,8 +3,8 @@ pragma solidity >=0.8.0; import { IWorldErrors } from "../../interfaces/IWorldErrors.sol"; -import { WorldRegistrationSystem } from "./implementations/WorldRegistrationSystem.sol"; import { StoreRegistrationSystem } from "./implementations/StoreRegistrationSystem.sol"; +import { WorldRegistrationSystem } from "./implementations/WorldRegistrationSystem.sol"; import { ModuleInstallationSystem } from "./implementations/ModuleInstallationSystem.sol"; import { AccessManagementSystem } from "./implementations/AccessManagementSystem.sol"; import { EphemeralRecordSystem } from "./implementations/EphemeralRecordSystem.sol"; @@ -15,8 +15,8 @@ import { EphemeralRecordSystem } from "./implementations/EphemeralRecordSystem.s */ contract CoreSystem is IWorldErrors, - WorldRegistrationSystem, StoreRegistrationSystem, + WorldRegistrationSystem, ModuleInstallationSystem, AccessManagementSystem, EphemeralRecordSystem diff --git a/packages/world/src/modules/core/implementations/AccessManagementSystem.sol b/packages/world/src/modules/core/implementations/AccessManagementSystem.sol index aece45d441..df10f158e0 100644 --- a/packages/world/src/modules/core/implementations/AccessManagementSystem.sol +++ b/packages/world/src/modules/core/implementations/AccessManagementSystem.sol @@ -4,6 +4,7 @@ pragma solidity >=0.8.0; import { IModule } from "../../../interfaces/IModule.sol"; import { System } from "../../../System.sol"; import { AccessControl } from "../../../AccessControl.sol"; +import { ResourceSelector } from "../../../ResourceSelector.sol"; import { Call } from "../../../Call.sol"; import { ResourceAccess } from "../../../tables/ResourceAccess.sol"; import { InstalledModules } from "../../../tables/InstalledModules.sol"; @@ -16,9 +17,9 @@ contract AccessManagementSystem is System { * Grant access to the resource at the given namespace and name. * Requires the caller to own the namespace. */ - function grantAccess(bytes16 namespace, bytes16 name, address grantee) public virtual { + function grantAccess(bytes32 resourceSelector, address grantee) public virtual { // Require the caller to own the namespace - bytes32 resourceSelector = AccessControl.requireOwnerOrSelf(namespace, name, _msgSender()); + AccessControl.requireOwnerOrSelf(resourceSelector, _msgSender()); // Grant access to the given resource ResourceAccess.set(resourceSelector, grantee, true); @@ -28,9 +29,9 @@ contract AccessManagementSystem is System { * Revoke access from the resource at the given namespace and name. * Requires the caller to own the namespace. */ - function revokeAccess(bytes16 namespace, bytes16 name, address grantee) public virtual { + function revokeAccess(bytes32 resourceSelector, address grantee) public virtual { // Require the caller to own the namespace - bytes32 resourceSelector = AccessControl.requireOwnerOrSelf(namespace, name, _msgSender()); + AccessControl.requireOwnerOrSelf(resourceSelector, _msgSender()); // Revoke access from the given resource ResourceAccess.deleteRecord(resourceSelector, grantee); diff --git a/packages/world/src/modules/core/implementations/EphemeralRecordSystem.sol b/packages/world/src/modules/core/implementations/EphemeralRecordSystem.sol index b20fe81f57..f49bb8996b 100644 --- a/packages/world/src/modules/core/implementations/EphemeralRecordSystem.sol +++ b/packages/world/src/modules/core/implementations/EphemeralRecordSystem.sol @@ -4,7 +4,6 @@ pragma solidity >=0.8.0; import { IStoreEphemeral } from "@latticexyz/store/src/IStore.sol"; import { Schema } from "@latticexyz/store/src/Schema.sol"; import { IModule } from "../../../interfaces/IModule.sol"; -import { IWorldEphemeral } from "../../../interfaces/IWorldEphemeral.sol"; import { System } from "../../../System.sol"; import { ResourceSelector } from "../../../ResourceSelector.sol"; import { AccessControl } from "../../../AccessControl.sol"; @@ -13,38 +12,23 @@ import { ResourceAccess } from "../../../tables/ResourceAccess.sol"; import { InstalledModules } from "../../../tables/InstalledModules.sol"; import { StoreCore } from "@latticexyz/store/src/StoreCore.sol"; -contract EphemeralRecordSystem is IStoreEphemeral, IWorldEphemeral, System { +contract EphemeralRecordSystem is IStoreEphemeral, System { using ResourceSelector for bytes32; /** * Emit the ephemeral event without modifying storage at the given namespace and name. - * Requires the caller to have access to the namespace or name. + * Requires the caller to have access to the namespace or name (encoded in the resource selector) */ function emitEphemeralRecord( - bytes16 namespace, - bytes16 name, + bytes32 resourceSelector, bytes32[] calldata key, bytes calldata data, Schema valueSchema ) public virtual { // Require access to the namespace or name - bytes32 resourceSelector = AccessControl.requireAccess(namespace, name, msg.sender); + AccessControl.requireAccess(resourceSelector, msg.sender); // Set the record StoreCore.emitEphemeralRecord(resourceSelector, key, data, valueSchema); } - - /** - * Emit the ephemeral event without modifying storage at the given tableId. - * This overload exists to conform with the `IStore` interface. - * Access is checked based on the namespace or name (encoded in the tableId). - */ - function emitEphemeralRecord( - bytes32 tableId, - bytes32[] calldata key, - bytes calldata data, - Schema valueSchema - ) public virtual { - emitEphemeralRecord(tableId.getNamespace(), tableId.getName(), key, data, valueSchema); - } } diff --git a/packages/world/src/modules/core/implementations/StoreRegistrationSystem.sol b/packages/world/src/modules/core/implementations/StoreRegistrationSystem.sol index 581937e1b5..7486549f6a 100644 --- a/packages/world/src/modules/core/implementations/StoreRegistrationSystem.sol +++ b/packages/world/src/modules/core/implementations/StoreRegistrationSystem.sol @@ -1,81 +1,89 @@ // SPDX-License-Identifier: MIT pragma solidity >=0.8.0; -import { IStoreRegistration, IStoreHook } from "@latticexyz/store/src/IStore.sol"; +import { IStoreHook } from "@latticexyz/store/src/IStore.sol"; +import { StoreCore } from "@latticexyz/store/src/StoreCore.sol"; import { Schema } from "@latticexyz/store/src/Schema.sol"; import { System } from "../../../System.sol"; -import { ROOT_NAMESPACE, ROOT_NAME } from "../../../constants.sol"; import { ResourceSelector } from "../../../ResourceSelector.sol"; +import { Resource } from "../../../Types.sol"; +import { ROOT_NAMESPACE, ROOT_NAME } from "../../../constants.sol"; +import { AccessControl } from "../../../AccessControl.sol"; import { Call } from "../../../Call.sol"; +import { NamespaceOwner } from "../../../tables/NamespaceOwner.sol"; +import { ResourceAccess } from "../../../tables/ResourceAccess.sol"; +import { ISystemHook } from "../../../interfaces/ISystemHook.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"; /** - * World framework implementation of IStoreRegistration. - * - * See {IStoreRegistration} + * Functions related to registering table resources in the World. */ -contract StoreRegistrationSystem is IStoreRegistration, System { +contract StoreRegistrationSystem is System, IWorldErrors { using ResourceSelector for bytes32; /** - * Register the given key schema, value schema, key names and value names for the given table id. - * This overload exists to conform with the IStore interface. - * Access is checked based on the namespace or name (encoded in the tableId). + * Register a table with given schema in the given namespace */ function registerTable( - bytes32 tableId, + bytes32 resourceSelector, Schema keySchema, Schema valueSchema, string[] calldata keyNames, string[] calldata fieldNames ) public virtual { - (address systemAddress, ) = Systems.get(ResourceSelector.from(ROOT_NAMESPACE, CORE_SYSTEM_NAME)); + // Require the name to not be the namespace's root name + if (resourceSelector.getName() == ROOT_NAME) revert InvalidSelector(resourceSelector.toString()); + + // If the namespace doesn't exist yet, register it + bytes16 namespace = resourceSelector.getNamespace(); + if (ResourceType.get(namespace) == Resource.NONE) { + // We can't call IBaseWorld(this).registerSchema directly because it would be handled like + // an external call, so msg.sender would be the address of the World contract + (address systemAddress, ) = Systems.get(ResourceSelector.from(ROOT_NAMESPACE, CORE_SYSTEM_NAME)); + Call.withSender({ + msgSender: _msgSender(), + target: systemAddress, + funcSelectorAndArgs: abi.encodeWithSelector(WorldRegistrationSystem.registerNamespace.selector, namespace), + delegate: true, + value: 0 + }); + } else { + // otherwise require caller to own the namespace + AccessControl.requireOwnerOrSelf(namespace, _msgSender()); + } + + // Require no resource to exist at this selector yet + if (ResourceType.get(resourceSelector) != Resource.NONE) { + revert ResourceExists(resourceSelector.toString()); + } + + // Store the table resource type + ResourceType.set(resourceSelector, Resource.TABLE); - // We can't call IBaseWorld(this).registerTable directly because it would be handled like - // an external call, so msg.sender would be the address of the World contract - Call.withSender({ - msgSender: _msgSender(), - target: systemAddress, - funcSelectorAndArgs: abi.encodeWithSelector( - WorldRegistrationSystem.registerTable.selector, - tableId.getNamespace(), - tableId.getName(), - keySchema, - valueSchema, - keyNames, - fieldNames - ), - delegate: true, - value: 0 - }); + // Register the table's schema + StoreCore.registerTable(resourceSelector, keySchema, valueSchema, keyNames, fieldNames); } /** - * Register a hook for the table at the given tableId. - * This overload exists to conform with the `IStore` interface. - * Access is checked based on the namespace or name (encoded in the tableId). + * Register a hook for the table at the given namepace and name. + * Requires the caller to own the namespace. */ function registerStoreHook(bytes32 tableId, IStoreHook hook) public virtual { - (address systemAddress, ) = Systems.get(ResourceSelector.from(ROOT_NAMESPACE, CORE_SYSTEM_NAME)); + // Require caller to own the namespace + AccessControl.requireOwnerOrSelf(tableId, _msgSender()); - // We can't call IBaseWorld(this).registerStoreHook directly because it would be handled like - // an external call, so msg.sender would be the address of the World contract - Call.withSender({ - msgSender: _msgSender(), - target: systemAddress, - funcSelectorAndArgs: abi.encodeWithSelector( - WorldRegistrationSystem.registerTableHook.selector, - tableId.getNamespace(), - tableId.getName(), - hook - ), - delegate: true, - value: 0 - }); + // Register the hook + StoreCore.registerStoreHook(tableId, hook); } } diff --git a/packages/world/src/modules/core/implementations/WorldRegistrationSystem.sol b/packages/world/src/modules/core/implementations/WorldRegistrationSystem.sol index b87f34b2ae..af57701497 100644 --- a/packages/world/src/modules/core/implementations/WorldRegistrationSystem.sol +++ b/packages/world/src/modules/core/implementations/WorldRegistrationSystem.sol @@ -1,10 +1,6 @@ // SPDX-License-Identifier: MIT pragma solidity >=0.8.0; -import { IStoreHook } from "@latticexyz/store/src/IStore.sol"; -import { StoreCore } from "@latticexyz/store/src/StoreCore.sol"; -import { Schema } from "@latticexyz/store/src/Schema.sol"; - import { System } from "../../../System.sol"; import { ResourceSelector } from "../../../ResourceSelector.sol"; import { Resource } from "../../../Types.sol"; @@ -22,7 +18,8 @@ import { Systems } from "../tables/Systems.sol"; import { FunctionSelectors } from "../tables/FunctionSelectors.sol"; /** - * Functions related to registering resources in the World. + * Functions related to registering resources other than tables in the World. + * Registering tables is implemented in StoreRegistrationSystem.sol */ contract WorldRegistrationSystem is System, IWorldErrors { using ResourceSelector for bytes32; @@ -46,76 +43,12 @@ contract WorldRegistrationSystem is System, IWorldErrors { ResourceAccess.set(resourceSelector, _msgSender(), true); } - /** - * Register a table with given schema in the given namespace - */ - function registerTable( - bytes16 namespace, - bytes16 name, - Schema keySchema, - Schema valueSchema, - string[] calldata keyNames, - string[] calldata fieldNames - ) public virtual returns (bytes32 resourceSelector) { - resourceSelector = ResourceSelector.from(namespace, name); - - // Require the name to not be the namespace's root name - if (name == ROOT_NAME) revert InvalidSelector(resourceSelector.toString()); - - // If the namespace doesn't exist yet, register it - // otherwise require caller to own the namespace - if (ResourceType.get(namespace) == Resource.NONE) registerNamespace(namespace); - else AccessControl.requireOwnerOrSelf(namespace, ROOT_NAME, _msgSender()); - - // Require no resource to exist at this selector yet - if (ResourceType.get(resourceSelector) != Resource.NONE) { - revert ResourceExists(resourceSelector.toString()); - } - - // Store the table resource type - ResourceType.set(resourceSelector, Resource.TABLE); - - // Register the table's schema - StoreCore.registerTable(resourceSelector, keySchema, valueSchema, keyNames, fieldNames); - } - - /** - * Register the given store hook for the table at the given namespace and name. - * Hooks on table names must implement the IStoreHook interface, - * and hooks on system names must implement the ISystemHook interface. - */ - function registerHook(bytes16 namespace, bytes16 name, address hook) public virtual { - Resource resourceType = ResourceType.get(ResourceSelector.from(namespace, name)); - - if (resourceType == Resource.TABLE) { - return registerTableHook(namespace, name, IStoreHook(hook)); - } - - if (resourceType == Resource.SYSTEM) { - return registerSystemHook(namespace, name, ISystemHook(hook)); - } - - revert InvalidSelector(ResourceSelector.from(namespace, name).toString()); - } - - /** - * Register a hook for the table at the given namepace and name. - * Requires the caller to own the namespace. - */ - function registerTableHook(bytes16 namespace, bytes16 name, IStoreHook hook) public virtual { - // Require caller to own the namespace - bytes32 resourceSelector = AccessControl.requireOwnerOrSelf(namespace, name, _msgSender()); - - // Register the hook - StoreCore.registerStoreHook(resourceSelector, hook); - } - /** * Register a hook for the system at the given namespace and name */ - function registerSystemHook(bytes16 namespace, bytes16 name, ISystemHook hook) public virtual { + function registerSystemHook(bytes32 resourceSelector, ISystemHook hook) public virtual { // Require caller to own the namespace - bytes32 resourceSelector = AccessControl.requireOwnerOrSelf(namespace, name, _msgSender()); + AccessControl.requireOwnerOrSelf(resourceSelector, _msgSender()); // Register the hook SystemHooks.push(resourceSelector, address(hook)); @@ -127,24 +60,18 @@ contract WorldRegistrationSystem is System, IWorldErrors { * 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. */ - function registerSystem( - bytes16 namespace, - bytes16 name, - System system, - bool publicAccess - ) public virtual returns (bytes32 resourceSelector) { - resourceSelector = ResourceSelector.from(namespace, name); - + function registerSystem(bytes32 resourceSelector, System system, bool publicAccess) public virtual { // Require the name to not be the namespace's root name - if (name == ROOT_NAME) revert InvalidSelector(resourceSelector.toString()); + if (resourceSelector.getName() == ROOT_NAME) revert InvalidSelector(resourceSelector.toString()); // Require the system to not exist yet if (SystemRegistry.get(address(system)) != 0) revert SystemExists(address(system)); // If the namespace doesn't exist yet, register it // otherwise require caller to own the namespace + bytes16 namespace = resourceSelector.getNamespace(); if (ResourceType.get(namespace) == Resource.NONE) registerNamespace(namespace); - else AccessControl.requireOwnerOrSelf(namespace, ROOT_NAME, _msgSender()); + else AccessControl.requireOwnerOrSelf(namespace, _msgSender()); // Require no resource to exist at this selector yet if (ResourceType.get(resourceSelector) != Resource.NONE) { @@ -171,33 +98,31 @@ contract WorldRegistrationSystem is System, IWorldErrors { * (see https://github.com/latticexyz/mud/issues/444) */ function registerFunctionSelector( - bytes16 namespace, - bytes16 name, + bytes32 resourceSelector, string memory systemFunctionName, string memory systemFunctionArguments ) public returns (bytes4 worldFunctionSelector) { // Require the caller to own the namespace - AccessControl.requireOwnerOrSelf(namespace, name, _msgSender()); + AccessControl.requireOwnerOrSelf(resourceSelector, _msgSender()); // Compute global function selector - string memory namespaceString = ResourceSelector.toTrimmedString(namespace); - string memory nameString = ResourceSelector.toTrimmedString(name); + string memory namespaceString = ResourceSelector.toTrimmedString(resourceSelector.getNamespace()); + string memory nameString = ResourceSelector.toTrimmedString(resourceSelector.getName()); worldFunctionSelector = bytes4( keccak256(abi.encodePacked(namespaceString, "_", nameString, "_", systemFunctionName, systemFunctionArguments)) ); // Require the function selector to be globally unique - bytes16 existingNamespace = FunctionSelectors.getNamespace(worldFunctionSelector); - bytes16 existingName = FunctionSelectors.getName(worldFunctionSelector); + bytes32 existingResourceSelector = FunctionSelectors.getResourceSelector(worldFunctionSelector); - if (existingNamespace != 0 || existingName != 0) revert FunctionSelectorExists(worldFunctionSelector); + if (existingResourceSelector != 0) revert FunctionSelectorExists(worldFunctionSelector); // Register the function selector bytes memory systemFunctionSignature = abi.encodePacked(systemFunctionName, systemFunctionArguments); bytes4 systemFunctionSelector = systemFunctionSignature.length == 0 ? bytes4(0) // Save gas by storing 0x0 for empty function signatures (= fallback function) : bytes4(keccak256(systemFunctionSignature)); - FunctionSelectors.set(worldFunctionSelector, namespace, name, systemFunctionSelector); + FunctionSelectors.set(worldFunctionSelector, resourceSelector, systemFunctionSelector); } /** @@ -208,22 +133,20 @@ contract WorldRegistrationSystem is System, IWorldErrors { * (see https://github.com/latticexyz/mud/issues/444) */ function registerRootFunctionSelector( - bytes16 namespace, - bytes16 name, + bytes32 resourceSelector, bytes4 worldFunctionSelector, bytes4 systemFunctionSelector ) public returns (bytes4) { // Require the caller to own the root namespace - AccessControl.requireOwnerOrSelf(ROOT_NAMESPACE, ROOT_NAME, _msgSender()); + AccessControl.requireOwnerOrSelf(ROOT_NAMESPACE, _msgSender()); // Require the function selector to be globally unique - bytes16 existingNamespace = FunctionSelectors.getNamespace(worldFunctionSelector); - bytes16 existingName = FunctionSelectors.getName(worldFunctionSelector); + bytes32 existingResourceSelector = FunctionSelectors.getResourceSelector(worldFunctionSelector); - if (!(existingNamespace == 0 && existingName == 0)) revert FunctionSelectorExists(worldFunctionSelector); + if (existingResourceSelector != 0) revert FunctionSelectorExists(worldFunctionSelector); // Register the function selector - FunctionSelectors.set(worldFunctionSelector, namespace, name, systemFunctionSelector); + FunctionSelectors.set(worldFunctionSelector, resourceSelector, systemFunctionSelector); return worldFunctionSelector; } diff --git a/packages/world/src/modules/core/tables/FunctionSelectors.sol b/packages/world/src/modules/core/tables/FunctionSelectors.sol index 93468d6327..7e87cd6ad0 100644 --- a/packages/world/src/modules/core/tables/FunctionSelectors.sol +++ b/packages/world/src/modules/core/tables/FunctionSelectors.sol @@ -31,10 +31,9 @@ library FunctionSelectors { /** Get the table's value schema */ function getValueSchema() internal pure returns (Schema) { - SchemaType[] memory _schema = new SchemaType[](3); - _schema[0] = SchemaType.BYTES16; - _schema[1] = SchemaType.BYTES16; - _schema[2] = SchemaType.BYTES4; + SchemaType[] memory _schema = new SchemaType[](2); + _schema[0] = SchemaType.BYTES32; + _schema[1] = SchemaType.BYTES4; return SchemaLib.encode(_schema); } @@ -47,10 +46,9 @@ library FunctionSelectors { /** Get the table's field names */ function getFieldNames() internal pure returns (string[] memory fieldNames) { - fieldNames = new string[](3); - fieldNames[0] = "namespace"; - fieldNames[1] = "name"; - fieldNames[2] = "systemFunctionSelector"; + fieldNames = new string[](2); + fieldNames[0] = "resourceSelector"; + fieldNames[1] = "systemFunctionSelector"; } /** Register the table's key schema, value schema, key names and value names */ @@ -63,72 +61,41 @@ library FunctionSelectors { _store.registerTable(_tableId, getKeySchema(), getValueSchema(), getKeyNames(), getFieldNames()); } - /** Get namespace */ - function getNamespace(bytes4 functionSelector) internal view returns (bytes16 namespace) { + /** Get resourceSelector */ + function getResourceSelector(bytes4 functionSelector) internal view returns (bytes32 resourceSelector) { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = bytes32(functionSelector); bytes memory _blob = StoreSwitch.getField(_tableId, _keyTuple, 0, getValueSchema()); - return (Bytes.slice16(_blob, 0)); + return (Bytes.slice32(_blob, 0)); } - /** Get namespace (using the specified store) */ - function getNamespace(IStore _store, bytes4 functionSelector) internal view returns (bytes16 namespace) { + /** Get resourceSelector (using the specified store) */ + function getResourceSelector( + IStore _store, + bytes4 functionSelector + ) internal view returns (bytes32 resourceSelector) { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = bytes32(functionSelector); bytes memory _blob = _store.getField(_tableId, _keyTuple, 0, getValueSchema()); - return (Bytes.slice16(_blob, 0)); - } - - /** Set namespace */ - function setNamespace(bytes4 functionSelector, bytes16 namespace) internal { - bytes32[] memory _keyTuple = new bytes32[](1); - _keyTuple[0] = bytes32(functionSelector); - - StoreSwitch.setField(_tableId, _keyTuple, 0, abi.encodePacked((namespace)), getValueSchema()); + return (Bytes.slice32(_blob, 0)); } - /** Set namespace (using the specified store) */ - function setNamespace(IStore _store, bytes4 functionSelector, bytes16 namespace) internal { + /** Set resourceSelector */ + function setResourceSelector(bytes4 functionSelector, bytes32 resourceSelector) internal { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = bytes32(functionSelector); - _store.setField(_tableId, _keyTuple, 0, abi.encodePacked((namespace)), getValueSchema()); + StoreSwitch.setField(_tableId, _keyTuple, 0, abi.encodePacked((resourceSelector)), getValueSchema()); } - /** Get name */ - function getName(bytes4 functionSelector) internal view returns (bytes16 name) { + /** Set resourceSelector (using the specified store) */ + function setResourceSelector(IStore _store, bytes4 functionSelector, bytes32 resourceSelector) internal { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = bytes32(functionSelector); - bytes memory _blob = StoreSwitch.getField(_tableId, _keyTuple, 1, getValueSchema()); - return (Bytes.slice16(_blob, 0)); - } - - /** Get name (using the specified store) */ - function getName(IStore _store, bytes4 functionSelector) internal view returns (bytes16 name) { - bytes32[] memory _keyTuple = new bytes32[](1); - _keyTuple[0] = bytes32(functionSelector); - - bytes memory _blob = _store.getField(_tableId, _keyTuple, 1, getValueSchema()); - return (Bytes.slice16(_blob, 0)); - } - - /** Set name */ - function setName(bytes4 functionSelector, bytes16 name) internal { - bytes32[] memory _keyTuple = new bytes32[](1); - _keyTuple[0] = bytes32(functionSelector); - - StoreSwitch.setField(_tableId, _keyTuple, 1, abi.encodePacked((name)), getValueSchema()); - } - - /** Set name (using the specified store) */ - function setName(IStore _store, bytes4 functionSelector, bytes16 name) internal { - bytes32[] memory _keyTuple = new bytes32[](1); - _keyTuple[0] = bytes32(functionSelector); - - _store.setField(_tableId, _keyTuple, 1, abi.encodePacked((name)), getValueSchema()); + _store.setField(_tableId, _keyTuple, 0, abi.encodePacked((resourceSelector)), getValueSchema()); } /** Get systemFunctionSelector */ @@ -136,7 +103,7 @@ library FunctionSelectors { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = bytes32(functionSelector); - bytes memory _blob = StoreSwitch.getField(_tableId, _keyTuple, 2, getValueSchema()); + bytes memory _blob = StoreSwitch.getField(_tableId, _keyTuple, 1, getValueSchema()); return (Bytes.slice4(_blob, 0)); } @@ -148,7 +115,7 @@ library FunctionSelectors { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = bytes32(functionSelector); - bytes memory _blob = _store.getField(_tableId, _keyTuple, 2, getValueSchema()); + bytes memory _blob = _store.getField(_tableId, _keyTuple, 1, getValueSchema()); return (Bytes.slice4(_blob, 0)); } @@ -157,7 +124,7 @@ library FunctionSelectors { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = bytes32(functionSelector); - StoreSwitch.setField(_tableId, _keyTuple, 2, abi.encodePacked((systemFunctionSelector)), getValueSchema()); + StoreSwitch.setField(_tableId, _keyTuple, 1, abi.encodePacked((systemFunctionSelector)), getValueSchema()); } /** Set systemFunctionSelector (using the specified store) */ @@ -165,13 +132,13 @@ library FunctionSelectors { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = bytes32(functionSelector); - _store.setField(_tableId, _keyTuple, 2, abi.encodePacked((systemFunctionSelector)), getValueSchema()); + _store.setField(_tableId, _keyTuple, 1, abi.encodePacked((systemFunctionSelector)), getValueSchema()); } /** Get the full data */ function get( bytes4 functionSelector - ) internal view returns (bytes16 namespace, bytes16 name, bytes4 systemFunctionSelector) { + ) internal view returns (bytes32 resourceSelector, bytes4 systemFunctionSelector) { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = bytes32(functionSelector); @@ -183,7 +150,7 @@ library FunctionSelectors { function get( IStore _store, bytes4 functionSelector - ) internal view returns (bytes16 namespace, bytes16 name, bytes4 systemFunctionSelector) { + ) internal view returns (bytes32 resourceSelector, bytes4 systemFunctionSelector) { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = bytes32(functionSelector); @@ -192,8 +159,8 @@ library FunctionSelectors { } /** Set the full data using individual values */ - function set(bytes4 functionSelector, bytes16 namespace, bytes16 name, bytes4 systemFunctionSelector) internal { - bytes memory _data = encode(namespace, name, systemFunctionSelector); + function set(bytes4 functionSelector, bytes32 resourceSelector, bytes4 systemFunctionSelector) internal { + bytes memory _data = encode(resourceSelector, systemFunctionSelector); bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = bytes32(functionSelector); @@ -205,11 +172,10 @@ library FunctionSelectors { function set( IStore _store, bytes4 functionSelector, - bytes16 namespace, - bytes16 name, + bytes32 resourceSelector, bytes4 systemFunctionSelector ) internal { - bytes memory _data = encode(namespace, name, systemFunctionSelector); + bytes memory _data = encode(resourceSelector, systemFunctionSelector); bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = bytes32(functionSelector); @@ -218,19 +184,15 @@ library FunctionSelectors { } /** Decode the tightly packed blob using this table's schema */ - function decode( - bytes memory _blob - ) internal pure returns (bytes16 namespace, bytes16 name, bytes4 systemFunctionSelector) { - namespace = (Bytes.slice16(_blob, 0)); - - name = (Bytes.slice16(_blob, 16)); + function decode(bytes memory _blob) internal pure returns (bytes32 resourceSelector, bytes4 systemFunctionSelector) { + resourceSelector = (Bytes.slice32(_blob, 0)); systemFunctionSelector = (Bytes.slice4(_blob, 32)); } /** Tightly pack full data using this table's schema */ - function encode(bytes16 namespace, bytes16 name, bytes4 systemFunctionSelector) internal pure returns (bytes memory) { - return abi.encodePacked(namespace, name, systemFunctionSelector); + function encode(bytes32 resourceSelector, bytes4 systemFunctionSelector) internal pure returns (bytes memory) { + return abi.encodePacked(resourceSelector, systemFunctionSelector); } /** Encode keys as a bytes32 array using this table's schema */ diff --git a/packages/world/src/modules/keysintable/KeysInTableModule.sol b/packages/world/src/modules/keysintable/KeysInTableModule.sol index 74abc6ad84..a80e7de6c2 100644 --- a/packages/world/src/modules/keysintable/KeysInTableModule.sol +++ b/packages/world/src/modules/keysintable/KeysInTableModule.sol @@ -47,8 +47,8 @@ contract KeysInTableModule is IModule, WorldContext { UsedKeysIndex.register(world); // Grant the hook access to the tables - world.grantAccess(KeysInTableTableId.getNamespace(), KeysInTableTableId.getName(), address(hook)); - world.grantAccess(UsedKeysIndexTableId.getNamespace(), UsedKeysIndexTableId.getName(), address(hook)); + world.grantAccess(KeysInTableTableId, address(hook)); + world.grantAccess(UsedKeysIndexTableId, address(hook)); } // Register a hook that is called when a value is set in the source table diff --git a/packages/world/src/modules/keyswithvalue/KeysWithValueModule.sol b/packages/world/src/modules/keyswithvalue/KeysWithValueModule.sol index 43c8ca34cb..575ae3238f 100644 --- a/packages/world/src/modules/keyswithvalue/KeysWithValueModule.sol +++ b/packages/world/src/modules/keyswithvalue/KeysWithValueModule.sol @@ -45,7 +45,7 @@ contract KeysWithValueModule is IModule, WorldContext { KeysWithValue.register(IBaseWorld(_world()), targetTableSelector); // Grant the hook access to the target table - IBaseWorld(_world()).grantAccess(targetTableSelector.getNamespace(), targetTableSelector.getName(), address(hook)); + IBaseWorld(_world()).grantAccess(targetTableSelector, address(hook)); // Register a hook that is called when a value is set in the source table StoreSwitch.registerStoreHook(sourceTableId, hook); diff --git a/packages/world/src/modules/uniqueentity/UniqueEntityModule.sol b/packages/world/src/modules/uniqueentity/UniqueEntityModule.sol index 05ffefa7dc..b817e4a531 100644 --- a/packages/world/src/modules/uniqueentity/UniqueEntityModule.sol +++ b/packages/world/src/modules/uniqueentity/UniqueEntityModule.sol @@ -32,9 +32,9 @@ contract UniqueEntityModule is IModule, WorldContext { UniqueEntity.register(world, ResourceSelector.from(NAMESPACE, TABLE_NAME)); // Register system - world.registerSystem(NAMESPACE, SYSTEM_NAME, uniqueEntitySystem, true); + world.registerSystem(ResourceSelector.from(NAMESPACE, SYSTEM_NAME), uniqueEntitySystem, true); // Register system's functions - world.registerFunctionSelector(NAMESPACE, SYSTEM_NAME, "getUniqueEntity", "()"); + world.registerFunctionSelector(ResourceSelector.from(NAMESPACE, SYSTEM_NAME), "getUniqueEntity", "()"); } } diff --git a/packages/world/test/AccessControl.t.sol b/packages/world/test/AccessControl.t.sol index fcafb4f67d..39092d375c 100644 --- a/packages/world/test/AccessControl.t.sol +++ b/packages/world/test/AccessControl.t.sol @@ -21,35 +21,35 @@ contract AccessControlTest is Test, StoreReadWithStubs { NamespaceOwner.register(); NamespaceOwner.set(namespace, address(this)); - ResourceAccess.set(ResourceSelector.from(namespace, 0), address(this), true); + ResourceAccess.set(ResourceSelector.from(namespace), address(this), true); } function testAccessControl() public { // Check that the caller has no access to the namespace or name - assertFalse(AccessControl.hasAccess(namespace, name, caller)); + assertFalse(AccessControl.hasAccess(ResourceSelector.from(namespace, name), caller)); // Grant access to the namespace ResourceAccess.set(ResourceSelector.from(namespace, 0), caller, true); // Check that the caller has access to the namespace or name - assertTrue(AccessControl.hasAccess(namespace, name, caller)); + assertTrue(AccessControl.hasAccess(ResourceSelector.from(namespace, name), caller)); // Revoke access to the namespace ResourceAccess.set(ResourceSelector.from(namespace, 0), caller, false); // Check that the caller has no access to the namespace or name - assertFalse(AccessControl.hasAccess(namespace, name, caller)); + assertFalse(AccessControl.hasAccess(ResourceSelector.from(namespace, name), caller)); // Grant access to the name ResourceAccess.set(ResourceSelector.from(namespace, name), caller, true); // Check that the caller has access to the name - assertTrue(AccessControl.hasAccess(namespace, name, caller)); + assertTrue(AccessControl.hasAccess(ResourceSelector.from(namespace, name), caller)); // Revoke access to the name ResourceAccess.set(ResourceSelector.from(namespace, name), caller, false); // Check that the caller has no access to the namespace or name - assertFalse(AccessControl.hasAccess(namespace, name, caller)); + assertFalse(AccessControl.hasAccess(ResourceSelector.from(namespace, name), caller)); } } diff --git a/packages/world/test/KeysInTableModule.t.sol b/packages/world/test/KeysInTableModule.t.sol index a1547985c1..1968d14a00 100644 --- a/packages/world/test/KeysInTableModule.t.sol +++ b/packages/world/test/KeysInTableModule.t.sol @@ -38,9 +38,9 @@ contract KeysInTableModuleTest is Test, GasReporter { Schema tableKeySchema; Schema singletonKeySchema; Schema compositeKeySchema; - bytes32 tableId; - bytes32 singletonTableId; - bytes32 compositeTableId; + bytes32 tableId = ResourceSelector.from(namespace, name); + bytes32 singletonTableId = ResourceSelector.from(namespace, singletonName); + bytes32 compositeTableId = ResourceSelector.from(namespace, compositeName); uint256 val1 = 123; uint256 val2 = 42; @@ -65,23 +65,9 @@ contract KeysInTableModuleTest is Test, GasReporter { function _installKeysInTableModule() internal { // Register source table - tableId = world.registerTable(namespace, name, tableKeySchema, tableValueSchema, new string[](1), new string[](1)); - singletonTableId = world.registerTable( - namespace, - singletonName, - singletonKeySchema, - tableValueSchema, - new string[](0), - new string[](1) - ); - compositeTableId = world.registerTable( - namespace, - compositeName, - compositeKeySchema, - tableValueSchema, - new string[](3), - new string[](1) - ); + world.registerTable(tableId, tableKeySchema, tableValueSchema, new string[](1), new string[](1)); + world.registerTable(singletonTableId, singletonKeySchema, tableValueSchema, new string[](0), new string[](1)); + world.registerTable(compositeTableId, compositeKeySchema, tableValueSchema, new string[](3), new string[](1)); // Install the index module // TODO: add support for installing this via installModule @@ -100,7 +86,7 @@ contract KeysInTableModuleTest is Test, GasReporter { bytes32[] memory keyTuple = new bytes32[](0); - world.setRecord(namespace, singletonName, keyTuple, abi.encodePacked(val1), tableValueSchema); + world.setRecord(singletonTableId, keyTuple, abi.encodePacked(val1), tableValueSchema); // Get the list of keys in this target table bytes32[][] memory keysInTable = getKeysInTable(world, singletonTableId); @@ -117,7 +103,7 @@ contract KeysInTableModuleTest is Test, GasReporter { keyTuple[1] = "two"; keyTuple[2] = "three"; - world.setRecord(namespace, compositeName, keyTuple, abi.encodePacked(val1), tableValueSchema); + world.setRecord(compositeTableId, keyTuple, abi.encodePacked(val1), tableValueSchema); // Get the list of keys in this target table bytes32[][] memory keysInTable = getKeysInTable(world, compositeTableId); @@ -142,7 +128,7 @@ contract KeysInTableModuleTest is Test, GasReporter { _installKeysInTableModule(); // Set a value in the source table startGasReport("set a record on a table with keysInTableModule installed"); - world.setRecord(namespace, name, keyTuple1, abi.encodePacked(value), tableValueSchema); + world.setRecord(tableId, keyTuple1, abi.encodePacked(value), tableValueSchema); endGasReport(); // Get the list of keys in this target table @@ -161,7 +147,7 @@ contract KeysInTableModuleTest is Test, GasReporter { // Set a value in the source table startGasReport("set a record on a table with keysInTableModule installed (first)"); - world.setRecord(namespace, name, keyTuple, abi.encodePacked(value1), tableValueSchema); + world.setRecord(tableId, keyTuple, abi.encodePacked(value1), tableValueSchema); endGasReport(); // Get the list of keys in the first target table @@ -173,14 +159,8 @@ contract KeysInTableModuleTest is Test, GasReporter { // Install the hook on the second table bytes16 sourceFile2 = bytes16("source2"); - bytes32 sourceTableId2 = world.registerTable( - namespace, - sourceFile2, - tableValueSchema, - tableKeySchema, - new string[](1), - new string[](1) - ); + bytes32 sourceTableId2 = ResourceSelector.from(namespace, sourceFile2); + world.registerTable(sourceTableId2, tableValueSchema, tableKeySchema, new string[](1), new string[](1)); world.installRootModule(keysInTableModule, abi.encode(sourceTableId2)); keyTuple = new bytes32[](1); @@ -188,7 +168,7 @@ contract KeysInTableModuleTest is Test, GasReporter { // Set a value in the source table startGasReport("set a record on a table with keysInTableModule installed (second)"); - world.setRecord(namespace, sourceFile2, keyTuple, abi.encodePacked(value2), tableValueSchema); + world.setRecord(sourceTableId2, keyTuple, abi.encodePacked(value2), tableValueSchema); endGasReport(); // Get the list of keys in the second target table @@ -208,7 +188,7 @@ contract KeysInTableModuleTest is Test, GasReporter { _installKeysInTableModule(); // Set a value in the source table - world.setRecord(namespace, name, keyTuple1, abi.encodePacked(value1), tableValueSchema); + world.setRecord(tableId, keyTuple1, abi.encodePacked(value1), tableValueSchema); // Get the list of keys in the target table bytes32[][] memory keysInTable = getKeysInTable(world, tableId); @@ -218,7 +198,7 @@ contract KeysInTableModuleTest is Test, GasReporter { assertEq(keysInTable[0][0], key1, "2"); // Set another key with the same value - world.setRecord(namespace, name, keyTuple2, abi.encodePacked(value1), tableValueSchema); + world.setRecord(tableId, keyTuple2, abi.encodePacked(value1), tableValueSchema); // Get the list of keys in the target table keysInTable = getKeysInTable(world, tableId); @@ -230,7 +210,7 @@ contract KeysInTableModuleTest is Test, GasReporter { // Change the value of the first key startGasReport("change a record on a table with keysInTableModule installed"); - world.setRecord(namespace, name, keyTuple1, abi.encodePacked(value2), tableValueSchema); + world.setRecord(tableId, keyTuple1, abi.encodePacked(value2), tableValueSchema); endGasReport(); // Get the list of keys in the target table @@ -243,7 +223,7 @@ contract KeysInTableModuleTest is Test, GasReporter { // Delete the first key startGasReport("delete a record on a table with keysInTableModule installed"); - world.deleteRecord(namespace, name, keyTuple1, tableValueSchema); + world.deleteRecord(tableId, keyTuple1, tableValueSchema); endGasReport(); // Get the list of keys in the target table @@ -273,7 +253,7 @@ contract KeysInTableModuleTest is Test, GasReporter { keyTupleB[2] = "charlie"; // Set a value in the source table - world.setRecord(namespace, compositeName, keyTupleA, abi.encodePacked(value1), tableValueSchema); + world.setRecord(compositeTableId, keyTupleA, abi.encodePacked(value1), tableValueSchema); // Get the list of keys in the target table bytes32[][] memory keysInTable = getKeysInTable(world, compositeTableId); @@ -285,7 +265,7 @@ contract KeysInTableModuleTest is Test, GasReporter { } // Set another key with the same value - world.setRecord(namespace, compositeName, keyTupleB, abi.encodePacked(value1), tableValueSchema); + world.setRecord(compositeTableId, keyTupleB, abi.encodePacked(value1), tableValueSchema); // Get the list of keys in the target table keysInTable = getKeysInTable(world, compositeTableId); @@ -301,7 +281,7 @@ contract KeysInTableModuleTest is Test, GasReporter { // Change the value of the first key startGasReport("change a composite record on a table with keysInTableModule installed"); - world.setRecord(namespace, compositeName, keyTupleA, abi.encodePacked(value2), tableValueSchema); + world.setRecord(compositeTableId, keyTupleA, abi.encodePacked(value2), tableValueSchema); endGasReport(); // Get the list of keys in the target table @@ -318,7 +298,7 @@ contract KeysInTableModuleTest is Test, GasReporter { // Delete the first key startGasReport("delete a composite record on a table with keysInTableModule installed"); - world.deleteRecord(namespace, compositeName, keyTupleA, tableValueSchema); + world.deleteRecord(compositeTableId, keyTupleA, tableValueSchema); endGasReport(); // Get the list of keys in the target table @@ -336,7 +316,7 @@ contract KeysInTableModuleTest is Test, GasReporter { // Set a value in the source table startGasReport("set a field on a table with keysInTableModule installed"); - world.setField(namespace, name, keyTuple1, 0, abi.encodePacked(value1), tableValueSchema); + world.setField(tableId, keyTuple1, 0, abi.encodePacked(value1), tableValueSchema); endGasReport(); // Get the list of keys in the target table @@ -348,7 +328,7 @@ contract KeysInTableModuleTest is Test, GasReporter { // Change the value using setField startGasReport("change a field on a table with keysInTableModule installed"); - world.setField(namespace, name, keyTuple1, 0, abi.encodePacked(value2), tableValueSchema); + world.setField(tableId, keyTuple1, 0, abi.encodePacked(value2), tableValueSchema); endGasReport(); // Get the list of keys in the target table @@ -363,7 +343,7 @@ contract KeysInTableModuleTest is Test, GasReporter { _installKeysInTableModule(); // Set a value in the source table - world.setRecord(namespace, name, keyTuple1, abi.encodePacked(value1), tableValueSchema); + world.setRecord(tableId, keyTuple1, abi.encodePacked(value1), tableValueSchema); startGasReport("Get list of keys in a given table"); bytes32[][] memory keysInTable = getKeysInTable(world, tableId); @@ -374,7 +354,7 @@ contract KeysInTableModuleTest is Test, GasReporter { assertEq(keysInTable[0][0], key1); // Set another key with a different value - world.setRecord(namespace, name, keyTuple2, abi.encodePacked(value2), tableValueSchema); + world.setRecord(tableId, keyTuple2, abi.encodePacked(value2), tableValueSchema); // Get the list of keys in the target table keysInTable = getKeysInTable(world, tableId); @@ -389,14 +369,14 @@ contract KeysInTableModuleTest is Test, GasReporter { _installKeysInTableModule(); // Add 3 values - world.setRecord(namespace, name, keyTuple1, abi.encodePacked(value), tableValueSchema); - world.setRecord(namespace, name, keyTuple2, abi.encodePacked(value), tableValueSchema); - world.setRecord(namespace, name, keyTuple3, abi.encodePacked(value), tableValueSchema); + world.setRecord(tableId, keyTuple1, abi.encodePacked(value), tableValueSchema); + world.setRecord(tableId, keyTuple2, abi.encodePacked(value), tableValueSchema); + world.setRecord(tableId, keyTuple3, abi.encodePacked(value), tableValueSchema); // Remove 2, starting from the middle // This tests that KeysInTable correctly tracks swaps indexes - world.deleteRecord(namespace, name, keyTuple2, tableValueSchema); - world.deleteRecord(namespace, name, keyTuple3, tableValueSchema); + world.deleteRecord(tableId, keyTuple2, tableValueSchema); + world.deleteRecord(tableId, keyTuple3, tableValueSchema); // Get the list of keys in the target table bytes32[][] memory keysInTable = getKeysInTable(world, tableId); diff --git a/packages/world/test/KeysWithValueModule.t.sol b/packages/world/test/KeysWithValueModule.t.sol index 3f55d0b8d7..4e27ae8cc7 100644 --- a/packages/world/test/KeysWithValueModule.t.sol +++ b/packages/world/test/KeysWithValueModule.t.sol @@ -52,14 +52,7 @@ contract KeysWithValueModuleTest is Test, GasReporter { function _installKeysWithValueModule() internal { // Register source table - sourceTableId = world.registerTable( - namespace, - sourceName, - sourceTableSchema, - sourceTableKeySchema, - new string[](1), - new string[](1) - ); + world.registerTable(sourceTableId, sourceTableSchema, sourceTableKeySchema, new string[](1), new string[](1)); // Install the index module // TODO: add support for installing this via installModule @@ -75,7 +68,7 @@ contract KeysWithValueModuleTest is Test, GasReporter { uint256 value = 1; startGasReport("set a record on a table with KeysWithValueModule installed"); - world.setRecord(namespace, sourceName, keyTuple1, abi.encodePacked(value), sourceTableSchema); + world.setRecord(sourceTableId, keyTuple1, abi.encodePacked(value), sourceTableSchema); endGasReport(); // Get the list of entities with this value from the target table @@ -92,7 +85,7 @@ contract KeysWithValueModuleTest is Test, GasReporter { // Set a value in the source table uint256 value1 = 1; - world.setRecord(namespace, sourceName, keyTuple1, abi.encodePacked(value1), sourceTableSchema); + world.setRecord(sourceTableId, keyTuple1, abi.encodePacked(value1), sourceTableSchema); // Get the list of entities with value1 from the target table bytes32[] memory keysWithValue = KeysWithValue.get(world, targetTableId, keccak256(abi.encode(value1))); @@ -102,7 +95,7 @@ contract KeysWithValueModuleTest is Test, GasReporter { assertEq(keysWithValue[0], key1, "2"); // Set a another key with the same value - world.setRecord(namespace, sourceName, keyTuple2, abi.encodePacked(value1), sourceTableSchema); + world.setRecord(sourceTableId, keyTuple2, abi.encodePacked(value1), sourceTableSchema); // Get the list of entities with value2 from the target table keysWithValue = KeysWithValue.get(world, targetTableId, keccak256(abi.encode(value1))); @@ -116,7 +109,7 @@ contract KeysWithValueModuleTest is Test, GasReporter { uint256 value2 = 2; startGasReport("change a record on a table with KeysWithValueModule installed"); - world.setRecord(namespace, sourceName, keyTuple1, abi.encodePacked(value2), sourceTableSchema); + world.setRecord(sourceTableId, keyTuple1, abi.encodePacked(value2), sourceTableSchema); endGasReport(); // Get the list of entities with value1 from the target table @@ -135,7 +128,7 @@ contract KeysWithValueModuleTest is Test, GasReporter { // Delete the first key startGasReport("delete a record on a table with KeysWithValueModule installed"); - world.deleteRecord(namespace, sourceName, keyTuple1, sourceTableSchema); + world.deleteRecord(sourceTableId, keyTuple1, sourceTableSchema); endGasReport(); // Get the list of entities with value2 from the target table @@ -152,7 +145,7 @@ contract KeysWithValueModuleTest is Test, GasReporter { uint256 value1 = 1; startGasReport("set a field on a table with KeysWithValueModule installed"); - world.setField(namespace, sourceName, keyTuple1, 0, abi.encodePacked(value1), sourceTableSchema); + world.setField(sourceTableId, keyTuple1, 0, abi.encodePacked(value1), sourceTableSchema); endGasReport(); // Get the list of entities with value1 from the target table @@ -166,7 +159,7 @@ contract KeysWithValueModuleTest is Test, GasReporter { // Change the value using setField startGasReport("change a field on a table with KeysWithValueModule installed"); - world.setField(namespace, sourceName, keyTuple1, 0, abi.encodePacked(value2), sourceTableSchema); + world.setField(sourceTableId, keyTuple1, 0, abi.encodePacked(value2), sourceTableSchema); endGasReport(); // Get the list of entities with value1 from the target table @@ -207,7 +200,7 @@ contract KeysWithValueModuleTest is Test, GasReporter { _installKeysWithValueModule(); // Set a value in the source table - world.setRecord(namespace, sourceName, keyTuple1, abi.encodePacked(value), sourceTableSchema); + world.setRecord(sourceTableId, keyTuple1, abi.encodePacked(value), sourceTableSchema); startGasReport("Get list of keys with a given value"); bytes32[] memory keysWithValue = getKeysWithValue(world, sourceTableId, abi.encode(value)); @@ -218,7 +211,7 @@ contract KeysWithValueModuleTest is Test, GasReporter { assertEq(keysWithValue[0], key1); // Set a another key with the same value - world.setRecord(namespace, sourceName, keyTuple2, abi.encodePacked(value), sourceTableSchema); + world.setRecord(sourceTableId, keyTuple2, abi.encodePacked(value), sourceTableSchema); // Get the list of keys with value from the target table keysWithValue = getKeysWithValue(world, sourceTableId, abi.encode(value)); diff --git a/packages/world/test/Utils.t.sol b/packages/world/test/Utils.t.sol index fa6cf1e012..55d066d32c 100644 --- a/packages/world/test/Utils.t.sol +++ b/packages/world/test/Utils.t.sol @@ -29,9 +29,12 @@ contract UtilsTest is Test { function _registerAndGetNamespace(bytes16 namespace) internal returns (bytes16 returnedNamespace) { UtilsTestSystem testSystem = new UtilsTestSystem(); bytes16 name = "testSystem"; - world.registerSystem(namespace, name, testSystem, true); + world.registerSystem(ResourceSelector.from(namespace, name), testSystem, true); - bytes memory data = world.call(namespace, name, abi.encodeWithSelector(UtilsTestSystem.systemNamespace.selector)); + bytes memory data = world.call( + ResourceSelector.from(namespace, name), + abi.encodeWithSelector(UtilsTestSystem.systemNamespace.selector) + ); returnedNamespace = abi.decode(data, (bytes16)); } diff --git a/packages/world/test/World.t.sol b/packages/world/test/World.t.sol index e0888a7328..04b36e064e 100644 --- a/packages/world/test/World.t.sol +++ b/packages/world/test/World.t.sol @@ -83,7 +83,7 @@ contract WorldTestSystem is System { if (StoreSwitch.getStoreAddress() == address(this)) { StoreCore.setRecord(tableId, key, abi.encodePacked(data), valueSchema); } else { - IBaseWorld(msg.sender).setRecord(namespace, name, key, abi.encodePacked(data), valueSchema); + IBaseWorld(msg.sender).setRecord(tableId, key, abi.encodePacked(data), valueSchema); } } @@ -217,10 +217,11 @@ contract WorldTest is Test, GasReporter { function testStoreAddress() public { // Register a system and use it to get storeAddress WorldTestSystem system = new WorldTestSystem(); - world.registerSystem("namespace", "testSystem", system, false); + bytes32 resourceSelector = ResourceSelector.from("namespace", "testSystem"); + + world.registerSystem(resourceSelector, system, false); bytes memory result = world.call( - "namespace", - "testSystem", + resourceSelector, abi.encodeWithSelector(WorldTestSystem.getStoreAddress.selector) ); @@ -249,7 +250,7 @@ contract WorldTest is Test, GasReporter { Schema valueSchema = SchemaEncodeHelper.encode(SchemaType.BOOL, SchemaType.UINT256, SchemaType.STRING); bytes16 namespace = "testNamespace"; bytes16 tableName = "testTable"; - + bytes32 tableSelector = ResourceSelector.from(namespace, tableName); string[] memory keyNames = new string[](1); keyNames[0] = "key1"; string[] memory fieldNames = new string[](3); @@ -258,14 +259,7 @@ contract WorldTest is Test, GasReporter { fieldNames[2] = "value3"; startGasReport("Register a new table in the namespace"); - bytes32 tableSelector = world.registerTable( - namespace, - tableName, - defaultKeySchema, - valueSchema, - keyNames, - fieldNames - ); + world.registerTable(tableSelector, defaultKeySchema, valueSchema, keyNames, fieldNames); endGasReport(); // Expect the namespace to be created and owned by the caller @@ -283,24 +277,26 @@ contract WorldTest is Test, GasReporter { // Expect an error when registering an existing table vm.expectRevert(abi.encodeWithSelector(IWorldErrors.ResourceExists.selector, tableSelector.toString())); - world.registerTable(namespace, tableName, defaultKeySchema, valueSchema, keyNames, fieldNames); + world.registerTable(tableSelector, defaultKeySchema, valueSchema, keyNames, fieldNames); // Expect an error when registering a table in a namespace that is not owned by the caller + bytes32 otherTableSelector = ResourceSelector.from(namespace, "otherTable"); _expectAccessDenied(address(0x01), namespace, ""); - world.registerTable(namespace, "otherTable", defaultKeySchema, valueSchema, keyNames, fieldNames); + world.registerTable(otherTableSelector, defaultKeySchema, valueSchema, keyNames, fieldNames); // Expect the World to be allowed to call registerTable vm.prank(address(world)); - world.registerTable(namespace, "otherTable", defaultKeySchema, valueSchema, keyNames, fieldNames); + world.registerTable(otherTableSelector, defaultKeySchema, valueSchema, keyNames, fieldNames); } function testRegisterSystem() public { System system = new System(); bytes16 namespace = ""; bytes16 name = "testSystem"; + bytes32 resourceSelector = ResourceSelector.from(namespace, name); // !gasrepot Register a new system - bytes32 resourceSelector = world.registerSystem(namespace, name, system, false); + world.registerSystem(resourceSelector, system, false); // Expect the system to be registered (address registeredAddress, bool publicAccess) = Systems.get(world, resourceSelector); @@ -324,61 +320,49 @@ contract WorldTest is Test, GasReporter { // Expect the namespace to be created if it doesn't exist yet assertEq(NamespaceOwner.get(world, "newNamespace"), address(0)); - world.registerSystem("newNamespace", "testSystem", new System(), false); + world.registerSystem(ResourceSelector.from("newNamespace", "testSystem"), new System(), false); assertEq(NamespaceOwner.get(world, "newNamespace"), address(this)); // Expect an error when registering an existing system vm.expectRevert(abi.encodeWithSelector(IWorldErrors.SystemExists.selector, address(system))); - world.registerSystem("", "newSystem", system, true); + world.registerSystem(ResourceSelector.from("", "newSystem"), system, true); // Expect an error when registering a system at an existing resource selector System newSystem = new System(); // Expect an error when registering a system at an existing resource selector vm.expectRevert(abi.encodeWithSelector(IWorldErrors.ResourceExists.selector, resourceSelector.toString())); - resourceSelector = world.registerSystem("", "testSystem", newSystem, true); + world.registerSystem(ResourceSelector.from("", "testSystem"), newSystem, true); // Expect an error when registering a system in a namespace is not owned by the caller System yetAnotherSystem = new System(); _expectAccessDenied(address(0x01), "", ""); - world.registerSystem("", "rootSystem", yetAnotherSystem, true); + world.registerSystem(ResourceSelector.from("", "rootSystem"), yetAnotherSystem, true); // Expect the registration to succeed when coming from the World vm.prank(address(world)); - world.registerSystem("", "rootSystem", yetAnotherSystem, true); + world.registerSystem(ResourceSelector.from("", "rootSystem"), yetAnotherSystem, true); } function testDuplicateSelectors() public { // Register a new table - bytes32 resourceSelector = world.registerTable( - "namespace", - "name", - defaultKeySchema, - Bool.getValueSchema(), - new string[](1), - new string[](1) - ); + bytes32 resourceSelector = ResourceSelector.from("namespace", "name"); + world.registerTable(resourceSelector, defaultKeySchema, Bool.getValueSchema(), new string[](1), new string[](1)); // Deploy a new system System system = new System(); // Expect an error when trying to register a system at the same selector vm.expectRevert(abi.encodeWithSelector(IWorldErrors.ResourceExists.selector, resourceSelector.toString())); - world.registerSystem("namespace", "name", system, false); + world.registerSystem(resourceSelector, system, false); // Register a new system - resourceSelector = world.registerSystem("namespace2", "name", new System(), false); + bytes32 resourceSelector2 = ResourceSelector.from("namespace2", "name"); + world.registerSystem(resourceSelector2, new System(), false); // Expect an error when trying to register a table at the same selector - vm.expectRevert(abi.encodeWithSelector(IWorldErrors.ResourceExists.selector, resourceSelector.toString())); - world.registerTable( - "namespace2", - "name", - defaultKeySchema, - Bool.getValueSchema(), - new string[](1), - new string[](1) - ); + vm.expectRevert(abi.encodeWithSelector(IWorldErrors.ResourceExists.selector, resourceSelector2.toString())); + world.registerTable(resourceSelector2, defaultKeySchema, Bool.getValueSchema(), new string[](1), new string[](1)); } function testGrantAccess() public { @@ -390,15 +374,9 @@ contract WorldTest is Test, GasReporter { } function testSetRecord() public { + bytes32 tableId = ResourceSelector.from("testSetRecord", "testTable"); // Register a new table - bytes32 tableId = world.registerTable( - "testSetRecord", - "testTable", - defaultKeySchema, - Bool.getValueSchema(), - new string[](1), - new string[](1) - ); + world.registerTable(tableId, defaultKeySchema, Bool.getValueSchema(), new string[](1), new string[](1)); startGasReport("Write data to the table"); Bool.set(world, tableId, true); @@ -419,20 +397,14 @@ contract WorldTest is Test, GasReporter { function testSetField() public { bytes16 namespace = "testSetField"; bytes16 name = "testTable"; + bytes32 tableId = ResourceSelector.from(namespace, name); Schema valueSchema = Bool.getValueSchema(); // Register a new table - bytes32 tableId = world.registerTable( - namespace, - name, - defaultKeySchema, - valueSchema, - new string[](1), - new string[](1) - ); + world.registerTable(tableId, defaultKeySchema, valueSchema, new string[](1), new string[](1)); startGasReport("Write data to a table field"); - world.setField(namespace, name, singletonKey, 0, abi.encodePacked(true), valueSchema); + world.setField(tableId, singletonKey, 0, abi.encodePacked(true), valueSchema); endGasReport(); // Expect the data to be written @@ -446,7 +418,7 @@ contract WorldTest is Test, GasReporter { // Expect an error when trying to write from an address that doesn't have access when calling via the namespace _expectAccessDenied(address(0x01), "testSetField", "testTable"); - world.setField("testSetField", "testTable", singletonKey, 0, abi.encodePacked(true), valueSchema); + world.setField(tableId, singletonKey, 0, abi.encodePacked(true), valueSchema); // Expect an error when trying to write from an address that doesn't have access when calling via the tableId _expectAccessDenied(address(0x01), "testSetField", "testTable"); @@ -454,23 +426,17 @@ contract WorldTest is Test, GasReporter { // Expect the World to have access vm.prank(address(world)); - world.setField("testSetField", "testTable", singletonKey, 0, abi.encodePacked(true), valueSchema); + world.setField(tableId, singletonKey, 0, abi.encodePacked(true), valueSchema); } function testPushToField() public { bytes16 namespace = "testPushToField"; bytes16 name = "testTable"; + bytes32 tableId = ResourceSelector.from(namespace, name); Schema valueSchema = AddressArray.getValueSchema(); // Register a new table - bytes32 tableId = world.registerTable( - namespace, - name, - defaultKeySchema, - valueSchema, - new string[](1), - new string[](1) - ); + world.registerTable(tableId, defaultKeySchema, valueSchema, new string[](1), new string[](1)); // Create data address[] memory dataToPush = new address[](3); @@ -480,14 +446,14 @@ contract WorldTest is Test, GasReporter { bytes memory encodedData = EncodeArray.encode(dataToPush); startGasReport("Push data to the table"); - world.pushToField(namespace, name, keyTuple, 0, encodedData, valueSchema); + world.pushToField(tableId, keyTuple, 0, encodedData, valueSchema); endGasReport(); // Expect the data to be written assertEq(AddressArray.get(world, tableId, key), dataToPush); // Delete the data - world.deleteRecord(namespace, name, keyTuple, valueSchema); + world.deleteRecord(tableId, keyTuple, valueSchema); // Push data to the table via direct access world.pushToField(tableId, keyTuple, 0, encodedData, valueSchema); @@ -495,47 +461,37 @@ contract WorldTest is Test, GasReporter { // Expect the data to be written assertEq(AddressArray.get(world, tableId, key), dataToPush); - // Expect an error when trying to write from an address that doesn't have access (via namespace/name) - _expectAccessDenied(address(0x01), namespace, name); - world.pushToField(namespace, name, keyTuple, 0, encodedData, valueSchema); - - // Expect an error when trying to write from an address that doesn't have access (via tableId) + // Expect an error when trying to write from an address that doesn't have access _expectAccessDenied(address(0x01), namespace, name); world.pushToField(tableId, keyTuple, 0, encodedData, valueSchema); // Expect the World to have access vm.prank(address(world)); - world.pushToField(namespace, name, keyTuple, 0, encodedData, valueSchema); + world.pushToField(tableId, keyTuple, 0, encodedData, valueSchema); } function testDeleteRecord() public { bytes16 namespace = "testDeleteRecord"; bytes16 name = "testTable"; + bytes32 tableId = ResourceSelector.from(namespace, name); Schema valueSchema = Bool.getValueSchema(); // Register a new table - bytes32 tableId = world.registerTable( - namespace, - name, - defaultKeySchema, - valueSchema, - new string[](1), - new string[](1) - ); + world.registerTable(tableId, defaultKeySchema, valueSchema, new string[](1), new string[](1)); // Write data to the table via the namespace and expect it to be written - world.setRecord(namespace, name, singletonKey, abi.encodePacked(true), valueSchema); + world.setRecord(tableId, singletonKey, abi.encodePacked(true), valueSchema); assertTrue(Bool.get(world, tableId)); startGasReport("Delete record"); - world.deleteRecord(namespace, name, singletonKey, valueSchema); + world.deleteRecord(tableId, singletonKey, valueSchema); endGasReport(); // expect it to be deleted assertFalse(Bool.get(world, tableId)); // Write data to the table via the namespace and expect it to be written - world.setRecord("testDeleteRecord", "testTable", singletonKey, abi.encodePacked(true), valueSchema); + world.setRecord(tableId, singletonKey, abi.encodePacked(true), valueSchema); assertTrue(Bool.get(world, tableId)); // Delete the record via the tableId and expect it to be deleted @@ -543,41 +499,33 @@ contract WorldTest is Test, GasReporter { assertFalse(Bool.get(world, tableId)); // Write data to the table via the namespace and expect it to be written - world.setRecord("testDeleteRecord", "testTable", singletonKey, abi.encodePacked(true), valueSchema); + world.setRecord(tableId, singletonKey, abi.encodePacked(true), valueSchema); assertTrue(Bool.get(world, tableId)); - // Expect an error when trying to delete from an address that doesn't have access when calling via the namespace - _expectAccessDenied(address(0x01), "testDeleteRecord", "testTable"); - world.deleteRecord("testDeleteRecord", "testTable", singletonKey, valueSchema); - - // Expect an error when trying to delete from an address that doesn't have access when calling via the tableId + // Expect an error when trying to delete from an address that doesn't have access _expectAccessDenied(address(0x02), "testDeleteRecord", "testTable"); world.deleteRecord(tableId, singletonKey, valueSchema); // Expect the World to have access vm.prank(address(world)); - world.deleteRecord("testDeleteRecord", "testTable", singletonKey, valueSchema); + world.deleteRecord(tableId, singletonKey, valueSchema); } function testCall() public { // Register a new system WorldTestSystem system = new WorldTestSystem(); - world.registerSystem("namespace", "testSystem", system, false); + bytes32 resourceSelector = ResourceSelector.from("namespace", "testSystem"); + world.registerSystem(resourceSelector, system, false); // Call a system function without arguments via the World - bytes memory result = world.call( - "namespace", - "testSystem", - abi.encodeWithSelector(WorldTestSystem.msgSender.selector) - ); + bytes memory result = world.call(resourceSelector, abi.encodeWithSelector(WorldTestSystem.msgSender.selector)); // Expect the system to have received the caller's address assertEq(address(uint160(uint256(bytes32(result)))), address(this)); // Call a system function with arguments via the World result = world.call( - "namespace", - "testSystem", + resourceSelector, abi.encodeWithSelector(WorldTestSystem.echo.selector, bytes32(uint256(0x123))) ); @@ -593,23 +541,24 @@ contract WorldTest is Test, GasReporter { // Expect an error when trying to call a private system from an address that doesn't have access _expectAccessDenied(address(0x01), "namespace", "testSystem"); - world.call("namespace", "testSystem", abi.encodeWithSelector(WorldTestSystem.msgSender.selector)); + world.call(resourceSelector, abi.encodeWithSelector(WorldTestSystem.msgSender.selector)); // Expect the World to have access vm.prank(address(world)); - world.call("namespace", "testSystem", abi.encodeWithSelector(WorldTestSystem.msgSender.selector)); + world.call(resourceSelector, abi.encodeWithSelector(WorldTestSystem.msgSender.selector)); // Expect errors from the system to be forwarded vm.expectRevert(abi.encodeWithSelector(WorldTestSystem.WorldTestSystemError.selector, "test error")); - world.call("namespace", "testSystem", abi.encodeWithSelector(WorldTestSystem.err.selector, "test error")); + world.call(resourceSelector, abi.encodeWithSelector(WorldTestSystem.err.selector, "test error")); // Register another system in the same namespace WorldTestSystem subSystem = new WorldTestSystem(); - world.registerSystem("namespace", "testSubSystem", subSystem, false); + bytes32 subsystemResourceSelector = ResourceSelector.from("namespace", "testSubSystem"); + world.registerSystem(subsystemResourceSelector, subSystem, false); // Call the subsystem via the World (with access to the base route) returnedAddress = abi.decode( - world.call("namespace", "testSubSystem", abi.encodeWithSelector(WorldTestSystem.msgSender.selector)), + world.call(subsystemResourceSelector, abi.encodeWithSelector(WorldTestSystem.msgSender.selector)), (address) ); assertEq(returnedAddress, address(this)); @@ -617,8 +566,7 @@ contract WorldTest is Test, GasReporter { // Call the subsystem via delegatecall from the system // (Note: just for testing purposes, in reality systems can call subsystems directly instead of via two indirections like here) bytes memory nestedReturndata = world.call( - "namespace", - "testSystem", + resourceSelector, abi.encodeWithSelector( WorldTestSystem.delegateCallSubSystem.selector, // Function in system address(subSystem), // Address of subsystem @@ -632,20 +580,14 @@ contract WorldTest is Test, GasReporter { function testRegisterTableHook() public { Schema valueSchema = Bool.getValueSchema(); + bytes32 tableId = ResourceSelector.from("", "testTable"); // Register a new table - bytes32 tableId = world.registerTable( - "", - "testTable", - defaultKeySchema, - valueSchema, - new string[](1), - new string[](1) - ); + world.registerTable(tableId, defaultKeySchema, valueSchema, new string[](1), new string[](1)); // Register a new hook IStoreHook tableHook = new WorldTestTableHook(); - world.registerTableHook("", "testTable", tableHook); + world.registerStoreHook(tableId, tableHook); // Prepare data to write to the table bytes memory value = abi.encodePacked(true); @@ -660,13 +602,15 @@ contract WorldTest is Test, GasReporter { } function testRegisterSystemHook() public { + bytes32 tableId = ResourceSelector.from("namespace", "testTable"); + // Register a new system WorldTestSystem system = new WorldTestSystem(); - world.registerSystem("namespace", "testSystem", system, false); + world.registerSystem(tableId, system, false); // Register a new hook ISystemHook systemHook = new WorldTestSystemHook(); - world.registerSystemHook("namespace", "testSystem", systemHook); + world.registerSystemHook(tableId, systemHook); bytes memory funcSelectorAndArgs = abi.encodeWithSelector(bytes4(keccak256("fallbackselector"))); @@ -681,28 +625,22 @@ contract WorldTest is Test, GasReporter { emit SystemHookCalled(abi.encode("after", address(this), address(system), funcSelectorAndArgs)); // Call a system fallback function without arguments via the World - world.call("namespace", "testSystem", funcSelectorAndArgs); + world.call(tableId, funcSelectorAndArgs); } function testWriteRootSystem() public { + bytes32 tableId = ResourceSelector.from("namespace", "testTable"); // Register a new table - bytes32 tableId = world.registerTable( - "namespace", - "testTable", - defaultKeySchema, - Bool.getValueSchema(), - new string[](1), - new string[](1) - ); + world.registerTable(tableId, defaultKeySchema, Bool.getValueSchema(), new string[](1), new string[](1)); // Register a new system + bytes32 rootSystemId = ResourceSelector.from("", "testSystem"); WorldTestSystem system = new WorldTestSystem(); - world.registerSystem("", "testSystem", system, false); + world.registerSystem(rootSystemId, system, false); // Call a system function that writes data to the World world.call( - "", - "testSystem", + rootSystemId, abi.encodeWithSelector(WorldTestSystem.writeData.selector, bytes16("namespace"), bytes16("testTable"), true) ); @@ -711,24 +649,18 @@ contract WorldTest is Test, GasReporter { } function testWriteAutonomousSystem() public { + bytes32 tableId = ResourceSelector.from("namespace", "testTable"); // Register a new table - bytes32 tableId = world.registerTable( - "namespace", - "testTable", - defaultKeySchema, - Bool.getValueSchema(), - new string[](1), - new string[](1) - ); + world.registerTable(tableId, defaultKeySchema, Bool.getValueSchema(), new string[](1), new string[](1)); // Register a new system + bytes32 systemId = ResourceSelector.from("namespace", "testSystem"); WorldTestSystem system = new WorldTestSystem(); - world.registerSystem("namespace", "testSystem", system, false); + world.registerSystem(systemId, system, false); // Call a system function that writes data to the World world.call( - "namespace", - "testSystem", + systemId, abi.encodeWithSelector(WorldTestSystem.writeData.selector, bytes16("namespace"), bytes16("testTable"), true) ); @@ -737,37 +669,40 @@ contract WorldTest is Test, GasReporter { } function testDelegatecallRootSystem() public { + bytes32 resourceSelector = ResourceSelector.from("", "testSystem"); // Register a new root system WorldTestSystem system = new WorldTestSystem(); - world.registerSystem("", "testSystem", system, false); + world.registerSystem(resourceSelector, system, false); // Call the root sysyem vm.expectEmit(true, true, true, true); emit WorldTestSystemLog("delegatecall"); - world.call("", "testSystem", abi.encodeWithSelector(WorldTestSystem.emitCallType.selector)); + world.call(resourceSelector, abi.encodeWithSelector(WorldTestSystem.emitCallType.selector)); } function testCallAutonomousSystem() public { + bytes32 resourceSelector = ResourceSelector.from("namespace", "testSystem"); // Register a new non-root system WorldTestSystem system = new WorldTestSystem(); - world.registerSystem("namespace", "testSystem", system, false); + world.registerSystem(resourceSelector, system, false); // Call the sysyem vm.expectEmit(true, true, true, true); emit WorldTestSystemLog("call"); - world.call("namespace", "testSystem", abi.encodeWithSelector(WorldTestSystem.emitCallType.selector)); + world.call(resourceSelector, abi.encodeWithSelector(WorldTestSystem.emitCallType.selector)); } function testRegisterFunctionSelector() public { bytes16 namespace = "testNamespace"; bytes16 name = "testSystem"; + bytes32 resourceSelector = ResourceSelector.from(namespace, name); // Register a new system WorldTestSystem system = new WorldTestSystem(); - world.registerSystem(namespace, name, system, true); + world.registerSystem(resourceSelector, system, true); startGasReport("Register a function selector"); - bytes4 functionSelector = world.registerFunctionSelector(namespace, name, "msgSender", "()"); + bytes4 functionSelector = world.registerFunctionSelector(resourceSelector, "msgSender", "()"); endGasReport(); string memory expectedWorldFunctionSignature = "testNamespace_testSystem_msgSender()"; @@ -781,7 +716,7 @@ contract WorldTest is Test, GasReporter { assertEq(abi.decode(data, (address)), address(this), "wrong address returned"); // Register a function selector to the error function - functionSelector = world.registerFunctionSelector(namespace, name, "err", "(string)"); + functionSelector = world.registerFunctionSelector(resourceSelector, "err", "(string)"); // Expect errors to be passed through vm.expectRevert(abi.encodeWithSelector(WorldTestSystem.WorldTestSystemError.selector, "test error")); @@ -791,24 +726,25 @@ contract WorldTest is Test, GasReporter { function testRegisterRootFunctionSelector() public { bytes16 namespace = "testNamespace"; bytes16 name = "testSystem"; + bytes32 resourceSelector = ResourceSelector.from(namespace, name); // Register a new system WorldTestSystem system = new WorldTestSystem(); - world.registerSystem(namespace, name, system, true); + world.registerSystem(resourceSelector, system, true); bytes4 worldFunc = bytes4(abi.encodeWithSignature("testSelector()")); bytes4 sysFunc = WorldTestSystem.msgSender.selector; // Expect an error when trying to register a root function selector from an account without access _expectAccessDenied(address(0x01), "", ""); - world.registerRootFunctionSelector(namespace, name, worldFunc, sysFunc); + world.registerRootFunctionSelector(resourceSelector, worldFunc, sysFunc); // Expect the World to be able to register a root function selector vm.prank(address(world)); - world.registerRootFunctionSelector(namespace, name, "smth", "smth"); + world.registerRootFunctionSelector(resourceSelector, "smth", "smth"); startGasReport("Register a root function selector"); - bytes4 functionSelector = world.registerRootFunctionSelector(namespace, name, worldFunc, sysFunc); + bytes4 functionSelector = world.registerRootFunctionSelector(resourceSelector, worldFunc, sysFunc); endGasReport(); assertEq(functionSelector, worldFunc, "wrong function selector returned"); @@ -821,8 +757,7 @@ contract WorldTest is Test, GasReporter { // Register a function selector to the error function functionSelector = world.registerRootFunctionSelector( - namespace, - name, + resourceSelector, WorldTestSystem.err.selector, WorldTestSystem.err.selector ); @@ -835,13 +770,14 @@ contract WorldTest is Test, GasReporter { function testRegisterFallbackSystem() public { bytes16 namespace = "testNamespace"; bytes16 name = "testSystem"; + bytes32 resourceSelector = ResourceSelector.from(namespace, name); // Register a new system WorldTestSystem system = new WorldTestSystem(); - world.registerSystem(namespace, name, system, true); + world.registerSystem(resourceSelector, system, true); startGasReport("Register a fallback system"); - bytes4 funcSelector1 = world.registerFunctionSelector(namespace, name, "", ""); + bytes4 funcSelector1 = world.registerFunctionSelector(resourceSelector, "", ""); endGasReport(); // Call the system's fallback function @@ -853,7 +789,7 @@ contract WorldTest is Test, GasReporter { bytes4 worldFunc = bytes4(abi.encodeWithSignature("testSelector()")); startGasReport("Register a root fallback system"); - bytes4 funcSelector2 = world.registerRootFunctionSelector(namespace, name, worldFunc, 0); + bytes4 funcSelector2 = world.registerRootFunctionSelector(resourceSelector, worldFunc, 0); endGasReport(); assertEq(funcSelector2, worldFunc, "wrong function selector returned"); @@ -891,10 +827,11 @@ contract WorldTest is Test, GasReporter { WorldTestSystem system = new WorldTestSystem(); bytes16 namespace = "noroot"; bytes16 name = "testSystem"; - world.registerSystem(namespace, name, system, true); + bytes32 resourceSelector = ResourceSelector.from(namespace, name); + + world.registerSystem(resourceSelector, system, true); world.registerRootFunctionSelector( - namespace, - name, + resourceSelector, WorldTestSystem.receiveEther.selector, WorldTestSystem.receiveEther.selector ); @@ -923,10 +860,10 @@ contract WorldTest is Test, GasReporter { WorldTestSystem system = new WorldTestSystem(); bytes16 namespace = "noroot"; bytes16 name = "testSystem"; - world.registerSystem(namespace, name, system, true); + bytes32 resourceSelector = ResourceSelector.from(namespace, name); + world.registerSystem(resourceSelector, system, true); world.registerRootFunctionSelector( - namespace, - name, + resourceSelector, WorldTestSystem.msgSender.selector, WorldTestSystem.msgSender.selector ); @@ -955,10 +892,10 @@ contract WorldTest is Test, GasReporter { WorldTestSystem system = new WorldTestSystem(); bytes16 namespace = "noroot"; bytes16 name = "testSystem"; - world.registerSystem(namespace, name, system, true); + bytes32 resourceSelector = ResourceSelector.from(namespace, name); + world.registerSystem(resourceSelector, system, true); world.registerRootFunctionSelector( - namespace, - name, + resourceSelector, bytes4(abi.encodeWithSignature("systemFallback()")), bytes4("") ); @@ -985,10 +922,10 @@ contract WorldTest is Test, GasReporter { PayableFallbackSystem system = new PayableFallbackSystem(); bytes16 namespace = "noroot"; bytes16 name = "testSystem"; - world.registerSystem(namespace, name, system, true); + bytes32 resourceSelector = ResourceSelector.from(namespace, name); + world.registerSystem(resourceSelector, system, true); world.registerRootFunctionSelector( - namespace, - name, + resourceSelector, bytes4(abi.encodeWithSignature("systemFallback()")), bytes4("") ); @@ -1015,10 +952,10 @@ contract WorldTest is Test, GasReporter { WorldTestSystem system = new WorldTestSystem(); bytes16 namespace = ""; bytes16 name = "testSystem"; - world.registerSystem(namespace, name, system, true); + bytes32 resourceSelector = ResourceSelector.from(namespace, name); + world.registerSystem(resourceSelector, system, true); world.registerRootFunctionSelector( - namespace, - name, + resourceSelector, WorldTestSystem.receiveEther.selector, WorldTestSystem.receiveEther.selector ); diff --git a/packages/world/test/WorldDynamicUpdate.t.sol b/packages/world/test/WorldDynamicUpdate.t.sol index 809d704923..62f9a71016 100644 --- a/packages/world/test/WorldDynamicUpdate.t.sol +++ b/packages/world/test/WorldDynamicUpdate.t.sol @@ -38,6 +38,8 @@ contract UpdateInFieldTest is Test, GasReporter { bytes32[] internal keyTuple; bytes32[] internal singletonKey; + bytes16 namespace; + bytes16 name; bytes32 internal tableId; address[] internal initData; bytes internal encodedData; @@ -54,11 +56,12 @@ contract UpdateInFieldTest is Test, GasReporter { // Initialize the data in setUp so that slots aren't warm in tests (to test cold update) - bytes16 namespace = "DynamicUpdTest"; - bytes16 name = "testTable"; + namespace = "DynamicUpdTest"; + name = "testTable"; + tableId = ResourceSelector.from(namespace, name); // Register a new table - tableId = world.registerTable(namespace, name, defaultKeySchema, valueSchema, new string[](1), new string[](1)); + world.registerTable(tableId, defaultKeySchema, valueSchema, new string[](1), new string[](1)); // Create data initData = new address[](3); @@ -67,24 +70,16 @@ contract UpdateInFieldTest is Test, GasReporter { initData[2] = address(bytes20(keccak256("another address"))); encodedData = EncodeArray.encode(initData); - world.setField(namespace, name, keyTuple, 0, encodedData, valueSchema); + world.setField(tableId, keyTuple, 0, encodedData, valueSchema); } // Expect an error when trying to write from an address that doesn't have access - function _expectAccessDenied(address caller, bytes16 namespace, bytes16 name) internal { - vm.prank(caller); - vm.expectRevert( - abi.encodeWithSelector( - IWorldErrors.AccessDenied.selector, - ResourceSelector.from(namespace, name).toString(), - caller - ) - ); + function _expectAccessDenied(address _caller, bytes32 _tableId) internal { + vm.prank(_caller); + vm.expectRevert(abi.encodeWithSelector(IWorldErrors.AccessDenied.selector, _tableId.toString(), _caller)); } function testPopFromField() public { - bytes16 namespace = "DynamicUpdTest"; - bytes16 name = "testTable"; Schema valueSchema = AddressArray.getValueSchema(); // Expect the data to be written @@ -94,7 +89,7 @@ contract UpdateInFieldTest is Test, GasReporter { uint256 byteLengthToPop = 20; startGasReport("pop 1 address (cold)"); - world.popFromField(namespace, name, keyTuple, 0, byteLengthToPop, valueSchema); + world.popFromField(tableId, keyTuple, 0, byteLengthToPop, valueSchema); endGasReport(); // Expect the data to be updated @@ -108,7 +103,7 @@ contract UpdateInFieldTest is Test, GasReporter { byteLengthToPop = 20; startGasReport("pop 1 address (warm)"); - world.popFromField(namespace, name, keyTuple, 0, byteLengthToPop, valueSchema); + world.popFromField(tableId, keyTuple, 0, byteLengthToPop, valueSchema); endGasReport(); // Expect the data to be updated @@ -119,7 +114,7 @@ contract UpdateInFieldTest is Test, GasReporter { } // Reset data - world.setField(namespace, name, keyTuple, 0, encodedData, valueSchema); + world.setField(tableId, keyTuple, 0, encodedData, valueSchema); // Pop 2 items via direct access byteLengthToPop = 20 * 2; world.popFromField(tableId, keyTuple, 0, byteLengthToPop, valueSchema); @@ -131,21 +126,19 @@ contract UpdateInFieldTest is Test, GasReporter { } // Expect an error when trying to write from an address that doesn't have access (via namespace/name) - _expectAccessDenied(address(0x01), namespace, name); - world.popFromField(namespace, name, keyTuple, 0, 20, valueSchema); + _expectAccessDenied(address(0x01), tableId); + world.popFromField(tableId, keyTuple, 0, 20, valueSchema); // Expect an error when trying to write from an address that doesn't have access (via tableId) - _expectAccessDenied(address(0x01), namespace, name); + _expectAccessDenied(address(0x01), tableId); world.popFromField(tableId, keyTuple, 0, 20, valueSchema); // Expect the World to have access vm.prank(address(world)); - world.popFromField(namespace, name, keyTuple, 0, 20, valueSchema); + world.popFromField(tableId, keyTuple, 0, 20, valueSchema); } function testUpdateInField() public { - bytes16 namespace = "DynamicUpdTest"; - bytes16 name = "testTable"; Schema valueSchema = AddressArray.getValueSchema(); // Expect the data to be written @@ -156,11 +149,11 @@ contract UpdateInFieldTest is Test, GasReporter { dataForUpdate[0] = address(bytes20(keccak256("address for update"))); startGasReport("updateInField 1 item (cold)"); - world.updateInField(namespace, name, keyTuple, 0, 0, EncodeArray.encode(dataForUpdate), valueSchema); + world.updateInField(tableId, keyTuple, 0, 0, EncodeArray.encode(dataForUpdate), valueSchema); endGasReport(); startGasReport("updateInField 1 item (warm)"); - world.updateInField(namespace, name, keyTuple, 0, 0, EncodeArray.encode(dataForUpdate), valueSchema); + world.updateInField(tableId, keyTuple, 0, 0, EncodeArray.encode(dataForUpdate), valueSchema); endGasReport(); // Expect the data to be updated @@ -175,15 +168,15 @@ contract UpdateInFieldTest is Test, GasReporter { assertEq(AddressArray.get(world, tableId, key), initData); // Expect an error when trying to write from an address that doesn't have access (via namespace/name) - _expectAccessDenied(address(0x01), namespace, name); - world.updateInField(namespace, name, keyTuple, 0, 0, EncodeArray.encode(dataForUpdate), valueSchema); + _expectAccessDenied(address(0x01), tableId); + world.updateInField(tableId, keyTuple, 0, 0, EncodeArray.encode(dataForUpdate), valueSchema); // Expect an error when trying to write from an address that doesn't have access (via tableId) - _expectAccessDenied(address(0x01), namespace, name); + _expectAccessDenied(address(0x01), tableId); world.updateInField(tableId, keyTuple, 0, 0, EncodeArray.encode(dataForUpdate), valueSchema); // Expect the World to have access vm.prank(address(world)); - world.updateInField(namespace, name, keyTuple, 0, 0, EncodeArray.encode(dataForUpdate), valueSchema); + world.updateInField(tableId, keyTuple, 0, 0, EncodeArray.encode(dataForUpdate), valueSchema); } } diff --git a/packages/world/test/query.t.sol b/packages/world/test/query.t.sol index 6a40efae56..7f061dcd1f 100644 --- a/packages/world/test/query.t.sol +++ b/packages/world/test/query.t.sol @@ -62,9 +62,9 @@ contract QueryTest is Test, GasReporter { function _installKeysInTableModule() internal { // Register source table - table1 = world.registerTable(namespace, name1, tableKeySchema, tableValueSchema, new string[](1), new string[](1)); - table2 = world.registerTable(namespace, name2, tableKeySchema, tableValueSchema, new string[](1), new string[](1)); - table3 = world.registerTable(namespace, name3, tableKeySchema, tableValueSchema, new string[](1), new string[](1)); + world.registerTable(table1, tableKeySchema, tableValueSchema, new string[](1), new string[](1)); + world.registerTable(table2, tableKeySchema, tableValueSchema, new string[](1), new string[](1)); + world.registerTable(table3, tableKeySchema, tableValueSchema, new string[](1), new string[](1)); // Install the index module // TODO: add support for installing this via installModule @@ -86,9 +86,9 @@ contract QueryTest is Test, GasReporter { function testHasQuery() public { _installKeysInTableModule(); - world.setRecord(namespace, name1, key1, abi.encode(1), tableValueSchema); - world.setRecord(namespace, name1, key2, abi.encode(1), tableValueSchema); - world.setRecord(namespace, name2, key1, abi.encode(0), tableValueSchema); + world.setRecord(table1, key1, abi.encode(1), tableValueSchema); + world.setRecord(table1, key2, abi.encode(1), tableValueSchema); + world.setRecord(table2, key1, abi.encode(0), tableValueSchema); // Query should return all keys in table1 QueryFragment[] memory fragments = new QueryFragment[](1); @@ -107,9 +107,9 @@ contract QueryTest is Test, GasReporter { _installKeysInTableModule(); _installKeysWithValueModule(); - world.setRecord(namespace, name1, key1, abi.encode(2), tableValueSchema); - world.setRecord(namespace, name1, key2, abi.encode(1), tableValueSchema); - world.setRecord(namespace, name1, key3, abi.encode(1), tableValueSchema); + world.setRecord(table1, key1, abi.encode(2), tableValueSchema); + world.setRecord(table1, key2, abi.encode(1), tableValueSchema); + world.setRecord(table1, key3, abi.encode(1), tableValueSchema); // Query should return all keys in table1 with value 1 QueryFragment[] memory fragments = new QueryFragment[](1); fragments[0] = QueryFragment(QueryType.HasValue, table1, abi.encode(1)); @@ -125,12 +125,12 @@ contract QueryTest is Test, GasReporter { function testCombinedHasQuery() public { _installKeysInTableModule(); - world.setRecord(namespace, name1, key1, abi.encode(2), tableValueSchema); - world.setRecord(namespace, name1, key2, abi.encode(1), tableValueSchema); - world.setRecord(namespace, name1, key3, abi.encode(1), tableValueSchema); - world.setRecord(namespace, name2, key2, abi.encode(1), tableValueSchema); - world.setRecord(namespace, name2, key3, abi.encode(1), tableValueSchema); - world.setRecord(namespace, name3, key1, abi.encode(1), tableValueSchema); + world.setRecord(table1, key1, abi.encode(2), tableValueSchema); + world.setRecord(table1, key2, abi.encode(1), tableValueSchema); + world.setRecord(table1, key3, abi.encode(1), tableValueSchema); + world.setRecord(table2, key2, abi.encode(1), tableValueSchema); + world.setRecord(table2, key3, abi.encode(1), tableValueSchema); + world.setRecord(table3, key1, abi.encode(1), tableValueSchema); // Query should return all entities that have table1 and table2 QueryFragment[] memory fragments = new QueryFragment[](2); @@ -149,12 +149,12 @@ contract QueryTest is Test, GasReporter { _installKeysInTableModule(); _installKeysWithValueModule(); - world.setRecord(namespace, name1, key1, abi.encode(2), tableValueSchema); - world.setRecord(namespace, name1, key2, abi.encode(2), tableValueSchema); - world.setRecord(namespace, name1, key3, abi.encode(1), tableValueSchema); - world.setRecord(namespace, name2, key2, abi.encode(1), tableValueSchema); - world.setRecord(namespace, name2, key3, abi.encode(1), tableValueSchema); - world.setRecord(namespace, name3, key1, abi.encode(1), tableValueSchema); + world.setRecord(table1, key1, abi.encode(2), tableValueSchema); + world.setRecord(table1, key2, abi.encode(2), tableValueSchema); + world.setRecord(table1, key3, abi.encode(1), tableValueSchema); + world.setRecord(table2, key2, abi.encode(1), tableValueSchema); + world.setRecord(table2, key3, abi.encode(1), tableValueSchema); + world.setRecord(table3, key1, abi.encode(1), tableValueSchema); // Query should return all entities that have table1 and table2 QueryFragment[] memory fragments = new QueryFragment[](2); @@ -172,13 +172,13 @@ contract QueryTest is Test, GasReporter { _installKeysInTableModule(); _installKeysWithValueModule(); - world.setRecord(namespace, name1, key1, abi.encode(1), tableValueSchema); - world.setRecord(namespace, name1, key2, abi.encode(1), tableValueSchema); - world.setRecord(namespace, name1, key3, abi.encode(1), tableValueSchema); - world.setRecord(namespace, name2, key1, abi.encode(1), tableValueSchema); - world.setRecord(namespace, name2, key2, abi.encode(2), tableValueSchema); - world.setRecord(namespace, name2, key3, abi.encode(2), tableValueSchema); - world.setRecord(namespace, name2, key4, abi.encode(2), tableValueSchema); + world.setRecord(table1, key1, abi.encode(1), tableValueSchema); + world.setRecord(table1, key2, abi.encode(1), tableValueSchema); + world.setRecord(table1, key3, abi.encode(1), tableValueSchema); + world.setRecord(table2, key1, abi.encode(1), tableValueSchema); + world.setRecord(table2, key2, abi.encode(2), tableValueSchema); + world.setRecord(table2, key3, abi.encode(2), tableValueSchema); + world.setRecord(table2, key4, abi.encode(2), tableValueSchema); // Query should return all entities that have table1 and table2 QueryFragment[] memory fragments = new QueryFragment[](2); @@ -196,13 +196,13 @@ contract QueryTest is Test, GasReporter { function testCombinedHasNotQuery() public { _installKeysInTableModule(); - world.setRecord(namespace, name1, key1, abi.encode(1), tableValueSchema); - world.setRecord(namespace, name1, key2, abi.encode(1), tableValueSchema); - world.setRecord(namespace, name1, key3, abi.encode(1), tableValueSchema); - world.setRecord(namespace, name2, key1, abi.encode(1), tableValueSchema); - world.setRecord(namespace, name2, key2, abi.encode(2), tableValueSchema); - world.setRecord(namespace, name2, key3, abi.encode(2), tableValueSchema); - world.setRecord(namespace, name2, key4, abi.encode(2), tableValueSchema); + world.setRecord(table1, key1, abi.encode(1), tableValueSchema); + world.setRecord(table1, key2, abi.encode(1), tableValueSchema); + world.setRecord(table1, key3, abi.encode(1), tableValueSchema); + world.setRecord(table2, key1, abi.encode(1), tableValueSchema); + world.setRecord(table2, key2, abi.encode(2), tableValueSchema); + world.setRecord(table2, key3, abi.encode(2), tableValueSchema); + world.setRecord(table2, key4, abi.encode(2), tableValueSchema); // Query should return all entities that have table1 and table2 QueryFragment[] memory fragments = new QueryFragment[](2); @@ -220,13 +220,13 @@ contract QueryTest is Test, GasReporter { _installKeysInTableModule(); _installKeysWithValueModule(); - world.setRecord(namespace, name1, key1, abi.encode(1), tableValueSchema); - world.setRecord(namespace, name1, key2, abi.encode(1), tableValueSchema); - world.setRecord(namespace, name1, key3, abi.encode(1), tableValueSchema); - world.setRecord(namespace, name2, key1, abi.encode(1), tableValueSchema); - world.setRecord(namespace, name2, key2, abi.encode(2), tableValueSchema); - world.setRecord(namespace, name2, key3, abi.encode(1), tableValueSchema); - world.setRecord(namespace, name2, key4, abi.encode(1), tableValueSchema); + world.setRecord(table1, key1, abi.encode(1), tableValueSchema); + world.setRecord(table1, key2, abi.encode(1), tableValueSchema); + world.setRecord(table1, key3, abi.encode(1), tableValueSchema); + world.setRecord(table2, key1, abi.encode(1), tableValueSchema); + world.setRecord(table2, key2, abi.encode(2), tableValueSchema); + world.setRecord(table2, key3, abi.encode(1), tableValueSchema); + world.setRecord(table2, key4, abi.encode(1), tableValueSchema); // Query should return all entities that have table1 and table2 QueryFragment[] memory fragments = new QueryFragment[](2); @@ -244,16 +244,16 @@ contract QueryTest is Test, GasReporter { _installKeysInTableModule(); _installKeysWithValueModule(); - world.setRecord(namespace, name1, key1, abi.encode(1), tableValueSchema); - world.setRecord(namespace, name1, key2, abi.encode(1), tableValueSchema); - world.setRecord(namespace, name1, key3, abi.encode(1), tableValueSchema); - world.setRecord(namespace, name2, key1, abi.encode(1), tableValueSchema); - world.setRecord(namespace, name2, key2, abi.encode(2), tableValueSchema); - world.setRecord(namespace, name2, key3, abi.encode(1), tableValueSchema); - world.setRecord(namespace, name2, key4, abi.encode(1), tableValueSchema); - world.setRecord(namespace, name3, key2, abi.encode(1), tableValueSchema); - world.setRecord(namespace, name3, key3, abi.encode(1), tableValueSchema); - world.setRecord(namespace, name3, key4, abi.encode(1), tableValueSchema); + world.setRecord(table1, key1, abi.encode(1), tableValueSchema); + world.setRecord(table1, key2, abi.encode(1), tableValueSchema); + world.setRecord(table1, key3, abi.encode(1), tableValueSchema); + world.setRecord(table2, key1, abi.encode(1), tableValueSchema); + world.setRecord(table2, key2, abi.encode(2), tableValueSchema); + world.setRecord(table2, key3, abi.encode(1), tableValueSchema); + world.setRecord(table2, key4, abi.encode(1), tableValueSchema); + world.setRecord(table3, key2, abi.encode(1), tableValueSchema); + world.setRecord(table3, key3, abi.encode(1), tableValueSchema); + world.setRecord(table3, key4, abi.encode(1), tableValueSchema); // Query should return all entities that have table2 and not table1 QueryFragment[] memory fragments = new QueryFragment[](3); @@ -272,9 +272,9 @@ contract QueryTest is Test, GasReporter { _installKeysInTableModule(); _installKeysWithValueModule(); - world.setRecord(namespace, name1, key1, abi.encode(4), tableValueSchema); - world.setRecord(namespace, name1, key2, abi.encode(5), tableValueSchema); - world.setRecord(namespace, name1, key3, abi.encode(6), tableValueSchema); + world.setRecord(table1, key1, abi.encode(4), tableValueSchema); + world.setRecord(table1, key2, abi.encode(5), tableValueSchema); + world.setRecord(table1, key3, abi.encode(6), tableValueSchema); // Query should return all entities with table1 except value 6 QueryFragment[] memory fragments = new QueryFragment[](2); @@ -295,9 +295,9 @@ contract QueryTest is Test, GasReporter { for (uint256 i; i < 100; i++) { bytes32[] memory key = new bytes32[](1); key[0] = bytes32(i); - world.setRecord(namespace, name1, key, abi.encode(1), tableValueSchema); + world.setRecord(table1, key, abi.encode(1), tableValueSchema); } - world.setRecord(namespace, name2, key1, abi.encode(0), tableValueSchema); + world.setRecord(table2, key1, abi.encode(0), tableValueSchema); // Query should return all keys in table1 QueryFragment[] memory fragments = new QueryFragment[](1); @@ -316,9 +316,9 @@ contract QueryTest is Test, GasReporter { for (uint256 i; i < 1000; i++) { bytes32[] memory key = new bytes32[](1); key[0] = bytes32(i); - world.setRecord(namespace, name1, key, abi.encode(1), tableValueSchema); + world.setRecord(table1, key, abi.encode(1), tableValueSchema); } - world.setRecord(namespace, name2, key1, abi.encode(0), tableValueSchema); + world.setRecord(table2, key1, abi.encode(0), tableValueSchema); // Query should return all keys in table1 QueryFragment[] memory fragments = new QueryFragment[](1); diff --git a/packages/world/ts/node/render-solidity/renderWorld.ts b/packages/world/ts/node/render-solidity/renderWorld.ts index 4c80e9e614..f6eb71b818 100644 --- a/packages/world/ts/node/render-solidity/renderWorld.ts +++ b/packages/world/ts/node/render-solidity/renderWorld.ts @@ -14,7 +14,6 @@ export function renderWorld(options: RenderWorldOptions) { ? [ { symbol: "IStore", path: `${storeImportPath}IStore.sol` }, { symbol: "IWorldKernel", path: `${worldImportPath}interfaces/IWorldKernel.sol` }, - { symbol: "IWorldEphemeral", path: `${worldImportPath}interfaces/IWorldEphemeral.sol` }, ] : [ {