@latticexyz/world-module-metadata 2.1.1-main-fad4e85853d9ee80753ae1b0b161b60bf9874846
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +1 -0
- package/dist/mud.config.d.ts +108 -0
- package/dist/mud.config.js +2 -0
- package/dist/mud.config.js.map +1 -0
- package/out/AccessControl.sol/AccessControl.abi.json +1 -0
- package/out/AccessControl.sol/AccessControl.json +1 -0
- package/out/AccessManagementSystem.sol/AccessManagementSystem.abi.json +256 -0
- package/out/AccessManagementSystem.sol/AccessManagementSystem.abi.json.d.ts +256 -0
- package/out/AccessManagementSystem.sol/AccessManagementSystem.json +1 -0
- package/out/BalanceTransferSystem.sol/BalanceTransferSystem.abi.json +361 -0
- package/out/BalanceTransferSystem.sol/BalanceTransferSystem.abi.json.d.ts +361 -0
- package/out/BalanceTransferSystem.sol/BalanceTransferSystem.json +1 -0
- package/out/Balances.sol/Balances.abi.json +1 -0
- package/out/Balances.sol/Balances.json +1 -0
- package/out/Base.sol/CommonBase.abi.json +1 -0
- package/out/Base.sol/CommonBase.json +1 -0
- package/out/Base.sol/ScriptBase.abi.json +1 -0
- package/out/Base.sol/ScriptBase.json +1 -0
- package/out/Base.sol/TestBase.abi.json +1 -0
- package/out/Base.sol/TestBase.json +1 -0
- package/out/BatchCallSystem.sol/BatchCallSystem.abi.json +132 -0
- package/out/BatchCallSystem.sol/BatchCallSystem.abi.json.d.ts +132 -0
- package/out/BatchCallSystem.sol/BatchCallSystem.json +1 -0
- package/out/Bytes.sol/Bytes.abi.json +1 -0
- package/out/Bytes.sol/Bytes.json +1 -0
- package/out/DecodeSlice.sol/DecodeSlice.abi.json +1 -0
- package/out/DecodeSlice.sol/DecodeSlice.json +1 -0
- package/out/Delegation.sol/Delegation.abi.json +1 -0
- package/out/Delegation.sol/Delegation.json +1 -0
- package/out/ERC165Checker.sol/ERC165Checker.abi.json +1 -0
- package/out/ERC165Checker.sol/ERC165Checker.json +1 -0
- package/out/EncodeArray.sol/EncodeArray.abi.json +1 -0
- package/out/EncodeArray.sol/EncodeArray.json +1 -0
- package/out/EncodedLengths.sol/EncodedLengthsInstance.abi.json +1 -0
- package/out/EncodedLengths.sol/EncodedLengthsInstance.json +1 -0
- package/out/EncodedLengths.sol/EncodedLengthsLib.abi.json +1 -0
- package/out/EncodedLengths.sol/EncodedLengthsLib.json +1 -0
- package/out/FieldLayout.sol/FieldLayoutInstance.abi.json +1 -0
- package/out/FieldLayout.sol/FieldLayoutInstance.json +1 -0
- package/out/FieldLayout.sol/FieldLayoutLib.abi.json +1 -0
- package/out/FieldLayout.sol/FieldLayoutLib.json +1 -0
- package/out/FunctionSelectors.sol/FunctionSelectors.abi.json +1 -0
- package/out/FunctionSelectors.sol/FunctionSelectors.json +1 -0
- package/out/FunctionSignatures.sol/FunctionSignatures.abi.json +1 -0
- package/out/FunctionSignatures.sol/FunctionSignatures.json +1 -0
- package/out/GasReporter.sol/GasReporter.abi.json +520 -0
- package/out/GasReporter.sol/GasReporter.abi.json.d.ts +520 -0
- package/out/GasReporter.sol/GasReporter.json +1 -0
- package/out/Hook.sol/HookInstance.abi.json +1 -0
- package/out/Hook.sol/HookInstance.json +1 -0
- package/out/Hook.sol/HookLib.abi.json +1 -0
- package/out/Hook.sol/HookLib.json +1 -0
- package/out/Hooks.sol/Hooks.abi.json +1 -0
- package/out/Hooks.sol/Hooks.json +1 -0
- package/out/IAccessManagementSystem.sol/IAccessManagementSystem.abi.json +69 -0
- package/out/IAccessManagementSystem.sol/IAccessManagementSystem.abi.json.d.ts +69 -0
- package/out/IAccessManagementSystem.sol/IAccessManagementSystem.json +1 -0
- package/out/IBalanceTransferSystem.sol/IBalanceTransferSystem.abi.json +48 -0
- package/out/IBalanceTransferSystem.sol/IBalanceTransferSystem.abi.json.d.ts +48 -0
- package/out/IBalanceTransferSystem.sol/IBalanceTransferSystem.json +1 -0
- package/out/IBaseWorld.sol/IBaseWorld.abi.json +2008 -0
- package/out/IBaseWorld.sol/IBaseWorld.abi.json.d.ts +2008 -0
- package/out/IBaseWorld.sol/IBaseWorld.json +1 -0
- package/out/IBatchCallSystem.sol/IBatchCallSystem.abi.json +69 -0
- package/out/IBatchCallSystem.sol/IBatchCallSystem.abi.json.d.ts +69 -0
- package/out/IBatchCallSystem.sol/IBatchCallSystem.json +1 -0
- package/out/IDelegationControl.sol/IDelegationControl.abi.json +89 -0
- package/out/IDelegationControl.sol/IDelegationControl.abi.json.d.ts +89 -0
- package/out/IDelegationControl.sol/IDelegationControl.json +1 -0
- package/out/IERC165.sol/IERC165.abi.json +21 -0
- package/out/IERC165.sol/IERC165.abi.json.d.ts +21 -0
- package/out/IERC165.sol/IERC165.json +1 -0
- package/out/IEncodedLengthsErrors.sol/IEncodedLengthsErrors.abi.json +13 -0
- package/out/IEncodedLengthsErrors.sol/IEncodedLengthsErrors.abi.json.d.ts +13 -0
- package/out/IEncodedLengthsErrors.sol/IEncodedLengthsErrors.json +1 -0
- package/out/IFieldLayoutErrors.sol/IFieldLayoutErrors.abi.json +88 -0
- package/out/IFieldLayoutErrors.sol/IFieldLayoutErrors.abi.json.d.ts +88 -0
- package/out/IFieldLayoutErrors.sol/IFieldLayoutErrors.json +1 -0
- package/out/IMetadataSystem.sol/IMetadataSystem.abi.json +67 -0
- package/out/IMetadataSystem.sol/IMetadataSystem.abi.json.d.ts +67 -0
- package/out/IMetadataSystem.sol/IMetadataSystem.json +1 -0
- package/out/IModule.sol/IModule.abi.json +73 -0
- package/out/IModule.sol/IModule.abi.json.d.ts +73 -0
- package/out/IModule.sol/IModule.json +1 -0
- package/out/IModuleErrors.sol/IModuleErrors.abi.json +28 -0
- package/out/IModuleErrors.sol/IModuleErrors.abi.json.d.ts +28 -0
- package/out/IModuleErrors.sol/IModuleErrors.json +1 -0
- package/out/IModuleInstallationSystem.sol/IModuleInstallationSystem.abi.json +20 -0
- package/out/IModuleInstallationSystem.sol/IModuleInstallationSystem.abi.json.d.ts +20 -0
- package/out/IModuleInstallationSystem.sol/IModuleInstallationSystem.json +1 -0
- package/out/IMulticall3.sol/IMulticall3.abi.json +440 -0
- package/out/IMulticall3.sol/IMulticall3.abi.json.d.ts +440 -0
- package/out/IMulticall3.sol/IMulticall3.json +1 -0
- package/out/IRegistrationSystem.sol/IRegistrationSystem.abi.json +1 -0
- package/out/IRegistrationSystem.sol/IRegistrationSystem.json +1 -0
- package/out/ISchemaErrors.sol/ISchemaErrors.abi.json +18 -0
- package/out/ISchemaErrors.sol/ISchemaErrors.abi.json.d.ts +18 -0
- package/out/ISchemaErrors.sol/ISchemaErrors.json +1 -0
- package/out/ISliceErrors.sol/ISliceErrors.abi.json +23 -0
- package/out/ISliceErrors.sol/ISliceErrors.abi.json.d.ts +23 -0
- package/out/ISliceErrors.sol/ISliceErrors.json +1 -0
- package/out/IStore.sol/IStore.abi.json +1261 -0
- package/out/IStore.sol/IStore.abi.json.d.ts +1261 -0
- package/out/IStore.sol/IStore.json +1 -0
- package/out/IStoreErrors.sol/IStoreErrors.abi.json +204 -0
- package/out/IStoreErrors.sol/IStoreErrors.abi.json.d.ts +204 -0
- package/out/IStoreErrors.sol/IStoreErrors.json +1 -0
- package/out/IStoreEvents.sol/IStoreEvents.abi.json +151 -0
- package/out/IStoreEvents.sol/IStoreEvents.abi.json.d.ts +151 -0
- package/out/IStoreEvents.sol/IStoreEvents.json +1 -0
- package/out/IStoreHook.sol/IStoreHook.abi.json +290 -0
- package/out/IStoreHook.sol/IStoreHook.abi.json.d.ts +290 -0
- package/out/IStoreHook.sol/IStoreHook.json +1 -0
- package/out/IStoreKernel.sol/IStoreKernel.abi.json +1182 -0
- package/out/IStoreKernel.sol/IStoreKernel.abi.json.d.ts +1182 -0
- package/out/IStoreKernel.sol/IStoreKernel.json +1 -0
- package/out/IStoreRead.sol/IStoreRead.abi.json +389 -0
- package/out/IStoreRead.sol/IStoreRead.abi.json.d.ts +389 -0
- package/out/IStoreRead.sol/IStoreRead.json +1 -0
- package/out/IStoreRegistration.sol/IStoreRegistration.abi.json +81 -0
- package/out/IStoreRegistration.sol/IStoreRegistration.abi.json.d.ts +81 -0
- package/out/IStoreRegistration.sol/IStoreRegistration.json +1 -0
- package/out/IStoreWrite.sol/IStoreWrite.abi.json +446 -0
- package/out/IStoreWrite.sol/IStoreWrite.abi.json.d.ts +446 -0
- package/out/IStoreWrite.sol/IStoreWrite.json +1 -0
- package/out/ISystemHook.sol/ISystemHook.abi.json +67 -0
- package/out/ISystemHook.sol/ISystemHook.abi.json.d.ts +67 -0
- package/out/ISystemHook.sol/ISystemHook.json +1 -0
- package/out/IWorld.sol/IWorld.abi.json +2073 -0
- package/out/IWorld.sol/IWorld.abi.json.d.ts +2073 -0
- package/out/IWorld.sol/IWorld.json +1 -0
- package/out/IWorldContextConsumer.sol/IWorldContextConsumer.abi.json +60 -0
- package/out/IWorldContextConsumer.sol/IWorldContextConsumer.abi.json.d.ts +60 -0
- package/out/IWorldContextConsumer.sol/IWorldContextConsumer.json +1 -0
- package/out/IWorldErrors.sol/IWorldErrors.abi.json +200 -0
- package/out/IWorldErrors.sol/IWorldErrors.abi.json.d.ts +200 -0
- package/out/IWorldErrors.sol/IWorldErrors.json +1 -0
- package/out/IWorldEvents.sol/IWorldEvents.abi.json +15 -0
- package/out/IWorldEvents.sol/IWorldEvents.abi.json.d.ts +15 -0
- package/out/IWorldEvents.sol/IWorldEvents.json +1 -0
- package/out/IWorldKernel.sol/IWorldCall.abi.json +55 -0
- package/out/IWorldKernel.sol/IWorldCall.abi.json.d.ts +55 -0
- package/out/IWorldKernel.sol/IWorldCall.json +1 -0
- package/out/IWorldKernel.sol/IWorldKernel.abi.json +349 -0
- package/out/IWorldKernel.sol/IWorldKernel.abi.json.d.ts +349 -0
- package/out/IWorldKernel.sol/IWorldKernel.json +1 -0
- package/out/IWorldKernel.sol/IWorldModuleInstallation.abi.json +20 -0
- package/out/IWorldKernel.sol/IWorldModuleInstallation.abi.json.d.ts +20 -0
- package/out/IWorldKernel.sol/IWorldModuleInstallation.json +1 -0
- package/out/IWorldRegistrationSystem.sol/IWorldRegistrationSystem.abi.json +204 -0
- package/out/IWorldRegistrationSystem.sol/IWorldRegistrationSystem.abi.json.d.ts +204 -0
- package/out/IWorldRegistrationSystem.sol/IWorldRegistrationSystem.json +1 -0
- package/out/InitModule.sol/InitModule.abi.json +462 -0
- package/out/InitModule.sol/InitModule.abi.json.d.ts +462 -0
- package/out/InitModule.sol/InitModule.json +1 -0
- package/out/InitModuleAddress.sol/InitModuleAddress.abi.json +1 -0
- package/out/InitModuleAddress.sol/InitModuleAddress.json +1 -0
- package/out/InstalledModules.sol/InstalledModules.abi.json +1 -0
- package/out/InstalledModules.sol/InstalledModules.json +1 -0
- package/out/LimitedCallContext.sol/LimitedCallContext.abi.json +7 -0
- package/out/LimitedCallContext.sol/LimitedCallContext.abi.json.d.ts +7 -0
- package/out/LimitedCallContext.sol/LimitedCallContext.json +1 -0
- package/out/Memory.sol/Memory.abi.json +1 -0
- package/out/Memory.sol/Memory.json +1 -0
- package/out/MetadataModule.sol/MetadataModule.abi.json +452 -0
- package/out/MetadataModule.sol/MetadataModule.abi.json.d.ts +452 -0
- package/out/MetadataModule.sol/MetadataModule.json +1 -0
- package/out/MetadataModule.t.sol/MetadataModuleTest.abi.json +568 -0
- package/out/MetadataModule.t.sol/MetadataModuleTest.abi.json.d.ts +568 -0
- package/out/MetadataModule.t.sol/MetadataModuleTest.json +1 -0
- package/out/MetadataSystem.sol/MetadataSystem.abi.json +315 -0
- package/out/MetadataSystem.sol/MetadataSystem.abi.json.d.ts +315 -0
- package/out/MetadataSystem.sol/MetadataSystem.json +1 -0
- package/out/Module.sol/Module.abi.json +112 -0
- package/out/Module.sol/Module.abi.json.d.ts +112 -0
- package/out/Module.sol/Module.json +1 -0
- package/out/ModuleInstallationSystem.sol/ModuleInstallationSystem.abi.json +151 -0
- package/out/ModuleInstallationSystem.sol/ModuleInstallationSystem.abi.json.d.ts +151 -0
- package/out/ModuleInstallationSystem.sol/ModuleInstallationSystem.json +1 -0
- package/out/NamespaceDelegationControl.sol/NamespaceDelegationControl.abi.json +1 -0
- package/out/NamespaceDelegationControl.sol/NamespaceDelegationControl.json +1 -0
- package/out/NamespaceOwner.sol/NamespaceOwner.abi.json +1 -0
- package/out/NamespaceOwner.sol/NamespaceOwner.json +1 -0
- package/out/RegistrationSystem.sol/RegistrationSystem.abi.json +1018 -0
- package/out/RegistrationSystem.sol/RegistrationSystem.abi.json.d.ts +1018 -0
- package/out/RegistrationSystem.sol/RegistrationSystem.json +1 -0
- package/out/ResourceAccess.sol/ResourceAccess.abi.json +1 -0
- package/out/ResourceAccess.sol/ResourceAccess.json +1 -0
- package/out/ResourceId.sol/ResourceIdInstance.abi.json +1 -0
- package/out/ResourceId.sol/ResourceIdInstance.json +1 -0
- package/out/ResourceId.sol/ResourceIdLib.abi.json +1 -0
- package/out/ResourceId.sol/ResourceIdLib.json +1 -0
- package/out/ResourceIds.sol/ResourceIds.abi.json +1 -0
- package/out/ResourceIds.sol/ResourceIds.json +1 -0
- package/out/ResourceTag.sol/ResourceTag.abi.json +1 -0
- package/out/ResourceTag.sol/ResourceTag.json +1 -0
- package/out/Schema.sol/SchemaInstance.abi.json +1 -0
- package/out/Schema.sol/SchemaInstance.json +1 -0
- package/out/Schema.sol/SchemaLib.abi.json +1 -0
- package/out/Schema.sol/SchemaLib.json +1 -0
- package/out/Slice.sol/SliceInstance.abi.json +1 -0
- package/out/Slice.sol/SliceInstance.json +1 -0
- package/out/Slice.sol/SliceLib.abi.json +1 -0
- package/out/Slice.sol/SliceLib.json +1 -0
- package/out/StdAssertions.sol/StdAssertions.abi.json +392 -0
- package/out/StdAssertions.sol/StdAssertions.abi.json.d.ts +392 -0
- package/out/StdAssertions.sol/StdAssertions.json +1 -0
- package/out/StdChains.sol/StdChains.abi.json +1 -0
- package/out/StdChains.sol/StdChains.json +1 -0
- package/out/StdCheats.sol/StdCheats.abi.json +1 -0
- package/out/StdCheats.sol/StdCheats.json +1 -0
- package/out/StdCheats.sol/StdCheatsSafe.abi.json +1 -0
- package/out/StdCheats.sol/StdCheatsSafe.json +1 -0
- package/out/StdError.sol/stdError.abi.json +119 -0
- package/out/StdError.sol/stdError.abi.json.d.ts +119 -0
- package/out/StdError.sol/stdError.json +1 -0
- package/out/StdInvariant.sol/StdInvariant.abi.json +130 -0
- package/out/StdInvariant.sol/StdInvariant.abi.json.d.ts +130 -0
- package/out/StdInvariant.sol/StdInvariant.json +1 -0
- package/out/StdJson.sol/stdJson.abi.json +1 -0
- package/out/StdJson.sol/stdJson.json +1 -0
- package/out/StdMath.sol/stdMath.abi.json +1 -0
- package/out/StdMath.sol/stdMath.json +1 -0
- package/out/StdStorage.sol/stdStorage.abi.json +1 -0
- package/out/StdStorage.sol/stdStorage.json +1 -0
- package/out/StdStorage.sol/stdStorageSafe.abi.json +52 -0
- package/out/StdStorage.sol/stdStorageSafe.abi.json.d.ts +52 -0
- package/out/StdStorage.sol/stdStorageSafe.json +1 -0
- package/out/StdStyle.sol/StdStyle.abi.json +1 -0
- package/out/StdStyle.sol/StdStyle.json +1 -0
- package/out/StdUtils.sol/StdUtils.abi.json +1 -0
- package/out/StdUtils.sol/StdUtils.json +1 -0
- package/out/Storage.sol/Storage.abi.json +1 -0
- package/out/Storage.sol/Storage.json +1 -0
- package/out/StoreCore.sol/StoreCore.abi.json +1 -0
- package/out/StoreCore.sol/StoreCore.json +1 -0
- package/out/StoreCore.sol/StoreCoreInternal.abi.json +1 -0
- package/out/StoreCore.sol/StoreCoreInternal.json +1 -0
- package/out/StoreHooks.sol/StoreHooks.abi.json +1 -0
- package/out/StoreHooks.sol/StoreHooks.json +1 -0
- package/out/StoreKernel.sol/StoreKernel.abi.json +1182 -0
- package/out/StoreKernel.sol/StoreKernel.abi.json.d.ts +1182 -0
- package/out/StoreKernel.sol/StoreKernel.json +1 -0
- package/out/StoreRead.sol/StoreRead.abi.json +437 -0
- package/out/StoreRead.sol/StoreRead.abi.json.d.ts +437 -0
- package/out/StoreRead.sol/StoreRead.json +1 -0
- package/out/StoreRegistrationSystem.sol/StoreRegistrationSystem.abi.json +779 -0
- package/out/StoreRegistrationSystem.sol/StoreRegistrationSystem.abi.json.d.ts +779 -0
- package/out/StoreRegistrationSystem.sol/StoreRegistrationSystem.json +1 -0
- package/out/StoreSwitch.sol/StoreSwitch.abi.json +1 -0
- package/out/StoreSwitch.sol/StoreSwitch.json +1 -0
- package/out/System.sol/System.abi.json +60 -0
- package/out/System.sol/System.abi.json.d.ts +60 -0
- package/out/System.sol/System.json +1 -0
- package/out/SystemCall.sol/SystemCall.abi.json +1 -0
- package/out/SystemCall.sol/SystemCall.json +1 -0
- package/out/SystemHooks.sol/SystemHooks.abi.json +1 -0
- package/out/SystemHooks.sol/SystemHooks.json +1 -0
- package/out/SystemRegistry.sol/SystemRegistry.abi.json +1 -0
- package/out/SystemRegistry.sol/SystemRegistry.json +1 -0
- package/out/Systems.sol/Systems.abi.json +1 -0
- package/out/Systems.sol/Systems.json +1 -0
- package/out/Tables.sol/Tables.abi.json +1 -0
- package/out/Tables.sol/Tables.json +1 -0
- package/out/Test.sol/Test.abi.json +520 -0
- package/out/Test.sol/Test.abi.json.d.ts +520 -0
- package/out/Test.sol/Test.json +1 -0
- package/out/TightCoder.sol/TightCoder.abi.json +1 -0
- package/out/TightCoder.sol/TightCoder.json +1 -0
- package/out/UserDelegationControl.sol/UserDelegationControl.abi.json +1 -0
- package/out/UserDelegationControl.sol/UserDelegationControl.json +1 -0
- package/out/Vm.sol/Vm.abi.json +3878 -0
- package/out/Vm.sol/Vm.abi.json.d.ts +3878 -0
- package/out/Vm.sol/Vm.json +1 -0
- package/out/Vm.sol/VmSafe.abi.json +2678 -0
- package/out/Vm.sol/VmSafe.abi.json.d.ts +2678 -0
- package/out/Vm.sol/VmSafe.json +1 -0
- package/out/World.sol/World.abi.json +1542 -0
- package/out/World.sol/World.abi.json.d.ts +1542 -0
- package/out/World.sol/World.json +1 -0
- package/out/WorldContext.sol/WorldContextConsumer.abi.json +60 -0
- package/out/WorldContext.sol/WorldContextConsumer.abi.json.d.ts +60 -0
- package/out/WorldContext.sol/WorldContextConsumer.json +1 -0
- package/out/WorldContext.sol/WorldContextConsumerLib.abi.json +1 -0
- package/out/WorldContext.sol/WorldContextConsumerLib.json +1 -0
- package/out/WorldContext.sol/WorldContextProviderLib.abi.json +1 -0
- package/out/WorldContext.sol/WorldContextProviderLib.json +1 -0
- package/out/WorldRegistrationSystem.sol/WorldRegistrationSystem.abi.json +691 -0
- package/out/WorldRegistrationSystem.sol/WorldRegistrationSystem.abi.json.d.ts +691 -0
- package/out/WorldRegistrationSystem.sol/WorldRegistrationSystem.json +1 -0
- package/out/WorldResourceId.sol/WorldResourceIdInstance.abi.json +1 -0
- package/out/WorldResourceId.sol/WorldResourceIdInstance.json +1 -0
- package/out/WorldResourceId.sol/WorldResourceIdLib.abi.json +1 -0
- package/out/WorldResourceId.sol/WorldResourceIdLib.json +1 -0
- package/out/build-info/6e6d00ff6cd02b591740ca2c5d45982e.json +1 -0
- package/out/console.sol/console.abi.json +1 -0
- package/out/console.sol/console.json +1 -0
- package/out/console2.sol/console2.abi.json +1 -0
- package/out/console2.sol/console2.json +1 -0
- package/out/constants.sol/LayoutOffsets.abi.json +1 -0
- package/out/constants.sol/LayoutOffsets.json +1 -0
- package/out/safeconsole.sol/safeconsole.abi.json +1 -0
- package/out/safeconsole.sol/safeconsole.json +1 -0
- package/out/src/IERC165.sol/IERC165.abi.json +21 -0
- package/out/src/IERC165.sol/IERC165.abi.json.d.ts +21 -0
- package/out/src/IERC165.sol/IERC165.json +1 -0
- package/out/test.sol/DSTest.abi.json +296 -0
- package/out/test.sol/DSTest.abi.json.d.ts +296 -0
- package/out/test.sol/DSTest.json +1 -0
- package/package.json +63 -0
- package/src/MetadataModule.sol +57 -0
- package/src/MetadataSystem.sol +25 -0
- package/src/codegen/index.sol +6 -0
- package/src/codegen/tables/ResourceTag.sol +484 -0
- package/src/codegen/world/IMetadataSystem.sol +19 -0
- package/src/codegen/world/IWorld.sol +16 -0
- package/src/common.sol +60 -0
|
@@ -0,0 +1,484 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity >=0.8.24;
|
|
3
|
+
|
|
4
|
+
/* Autogenerated file. Do not edit manually. */
|
|
5
|
+
|
|
6
|
+
// Import store internals
|
|
7
|
+
import { IStore } from "@latticexyz/store/src/IStore.sol";
|
|
8
|
+
import { StoreSwitch } from "@latticexyz/store/src/StoreSwitch.sol";
|
|
9
|
+
import { StoreCore } from "@latticexyz/store/src/StoreCore.sol";
|
|
10
|
+
import { Bytes } from "@latticexyz/store/src/Bytes.sol";
|
|
11
|
+
import { Memory } from "@latticexyz/store/src/Memory.sol";
|
|
12
|
+
import { SliceLib } from "@latticexyz/store/src/Slice.sol";
|
|
13
|
+
import { EncodeArray } from "@latticexyz/store/src/tightcoder/EncodeArray.sol";
|
|
14
|
+
import { FieldLayout } from "@latticexyz/store/src/FieldLayout.sol";
|
|
15
|
+
import { Schema } from "@latticexyz/store/src/Schema.sol";
|
|
16
|
+
import { EncodedLengths, EncodedLengthsLib } from "@latticexyz/store/src/EncodedLengths.sol";
|
|
17
|
+
import { ResourceId } from "@latticexyz/store/src/ResourceId.sol";
|
|
18
|
+
|
|
19
|
+
// Import user types
|
|
20
|
+
import { ResourceId } from "@latticexyz/store/src/ResourceId.sol";
|
|
21
|
+
|
|
22
|
+
library ResourceTag {
|
|
23
|
+
// Hex below is the result of `WorldResourceIdLib.encode({ namespace: "metadata", name: "ResourceTag", typeId: RESOURCE_TABLE });`
|
|
24
|
+
ResourceId constant _tableId = ResourceId.wrap(0x74626d657461646174610000000000005265736f757263655461670000000000);
|
|
25
|
+
|
|
26
|
+
FieldLayout constant _fieldLayout =
|
|
27
|
+
FieldLayout.wrap(0x0000000100000000000000000000000000000000000000000000000000000000);
|
|
28
|
+
|
|
29
|
+
// Hex-encoded key schema of (bytes32, bytes32)
|
|
30
|
+
Schema constant _keySchema = Schema.wrap(0x004002005f5f0000000000000000000000000000000000000000000000000000);
|
|
31
|
+
// Hex-encoded value schema of (bytes)
|
|
32
|
+
Schema constant _valueSchema = Schema.wrap(0x00000001c4000000000000000000000000000000000000000000000000000000);
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* @notice Get the table's key field names.
|
|
36
|
+
* @return keyNames An array of strings with the names of key fields.
|
|
37
|
+
*/
|
|
38
|
+
function getKeyNames() internal pure returns (string[] memory keyNames) {
|
|
39
|
+
keyNames = new string[](2);
|
|
40
|
+
keyNames[0] = "resource";
|
|
41
|
+
keyNames[1] = "tag";
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* @notice Get the table's value field names.
|
|
46
|
+
* @return fieldNames An array of strings with the names of value fields.
|
|
47
|
+
*/
|
|
48
|
+
function getFieldNames() internal pure returns (string[] memory fieldNames) {
|
|
49
|
+
fieldNames = new string[](1);
|
|
50
|
+
fieldNames[0] = "value";
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* @notice Register the table with its config.
|
|
55
|
+
*/
|
|
56
|
+
function register() internal {
|
|
57
|
+
StoreSwitch.registerTable(_tableId, _fieldLayout, _keySchema, _valueSchema, getKeyNames(), getFieldNames());
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* @notice Register the table with its config.
|
|
62
|
+
*/
|
|
63
|
+
function _register() internal {
|
|
64
|
+
StoreCore.registerTable(_tableId, _fieldLayout, _keySchema, _valueSchema, getKeyNames(), getFieldNames());
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* @notice Get value.
|
|
69
|
+
*/
|
|
70
|
+
function getValue(ResourceId resource, bytes32 tag) internal view returns (bytes memory value) {
|
|
71
|
+
bytes32[] memory _keyTuple = new bytes32[](2);
|
|
72
|
+
_keyTuple[0] = ResourceId.unwrap(resource);
|
|
73
|
+
_keyTuple[1] = tag;
|
|
74
|
+
|
|
75
|
+
bytes memory _blob = StoreSwitch.getDynamicField(_tableId, _keyTuple, 0);
|
|
76
|
+
return (bytes(_blob));
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* @notice Get value.
|
|
81
|
+
*/
|
|
82
|
+
function _getValue(ResourceId resource, bytes32 tag) internal view returns (bytes memory value) {
|
|
83
|
+
bytes32[] memory _keyTuple = new bytes32[](2);
|
|
84
|
+
_keyTuple[0] = ResourceId.unwrap(resource);
|
|
85
|
+
_keyTuple[1] = tag;
|
|
86
|
+
|
|
87
|
+
bytes memory _blob = StoreCore.getDynamicField(_tableId, _keyTuple, 0);
|
|
88
|
+
return (bytes(_blob));
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* @notice Get value.
|
|
93
|
+
*/
|
|
94
|
+
function get(ResourceId resource, bytes32 tag) internal view returns (bytes memory value) {
|
|
95
|
+
bytes32[] memory _keyTuple = new bytes32[](2);
|
|
96
|
+
_keyTuple[0] = ResourceId.unwrap(resource);
|
|
97
|
+
_keyTuple[1] = tag;
|
|
98
|
+
|
|
99
|
+
bytes memory _blob = StoreSwitch.getDynamicField(_tableId, _keyTuple, 0);
|
|
100
|
+
return (bytes(_blob));
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* @notice Get value.
|
|
105
|
+
*/
|
|
106
|
+
function _get(ResourceId resource, bytes32 tag) internal view returns (bytes memory value) {
|
|
107
|
+
bytes32[] memory _keyTuple = new bytes32[](2);
|
|
108
|
+
_keyTuple[0] = ResourceId.unwrap(resource);
|
|
109
|
+
_keyTuple[1] = tag;
|
|
110
|
+
|
|
111
|
+
bytes memory _blob = StoreCore.getDynamicField(_tableId, _keyTuple, 0);
|
|
112
|
+
return (bytes(_blob));
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* @notice Set value.
|
|
117
|
+
*/
|
|
118
|
+
function setValue(ResourceId resource, bytes32 tag, bytes memory value) internal {
|
|
119
|
+
bytes32[] memory _keyTuple = new bytes32[](2);
|
|
120
|
+
_keyTuple[0] = ResourceId.unwrap(resource);
|
|
121
|
+
_keyTuple[1] = tag;
|
|
122
|
+
|
|
123
|
+
StoreSwitch.setDynamicField(_tableId, _keyTuple, 0, bytes((value)));
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* @notice Set value.
|
|
128
|
+
*/
|
|
129
|
+
function _setValue(ResourceId resource, bytes32 tag, bytes memory value) internal {
|
|
130
|
+
bytes32[] memory _keyTuple = new bytes32[](2);
|
|
131
|
+
_keyTuple[0] = ResourceId.unwrap(resource);
|
|
132
|
+
_keyTuple[1] = tag;
|
|
133
|
+
|
|
134
|
+
StoreCore.setDynamicField(_tableId, _keyTuple, 0, bytes((value)));
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* @notice Set value.
|
|
139
|
+
*/
|
|
140
|
+
function set(ResourceId resource, bytes32 tag, bytes memory value) internal {
|
|
141
|
+
bytes32[] memory _keyTuple = new bytes32[](2);
|
|
142
|
+
_keyTuple[0] = ResourceId.unwrap(resource);
|
|
143
|
+
_keyTuple[1] = tag;
|
|
144
|
+
|
|
145
|
+
StoreSwitch.setDynamicField(_tableId, _keyTuple, 0, bytes((value)));
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* @notice Set value.
|
|
150
|
+
*/
|
|
151
|
+
function _set(ResourceId resource, bytes32 tag, bytes memory value) internal {
|
|
152
|
+
bytes32[] memory _keyTuple = new bytes32[](2);
|
|
153
|
+
_keyTuple[0] = ResourceId.unwrap(resource);
|
|
154
|
+
_keyTuple[1] = tag;
|
|
155
|
+
|
|
156
|
+
StoreCore.setDynamicField(_tableId, _keyTuple, 0, bytes((value)));
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* @notice Get the length of value.
|
|
161
|
+
*/
|
|
162
|
+
function lengthValue(ResourceId resource, bytes32 tag) internal view returns (uint256) {
|
|
163
|
+
bytes32[] memory _keyTuple = new bytes32[](2);
|
|
164
|
+
_keyTuple[0] = ResourceId.unwrap(resource);
|
|
165
|
+
_keyTuple[1] = tag;
|
|
166
|
+
|
|
167
|
+
uint256 _byteLength = StoreSwitch.getDynamicFieldLength(_tableId, _keyTuple, 0);
|
|
168
|
+
unchecked {
|
|
169
|
+
return _byteLength / 1;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* @notice Get the length of value.
|
|
175
|
+
*/
|
|
176
|
+
function _lengthValue(ResourceId resource, bytes32 tag) internal view returns (uint256) {
|
|
177
|
+
bytes32[] memory _keyTuple = new bytes32[](2);
|
|
178
|
+
_keyTuple[0] = ResourceId.unwrap(resource);
|
|
179
|
+
_keyTuple[1] = tag;
|
|
180
|
+
|
|
181
|
+
uint256 _byteLength = StoreCore.getDynamicFieldLength(_tableId, _keyTuple, 0);
|
|
182
|
+
unchecked {
|
|
183
|
+
return _byteLength / 1;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* @notice Get the length of value.
|
|
189
|
+
*/
|
|
190
|
+
function length(ResourceId resource, bytes32 tag) internal view returns (uint256) {
|
|
191
|
+
bytes32[] memory _keyTuple = new bytes32[](2);
|
|
192
|
+
_keyTuple[0] = ResourceId.unwrap(resource);
|
|
193
|
+
_keyTuple[1] = tag;
|
|
194
|
+
|
|
195
|
+
uint256 _byteLength = StoreSwitch.getDynamicFieldLength(_tableId, _keyTuple, 0);
|
|
196
|
+
unchecked {
|
|
197
|
+
return _byteLength / 1;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* @notice Get the length of value.
|
|
203
|
+
*/
|
|
204
|
+
function _length(ResourceId resource, bytes32 tag) internal view returns (uint256) {
|
|
205
|
+
bytes32[] memory _keyTuple = new bytes32[](2);
|
|
206
|
+
_keyTuple[0] = ResourceId.unwrap(resource);
|
|
207
|
+
_keyTuple[1] = tag;
|
|
208
|
+
|
|
209
|
+
uint256 _byteLength = StoreCore.getDynamicFieldLength(_tableId, _keyTuple, 0);
|
|
210
|
+
unchecked {
|
|
211
|
+
return _byteLength / 1;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* @notice Get an item of value.
|
|
217
|
+
* @dev Reverts with Store_IndexOutOfBounds if `_index` is out of bounds for the array.
|
|
218
|
+
*/
|
|
219
|
+
function getItemValue(ResourceId resource, bytes32 tag, uint256 _index) internal view returns (bytes memory) {
|
|
220
|
+
bytes32[] memory _keyTuple = new bytes32[](2);
|
|
221
|
+
_keyTuple[0] = ResourceId.unwrap(resource);
|
|
222
|
+
_keyTuple[1] = tag;
|
|
223
|
+
|
|
224
|
+
unchecked {
|
|
225
|
+
bytes memory _blob = StoreSwitch.getDynamicFieldSlice(_tableId, _keyTuple, 0, _index * 1, (_index + 1) * 1);
|
|
226
|
+
return (bytes(_blob));
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* @notice Get an item of value.
|
|
232
|
+
* @dev Reverts with Store_IndexOutOfBounds if `_index` is out of bounds for the array.
|
|
233
|
+
*/
|
|
234
|
+
function _getItemValue(ResourceId resource, bytes32 tag, uint256 _index) internal view returns (bytes memory) {
|
|
235
|
+
bytes32[] memory _keyTuple = new bytes32[](2);
|
|
236
|
+
_keyTuple[0] = ResourceId.unwrap(resource);
|
|
237
|
+
_keyTuple[1] = tag;
|
|
238
|
+
|
|
239
|
+
unchecked {
|
|
240
|
+
bytes memory _blob = StoreCore.getDynamicFieldSlice(_tableId, _keyTuple, 0, _index * 1, (_index + 1) * 1);
|
|
241
|
+
return (bytes(_blob));
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* @notice Get an item of value.
|
|
247
|
+
* @dev Reverts with Store_IndexOutOfBounds if `_index` is out of bounds for the array.
|
|
248
|
+
*/
|
|
249
|
+
function getItem(ResourceId resource, bytes32 tag, uint256 _index) internal view returns (bytes memory) {
|
|
250
|
+
bytes32[] memory _keyTuple = new bytes32[](2);
|
|
251
|
+
_keyTuple[0] = ResourceId.unwrap(resource);
|
|
252
|
+
_keyTuple[1] = tag;
|
|
253
|
+
|
|
254
|
+
unchecked {
|
|
255
|
+
bytes memory _blob = StoreSwitch.getDynamicFieldSlice(_tableId, _keyTuple, 0, _index * 1, (_index + 1) * 1);
|
|
256
|
+
return (bytes(_blob));
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* @notice Get an item of value.
|
|
262
|
+
* @dev Reverts with Store_IndexOutOfBounds if `_index` is out of bounds for the array.
|
|
263
|
+
*/
|
|
264
|
+
function _getItem(ResourceId resource, bytes32 tag, uint256 _index) internal view returns (bytes memory) {
|
|
265
|
+
bytes32[] memory _keyTuple = new bytes32[](2);
|
|
266
|
+
_keyTuple[0] = ResourceId.unwrap(resource);
|
|
267
|
+
_keyTuple[1] = tag;
|
|
268
|
+
|
|
269
|
+
unchecked {
|
|
270
|
+
bytes memory _blob = StoreCore.getDynamicFieldSlice(_tableId, _keyTuple, 0, _index * 1, (_index + 1) * 1);
|
|
271
|
+
return (bytes(_blob));
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* @notice Push a slice to value.
|
|
277
|
+
*/
|
|
278
|
+
function pushValue(ResourceId resource, bytes32 tag, bytes memory _slice) internal {
|
|
279
|
+
bytes32[] memory _keyTuple = new bytes32[](2);
|
|
280
|
+
_keyTuple[0] = ResourceId.unwrap(resource);
|
|
281
|
+
_keyTuple[1] = tag;
|
|
282
|
+
|
|
283
|
+
StoreSwitch.pushToDynamicField(_tableId, _keyTuple, 0, bytes((_slice)));
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* @notice Push a slice to value.
|
|
288
|
+
*/
|
|
289
|
+
function _pushValue(ResourceId resource, bytes32 tag, bytes memory _slice) internal {
|
|
290
|
+
bytes32[] memory _keyTuple = new bytes32[](2);
|
|
291
|
+
_keyTuple[0] = ResourceId.unwrap(resource);
|
|
292
|
+
_keyTuple[1] = tag;
|
|
293
|
+
|
|
294
|
+
StoreCore.pushToDynamicField(_tableId, _keyTuple, 0, bytes((_slice)));
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* @notice Push a slice to value.
|
|
299
|
+
*/
|
|
300
|
+
function push(ResourceId resource, bytes32 tag, bytes memory _slice) internal {
|
|
301
|
+
bytes32[] memory _keyTuple = new bytes32[](2);
|
|
302
|
+
_keyTuple[0] = ResourceId.unwrap(resource);
|
|
303
|
+
_keyTuple[1] = tag;
|
|
304
|
+
|
|
305
|
+
StoreSwitch.pushToDynamicField(_tableId, _keyTuple, 0, bytes((_slice)));
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* @notice Push a slice to value.
|
|
310
|
+
*/
|
|
311
|
+
function _push(ResourceId resource, bytes32 tag, bytes memory _slice) internal {
|
|
312
|
+
bytes32[] memory _keyTuple = new bytes32[](2);
|
|
313
|
+
_keyTuple[0] = ResourceId.unwrap(resource);
|
|
314
|
+
_keyTuple[1] = tag;
|
|
315
|
+
|
|
316
|
+
StoreCore.pushToDynamicField(_tableId, _keyTuple, 0, bytes((_slice)));
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
/**
|
|
320
|
+
* @notice Pop a slice from value.
|
|
321
|
+
*/
|
|
322
|
+
function popValue(ResourceId resource, bytes32 tag) internal {
|
|
323
|
+
bytes32[] memory _keyTuple = new bytes32[](2);
|
|
324
|
+
_keyTuple[0] = ResourceId.unwrap(resource);
|
|
325
|
+
_keyTuple[1] = tag;
|
|
326
|
+
|
|
327
|
+
StoreSwitch.popFromDynamicField(_tableId, _keyTuple, 0, 1);
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
/**
|
|
331
|
+
* @notice Pop a slice from value.
|
|
332
|
+
*/
|
|
333
|
+
function _popValue(ResourceId resource, bytes32 tag) internal {
|
|
334
|
+
bytes32[] memory _keyTuple = new bytes32[](2);
|
|
335
|
+
_keyTuple[0] = ResourceId.unwrap(resource);
|
|
336
|
+
_keyTuple[1] = tag;
|
|
337
|
+
|
|
338
|
+
StoreCore.popFromDynamicField(_tableId, _keyTuple, 0, 1);
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
/**
|
|
342
|
+
* @notice Pop a slice from value.
|
|
343
|
+
*/
|
|
344
|
+
function pop(ResourceId resource, bytes32 tag) internal {
|
|
345
|
+
bytes32[] memory _keyTuple = new bytes32[](2);
|
|
346
|
+
_keyTuple[0] = ResourceId.unwrap(resource);
|
|
347
|
+
_keyTuple[1] = tag;
|
|
348
|
+
|
|
349
|
+
StoreSwitch.popFromDynamicField(_tableId, _keyTuple, 0, 1);
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
/**
|
|
353
|
+
* @notice Pop a slice from value.
|
|
354
|
+
*/
|
|
355
|
+
function _pop(ResourceId resource, bytes32 tag) internal {
|
|
356
|
+
bytes32[] memory _keyTuple = new bytes32[](2);
|
|
357
|
+
_keyTuple[0] = ResourceId.unwrap(resource);
|
|
358
|
+
_keyTuple[1] = tag;
|
|
359
|
+
|
|
360
|
+
StoreCore.popFromDynamicField(_tableId, _keyTuple, 0, 1);
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
/**
|
|
364
|
+
* @notice Update a slice of value at `_index`.
|
|
365
|
+
*/
|
|
366
|
+
function updateValue(ResourceId resource, bytes32 tag, uint256 _index, bytes memory _slice) internal {
|
|
367
|
+
bytes32[] memory _keyTuple = new bytes32[](2);
|
|
368
|
+
_keyTuple[0] = ResourceId.unwrap(resource);
|
|
369
|
+
_keyTuple[1] = tag;
|
|
370
|
+
|
|
371
|
+
unchecked {
|
|
372
|
+
bytes memory _encoded = bytes((_slice));
|
|
373
|
+
StoreSwitch.spliceDynamicData(_tableId, _keyTuple, 0, uint40(_index * 1), uint40(_encoded.length), _encoded);
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
/**
|
|
378
|
+
* @notice Update a slice of value at `_index`.
|
|
379
|
+
*/
|
|
380
|
+
function _updateValue(ResourceId resource, bytes32 tag, uint256 _index, bytes memory _slice) internal {
|
|
381
|
+
bytes32[] memory _keyTuple = new bytes32[](2);
|
|
382
|
+
_keyTuple[0] = ResourceId.unwrap(resource);
|
|
383
|
+
_keyTuple[1] = tag;
|
|
384
|
+
|
|
385
|
+
unchecked {
|
|
386
|
+
bytes memory _encoded = bytes((_slice));
|
|
387
|
+
StoreCore.spliceDynamicData(_tableId, _keyTuple, 0, uint40(_index * 1), uint40(_encoded.length), _encoded);
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
/**
|
|
392
|
+
* @notice Update a slice of value at `_index`.
|
|
393
|
+
*/
|
|
394
|
+
function update(ResourceId resource, bytes32 tag, uint256 _index, bytes memory _slice) internal {
|
|
395
|
+
bytes32[] memory _keyTuple = new bytes32[](2);
|
|
396
|
+
_keyTuple[0] = ResourceId.unwrap(resource);
|
|
397
|
+
_keyTuple[1] = tag;
|
|
398
|
+
|
|
399
|
+
unchecked {
|
|
400
|
+
bytes memory _encoded = bytes((_slice));
|
|
401
|
+
StoreSwitch.spliceDynamicData(_tableId, _keyTuple, 0, uint40(_index * 1), uint40(_encoded.length), _encoded);
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
/**
|
|
406
|
+
* @notice Update a slice of value at `_index`.
|
|
407
|
+
*/
|
|
408
|
+
function _update(ResourceId resource, bytes32 tag, uint256 _index, bytes memory _slice) internal {
|
|
409
|
+
bytes32[] memory _keyTuple = new bytes32[](2);
|
|
410
|
+
_keyTuple[0] = ResourceId.unwrap(resource);
|
|
411
|
+
_keyTuple[1] = tag;
|
|
412
|
+
|
|
413
|
+
unchecked {
|
|
414
|
+
bytes memory _encoded = bytes((_slice));
|
|
415
|
+
StoreCore.spliceDynamicData(_tableId, _keyTuple, 0, uint40(_index * 1), uint40(_encoded.length), _encoded);
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
/**
|
|
420
|
+
* @notice Delete all data for given keys.
|
|
421
|
+
*/
|
|
422
|
+
function deleteRecord(ResourceId resource, bytes32 tag) internal {
|
|
423
|
+
bytes32[] memory _keyTuple = new bytes32[](2);
|
|
424
|
+
_keyTuple[0] = ResourceId.unwrap(resource);
|
|
425
|
+
_keyTuple[1] = tag;
|
|
426
|
+
|
|
427
|
+
StoreSwitch.deleteRecord(_tableId, _keyTuple);
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
/**
|
|
431
|
+
* @notice Delete all data for given keys.
|
|
432
|
+
*/
|
|
433
|
+
function _deleteRecord(ResourceId resource, bytes32 tag) internal {
|
|
434
|
+
bytes32[] memory _keyTuple = new bytes32[](2);
|
|
435
|
+
_keyTuple[0] = ResourceId.unwrap(resource);
|
|
436
|
+
_keyTuple[1] = tag;
|
|
437
|
+
|
|
438
|
+
StoreCore.deleteRecord(_tableId, _keyTuple, _fieldLayout);
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
/**
|
|
442
|
+
* @notice Tightly pack dynamic data lengths using this table's schema.
|
|
443
|
+
* @return _encodedLengths The lengths of the dynamic fields (packed into a single bytes32 value).
|
|
444
|
+
*/
|
|
445
|
+
function encodeLengths(bytes memory value) internal pure returns (EncodedLengths _encodedLengths) {
|
|
446
|
+
// Lengths are effectively checked during copy by 2**40 bytes exceeding gas limits
|
|
447
|
+
unchecked {
|
|
448
|
+
_encodedLengths = EncodedLengthsLib.pack(bytes(value).length);
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
/**
|
|
453
|
+
* @notice Tightly pack dynamic (variable length) data using this table's schema.
|
|
454
|
+
* @return The dynamic data, encoded into a sequence of bytes.
|
|
455
|
+
*/
|
|
456
|
+
function encodeDynamic(bytes memory value) internal pure returns (bytes memory) {
|
|
457
|
+
return abi.encodePacked(bytes((value)));
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
/**
|
|
461
|
+
* @notice Encode all of a record's fields.
|
|
462
|
+
* @return The static (fixed length) data, encoded into a sequence of bytes.
|
|
463
|
+
* @return The lengths of the dynamic fields (packed into a single bytes32 value).
|
|
464
|
+
* @return The dynamic (variable length) data, encoded into a sequence of bytes.
|
|
465
|
+
*/
|
|
466
|
+
function encode(bytes memory value) internal pure returns (bytes memory, EncodedLengths, bytes memory) {
|
|
467
|
+
bytes memory _staticData;
|
|
468
|
+
EncodedLengths _encodedLengths = encodeLengths(value);
|
|
469
|
+
bytes memory _dynamicData = encodeDynamic(value);
|
|
470
|
+
|
|
471
|
+
return (_staticData, _encodedLengths, _dynamicData);
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
/**
|
|
475
|
+
* @notice Encode keys as a bytes32 array using this table's field layout.
|
|
476
|
+
*/
|
|
477
|
+
function encodeKeyTuple(ResourceId resource, bytes32 tag) internal pure returns (bytes32[] memory) {
|
|
478
|
+
bytes32[] memory _keyTuple = new bytes32[](2);
|
|
479
|
+
_keyTuple[0] = ResourceId.unwrap(resource);
|
|
480
|
+
_keyTuple[1] = tag;
|
|
481
|
+
|
|
482
|
+
return _keyTuple;
|
|
483
|
+
}
|
|
484
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity >=0.8.24;
|
|
3
|
+
|
|
4
|
+
/* Autogenerated file. Do not edit manually. */
|
|
5
|
+
|
|
6
|
+
import { ResourceId } from "@latticexyz/store/src/ResourceId.sol";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @title IMetadataSystem
|
|
10
|
+
* @author MUD (https://mud.dev) by Lattice (https://lattice.xyz)
|
|
11
|
+
* @dev This interface is automatically generated from the corresponding system contract. Do not edit manually.
|
|
12
|
+
*/
|
|
13
|
+
interface IMetadataSystem {
|
|
14
|
+
function metadata__getResourceTag(ResourceId resource, bytes32 tag) external view returns (bytes memory);
|
|
15
|
+
|
|
16
|
+
function metadata__setResourceTag(ResourceId resource, bytes32 tag, bytes memory value) external;
|
|
17
|
+
|
|
18
|
+
function metadata__deleteResourceTag(ResourceId resource, bytes32 tag) external;
|
|
19
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity >=0.8.24;
|
|
3
|
+
|
|
4
|
+
/* Autogenerated file. Do not edit manually. */
|
|
5
|
+
|
|
6
|
+
import { IBaseWorld } from "@latticexyz/world/src/codegen/interfaces/IBaseWorld.sol";
|
|
7
|
+
import { IMetadataSystem } from "./IMetadataSystem.sol";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @title IWorld
|
|
11
|
+
* @author MUD (https://mud.dev) by Lattice (https://lattice.xyz)
|
|
12
|
+
* @notice This interface integrates all systems and associated function selectors
|
|
13
|
+
* that are dynamically registered in the World during deployment.
|
|
14
|
+
* @dev This is an autogenerated file; do not edit manually.
|
|
15
|
+
*/
|
|
16
|
+
interface IWorld is IBaseWorld, IMetadataSystem {}
|
package/src/common.sol
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity >=0.8.24;
|
|
3
|
+
|
|
4
|
+
import { ResourceId, WorldResourceIdInstance } from "@latticexyz/world/src/WorldResourceId.sol";
|
|
5
|
+
import { IWorldErrors } from "@latticexyz/world/src/IWorldErrors.sol";
|
|
6
|
+
import { ResourceAccess } from "@latticexyz/world/src/codegen/tables/ResourceAccess.sol";
|
|
7
|
+
import { NamespaceOwner } from "@latticexyz/world/src/codegen/tables/NamespaceOwner.sol";
|
|
8
|
+
import { ResourceIds } from "@latticexyz/store/src/codegen/tables/ResourceIds.sol";
|
|
9
|
+
|
|
10
|
+
using WorldResourceIdInstance for ResourceId;
|
|
11
|
+
|
|
12
|
+
// TODO: move these to world
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @notice Checks if the caller has access to the given resource ID or its namespace.
|
|
16
|
+
* @param resourceId The resource ID to check access for.
|
|
17
|
+
* @param caller The address of the caller.
|
|
18
|
+
* @return true if the caller has access, false otherwise.
|
|
19
|
+
*/
|
|
20
|
+
function hasAccess(ResourceId resourceId, address caller) view returns (bool) {
|
|
21
|
+
return
|
|
22
|
+
// First check access based on the namespace. If caller has no namespace access, check access on the resource.
|
|
23
|
+
ResourceAccess.get(resourceId.getNamespaceId(), caller) || ResourceAccess.get(resourceId, caller);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* @notice Check for access at the given namespace or resource.
|
|
28
|
+
* @param resourceId The resource ID to check access for.
|
|
29
|
+
* @param caller The address of the caller.
|
|
30
|
+
* @dev Reverts with IWorldErrors.World_AccessDenied if access is denied.
|
|
31
|
+
*/
|
|
32
|
+
function requireAccess(ResourceId resourceId, address caller) view {
|
|
33
|
+
// Check if the given caller has access to the given namespace or name
|
|
34
|
+
if (!hasAccess(resourceId, caller)) {
|
|
35
|
+
revert IWorldErrors.World_AccessDenied(resourceId.toString(), caller);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* @notice Check for ownership of the namespace of the given resource ID.
|
|
41
|
+
* @dev Reverts with IWorldErrors.World_AccessDenied if caller is not owner of the namespace of the resource.
|
|
42
|
+
* @param resourceId The resource ID to check ownership for.
|
|
43
|
+
* @param caller The address of the caller.
|
|
44
|
+
*/
|
|
45
|
+
function requireOwner(ResourceId resourceId, address caller) view {
|
|
46
|
+
if (NamespaceOwner.get(resourceId.getNamespaceId()) != caller) {
|
|
47
|
+
revert IWorldErrors.World_AccessDenied(resourceId.toString(), caller);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* @notice Check for existence of the given resource ID.
|
|
53
|
+
* @dev Reverts with IWorldErrors.World_ResourceNotFound if the resource does not exist.
|
|
54
|
+
* @param resourceId The resource ID to check existence for.
|
|
55
|
+
*/
|
|
56
|
+
function requireExistence(ResourceId resourceId) view {
|
|
57
|
+
if (!ResourceIds.getExists(resourceId)) {
|
|
58
|
+
revert IWorldErrors.World_ResourceNotFound(resourceId, resourceId.toString());
|
|
59
|
+
}
|
|
60
|
+
}
|