From fb3abde64f7327d0315a7e5e804b6bfdce0b7868 Mon Sep 17 00:00:00 2001 From: MrDeadCe11 Date: Fri, 21 Jun 2024 22:27:43 -0500 Subject: [PATCH 1/7] added items tables to mud config --- packages/contracts/mud.config.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/contracts/mud.config.ts b/packages/contracts/mud.config.ts index 6265c6a50..15291b720 100644 --- a/packages/contracts/mud.config.ts +++ b/packages/contracts/mud.config.ts @@ -14,6 +14,7 @@ export default defineWorld({ "Mage", // 2 ], RngRequestType: ["CharacterStats", "Combat", "WorldGeneration"], + ItemType: ["Weapon", "Armor", "Potion", "Scroll", "Material"], }, tables: { /** @@ -48,6 +49,14 @@ export default defineWorld({ }, key: ["contractAddress"], }, + Items: { + schema: { + itemId: "uint256", + itemType: "ItemType", + stats: "bytes", + }, + key: ["itemId"], + }, /** * Stores players chosen names. */ From 6a9532f7b9422459812252801271043c0e2971d7 Mon Sep 17 00:00:00 2001 From: MrDeadCe11 Date: Fri, 21 Jun 2024 22:35:15 -0500 Subject: [PATCH 2/7] forge install: ERC1155-puppet --- .gitmodules | 3 +++ lib/ERC1155-puppet | 1 + 2 files changed, 4 insertions(+) create mode 100644 .gitmodules create mode 160000 lib/ERC1155-puppet diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 000000000..8d1427b1f --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "lib/ERC1155-puppet"] + path = lib/ERC1155-puppet + url = https://github.com/MrDeadCe11/ERC1155-puppet diff --git a/lib/ERC1155-puppet b/lib/ERC1155-puppet new file mode 160000 index 000000000..3988bc4d4 --- /dev/null +++ b/lib/ERC1155-puppet @@ -0,0 +1 @@ +Subproject commit 3988bc4d4ec1cfcb32f2cefcec5475b74951e77c From 15bbf4574eb72a958f288eefa82d8cd44e3a67f1 Mon Sep 17 00:00:00 2001 From: MrDeadCe11 Date: Sat, 22 Jun 2024 00:19:55 -0500 Subject: [PATCH 3/7] Items contract included and set up --- lib/ERC1155-puppet | 1 - .gitmodules => packages/contracts/.gitmodules | 0 packages/contracts/constants.sol | 1 + .../lib/ERC1155-puppet/ERC1155Module.sol | 102 +++ .../lib/ERC1155-puppet/ERC1155System.sol | 555 +++++++++++++++++ .../contracts/lib/ERC1155-puppet/IERC1155.sol | 90 +++ .../lib/ERC1155-puppet/IERC1155Errors.sol | 63 ++ .../lib/ERC1155-puppet/IERC1155Events.sol | 36 ++ .../ERC1155-puppet/IERC1155MetadataURI.sol | 19 + .../lib/ERC1155-puppet/IERC1155Receiver.sol | 54 ++ .../lib/ERC1155-puppet/IERC1155System.sol | 55 ++ .../lib/ERC1155-puppet/constants.sol | 22 + .../ERC1155-puppet/libraries/LibString.sol | 77 +++ .../libraries/utils/ERC1155Utils.sol | 85 +++ .../libraries/utils/draft-IERC6093.sol | 161 +++++ .../lib/ERC1155-puppet/registerERC1155.sol | 37 ++ .../tables/ERC1155MetadataURI.sol | 414 +++++++++++++ .../ERC1155-puppet/tables/ERC1155Registry.sol | 321 ++++++++++ .../tables/ERC1155URIStorage.sol | 446 +++++++++++++ .../tables/OperatorApproval.sol | 220 +++++++ .../lib/ERC1155-puppet/tables/Owners.sol | 208 +++++++ .../lib/ERC1155-puppet/tables/TestConfig.sol | 300 +++++++++ .../lib/ERC1155-puppet/tables/TotalSupply.sol | 318 ++++++++++ .../contracts/lib/ERC1155-puppet/utils.sol | 48 ++ packages/contracts/mud.config.ts | 9 + .../contracts/out/IWorld.sol/IWorld.abi.json | 156 +++++ .../out/IWorld.sol/IWorld.abi.json.d.ts | 156 +++++ packages/contracts/out/IWorld.sol/IWorld.json | 2 +- packages/contracts/remappings.txt | 1 + packages/contracts/script/PostDeploy.s.sol | 331 +++++----- packages/contracts/src/codegen/common.sol | 8 + packages/contracts/src/codegen/index.sol | 2 + .../contracts/src/codegen/tables/Items.sol | 478 ++++++++++++++ .../src/codegen/tables/StarterItems.sol | 585 ++++++++++++++++++ .../codegen/tables/UltimateDominionConfig.sol | 102 ++- .../src/codegen/world/IItemsSystem.sol | 31 + .../world/IUltimateDominionConfigSystem.sol | 2 + .../contracts/src/codegen/world/IWorld.sol | 3 +- packages/contracts/src/interfaces/Structs.sol | 8 + .../contracts/src/systems/CharacterSystem.sol | 10 +- .../contracts/src/systems/ItemsSystem.sol | 106 ++++ .../systems/UltimateDominionConfigSystem.sol | 32 +- packages/contracts/src/utils.sol | 24 +- packages/contracts/test/ItemsSystem.t.sol | 75 +++ packages/contracts/test/SetUp.sol | 3 + packages/contracts/worlds.json | 2 +- 46 files changed, 5566 insertions(+), 193 deletions(-) delete mode 160000 lib/ERC1155-puppet rename .gitmodules => packages/contracts/.gitmodules (100%) create mode 100644 packages/contracts/lib/ERC1155-puppet/ERC1155Module.sol create mode 100644 packages/contracts/lib/ERC1155-puppet/ERC1155System.sol create mode 100644 packages/contracts/lib/ERC1155-puppet/IERC1155.sol create mode 100644 packages/contracts/lib/ERC1155-puppet/IERC1155Errors.sol create mode 100644 packages/contracts/lib/ERC1155-puppet/IERC1155Events.sol create mode 100644 packages/contracts/lib/ERC1155-puppet/IERC1155MetadataURI.sol create mode 100644 packages/contracts/lib/ERC1155-puppet/IERC1155Receiver.sol create mode 100644 packages/contracts/lib/ERC1155-puppet/IERC1155System.sol create mode 100644 packages/contracts/lib/ERC1155-puppet/constants.sol create mode 100644 packages/contracts/lib/ERC1155-puppet/libraries/LibString.sol create mode 100644 packages/contracts/lib/ERC1155-puppet/libraries/utils/ERC1155Utils.sol create mode 100644 packages/contracts/lib/ERC1155-puppet/libraries/utils/draft-IERC6093.sol create mode 100644 packages/contracts/lib/ERC1155-puppet/registerERC1155.sol create mode 100644 packages/contracts/lib/ERC1155-puppet/tables/ERC1155MetadataURI.sol create mode 100644 packages/contracts/lib/ERC1155-puppet/tables/ERC1155Registry.sol create mode 100644 packages/contracts/lib/ERC1155-puppet/tables/ERC1155URIStorage.sol create mode 100644 packages/contracts/lib/ERC1155-puppet/tables/OperatorApproval.sol create mode 100644 packages/contracts/lib/ERC1155-puppet/tables/Owners.sol create mode 100644 packages/contracts/lib/ERC1155-puppet/tables/TestConfig.sol create mode 100644 packages/contracts/lib/ERC1155-puppet/tables/TotalSupply.sol create mode 100644 packages/contracts/lib/ERC1155-puppet/utils.sol create mode 100644 packages/contracts/src/codegen/tables/Items.sol create mode 100644 packages/contracts/src/codegen/tables/StarterItems.sol create mode 100644 packages/contracts/src/codegen/world/IItemsSystem.sol create mode 100644 packages/contracts/src/interfaces/Structs.sol create mode 100644 packages/contracts/src/systems/ItemsSystem.sol create mode 100644 packages/contracts/test/ItemsSystem.t.sol diff --git a/lib/ERC1155-puppet b/lib/ERC1155-puppet deleted file mode 160000 index 3988bc4d4..000000000 --- a/lib/ERC1155-puppet +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 3988bc4d4ec1cfcb32f2cefcec5475b74951e77c diff --git a/.gitmodules b/packages/contracts/.gitmodules similarity index 100% rename from .gitmodules rename to packages/contracts/.gitmodules diff --git a/packages/contracts/constants.sol b/packages/contracts/constants.sol index 0bfa7f8c7..2b22ddbc4 100644 --- a/packages/contracts/constants.sol +++ b/packages/contracts/constants.sol @@ -3,6 +3,7 @@ pragma solidity >=0.8.24; bytes14 constant GOLD_NAMESPACE = "Gold"; bytes14 constant CHARACTERS_NAMESPACE = "Characters"; +bytes14 constant ITEMS_NAMESPACE = "Items"; bytes14 constant WORLD_NAMESPACE = "UD"; string constant ERC721_NAME = "UDCharacters"; diff --git a/packages/contracts/lib/ERC1155-puppet/ERC1155Module.sol b/packages/contracts/lib/ERC1155-puppet/ERC1155Module.sol new file mode 100644 index 000000000..3a67dcf67 --- /dev/null +++ b/packages/contracts/lib/ERC1155-puppet/ERC1155Module.sol @@ -0,0 +1,102 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.20; + +import {ResourceIds} from "@latticexyz/store/src/codegen/tables/ResourceIds.sol"; +import {ResourceId} from "@latticexyz/store/src/ResourceId.sol"; +import {Module} from "@latticexyz/world/src/Module.sol"; +import {WorldResourceIdLib} from "@latticexyz/world/src/WorldResourceId.sol"; +import {IBaseWorld} from "@latticexyz/world/src/codegen/interfaces/IBaseWorld.sol"; +import {InstalledModules} from "@latticexyz/world/src/codegen/tables/InstalledModules.sol"; +import {revertWithBytes} from "@latticexyz/world/src/revertWithBytes.sol"; + +import {Puppet} from "@latticexyz/world-modules/src/modules/puppet/Puppet.sol"; +import {createPuppet} from "@latticexyz/world-modules/src/modules/puppet/createPuppet.sol"; + +import {MODULE_NAMESPACE, MODULE_NAMESPACE_ID, ERC1155_REGISTRY_TABLE_ID} from "./constants.sol"; +import { + _erc1155SystemId, + _totalSupplyTableId, + _erc1155URIStorageSystemId, + _metadataTableId, + _erc1155URIStorageTableId, + _operatorApprovalTableId, + _ownersTableId +} from "./utils.sol"; +import {ERC1155System} from "./ERC1155System.sol"; + +import {Owners} from "./tables/Owners.sol"; +import {OperatorApproval} from "./tables/OperatorApproval.sol"; +import {ERC1155Registry} from "./tables/ERC1155Registry.sol"; +import {ERC1155MetadataURI} from "./tables/ERC1155MetadataURI.sol"; +import {ERC1155URIStorage} from "./tables/ERC1155URIStorage.sol"; +import {TotalSupply} from "./tables/TotalSupply.sol"; +import "forge-std/console2.sol"; + +contract ERC1155Module is Module { + error ERC1155Module_InvalidNamespace(bytes14 namespace); + + address public immutable registrationLibrary = address(new ERC1155ModuleRegistrationLibrary()); + + function install(bytes memory encodedArgs) public { + // Require the module to not be installed with these args yet + requireNotInstalled(__self, encodedArgs); + + // Decode args + (bytes14 namespace, string memory metaDataURI) = abi.decode(encodedArgs, (bytes14, string)); + + // Require the namespace to not be the module's namespace + if (namespace == MODULE_NAMESPACE) { + revert ERC1155Module_InvalidNamespace(namespace); + } + + // Register the ERC1155 tables and system + IBaseWorld world = IBaseWorld(_world()); + (bool success, bytes memory returnData) = registrationLibrary.delegatecall( + abi.encodeCall(ERC1155ModuleRegistrationLibrary.register, (world, namespace)) + ); + if (!success) revertWithBytes(returnData); + + ERC1155MetadataURI.set(_metadataTableId(namespace), metaDataURI); + + // Deploy and register the ERC1155 puppet. + ResourceId erc1155SystemId = _erc1155SystemId(namespace); + address puppet = createPuppet(world, erc1155SystemId); + + // Transfer ownership of the namespace to the caller + ResourceId namespaceId = WorldResourceIdLib.encodeNamespace(namespace); + world.transferOwnership(namespaceId, _msgSender()); + + // Register the ERC1155 in the ERC1155Registry + if (!ResourceIds.getExists(ERC1155_REGISTRY_TABLE_ID)) { + world.registerNamespace(MODULE_NAMESPACE_ID); + ERC1155Registry.register(ERC1155_REGISTRY_TABLE_ID); + } + + ERC1155Registry.setTokenAddress(ERC1155_REGISTRY_TABLE_ID, namespaceId, puppet); + } + + function installRoot(bytes memory) public pure { + revert Module_RootInstallNotSupported(); + } +} + +contract ERC1155ModuleRegistrationLibrary { + /** + * Register systems and tables for a new ERC1155 token in a given namespace + */ + function register(IBaseWorld world, bytes14 namespace) public { + // Register the namespace if it doesn't exist yet + ResourceId tokenNamespace = WorldResourceIdLib.encodeNamespace(namespace); + world.registerNamespace(tokenNamespace); + + // Register the tables + OperatorApproval.register(_operatorApprovalTableId(namespace)); + Owners.register(_ownersTableId(namespace)); + ERC1155MetadataURI.register(_metadataTableId(namespace)); + ERC1155URIStorage.register(_erc1155URIStorageTableId(namespace)); + TotalSupply.register(_totalSupplyTableId(namespace)); + + // Register a new ERC1155System + world.registerSystem(_erc1155SystemId(namespace), new ERC1155System(), true); + } +} diff --git a/packages/contracts/lib/ERC1155-puppet/ERC1155System.sol b/packages/contracts/lib/ERC1155-puppet/ERC1155System.sol new file mode 100644 index 000000000..3b3e72111 --- /dev/null +++ b/packages/contracts/lib/ERC1155-puppet/ERC1155System.sol @@ -0,0 +1,555 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.20; + +import {ResourceId} from "@latticexyz/store/src/ResourceId.sol"; +import {System} from "@latticexyz/world/src/System.sol"; +import {WorldResourceIdInstance} from "@latticexyz/world/src/WorldResourceId.sol"; +import {SystemRegistry} from "@latticexyz/world/src/codegen/tables/SystemRegistry.sol"; + +import {AccessControlLib} from "@latticexyz/world-modules/src/utils/AccessControlLib.sol"; +import {PuppetMaster} from "@latticexyz/world-modules/src/modules/puppet/PuppetMaster.sol"; +import {toTopic} from "@latticexyz/world-modules/src/modules/puppet/utils.sol"; + +import {IERC1155Receiver} from "./IERC1155Receiver.sol"; +import {IERC1155} from "./IERC1155.sol"; +import {IERC1155MetadataURI} from "./IERC1155MetadataURI.sol"; + +import {ERC1155MetadataURI} from "./tables/ERC1155MetadataURI.sol"; +import {ERC1155URIStorage} from "./tables/ERC1155URIStorage.sol"; +import {OperatorApproval} from "./tables/OperatorApproval.sol"; +import {Owners} from "./tables/Owners.sol"; +import {TotalSupply} from "./tables/TotalSupply.sol"; +import {ERC1155Utils} from "./libraries/utils/ERC1155Utils.sol"; + +import { + _metadataTableId, + _erc1155URIStorageTableId, + _totalSupplyTableId, + _operatorApprovalTableId, + _ownersTableId +} from "./utils.sol"; + +import {LibString} from "./libraries/LibString.sol"; +import "forge-std/console2.sol"; + +contract ERC1155System is IERC1155MetadataURI, System, PuppetMaster { + using WorldResourceIdInstance for ResourceId; + using LibString for uint256; + + /** + * @dev See {IERC1155-setApprovalForAll}. + */ + function setApprovalForAll(address operator, bool approved) public virtual { + _setApprovalForAll(_msgSender(), operator, approved); + } + + /** + * @dev See {IERC1155-isApprovedForAll}. + */ + function isApprovedForAll(address owner, address operator) public view virtual returns (bool) { + return OperatorApproval.getApproved(_operatorApprovalTableId(_namespace()), owner, operator); + } + + /** + * @dev See {IERC1155-transferFrom}. + */ + function transferFrom(address from, address to, uint256 tokenId, uint256 value) public virtual { + if (to == address(0)) revert ERC1155InvalidReceiver(to); + // (from != 0). Therefore, it is not needed to verify that the return value is not 0 here. + _transfer(from, to, tokenId, value); + } + + /** + * @dev See {IERC1155-safeTransferFrom}. + */ + function safeTransferFrom(address from, address to, uint256 tokenId, uint256 value, bytes memory data) + public + virtual + { + _safeTransferFrom(from, to, tokenId, value, data); + } + + function safeBatchTransferFrom( + address from, + address to, + uint256[] calldata ids, + uint256[] calldata values, + bytes calldata data + ) external virtual { + if (to == address(0)) revert ERC1155InvalidReceiver(to); + for (uint256 i; i < ids.length; i++) { + _safeTransferFrom(from, to, ids[i], values[i], data); + } + } + + /** + * @dev Mints `tokenId` and transfers it to `to`. + * + * Requirements: + * + * - caller must own the namespace + * - `tokenId` must not exist. + * - `to` cannot be the zero address. + * + * Emits a {Transfer} event. + */ + function mint(address to, uint256 tokenId, uint256 value, bytes memory data) public virtual { + _requireOwner(); + if (to == address(0)) revert ERC1155InvalidReceiver(to); + (uint256[] memory ids, uint256[] memory values) = _asSingletonArrays(tokenId, value); + _update(address(0), to, ids, values); + } + + /** + * @dev Mints `tokenId` and transfers it to `to`. + * + * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible + * + * Requirements: + * + * - `tokenId` must not exist. + * - `to` cannot be the zero address. + * + * Emits a {Transfer} event. + */ + // function _mint(address to, uint256 tokenId, uint256 value, bytes memory data) internal { + // _requireOwner(); + // if(to == address(0))revert ERC1155InvalidReceiver(to); + // (uint256[] memory ids, uint256[] memory values) = _asSingletonArrays(tokenId, value); + // _update(address(0), to, ids, values); + // } + + /** + * @dev Mints `tokenId`, transfers it to `to` and checks for `to` acceptance. + * + * Requirements: + * + * - caller must own the namespace + * - `tokenId` must not exist. + * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received}, which is called upon a safe transfer. + * + * Emits a {Transfer} event. + */ + function safeMint(address to, uint256 tokenId, uint256 value, bytes memory data) public virtual { + mint(to, tokenId, value, data); + _checkOnERC1155Received(address(0), to, tokenId, value, data); + } + + /** + * @dev Destroys `tokenId`. + * The approval is cleared when the token is burned. + * + * Requirements: + * - caller must own the namespace + * - `tokenId` must exist. + * + * Emits a {Transfer} event. + */ + function burn(uint256 tokenId, uint256 value) public { + _burn(_msgSender(), tokenId, value); + } + + /** + * @dev See {IERC1155-balanceOf}. + */ + function balanceOf(address owner, uint256 id) public view virtual returns (uint256) { + return Owners.getBalance(_ownersTableId(_namespace()), owner, id); + } + + /** + * @dev See {IERC1155-balanceOfBatch}. + * + * Requirements: + * + * - `accounts` and `ids` must have the same length. + */ + function balanceOfBatch(address[] memory accounts, uint256[] memory ids) + public + view + virtual + returns (uint256[] memory) + { + if (accounts.length != ids.length) { + revert ERC1155InvalidArrayLength(ids.length, accounts.length); + } + + uint256[] memory batchBalances = new uint256[](accounts.length); + + for (uint256 i = 0; i < accounts.length; ++i) { + batchBalances[i] = balanceOf(accounts[i], ids[i]); + } + + return batchBalances; + } + + /** + * @dev See {IERC1155MetadataURI-uri}. + * + * This implementation returns the same URI for *all* token types. It relies + * on the token type ID substitution mechanism + * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the ERC]. + * + * Clients calling this function must replace the `\{id\}` substring with the + * actual token type ID. + */ + function uri(uint256 tokenId) public view returns (string memory) { + string memory baseURI = ERC1155MetadataURI.getUri(_metadataTableId(_namespace())); + string memory tokenURI = ERC1155URIStorage.getUri(_erc1155URIStorageTableId(_namespace()), tokenId); + + // If token URI is set, concatenate base URI and tokenURI (via string.concat). + return bytes(tokenURI).length > 0 ? string.concat(baseURI, tokenURI) : baseURI; + } + + function _setTokenUri(bytes14 namespace, uint256 tokenId, string memory uri) internal { + _requireOwner(); + ERC1155URIStorage.setUri(_erc1155URIStorageTableId(namespace), tokenId, uri); + } + + /** + * @dev Returns whether `spender` is allowed to manage `owner`'s tokens, or `tokenId` in + * particular (ignoring whether it is owned by `owner`). + * + * WARNING: This function assumes that `owner` is the actual owner of `tokenId` and does not verify this + * assumption. + */ + function _isAuthorized(address owner, address spender) internal view virtual returns (bool) { + return spender != address(0) && (owner == spender || isApprovedForAll(owner, spender)); + } + + /** + * @dev Unsafe write access to the balances, used by extensions that 'mint' tokens using an {ownerOf} override. + * + * NOTE: the value is limited to type(uint128).max. This protect against _balance overflow. It is unrealistic that + * a uint256 would ever overflow from increments when these increments are bounded to uint128 values. + * + * WARNING: Increasing an account's balance using this function tends to be paired with an override of the + * {_ownerOf} function to resolve the ownership of the corresponding tokens so that balances and ownership + * remain consistent with one another. + */ + function _setAccountBalance(address account, uint256 tokenId, int256 delta) internal returns (uint256 balance) { + if (delta < 0) { + balance = uint256(balanceOf(account, tokenId) - uint256(-delta)); + } else { + balance = uint256(balanceOf(account, tokenId) + uint256(delta)); + } + Owners.setBalance(_ownersTableId(_namespace()), account, tokenId, balance); + } + + function _setTotalSupply(uint256 tokenId, int256 delta) internal returns (uint256 supply) { + uint256 totalSupply = TotalSupply.getTotalSupply(_totalSupplyTableId(_namespace()), tokenId); + if (delta < 0) { + supply = totalSupply - uint256(-delta); + } else { + supply = totalSupply + uint256(delta); + } + TotalSupply.setTotalSupply(_totalSupplyTableId(_namespace()), tokenId, supply); + } + + /** + * @dev Transfers `tokenId` from its current owner to `to`, or alternatively mints (or burns) if the current owner + * (or `to`) is the zero address. Returns the owner of the `tokenId` before the update. + * + * The `auth` argument is optional. If the value passed is non 0, then this function will check that + * `auth` is either the owner of the token, or approved to operate on the token (by the owner). + * + * Emits a {Transfer} event. + * + * NOTE: If overriding this function in a way that tracks balances, see also {_increaseBalance}. + */ + function _update(address from, address to, uint256[] memory tokenIds, uint256[] memory _values) + internal + virtual + returns (address) + { + uint256 len = tokenIds.length; + if (len != _values.length) revert ERC1155InvalidArrayLength(len, _values.length); + if (_msgSender() != from && from != address(0)) { + if (!_isAuthorized(from, _msgSender())) revert ERC1155MissingApprovalForAll(_msgSender(), from); + } + + // check if both to and from are address(0) + if (from == address(0) && to == address(0)) revert ERC1155NonexistentToken(10); + uint256 fromBalance; + uint256 tokenId; + uint256 _value; + for (uint256 i; i < len; i++) { + tokenId = tokenIds[i]; + _value = _values[i]; + + if (from == address(0)) { + _requireOwner(); + // Overflow check required: The rest of the code assumes that totalSupply never overflows + _setTotalSupply(tokenId, int256(_value)); + } else { + if (TotalSupply.getTotalSupply(_totalSupplyTableId(_namespace()), tokenId) == 0) { + revert ERC1155NonexistentToken(tokenId); + } + fromBalance = balanceOf(from, tokenId); + if (fromBalance < _value) { + revert ERC1155InsufficientBalance(from, fromBalance, _value, tokenId); + } + } + + // Perform (optional) operator check + if (to != address(0)) { + unchecked { + _setAccountBalance(to, tokenId, int256(_value)); + } + } + + // Execute the update + if (from != address(0)) { + unchecked { + _setAccountBalance(from, tokenId, -int256(_value)); + } + } + } + + if (len == 1) { + // Emit Transfer event on puppet + puppet().log( + TransferSingle.selector, + toTopic(_msgSender()), + toTopic(from), + toTopic(to), + abi.encode(tokenIds[0], _values[0]) + ); + } else { + puppet().log( + TransferBatch.selector, toTopic(_msgSender()), toTopic(from), toTopic(to), abi.encode(tokenIds, _values) + ); + } + return from; + } + + /** + * @dev Destroys `tokenId`. + * The approval is cleared when the token is burned. + * This is an internal function that does not check if the sender is authorized to operate on the token. + * + * Requirements: + * + * - `tokenId` must exist. + * + * Emits a {Transfer} event. + */ + function _burn(address account, uint256 tokenId, uint256 value) internal { + (uint256[] memory ids, uint256[] memory values) = _asSingletonArrays(tokenId, value); + + _update(account, address(0), ids, values); + _setTotalSupply(tokenId, -int256(value)); + } + + /** + * @dev Transfers `tokenId` from `from` to `to`. + * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. + * + * Requirements: + * + * - `to` cannot be the zero address. + * - `tokenId` token must be owned by `from`. + * + * Emits a {Transfer} event. + */ + function _transfer(address from, address to, uint256 tokenId, uint256 value) internal { + if (to == address(0)) { + revert ERC1155InvalidReceiver(address(0)); + } + (uint256[] memory ids, uint256[] memory values) = _asSingletonArrays(tokenId, value); + _update(from, to, ids, values); + } + + /** + * @dev Safely transfers `tokenId` token from `from` to `to`, checking that contract recipients + * are aware of the ERC1155 standard to prevent tokens from being forever locked. + * + * `data` is additional data, it has no specified format and it is sent in call to `to`. + * + * This internal function is like {safeTransferFrom} in the sense that it invokes + * {IERC1155Receiver-onERC1155Received} on the receiver, and can be used to e.g. + * implement alternative mechanisms to perform token transfer, such as signature-based. + * + * Requirements: + * + * - `tokenId` token must exist and be owned by `from`. + * - `to` cannot be the zero address. + * - `from` cannot be the zero address. + * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received}, which is called upon a safe transfer. + * + * Emits a {Transfer} event. + */ + function _safeTransfer(address from, address to, uint256 tokenId, uint256 value) internal { + _safeTransfer(from, to, tokenId, value, ""); + } + + /** + * @dev Transfers a `value` tokens of token type `id` from `from` to `to`. + * + * Emits a {TransferSingle} event. + * + * Requirements: + * + * - `to` cannot be the zero address. + * - `from` must have a balance of tokens of type `id` of at least `value` amount. + * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the + * acceptance magic value. + */ + function _safeTransferFrom(address from, address to, uint256 id, uint256 value, bytes memory data) internal { + if (to == address(0)) { + revert ERC1155InvalidReceiver(address(0)); + } + if (from == address(0)) { + revert ERC1155InvalidSender(address(0)); + } + (uint256[] memory ids, uint256[] memory values) = _asSingletonArrays(id, value); + _updateWithAcceptanceCheck(from, to, ids, values, data); + } + + /** + * @dev Version of {_update} that performs the token acceptance check by calling + * {IERC1155Receiver-onERC1155Received} or {IERC1155Receiver-onERC1155BatchReceived} on the receiver address if it + * contains code (eg. is a smart contract at the moment of execution). + * + * IMPORTANT: Overriding this function is discouraged because it poses a reentrancy risk from the receiver. So any + * update to the contract state after this function would break the check-effect-interaction pattern. Consider + * overriding {_update} instead. + */ + function _updateWithAcceptanceCheck( + address from, + address to, + uint256[] memory ids, + uint256[] memory values, + bytes memory data + ) internal virtual { + // todo create _update that takes an array of ids and values + _update(from, to, ids, values); + if (to != address(0)) { + address operator = _msgSender(); + if (ids.length == 1) { + uint256 id = ids[0]; + uint256 value = values[0]; + ERC1155Utils.checkOnERC1155Received(operator, from, to, id, value, data); + } else { + ERC1155Utils.checkOnERC1155BatchReceived(operator, from, to, ids, values, data); + } + } + } + + /** + * @dev Creates an array in memory with only one value for each of the elements provided. + */ + function _asSingletonArrays(uint256 element1, uint256 element2) + private + pure + returns (uint256[] memory array1, uint256[] memory array2) + { + /// @solidity memory-safe-assembly + assembly { + // Load the free memory pointer + array1 := mload(0x40) + // Set array length to 1 + mstore(array1, 1) + // Store the single element at the next word after the length (where content starts) + mstore(add(array1, 0x20), element1) + + // Repeat for next array locating it right after the first array + array2 := add(array1, 0x40) + mstore(array2, 1) + mstore(add(array2, 0x20), element2) + + // Update the free memory pointer by pointing after the second array + mstore(0x40, add(array2, 0x40)) + } + } + + /** + * @dev Same as {xref-ERC1155-_safeTransfer-address-address-uint256-}[`_safeTransfer`], with an additional `data` parameter which is + * forwarded in {IERC1155Receiver-onERC1155Received} to contract recipients. + */ + function _safeTransfer(address from, address to, uint256 tokenId, uint256 value, bytes memory data) + internal + virtual + { + (uint256[] memory ids, uint256[] memory values) = _asSingletonArrays(tokenId, value); + _updateWithAcceptanceCheck(_msgSender(), to, ids, values, data); + } + + /** + * @dev Approve `operator` to operate on all of `owner` tokens + * + * Requirements: + * - operator can't be the address zero. + * + * Emits an {ApprovalForAll} event. + */ + function _setApprovalForAll(address owner, address operator, bool approved) internal virtual { + if (operator == address(0)) { + revert ERC1155InvalidOperator(operator); + } + OperatorApproval.set(_operatorApprovalTableId(_namespace()), owner, operator, approved); + + // Emit ApprovalForAll event on puppet + puppet().log(ApprovalForAll.selector, toTopic(owner), toTopic(operator), abi.encode(approved)); + } + + /** + * @dev Private function to invoke {IERC1155Receiver-onERC1155Received} on a target address. This will revert if the + * recipient doesn't accept the token transfer. The call is not executed if the target address is not a contract. + * + * @param from address representing the previous owner of the given token ID + * @param to target address that will receive the tokens + * @param tokenId uint256 ID of the token to be transferred + * @param value the amount of a token being sent + * @param data bytes optional data to send along with the call + */ + function _checkOnERC1155Received(address from, address to, uint256 tokenId, uint256 value, bytes memory data) + private + { + if (to.code.length > 0) { + try IERC1155Receiver(to).onERC1155Received(_msgSender(), from, tokenId, value, data) returns (bytes4 retval) + { + if (retval != IERC1155Receiver.onERC1155Received.selector) { + revert ERC1155InvalidReceiver(to); + } + } catch (bytes memory reason) { + if (reason.length == 0) { + revert ERC1155InvalidReceiver(to); + } else { + /// @solidity memory-safe-assembly + assembly { + revert(add(32, reason), mload(reason)) + } + } + } + } + } + + function onERC1155Received( + address, /* to **/ + address, /* from **/ + uint256, /* tokenId **/ + uint256, /* value **/ + bytes calldata /* data **/ + ) external returns (bytes4 retval) { + return IERC1155Receiver.onERC1155Received.selector; + } + + function onERC1155BatchReceived( + address, /* to **/ + address, /* from **/ + uint256[] calldata, /* tokenIds **/ + uint256[] calldata, /* values **/ + bytes calldata /* data **/ + ) external returns (bytes4 retval) { + return IERC1155Receiver.onERC1155Received.selector; + } + + function _namespace() internal view returns (bytes14 namespace) { + ResourceId systemId = SystemRegistry.get(address(this)); + return systemId.getNamespace(); + } + + function _requireOwner() internal view { + AccessControlLib.requireOwner(SystemRegistry.get(address(this)), _msgSender()); + } +} diff --git a/packages/contracts/lib/ERC1155-puppet/IERC1155.sol b/packages/contracts/lib/ERC1155-puppet/IERC1155.sol new file mode 100644 index 000000000..46035a37a --- /dev/null +++ b/packages/contracts/lib/ERC1155-puppet/IERC1155.sol @@ -0,0 +1,90 @@ +// SPDX-License-Identifier: MIT +// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC1155/IERC1155.sol) +pragma solidity ^0.8.20; + +import {IERC1155Events} from "./IERC1155Events.sol"; +import {IERC1155Errors} from "./IERC1155Errors.sol"; + +/** + * @dev Required interface of an ERC1155 compliant contract. + */ +interface IERC1155 is IERC1155Events, IERC1155Errors { + /** + * @dev Returns the value of tokens of token type `id` owned by `account`. + */ + function balanceOf(address account, uint256 id) external view returns (uint256); + + /** + * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}. + * + * Requirements: + * + * - `accounts` and `ids` must have the same length. + */ + function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids) + external + view + returns (uint256[] memory); + + /** + * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`, + * + * Emits an {ApprovalForAll} event. + * + * Requirements: + * + * - `operator` cannot be the zero address. + */ + function setApprovalForAll(address operator, bool approved) external; + + /** + * @dev Returns true if `operator` is approved to transfer ``account``'s tokens. + * + * See {setApprovalForAll}. + */ + function isApprovedForAll(address account, address operator) external view returns (bool); + + /** + * @dev Transfers a `value` amount of tokens of type `id` from `from` to `to`. + * + * WARNING: This function can potentially allow a reentrancy attack when transferring tokens + * to an untrusted contract, when invoking {onERC1155Received} on the receiver. + * Ensure to follow the checks-effects-interactions pattern and consider employing + * reentrancy guards when interacting with untrusted contracts. + * + * Emits a {TransferSingle} event. + * + * Requirements: + * + * - `to` cannot be the zero address. + * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}. + * - `from` must have a balance of tokens of type `id` of at least `value` amount. + * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the + * acceptance magic value. + */ + function safeTransferFrom(address from, address to, uint256 id, uint256 value, bytes calldata data) external; + + /** + * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}. + * + * WARNING: This function can potentially allow a reentrancy attack when transferring tokens + * to an untrusted contract, when invoking {onERC1155BatchReceived} on the receiver. + * Ensure to follow the checks-effects-interactions pattern and consider employing + * reentrancy guards when interacting with untrusted contracts. + * + * Emits either a {TransferSingle} or a {TransferBatch} event, depending on the length of the array arguments. + * + * Requirements: + * + * - `ids` and `values` must have the same length. + * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the + * acceptance magic value. + */ + function safeBatchTransferFrom( + address from, + address to, + uint256[] calldata ids, + uint256[] calldata values, + bytes calldata data + ) external; +} diff --git a/packages/contracts/lib/ERC1155-puppet/IERC1155Errors.sol b/packages/contracts/lib/ERC1155-puppet/IERC1155Errors.sol new file mode 100644 index 000000000..58c2c41c5 --- /dev/null +++ b/packages/contracts/lib/ERC1155-puppet/IERC1155Errors.sol @@ -0,0 +1,63 @@ +// SPDX-License-Identifier: MIT +// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC6093.sol) +pragma solidity ^0.8.20; + +/** + * @dev Standard ERC1155 Errors + * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC1155 tokens. + */ +interface IERC1155Errors { + /** + * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers. + * @param sender Address whose tokens are being transferred. + * @param balance Current balance for the interacting account. + * @param needed Minimum amount required to perform a transfer. + * @param tokenId Identifier number of a token. + */ + error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId); + + /** + * @dev Indicates a failure with the token `sender`. Used in transfers. + * @param sender Address whose tokens are being transferred. + */ + error ERC1155InvalidSender(address sender); + + /** + * @dev Indicates a failure with the token `receiver`. Used in transfers. + * @param receiver Address to which tokens are being transferred. + */ + error ERC1155InvalidReceiver(address receiver); + + /** + * @dev Indicates a failure with the `operator`’s approval. Used in transfers. + * @param operator Address that may be allowed to operate on tokens without being their owner. + * @param owner Address of the current owner of a token. + */ + error ERC1155MissingApprovalForAll(address operator, address owner); + + /** + * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals. + * @param approver Address initiating an approval operation. + */ + error ERC1155InvalidApprover(address approver); + + /** + * @dev Indicates a failure with the `operator` to be approved. Used in approvals. + * @param operator Address that may be allowed to operate on tokens without being their owner. + */ + error ERC1155InvalidOperator(address operator); + + /** + * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation. + * Used in batch transfers. + * @param idsLength Length of the array of token identifiers + * @param valuesLength Length of the array of token amounts + */ + error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength); + + /** + * @dev Indicates the attempt to interact with a token ID that has not been created + * @param tokenId the token Id that doesn't exist + */ + error ERC1155NonexistentToken(uint256 tokenId); +} diff --git a/packages/contracts/lib/ERC1155-puppet/IERC1155Events.sol b/packages/contracts/lib/ERC1155-puppet/IERC1155Events.sol new file mode 100644 index 000000000..e9890040f --- /dev/null +++ b/packages/contracts/lib/ERC1155-puppet/IERC1155Events.sol @@ -0,0 +1,36 @@ +// SPDX-License-Identifier: MIT +// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC1155/IERC1155.sol) +pragma solidity ^0.8.20; + +/** + * @dev Events emitted by an ERC1155 compliant contract. + */ +interface IERC1155Events { + /** + * @dev Emitted when `value` amount of tokens of type `id` are transferred from `from` to `to` by `operator`. + */ + event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value); + + /** + * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all + * transfers. + */ + event TransferBatch( + address indexed operator, address indexed from, address indexed to, uint256[] ids, uint256[] values + ); + + /** + * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to + * `approved`. + */ + event ApprovalForAll(address indexed account, address indexed operator, bool approved); + + /** + * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI. + * + * If an {URI} event was emitted for `id`, the standard + * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value + * returned by {IERC1155MetadataURI-uri}. + */ + event URI(string value, uint256 indexed id); +} diff --git a/packages/contracts/lib/ERC1155-puppet/IERC1155MetadataURI.sol b/packages/contracts/lib/ERC1155-puppet/IERC1155MetadataURI.sol new file mode 100644 index 000000000..ae2e26e02 --- /dev/null +++ b/packages/contracts/lib/ERC1155-puppet/IERC1155MetadataURI.sol @@ -0,0 +1,19 @@ +// SPDX-License-Identifier: MIT +// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC1155/extensions/IERC1155Metadata.sol) +pragma solidity ^0.8.20; + +import {IERC1155} from "./IERC1155.sol"; + +/** + * @dev Interface of the optional ERC1155MetadataExtension interface, as defined + * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[ERC]. + */ +interface IERC1155MetadataURI is IERC1155 { + /** + * @dev Returns the URI for token type `id`. + * + * If the `\{id\}` substring is present in the URI, it must be replaced by + * clients with the actual token type ID. + */ + function uri(uint256 id) external view returns (string memory); +} diff --git a/packages/contracts/lib/ERC1155-puppet/IERC1155Receiver.sol b/packages/contracts/lib/ERC1155-puppet/IERC1155Receiver.sol new file mode 100644 index 000000000..31fe95510 --- /dev/null +++ b/packages/contracts/lib/ERC1155-puppet/IERC1155Receiver.sol @@ -0,0 +1,54 @@ +// SPDX-License-Identifier: MIT +// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC1155/IERC1155Receiver.sol) +pragma solidity ^0.8.20; + +/** + * @title ERC1155 token receiver interface + * @author MUD (https://mud.dev) by Lattice (https://lattice.xyz) + * @dev Interface for any contract that wants to support safeTransfers + * from ERC1155 asset contracts. + */ +interface IERC1155Receiver { + /** + * @dev Handles the receipt of a single ERC-1155 token type. This function is + * called at the end of a `safeTransferFrom` after the balance has been updated. + * + * NOTE: To accept the transfer, this must return + * `bytes4(keccak256('onERC1155Received(address,address,uint256,uint256,bytes)'))` + * (i.e. 0xf23a6e61, or its own function selector). + * + * @param operator The address which initiated the transfer (i.e. msg.sender) + * @param from The address which previously owned the token + * @param id The ID of the token being transferred + * @param value The amount of tokens being transferred + * @param data Additional data with no specified format + * @return `bytes4(keccak256('onERC1155Received(address,address,uint256,uint256,bytes)'))` if transfer is allowed + */ + function onERC1155Received(address operator, address from, uint256 id, uint256 value, bytes calldata data) + external + returns (bytes4); + + /** + * @dev Handles the receipt of a multiple ERC-1155 token types. This function + * is called at the end of a `safeBatchTransferFrom` after the balances have + * been updated. + * + * NOTE: To accept the transfer(s), this must return + * `bytes4(keccak256('onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)'))` + * (i.e. 0xbc197c81, or its own function selector). + * + * @param operator The address which initiated the batch transfer (i.e. msg.sender) + * @param from The address which previously owned the token + * @param ids An array containing ids of each token being transferred (order and length must match values array) + * @param values An array containing amounts of each token being transferred (order and length must match ids array) + * @param data Additional data with no specified format + * @return `bytes4(keccak256('onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)'))` if transfer is allowed + */ + function onERC1155BatchReceived( + address operator, + address from, + uint256[] calldata ids, + uint256[] calldata values, + bytes calldata data + ) external returns (bytes4); +} diff --git a/packages/contracts/lib/ERC1155-puppet/IERC1155System.sol b/packages/contracts/lib/ERC1155-puppet/IERC1155System.sol new file mode 100644 index 000000000..58599fe1c --- /dev/null +++ b/packages/contracts/lib/ERC1155-puppet/IERC1155System.sol @@ -0,0 +1,55 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.8.24; + +/* Autogenerated file. Do not edit manually. */ + +/** + * @title IERC1155System + * @author MUD (https://mud.dev) by Lattice (https://lattice.xyz) + * @dev This interface is automatically generated from the corresponding system contract. Do not edit manually. + */ +interface IERC1155System { + function setApprovalForAll(address operator, bool approved) external; + + function isApprovedForAll(address owner, address operator) external view returns (bool); + + function transferFrom(address from, address to, uint256 tokenId, uint256 value) external; + + function safeTransferFrom(address from, address to, uint256 tokenId, uint256 value) external; + + function safeTransferFrom(address from, address to, uint256 tokenId, uint256 value, bytes memory data) external; + + function safeBatchTransferFrom( + address from, + address to, + uint256[] calldata ids, + uint256[] calldata values, + bytes calldata data + ) external; + + // function mint(address to, uint256 tokenId, uint256 value) external; + + function mint(address to, uint256 tokenId, uint256 value, bytes memory data) external; + + function safeMint(address to, uint256 tokenId, uint256 value) external; + + function safeMint(address to, uint256 tokenId, uint256 value, bytes memory data) external; + + function burn(uint256 tokenId, uint256 value) external; + + function balanceOf(address owner, uint256 id) external view returns (uint256); + + function balanceOfBatch(address[] memory accounts, uint256[] memory ids) external view returns (uint256[] memory); + + function uri(uint256 tokenId) external view returns (string memory); + + function setTokenURI(uint256 tokenId, string memory tokenURI) external; + + function totalSupply(uint256 tokenId) external view returns (uint256 _totalSupply); + + function onERC1155Received(address, address, uint256, uint256, bytes calldata) external returns (bytes4 retval); + + function onERC1155BatchReceived(address, address, uint256[] calldata, uint256[] calldata, bytes calldata) + external + returns (bytes4 retval); +} diff --git a/packages/contracts/lib/ERC1155-puppet/constants.sol b/packages/contracts/lib/ERC1155-puppet/constants.sol new file mode 100644 index 000000000..c11e4e44f --- /dev/null +++ b/packages/contracts/lib/ERC1155-puppet/constants.sol @@ -0,0 +1,22 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.20; + +import {ResourceId} from "@latticexyz/store/src/ResourceId.sol"; +import {RESOURCE_TABLE} from "@latticexyz/store/src/storeResourceTypes.sol"; +import {RESOURCE_SYSTEM, RESOURCE_NAMESPACE} from "@latticexyz/world/src/worldResourceTypes.sol"; + +bytes14 constant MODULE_NAMESPACE = "erc1155puppet"; +ResourceId constant MODULE_NAMESPACE_ID = + ResourceId.wrap(bytes32(abi.encodePacked(RESOURCE_NAMESPACE, MODULE_NAMESPACE))); +bytes16 constant TOKEN_APPROVALSTORAGE_NAME = "ApprovalStorage"; +bytes16 constant TOKEN_URISTORAGE_NAME = "URIStorage"; +bytes16 constant METADATA_NAME = "MetadataURI"; +bytes16 constant OPERATOR_APPROVAL_NAME = "OperatorApproval"; +bytes16 constant OWNERS_NAME = "Owners"; +bytes16 constant TOTAL_SUPPLY_NAME = "TotalSupply"; + +bytes16 constant ERC1155_SYSTEM_NAME = "ERC1155System"; +bytes16 constant ERC1155URISTORAGE_SYSTEM_NAME = "URIStorageSystem"; + +ResourceId constant ERC1155_REGISTRY_TABLE_ID = + ResourceId.wrap(bytes32(abi.encodePacked(RESOURCE_TABLE, MODULE_NAMESPACE, bytes16("ERC1155Registry")))); diff --git a/packages/contracts/lib/ERC1155-puppet/libraries/LibString.sol b/packages/contracts/lib/ERC1155-puppet/libraries/LibString.sol new file mode 100644 index 000000000..706ab0502 --- /dev/null +++ b/packages/contracts/lib/ERC1155-puppet/libraries/LibString.sol @@ -0,0 +1,77 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.8.0; + +/// @notice Efficient library for creating string representations of integers. +/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/LibString.sol) +/// @author Modified from Solady (https://github.com/Vectorized/solady/blob/main/src/utils/LibString.sol) +library LibString { + function toString(int256 value) internal pure returns (string memory str) { + if (value >= 0) return toString(uint256(value)); + + unchecked { + str = toString(uint256(-value)); + + /// @solidity memory-safe-assembly + assembly { + // Note: This is only safe because we over-allocate memory + // and write the string from right to left in toString(uint256), + // and thus can be sure that sub(str, 1) is an unused memory location. + + let length := mload(str) // Load the string length. + // Put the - character at the start of the string contents. + mstore(str, 45) // 45 is the ASCII code for the - character. + str := sub(str, 1) // Move back the string pointer by a byte. + mstore(str, add(length, 1)) // Update the string length. + } + } + } + + function toString(uint256 value) internal pure returns (string memory str) { + /// @solidity memory-safe-assembly + assembly { + // The maximum value of a uint256 contains 78 digits (1 byte per digit), but we allocate 160 bytes + // to keep the free memory pointer word aligned. We'll need 1 word for the length, 1 word for the + // trailing zeros padding, and 3 other words for a max of 78 digits. In total: 5 * 32 = 160 bytes. + let newFreeMemoryPointer := add(mload(0x40), 160) + + // Update the free memory pointer to avoid overriding our string. + mstore(0x40, newFreeMemoryPointer) + + // Assign str to the end of the zone of newly allocated memory. + str := sub(newFreeMemoryPointer, 32) + + // Clean the last word of memory it may not be overwritten. + mstore(str, 0) + + // Cache the end of the memory to calculate the length later. + let end := str + + // We write the string from rightmost digit to leftmost digit. + // The following is essentially a do-while loop that also handles the zero case. + // prettier-ignore + for { let temp := value } 1 {} { + // Move the pointer 1 byte to the left. + str := sub(str, 1) + + // Write the character to the pointer. + // The ASCII index of the '0' character is 48. + mstore8(str, add(48, mod(temp, 10))) + + // Keep dividing temp until zero. + temp := div(temp, 10) + + // prettier-ignore + if iszero(temp) { break } + } + + // Compute and cache the final total length of the string. + let length := sub(end, str) + + // Move the pointer 32 bytes leftwards to make room for the length. + str := sub(str, 32) + + // Store the string's length at the start of memory allocated for our string. + mstore(str, length) + } + } +} diff --git a/packages/contracts/lib/ERC1155-puppet/libraries/utils/ERC1155Utils.sol b/packages/contracts/lib/ERC1155-puppet/libraries/utils/ERC1155Utils.sol new file mode 100644 index 000000000..5f40dffbd --- /dev/null +++ b/packages/contracts/lib/ERC1155-puppet/libraries/utils/ERC1155Utils.sol @@ -0,0 +1,85 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.8.20; + +import { IERC1155Receiver } from '../../IERC1155Receiver.sol'; +import { IERC1155Errors } from './draft-IERC6093.sol'; + +/** + * @dev Library that provide common ERC-1155 utility functions. + * + * See https://eips.ethereum.org/EIPS/eip-1155[ERC-1155]. + */ +library ERC1155Utils { + /** + * @dev Performs an acceptance check for the provided `operator` by calling {IERC1155-onERC1155Received} + * on the `to` address. The `operator` is generally the address that initiated the token transfer (i.e. `msg.sender`). + * + * The acceptance call is not executed and treated as a no-op if the target address is doesn't contain code (i.e. an EOA). + * Otherwise, the recipient must implement {IERC1155Receiver-onERC1155Received} and return the acceptance magic value to accept + * the transfer. + */ + function checkOnERC1155Received( + address operator, + address from, + address to, + uint256 id, + uint256 value, + bytes memory data + ) internal { + if (to.code.length > 0) { + try IERC1155Receiver(to).onERC1155Received(operator, from, id, value, data) returns (bytes4 response) { + if (response != IERC1155Receiver.onERC1155Received.selector) { + // Tokens rejected + revert IERC1155Errors.ERC1155InvalidReceiver(to); + } + } catch (bytes memory reason) { + if (reason.length == 0) { + // non-IERC1155Receiver implementer + revert IERC1155Errors.ERC1155InvalidReceiver(to); + } else { + /// @solidity memory-safe-assembly + assembly { + revert(add(32, reason), mload(reason)) + } + } + } + } + } + + /** + * @dev Performs a batch acceptance check for the provided `operator` by calling {IERC1155-onERC1155BatchReceived} + * on the `to` address. The `operator` is generally the address that initiated the token transfer (i.e. `msg.sender`). + * + * The acceptance call is not executed and treated as a no-op if the target address is doesn't contain code (i.e. an EOA). + * Otherwise, the recipient must implement {IERC1155Receiver-onERC1155Received} and return the acceptance magic value to accept + * the transfer. + */ + function checkOnERC1155BatchReceived( + address operator, + address from, + address to, + uint256[] memory ids, + uint256[] memory values, + bytes memory data + ) internal { + if (to.code.length > 0) { + try IERC1155Receiver(to).onERC1155BatchReceived(operator, from, ids, values, data) returns (bytes4 response) { + if (response != IERC1155Receiver.onERC1155BatchReceived.selector) { + // Tokens rejected + revert IERC1155Errors.ERC1155InvalidReceiver(to); + } + } catch (bytes memory reason) { + if (reason.length == 0) { + // non-IERC1155Receiver implementer + revert IERC1155Errors.ERC1155InvalidReceiver(to); + } else { + /// @solidity memory-safe-assembly + assembly { + revert(add(32, reason), mload(reason)) + } + } + } + } + } +} diff --git a/packages/contracts/lib/ERC1155-puppet/libraries/utils/draft-IERC6093.sol b/packages/contracts/lib/ERC1155-puppet/libraries/utils/draft-IERC6093.sol new file mode 100644 index 000000000..e7ab69c1b --- /dev/null +++ b/packages/contracts/lib/ERC1155-puppet/libraries/utils/draft-IERC6093.sol @@ -0,0 +1,161 @@ +// SPDX-License-Identifier: MIT +// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC6093.sol) +pragma solidity ^0.8.20; + +/** + * @dev Standard ERC-20 Errors + * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-20 tokens. + */ +interface IERC20Errors { + /** + * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers. + * @param sender Address whose tokens are being transferred. + * @param balance Current balance for the interacting account. + * @param needed Minimum amount required to perform a transfer. + */ + error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed); + + /** + * @dev Indicates a failure with the token `sender`. Used in transfers. + * @param sender Address whose tokens are being transferred. + */ + error ERC20InvalidSender(address sender); + + /** + * @dev Indicates a failure with the token `receiver`. Used in transfers. + * @param receiver Address to which tokens are being transferred. + */ + error ERC20InvalidReceiver(address receiver); + + /** + * @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers. + * @param spender Address that may be allowed to operate on tokens without being their owner. + * @param allowance Amount of tokens a `spender` is allowed to operate with. + * @param needed Minimum amount required to perform a transfer. + */ + error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed); + + /** + * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals. + * @param approver Address initiating an approval operation. + */ + error ERC20InvalidApprover(address approver); + + /** + * @dev Indicates a failure with the `spender` to be approved. Used in approvals. + * @param spender Address that may be allowed to operate on tokens without being their owner. + */ + error ERC20InvalidSpender(address spender); +} + +/** + * @dev Standard ERC-721 Errors + * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-721 tokens. + */ +interface IERC721Errors { + /** + * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in ERC-20. + * Used in balance queries. + * @param owner Address of the current owner of a token. + */ + error ERC721InvalidOwner(address owner); + + /** + * @dev Indicates a `tokenId` whose `owner` is the zero address. + * @param tokenId Identifier number of a token. + */ + error ERC721NonexistentToken(uint256 tokenId); + + /** + * @dev Indicates an error related to the ownership over a particular token. Used in transfers. + * @param sender Address whose tokens are being transferred. + * @param tokenId Identifier number of a token. + * @param owner Address of the current owner of a token. + */ + error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner); + + /** + * @dev Indicates a failure with the token `sender`. Used in transfers. + * @param sender Address whose tokens are being transferred. + */ + error ERC721InvalidSender(address sender); + + /** + * @dev Indicates a failure with the token `receiver`. Used in transfers. + * @param receiver Address to which tokens are being transferred. + */ + error ERC721InvalidReceiver(address receiver); + + /** + * @dev Indicates a failure with the `operator`’s approval. Used in transfers. + * @param operator Address that may be allowed to operate on tokens without being their owner. + * @param tokenId Identifier number of a token. + */ + error ERC721InsufficientApproval(address operator, uint256 tokenId); + + /** + * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals. + * @param approver Address initiating an approval operation. + */ + error ERC721InvalidApprover(address approver); + + /** + * @dev Indicates a failure with the `operator` to be approved. Used in approvals. + * @param operator Address that may be allowed to operate on tokens without being their owner. + */ + error ERC721InvalidOperator(address operator); +} + +/** + * @dev Standard ERC-1155 Errors + * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-1155 tokens. + */ +interface IERC1155Errors { + /** + * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers. + * @param sender Address whose tokens are being transferred. + * @param balance Current balance for the interacting account. + * @param needed Minimum amount required to perform a transfer. + * @param tokenId Identifier number of a token. + */ + error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId); + + /** + * @dev Indicates a failure with the token `sender`. Used in transfers. + * @param sender Address whose tokens are being transferred. + */ + error ERC1155InvalidSender(address sender); + + /** + * @dev Indicates a failure with the token `receiver`. Used in transfers. + * @param receiver Address to which tokens are being transferred. + */ + error ERC1155InvalidReceiver(address receiver); + + /** + * @dev Indicates a failure with the `operator`’s approval. Used in transfers. + * @param operator Address that may be allowed to operate on tokens without being their owner. + * @param owner Address of the current owner of a token. + */ + error ERC1155MissingApprovalForAll(address operator, address owner); + + /** + * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals. + * @param approver Address initiating an approval operation. + */ + error ERC1155InvalidApprover(address approver); + + /** + * @dev Indicates a failure with the `operator` to be approved. Used in approvals. + * @param operator Address that may be allowed to operate on tokens without being their owner. + */ + error ERC1155InvalidOperator(address operator); + + /** + * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation. + * Used in batch transfers. + * @param idsLength Length of the array of token identifiers + * @param valuesLength Length of the array of token amounts + */ + error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength); +} diff --git a/packages/contracts/lib/ERC1155-puppet/registerERC1155.sol b/packages/contracts/lib/ERC1155-puppet/registerERC1155.sol new file mode 100644 index 000000000..0dc886150 --- /dev/null +++ b/packages/contracts/lib/ERC1155-puppet/registerERC1155.sol @@ -0,0 +1,37 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.20; + +import {IBaseWorld} from "@latticexyz/world/src/codegen/interfaces/IBaseWorld.sol"; +import {NamespaceOwner} from "@latticexyz/world/src/codegen/tables/NamespaceOwner.sol"; +import {WorldResourceIdLib} from "@latticexyz/world/src/WorldResourceId.sol"; + +import {SystemSwitch} from "@latticexyz/world-modules/src/utils/SystemSwitch.sol"; + +import {ERC1155Module} from "./ERC1155Module.sol"; +import {MODULE_NAMESPACE_ID, ERC1155_REGISTRY_TABLE_ID} from "./constants.sol"; +import {IERC1155} from "./IERC1155.sol"; + +import {ERC1155MetadataURI} from "./tables/ERC1155MetadataURI.sol"; +import {ERC1155Registry} from "./tables/ERC1155Registry.sol"; +import "forge-std/console2.sol"; + +/** + * @notice Register a new ERC1155 token with the given metaDataURI in a given namespace + * @dev This function must be called within a Store context (i.e. using StoreSwitch.setStoreAddress()) + */ +function registerERC1155(IBaseWorld world, bytes14 namespace, string memory metaDataURI) returns (IERC1155 token) { + // Get the ERC1155 module + address owner = NamespaceOwner.get(MODULE_NAMESPACE_ID); + ERC1155Module erc1155Module = ERC1155Module(owner); + if (address(erc1155Module) == address(0)) { + erc1155Module = new ERC1155Module(); + } + + // Install the ERC1155 module with the provided args + world.installModule(erc1155Module, abi.encode(namespace, metaDataURI)); + + // Return the newly created ERC1155 token + token = IERC1155( + ERC1155Registry.getTokenAddress(ERC1155_REGISTRY_TABLE_ID, WorldResourceIdLib.encodeNamespace(namespace)) + ); +} diff --git a/packages/contracts/lib/ERC1155-puppet/tables/ERC1155MetadataURI.sol b/packages/contracts/lib/ERC1155-puppet/tables/ERC1155MetadataURI.sol new file mode 100644 index 000000000..d8d8c0783 --- /dev/null +++ b/packages/contracts/lib/ERC1155-puppet/tables/ERC1155MetadataURI.sol @@ -0,0 +1,414 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.8.24; + +/* Autogenerated file. Do not edit manually. */ + +// Import store internals +import { IStore } from "@latticexyz/store/src/IStore.sol"; +import { StoreSwitch } from "@latticexyz/store/src/StoreSwitch.sol"; +import { StoreCore } from "@latticexyz/store/src/StoreCore.sol"; +import { Bytes } from "@latticexyz/store/src/Bytes.sol"; +import { Memory } from "@latticexyz/store/src/Memory.sol"; +import { SliceLib } from "@latticexyz/store/src/Slice.sol"; +import { EncodeArray } from "@latticexyz/store/src/tightcoder/EncodeArray.sol"; +import { FieldLayout } from "@latticexyz/store/src/FieldLayout.sol"; +import { Schema } from "@latticexyz/store/src/Schema.sol"; +import { EncodedLengths, EncodedLengthsLib } from "@latticexyz/store/src/EncodedLengths.sol"; +import { ResourceId } from "@latticexyz/store/src/ResourceId.sol"; + +library ERC1155MetadataURI { + FieldLayout constant _fieldLayout = + FieldLayout.wrap(0x0000000100000000000000000000000000000000000000000000000000000000); + + // Hex-encoded key schema of () + Schema constant _keySchema = Schema.wrap(0x0000000000000000000000000000000000000000000000000000000000000000); + // Hex-encoded value schema of (string) + Schema constant _valueSchema = Schema.wrap(0x00000001c5000000000000000000000000000000000000000000000000000000); + + /** + * @notice Get the table's key field names. + * @return keyNames An array of strings with the names of key fields. + */ + function getKeyNames() internal pure returns (string[] memory keyNames) { + keyNames = new string[](0); + } + + /** + * @notice Get the table's value field names. + * @return fieldNames An array of strings with the names of value fields. + */ + function getFieldNames() internal pure returns (string[] memory fieldNames) { + fieldNames = new string[](1); + fieldNames[0] = "uri"; + } + + /** + * @notice Register the table with its config. + */ + function register(ResourceId _tableId) internal { + StoreSwitch.registerTable(_tableId, _fieldLayout, _keySchema, _valueSchema, getKeyNames(), getFieldNames()); + } + + /** + * @notice Register the table with its config. + */ + function _register(ResourceId _tableId) internal { + StoreCore.registerTable(_tableId, _fieldLayout, _keySchema, _valueSchema, getKeyNames(), getFieldNames()); + } + + /** + * @notice Get uri. + */ + function getUri(ResourceId _tableId) internal view returns (string memory uri) { + bytes32[] memory _keyTuple = new bytes32[](0); + + bytes memory _blob = StoreSwitch.getDynamicField(_tableId, _keyTuple, 0); + return (string(_blob)); + } + + /** + * @notice Get uri. + */ + function _getUri(ResourceId _tableId) internal view returns (string memory uri) { + bytes32[] memory _keyTuple = new bytes32[](0); + + bytes memory _blob = StoreCore.getDynamicField(_tableId, _keyTuple, 0); + return (string(_blob)); + } + + /** + * @notice Get uri. + */ + function get(ResourceId _tableId) internal view returns (string memory uri) { + bytes32[] memory _keyTuple = new bytes32[](0); + + bytes memory _blob = StoreSwitch.getDynamicField(_tableId, _keyTuple, 0); + return (string(_blob)); + } + + /** + * @notice Get uri. + */ + function _get(ResourceId _tableId) internal view returns (string memory uri) { + bytes32[] memory _keyTuple = new bytes32[](0); + + bytes memory _blob = StoreCore.getDynamicField(_tableId, _keyTuple, 0); + return (string(_blob)); + } + + /** + * @notice Set uri. + */ + function setUri(ResourceId _tableId, string memory uri) internal { + bytes32[] memory _keyTuple = new bytes32[](0); + + StoreSwitch.setDynamicField(_tableId, _keyTuple, 0, bytes((uri))); + } + + /** + * @notice Set uri. + */ + function _setUri(ResourceId _tableId, string memory uri) internal { + bytes32[] memory _keyTuple = new bytes32[](0); + + StoreCore.setDynamicField(_tableId, _keyTuple, 0, bytes((uri))); + } + + /** + * @notice Set uri. + */ + function set(ResourceId _tableId, string memory uri) internal { + bytes32[] memory _keyTuple = new bytes32[](0); + + StoreSwitch.setDynamicField(_tableId, _keyTuple, 0, bytes((uri))); + } + + /** + * @notice Set uri. + */ + function _set(ResourceId _tableId, string memory uri) internal { + bytes32[] memory _keyTuple = new bytes32[](0); + + StoreCore.setDynamicField(_tableId, _keyTuple, 0, bytes((uri))); + } + + /** + * @notice Get the length of uri. + */ + function lengthUri(ResourceId _tableId) internal view returns (uint256) { + bytes32[] memory _keyTuple = new bytes32[](0); + + uint256 _byteLength = StoreSwitch.getDynamicFieldLength(_tableId, _keyTuple, 0); + unchecked { + return _byteLength / 1; + } + } + + /** + * @notice Get the length of uri. + */ + function _lengthUri(ResourceId _tableId) internal view returns (uint256) { + bytes32[] memory _keyTuple = new bytes32[](0); + + uint256 _byteLength = StoreCore.getDynamicFieldLength(_tableId, _keyTuple, 0); + unchecked { + return _byteLength / 1; + } + } + + /** + * @notice Get the length of uri. + */ + function length(ResourceId _tableId) internal view returns (uint256) { + bytes32[] memory _keyTuple = new bytes32[](0); + + uint256 _byteLength = StoreSwitch.getDynamicFieldLength(_tableId, _keyTuple, 0); + unchecked { + return _byteLength / 1; + } + } + + /** + * @notice Get the length of uri. + */ + function _length(ResourceId _tableId) internal view returns (uint256) { + bytes32[] memory _keyTuple = new bytes32[](0); + + uint256 _byteLength = StoreCore.getDynamicFieldLength(_tableId, _keyTuple, 0); + unchecked { + return _byteLength / 1; + } + } + + /** + * @notice Get an item of uri. + * @dev Reverts with Store_IndexOutOfBounds if `_index` is out of bounds for the array. + */ + function getItemUri(ResourceId _tableId, uint256 _index) internal view returns (string memory) { + bytes32[] memory _keyTuple = new bytes32[](0); + + unchecked { + bytes memory _blob = StoreSwitch.getDynamicFieldSlice(_tableId, _keyTuple, 0, _index * 1, (_index + 1) * 1); + return (string(_blob)); + } + } + + /** + * @notice Get an item of uri. + * @dev Reverts with Store_IndexOutOfBounds if `_index` is out of bounds for the array. + */ + function _getItemUri(ResourceId _tableId, uint256 _index) internal view returns (string memory) { + bytes32[] memory _keyTuple = new bytes32[](0); + + unchecked { + bytes memory _blob = StoreCore.getDynamicFieldSlice(_tableId, _keyTuple, 0, _index * 1, (_index + 1) * 1); + return (string(_blob)); + } + } + + /** + * @notice Get an item of uri. + * @dev Reverts with Store_IndexOutOfBounds if `_index` is out of bounds for the array. + */ + function getItem(ResourceId _tableId, uint256 _index) internal view returns (string memory) { + bytes32[] memory _keyTuple = new bytes32[](0); + + unchecked { + bytes memory _blob = StoreSwitch.getDynamicFieldSlice(_tableId, _keyTuple, 0, _index * 1, (_index + 1) * 1); + return (string(_blob)); + } + } + + /** + * @notice Get an item of uri. + * @dev Reverts with Store_IndexOutOfBounds if `_index` is out of bounds for the array. + */ + function _getItem(ResourceId _tableId, uint256 _index) internal view returns (string memory) { + bytes32[] memory _keyTuple = new bytes32[](0); + + unchecked { + bytes memory _blob = StoreCore.getDynamicFieldSlice(_tableId, _keyTuple, 0, _index * 1, (_index + 1) * 1); + return (string(_blob)); + } + } + + /** + * @notice Push a slice to uri. + */ + function pushUri(ResourceId _tableId, string memory _slice) internal { + bytes32[] memory _keyTuple = new bytes32[](0); + + StoreSwitch.pushToDynamicField(_tableId, _keyTuple, 0, bytes((_slice))); + } + + /** + * @notice Push a slice to uri. + */ + function _pushUri(ResourceId _tableId, string memory _slice) internal { + bytes32[] memory _keyTuple = new bytes32[](0); + + StoreCore.pushToDynamicField(_tableId, _keyTuple, 0, bytes((_slice))); + } + + /** + * @notice Push a slice to uri. + */ + function push(ResourceId _tableId, string memory _slice) internal { + bytes32[] memory _keyTuple = new bytes32[](0); + + StoreSwitch.pushToDynamicField(_tableId, _keyTuple, 0, bytes((_slice))); + } + + /** + * @notice Push a slice to uri. + */ + function _push(ResourceId _tableId, string memory _slice) internal { + bytes32[] memory _keyTuple = new bytes32[](0); + + StoreCore.pushToDynamicField(_tableId, _keyTuple, 0, bytes((_slice))); + } + + /** + * @notice Pop a slice from uri. + */ + function popUri(ResourceId _tableId) internal { + bytes32[] memory _keyTuple = new bytes32[](0); + + StoreSwitch.popFromDynamicField(_tableId, _keyTuple, 0, 1); + } + + /** + * @notice Pop a slice from uri. + */ + function _popUri(ResourceId _tableId) internal { + bytes32[] memory _keyTuple = new bytes32[](0); + + StoreCore.popFromDynamicField(_tableId, _keyTuple, 0, 1); + } + + /** + * @notice Pop a slice from uri. + */ + function pop(ResourceId _tableId) internal { + bytes32[] memory _keyTuple = new bytes32[](0); + + StoreSwitch.popFromDynamicField(_tableId, _keyTuple, 0, 1); + } + + /** + * @notice Pop a slice from uri. + */ + function _pop(ResourceId _tableId) internal { + bytes32[] memory _keyTuple = new bytes32[](0); + + StoreCore.popFromDynamicField(_tableId, _keyTuple, 0, 1); + } + + /** + * @notice Update a slice of uri at `_index`. + */ + function updateUri(ResourceId _tableId, uint256 _index, string memory _slice) internal { + bytes32[] memory _keyTuple = new bytes32[](0); + + unchecked { + bytes memory _encoded = bytes((_slice)); + StoreSwitch.spliceDynamicData(_tableId, _keyTuple, 0, uint40(_index * 1), uint40(_encoded.length), _encoded); + } + } + + /** + * @notice Update a slice of uri at `_index`. + */ + function _updateUri(ResourceId _tableId, uint256 _index, string memory _slice) internal { + bytes32[] memory _keyTuple = new bytes32[](0); + + unchecked { + bytes memory _encoded = bytes((_slice)); + StoreCore.spliceDynamicData(_tableId, _keyTuple, 0, uint40(_index * 1), uint40(_encoded.length), _encoded); + } + } + + /** + * @notice Update a slice of uri at `_index`. + */ + function update(ResourceId _tableId, uint256 _index, string memory _slice) internal { + bytes32[] memory _keyTuple = new bytes32[](0); + + unchecked { + bytes memory _encoded = bytes((_slice)); + StoreSwitch.spliceDynamicData(_tableId, _keyTuple, 0, uint40(_index * 1), uint40(_encoded.length), _encoded); + } + } + + /** + * @notice Update a slice of uri at `_index`. + */ + function _update(ResourceId _tableId, uint256 _index, string memory _slice) internal { + bytes32[] memory _keyTuple = new bytes32[](0); + + unchecked { + bytes memory _encoded = bytes((_slice)); + StoreCore.spliceDynamicData(_tableId, _keyTuple, 0, uint40(_index * 1), uint40(_encoded.length), _encoded); + } + } + + /** + * @notice Delete all data for given keys. + */ + function deleteRecord(ResourceId _tableId) internal { + bytes32[] memory _keyTuple = new bytes32[](0); + + StoreSwitch.deleteRecord(_tableId, _keyTuple); + } + + /** + * @notice Delete all data for given keys. + */ + function _deleteRecord(ResourceId _tableId) internal { + bytes32[] memory _keyTuple = new bytes32[](0); + + StoreCore.deleteRecord(_tableId, _keyTuple, _fieldLayout); + } + + /** + * @notice Tightly pack dynamic data lengths using this table's schema. + * @return _encodedLengths The lengths of the dynamic fields (packed into a single bytes32 value). + */ + function encodeLengths(string memory uri) internal pure returns (EncodedLengths _encodedLengths) { + // Lengths are effectively checked during copy by 2**40 bytes exceeding gas limits + unchecked { + _encodedLengths = EncodedLengthsLib.pack(bytes(uri).length); + } + } + + /** + * @notice Tightly pack dynamic (variable length) data using this table's schema. + * @return The dynamic data, encoded into a sequence of bytes. + */ + function encodeDynamic(string memory uri) internal pure returns (bytes memory) { + return abi.encodePacked(bytes((uri))); + } + + /** + * @notice Encode all of a record's fields. + * @return The static (fixed length) data, encoded into a sequence of bytes. + * @return The lengths of the dynamic fields (packed into a single bytes32 value). + * @return The dynamic (variable length) data, encoded into a sequence of bytes. + */ + function encode(string memory uri) internal pure returns (bytes memory, EncodedLengths, bytes memory) { + bytes memory _staticData; + EncodedLengths _encodedLengths = encodeLengths(uri); + bytes memory _dynamicData = encodeDynamic(uri); + + return (_staticData, _encodedLengths, _dynamicData); + } + + /** + * @notice Encode keys as a bytes32 array using this table's field layout. + */ + function encodeKeyTuple() internal pure returns (bytes32[] memory) { + bytes32[] memory _keyTuple = new bytes32[](0); + + return _keyTuple; + } +} diff --git a/packages/contracts/lib/ERC1155-puppet/tables/ERC1155Registry.sol b/packages/contracts/lib/ERC1155-puppet/tables/ERC1155Registry.sol new file mode 100644 index 000000000..269edbdc5 --- /dev/null +++ b/packages/contracts/lib/ERC1155-puppet/tables/ERC1155Registry.sol @@ -0,0 +1,321 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.8.24; + +/* Autogenerated file. Do not edit manually. */ + +// Import store internals +import { IStore } from "@latticexyz/store/src/IStore.sol"; +import { StoreSwitch } from "@latticexyz/store/src/StoreSwitch.sol"; +import { StoreCore } from "@latticexyz/store/src/StoreCore.sol"; +import { Bytes } from "@latticexyz/store/src/Bytes.sol"; +import { Memory } from "@latticexyz/store/src/Memory.sol"; +import { SliceLib } from "@latticexyz/store/src/Slice.sol"; +import { EncodeArray } from "@latticexyz/store/src/tightcoder/EncodeArray.sol"; +import { FieldLayout } from "@latticexyz/store/src/FieldLayout.sol"; +import { Schema } from "@latticexyz/store/src/Schema.sol"; +import { EncodedLengths, EncodedLengthsLib } from "@latticexyz/store/src/EncodedLengths.sol"; +import { ResourceId } from "@latticexyz/store/src/ResourceId.sol"; + +// Import user types +import { ResourceId } from "@latticexyz/store/src/ResourceId.sol"; + +struct ERC1155RegistryData { + address tokenAddress; + address uriStorage; +} + +library ERC1155Registry { + FieldLayout constant _fieldLayout = + FieldLayout.wrap(0x0028020014140000000000000000000000000000000000000000000000000000); + + // Hex-encoded key schema of (bytes32) + Schema constant _keySchema = Schema.wrap(0x002001005f000000000000000000000000000000000000000000000000000000); + // Hex-encoded value schema of (address, address) + Schema constant _valueSchema = Schema.wrap(0x0028020061610000000000000000000000000000000000000000000000000000); + + /** + * @notice Get the table's key field names. + * @return keyNames An array of strings with the names of key fields. + */ + function getKeyNames() internal pure returns (string[] memory keyNames) { + keyNames = new string[](1); + keyNames[0] = "namespaceId"; + } + + /** + * @notice Get the table's value field names. + * @return fieldNames An array of strings with the names of value fields. + */ + function getFieldNames() internal pure returns (string[] memory fieldNames) { + fieldNames = new string[](2); + fieldNames[0] = "tokenAddress"; + fieldNames[1] = "uriStorage"; + } + + /** + * @notice Register the table with its config. + */ + function register(ResourceId _tableId) internal { + StoreSwitch.registerTable(_tableId, _fieldLayout, _keySchema, _valueSchema, getKeyNames(), getFieldNames()); + } + + /** + * @notice Register the table with its config. + */ + function _register(ResourceId _tableId) internal { + StoreCore.registerTable(_tableId, _fieldLayout, _keySchema, _valueSchema, getKeyNames(), getFieldNames()); + } + + /** + * @notice Get tokenAddress. + */ + function getTokenAddress(ResourceId _tableId, ResourceId namespaceId) internal view returns (address tokenAddress) { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = ResourceId.unwrap(namespaceId); + + bytes32 _blob = StoreSwitch.getStaticField(_tableId, _keyTuple, 0, _fieldLayout); + return (address(bytes20(_blob))); + } + + /** + * @notice Get tokenAddress. + */ + function _getTokenAddress(ResourceId _tableId, ResourceId namespaceId) internal view returns (address tokenAddress) { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = ResourceId.unwrap(namespaceId); + + bytes32 _blob = StoreCore.getStaticField(_tableId, _keyTuple, 0, _fieldLayout); + return (address(bytes20(_blob))); + } + + /** + * @notice Set tokenAddress. + */ + function setTokenAddress(ResourceId _tableId, ResourceId namespaceId, address tokenAddress) internal { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = ResourceId.unwrap(namespaceId); + + StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((tokenAddress)), _fieldLayout); + } + + /** + * @notice Set tokenAddress. + */ + function _setTokenAddress(ResourceId _tableId, ResourceId namespaceId, address tokenAddress) internal { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = ResourceId.unwrap(namespaceId); + + StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((tokenAddress)), _fieldLayout); + } + + /** + * @notice Get uriStorage. + */ + function getUriStorage(ResourceId _tableId, ResourceId namespaceId) internal view returns (address uriStorage) { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = ResourceId.unwrap(namespaceId); + + bytes32 _blob = StoreSwitch.getStaticField(_tableId, _keyTuple, 1, _fieldLayout); + return (address(bytes20(_blob))); + } + + /** + * @notice Get uriStorage. + */ + function _getUriStorage(ResourceId _tableId, ResourceId namespaceId) internal view returns (address uriStorage) { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = ResourceId.unwrap(namespaceId); + + bytes32 _blob = StoreCore.getStaticField(_tableId, _keyTuple, 1, _fieldLayout); + return (address(bytes20(_blob))); + } + + /** + * @notice Set uriStorage. + */ + function setUriStorage(ResourceId _tableId, ResourceId namespaceId, address uriStorage) internal { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = ResourceId.unwrap(namespaceId); + + StoreSwitch.setStaticField(_tableId, _keyTuple, 1, abi.encodePacked((uriStorage)), _fieldLayout); + } + + /** + * @notice Set uriStorage. + */ + function _setUriStorage(ResourceId _tableId, ResourceId namespaceId, address uriStorage) internal { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = ResourceId.unwrap(namespaceId); + + StoreCore.setStaticField(_tableId, _keyTuple, 1, abi.encodePacked((uriStorage)), _fieldLayout); + } + + /** + * @notice Get the full data. + */ + function get(ResourceId _tableId, ResourceId namespaceId) internal view returns (ERC1155RegistryData memory _table) { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = ResourceId.unwrap(namespaceId); + + (bytes memory _staticData, EncodedLengths _encodedLengths, bytes memory _dynamicData) = StoreSwitch.getRecord( + _tableId, + _keyTuple, + _fieldLayout + ); + return decode(_staticData, _encodedLengths, _dynamicData); + } + + /** + * @notice Get the full data. + */ + function _get(ResourceId _tableId, ResourceId namespaceId) internal view returns (ERC1155RegistryData memory _table) { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = ResourceId.unwrap(namespaceId); + + (bytes memory _staticData, EncodedLengths _encodedLengths, bytes memory _dynamicData) = StoreCore.getRecord( + _tableId, + _keyTuple, + _fieldLayout + ); + return decode(_staticData, _encodedLengths, _dynamicData); + } + + /** + * @notice Set the full data using individual values. + */ + function set(ResourceId _tableId, ResourceId namespaceId, address tokenAddress, address uriStorage) internal { + bytes memory _staticData = encodeStatic(tokenAddress, uriStorage); + + EncodedLengths _encodedLengths; + bytes memory _dynamicData; + + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = ResourceId.unwrap(namespaceId); + + StoreSwitch.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData); + } + + /** + * @notice Set the full data using individual values. + */ + function _set(ResourceId _tableId, ResourceId namespaceId, address tokenAddress, address uriStorage) internal { + bytes memory _staticData = encodeStatic(tokenAddress, uriStorage); + + EncodedLengths _encodedLengths; + bytes memory _dynamicData; + + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = ResourceId.unwrap(namespaceId); + + StoreCore.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData, _fieldLayout); + } + + /** + * @notice Set the full data using the data struct. + */ + function set(ResourceId _tableId, ResourceId namespaceId, ERC1155RegistryData memory _table) internal { + bytes memory _staticData = encodeStatic(_table.tokenAddress, _table.uriStorage); + + EncodedLengths _encodedLengths; + bytes memory _dynamicData; + + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = ResourceId.unwrap(namespaceId); + + StoreSwitch.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData); + } + + /** + * @notice Set the full data using the data struct. + */ + function _set(ResourceId _tableId, ResourceId namespaceId, ERC1155RegistryData memory _table) internal { + bytes memory _staticData = encodeStatic(_table.tokenAddress, _table.uriStorage); + + EncodedLengths _encodedLengths; + bytes memory _dynamicData; + + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = ResourceId.unwrap(namespaceId); + + StoreCore.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData, _fieldLayout); + } + + /** + * @notice Decode the tightly packed blob of static data using this table's field layout. + */ + function decodeStatic(bytes memory _blob) internal pure returns (address tokenAddress, address uriStorage) { + tokenAddress = (address(Bytes.getBytes20(_blob, 0))); + + uriStorage = (address(Bytes.getBytes20(_blob, 20))); + } + + /** + * @notice Decode the tightly packed blobs using this table's field layout. + * @param _staticData Tightly packed static fields. + * + * + */ + function decode( + bytes memory _staticData, + EncodedLengths, + bytes memory + ) internal pure returns (ERC1155RegistryData memory _table) { + (_table.tokenAddress, _table.uriStorage) = decodeStatic(_staticData); + } + + /** + * @notice Delete all data for given keys. + */ + function deleteRecord(ResourceId _tableId, ResourceId namespaceId) internal { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = ResourceId.unwrap(namespaceId); + + StoreSwitch.deleteRecord(_tableId, _keyTuple); + } + + /** + * @notice Delete all data for given keys. + */ + function _deleteRecord(ResourceId _tableId, ResourceId namespaceId) internal { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = ResourceId.unwrap(namespaceId); + + StoreCore.deleteRecord(_tableId, _keyTuple, _fieldLayout); + } + + /** + * @notice Tightly pack static (fixed length) data using this table's schema. + * @return The static data, encoded into a sequence of bytes. + */ + function encodeStatic(address tokenAddress, address uriStorage) internal pure returns (bytes memory) { + return abi.encodePacked(tokenAddress, uriStorage); + } + + /** + * @notice Encode all of a record's fields. + * @return The static (fixed length) data, encoded into a sequence of bytes. + * @return The lengths of the dynamic fields (packed into a single bytes32 value). + * @return The dynamic (variable length) data, encoded into a sequence of bytes. + */ + function encode( + address tokenAddress, + address uriStorage + ) internal pure returns (bytes memory, EncodedLengths, bytes memory) { + bytes memory _staticData = encodeStatic(tokenAddress, uriStorage); + + EncodedLengths _encodedLengths; + bytes memory _dynamicData; + + return (_staticData, _encodedLengths, _dynamicData); + } + + /** + * @notice Encode keys as a bytes32 array using this table's field layout. + */ + function encodeKeyTuple(ResourceId namespaceId) internal pure returns (bytes32[] memory) { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = ResourceId.unwrap(namespaceId); + + return _keyTuple; + } +} diff --git a/packages/contracts/lib/ERC1155-puppet/tables/ERC1155URIStorage.sol b/packages/contracts/lib/ERC1155-puppet/tables/ERC1155URIStorage.sol new file mode 100644 index 000000000..aeb86f162 --- /dev/null +++ b/packages/contracts/lib/ERC1155-puppet/tables/ERC1155URIStorage.sol @@ -0,0 +1,446 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.8.24; + +/* Autogenerated file. Do not edit manually. */ + +// Import store internals +import { IStore } from "@latticexyz/store/src/IStore.sol"; +import { StoreSwitch } from "@latticexyz/store/src/StoreSwitch.sol"; +import { StoreCore } from "@latticexyz/store/src/StoreCore.sol"; +import { Bytes } from "@latticexyz/store/src/Bytes.sol"; +import { Memory } from "@latticexyz/store/src/Memory.sol"; +import { SliceLib } from "@latticexyz/store/src/Slice.sol"; +import { EncodeArray } from "@latticexyz/store/src/tightcoder/EncodeArray.sol"; +import { FieldLayout } from "@latticexyz/store/src/FieldLayout.sol"; +import { Schema } from "@latticexyz/store/src/Schema.sol"; +import { EncodedLengths, EncodedLengthsLib } from "@latticexyz/store/src/EncodedLengths.sol"; +import { ResourceId } from "@latticexyz/store/src/ResourceId.sol"; + +library ERC1155URIStorage { + FieldLayout constant _fieldLayout = + FieldLayout.wrap(0x0000000100000000000000000000000000000000000000000000000000000000); + + // Hex-encoded key schema of (uint256) + Schema constant _keySchema = Schema.wrap(0x002001001f000000000000000000000000000000000000000000000000000000); + // Hex-encoded value schema of (string) + Schema constant _valueSchema = Schema.wrap(0x00000001c5000000000000000000000000000000000000000000000000000000); + + /** + * @notice Get the table's key field names. + * @return keyNames An array of strings with the names of key fields. + */ + function getKeyNames() internal pure returns (string[] memory keyNames) { + keyNames = new string[](1); + keyNames[0] = "tokenId"; + } + + /** + * @notice Get the table's value field names. + * @return fieldNames An array of strings with the names of value fields. + */ + function getFieldNames() internal pure returns (string[] memory fieldNames) { + fieldNames = new string[](1); + fieldNames[0] = "uri"; + } + + /** + * @notice Register the table with its config. + */ + function register(ResourceId _tableId) internal { + StoreSwitch.registerTable(_tableId, _fieldLayout, _keySchema, _valueSchema, getKeyNames(), getFieldNames()); + } + + /** + * @notice Register the table with its config. + */ + function _register(ResourceId _tableId) internal { + StoreCore.registerTable(_tableId, _fieldLayout, _keySchema, _valueSchema, getKeyNames(), getFieldNames()); + } + + /** + * @notice Get uri. + */ + function getUri(ResourceId _tableId, uint256 tokenId) internal view returns (string memory uri) { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(tokenId)); + + bytes memory _blob = StoreSwitch.getDynamicField(_tableId, _keyTuple, 0); + return (string(_blob)); + } + + /** + * @notice Get uri. + */ + function _getUri(ResourceId _tableId, uint256 tokenId) internal view returns (string memory uri) { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(tokenId)); + + bytes memory _blob = StoreCore.getDynamicField(_tableId, _keyTuple, 0); + return (string(_blob)); + } + + /** + * @notice Get uri. + */ + function get(ResourceId _tableId, uint256 tokenId) internal view returns (string memory uri) { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(tokenId)); + + bytes memory _blob = StoreSwitch.getDynamicField(_tableId, _keyTuple, 0); + return (string(_blob)); + } + + /** + * @notice Get uri. + */ + function _get(ResourceId _tableId, uint256 tokenId) internal view returns (string memory uri) { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(tokenId)); + + bytes memory _blob = StoreCore.getDynamicField(_tableId, _keyTuple, 0); + return (string(_blob)); + } + + /** + * @notice Set uri. + */ + function setUri(ResourceId _tableId, uint256 tokenId, string memory uri) internal { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(tokenId)); + + StoreSwitch.setDynamicField(_tableId, _keyTuple, 0, bytes((uri))); + } + + /** + * @notice Set uri. + */ + function _setUri(ResourceId _tableId, uint256 tokenId, string memory uri) internal { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(tokenId)); + + StoreCore.setDynamicField(_tableId, _keyTuple, 0, bytes((uri))); + } + + /** + * @notice Set uri. + */ + function set(ResourceId _tableId, uint256 tokenId, string memory uri) internal { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(tokenId)); + + StoreSwitch.setDynamicField(_tableId, _keyTuple, 0, bytes((uri))); + } + + /** + * @notice Set uri. + */ + function _set(ResourceId _tableId, uint256 tokenId, string memory uri) internal { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(tokenId)); + + StoreCore.setDynamicField(_tableId, _keyTuple, 0, bytes((uri))); + } + + /** + * @notice Get the length of uri. + */ + function lengthUri(ResourceId _tableId, uint256 tokenId) internal view returns (uint256) { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(tokenId)); + + uint256 _byteLength = StoreSwitch.getDynamicFieldLength(_tableId, _keyTuple, 0); + unchecked { + return _byteLength / 1; + } + } + + /** + * @notice Get the length of uri. + */ + function _lengthUri(ResourceId _tableId, uint256 tokenId) internal view returns (uint256) { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(tokenId)); + + uint256 _byteLength = StoreCore.getDynamicFieldLength(_tableId, _keyTuple, 0); + unchecked { + return _byteLength / 1; + } + } + + /** + * @notice Get the length of uri. + */ + function length(ResourceId _tableId, uint256 tokenId) internal view returns (uint256) { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(tokenId)); + + uint256 _byteLength = StoreSwitch.getDynamicFieldLength(_tableId, _keyTuple, 0); + unchecked { + return _byteLength / 1; + } + } + + /** + * @notice Get the length of uri. + */ + function _length(ResourceId _tableId, uint256 tokenId) internal view returns (uint256) { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(tokenId)); + + uint256 _byteLength = StoreCore.getDynamicFieldLength(_tableId, _keyTuple, 0); + unchecked { + return _byteLength / 1; + } + } + + /** + * @notice Get an item of uri. + * @dev Reverts with Store_IndexOutOfBounds if `_index` is out of bounds for the array. + */ + function getItemUri(ResourceId _tableId, uint256 tokenId, uint256 _index) internal view returns (string memory) { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(tokenId)); + + unchecked { + bytes memory _blob = StoreSwitch.getDynamicFieldSlice(_tableId, _keyTuple, 0, _index * 1, (_index + 1) * 1); + return (string(_blob)); + } + } + + /** + * @notice Get an item of uri. + * @dev Reverts with Store_IndexOutOfBounds if `_index` is out of bounds for the array. + */ + function _getItemUri(ResourceId _tableId, uint256 tokenId, uint256 _index) internal view returns (string memory) { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(tokenId)); + + unchecked { + bytes memory _blob = StoreCore.getDynamicFieldSlice(_tableId, _keyTuple, 0, _index * 1, (_index + 1) * 1); + return (string(_blob)); + } + } + + /** + * @notice Get an item of uri. + * @dev Reverts with Store_IndexOutOfBounds if `_index` is out of bounds for the array. + */ + function getItem(ResourceId _tableId, uint256 tokenId, uint256 _index) internal view returns (string memory) { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(tokenId)); + + unchecked { + bytes memory _blob = StoreSwitch.getDynamicFieldSlice(_tableId, _keyTuple, 0, _index * 1, (_index + 1) * 1); + return (string(_blob)); + } + } + + /** + * @notice Get an item of uri. + * @dev Reverts with Store_IndexOutOfBounds if `_index` is out of bounds for the array. + */ + function _getItem(ResourceId _tableId, uint256 tokenId, uint256 _index) internal view returns (string memory) { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(tokenId)); + + unchecked { + bytes memory _blob = StoreCore.getDynamicFieldSlice(_tableId, _keyTuple, 0, _index * 1, (_index + 1) * 1); + return (string(_blob)); + } + } + + /** + * @notice Push a slice to uri. + */ + function pushUri(ResourceId _tableId, uint256 tokenId, string memory _slice) internal { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(tokenId)); + + StoreSwitch.pushToDynamicField(_tableId, _keyTuple, 0, bytes((_slice))); + } + + /** + * @notice Push a slice to uri. + */ + function _pushUri(ResourceId _tableId, uint256 tokenId, string memory _slice) internal { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(tokenId)); + + StoreCore.pushToDynamicField(_tableId, _keyTuple, 0, bytes((_slice))); + } + + /** + * @notice Push a slice to uri. + */ + function push(ResourceId _tableId, uint256 tokenId, string memory _slice) internal { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(tokenId)); + + StoreSwitch.pushToDynamicField(_tableId, _keyTuple, 0, bytes((_slice))); + } + + /** + * @notice Push a slice to uri. + */ + function _push(ResourceId _tableId, uint256 tokenId, string memory _slice) internal { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(tokenId)); + + StoreCore.pushToDynamicField(_tableId, _keyTuple, 0, bytes((_slice))); + } + + /** + * @notice Pop a slice from uri. + */ + function popUri(ResourceId _tableId, uint256 tokenId) internal { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(tokenId)); + + StoreSwitch.popFromDynamicField(_tableId, _keyTuple, 0, 1); + } + + /** + * @notice Pop a slice from uri. + */ + function _popUri(ResourceId _tableId, uint256 tokenId) internal { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(tokenId)); + + StoreCore.popFromDynamicField(_tableId, _keyTuple, 0, 1); + } + + /** + * @notice Pop a slice from uri. + */ + function pop(ResourceId _tableId, uint256 tokenId) internal { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(tokenId)); + + StoreSwitch.popFromDynamicField(_tableId, _keyTuple, 0, 1); + } + + /** + * @notice Pop a slice from uri. + */ + function _pop(ResourceId _tableId, uint256 tokenId) internal { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(tokenId)); + + StoreCore.popFromDynamicField(_tableId, _keyTuple, 0, 1); + } + + /** + * @notice Update a slice of uri at `_index`. + */ + function updateUri(ResourceId _tableId, uint256 tokenId, uint256 _index, string memory _slice) internal { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(tokenId)); + + unchecked { + bytes memory _encoded = bytes((_slice)); + StoreSwitch.spliceDynamicData(_tableId, _keyTuple, 0, uint40(_index * 1), uint40(_encoded.length), _encoded); + } + } + + /** + * @notice Update a slice of uri at `_index`. + */ + function _updateUri(ResourceId _tableId, uint256 tokenId, uint256 _index, string memory _slice) internal { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(tokenId)); + + unchecked { + bytes memory _encoded = bytes((_slice)); + StoreCore.spliceDynamicData(_tableId, _keyTuple, 0, uint40(_index * 1), uint40(_encoded.length), _encoded); + } + } + + /** + * @notice Update a slice of uri at `_index`. + */ + function update(ResourceId _tableId, uint256 tokenId, uint256 _index, string memory _slice) internal { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(tokenId)); + + unchecked { + bytes memory _encoded = bytes((_slice)); + StoreSwitch.spliceDynamicData(_tableId, _keyTuple, 0, uint40(_index * 1), uint40(_encoded.length), _encoded); + } + } + + /** + * @notice Update a slice of uri at `_index`. + */ + function _update(ResourceId _tableId, uint256 tokenId, uint256 _index, string memory _slice) internal { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(tokenId)); + + unchecked { + bytes memory _encoded = bytes((_slice)); + StoreCore.spliceDynamicData(_tableId, _keyTuple, 0, uint40(_index * 1), uint40(_encoded.length), _encoded); + } + } + + /** + * @notice Delete all data for given keys. + */ + function deleteRecord(ResourceId _tableId, uint256 tokenId) internal { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(tokenId)); + + StoreSwitch.deleteRecord(_tableId, _keyTuple); + } + + /** + * @notice Delete all data for given keys. + */ + function _deleteRecord(ResourceId _tableId, uint256 tokenId) internal { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(tokenId)); + + StoreCore.deleteRecord(_tableId, _keyTuple, _fieldLayout); + } + + /** + * @notice Tightly pack dynamic data lengths using this table's schema. + * @return _encodedLengths The lengths of the dynamic fields (packed into a single bytes32 value). + */ + function encodeLengths(string memory uri) internal pure returns (EncodedLengths _encodedLengths) { + // Lengths are effectively checked during copy by 2**40 bytes exceeding gas limits + unchecked { + _encodedLengths = EncodedLengthsLib.pack(bytes(uri).length); + } + } + + /** + * @notice Tightly pack dynamic (variable length) data using this table's schema. + * @return The dynamic data, encoded into a sequence of bytes. + */ + function encodeDynamic(string memory uri) internal pure returns (bytes memory) { + return abi.encodePacked(bytes((uri))); + } + + /** + * @notice Encode all of a record's fields. + * @return The static (fixed length) data, encoded into a sequence of bytes. + * @return The lengths of the dynamic fields (packed into a single bytes32 value). + * @return The dynamic (variable length) data, encoded into a sequence of bytes. + */ + function encode(string memory uri) internal pure returns (bytes memory, EncodedLengths, bytes memory) { + bytes memory _staticData; + EncodedLengths _encodedLengths = encodeLengths(uri); + bytes memory _dynamicData = encodeDynamic(uri); + + return (_staticData, _encodedLengths, _dynamicData); + } + + /** + * @notice Encode keys as a bytes32 array using this table's field layout. + */ + function encodeKeyTuple(uint256 tokenId) internal pure returns (bytes32[] memory) { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(tokenId)); + + return _keyTuple; + } +} diff --git a/packages/contracts/lib/ERC1155-puppet/tables/OperatorApproval.sol b/packages/contracts/lib/ERC1155-puppet/tables/OperatorApproval.sol new file mode 100644 index 000000000..8a77fc84d --- /dev/null +++ b/packages/contracts/lib/ERC1155-puppet/tables/OperatorApproval.sol @@ -0,0 +1,220 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.8.24; + +/* Autogenerated file. Do not edit manually. */ + +// Import store internals +import { IStore } from "@latticexyz/store/src/IStore.sol"; +import { StoreSwitch } from "@latticexyz/store/src/StoreSwitch.sol"; +import { StoreCore } from "@latticexyz/store/src/StoreCore.sol"; +import { Bytes } from "@latticexyz/store/src/Bytes.sol"; +import { Memory } from "@latticexyz/store/src/Memory.sol"; +import { SliceLib } from "@latticexyz/store/src/Slice.sol"; +import { EncodeArray } from "@latticexyz/store/src/tightcoder/EncodeArray.sol"; +import { FieldLayout } from "@latticexyz/store/src/FieldLayout.sol"; +import { Schema } from "@latticexyz/store/src/Schema.sol"; +import { EncodedLengths, EncodedLengthsLib } from "@latticexyz/store/src/EncodedLengths.sol"; +import { ResourceId } from "@latticexyz/store/src/ResourceId.sol"; + +library OperatorApproval { + FieldLayout constant _fieldLayout = + FieldLayout.wrap(0x0001010001000000000000000000000000000000000000000000000000000000); + + // Hex-encoded key schema of (address, address) + Schema constant _keySchema = Schema.wrap(0x0028020061610000000000000000000000000000000000000000000000000000); + // Hex-encoded value schema of (bool) + Schema constant _valueSchema = Schema.wrap(0x0001010060000000000000000000000000000000000000000000000000000000); + + /** + * @notice Get the table's key field names. + * @return keyNames An array of strings with the names of key fields. + */ + function getKeyNames() internal pure returns (string[] memory keyNames) { + keyNames = new string[](2); + keyNames[0] = "owner"; + keyNames[1] = "operator"; + } + + /** + * @notice Get the table's value field names. + * @return fieldNames An array of strings with the names of value fields. + */ + function getFieldNames() internal pure returns (string[] memory fieldNames) { + fieldNames = new string[](1); + fieldNames[0] = "approved"; + } + + /** + * @notice Register the table with its config. + */ + function register(ResourceId _tableId) internal { + StoreSwitch.registerTable(_tableId, _fieldLayout, _keySchema, _valueSchema, getKeyNames(), getFieldNames()); + } + + /** + * @notice Register the table with its config. + */ + function _register(ResourceId _tableId) internal { + StoreCore.registerTable(_tableId, _fieldLayout, _keySchema, _valueSchema, getKeyNames(), getFieldNames()); + } + + /** + * @notice Get approved. + */ + function getApproved(ResourceId _tableId, address owner, address operator) internal view returns (bool approved) { + bytes32[] memory _keyTuple = new bytes32[](2); + _keyTuple[0] = bytes32(uint256(uint160(owner))); + _keyTuple[1] = bytes32(uint256(uint160(operator))); + + bytes32 _blob = StoreSwitch.getStaticField(_tableId, _keyTuple, 0, _fieldLayout); + return (_toBool(uint8(bytes1(_blob)))); + } + + /** + * @notice Get approved. + */ + function _getApproved(ResourceId _tableId, address owner, address operator) internal view returns (bool approved) { + bytes32[] memory _keyTuple = new bytes32[](2); + _keyTuple[0] = bytes32(uint256(uint160(owner))); + _keyTuple[1] = bytes32(uint256(uint160(operator))); + + bytes32 _blob = StoreCore.getStaticField(_tableId, _keyTuple, 0, _fieldLayout); + return (_toBool(uint8(bytes1(_blob)))); + } + + /** + * @notice Get approved. + */ + function get(ResourceId _tableId, address owner, address operator) internal view returns (bool approved) { + bytes32[] memory _keyTuple = new bytes32[](2); + _keyTuple[0] = bytes32(uint256(uint160(owner))); + _keyTuple[1] = bytes32(uint256(uint160(operator))); + + bytes32 _blob = StoreSwitch.getStaticField(_tableId, _keyTuple, 0, _fieldLayout); + return (_toBool(uint8(bytes1(_blob)))); + } + + /** + * @notice Get approved. + */ + function _get(ResourceId _tableId, address owner, address operator) internal view returns (bool approved) { + bytes32[] memory _keyTuple = new bytes32[](2); + _keyTuple[0] = bytes32(uint256(uint160(owner))); + _keyTuple[1] = bytes32(uint256(uint160(operator))); + + bytes32 _blob = StoreCore.getStaticField(_tableId, _keyTuple, 0, _fieldLayout); + return (_toBool(uint8(bytes1(_blob)))); + } + + /** + * @notice Set approved. + */ + function setApproved(ResourceId _tableId, address owner, address operator, bool approved) internal { + bytes32[] memory _keyTuple = new bytes32[](2); + _keyTuple[0] = bytes32(uint256(uint160(owner))); + _keyTuple[1] = bytes32(uint256(uint160(operator))); + + StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((approved)), _fieldLayout); + } + + /** + * @notice Set approved. + */ + function _setApproved(ResourceId _tableId, address owner, address operator, bool approved) internal { + bytes32[] memory _keyTuple = new bytes32[](2); + _keyTuple[0] = bytes32(uint256(uint160(owner))); + _keyTuple[1] = bytes32(uint256(uint160(operator))); + + StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((approved)), _fieldLayout); + } + + /** + * @notice Set approved. + */ + function set(ResourceId _tableId, address owner, address operator, bool approved) internal { + bytes32[] memory _keyTuple = new bytes32[](2); + _keyTuple[0] = bytes32(uint256(uint160(owner))); + _keyTuple[1] = bytes32(uint256(uint160(operator))); + + StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((approved)), _fieldLayout); + } + + /** + * @notice Set approved. + */ + function _set(ResourceId _tableId, address owner, address operator, bool approved) internal { + bytes32[] memory _keyTuple = new bytes32[](2); + _keyTuple[0] = bytes32(uint256(uint160(owner))); + _keyTuple[1] = bytes32(uint256(uint160(operator))); + + StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((approved)), _fieldLayout); + } + + /** + * @notice Delete all data for given keys. + */ + function deleteRecord(ResourceId _tableId, address owner, address operator) internal { + bytes32[] memory _keyTuple = new bytes32[](2); + _keyTuple[0] = bytes32(uint256(uint160(owner))); + _keyTuple[1] = bytes32(uint256(uint160(operator))); + + StoreSwitch.deleteRecord(_tableId, _keyTuple); + } + + /** + * @notice Delete all data for given keys. + */ + function _deleteRecord(ResourceId _tableId, address owner, address operator) internal { + bytes32[] memory _keyTuple = new bytes32[](2); + _keyTuple[0] = bytes32(uint256(uint160(owner))); + _keyTuple[1] = bytes32(uint256(uint160(operator))); + + StoreCore.deleteRecord(_tableId, _keyTuple, _fieldLayout); + } + + /** + * @notice Tightly pack static (fixed length) data using this table's schema. + * @return The static data, encoded into a sequence of bytes. + */ + function encodeStatic(bool approved) internal pure returns (bytes memory) { + return abi.encodePacked(approved); + } + + /** + * @notice Encode all of a record's fields. + * @return The static (fixed length) data, encoded into a sequence of bytes. + * @return The lengths of the dynamic fields (packed into a single bytes32 value). + * @return The dynamic (variable length) data, encoded into a sequence of bytes. + */ + function encode(bool approved) internal pure returns (bytes memory, EncodedLengths, bytes memory) { + bytes memory _staticData = encodeStatic(approved); + + EncodedLengths _encodedLengths; + bytes memory _dynamicData; + + return (_staticData, _encodedLengths, _dynamicData); + } + + /** + * @notice Encode keys as a bytes32 array using this table's field layout. + */ + function encodeKeyTuple(address owner, address operator) internal pure returns (bytes32[] memory) { + bytes32[] memory _keyTuple = new bytes32[](2); + _keyTuple[0] = bytes32(uint256(uint160(owner))); + _keyTuple[1] = bytes32(uint256(uint160(operator))); + + return _keyTuple; + } +} + +/** + * @notice Cast a value to a bool. + * @dev Boolean values are encoded as uint8 (1 = true, 0 = false), but Solidity doesn't allow casting between uint8 and bool. + * @param value The uint8 value to convert. + * @return result The boolean value. + */ +function _toBool(uint8 value) pure returns (bool result) { + assembly { + result := value + } +} diff --git a/packages/contracts/lib/ERC1155-puppet/tables/Owners.sol b/packages/contracts/lib/ERC1155-puppet/tables/Owners.sol new file mode 100644 index 000000000..92385749e --- /dev/null +++ b/packages/contracts/lib/ERC1155-puppet/tables/Owners.sol @@ -0,0 +1,208 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.8.24; + +/* Autogenerated file. Do not edit manually. */ + +// Import store internals +import { IStore } from "@latticexyz/store/src/IStore.sol"; +import { StoreSwitch } from "@latticexyz/store/src/StoreSwitch.sol"; +import { StoreCore } from "@latticexyz/store/src/StoreCore.sol"; +import { Bytes } from "@latticexyz/store/src/Bytes.sol"; +import { Memory } from "@latticexyz/store/src/Memory.sol"; +import { SliceLib } from "@latticexyz/store/src/Slice.sol"; +import { EncodeArray } from "@latticexyz/store/src/tightcoder/EncodeArray.sol"; +import { FieldLayout } from "@latticexyz/store/src/FieldLayout.sol"; +import { Schema } from "@latticexyz/store/src/Schema.sol"; +import { EncodedLengths, EncodedLengthsLib } from "@latticexyz/store/src/EncodedLengths.sol"; +import { ResourceId } from "@latticexyz/store/src/ResourceId.sol"; + +library Owners { + FieldLayout constant _fieldLayout = + FieldLayout.wrap(0x0020010020000000000000000000000000000000000000000000000000000000); + + // Hex-encoded key schema of (address, uint256) + Schema constant _keySchema = Schema.wrap(0x00340200611f0000000000000000000000000000000000000000000000000000); + // Hex-encoded value schema of (uint256) + Schema constant _valueSchema = Schema.wrap(0x002001001f000000000000000000000000000000000000000000000000000000); + + /** + * @notice Get the table's key field names. + * @return keyNames An array of strings with the names of key fields. + */ + function getKeyNames() internal pure returns (string[] memory keyNames) { + keyNames = new string[](2); + keyNames[0] = "owner"; + keyNames[1] = "tokenId"; + } + + /** + * @notice Get the table's value field names. + * @return fieldNames An array of strings with the names of value fields. + */ + function getFieldNames() internal pure returns (string[] memory fieldNames) { + fieldNames = new string[](1); + fieldNames[0] = "balance"; + } + + /** + * @notice Register the table with its config. + */ + function register(ResourceId _tableId) internal { + StoreSwitch.registerTable(_tableId, _fieldLayout, _keySchema, _valueSchema, getKeyNames(), getFieldNames()); + } + + /** + * @notice Register the table with its config. + */ + function _register(ResourceId _tableId) internal { + StoreCore.registerTable(_tableId, _fieldLayout, _keySchema, _valueSchema, getKeyNames(), getFieldNames()); + } + + /** + * @notice Get balance. + */ + function getBalance(ResourceId _tableId, address owner, uint256 tokenId) internal view returns (uint256 balance) { + bytes32[] memory _keyTuple = new bytes32[](2); + _keyTuple[0] = bytes32(uint256(uint160(owner))); + _keyTuple[1] = bytes32(uint256(tokenId)); + + bytes32 _blob = StoreSwitch.getStaticField(_tableId, _keyTuple, 0, _fieldLayout); + return (uint256(bytes32(_blob))); + } + + /** + * @notice Get balance. + */ + function _getBalance(ResourceId _tableId, address owner, uint256 tokenId) internal view returns (uint256 balance) { + bytes32[] memory _keyTuple = new bytes32[](2); + _keyTuple[0] = bytes32(uint256(uint160(owner))); + _keyTuple[1] = bytes32(uint256(tokenId)); + + bytes32 _blob = StoreCore.getStaticField(_tableId, _keyTuple, 0, _fieldLayout); + return (uint256(bytes32(_blob))); + } + + /** + * @notice Get balance. + */ + function get(ResourceId _tableId, address owner, uint256 tokenId) internal view returns (uint256 balance) { + bytes32[] memory _keyTuple = new bytes32[](2); + _keyTuple[0] = bytes32(uint256(uint160(owner))); + _keyTuple[1] = bytes32(uint256(tokenId)); + + bytes32 _blob = StoreSwitch.getStaticField(_tableId, _keyTuple, 0, _fieldLayout); + return (uint256(bytes32(_blob))); + } + + /** + * @notice Get balance. + */ + function _get(ResourceId _tableId, address owner, uint256 tokenId) internal view returns (uint256 balance) { + bytes32[] memory _keyTuple = new bytes32[](2); + _keyTuple[0] = bytes32(uint256(uint160(owner))); + _keyTuple[1] = bytes32(uint256(tokenId)); + + bytes32 _blob = StoreCore.getStaticField(_tableId, _keyTuple, 0, _fieldLayout); + return (uint256(bytes32(_blob))); + } + + /** + * @notice Set balance. + */ + function setBalance(ResourceId _tableId, address owner, uint256 tokenId, uint256 balance) internal { + bytes32[] memory _keyTuple = new bytes32[](2); + _keyTuple[0] = bytes32(uint256(uint160(owner))); + _keyTuple[1] = bytes32(uint256(tokenId)); + + StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((balance)), _fieldLayout); + } + + /** + * @notice Set balance. + */ + function _setBalance(ResourceId _tableId, address owner, uint256 tokenId, uint256 balance) internal { + bytes32[] memory _keyTuple = new bytes32[](2); + _keyTuple[0] = bytes32(uint256(uint160(owner))); + _keyTuple[1] = bytes32(uint256(tokenId)); + + StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((balance)), _fieldLayout); + } + + /** + * @notice Set balance. + */ + function set(ResourceId _tableId, address owner, uint256 tokenId, uint256 balance) internal { + bytes32[] memory _keyTuple = new bytes32[](2); + _keyTuple[0] = bytes32(uint256(uint160(owner))); + _keyTuple[1] = bytes32(uint256(tokenId)); + + StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((balance)), _fieldLayout); + } + + /** + * @notice Set balance. + */ + function _set(ResourceId _tableId, address owner, uint256 tokenId, uint256 balance) internal { + bytes32[] memory _keyTuple = new bytes32[](2); + _keyTuple[0] = bytes32(uint256(uint160(owner))); + _keyTuple[1] = bytes32(uint256(tokenId)); + + StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((balance)), _fieldLayout); + } + + /** + * @notice Delete all data for given keys. + */ + function deleteRecord(ResourceId _tableId, address owner, uint256 tokenId) internal { + bytes32[] memory _keyTuple = new bytes32[](2); + _keyTuple[0] = bytes32(uint256(uint160(owner))); + _keyTuple[1] = bytes32(uint256(tokenId)); + + StoreSwitch.deleteRecord(_tableId, _keyTuple); + } + + /** + * @notice Delete all data for given keys. + */ + function _deleteRecord(ResourceId _tableId, address owner, uint256 tokenId) internal { + bytes32[] memory _keyTuple = new bytes32[](2); + _keyTuple[0] = bytes32(uint256(uint160(owner))); + _keyTuple[1] = bytes32(uint256(tokenId)); + + StoreCore.deleteRecord(_tableId, _keyTuple, _fieldLayout); + } + + /** + * @notice Tightly pack static (fixed length) data using this table's schema. + * @return The static data, encoded into a sequence of bytes. + */ + function encodeStatic(uint256 balance) internal pure returns (bytes memory) { + return abi.encodePacked(balance); + } + + /** + * @notice Encode all of a record's fields. + * @return The static (fixed length) data, encoded into a sequence of bytes. + * @return The lengths of the dynamic fields (packed into a single bytes32 value). + * @return The dynamic (variable length) data, encoded into a sequence of bytes. + */ + function encode(uint256 balance) internal pure returns (bytes memory, EncodedLengths, bytes memory) { + bytes memory _staticData = encodeStatic(balance); + + EncodedLengths _encodedLengths; + bytes memory _dynamicData; + + return (_staticData, _encodedLengths, _dynamicData); + } + + /** + * @notice Encode keys as a bytes32 array using this table's field layout. + */ + function encodeKeyTuple(address owner, uint256 tokenId) internal pure returns (bytes32[] memory) { + bytes32[] memory _keyTuple = new bytes32[](2); + _keyTuple[0] = bytes32(uint256(uint160(owner))); + _keyTuple[1] = bytes32(uint256(tokenId)); + + return _keyTuple; + } +} diff --git a/packages/contracts/lib/ERC1155-puppet/tables/TestConfig.sol b/packages/contracts/lib/ERC1155-puppet/tables/TestConfig.sol new file mode 100644 index 000000000..59c7c4074 --- /dev/null +++ b/packages/contracts/lib/ERC1155-puppet/tables/TestConfig.sol @@ -0,0 +1,300 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.8.24; + +/* Autogenerated file. Do not edit manually. */ + +// Import store internals +import { IStore } from "@latticexyz/store/src/IStore.sol"; +import { StoreSwitch } from "@latticexyz/store/src/StoreSwitch.sol"; +import { StoreCore } from "@latticexyz/store/src/StoreCore.sol"; +import { Bytes } from "@latticexyz/store/src/Bytes.sol"; +import { Memory } from "@latticexyz/store/src/Memory.sol"; +import { SliceLib } from "@latticexyz/store/src/Slice.sol"; +import { EncodeArray } from "@latticexyz/store/src/tightcoder/EncodeArray.sol"; +import { FieldLayout } from "@latticexyz/store/src/FieldLayout.sol"; +import { Schema } from "@latticexyz/store/src/Schema.sol"; +import { EncodedLengths, EncodedLengthsLib } from "@latticexyz/store/src/EncodedLengths.sol"; +import { ResourceId } from "@latticexyz/store/src/ResourceId.sol"; + +struct TestConfigData { + address erc721; + address erc1155; +} + +library TestConfig { + // Hex below is the result of `WorldResourceIdLib.encode({ namespace: "TST", name: "TestConfig", typeId: RESOURCE_TABLE });` + ResourceId constant _tableId = ResourceId.wrap(0x7462545354000000000000000000000054657374436f6e666967000000000000); + + FieldLayout constant _fieldLayout = + FieldLayout.wrap(0x0028020014140000000000000000000000000000000000000000000000000000); + + // Hex-encoded key schema of () + Schema constant _keySchema = Schema.wrap(0x0000000000000000000000000000000000000000000000000000000000000000); + // Hex-encoded value schema of (address, address) + Schema constant _valueSchema = Schema.wrap(0x0028020061610000000000000000000000000000000000000000000000000000); + + /** + * @notice Get the table's key field names. + * @return keyNames An array of strings with the names of key fields. + */ + function getKeyNames() internal pure returns (string[] memory keyNames) { + keyNames = new string[](0); + } + + /** + * @notice Get the table's value field names. + * @return fieldNames An array of strings with the names of value fields. + */ + function getFieldNames() internal pure returns (string[] memory fieldNames) { + fieldNames = new string[](2); + fieldNames[0] = "erc721"; + fieldNames[1] = "erc1155"; + } + + /** + * @notice Register the table with its config. + */ + function register() internal { + StoreSwitch.registerTable(_tableId, _fieldLayout, _keySchema, _valueSchema, getKeyNames(), getFieldNames()); + } + + /** + * @notice Register the table with its config. + */ + function _register() internal { + StoreCore.registerTable(_tableId, _fieldLayout, _keySchema, _valueSchema, getKeyNames(), getFieldNames()); + } + + /** + * @notice Get erc721. + */ + function getErc721() internal view returns (address erc721) { + bytes32[] memory _keyTuple = new bytes32[](0); + + bytes32 _blob = StoreSwitch.getStaticField(_tableId, _keyTuple, 0, _fieldLayout); + return (address(bytes20(_blob))); + } + + /** + * @notice Get erc721. + */ + function _getErc721() internal view returns (address erc721) { + bytes32[] memory _keyTuple = new bytes32[](0); + + bytes32 _blob = StoreCore.getStaticField(_tableId, _keyTuple, 0, _fieldLayout); + return (address(bytes20(_blob))); + } + + /** + * @notice Set erc721. + */ + function setErc721(address erc721) internal { + bytes32[] memory _keyTuple = new bytes32[](0); + + StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((erc721)), _fieldLayout); + } + + /** + * @notice Set erc721. + */ + function _setErc721(address erc721) internal { + bytes32[] memory _keyTuple = new bytes32[](0); + + StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((erc721)), _fieldLayout); + } + + /** + * @notice Get erc1155. + */ + function getErc1155() internal view returns (address erc1155) { + bytes32[] memory _keyTuple = new bytes32[](0); + + bytes32 _blob = StoreSwitch.getStaticField(_tableId, _keyTuple, 1, _fieldLayout); + return (address(bytes20(_blob))); + } + + /** + * @notice Get erc1155. + */ + function _getErc1155() internal view returns (address erc1155) { + bytes32[] memory _keyTuple = new bytes32[](0); + + bytes32 _blob = StoreCore.getStaticField(_tableId, _keyTuple, 1, _fieldLayout); + return (address(bytes20(_blob))); + } + + /** + * @notice Set erc1155. + */ + function setErc1155(address erc1155) internal { + bytes32[] memory _keyTuple = new bytes32[](0); + + StoreSwitch.setStaticField(_tableId, _keyTuple, 1, abi.encodePacked((erc1155)), _fieldLayout); + } + + /** + * @notice Set erc1155. + */ + function _setErc1155(address erc1155) internal { + bytes32[] memory _keyTuple = new bytes32[](0); + + StoreCore.setStaticField(_tableId, _keyTuple, 1, abi.encodePacked((erc1155)), _fieldLayout); + } + + /** + * @notice Get the full data. + */ + function get() internal view returns (TestConfigData memory _table) { + bytes32[] memory _keyTuple = new bytes32[](0); + + (bytes memory _staticData, EncodedLengths _encodedLengths, bytes memory _dynamicData) = StoreSwitch.getRecord( + _tableId, + _keyTuple, + _fieldLayout + ); + return decode(_staticData, _encodedLengths, _dynamicData); + } + + /** + * @notice Get the full data. + */ + function _get() internal view returns (TestConfigData memory _table) { + bytes32[] memory _keyTuple = new bytes32[](0); + + (bytes memory _staticData, EncodedLengths _encodedLengths, bytes memory _dynamicData) = StoreCore.getRecord( + _tableId, + _keyTuple, + _fieldLayout + ); + return decode(_staticData, _encodedLengths, _dynamicData); + } + + /** + * @notice Set the full data using individual values. + */ + function set(address erc721, address erc1155) internal { + bytes memory _staticData = encodeStatic(erc721, erc1155); + + EncodedLengths _encodedLengths; + bytes memory _dynamicData; + + bytes32[] memory _keyTuple = new bytes32[](0); + + StoreSwitch.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData); + } + + /** + * @notice Set the full data using individual values. + */ + function _set(address erc721, address erc1155) internal { + bytes memory _staticData = encodeStatic(erc721, erc1155); + + EncodedLengths _encodedLengths; + bytes memory _dynamicData; + + bytes32[] memory _keyTuple = new bytes32[](0); + + StoreCore.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData, _fieldLayout); + } + + /** + * @notice Set the full data using the data struct. + */ + function set(TestConfigData memory _table) internal { + bytes memory _staticData = encodeStatic(_table.erc721, _table.erc1155); + + EncodedLengths _encodedLengths; + bytes memory _dynamicData; + + bytes32[] memory _keyTuple = new bytes32[](0); + + StoreSwitch.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData); + } + + /** + * @notice Set the full data using the data struct. + */ + function _set(TestConfigData memory _table) internal { + bytes memory _staticData = encodeStatic(_table.erc721, _table.erc1155); + + EncodedLengths _encodedLengths; + bytes memory _dynamicData; + + bytes32[] memory _keyTuple = new bytes32[](0); + + StoreCore.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData, _fieldLayout); + } + + /** + * @notice Decode the tightly packed blob of static data using this table's field layout. + */ + function decodeStatic(bytes memory _blob) internal pure returns (address erc721, address erc1155) { + erc721 = (address(Bytes.getBytes20(_blob, 0))); + + erc1155 = (address(Bytes.getBytes20(_blob, 20))); + } + + /** + * @notice Decode the tightly packed blobs using this table's field layout. + * @param _staticData Tightly packed static fields. + * + * + */ + function decode( + bytes memory _staticData, + EncodedLengths, + bytes memory + ) internal pure returns (TestConfigData memory _table) { + (_table.erc721, _table.erc1155) = decodeStatic(_staticData); + } + + /** + * @notice Delete all data for given keys. + */ + function deleteRecord() internal { + bytes32[] memory _keyTuple = new bytes32[](0); + + StoreSwitch.deleteRecord(_tableId, _keyTuple); + } + + /** + * @notice Delete all data for given keys. + */ + function _deleteRecord() internal { + bytes32[] memory _keyTuple = new bytes32[](0); + + StoreCore.deleteRecord(_tableId, _keyTuple, _fieldLayout); + } + + /** + * @notice Tightly pack static (fixed length) data using this table's schema. + * @return The static data, encoded into a sequence of bytes. + */ + function encodeStatic(address erc721, address erc1155) internal pure returns (bytes memory) { + return abi.encodePacked(erc721, erc1155); + } + + /** + * @notice Encode all of a record's fields. + * @return The static (fixed length) data, encoded into a sequence of bytes. + * @return The lengths of the dynamic fields (packed into a single bytes32 value). + * @return The dynamic (variable length) data, encoded into a sequence of bytes. + */ + function encode(address erc721, address erc1155) internal pure returns (bytes memory, EncodedLengths, bytes memory) { + bytes memory _staticData = encodeStatic(erc721, erc1155); + + EncodedLengths _encodedLengths; + bytes memory _dynamicData; + + return (_staticData, _encodedLengths, _dynamicData); + } + + /** + * @notice Encode keys as a bytes32 array using this table's field layout. + */ + function encodeKeyTuple() internal pure returns (bytes32[] memory) { + bytes32[] memory _keyTuple = new bytes32[](0); + + return _keyTuple; + } +} diff --git a/packages/contracts/lib/ERC1155-puppet/tables/TotalSupply.sol b/packages/contracts/lib/ERC1155-puppet/tables/TotalSupply.sol new file mode 100644 index 000000000..aca5ea6f8 --- /dev/null +++ b/packages/contracts/lib/ERC1155-puppet/tables/TotalSupply.sol @@ -0,0 +1,318 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.8.24; + +/* Autogenerated file. Do not edit manually. */ + +// Import store internals +import { IStore } from "@latticexyz/store/src/IStore.sol"; +import { StoreSwitch } from "@latticexyz/store/src/StoreSwitch.sol"; +import { StoreCore } from "@latticexyz/store/src/StoreCore.sol"; +import { Bytes } from "@latticexyz/store/src/Bytes.sol"; +import { Memory } from "@latticexyz/store/src/Memory.sol"; +import { SliceLib } from "@latticexyz/store/src/Slice.sol"; +import { EncodeArray } from "@latticexyz/store/src/tightcoder/EncodeArray.sol"; +import { FieldLayout } from "@latticexyz/store/src/FieldLayout.sol"; +import { Schema } from "@latticexyz/store/src/Schema.sol"; +import { EncodedLengths, EncodedLengthsLib } from "@latticexyz/store/src/EncodedLengths.sol"; +import { ResourceId } from "@latticexyz/store/src/ResourceId.sol"; + +struct TotalSupplyData { + uint256 currentSupply; + uint256 totalSupply; +} + +library TotalSupply { + FieldLayout constant _fieldLayout = + FieldLayout.wrap(0x0040020020200000000000000000000000000000000000000000000000000000); + + // Hex-encoded key schema of (uint256) + Schema constant _keySchema = Schema.wrap(0x002001001f000000000000000000000000000000000000000000000000000000); + // Hex-encoded value schema of (uint256, uint256) + Schema constant _valueSchema = Schema.wrap(0x004002001f1f0000000000000000000000000000000000000000000000000000); + + /** + * @notice Get the table's key field names. + * @return keyNames An array of strings with the names of key fields. + */ + function getKeyNames() internal pure returns (string[] memory keyNames) { + keyNames = new string[](1); + keyNames[0] = "tokenId"; + } + + /** + * @notice Get the table's value field names. + * @return fieldNames An array of strings with the names of value fields. + */ + function getFieldNames() internal pure returns (string[] memory fieldNames) { + fieldNames = new string[](2); + fieldNames[0] = "currentSupply"; + fieldNames[1] = "totalSupply"; + } + + /** + * @notice Register the table with its config. + */ + function register(ResourceId _tableId) internal { + StoreSwitch.registerTable(_tableId, _fieldLayout, _keySchema, _valueSchema, getKeyNames(), getFieldNames()); + } + + /** + * @notice Register the table with its config. + */ + function _register(ResourceId _tableId) internal { + StoreCore.registerTable(_tableId, _fieldLayout, _keySchema, _valueSchema, getKeyNames(), getFieldNames()); + } + + /** + * @notice Get currentSupply. + */ + function getCurrentSupply(ResourceId _tableId, uint256 tokenId) internal view returns (uint256 currentSupply) { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(tokenId)); + + bytes32 _blob = StoreSwitch.getStaticField(_tableId, _keyTuple, 0, _fieldLayout); + return (uint256(bytes32(_blob))); + } + + /** + * @notice Get currentSupply. + */ + function _getCurrentSupply(ResourceId _tableId, uint256 tokenId) internal view returns (uint256 currentSupply) { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(tokenId)); + + bytes32 _blob = StoreCore.getStaticField(_tableId, _keyTuple, 0, _fieldLayout); + return (uint256(bytes32(_blob))); + } + + /** + * @notice Set currentSupply. + */ + function setCurrentSupply(ResourceId _tableId, uint256 tokenId, uint256 currentSupply) internal { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(tokenId)); + + StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((currentSupply)), _fieldLayout); + } + + /** + * @notice Set currentSupply. + */ + function _setCurrentSupply(ResourceId _tableId, uint256 tokenId, uint256 currentSupply) internal { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(tokenId)); + + StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((currentSupply)), _fieldLayout); + } + + /** + * @notice Get totalSupply. + */ + function getTotalSupply(ResourceId _tableId, uint256 tokenId) internal view returns (uint256 totalSupply) { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(tokenId)); + + bytes32 _blob = StoreSwitch.getStaticField(_tableId, _keyTuple, 1, _fieldLayout); + return (uint256(bytes32(_blob))); + } + + /** + * @notice Get totalSupply. + */ + function _getTotalSupply(ResourceId _tableId, uint256 tokenId) internal view returns (uint256 totalSupply) { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(tokenId)); + + bytes32 _blob = StoreCore.getStaticField(_tableId, _keyTuple, 1, _fieldLayout); + return (uint256(bytes32(_blob))); + } + + /** + * @notice Set totalSupply. + */ + function setTotalSupply(ResourceId _tableId, uint256 tokenId, uint256 totalSupply) internal { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(tokenId)); + + StoreSwitch.setStaticField(_tableId, _keyTuple, 1, abi.encodePacked((totalSupply)), _fieldLayout); + } + + /** + * @notice Set totalSupply. + */ + function _setTotalSupply(ResourceId _tableId, uint256 tokenId, uint256 totalSupply) internal { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(tokenId)); + + StoreCore.setStaticField(_tableId, _keyTuple, 1, abi.encodePacked((totalSupply)), _fieldLayout); + } + + /** + * @notice Get the full data. + */ + function get(ResourceId _tableId, uint256 tokenId) internal view returns (TotalSupplyData memory _table) { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(tokenId)); + + (bytes memory _staticData, EncodedLengths _encodedLengths, bytes memory _dynamicData) = StoreSwitch.getRecord( + _tableId, + _keyTuple, + _fieldLayout + ); + return decode(_staticData, _encodedLengths, _dynamicData); + } + + /** + * @notice Get the full data. + */ + function _get(ResourceId _tableId, uint256 tokenId) internal view returns (TotalSupplyData memory _table) { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(tokenId)); + + (bytes memory _staticData, EncodedLengths _encodedLengths, bytes memory _dynamicData) = StoreCore.getRecord( + _tableId, + _keyTuple, + _fieldLayout + ); + return decode(_staticData, _encodedLengths, _dynamicData); + } + + /** + * @notice Set the full data using individual values. + */ + function set(ResourceId _tableId, uint256 tokenId, uint256 currentSupply, uint256 totalSupply) internal { + bytes memory _staticData = encodeStatic(currentSupply, totalSupply); + + EncodedLengths _encodedLengths; + bytes memory _dynamicData; + + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(tokenId)); + + StoreSwitch.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData); + } + + /** + * @notice Set the full data using individual values. + */ + function _set(ResourceId _tableId, uint256 tokenId, uint256 currentSupply, uint256 totalSupply) internal { + bytes memory _staticData = encodeStatic(currentSupply, totalSupply); + + EncodedLengths _encodedLengths; + bytes memory _dynamicData; + + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(tokenId)); + + StoreCore.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData, _fieldLayout); + } + + /** + * @notice Set the full data using the data struct. + */ + function set(ResourceId _tableId, uint256 tokenId, TotalSupplyData memory _table) internal { + bytes memory _staticData = encodeStatic(_table.currentSupply, _table.totalSupply); + + EncodedLengths _encodedLengths; + bytes memory _dynamicData; + + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(tokenId)); + + StoreSwitch.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData); + } + + /** + * @notice Set the full data using the data struct. + */ + function _set(ResourceId _tableId, uint256 tokenId, TotalSupplyData memory _table) internal { + bytes memory _staticData = encodeStatic(_table.currentSupply, _table.totalSupply); + + EncodedLengths _encodedLengths; + bytes memory _dynamicData; + + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(tokenId)); + + StoreCore.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData, _fieldLayout); + } + + /** + * @notice Decode the tightly packed blob of static data using this table's field layout. + */ + function decodeStatic(bytes memory _blob) internal pure returns (uint256 currentSupply, uint256 totalSupply) { + currentSupply = (uint256(Bytes.getBytes32(_blob, 0))); + + totalSupply = (uint256(Bytes.getBytes32(_blob, 32))); + } + + /** + * @notice Decode the tightly packed blobs using this table's field layout. + * @param _staticData Tightly packed static fields. + * + * + */ + function decode( + bytes memory _staticData, + EncodedLengths, + bytes memory + ) internal pure returns (TotalSupplyData memory _table) { + (_table.currentSupply, _table.totalSupply) = decodeStatic(_staticData); + } + + /** + * @notice Delete all data for given keys. + */ + function deleteRecord(ResourceId _tableId, uint256 tokenId) internal { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(tokenId)); + + StoreSwitch.deleteRecord(_tableId, _keyTuple); + } + + /** + * @notice Delete all data for given keys. + */ + function _deleteRecord(ResourceId _tableId, uint256 tokenId) internal { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(tokenId)); + + StoreCore.deleteRecord(_tableId, _keyTuple, _fieldLayout); + } + + /** + * @notice Tightly pack static (fixed length) data using this table's schema. + * @return The static data, encoded into a sequence of bytes. + */ + function encodeStatic(uint256 currentSupply, uint256 totalSupply) internal pure returns (bytes memory) { + return abi.encodePacked(currentSupply, totalSupply); + } + + /** + * @notice Encode all of a record's fields. + * @return The static (fixed length) data, encoded into a sequence of bytes. + * @return The lengths of the dynamic fields (packed into a single bytes32 value). + * @return The dynamic (variable length) data, encoded into a sequence of bytes. + */ + function encode( + uint256 currentSupply, + uint256 totalSupply + ) internal pure returns (bytes memory, EncodedLengths, bytes memory) { + bytes memory _staticData = encodeStatic(currentSupply, totalSupply); + + EncodedLengths _encodedLengths; + bytes memory _dynamicData; + + return (_staticData, _encodedLengths, _dynamicData); + } + + /** + * @notice Encode keys as a bytes32 array using this table's field layout. + */ + function encodeKeyTuple(uint256 tokenId) internal pure returns (bytes32[] memory) { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(tokenId)); + + return _keyTuple; + } +} diff --git a/packages/contracts/lib/ERC1155-puppet/utils.sol b/packages/contracts/lib/ERC1155-puppet/utils.sol new file mode 100644 index 000000000..a191baba5 --- /dev/null +++ b/packages/contracts/lib/ERC1155-puppet/utils.sol @@ -0,0 +1,48 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.20; + +import {ResourceId} from "@latticexyz/store/src/ResourceId.sol"; +import {RESOURCE_TABLE} from "@latticexyz/store/src/storeResourceTypes.sol"; + +import {WorldResourceIdLib} from "@latticexyz/world/src/WorldResourceId.sol"; +import {RESOURCE_SYSTEM} from "@latticexyz/world/src/worldResourceTypes.sol"; + +import { + ERC1155_SYSTEM_NAME, + TOTAL_SUPPLY_NAME, + METADATA_NAME, + ERC1155URISTORAGE_SYSTEM_NAME, + OPERATOR_APPROVAL_NAME, + OWNERS_NAME, + TOKEN_URISTORAGE_NAME +} from "./constants.sol"; +//solhint-disable + +function _erc1155URIStorageTableId(bytes14 namespace) pure returns (ResourceId) { + return WorldResourceIdLib.encode({typeId: RESOURCE_TABLE, namespace: namespace, name: TOKEN_URISTORAGE_NAME}); +} + +function _metadataTableId(bytes14 namespace) pure returns (ResourceId) { + return WorldResourceIdLib.encode({typeId: RESOURCE_TABLE, namespace: namespace, name: METADATA_NAME}); +} + +function _operatorApprovalTableId(bytes14 namespace) pure returns (ResourceId) { + return WorldResourceIdLib.encode({typeId: RESOURCE_TABLE, namespace: namespace, name: OPERATOR_APPROVAL_NAME}); +} + +function _ownersTableId(bytes14 namespace) pure returns (ResourceId) { + return WorldResourceIdLib.encode({typeId: RESOURCE_TABLE, namespace: namespace, name: OWNERS_NAME}); +} + +function _totalSupplyTableId(bytes14 namespace) pure returns (ResourceId) { + return WorldResourceIdLib.encode({typeId: RESOURCE_TABLE, namespace: namespace, name: TOTAL_SUPPLY_NAME}); +} + +function _erc1155SystemId(bytes14 namespace) pure returns (ResourceId) { + return WorldResourceIdLib.encode({typeId: RESOURCE_SYSTEM, namespace: namespace, name: ERC1155_SYSTEM_NAME}); +} + +function _erc1155URIStorageSystemId(bytes14 namespace) pure returns (ResourceId) { + return + WorldResourceIdLib.encode({typeId: RESOURCE_SYSTEM, namespace: namespace, name: ERC1155URISTORAGE_SYSTEM_NAME}); +} diff --git a/packages/contracts/mud.config.ts b/packages/contracts/mud.config.ts index 15291b720..50c760dce 100644 --- a/packages/contracts/mud.config.ts +++ b/packages/contracts/mud.config.ts @@ -57,6 +57,14 @@ export default defineWorld({ }, key: ["itemId"], }, + StarterItems: { + key: ["class"], + schema: { + class: "Classes", + itemIds: "uint256[]", + amounts: "uint256[]", + }, + }, /** * Stores players chosen names. */ @@ -93,6 +101,7 @@ export default defineWorld({ characterToken: "address", entropy: "address", pythProvider: "address", + items: "address", }, }, }, diff --git a/packages/contracts/out/IWorld.sol/IWorld.abi.json b/packages/contracts/out/IWorld.sol/IWorld.abi.json index b1578f984..1abbcea2b 100644 --- a/packages/contracts/out/IWorld.sol/IWorld.abi.json +++ b/packages/contracts/out/IWorld.sol/IWorld.abi.json @@ -1,4 +1,38 @@ [ + { + "type": "function", + "name": "UD__createItem", + "inputs": [ + { + "name": "itemType", + "type": "uint8", + "internalType": "enum ItemType" + }, + { + "name": "supply", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "itemMetadataURI", + "type": "string", + "internalType": "string" + }, + { + "name": "stats", + "type": "bytes", + "internalType": "bytes" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "nonpayable" + }, { "type": "function", "name": "UD__enterGame", @@ -135,6 +169,19 @@ ], "stateMutability": "view" }, + { + "type": "function", + "name": "UD__getItemsContract", + "inputs": [], + "outputs": [ + { + "name": "_erc1155", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "view" + }, { "type": "function", "name": "UD__getName", @@ -186,6 +233,74 @@ ], "stateMutability": "view" }, + { + "type": "function", + "name": "UD__getTotalSupply", + "inputs": [ + { + "name": "tokenId", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [ + { + "name": "_supply", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "UD__getWeaponStats", + "inputs": [ + { + "name": "itemId", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [ + { + "name": "_weaponStats", + "type": "tuple", + "internalType": "struct WeaponStats", + "components": [ + { + "name": "damage", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "speed", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "classRestrictions", + "type": "uint8[]", + "internalType": "uint8[]" + } + ] + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "UD__issueStarterItems", + "inputs": [ + { + "name": "characterId", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, { "type": "function", "name": "UD__mintCharacter", @@ -238,6 +353,47 @@ "outputs": [], "stateMutability": "payable" }, + { + "type": "function", + "name": "UD__setStarterItems", + "inputs": [ + { + "name": "class", + "type": "uint8", + "internalType": "enum Classes" + }, + { + "name": "itemIds", + "type": "uint256[]", + "internalType": "uint256[]" + }, + { + "name": "amounts", + "type": "uint256[]", + "internalType": "uint256[]" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "UD__setTokenUri", + "inputs": [ + { + "name": "tokenId", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "tokenUri", + "type": "string", + "internalType": "string" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, { "type": "function", "name": "batchCall", diff --git a/packages/contracts/out/IWorld.sol/IWorld.abi.json.d.ts b/packages/contracts/out/IWorld.sol/IWorld.abi.json.d.ts index f53c3e55c..e8f22b9c1 100644 --- a/packages/contracts/out/IWorld.sol/IWorld.abi.json.d.ts +++ b/packages/contracts/out/IWorld.sol/IWorld.abi.json.d.ts @@ -1,4 +1,38 @@ declare const abi: [ + { + "type": "function", + "name": "UD__createItem", + "inputs": [ + { + "name": "itemType", + "type": "uint8", + "internalType": "enum ItemType" + }, + { + "name": "supply", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "itemMetadataURI", + "type": "string", + "internalType": "string" + }, + { + "name": "stats", + "type": "bytes", + "internalType": "bytes" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "nonpayable" + }, { "type": "function", "name": "UD__enterGame", @@ -135,6 +169,19 @@ declare const abi: [ ], "stateMutability": "view" }, + { + "type": "function", + "name": "UD__getItemsContract", + "inputs": [], + "outputs": [ + { + "name": "_erc1155", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "view" + }, { "type": "function", "name": "UD__getName", @@ -186,6 +233,74 @@ declare const abi: [ ], "stateMutability": "view" }, + { + "type": "function", + "name": "UD__getTotalSupply", + "inputs": [ + { + "name": "tokenId", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [ + { + "name": "_supply", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "UD__getWeaponStats", + "inputs": [ + { + "name": "itemId", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [ + { + "name": "_weaponStats", + "type": "tuple", + "internalType": "struct WeaponStats", + "components": [ + { + "name": "damage", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "speed", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "classRestrictions", + "type": "uint8[]", + "internalType": "uint8[]" + } + ] + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "UD__issueStarterItems", + "inputs": [ + { + "name": "characterId", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, { "type": "function", "name": "UD__mintCharacter", @@ -238,6 +353,47 @@ declare const abi: [ "outputs": [], "stateMutability": "payable" }, + { + "type": "function", + "name": "UD__setStarterItems", + "inputs": [ + { + "name": "class", + "type": "uint8", + "internalType": "enum Classes" + }, + { + "name": "itemIds", + "type": "uint256[]", + "internalType": "uint256[]" + }, + { + "name": "amounts", + "type": "uint256[]", + "internalType": "uint256[]" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "UD__setTokenUri", + "inputs": [ + { + "name": "tokenId", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "tokenUri", + "type": "string", + "internalType": "string" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, { "type": "function", "name": "batchCall", diff --git a/packages/contracts/out/IWorld.sol/IWorld.json b/packages/contracts/out/IWorld.sol/IWorld.json index 8f2ba3405..012a448d0 100644 --- a/packages/contracts/out/IWorld.sol/IWorld.json +++ b/packages/contracts/out/IWorld.sol/IWorld.json @@ -1 +1 @@ -{"abi":[{"type":"function","name":"UD__enterGame","inputs":[{"name":"characterId","type":"uint256","internalType":"uint256"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"UD__getCharacterStats","inputs":[{"name":"characterId","type":"uint256","internalType":"uint256"}],"outputs":[{"name":"","type":"tuple","internalType":"struct CharacterStatsData","components":[{"name":"strength","type":"uint256","internalType":"uint256"},{"name":"agility","type":"uint256","internalType":"uint256"},{"name":"intelligence","type":"uint256","internalType":"uint256"},{"name":"hitPoints","type":"uint256","internalType":"uint256"},{"name":"experience","type":"uint256","internalType":"uint256"}]}],"stateMutability":"view"},{"type":"function","name":"UD__getCharacterToken","inputs":[],"outputs":[{"name":"_characterToken","type":"address","internalType":"address"}],"stateMutability":"view"},{"type":"function","name":"UD__getClass","inputs":[{"name":"characterId","type":"uint256","internalType":"uint256"}],"outputs":[{"name":"_class","type":"uint8","internalType":"enum Classes"}],"stateMutability":"view"},{"type":"function","name":"UD__getEntropy","inputs":[],"outputs":[{"name":"_entropy","type":"address","internalType":"address"}],"stateMutability":"view"},{"type":"function","name":"UD__getExperience","inputs":[{"name":"characterId","type":"uint256","internalType":"uint256"}],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"type":"function","name":"UD__getGoldToken","inputs":[],"outputs":[{"name":"_goldToken","type":"address","internalType":"address"}],"stateMutability":"view"},{"type":"function","name":"UD__getName","inputs":[{"name":"characterId","type":"uint256","internalType":"uint256"}],"outputs":[{"name":"_name","type":"bytes32","internalType":"bytes32"}],"stateMutability":"view"},{"type":"function","name":"UD__getOwner","inputs":[{"name":"characterId","type":"uint256","internalType":"uint256"}],"outputs":[{"name":"","type":"address","internalType":"address"}],"stateMutability":"view"},{"type":"function","name":"UD__getPythProvider","inputs":[],"outputs":[{"name":"_provider","type":"address","internalType":"address"}],"stateMutability":"view"},{"type":"function","name":"UD__mintCharacter","inputs":[{"name":"account","type":"address","internalType":"address"},{"name":"name","type":"bytes32","internalType":"bytes32"},{"name":"tokenUri","type":"string","internalType":"string"}],"outputs":[{"name":"characterId","type":"uint256","internalType":"uint256"}],"stateMutability":"nonpayable"},{"type":"function","name":"UD__rollStats","inputs":[{"name":"userRandomNumber","type":"bytes32","internalType":"bytes32"},{"name":"characterId","type":"uint256","internalType":"uint256"},{"name":"class","type":"uint8","internalType":"enum Classes"}],"outputs":[],"stateMutability":"payable"},{"type":"function","name":"batchCall","inputs":[{"name":"systemCalls","type":"tuple[]","internalType":"struct SystemCallData[]","components":[{"name":"systemId","type":"bytes32","internalType":"ResourceId"},{"name":"callData","type":"bytes","internalType":"bytes"}]}],"outputs":[{"name":"returnDatas","type":"bytes[]","internalType":"bytes[]"}],"stateMutability":"nonpayable"},{"type":"function","name":"batchCallFrom","inputs":[{"name":"systemCalls","type":"tuple[]","internalType":"struct SystemCallFromData[]","components":[{"name":"from","type":"address","internalType":"address"},{"name":"systemId","type":"bytes32","internalType":"ResourceId"},{"name":"callData","type":"bytes","internalType":"bytes"}]}],"outputs":[{"name":"returnDatas","type":"bytes[]","internalType":"bytes[]"}],"stateMutability":"nonpayable"},{"type":"function","name":"call","inputs":[{"name":"systemId","type":"bytes32","internalType":"ResourceId"},{"name":"callData","type":"bytes","internalType":"bytes"}],"outputs":[{"name":"","type":"bytes","internalType":"bytes"}],"stateMutability":"payable"},{"type":"function","name":"callFrom","inputs":[{"name":"delegator","type":"address","internalType":"address"},{"name":"systemId","type":"bytes32","internalType":"ResourceId"},{"name":"callData","type":"bytes","internalType":"bytes"}],"outputs":[{"name":"","type":"bytes","internalType":"bytes"}],"stateMutability":"payable"},{"type":"function","name":"creator","inputs":[],"outputs":[{"name":"","type":"address","internalType":"address"}],"stateMutability":"view"},{"type":"function","name":"deleteRecord","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","internalType":"bytes32[]"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"getDynamicField","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","internalType":"bytes32[]"},{"name":"dynamicFieldIndex","type":"uint8","internalType":"uint8"}],"outputs":[{"name":"","type":"bytes","internalType":"bytes"}],"stateMutability":"view"},{"type":"function","name":"getDynamicFieldLength","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","internalType":"bytes32[]"},{"name":"dynamicFieldIndex","type":"uint8","internalType":"uint8"}],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"type":"function","name":"getDynamicFieldSlice","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","internalType":"bytes32[]"},{"name":"dynamicFieldIndex","type":"uint8","internalType":"uint8"},{"name":"start","type":"uint256","internalType":"uint256"},{"name":"end","type":"uint256","internalType":"uint256"}],"outputs":[{"name":"data","type":"bytes","internalType":"bytes"}],"stateMutability":"view"},{"type":"function","name":"getField","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","internalType":"bytes32[]"},{"name":"fieldIndex","type":"uint8","internalType":"uint8"},{"name":"fieldLayout","type":"bytes32","internalType":"FieldLayout"}],"outputs":[{"name":"data","type":"bytes","internalType":"bytes"}],"stateMutability":"view"},{"type":"function","name":"getField","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","internalType":"bytes32[]"},{"name":"fieldIndex","type":"uint8","internalType":"uint8"}],"outputs":[{"name":"data","type":"bytes","internalType":"bytes"}],"stateMutability":"view"},{"type":"function","name":"getFieldLayout","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"}],"outputs":[{"name":"fieldLayout","type":"bytes32","internalType":"FieldLayout"}],"stateMutability":"view"},{"type":"function","name":"getFieldLength","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","internalType":"bytes32[]"},{"name":"fieldIndex","type":"uint8","internalType":"uint8"},{"name":"fieldLayout","type":"bytes32","internalType":"FieldLayout"}],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"type":"function","name":"getFieldLength","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","internalType":"bytes32[]"},{"name":"fieldIndex","type":"uint8","internalType":"uint8"}],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"type":"function","name":"getKeySchema","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"}],"outputs":[{"name":"keySchema","type":"bytes32","internalType":"Schema"}],"stateMutability":"view"},{"type":"function","name":"getRecord","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","internalType":"bytes32[]"},{"name":"fieldLayout","type":"bytes32","internalType":"FieldLayout"}],"outputs":[{"name":"staticData","type":"bytes","internalType":"bytes"},{"name":"encodedLengths","type":"bytes32","internalType":"EncodedLengths"},{"name":"dynamicData","type":"bytes","internalType":"bytes"}],"stateMutability":"view"},{"type":"function","name":"getRecord","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","internalType":"bytes32[]"}],"outputs":[{"name":"staticData","type":"bytes","internalType":"bytes"},{"name":"encodedLengths","type":"bytes32","internalType":"EncodedLengths"},{"name":"dynamicData","type":"bytes","internalType":"bytes"}],"stateMutability":"view"},{"type":"function","name":"getStaticField","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","internalType":"bytes32[]"},{"name":"fieldIndex","type":"uint8","internalType":"uint8"},{"name":"fieldLayout","type":"bytes32","internalType":"FieldLayout"}],"outputs":[{"name":"","type":"bytes32","internalType":"bytes32"}],"stateMutability":"view"},{"type":"function","name":"getValueSchema","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"}],"outputs":[{"name":"valueSchema","type":"bytes32","internalType":"Schema"}],"stateMutability":"view"},{"type":"function","name":"grantAccess","inputs":[{"name":"resourceId","type":"bytes32","internalType":"ResourceId"},{"name":"grantee","type":"address","internalType":"address"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"initialize","inputs":[{"name":"initModule","type":"address","internalType":"contract IModule"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"installModule","inputs":[{"name":"module","type":"address","internalType":"contract IModule"},{"name":"encodedArgs","type":"bytes","internalType":"bytes"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"installRootModule","inputs":[{"name":"module","type":"address","internalType":"contract IModule"},{"name":"encodedArgs","type":"bytes","internalType":"bytes"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"popFromDynamicField","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","internalType":"bytes32[]"},{"name":"dynamicFieldIndex","type":"uint8","internalType":"uint8"},{"name":"byteLengthToPop","type":"uint256","internalType":"uint256"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"pushToDynamicField","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","internalType":"bytes32[]"},{"name":"dynamicFieldIndex","type":"uint8","internalType":"uint8"},{"name":"dataToPush","type":"bytes","internalType":"bytes"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"registerDelegation","inputs":[{"name":"delegatee","type":"address","internalType":"address"},{"name":"delegationControlId","type":"bytes32","internalType":"ResourceId"},{"name":"initCallData","type":"bytes","internalType":"bytes"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"registerFunctionSelector","inputs":[{"name":"systemId","type":"bytes32","internalType":"ResourceId"},{"name":"systemFunctionSignature","type":"string","internalType":"string"}],"outputs":[{"name":"worldFunctionSelector","type":"bytes4","internalType":"bytes4"}],"stateMutability":"nonpayable"},{"type":"function","name":"registerNamespace","inputs":[{"name":"namespaceId","type":"bytes32","internalType":"ResourceId"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"registerNamespaceDelegation","inputs":[{"name":"namespaceId","type":"bytes32","internalType":"ResourceId"},{"name":"delegationControlId","type":"bytes32","internalType":"ResourceId"},{"name":"initCallData","type":"bytes","internalType":"bytes"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"registerRootFunctionSelector","inputs":[{"name":"systemId","type":"bytes32","internalType":"ResourceId"},{"name":"worldFunctionSignature","type":"string","internalType":"string"},{"name":"systemFunctionSignature","type":"string","internalType":"string"}],"outputs":[{"name":"worldFunctionSelector","type":"bytes4","internalType":"bytes4"}],"stateMutability":"nonpayable"},{"type":"function","name":"registerStoreHook","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"hookAddress","type":"address","internalType":"contract IStoreHook"},{"name":"enabledHooksBitmap","type":"uint8","internalType":"uint8"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"registerSystem","inputs":[{"name":"systemId","type":"bytes32","internalType":"ResourceId"},{"name":"system","type":"address","internalType":"contract System"},{"name":"publicAccess","type":"bool","internalType":"bool"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"registerSystemHook","inputs":[{"name":"systemId","type":"bytes32","internalType":"ResourceId"},{"name":"hookAddress","type":"address","internalType":"contract ISystemHook"},{"name":"enabledHooksBitmap","type":"uint8","internalType":"uint8"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"registerTable","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"fieldLayout","type":"bytes32","internalType":"FieldLayout"},{"name":"keySchema","type":"bytes32","internalType":"Schema"},{"name":"valueSchema","type":"bytes32","internalType":"Schema"},{"name":"keyNames","type":"string[]","internalType":"string[]"},{"name":"fieldNames","type":"string[]","internalType":"string[]"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"renounceOwnership","inputs":[{"name":"namespaceId","type":"bytes32","internalType":"ResourceId"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"revokeAccess","inputs":[{"name":"resourceId","type":"bytes32","internalType":"ResourceId"},{"name":"grantee","type":"address","internalType":"address"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"setDynamicField","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","internalType":"bytes32[]"},{"name":"dynamicFieldIndex","type":"uint8","internalType":"uint8"},{"name":"data","type":"bytes","internalType":"bytes"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"setField","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","internalType":"bytes32[]"},{"name":"fieldIndex","type":"uint8","internalType":"uint8"},{"name":"data","type":"bytes","internalType":"bytes"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"setField","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","internalType":"bytes32[]"},{"name":"fieldIndex","type":"uint8","internalType":"uint8"},{"name":"data","type":"bytes","internalType":"bytes"},{"name":"fieldLayout","type":"bytes32","internalType":"FieldLayout"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"setRecord","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","internalType":"bytes32[]"},{"name":"staticData","type":"bytes","internalType":"bytes"},{"name":"encodedLengths","type":"bytes32","internalType":"EncodedLengths"},{"name":"dynamicData","type":"bytes","internalType":"bytes"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"setStaticField","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","internalType":"bytes32[]"},{"name":"fieldIndex","type":"uint8","internalType":"uint8"},{"name":"data","type":"bytes","internalType":"bytes"},{"name":"fieldLayout","type":"bytes32","internalType":"FieldLayout"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"spliceDynamicData","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","internalType":"bytes32[]"},{"name":"dynamicFieldIndex","type":"uint8","internalType":"uint8"},{"name":"startWithinField","type":"uint40","internalType":"uint40"},{"name":"deleteCount","type":"uint40","internalType":"uint40"},{"name":"data","type":"bytes","internalType":"bytes"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"spliceStaticData","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","internalType":"bytes32[]"},{"name":"start","type":"uint48","internalType":"uint48"},{"name":"data","type":"bytes","internalType":"bytes"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"storeVersion","inputs":[],"outputs":[{"name":"version","type":"bytes32","internalType":"bytes32"}],"stateMutability":"view"},{"type":"function","name":"transferBalanceToAddress","inputs":[{"name":"fromNamespaceId","type":"bytes32","internalType":"ResourceId"},{"name":"toAddress","type":"address","internalType":"address"},{"name":"amount","type":"uint256","internalType":"uint256"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"transferBalanceToNamespace","inputs":[{"name":"fromNamespaceId","type":"bytes32","internalType":"ResourceId"},{"name":"toNamespaceId","type":"bytes32","internalType":"ResourceId"},{"name":"amount","type":"uint256","internalType":"uint256"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"transferOwnership","inputs":[{"name":"namespaceId","type":"bytes32","internalType":"ResourceId"},{"name":"newOwner","type":"address","internalType":"address"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"unregisterDelegation","inputs":[{"name":"delegatee","type":"address","internalType":"address"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"unregisterNamespaceDelegation","inputs":[{"name":"namespaceId","type":"bytes32","internalType":"ResourceId"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"unregisterStoreHook","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"hookAddress","type":"address","internalType":"contract IStoreHook"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"unregisterSystemHook","inputs":[{"name":"systemId","type":"bytes32","internalType":"ResourceId"},{"name":"hookAddress","type":"address","internalType":"contract ISystemHook"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"worldVersion","inputs":[],"outputs":[{"name":"","type":"bytes32","internalType":"bytes32"}],"stateMutability":"view"},{"type":"event","name":"HelloStore","inputs":[{"name":"storeVersion","type":"bytes32","indexed":true,"internalType":"bytes32"}],"anonymous":false},{"type":"event","name":"HelloWorld","inputs":[{"name":"worldVersion","type":"bytes32","indexed":true,"internalType":"bytes32"}],"anonymous":false},{"type":"event","name":"Store_DeleteRecord","inputs":[{"name":"tableId","type":"bytes32","indexed":true,"internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","indexed":false,"internalType":"bytes32[]"}],"anonymous":false},{"type":"event","name":"Store_SetRecord","inputs":[{"name":"tableId","type":"bytes32","indexed":true,"internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","indexed":false,"internalType":"bytes32[]"},{"name":"staticData","type":"bytes","indexed":false,"internalType":"bytes"},{"name":"encodedLengths","type":"bytes32","indexed":false,"internalType":"EncodedLengths"},{"name":"dynamicData","type":"bytes","indexed":false,"internalType":"bytes"}],"anonymous":false},{"type":"event","name":"Store_SpliceDynamicData","inputs":[{"name":"tableId","type":"bytes32","indexed":true,"internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","indexed":false,"internalType":"bytes32[]"},{"name":"dynamicFieldIndex","type":"uint8","indexed":false,"internalType":"uint8"},{"name":"start","type":"uint48","indexed":false,"internalType":"uint48"},{"name":"deleteCount","type":"uint40","indexed":false,"internalType":"uint40"},{"name":"encodedLengths","type":"bytes32","indexed":false,"internalType":"EncodedLengths"},{"name":"data","type":"bytes","indexed":false,"internalType":"bytes"}],"anonymous":false},{"type":"event","name":"Store_SpliceStaticData","inputs":[{"name":"tableId","type":"bytes32","indexed":true,"internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","indexed":false,"internalType":"bytes32[]"},{"name":"start","type":"uint48","indexed":false,"internalType":"uint48"},{"name":"data","type":"bytes","indexed":false,"internalType":"bytes"}],"anonymous":false},{"type":"error","name":"EncodedLengths_InvalidLength","inputs":[{"name":"length","type":"uint256","internalType":"uint256"}]},{"type":"error","name":"FieldLayout_Empty","inputs":[]},{"type":"error","name":"FieldLayout_InvalidStaticDataLength","inputs":[{"name":"staticDataLength","type":"uint256","internalType":"uint256"},{"name":"computedStaticDataLength","type":"uint256","internalType":"uint256"}]},{"type":"error","name":"FieldLayout_StaticLengthDoesNotFitInAWord","inputs":[{"name":"index","type":"uint256","internalType":"uint256"}]},{"type":"error","name":"FieldLayout_StaticLengthIsNotZero","inputs":[{"name":"index","type":"uint256","internalType":"uint256"}]},{"type":"error","name":"FieldLayout_StaticLengthIsZero","inputs":[{"name":"index","type":"uint256","internalType":"uint256"}]},{"type":"error","name":"FieldLayout_TooManyDynamicFields","inputs":[{"name":"numFields","type":"uint256","internalType":"uint256"},{"name":"maxFields","type":"uint256","internalType":"uint256"}]},{"type":"error","name":"FieldLayout_TooManyFields","inputs":[{"name":"numFields","type":"uint256","internalType":"uint256"},{"name":"maxFields","type":"uint256","internalType":"uint256"}]},{"type":"error","name":"Module_AlreadyInstalled","inputs":[]},{"type":"error","name":"Module_MissingDependency","inputs":[{"name":"dependency","type":"address","internalType":"address"}]},{"type":"error","name":"Module_NonRootInstallNotSupported","inputs":[]},{"type":"error","name":"Module_RootInstallNotSupported","inputs":[]},{"type":"error","name":"Schema_InvalidLength","inputs":[{"name":"length","type":"uint256","internalType":"uint256"}]},{"type":"error","name":"Schema_StaticTypeAfterDynamicType","inputs":[]},{"type":"error","name":"Slice_OutOfBounds","inputs":[{"name":"data","type":"bytes","internalType":"bytes"},{"name":"start","type":"uint256","internalType":"uint256"},{"name":"end","type":"uint256","internalType":"uint256"}]},{"type":"error","name":"Store_IndexOutOfBounds","inputs":[{"name":"length","type":"uint256","internalType":"uint256"},{"name":"accessedIndex","type":"uint256","internalType":"uint256"}]},{"type":"error","name":"Store_InvalidBounds","inputs":[{"name":"start","type":"uint256","internalType":"uint256"},{"name":"end","type":"uint256","internalType":"uint256"}]},{"type":"error","name":"Store_InvalidFieldNamesLength","inputs":[{"name":"expected","type":"uint256","internalType":"uint256"},{"name":"received","type":"uint256","internalType":"uint256"}]},{"type":"error","name":"Store_InvalidKeyNamesLength","inputs":[{"name":"expected","type":"uint256","internalType":"uint256"},{"name":"received","type":"uint256","internalType":"uint256"}]},{"type":"error","name":"Store_InvalidResourceType","inputs":[{"name":"expected","type":"bytes2","internalType":"bytes2"},{"name":"resourceId","type":"bytes32","internalType":"ResourceId"},{"name":"resourceIdString","type":"string","internalType":"string"}]},{"type":"error","name":"Store_InvalidSplice","inputs":[{"name":"startWithinField","type":"uint40","internalType":"uint40"},{"name":"deleteCount","type":"uint40","internalType":"uint40"},{"name":"fieldLength","type":"uint40","internalType":"uint40"}]},{"type":"error","name":"Store_InvalidStaticDataLength","inputs":[{"name":"expected","type":"uint256","internalType":"uint256"},{"name":"received","type":"uint256","internalType":"uint256"}]},{"type":"error","name":"Store_InvalidValueSchemaDynamicLength","inputs":[{"name":"expected","type":"uint256","internalType":"uint256"},{"name":"received","type":"uint256","internalType":"uint256"}]},{"type":"error","name":"Store_InvalidValueSchemaLength","inputs":[{"name":"expected","type":"uint256","internalType":"uint256"},{"name":"received","type":"uint256","internalType":"uint256"}]},{"type":"error","name":"Store_InvalidValueSchemaStaticLength","inputs":[{"name":"expected","type":"uint256","internalType":"uint256"},{"name":"received","type":"uint256","internalType":"uint256"}]},{"type":"error","name":"Store_TableAlreadyExists","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"tableIdString","type":"string","internalType":"string"}]},{"type":"error","name":"Store_TableNotFound","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"tableIdString","type":"string","internalType":"string"}]},{"type":"error","name":"World_AccessDenied","inputs":[{"name":"resource","type":"string","internalType":"string"},{"name":"caller","type":"address","internalType":"address"}]},{"type":"error","name":"World_AlreadyInitialized","inputs":[]},{"type":"error","name":"World_CallbackNotAllowed","inputs":[{"name":"functionSelector","type":"bytes4","internalType":"bytes4"}]},{"type":"error","name":"World_DelegationNotFound","inputs":[{"name":"delegator","type":"address","internalType":"address"},{"name":"delegatee","type":"address","internalType":"address"}]},{"type":"error","name":"World_FunctionSelectorAlreadyExists","inputs":[{"name":"functionSelector","type":"bytes4","internalType":"bytes4"}]},{"type":"error","name":"World_FunctionSelectorNotFound","inputs":[{"name":"functionSelector","type":"bytes4","internalType":"bytes4"}]},{"type":"error","name":"World_InsufficientBalance","inputs":[{"name":"balance","type":"uint256","internalType":"uint256"},{"name":"amount","type":"uint256","internalType":"uint256"}]},{"type":"error","name":"World_InterfaceNotSupported","inputs":[{"name":"contractAddress","type":"address","internalType":"address"},{"name":"interfaceId","type":"bytes4","internalType":"bytes4"}]},{"type":"error","name":"World_InvalidNamespace","inputs":[{"name":"namespace","type":"bytes14","internalType":"bytes14"}]},{"type":"error","name":"World_InvalidResourceId","inputs":[{"name":"resourceId","type":"bytes32","internalType":"ResourceId"},{"name":"resourceIdString","type":"string","internalType":"string"}]},{"type":"error","name":"World_InvalidResourceType","inputs":[{"name":"expected","type":"bytes2","internalType":"bytes2"},{"name":"resourceId","type":"bytes32","internalType":"ResourceId"},{"name":"resourceIdString","type":"string","internalType":"string"}]},{"type":"error","name":"World_ResourceAlreadyExists","inputs":[{"name":"resourceId","type":"bytes32","internalType":"ResourceId"},{"name":"resourceIdString","type":"string","internalType":"string"}]},{"type":"error","name":"World_ResourceNotFound","inputs":[{"name":"resourceId","type":"bytes32","internalType":"ResourceId"},{"name":"resourceIdString","type":"string","internalType":"string"}]},{"type":"error","name":"World_SystemAlreadyExists","inputs":[{"name":"system","type":"address","internalType":"address"}]},{"type":"error","name":"World_UnlimitedDelegationNotAllowed","inputs":[]}],"bytecode":{"object":"0x","sourceMap":"","linkReferences":{}},"deployedBytecode":{"object":"0x","sourceMap":"","linkReferences":{}},"methodIdentifiers":{"UD__enterGame(uint256)":"cc0f1ab7","UD__getCharacterStats(uint256)":"e1ecef13","UD__getCharacterToken()":"49d8cf02","UD__getClass(uint256)":"5758128c","UD__getEntropy()":"b5c691c7","UD__getExperience(uint256)":"8bc01bf0","UD__getGoldToken()":"8b994e32","UD__getName(uint256)":"cf36b62e","UD__getOwner(uint256)":"ef89f17a","UD__getPythProvider()":"e24cefd9","UD__mintCharacter(address,bytes32,string)":"d408a43b","UD__rollStats(bytes32,uint256,uint8)":"1cf705d7","batchCall((bytes32,bytes)[])":"ce5e8dd9","batchCallFrom((address,bytes32,bytes)[])":"8fc8cf7e","call(bytes32,bytes)":"3ae7af08","callFrom(address,bytes32,bytes)":"894ecc58","creator()":"02d05d3f","deleteRecord(bytes32,bytes32[])":"505a181d","getDynamicField(bytes32,bytes32[],uint8)":"1e788977","getDynamicFieldLength(bytes32,bytes32[],uint8)":"dbbf0e21","getDynamicFieldSlice(bytes32,bytes32[],uint8,uint256,uint256)":"4dc77d97","getField(bytes32,bytes32[],uint8)":"d03edb8c","getField(bytes32,bytes32[],uint8,bytes32)":"05242d2f","getFieldLayout(bytes32)":"3a77c2c2","getFieldLength(bytes32,bytes32[],uint8)":"a53417ed","getFieldLength(bytes32,bytes32[],uint8,bytes32)":"9f1fcf0a","getKeySchema(bytes32)":"d4285dc2","getRecord(bytes32,bytes32[])":"cc49db7e","getRecord(bytes32,bytes32[],bytes32)":"419b58fd","getStaticField(bytes32,bytes32[],uint8,bytes32)":"8c364d59","getValueSchema(bytes32)":"e228a4a3","grantAccess(bytes32,address)":"40554c3a","initialize(address)":"c4d66de8","installModule(address,bytes)":"8da798da","installRootModule(address,bytes)":"af068c9e","popFromDynamicField(bytes32,bytes32[],uint8,uint256)":"d9c03a04","pushToDynamicField(bytes32,bytes32[],uint8,bytes)":"150f3262","registerDelegation(address,bytes32,bytes)":"1d2257ba","registerFunctionSelector(bytes32,string)":"26d98102","registerNamespace(bytes32)":"b29e4089","registerNamespaceDelegation(bytes32,bytes32,bytes)":"bfdfaff7","registerRootFunctionSelector(bytes32,string,string)":"6548a90a","registerStoreHook(bytes32,address,uint8)":"530f4b60","registerSystem(bytes32,address,bool)":"3350b6a9","registerSystemHook(bytes32,address,uint8)":"d5f8337f","registerTable(bytes32,bytes32,bytes32,bytes32,string[],string[])":"0ba51f49","renounceOwnership(bytes32)":"219adc2e","revokeAccess(bytes32,address)":"8d53b208","setDynamicField(bytes32,bytes32[],uint8,bytes)":"ef6ea862","setField(bytes32,bytes32[],uint8,bytes)":"114a7266","setField(bytes32,bytes32[],uint8,bytes,bytes32)":"3708196e","setRecord(bytes32,bytes32[],bytes,bytes32,bytes)":"298314fb","setStaticField(bytes32,bytes32[],uint8,bytes,bytes32)":"390baae0","spliceDynamicData(bytes32,bytes32[],uint8,uint40,uint40,bytes)":"c0a2895a","spliceStaticData(bytes32,bytes32[],uint48,bytes)":"b047c1eb","storeVersion()":"c1122229","transferBalanceToAddress(bytes32,address,uint256)":"45afd199","transferBalanceToNamespace(bytes32,bytes32,uint256)":"c9c85a60","transferOwnership(bytes32,address)":"ef5d6bbb","unregisterDelegation(address)":"cdc938c5","unregisterNamespaceDelegation(bytes32)":"aa66e9c8","unregisterStoreHook(bytes32,address)":"05609129","unregisterSystemHook(bytes32,address)":"a92813ad","worldVersion()":"6951955d"},"rawMetadata":"{\"compiler\":{\"version\":\"0.8.24+commit.e11b9ed9\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"length\",\"type\":\"uint256\"}],\"name\":\"EncodedLengths_InvalidLength\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"FieldLayout_Empty\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"staticDataLength\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"computedStaticDataLength\",\"type\":\"uint256\"}],\"name\":\"FieldLayout_InvalidStaticDataLength\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"FieldLayout_StaticLengthDoesNotFitInAWord\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"FieldLayout_StaticLengthIsNotZero\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"FieldLayout_StaticLengthIsZero\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"numFields\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxFields\",\"type\":\"uint256\"}],\"name\":\"FieldLayout_TooManyDynamicFields\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"numFields\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxFields\",\"type\":\"uint256\"}],\"name\":\"FieldLayout_TooManyFields\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"Module_AlreadyInstalled\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"dependency\",\"type\":\"address\"}],\"name\":\"Module_MissingDependency\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"Module_NonRootInstallNotSupported\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"Module_RootInstallNotSupported\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"length\",\"type\":\"uint256\"}],\"name\":\"Schema_InvalidLength\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"Schema_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\":\"length\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"accessedIndex\",\"type\":\"uint256\"}],\"name\":\"Store_IndexOutOfBounds\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"start\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"end\",\"type\":\"uint256\"}],\"name\":\"Store_InvalidBounds\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"expected\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"received\",\"type\":\"uint256\"}],\"name\":\"Store_InvalidFieldNamesLength\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"expected\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"received\",\"type\":\"uint256\"}],\"name\":\"Store_InvalidKeyNamesLength\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes2\",\"name\":\"expected\",\"type\":\"bytes2\"},{\"internalType\":\"ResourceId\",\"name\":\"resourceId\",\"type\":\"bytes32\"},{\"internalType\":\"string\",\"name\":\"resourceIdString\",\"type\":\"string\"}],\"name\":\"Store_InvalidResourceType\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint40\",\"name\":\"startWithinField\",\"type\":\"uint40\"},{\"internalType\":\"uint40\",\"name\":\"deleteCount\",\"type\":\"uint40\"},{\"internalType\":\"uint40\",\"name\":\"fieldLength\",\"type\":\"uint40\"}],\"name\":\"Store_InvalidSplice\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"expected\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"received\",\"type\":\"uint256\"}],\"name\":\"Store_InvalidStaticDataLength\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"expected\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"received\",\"type\":\"uint256\"}],\"name\":\"Store_InvalidValueSchemaDynamicLength\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"expected\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"received\",\"type\":\"uint256\"}],\"name\":\"Store_InvalidValueSchemaLength\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"expected\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"received\",\"type\":\"uint256\"}],\"name\":\"Store_InvalidValueSchemaStaticLength\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"tableId\",\"type\":\"bytes32\"},{\"internalType\":\"string\",\"name\":\"tableIdString\",\"type\":\"string\"}],\"name\":\"Store_TableAlreadyExists\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"tableId\",\"type\":\"bytes32\"},{\"internalType\":\"string\",\"name\":\"tableIdString\",\"type\":\"string\"}],\"name\":\"Store_TableNotFound\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"resource\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"}],\"name\":\"World_AccessDenied\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"World_AlreadyInitialized\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"functionSelector\",\"type\":\"bytes4\"}],\"name\":\"World_CallbackNotAllowed\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"delegator\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"delegatee\",\"type\":\"address\"}],\"name\":\"World_DelegationNotFound\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"functionSelector\",\"type\":\"bytes4\"}],\"name\":\"World_FunctionSelectorAlreadyExists\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"functionSelector\",\"type\":\"bytes4\"}],\"name\":\"World_FunctionSelectorNotFound\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"balance\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"World_InsufficientBalance\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"contractAddress\",\"type\":\"address\"},{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"World_InterfaceNotSupported\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes14\",\"name\":\"namespace\",\"type\":\"bytes14\"}],\"name\":\"World_InvalidNamespace\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"resourceId\",\"type\":\"bytes32\"},{\"internalType\":\"string\",\"name\":\"resourceIdString\",\"type\":\"string\"}],\"name\":\"World_InvalidResourceId\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes2\",\"name\":\"expected\",\"type\":\"bytes2\"},{\"internalType\":\"ResourceId\",\"name\":\"resourceId\",\"type\":\"bytes32\"},{\"internalType\":\"string\",\"name\":\"resourceIdString\",\"type\":\"string\"}],\"name\":\"World_InvalidResourceType\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"resourceId\",\"type\":\"bytes32\"},{\"internalType\":\"string\",\"name\":\"resourceIdString\",\"type\":\"string\"}],\"name\":\"World_ResourceAlreadyExists\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"resourceId\",\"type\":\"bytes32\"},{\"internalType\":\"string\",\"name\":\"resourceIdString\",\"type\":\"string\"}],\"name\":\"World_ResourceNotFound\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"system\",\"type\":\"address\"}],\"name\":\"World_SystemAlreadyExists\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"World_UnlimitedDelegationNotAllowed\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"storeVersion\",\"type\":\"bytes32\"}],\"name\":\"HelloStore\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"worldVersion\",\"type\":\"bytes32\"}],\"name\":\"HelloWorld\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"ResourceId\",\"name\":\"tableId\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32[]\",\"name\":\"keyTuple\",\"type\":\"bytes32[]\"}],\"name\":\"Store_DeleteRecord\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"ResourceId\",\"name\":\"tableId\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32[]\",\"name\":\"keyTuple\",\"type\":\"bytes32[]\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"staticData\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"EncodedLengths\",\"name\":\"encodedLengths\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"dynamicData\",\"type\":\"bytes\"}],\"name\":\"Store_SetRecord\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"ResourceId\",\"name\":\"tableId\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32[]\",\"name\":\"keyTuple\",\"type\":\"bytes32[]\"},{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"dynamicFieldIndex\",\"type\":\"uint8\"},{\"indexed\":false,\"internalType\":\"uint48\",\"name\":\"start\",\"type\":\"uint48\"},{\"indexed\":false,\"internalType\":\"uint40\",\"name\":\"deleteCount\",\"type\":\"uint40\"},{\"indexed\":false,\"internalType\":\"EncodedLengths\",\"name\":\"encodedLengths\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"Store_SpliceDynamicData\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"ResourceId\",\"name\":\"tableId\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32[]\",\"name\":\"keyTuple\",\"type\":\"bytes32[]\"},{\"indexed\":false,\"internalType\":\"uint48\",\"name\":\"start\",\"type\":\"uint48\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"Store_SpliceStaticData\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"characterId\",\"type\":\"uint256\"}],\"name\":\"UD__enterGame\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"characterId\",\"type\":\"uint256\"}],\"name\":\"UD__getCharacterStats\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"strength\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"agility\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"intelligence\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"hitPoints\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"experience\",\"type\":\"uint256\"}],\"internalType\":\"struct CharacterStatsData\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"UD__getCharacterToken\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"_characterToken\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"characterId\",\"type\":\"uint256\"}],\"name\":\"UD__getClass\",\"outputs\":[{\"internalType\":\"enum Classes\",\"name\":\"_class\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"UD__getEntropy\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"_entropy\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"characterId\",\"type\":\"uint256\"}],\"name\":\"UD__getExperience\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"UD__getGoldToken\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"_goldToken\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"characterId\",\"type\":\"uint256\"}],\"name\":\"UD__getName\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"_name\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"characterId\",\"type\":\"uint256\"}],\"name\":\"UD__getOwner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"UD__getPythProvider\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"_provider\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"name\",\"type\":\"bytes32\"},{\"internalType\":\"string\",\"name\":\"tokenUri\",\"type\":\"string\"}],\"name\":\"UD__mintCharacter\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"characterId\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"userRandomNumber\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"characterId\",\"type\":\"uint256\"},{\"internalType\":\"enum Classes\",\"name\":\"class\",\"type\":\"uint8\"}],\"name\":\"UD__rollStats\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"ResourceId\",\"name\":\"systemId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"callData\",\"type\":\"bytes\"}],\"internalType\":\"struct SystemCallData[]\",\"name\":\"systemCalls\",\"type\":\"tuple[]\"}],\"name\":\"batchCall\",\"outputs\":[{\"internalType\":\"bytes[]\",\"name\":\"returnDatas\",\"type\":\"bytes[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"ResourceId\",\"name\":\"systemId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"callData\",\"type\":\"bytes\"}],\"internalType\":\"struct SystemCallFromData[]\",\"name\":\"systemCalls\",\"type\":\"tuple[]\"}],\"name\":\"batchCallFrom\",\"outputs\":[{\"internalType\":\"bytes[]\",\"name\":\"returnDatas\",\"type\":\"bytes[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"systemId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"callData\",\"type\":\"bytes\"}],\"name\":\"call\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"delegator\",\"type\":\"address\"},{\"internalType\":\"ResourceId\",\"name\":\"systemId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"callData\",\"type\":\"bytes\"}],\"name\":\"callFrom\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"creator\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"tableId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"keyTuple\",\"type\":\"bytes32[]\"}],\"name\":\"deleteRecord\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"tableId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"keyTuple\",\"type\":\"bytes32[]\"},{\"internalType\":\"uint8\",\"name\":\"dynamicFieldIndex\",\"type\":\"uint8\"}],\"name\":\"getDynamicField\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"tableId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"keyTuple\",\"type\":\"bytes32[]\"},{\"internalType\":\"uint8\",\"name\":\"dynamicFieldIndex\",\"type\":\"uint8\"}],\"name\":\"getDynamicFieldLength\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"tableId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"keyTuple\",\"type\":\"bytes32[]\"},{\"internalType\":\"uint8\",\"name\":\"dynamicFieldIndex\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"start\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"end\",\"type\":\"uint256\"}],\"name\":\"getDynamicFieldSlice\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"tableId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"keyTuple\",\"type\":\"bytes32[]\"},{\"internalType\":\"uint8\",\"name\":\"fieldIndex\",\"type\":\"uint8\"},{\"internalType\":\"FieldLayout\",\"name\":\"fieldLayout\",\"type\":\"bytes32\"}],\"name\":\"getField\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"tableId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"keyTuple\",\"type\":\"bytes32[]\"},{\"internalType\":\"uint8\",\"name\":\"fieldIndex\",\"type\":\"uint8\"}],\"name\":\"getField\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"tableId\",\"type\":\"bytes32\"}],\"name\":\"getFieldLayout\",\"outputs\":[{\"internalType\":\"FieldLayout\",\"name\":\"fieldLayout\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"tableId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"keyTuple\",\"type\":\"bytes32[]\"},{\"internalType\":\"uint8\",\"name\":\"fieldIndex\",\"type\":\"uint8\"},{\"internalType\":\"FieldLayout\",\"name\":\"fieldLayout\",\"type\":\"bytes32\"}],\"name\":\"getFieldLength\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"tableId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"keyTuple\",\"type\":\"bytes32[]\"},{\"internalType\":\"uint8\",\"name\":\"fieldIndex\",\"type\":\"uint8\"}],\"name\":\"getFieldLength\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"tableId\",\"type\":\"bytes32\"}],\"name\":\"getKeySchema\",\"outputs\":[{\"internalType\":\"Schema\",\"name\":\"keySchema\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"tableId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"keyTuple\",\"type\":\"bytes32[]\"},{\"internalType\":\"FieldLayout\",\"name\":\"fieldLayout\",\"type\":\"bytes32\"}],\"name\":\"getRecord\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"staticData\",\"type\":\"bytes\"},{\"internalType\":\"EncodedLengths\",\"name\":\"encodedLengths\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"dynamicData\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"tableId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"keyTuple\",\"type\":\"bytes32[]\"}],\"name\":\"getRecord\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"staticData\",\"type\":\"bytes\"},{\"internalType\":\"EncodedLengths\",\"name\":\"encodedLengths\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"dynamicData\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"tableId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"keyTuple\",\"type\":\"bytes32[]\"},{\"internalType\":\"uint8\",\"name\":\"fieldIndex\",\"type\":\"uint8\"},{\"internalType\":\"FieldLayout\",\"name\":\"fieldLayout\",\"type\":\"bytes32\"}],\"name\":\"getStaticField\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"tableId\",\"type\":\"bytes32\"}],\"name\":\"getValueSchema\",\"outputs\":[{\"internalType\":\"Schema\",\"name\":\"valueSchema\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"resourceId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"grantee\",\"type\":\"address\"}],\"name\":\"grantAccess\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IModule\",\"name\":\"initModule\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IModule\",\"name\":\"module\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"encodedArgs\",\"type\":\"bytes\"}],\"name\":\"installModule\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IModule\",\"name\":\"module\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"encodedArgs\",\"type\":\"bytes\"}],\"name\":\"installRootModule\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"tableId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"keyTuple\",\"type\":\"bytes32[]\"},{\"internalType\":\"uint8\",\"name\":\"dynamicFieldIndex\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"byteLengthToPop\",\"type\":\"uint256\"}],\"name\":\"popFromDynamicField\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"tableId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"keyTuple\",\"type\":\"bytes32[]\"},{\"internalType\":\"uint8\",\"name\":\"dynamicFieldIndex\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"dataToPush\",\"type\":\"bytes\"}],\"name\":\"pushToDynamicField\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"delegatee\",\"type\":\"address\"},{\"internalType\":\"ResourceId\",\"name\":\"delegationControlId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"initCallData\",\"type\":\"bytes\"}],\"name\":\"registerDelegation\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"systemId\",\"type\":\"bytes32\"},{\"internalType\":\"string\",\"name\":\"systemFunctionSignature\",\"type\":\"string\"}],\"name\":\"registerFunctionSelector\",\"outputs\":[{\"internalType\":\"bytes4\",\"name\":\"worldFunctionSelector\",\"type\":\"bytes4\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"namespaceId\",\"type\":\"bytes32\"}],\"name\":\"registerNamespace\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"namespaceId\",\"type\":\"bytes32\"},{\"internalType\":\"ResourceId\",\"name\":\"delegationControlId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"initCallData\",\"type\":\"bytes\"}],\"name\":\"registerNamespaceDelegation\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"systemId\",\"type\":\"bytes32\"},{\"internalType\":\"string\",\"name\":\"worldFunctionSignature\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"systemFunctionSignature\",\"type\":\"string\"}],\"name\":\"registerRootFunctionSelector\",\"outputs\":[{\"internalType\":\"bytes4\",\"name\":\"worldFunctionSelector\",\"type\":\"bytes4\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"tableId\",\"type\":\"bytes32\"},{\"internalType\":\"contract IStoreHook\",\"name\":\"hookAddress\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"enabledHooksBitmap\",\"type\":\"uint8\"}],\"name\":\"registerStoreHook\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"systemId\",\"type\":\"bytes32\"},{\"internalType\":\"contract System\",\"name\":\"system\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"publicAccess\",\"type\":\"bool\"}],\"name\":\"registerSystem\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"systemId\",\"type\":\"bytes32\"},{\"internalType\":\"contract ISystemHook\",\"name\":\"hookAddress\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"enabledHooksBitmap\",\"type\":\"uint8\"}],\"name\":\"registerSystemHook\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"tableId\",\"type\":\"bytes32\"},{\"internalType\":\"FieldLayout\",\"name\":\"fieldLayout\",\"type\":\"bytes32\"},{\"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\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"namespaceId\",\"type\":\"bytes32\"}],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"resourceId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"grantee\",\"type\":\"address\"}],\"name\":\"revokeAccess\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"tableId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"keyTuple\",\"type\":\"bytes32[]\"},{\"internalType\":\"uint8\",\"name\":\"dynamicFieldIndex\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"setDynamicField\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"tableId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"keyTuple\",\"type\":\"bytes32[]\"},{\"internalType\":\"uint8\",\"name\":\"fieldIndex\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"setField\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"tableId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"keyTuple\",\"type\":\"bytes32[]\"},{\"internalType\":\"uint8\",\"name\":\"fieldIndex\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"FieldLayout\",\"name\":\"fieldLayout\",\"type\":\"bytes32\"}],\"name\":\"setField\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"tableId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"keyTuple\",\"type\":\"bytes32[]\"},{\"internalType\":\"bytes\",\"name\":\"staticData\",\"type\":\"bytes\"},{\"internalType\":\"EncodedLengths\",\"name\":\"encodedLengths\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"dynamicData\",\"type\":\"bytes\"}],\"name\":\"setRecord\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"tableId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"keyTuple\",\"type\":\"bytes32[]\"},{\"internalType\":\"uint8\",\"name\":\"fieldIndex\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"FieldLayout\",\"name\":\"fieldLayout\",\"type\":\"bytes32\"}],\"name\":\"setStaticField\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"tableId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"keyTuple\",\"type\":\"bytes32[]\"},{\"internalType\":\"uint8\",\"name\":\"dynamicFieldIndex\",\"type\":\"uint8\"},{\"internalType\":\"uint40\",\"name\":\"startWithinField\",\"type\":\"uint40\"},{\"internalType\":\"uint40\",\"name\":\"deleteCount\",\"type\":\"uint40\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"spliceDynamicData\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"tableId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"keyTuple\",\"type\":\"bytes32[]\"},{\"internalType\":\"uint48\",\"name\":\"start\",\"type\":\"uint48\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"spliceStaticData\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"storeVersion\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"version\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"fromNamespaceId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"toAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transferBalanceToAddress\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"fromNamespaceId\",\"type\":\"bytes32\"},{\"internalType\":\"ResourceId\",\"name\":\"toNamespaceId\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transferBalanceToNamespace\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"namespaceId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"delegatee\",\"type\":\"address\"}],\"name\":\"unregisterDelegation\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"namespaceId\",\"type\":\"bytes32\"}],\"name\":\"unregisterNamespaceDelegation\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"tableId\",\"type\":\"bytes32\"},{\"internalType\":\"contract IStoreHook\",\"name\":\"hookAddress\",\"type\":\"address\"}],\"name\":\"unregisterStoreHook\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"systemId\",\"type\":\"bytes32\"},{\"internalType\":\"contract ISystemHook\",\"name\":\"hookAddress\",\"type\":\"address\"}],\"name\":\"unregisterSystemHook\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"worldVersion\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"MUD (https://mud.dev) by Lattice (https://lattice.xyz)\",\"details\":\"This is an autogenerated file; do not edit manually.\",\"errors\":{\"EncodedLengths_InvalidLength(uint256)\":[{\"params\":{\"length\":\"The length of the encoded lengths.\"}}],\"FieldLayout_InvalidStaticDataLength(uint256,uint256)\":[{\"params\":{\"computedStaticDataLength\":\"The computed static data length.\",\"staticDataLength\":\"The static data length of the field layout.\"}}],\"FieldLayout_StaticLengthDoesNotFitInAWord(uint256)\":[{\"params\":{\"index\":\"The index of the field.\"}}],\"FieldLayout_StaticLengthIsNotZero(uint256)\":[{\"params\":{\"index\":\"The index of the field.\"}}],\"FieldLayout_StaticLengthIsZero(uint256)\":[{\"params\":{\"index\":\"The index of the field.\"}}],\"FieldLayout_TooManyDynamicFields(uint256,uint256)\":[{\"params\":{\"maxFields\":\"The maximum number of fields a Schema can handle.\",\"numFields\":\"The total number of fields in the field layout.\"}}],\"FieldLayout_TooManyFields(uint256,uint256)\":[{\"params\":{\"maxFields\":\"The maximum number of fields a Schema can handle.\",\"numFields\":\"The total number of fields in the field layout.\"}}],\"Module_MissingDependency(address)\":[{\"params\":{\"dependency\":\"The address of the dependency.\"}}],\"Schema_InvalidLength(uint256)\":[{\"params\":{\"length\":\"The length of the schema.\"}}],\"Slice_OutOfBounds(bytes,uint256,uint256)\":[{\"details\":\"Raised if `start` is greater than `end` or `end` greater than the length of `data`.\",\"params\":{\"data\":\"The bytes array to subslice.\",\"end\":\"The end index for the subslice.\",\"start\":\"The start index for the subslice.\"}}],\"Store_IndexOutOfBounds(uint256,uint256)\":[{\"details\":\"Raised if the start index is larger than the previous length of the field.\",\"params\":{\"accessedIndex\":\"FIXME\",\"length\":\"FIXME\"}}],\"Store_InvalidBounds(uint256,uint256)\":[{\"params\":{\"end\":\"The end index within the dynamic field for the slice operation (exclusive).\",\"start\":\"The start index within the dynamic field for the slice operation (inclusive).\"}}],\"Store_InvalidFieldNamesLength(uint256,uint256)\":[{\"params\":{\"expected\":\"The expected length.\",\"received\":\"The provided length.\"}}],\"Store_InvalidKeyNamesLength(uint256,uint256)\":[{\"params\":{\"expected\":\"The expected length.\",\"received\":\"The provided length.\"}}],\"Store_InvalidResourceType(bytes2,bytes32,string)\":[{\"params\":{\"expected\":\"The expected resource type.\",\"resourceId\":\"The resource ID.\",\"resourceIdString\":\"The stringified resource ID (for easier debugging).\"}}],\"Store_InvalidSplice(uint40,uint40,uint40)\":[{\"details\":\"Raised if the splice total length of the field is changed but the splice is not at the end of the field.\",\"params\":{\"deleteCount\":\"The number of bytes to delete in the splice operation.\",\"fieldLength\":\"The field length for the splice operation.\",\"startWithinField\":\"The start index within the field for the splice operation.\"}}],\"Store_InvalidStaticDataLength(uint256,uint256)\":[{\"params\":{\"expected\":\"The expected length.\",\"received\":\"The provided length.\"}}],\"Store_InvalidValueSchemaDynamicLength(uint256,uint256)\":[{\"params\":{\"expected\":\"The expected length.\",\"received\":\"The provided length.\"}}],\"Store_InvalidValueSchemaLength(uint256,uint256)\":[{\"params\":{\"expected\":\"The expected length.\",\"received\":\"The provided length.\"}}],\"Store_InvalidValueSchemaStaticLength(uint256,uint256)\":[{\"params\":{\"expected\":\"The expected length.\",\"received\":\"The provided length.\"}}],\"Store_TableAlreadyExists(bytes32,string)\":[{\"params\":{\"tableId\":\"The ID of the table.\",\"tableIdString\":\"The stringified ID of the table (for easier debugging if cleartext tableIds are used).\"}}],\"Store_TableNotFound(bytes32,string)\":[{\"params\":{\"tableId\":\"The ID of the table.\",\"tableIdString\":\"The stringified ID of the table (for easier debugging if cleartext tableIds are used).\"}}],\"World_AccessDenied(string,address)\":[{\"params\":{\"caller\":\"The address of the user trying to access the resource.\",\"resource\":\"The resource's identifier.\"}}],\"World_CallbackNotAllowed(bytes4)\":[{\"params\":{\"functionSelector\":\"The function selector of the disallowed callback.\"}}],\"World_DelegationNotFound(address,address)\":[{\"params\":{\"delegatee\":\"The address of the delegatee.\",\"delegator\":\"The address of the delegator.\"}}],\"World_FunctionSelectorAlreadyExists(bytes4)\":[{\"params\":{\"functionSelector\":\"The function selector in question.\"}}],\"World_FunctionSelectorNotFound(bytes4)\":[{\"params\":{\"functionSelector\":\"The function selector in question.\"}}],\"World_InsufficientBalance(uint256,uint256)\":[{\"params\":{\"amount\":\"The amount needed.\",\"balance\":\"The current balance.\"}}],\"World_InterfaceNotSupported(address,bytes4)\":[{\"params\":{\"contractAddress\":\"The address of the contract in question.\",\"interfaceId\":\"The ID of the interface.\"}}],\"World_InvalidNamespace(bytes14)\":[{\"params\":{\"namespace\":\"The invalid namespace.\"}}],\"World_InvalidResourceId(bytes32,string)\":[{\"params\":{\"resourceId\":\"The ID of the resource.\",\"resourceIdString\":\"The string representation of the resource ID.\"}}],\"World_InvalidResourceType(bytes2,bytes32,string)\":[{\"params\":{\"expected\":\"The expected resource type.\",\"resourceId\":\"The ID of the resource.\",\"resourceIdString\":\"The string representation of the resource ID.\"}}],\"World_ResourceAlreadyExists(bytes32,string)\":[{\"params\":{\"resourceId\":\"The ID of the resource.\",\"resourceIdString\":\"The string representation of the resource ID.\"}}],\"World_ResourceNotFound(bytes32,string)\":[{\"params\":{\"resourceId\":\"The ID of the resource.\",\"resourceIdString\":\"The string representation of the resource ID.\"}}],\"World_SystemAlreadyExists(address)\":[{\"params\":{\"system\":\"The address of the system.\"}}]},\"events\":{\"HelloStore(bytes32)\":{\"params\":{\"storeVersion\":\"The protocol version of the Store.\"}},\"HelloWorld(bytes32)\":{\"params\":{\"worldVersion\":\"The protocol version of the World.\"}},\"Store_DeleteRecord(bytes32,bytes32[])\":{\"params\":{\"keyTuple\":\"An array representing the composite key for the record.\",\"tableId\":\"The ID of the table where the record is deleted.\"}},\"Store_SetRecord(bytes32,bytes32[],bytes,bytes32,bytes)\":{\"params\":{\"dynamicData\":\"The dynamic data of the record.\",\"encodedLengths\":\"The encoded lengths of the dynamic data of the record.\",\"keyTuple\":\"An array representing the composite key for the record.\",\"staticData\":\"The static data of the record.\",\"tableId\":\"The ID of the table where the record is set.\"}},\"Store_SpliceDynamicData(bytes32,bytes32[],uint8,uint48,uint40,bytes32,bytes)\":{\"params\":{\"data\":\"The data to insert into the dynamic data of the record at the start byte.\",\"deleteCount\":\"The number of bytes to delete in the splice operation.\",\"dynamicFieldIndex\":\"The index of the dynamic field to splice data, relative to the start of the dynamic fields. (Dynamic field index = field index - number of static fields)\",\"encodedLengths\":\"The encoded lengths of the dynamic data of the record.\",\"keyTuple\":\"An array representing the composite key for the record.\",\"start\":\"The start position in bytes for the splice operation.\",\"tableId\":\"The ID of the table where the data is spliced.\"}},\"Store_SpliceStaticData(bytes32,bytes32[],uint48,bytes)\":{\"details\":\"In static data, data is always overwritten starting at the start position, so the total length of the data remains the same and no data is shifted.\",\"params\":{\"data\":\"The data to write to the static data of the record at the start byte.\",\"keyTuple\":\"An array representing the key for the record.\",\"start\":\"The start position in bytes for the splice operation.\",\"tableId\":\"The ID of the table where the data is spliced.\"}}},\"kind\":\"dev\",\"methods\":{\"call(bytes32,bytes)\":{\"details\":\"If the system is not public, the caller must have access to the namespace or name (encoded in the system ID).\",\"params\":{\"callData\":\"The data to pass with the call, function selector (4 bytes) followed by the ABI encoded parameters.\",\"systemId\":\"The ID of the system to be called.\"},\"returns\":{\"_0\":\"The abi encoded return data from the called system.\"}},\"callFrom(address,bytes32,bytes)\":{\"details\":\"If the system is not public, the delegator must have access to the namespace or name (encoded in the system ID).\",\"params\":{\"callData\":\"The data to pass with the call, function selector (4 bytes) followed by the ABI encoded parameters.\",\"delegator\":\"The address on whose behalf the call is made.\",\"systemId\":\"The ID of the system to be called.\"},\"returns\":{\"_0\":\"The abi encoded return data from the called system.\"}},\"creator()\":{\"returns\":{\"_0\":\"The address of the World's creator.\"}},\"initialize(address)\":{\"details\":\"Can only be called once by the creator.\",\"params\":{\"initModule\":\"The InitModule to be installed during initialization.\"}},\"installRootModule(address,bytes)\":{\"details\":\"Requires the caller to own the root namespace. The module is delegatecalled and installed in the root namespace.\",\"params\":{\"encodedArgs\":\"The ABI encoded arguments for the module installation.\",\"module\":\"The module to be installed.\"}},\"storeVersion()\":{\"returns\":{\"version\":\"The protocol version of the Store contract.\"}},\"worldVersion()\":{\"returns\":{\"_0\":\"The protocol version of the World.\"}}},\"title\":\"IWorld\",\"version\":1},\"userdoc\":{\"errors\":{\"EncodedLengths_InvalidLength(uint256)\":[{\"notice\":\"Error raised when the provided encoded lengths has an invalid length.\"}],\"FieldLayout_Empty()\":[{\"notice\":\"Error raised when the provided field layout is empty.\"}],\"FieldLayout_InvalidStaticDataLength(uint256,uint256)\":[{\"notice\":\"Error raised when the provided field layout has an invalid static data length.\"}],\"FieldLayout_StaticLengthDoesNotFitInAWord(uint256)\":[{\"notice\":\"Error raised when the provided field layout has a static data length that does not fit in a word (32 bytes).\"}],\"FieldLayout_StaticLengthIsNotZero(uint256)\":[{\"notice\":\"Error raised when the provided field layout has a nonzero static data length.\"}],\"FieldLayout_StaticLengthIsZero(uint256)\":[{\"notice\":\"Error raised when the provided field layout has a static data length of zero.\"}],\"FieldLayout_TooManyDynamicFields(uint256,uint256)\":[{\"notice\":\"Error raised when the provided field layout has too many dynamic fields.\"}],\"FieldLayout_TooManyFields(uint256,uint256)\":[{\"notice\":\"Error raised when the provided field layout has too many fields.\"}],\"Module_AlreadyInstalled()\":[{\"notice\":\"Error raised if the provided module is already installed.\"}],\"Module_MissingDependency(address)\":[{\"notice\":\"Error raised if the provided module is missing a dependency.\"}],\"Module_NonRootInstallNotSupported()\":[{\"notice\":\"Error raised if installing in non-root is not supported.\"}],\"Module_RootInstallNotSupported()\":[{\"notice\":\"Error raised if installing in root is not supported.\"}],\"Schema_InvalidLength(uint256)\":[{\"notice\":\"Error raised when the provided schema has an invalid length.\"}],\"Schema_StaticTypeAfterDynamicType()\":[{\"notice\":\"Error raised when a static type is placed after a dynamic type in a schema.\"}],\"Slice_OutOfBounds(bytes,uint256,uint256)\":[{\"notice\":\"Error raised when the provided slice is out of bounds.\"}],\"Store_IndexOutOfBounds(uint256,uint256)\":[{\"notice\":\"Error raised if the provided index is out of bounds.\"}],\"Store_InvalidBounds(uint256,uint256)\":[{\"notice\":\"Error raised if the provided slice bounds are invalid.\"}],\"Store_InvalidFieldNamesLength(uint256,uint256)\":[{\"notice\":\"Error raised if the provided field names length is invalid.\"}],\"Store_InvalidKeyNamesLength(uint256,uint256)\":[{\"notice\":\"Error raised if the provided key names length is invalid.\"}],\"Store_InvalidResourceType(bytes2,bytes32,string)\":[{\"notice\":\"Error raised if the provided resource ID cannot be found.\"}],\"Store_InvalidSplice(uint40,uint40,uint40)\":[{\"notice\":\"Error raised if the provided splice is invalid.\"}],\"Store_InvalidStaticDataLength(uint256,uint256)\":[{\"notice\":\"Error raised if the provided static data length is invalid.\"}],\"Store_InvalidValueSchemaDynamicLength(uint256,uint256)\":[{\"notice\":\"Error raised if the provided schema dynamic length is invalid.\"}],\"Store_InvalidValueSchemaLength(uint256,uint256)\":[{\"notice\":\"Error raised if the provided value schema length is invalid.\"}],\"Store_InvalidValueSchemaStaticLength(uint256,uint256)\":[{\"notice\":\"Error raised if the provided schema static length is invalid.\"}],\"Store_TableAlreadyExists(bytes32,string)\":[{\"notice\":\"Error raised if the provided table already exists.\"}],\"Store_TableNotFound(bytes32,string)\":[{\"notice\":\"Error raised if the provided table cannot be found.\"}],\"World_AccessDenied(string,address)\":[{\"notice\":\"Raised when a user tries to access a resource they don't have permission for.\"}],\"World_AlreadyInitialized()\":[{\"notice\":\"Raised when trying to initialize an already initialized World.\"}],\"World_CallbackNotAllowed(bytes4)\":[{\"notice\":\"Raised when the World is calling itself via an external call.\"}],\"World_DelegationNotFound(address,address)\":[{\"notice\":\"Raised when the specified delegation is not found.\"}],\"World_FunctionSelectorAlreadyExists(bytes4)\":[{\"notice\":\"Raised when trying to register a function selector that already exists.\"}],\"World_FunctionSelectorNotFound(bytes4)\":[{\"notice\":\"Raised when the specified function selector is not found.\"}],\"World_InsufficientBalance(uint256,uint256)\":[{\"notice\":\"Raised when there's an insufficient balance for a particular operation.\"}],\"World_InterfaceNotSupported(address,bytes4)\":[{\"notice\":\"Raised when the specified interface is not supported by the contract.\"}],\"World_InvalidNamespace(bytes14)\":[{\"notice\":\"Raised when an namespace contains an invalid sequence of characters (\\\"__\\\").\"}],\"World_InvalidResourceId(bytes32,string)\":[{\"notice\":\"Raised when an invalid resource ID is provided.\"}],\"World_InvalidResourceType(bytes2,bytes32,string)\":[{\"notice\":\"Raised when an invalid resource type is provided.\"}],\"World_ResourceAlreadyExists(bytes32,string)\":[{\"notice\":\"Raised when trying to register a resource that already exists.\"}],\"World_ResourceNotFound(bytes32,string)\":[{\"notice\":\"Raised when the specified resource is not found.\"}],\"World_SystemAlreadyExists(address)\":[{\"notice\":\"Raised when trying to register a system that already exists.\"}],\"World_UnlimitedDelegationNotAllowed()\":[{\"notice\":\"Raised when trying to create an unlimited delegation in a context where it is not allowed, e.g. when registering a namespace fallback delegation.\"}]},\"events\":{\"HelloStore(bytes32)\":{\"notice\":\"Emitted when the Store is created.\"},\"HelloWorld(bytes32)\":{\"notice\":\"Emitted when the World is created.\"},\"Store_DeleteRecord(bytes32,bytes32[])\":{\"notice\":\"Emitted when a record is deleted from the store.\"},\"Store_SetRecord(bytes32,bytes32[],bytes,bytes32,bytes)\":{\"notice\":\"Emitted when a new record is set in the store.\"},\"Store_SpliceDynamicData(bytes32,bytes32[],uint8,uint48,uint40,bytes32,bytes)\":{\"notice\":\"Emitted when dynamic data in the store is spliced.\"},\"Store_SpliceStaticData(bytes32,bytes32[],uint48,bytes)\":{\"notice\":\"Emitted when static data in the store is spliced.\"}},\"kind\":\"user\",\"methods\":{\"call(bytes32,bytes)\":{\"notice\":\"Call the system at the given system ID.\"},\"callFrom(address,bytes32,bytes)\":{\"notice\":\"Call the system at the given system ID on behalf of the given delegator.\"},\"creator()\":{\"notice\":\"Retrieve the immutable original deployer of the World.\"},\"getDynamicField(bytes32,bytes32[],uint8)\":{\"notice\":\"Get a single dynamic field from the given tableId and key tuple at the given dynamic field index. (Dynamic field index = field index - number of static fields)\"},\"getDynamicFieldLength(bytes32,bytes32[],uint8)\":{\"notice\":\"Get the byte length of a single dynamic field from the given tableId and key tuple\"},\"getDynamicFieldSlice(bytes32,bytes32[],uint8,uint256,uint256)\":{\"notice\":\"Get a byte slice (including start, excluding end) of a single dynamic field from the given tableId and key tuple, with the given value field layout. The slice is unchecked and will return invalid data if `start`:`end` overflow.\"},\"getField(bytes32,bytes32[],uint8)\":{\"notice\":\"Get a single field from the given tableId and key tuple, loading the field layout from storage\"},\"getField(bytes32,bytes32[],uint8,bytes32)\":{\"notice\":\"Get a single field from the given tableId and key tuple, with the given field layout\"},\"getFieldLength(bytes32,bytes32[],uint8)\":{\"notice\":\"Get the byte length of a single field from the given tableId and key tuple, loading the field layout from storage\"},\"getFieldLength(bytes32,bytes32[],uint8,bytes32)\":{\"notice\":\"Get the byte length of a single field from the given tableId and key tuple, with the given value field layout\"},\"getRecord(bytes32,bytes32[])\":{\"notice\":\"Get full record (all fields, static and dynamic data) for the given tableId and key tuple, loading the field layout from storage\"},\"getRecord(bytes32,bytes32[],bytes32)\":{\"notice\":\"Get full record (all fields, static and dynamic data) for the given tableId and key tuple, with the given field layout\"},\"getStaticField(bytes32,bytes32[],uint8,bytes32)\":{\"notice\":\"Get a single static field from the given tableId and key tuple, with the given value field layout. Note: the field value is left-aligned in the returned bytes32, the rest of the word is not zeroed out. Consumers are expected to truncate the returned value as needed.\"},\"initialize(address)\":{\"notice\":\"Initializes the World.\"},\"installRootModule(address,bytes)\":{\"notice\":\"Install the given root module in the World.\"},\"storeVersion()\":{\"notice\":\"Returns the protocol version of the Store contract.\"},\"worldVersion()\":{\"notice\":\"Retrieve the protocol version of the World.\"}},\"notice\":\"This interface integrates all systems and associated function selectors that are dynamically registered in the World during deployment.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/codegen/world/IWorld.sol\":\"IWorld\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":3000},\"remappings\":[\":@codegen/=src/codegen/\",\":@erc1155/=lib/ERC1155-puppet/\",\":@latticexyz/=node_modules/@latticexyz/\",\":@openzeppelin-upgradeable/=node_modules/@openzeppelin/contracts-upgradeable/\",\":@openzeppelin/=node_modules/@openzeppelin/contracts/\",\":@pythnetwork/=node_modules/@pythnetwork/entropy-sdk-solidity/\",\":@systems/=src/systems/\",\":@tables/=src/codegen/tables/\",\":@test/=test/\",\":@world/=src/codegen/world/\",\":ds-test/=node_modules/ds-test/src/\",\":forge-std/=node_modules/forge-std/src/\"]},\"sources\":{\"node_modules/@latticexyz/schema-type/src/solidity/SchemaType.sol\":{\"keccak256\":\"0x650927696f7518fa216f2d6001835e9fdb419518034c781e86d2a2d33f4ecd2a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://72e91ac32ed00d36bd22fefeaf4ce1e9420143ddab7080eeb720c668a117bf44\",\"dweb:/ipfs/QmdVqn18WZvx5p84MDJPsB5tfVoXDR86wzm4sLx6WrGYYL\"]},\"node_modules/@latticexyz/store/src/Bytes.sol\":{\"keccak256\":\"0x7dec900f9c9e7dff59430fa6f520e76c56338c3e829201aea140d49342e4fef8\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://e55c1dfcda94dcc64b8577949b2e92a9d3fc44f5fba1ae77ceacccfdc8e22e35\",\"dweb:/ipfs/QmS7uRJbEQYkPuZ5Dz5aSNjaaxj9PA8RtxUeUGN2W3jZx6\"]},\"node_modules/@latticexyz/store/src/EncodedLengths.sol\":{\"keccak256\":\"0xebc0a6efd611e02b15c05a382382b597fe059eba7f2a9e90da81eeb2f7666774\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://00b2cac12599935e25ea0697e99fc9e6d5af6c1c982761996c16707d9cd6ca09\",\"dweb:/ipfs/QmXccFminkrFtDpNfx6X1pHvW7Tn1nA5XcGu9T17pJyZyK\"]},\"node_modules/@latticexyz/store/src/FieldLayout.sol\":{\"keccak256\":\"0x15f698b7eabc062a00ff7a2e02db0ace2dd51f8bd2bc51a45dc0afa88f2ee658\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://f774202c98ad394b3b62be93292512c633dec63bc931c190ed984656c2d54ec7\",\"dweb:/ipfs/Qmd2D9mvP8S88ad2Q8WU54saNVr3Pwc5stPqEKHwcpo8AT\"]},\"node_modules/@latticexyz/store/src/Hook.sol\":{\"keccak256\":\"0xd016a2e1260f5a81ff9a8dfac58d7947e114414df8cce7302a2629908ea5f18e\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://0c558a6f3a5f540c0190fa6d642a094a185c5db1acfc2437c7dbde0340f00ac3\",\"dweb:/ipfs/QmViAHvR7U7HNfBiBZEMFiy1TTSHDFNiDzBfQSeLBShCky\"]},\"node_modules/@latticexyz/store/src/IERC165.sol\":{\"keccak256\":\"0x0efbf9afc716c585621482221f75e5bd60bcf0e813c9f7800d7c0309dcc3c927\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://31b6aeb5446a0a0d5bd71be15a68c5bde94b08c961369203b83c8abe36f401d2\",\"dweb:/ipfs/QmXhComne4es9ZMKaGNqHCdJZrFoFssxMYgLaqvCXPL1Mg\"]},\"node_modules/@latticexyz/store/src/IEncodedLengthsErrors.sol\":{\"keccak256\":\"0x06bb49164f44acc8d51df7b75ecf2f7aeb9281f7a3b357cae7d8d58bd1700dfa\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://719027f4cc60fea30ce01cd4f672462f41fac750ae802e91a1a6d37c929e11ba\",\"dweb:/ipfs/QmWi5DM2jT5V5SGP1afRmFyRgFvuZiGDX2PWHwP19HssF1\"]},\"node_modules/@latticexyz/store/src/IFieldLayoutErrors.sol\":{\"keccak256\":\"0xaef70c46e412bded1024ac82c957cea81c1d1ab11878a95635531e2ac9673a53\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://cda2c7dc02ee8f0163b1c8d0f3e1e05d48b2a009e5c7365d2418f17bc3455817\",\"dweb:/ipfs/QmXHDZuCPTxjHaeiEaJhA81koX2NJ3Gj1zt5WVWaz77FL8\"]},\"node_modules/@latticexyz/store/src/ISchemaErrors.sol\":{\"keccak256\":\"0x0ac3de36c9d0058a17fcd7f1a905132215fd16ea3ed3b5109de1de04ddd7c441\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://f83fa2546009cfd16b3b3969dcec1d67c9d818d910177b885ba263b6a948c65d\",\"dweb:/ipfs/QmehywHdvFYBL9BTtoPsVVwJXsEA4Xjk8aPWoHw1R45KeY\"]},\"node_modules/@latticexyz/store/src/ISliceErrors.sol\":{\"keccak256\":\"0x72684b7dfc1b44537401ccf10d6120186d02323266fcc762bc81859985eded4c\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://e8d037b6937969ae54018ddf647eeaf5eb69a2b0bf9edf9456d3d270316b2883\",\"dweb:/ipfs/QmfYJeyAmzRqpn68FteiM97p5t17iBw62FCET4bK5g4w37\"]},\"node_modules/@latticexyz/store/src/IStore.sol\":{\"keccak256\":\"0x42515d1410333a3573f78a460576271ef62c16edad5cf771ef6287b83ca1c706\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://6a58d03c4cf420df57d2b2e2e7932daad877e46e89561b46e1fa9f593a701bdc\",\"dweb:/ipfs/QmeFmKS7J1WqqBAgXkyxxx2fGA8JzuGszUmVsV2T6DYtsL\"]},\"node_modules/@latticexyz/store/src/IStoreErrors.sol\":{\"keccak256\":\"0x37e4d2f015dd4005ff9b3f711257c891027804bc268db1791984af4989951912\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://a4a566ea96b69211f503707f69a9f9012d5873a3fd57b3f221549f46a7518df6\",\"dweb:/ipfs/QmVgcE3JufJr3iyeV6xqkvS4YtDcy6Eqyram2yzWUhwoB4\"]},\"node_modules/@latticexyz/store/src/IStoreEvents.sol\":{\"keccak256\":\"0x8606e9de37943c74beabb9ac9acd2132f951bed1ef79f2f4f3de83ed1f271f6a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://d13adeee7ae9e687bf1cd12a8c36223179685fc828a7c468ee9311c879401b08\",\"dweb:/ipfs/QmQeb2ArSoQpE6ujBbDj9LY3xqpVCPiz3bh9SLT6siE8RY\"]},\"node_modules/@latticexyz/store/src/IStoreHook.sol\":{\"keccak256\":\"0x6574a30a2bbd8a0de21b2504c55effb8802fdeff62296af82a9380bd753adcc4\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://85a859c533f51b584a9a2e8a64d61b6cf6f69bfcff1b926ad787518b1cae9562\",\"dweb:/ipfs/QmVyjmyJ69ZeqaXHg91JtGLVahRfZ7KtWaessLWZ6rYk9p\"]},\"node_modules/@latticexyz/store/src/IStoreKernel.sol\":{\"keccak256\":\"0x37a23dcbabc5937a717f2fda636b6a97963ed4b5a96870a62dfb199a8b692f89\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://ac9741ea6daf21f39699be11afd919ae3ec07df24d948aaaa6549456fefd7fc0\",\"dweb:/ipfs/QmeiPQkZitM4Pc3i6L87thU71Fs1JVWAgMqXnSK8VrCq75\"]},\"node_modules/@latticexyz/store/src/IStoreRead.sol\":{\"keccak256\":\"0xdcf28b3293d4d6c1fe2808a8918c1b2122e4e0e49f2793c79ebd2b9ae210ff7b\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://bb3d9cc80f549ed0c5b768aea69fb1b3c364bd4f85d193a3040c411b594d94db\",\"dweb:/ipfs/QmYYdY5CjPHiW5ucXihTva1eHsCPNqBsvL6zYYafH3ap4p\"]},\"node_modules/@latticexyz/store/src/IStoreRegistration.sol\":{\"keccak256\":\"0x9e91a73f93cc9ebc00c265c83177f6a3f8a156749a9261202e2845e12aeaa96b\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://a39280d87d22dd0a959d8f55925cb092dba1fee2f11d3dd8e3ffabed45a9ab6a\",\"dweb:/ipfs/QmRMBFLJtT2KN43Xz9P3vUNWxXrP8rLTNBFw2P6Z7EGeaS\"]},\"node_modules/@latticexyz/store/src/IStoreWrite.sol\":{\"keccak256\":\"0x120fd448da5806e09ecb5327ad4dba64df01d2ee7232de0979133627e87e24ba\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://7a3cb151b2ddee217f330d61813b2dcd997de94940c903719f6d066a21467890\",\"dweb:/ipfs/Qmbes1RRY6KdtsMohp8834xXyipeQK9GJ41NfgXK1d1QAZ\"]},\"node_modules/@latticexyz/store/src/Memory.sol\":{\"keccak256\":\"0xef6e7000b181c2991aeacbf99a9d886f8c4df88878b857713f851185b63a7811\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://b079b4773d140ab2c01bdb04facfa56a78f753aea7122fa445b2bfa133411392\",\"dweb:/ipfs/QmWYWKFpwtsPeGdCSxcANgxXUbwAuMMgR7iMVPDSCZxz2A\"]},\"node_modules/@latticexyz/store/src/ResourceId.sol\":{\"keccak256\":\"0x889423054511cf8a83f5dfd65a0f984dc514aba798ef3db139b59d395b2327e2\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://40b9495d455c87db8b063e291ca3973dc3ba1163f09c5d7446241a9e1cb69ed0\",\"dweb:/ipfs/Qmek1JKVjPUpoXnKwu66HfPS9rHstKtWTuBmG8YFxbPEWQ\"]},\"node_modules/@latticexyz/store/src/Schema.sol\":{\"keccak256\":\"0x0d2a08030d21292ecbcc850d9111f3817d03f17cd5e02186894848a9152d79d7\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://3f30024c1613fb587aaba4c1dcb8e4e46ed765a2cebd5b63fbebd327d1bf13d3\",\"dweb:/ipfs/QmZzqSnPMYKDYwbFNvUFrvuazMUyQHzQ59w3A9x6juHAm7\"]},\"node_modules/@latticexyz/store/src/Slice.sol\":{\"keccak256\":\"0xae6c03881fdfa56cba1879d9c9c6b52c2829e6a278a200176678d8da05a89345\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://3cad7dc4944c0518de2e7f99697485d365ae37aa6cad6967996377c2dd951fe4\",\"dweb:/ipfs/QmW3grFwr8BcgJmLfjLbj3FthnD7NRUBFMFiahbXztHPr7\"]},\"node_modules/@latticexyz/store/src/Storage.sol\":{\"keccak256\":\"0x7e735a4c7fa8b8a5fe2371d90801e3287ddb78efed69b31e1a76f0b7b153c4c3\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://9e6db36bd52144b6feeecd91a58fc311127a3892fc96c4171db5b570fe9876ee\",\"dweb:/ipfs/QmS6LqnTZvpMc4eiz5JowBoNnh3RYemG6JHjqtYucT1rQi\"]},\"node_modules/@latticexyz/store/src/StoreCore.sol\":{\"keccak256\":\"0x9513dc38e5baadde0ba9b08320a324043b0e88a10702be5c3507da8c3d45e861\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://99c80c65a394763668e4aed69220fec6bb3ed847fb277ddd1ff1d4bfdf452da2\",\"dweb:/ipfs/QmRT2BATKtrYmixWMuWo9Cz8g8oscfLNSmvjxTyiTNA1pc\"]},\"node_modules/@latticexyz/store/src/StoreSwitch.sol\":{\"keccak256\":\"0x7edf7c1641408f3a580eb28bda58054583cb846f875608612671c6d40712ba40\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://4146adef610d1daab085a81aa9f2d4fd8c4e5f459b9ef184f3ef23465573cf91\",\"dweb:/ipfs/QmQqZMsbkzSNG6VfYzQLdRCBCsNohBSVQmWoTP6QvKmKUP\"]},\"node_modules/@latticexyz/store/src/codegen/index.sol\":{\"keccak256\":\"0x094a6f1e2910b345b6b254e0fc2c8882b3190c673f7ee19742e857057a4d3f85\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://18908e2e7e878635abea72ef99851fddd204371e6b641f010e831ebfa0b1bfd4\",\"dweb:/ipfs/QmSNAxXqxTrzPkZ4rSAQgBnuer1yLPq74hoqnzrZV3WGsb\"]},\"node_modules/@latticexyz/store/src/codegen/tables/Hooks.sol\":{\"keccak256\":\"0xfdea5b4cf666720c1c0d81a8acdede68e6220aee45d8a9f3c9834b4edc5da394\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://b3a394dfe123cfb7200f65d379fb0cb3d2c84475b382faf6ee11bf9c45a63b53\",\"dweb:/ipfs/QmRMPHFBbCKtqKBVV9gvd2jhnfsyUKmCBEQkgviMoxi1UG\"]},\"node_modules/@latticexyz/store/src/codegen/tables/ResourceIds.sol\":{\"keccak256\":\"0xf192bceab34508cee21dd7c33e4d776f79c4a7ca55ee8905c6c694850ebfdf64\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://c95113f76f6de671cb44710754e0942934182b544660a4330fc90a505e198905\",\"dweb:/ipfs/QmXma5ZxfK8Y9TbvB7QM9hdhfc1ixiMcLpo9BQxnVthHB5\"]},\"node_modules/@latticexyz/store/src/codegen/tables/StoreHooks.sol\":{\"keccak256\":\"0xa825218614acc19a4100357dd7ee410b67b994fe7aaa68650d5d0d4202d4ca8c\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://09b0cbb598fe2b75bbcd269b47d686a66fcc89c0c40d9a09807eba7688b81fc6\",\"dweb:/ipfs/QmYk6XQwSLhRumujTCsqxdvugKuP8oLjjB926pMHR445ra\"]},\"node_modules/@latticexyz/store/src/codegen/tables/Tables.sol\":{\"keccak256\":\"0x918b977e7f7f3e947d6d5aa189c54c9c7e7c106d0a0d53734ee959ad454abe09\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://3a3de63c04c838bf80c1903cf7464d201d0ece0f86a7aaca35462b730e9338fc\",\"dweb:/ipfs/QmSUkLZ88J7tSwdmR3viBJHU8QVgN2Gji6W8wYLJEDNkc2\"]},\"node_modules/@latticexyz/store/src/constants.sol\":{\"keccak256\":\"0x67e0d59237bd37424827ecde1ecdbe71f65376af517b0623cd8f8d5451bca7a6\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://09c5ec7fe73e06140957d44a3d9938587711c783ccbf08ff017638c9279a3168\",\"dweb:/ipfs/QmfS9ZRqHXmBJ1h5B4x4gbU6d18DtMgKZSkxhQgNVRxueu\"]},\"node_modules/@latticexyz/store/src/rightMask.sol\":{\"keccak256\":\"0x28887aab8ad5ca598927e59d702999ca6e3b3128f1cddd2b995a381c8d04b275\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://7710847f4689b7f5b81436c7d52ae4395f244a2eebf8d398b2edd43accb06754\",\"dweb:/ipfs/QmTD2wYqryXTynHAn5Vf9wtjUUSGeCJWENZTnWtBAK38pa\"]},\"node_modules/@latticexyz/store/src/storeHookTypes.sol\":{\"keccak256\":\"0x4f29001e53690ce74fe405a6d0376a564c9c743d1631d36fab04331865e4d572\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://138c80abd63225a3eeb01ebfa1f9288e188a7ee5b2266b275fb4ed31b5aa30e3\",\"dweb:/ipfs/QmdEx9uHgCCbTcetGwFH5a66Ft7ajmrMDXvP1fW7WjnnE2\"]},\"node_modules/@latticexyz/store/src/storeResourceTypes.sol\":{\"keccak256\":\"0x1c4cb6b3ecf76f614479ab304d7de3ade0e99c7ccfd07717b57c92f699a27261\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://2c9b0e0c9b3b5610d6fd65a8ffd7c54df390a34ccc70d58f4a055c49ad1ea586\",\"dweb:/ipfs/QmP6ffpnR7aRyvq9AiUkVNH6LbGfFP3NDq7E2n2PVcHhp2\"]},\"node_modules/@latticexyz/store/src/tightcoder/DecodeSlice.sol\":{\"keccak256\":\"0x310523f7f3acca841e62fe50be8d8b042cad5b3c239cb1105d6623cf83e63152\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://1cc40ca233acf6502bc65677b381c05331dd7323953e54b5df969051e47f851e\",\"dweb:/ipfs/QmTxy9mhodT8drezB5K1kPR78AMaARomoJqDyaWpLuCKui\"]},\"node_modules/@latticexyz/store/src/tightcoder/EncodeArray.sol\":{\"keccak256\":\"0x259ee545fd9dfd4767f0b7fef31f52fd3c54c4a1c6657d6fbda4927800c937b3\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://0a4e31efa9f476cd267af7c3e11fe0151252206a1f6407a80a4092444c2de8ea\",\"dweb:/ipfs/QmRF4gWYw33mFTMh7nX8DJ1qzx3Ko6yMsnxubzYTRppdyo\"]},\"node_modules/@latticexyz/store/src/tightcoder/TightCoder.sol\":{\"keccak256\":\"0x0e74ff88ec94cb33f79d8afc1497c4fdccf02db40ab47f3701c7d02fc305d4d8\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://36b7cd0c2a3f2dcdc83ab7ac5a93f123746ce29c0f1000f2b275ad2c647ff0f3\",\"dweb:/ipfs/QmYdipHYUhHhS78wLdtmKZUK14FEwpto5mFy3rNeZssMLz\"]},\"node_modules/@latticexyz/store/src/version.sol\":{\"keccak256\":\"0x78c571906ee999ee7e56d4f7702b8a93c3a9e55e6b552aca115b5f6ac7f1c80a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://a9f141b2d556b2a2545e7db5606e8a038679a995a22aeaf1702cb3a60320b60a\",\"dweb:/ipfs/QmY7x258Fhj3TT3RT4sNyyfiRphVYdZXhtAnSYpasJ4xVQ\"]},\"node_modules/@latticexyz/world/src/IERC165.sol\":{\"keccak256\":\"0xe3d9074a1be3247be67ff4dd2c9e41481650ddaa799285a249736bb85673e33d\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://0b6743ee1e6d0c74927bf17fc1da0cad7575aa7634871b94190ffbdb4c28c2a7\",\"dweb:/ipfs/Qma5bNsPJSBTesWxg3eAAMUBTDE7UjqWaHF7eMiGwP87jr\"]},\"node_modules/@latticexyz/world/src/IModule.sol\":{\"keccak256\":\"0xbb926cf64e685bbf2770d60124664cc84ab70bd3038e17a074f2d472c3fc2c57\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://143c3dcbdf1702dd4f9c869629609386c12f7c0247e88a6d062dc4d519ebe0d2\",\"dweb:/ipfs/QmQJSDd8uFL4sssw9fb9NHo4s6zjuDUgmrLHj3zsJuhMo1\"]},\"node_modules/@latticexyz/world/src/IModuleErrors.sol\":{\"keccak256\":\"0x60917e029779c81cfea1f5140c389269e51d7adb78987f39101b9e0d7bdad12d\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://513f41920d67ca28c3e0fe247403c28a4d342785192df449c99d5f92db04fcea\",\"dweb:/ipfs/QmeAG2TtxAgcJQR4QxftuSvQrxisYQ1i1GZoyd7oeFQBDJ\"]},\"node_modules/@latticexyz/world/src/ISystemHook.sol\":{\"keccak256\":\"0x81f1743d7ca6a9c7efc4997cf95e603ccb2070885265ca0e540f461aa7430721\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://93d99e78b541b33ecd501bf0cd407a78cef490fec8eaef2f188bddb9e293a99f\",\"dweb:/ipfs/QmPrcMDxwhvBZTr2AxoGqJA9L3Mjx27KBc98h3gXSsa3PM\"]},\"node_modules/@latticexyz/world/src/IWorldContextConsumer.sol\":{\"keccak256\":\"0xb39e9d8cff4162e255f6c460ef9f9f0ad5b804627f745d967b2f10d0dd509299\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://18d957cd87febccc00d82b9454047f0f5236250c9245befc0f57978671675255\",\"dweb:/ipfs/QmdZ1eXBd15vLpLVqTNJDAAaTzzucpRLD8GPJahLKT4J7x\"]},\"node_modules/@latticexyz/world/src/IWorldErrors.sol\":{\"keccak256\":\"0x0abae6f4ed1b3070bddd0ed194c08b83a948b61ae959396202cf627bf1056a2b\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://a7037954f281cc0188a5aafc1d0cca0aabc110fd0234e6c43dca35ad69ed3baf\",\"dweb:/ipfs/Qmbv2nfK1qPpnoAbqNJFqWwo7AuyaX2ZEgZMFspMv7DR5B\"]},\"node_modules/@latticexyz/world/src/IWorldEvents.sol\":{\"keccak256\":\"0x39f6d8930db431c04158b85cc2a612c48d43dc81ec998f267076b12293c5d243\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://d68f1543e5e166d639372d1aec57e3e193b5bb3b37270b6cb0488fab2c0ebe57\",\"dweb:/ipfs/QmdJUFDx87AHWFKP3jVrYg8xqAkiPfuT1M3tEotNt7KUoy\"]},\"node_modules/@latticexyz/world/src/IWorldKernel.sol\":{\"keccak256\":\"0xdaa1e92439036e392fe79892819ae165732f416b831f84d38050ca3d958e549b\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://ea8dc52e31a62e8971322ea9ed8f2e83d562ec199d7f93a392c293e96ff7f092\",\"dweb:/ipfs/QmSbM8MgHbrJLYP7uzemfZeC4xctqdyKDbspwHUsgeeVJC\"]},\"node_modules/@latticexyz/world/src/System.sol\":{\"keccak256\":\"0xadcb32bdc444a4420909b738d81fa662dc63739455fe93d5aa89c93a3ccfd2dd\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://d303094c84ebfb0f9f114c54ff4dfc68bfa1e526d0ebe304be6fbeb7cb2f0d3f\",\"dweb:/ipfs/QmYvUx1mNDhkxZFqxLeswW3w9HkvVqeoJiJKj1HN1SB7Gi\"]},\"node_modules/@latticexyz/world/src/WorldContext.sol\":{\"keccak256\":\"0x50ca52bdd89a9f27d6b03ad00ef45c8c5a6884ea9d75e18f8fa53524ac2feed9\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://55febdece37b291527094fb654919d4c8fe0b231792996a14c5e5cc76512b19e\",\"dweb:/ipfs/QmZHFbDDNmdFHWc1uTSvDgMUUgb8NgBPb1cDUJYajswbHT\"]},\"node_modules/@latticexyz/world/src/WorldResourceId.sol\":{\"keccak256\":\"0xaff9a22fac8a0f6eee5763b07a7ccb623c829d37922b85e42e914aad2ad417ee\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://e598f0274d6d97c0a09806bf4fd1f0d054c310cf51b2123f5ce6380d6f3186ea\",\"dweb:/ipfs/QmaaVvqm21YsCgxozDyShcM17jKUXJhf2y26bk2YzPYZoM\"]},\"node_modules/@latticexyz/world/src/codegen/interfaces/IAccessManagementSystem.sol\":{\"keccak256\":\"0x7e7321b86836bfbf4b96d0fb2a424ed678efcf01b15fa3d0b4ae4f0b975ad5dc\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://ead41554796bd0507e390f2997aa4a8df7bff8b51523b86fa3c5bd8acb1fec48\",\"dweb:/ipfs/QmVe1VUhfbRy8tviA7UcCtS8NjXhsF1E6Re9xLqWS5aRTK\"]},\"node_modules/@latticexyz/world/src/codegen/interfaces/IBalanceTransferSystem.sol\":{\"keccak256\":\"0xe57042e82311847c56fa569377ed84459bf55afccdd3123312a5dff90c1d06f4\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://baf3258c9118bf16ba68ebcfecdb5e5ffc85d5c0cdc2815ca298283dfcff2c83\",\"dweb:/ipfs/QmcBVyUBR3PVejz7249VrEBMCMKHi72KoUXQ8DFmMmY48F\"]},\"node_modules/@latticexyz/world/src/codegen/interfaces/IBaseWorld.sol\":{\"keccak256\":\"0xf7acdfa0eb01c710d11fba129d613863fe86f1bed352f0bc5630bea81cceae17\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://3e4107681cd20c018cd8f5dff6da72e8a4b02f631c7c59b618e8743482c7bc81\",\"dweb:/ipfs/QmXS8NLaKVXcf97HrD8U4hGHqb9ytYGwdZrTVHHb5EwrRj\"]},\"node_modules/@latticexyz/world/src/codegen/interfaces/IBatchCallSystem.sol\":{\"keccak256\":\"0x600cc362780c319e640950ad3520af7fa558171268baab252ff4da4414aa0f1c\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://6d113a833b64bccbbe852f3d0261efd80ad4a0f6771802dc91af79c762a33ff2\",\"dweb:/ipfs/QmaXEdJJaMMQF8nZieWyXdVD15yuXnH89QLZHwD18LAndz\"]},\"node_modules/@latticexyz/world/src/codegen/interfaces/IModuleInstallationSystem.sol\":{\"keccak256\":\"0x7070453d969eba7defd90047d58ae979e27e5c1fcf05598daa4d17fedbe84c35\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://ee5c196c5e339ac0222cd1d14fd9d09451d255605f73732abc33397a9512503b\",\"dweb:/ipfs/QmYwNsWnxP24RzDqFYLnBYswZY97YE3nwG6Xf55f5FqNXa\"]},\"node_modules/@latticexyz/world/src/codegen/interfaces/IRegistrationSystem.sol\":{\"keccak256\":\"0xe08d3af994098120b5507c71a1c3558763b8c1a88c6eae506aa438c2af78f800\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://bb0c47b16ff524140388765fe9ef99211dd7d9b9374dae09144a9956138de00c\",\"dweb:/ipfs/Qma8ibVu6WZs1hFW3hMnUykV3pPXGZhZ3xJwJXNj6Xu7aL\"]},\"node_modules/@latticexyz/world/src/codegen/interfaces/IWorldRegistrationSystem.sol\":{\"keccak256\":\"0x70bed82da026058ddccf52766823c7d55c7d29faad0ab1d76d763786d5277f7c\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://1da6476d62e450d3d935ea8292723612a84fa1d07342fbc052ee851181701a27\",\"dweb:/ipfs/Qmd1FQpmEVbQciLDPkHPXSKB7aYW1YB74BN5JXqn74erhR\"]},\"node_modules/@latticexyz/world/src/constants.sol\":{\"keccak256\":\"0xb8320f88ed5519a4fe2554ad94815ce328a50fef7719932375d6ce695265c2f5\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://a8f5de30fbcc63e469e46ad4a4d4bcd7d8e4b4f2d31fcf62a04aca48d999af22\",\"dweb:/ipfs/QmXw1jDQM2szfRY3tAGrRy6fEzte6yVFgebJAqCLMDHndV\"]},\"node_modules/@latticexyz/world/src/modules/init/types.sol\":{\"keccak256\":\"0x81b75eb286ec515bde6cbb16c3d089054abb530b744865bbace68343d23177bc\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://afc77bd51e24da666260bb48c44ff611869fb2e550921d732e5aac84a1f09525\",\"dweb:/ipfs/QmeU5N4yeRh5nEA65pvGtQQJNv1GvEPy4PkhMVRYRMoMvh\"]},\"node_modules/@latticexyz/world/src/revertWithBytes.sol\":{\"keccak256\":\"0xa1147f218a0152b153d4e8bada0f606bfed40ac1f184fd16a941c2d0033c53f5\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://3f5e0f6d1b51a3a04d4bd84537b2ced373b32824898cf6fbfd13ae1cbdf06359\",\"dweb:/ipfs/QmayYRmBZRUV9m4UnFxuC62VvHriXhkYXeH3HibZ3Gmxxf\"]},\"node_modules/@latticexyz/world/src/worldResourceTypes.sol\":{\"keccak256\":\"0xeb042e7d3638430f6fd394107f3237cf14e4325154f0098624e8a7826584d465\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://39e0b8eb87616b661f5a4f2fd7e1a727bd19b7fd8d40ad3d93fda26822f433ea\",\"dweb:/ipfs/QmacYMatKV9pwEwirVRY9a6r89RoNs5yk99ic37ieWA8Dk\"]},\"src/codegen/common.sol\":{\"keccak256\":\"0x707897e27fa433c6a12bc59c1d7f531b74503089bcb54f24ac725176cb7f8991\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://b463a6c273e400177cd4ee26186f2ebf7fd65c8d4339e3fec1b9d75f102dfc30\",\"dweb:/ipfs/QmRaHH5dW6PKHST4tr1snoGk7P2NERPT8P9eGygu51mobS\"]},\"src/codegen/tables/CharacterStats.sol\":{\"keccak256\":\"0x8609e049f9c40a2990a4d769be61d195385c4e22e403f133be102b4e9662e7ca\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://35be01edf9b7e148303a62ffafba00df314c47f8d57f159f5a56d75b56ccf7fc\",\"dweb:/ipfs/QmQdFFa7U6AHadojoJZSCLMQRmHnzcEPsmJ6j382DF2nvg\"]},\"src/codegen/world/ICharacterSystem.sol\":{\"keccak256\":\"0x8bdbad1e2f920aec7ee05447880b01486094eb92869546e5b8bc34ca67fc879d\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://0c492dfa099175c6bb8e6c244a3a06d0acfed5eee99f5a6e2f934434d4344bdc\",\"dweb:/ipfs/QmfXCkjsgMaPGFarjdKiEY4dZmw9MigHfjRxTkZZuW9yPC\"]},\"src/codegen/world/IUltimateDominionConfigSystem.sol\":{\"keccak256\":\"0xa0f3ca216ac607c821d482c88f873fd608092c3d967dd38b0f890ab2328c5b93\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://8365b31f2a69315af9bd7a9b756186055a0bf5839c875ce0716033569a8bebdd\",\"dweb:/ipfs/Qme834tRDauXXVne3LTkNBKsGvqW68tsw6jjqGPssLeJ4m\"]},\"src/codegen/world/IWorld.sol\":{\"keccak256\":\"0xe1269365767ab0891c6f3a21d432fd872301e04e551ea3b813c87552a76fbc67\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://decd88538987a0e790845443f81eb7bad639c62849cbc0f69042d893c93c9fba\",\"dweb:/ipfs/Qmbug7m6PM9iMftpbUfJwKNp2FyZRritchkQA5vVxcN4a2\"]}},\"version\":1}","metadata":{"compiler":{"version":"0.8.24+commit.e11b9ed9"},"language":"Solidity","output":{"abi":[{"inputs":[{"internalType":"uint256","name":"length","type":"uint256"}],"type":"error","name":"EncodedLengths_InvalidLength"},{"inputs":[],"type":"error","name":"FieldLayout_Empty"},{"inputs":[{"internalType":"uint256","name":"staticDataLength","type":"uint256"},{"internalType":"uint256","name":"computedStaticDataLength","type":"uint256"}],"type":"error","name":"FieldLayout_InvalidStaticDataLength"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"type":"error","name":"FieldLayout_StaticLengthDoesNotFitInAWord"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"type":"error","name":"FieldLayout_StaticLengthIsNotZero"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"type":"error","name":"FieldLayout_StaticLengthIsZero"},{"inputs":[{"internalType":"uint256","name":"numFields","type":"uint256"},{"internalType":"uint256","name":"maxFields","type":"uint256"}],"type":"error","name":"FieldLayout_TooManyDynamicFields"},{"inputs":[{"internalType":"uint256","name":"numFields","type":"uint256"},{"internalType":"uint256","name":"maxFields","type":"uint256"}],"type":"error","name":"FieldLayout_TooManyFields"},{"inputs":[],"type":"error","name":"Module_AlreadyInstalled"},{"inputs":[{"internalType":"address","name":"dependency","type":"address"}],"type":"error","name":"Module_MissingDependency"},{"inputs":[],"type":"error","name":"Module_NonRootInstallNotSupported"},{"inputs":[],"type":"error","name":"Module_RootInstallNotSupported"},{"inputs":[{"internalType":"uint256","name":"length","type":"uint256"}],"type":"error","name":"Schema_InvalidLength"},{"inputs":[],"type":"error","name":"Schema_StaticTypeAfterDynamicType"},{"inputs":[{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"uint256","name":"start","type":"uint256"},{"internalType":"uint256","name":"end","type":"uint256"}],"type":"error","name":"Slice_OutOfBounds"},{"inputs":[{"internalType":"uint256","name":"length","type":"uint256"},{"internalType":"uint256","name":"accessedIndex","type":"uint256"}],"type":"error","name":"Store_IndexOutOfBounds"},{"inputs":[{"internalType":"uint256","name":"start","type":"uint256"},{"internalType":"uint256","name":"end","type":"uint256"}],"type":"error","name":"Store_InvalidBounds"},{"inputs":[{"internalType":"uint256","name":"expected","type":"uint256"},{"internalType":"uint256","name":"received","type":"uint256"}],"type":"error","name":"Store_InvalidFieldNamesLength"},{"inputs":[{"internalType":"uint256","name":"expected","type":"uint256"},{"internalType":"uint256","name":"received","type":"uint256"}],"type":"error","name":"Store_InvalidKeyNamesLength"},{"inputs":[{"internalType":"bytes2","name":"expected","type":"bytes2"},{"internalType":"ResourceId","name":"resourceId","type":"bytes32"},{"internalType":"string","name":"resourceIdString","type":"string"}],"type":"error","name":"Store_InvalidResourceType"},{"inputs":[{"internalType":"uint40","name":"startWithinField","type":"uint40"},{"internalType":"uint40","name":"deleteCount","type":"uint40"},{"internalType":"uint40","name":"fieldLength","type":"uint40"}],"type":"error","name":"Store_InvalidSplice"},{"inputs":[{"internalType":"uint256","name":"expected","type":"uint256"},{"internalType":"uint256","name":"received","type":"uint256"}],"type":"error","name":"Store_InvalidStaticDataLength"},{"inputs":[{"internalType":"uint256","name":"expected","type":"uint256"},{"internalType":"uint256","name":"received","type":"uint256"}],"type":"error","name":"Store_InvalidValueSchemaDynamicLength"},{"inputs":[{"internalType":"uint256","name":"expected","type":"uint256"},{"internalType":"uint256","name":"received","type":"uint256"}],"type":"error","name":"Store_InvalidValueSchemaLength"},{"inputs":[{"internalType":"uint256","name":"expected","type":"uint256"},{"internalType":"uint256","name":"received","type":"uint256"}],"type":"error","name":"Store_InvalidValueSchemaStaticLength"},{"inputs":[{"internalType":"ResourceId","name":"tableId","type":"bytes32"},{"internalType":"string","name":"tableIdString","type":"string"}],"type":"error","name":"Store_TableAlreadyExists"},{"inputs":[{"internalType":"ResourceId","name":"tableId","type":"bytes32"},{"internalType":"string","name":"tableIdString","type":"string"}],"type":"error","name":"Store_TableNotFound"},{"inputs":[{"internalType":"string","name":"resource","type":"string"},{"internalType":"address","name":"caller","type":"address"}],"type":"error","name":"World_AccessDenied"},{"inputs":[],"type":"error","name":"World_AlreadyInitialized"},{"inputs":[{"internalType":"bytes4","name":"functionSelector","type":"bytes4"}],"type":"error","name":"World_CallbackNotAllowed"},{"inputs":[{"internalType":"address","name":"delegator","type":"address"},{"internalType":"address","name":"delegatee","type":"address"}],"type":"error","name":"World_DelegationNotFound"},{"inputs":[{"internalType":"bytes4","name":"functionSelector","type":"bytes4"}],"type":"error","name":"World_FunctionSelectorAlreadyExists"},{"inputs":[{"internalType":"bytes4","name":"functionSelector","type":"bytes4"}],"type":"error","name":"World_FunctionSelectorNotFound"},{"inputs":[{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"type":"error","name":"World_InsufficientBalance"},{"inputs":[{"internalType":"address","name":"contractAddress","type":"address"},{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"type":"error","name":"World_InterfaceNotSupported"},{"inputs":[{"internalType":"bytes14","name":"namespace","type":"bytes14"}],"type":"error","name":"World_InvalidNamespace"},{"inputs":[{"internalType":"ResourceId","name":"resourceId","type":"bytes32"},{"internalType":"string","name":"resourceIdString","type":"string"}],"type":"error","name":"World_InvalidResourceId"},{"inputs":[{"internalType":"bytes2","name":"expected","type":"bytes2"},{"internalType":"ResourceId","name":"resourceId","type":"bytes32"},{"internalType":"string","name":"resourceIdString","type":"string"}],"type":"error","name":"World_InvalidResourceType"},{"inputs":[{"internalType":"ResourceId","name":"resourceId","type":"bytes32"},{"internalType":"string","name":"resourceIdString","type":"string"}],"type":"error","name":"World_ResourceAlreadyExists"},{"inputs":[{"internalType":"ResourceId","name":"resourceId","type":"bytes32"},{"internalType":"string","name":"resourceIdString","type":"string"}],"type":"error","name":"World_ResourceNotFound"},{"inputs":[{"internalType":"address","name":"system","type":"address"}],"type":"error","name":"World_SystemAlreadyExists"},{"inputs":[],"type":"error","name":"World_UnlimitedDelegationNotAllowed"},{"inputs":[{"internalType":"bytes32","name":"storeVersion","type":"bytes32","indexed":true}],"type":"event","name":"HelloStore","anonymous":false},{"inputs":[{"internalType":"bytes32","name":"worldVersion","type":"bytes32","indexed":true}],"type":"event","name":"HelloWorld","anonymous":false},{"inputs":[{"internalType":"ResourceId","name":"tableId","type":"bytes32","indexed":true},{"internalType":"bytes32[]","name":"keyTuple","type":"bytes32[]","indexed":false}],"type":"event","name":"Store_DeleteRecord","anonymous":false},{"inputs":[{"internalType":"ResourceId","name":"tableId","type":"bytes32","indexed":true},{"internalType":"bytes32[]","name":"keyTuple","type":"bytes32[]","indexed":false},{"internalType":"bytes","name":"staticData","type":"bytes","indexed":false},{"internalType":"EncodedLengths","name":"encodedLengths","type":"bytes32","indexed":false},{"internalType":"bytes","name":"dynamicData","type":"bytes","indexed":false}],"type":"event","name":"Store_SetRecord","anonymous":false},{"inputs":[{"internalType":"ResourceId","name":"tableId","type":"bytes32","indexed":true},{"internalType":"bytes32[]","name":"keyTuple","type":"bytes32[]","indexed":false},{"internalType":"uint8","name":"dynamicFieldIndex","type":"uint8","indexed":false},{"internalType":"uint48","name":"start","type":"uint48","indexed":false},{"internalType":"uint40","name":"deleteCount","type":"uint40","indexed":false},{"internalType":"EncodedLengths","name":"encodedLengths","type":"bytes32","indexed":false},{"internalType":"bytes","name":"data","type":"bytes","indexed":false}],"type":"event","name":"Store_SpliceDynamicData","anonymous":false},{"inputs":[{"internalType":"ResourceId","name":"tableId","type":"bytes32","indexed":true},{"internalType":"bytes32[]","name":"keyTuple","type":"bytes32[]","indexed":false},{"internalType":"uint48","name":"start","type":"uint48","indexed":false},{"internalType":"bytes","name":"data","type":"bytes","indexed":false}],"type":"event","name":"Store_SpliceStaticData","anonymous":false},{"inputs":[{"internalType":"uint256","name":"characterId","type":"uint256"}],"stateMutability":"nonpayable","type":"function","name":"UD__enterGame"},{"inputs":[{"internalType":"uint256","name":"characterId","type":"uint256"}],"stateMutability":"view","type":"function","name":"UD__getCharacterStats","outputs":[{"internalType":"struct CharacterStatsData","name":"","type":"tuple","components":[{"internalType":"uint256","name":"strength","type":"uint256"},{"internalType":"uint256","name":"agility","type":"uint256"},{"internalType":"uint256","name":"intelligence","type":"uint256"},{"internalType":"uint256","name":"hitPoints","type":"uint256"},{"internalType":"uint256","name":"experience","type":"uint256"}]}]},{"inputs":[],"stateMutability":"view","type":"function","name":"UD__getCharacterToken","outputs":[{"internalType":"address","name":"_characterToken","type":"address"}]},{"inputs":[{"internalType":"uint256","name":"characterId","type":"uint256"}],"stateMutability":"view","type":"function","name":"UD__getClass","outputs":[{"internalType":"enum Classes","name":"_class","type":"uint8"}]},{"inputs":[],"stateMutability":"view","type":"function","name":"UD__getEntropy","outputs":[{"internalType":"address","name":"_entropy","type":"address"}]},{"inputs":[{"internalType":"uint256","name":"characterId","type":"uint256"}],"stateMutability":"view","type":"function","name":"UD__getExperience","outputs":[{"internalType":"uint256","name":"","type":"uint256"}]},{"inputs":[],"stateMutability":"view","type":"function","name":"UD__getGoldToken","outputs":[{"internalType":"address","name":"_goldToken","type":"address"}]},{"inputs":[{"internalType":"uint256","name":"characterId","type":"uint256"}],"stateMutability":"view","type":"function","name":"UD__getName","outputs":[{"internalType":"bytes32","name":"_name","type":"bytes32"}]},{"inputs":[{"internalType":"uint256","name":"characterId","type":"uint256"}],"stateMutability":"view","type":"function","name":"UD__getOwner","outputs":[{"internalType":"address","name":"","type":"address"}]},{"inputs":[],"stateMutability":"view","type":"function","name":"UD__getPythProvider","outputs":[{"internalType":"address","name":"_provider","type":"address"}]},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bytes32","name":"name","type":"bytes32"},{"internalType":"string","name":"tokenUri","type":"string"}],"stateMutability":"nonpayable","type":"function","name":"UD__mintCharacter","outputs":[{"internalType":"uint256","name":"characterId","type":"uint256"}]},{"inputs":[{"internalType":"bytes32","name":"userRandomNumber","type":"bytes32"},{"internalType":"uint256","name":"characterId","type":"uint256"},{"internalType":"enum Classes","name":"class","type":"uint8"}],"stateMutability":"payable","type":"function","name":"UD__rollStats"},{"inputs":[{"internalType":"struct SystemCallData[]","name":"systemCalls","type":"tuple[]","components":[{"internalType":"ResourceId","name":"systemId","type":"bytes32"},{"internalType":"bytes","name":"callData","type":"bytes"}]}],"stateMutability":"nonpayable","type":"function","name":"batchCall","outputs":[{"internalType":"bytes[]","name":"returnDatas","type":"bytes[]"}]},{"inputs":[{"internalType":"struct SystemCallFromData[]","name":"systemCalls","type":"tuple[]","components":[{"internalType":"address","name":"from","type":"address"},{"internalType":"ResourceId","name":"systemId","type":"bytes32"},{"internalType":"bytes","name":"callData","type":"bytes"}]}],"stateMutability":"nonpayable","type":"function","name":"batchCallFrom","outputs":[{"internalType":"bytes[]","name":"returnDatas","type":"bytes[]"}]},{"inputs":[{"internalType":"ResourceId","name":"systemId","type":"bytes32"},{"internalType":"bytes","name":"callData","type":"bytes"}],"stateMutability":"payable","type":"function","name":"call","outputs":[{"internalType":"bytes","name":"","type":"bytes"}]},{"inputs":[{"internalType":"address","name":"delegator","type":"address"},{"internalType":"ResourceId","name":"systemId","type":"bytes32"},{"internalType":"bytes","name":"callData","type":"bytes"}],"stateMutability":"payable","type":"function","name":"callFrom","outputs":[{"internalType":"bytes","name":"","type":"bytes"}]},{"inputs":[],"stateMutability":"view","type":"function","name":"creator","outputs":[{"internalType":"address","name":"","type":"address"}]},{"inputs":[{"internalType":"ResourceId","name":"tableId","type":"bytes32"},{"internalType":"bytes32[]","name":"keyTuple","type":"bytes32[]"}],"stateMutability":"nonpayable","type":"function","name":"deleteRecord"},{"inputs":[{"internalType":"ResourceId","name":"tableId","type":"bytes32"},{"internalType":"bytes32[]","name":"keyTuple","type":"bytes32[]"},{"internalType":"uint8","name":"dynamicFieldIndex","type":"uint8"}],"stateMutability":"view","type":"function","name":"getDynamicField","outputs":[{"internalType":"bytes","name":"","type":"bytes"}]},{"inputs":[{"internalType":"ResourceId","name":"tableId","type":"bytes32"},{"internalType":"bytes32[]","name":"keyTuple","type":"bytes32[]"},{"internalType":"uint8","name":"dynamicFieldIndex","type":"uint8"}],"stateMutability":"view","type":"function","name":"getDynamicFieldLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}]},{"inputs":[{"internalType":"ResourceId","name":"tableId","type":"bytes32"},{"internalType":"bytes32[]","name":"keyTuple","type":"bytes32[]"},{"internalType":"uint8","name":"dynamicFieldIndex","type":"uint8"},{"internalType":"uint256","name":"start","type":"uint256"},{"internalType":"uint256","name":"end","type":"uint256"}],"stateMutability":"view","type":"function","name":"getDynamicFieldSlice","outputs":[{"internalType":"bytes","name":"data","type":"bytes"}]},{"inputs":[{"internalType":"ResourceId","name":"tableId","type":"bytes32"},{"internalType":"bytes32[]","name":"keyTuple","type":"bytes32[]"},{"internalType":"uint8","name":"fieldIndex","type":"uint8"},{"internalType":"FieldLayout","name":"fieldLayout","type":"bytes32"}],"stateMutability":"view","type":"function","name":"getField","outputs":[{"internalType":"bytes","name":"data","type":"bytes"}]},{"inputs":[{"internalType":"ResourceId","name":"tableId","type":"bytes32"},{"internalType":"bytes32[]","name":"keyTuple","type":"bytes32[]"},{"internalType":"uint8","name":"fieldIndex","type":"uint8"}],"stateMutability":"view","type":"function","name":"getField","outputs":[{"internalType":"bytes","name":"data","type":"bytes"}]},{"inputs":[{"internalType":"ResourceId","name":"tableId","type":"bytes32"}],"stateMutability":"view","type":"function","name":"getFieldLayout","outputs":[{"internalType":"FieldLayout","name":"fieldLayout","type":"bytes32"}]},{"inputs":[{"internalType":"ResourceId","name":"tableId","type":"bytes32"},{"internalType":"bytes32[]","name":"keyTuple","type":"bytes32[]"},{"internalType":"uint8","name":"fieldIndex","type":"uint8"},{"internalType":"FieldLayout","name":"fieldLayout","type":"bytes32"}],"stateMutability":"view","type":"function","name":"getFieldLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}]},{"inputs":[{"internalType":"ResourceId","name":"tableId","type":"bytes32"},{"internalType":"bytes32[]","name":"keyTuple","type":"bytes32[]"},{"internalType":"uint8","name":"fieldIndex","type":"uint8"}],"stateMutability":"view","type":"function","name":"getFieldLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}]},{"inputs":[{"internalType":"ResourceId","name":"tableId","type":"bytes32"}],"stateMutability":"view","type":"function","name":"getKeySchema","outputs":[{"internalType":"Schema","name":"keySchema","type":"bytes32"}]},{"inputs":[{"internalType":"ResourceId","name":"tableId","type":"bytes32"},{"internalType":"bytes32[]","name":"keyTuple","type":"bytes32[]"},{"internalType":"FieldLayout","name":"fieldLayout","type":"bytes32"}],"stateMutability":"view","type":"function","name":"getRecord","outputs":[{"internalType":"bytes","name":"staticData","type":"bytes"},{"internalType":"EncodedLengths","name":"encodedLengths","type":"bytes32"},{"internalType":"bytes","name":"dynamicData","type":"bytes"}]},{"inputs":[{"internalType":"ResourceId","name":"tableId","type":"bytes32"},{"internalType":"bytes32[]","name":"keyTuple","type":"bytes32[]"}],"stateMutability":"view","type":"function","name":"getRecord","outputs":[{"internalType":"bytes","name":"staticData","type":"bytes"},{"internalType":"EncodedLengths","name":"encodedLengths","type":"bytes32"},{"internalType":"bytes","name":"dynamicData","type":"bytes"}]},{"inputs":[{"internalType":"ResourceId","name":"tableId","type":"bytes32"},{"internalType":"bytes32[]","name":"keyTuple","type":"bytes32[]"},{"internalType":"uint8","name":"fieldIndex","type":"uint8"},{"internalType":"FieldLayout","name":"fieldLayout","type":"bytes32"}],"stateMutability":"view","type":"function","name":"getStaticField","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}]},{"inputs":[{"internalType":"ResourceId","name":"tableId","type":"bytes32"}],"stateMutability":"view","type":"function","name":"getValueSchema","outputs":[{"internalType":"Schema","name":"valueSchema","type":"bytes32"}]},{"inputs":[{"internalType":"ResourceId","name":"resourceId","type":"bytes32"},{"internalType":"address","name":"grantee","type":"address"}],"stateMutability":"nonpayable","type":"function","name":"grantAccess"},{"inputs":[{"internalType":"contract IModule","name":"initModule","type":"address"}],"stateMutability":"nonpayable","type":"function","name":"initialize"},{"inputs":[{"internalType":"contract IModule","name":"module","type":"address"},{"internalType":"bytes","name":"encodedArgs","type":"bytes"}],"stateMutability":"nonpayable","type":"function","name":"installModule"},{"inputs":[{"internalType":"contract IModule","name":"module","type":"address"},{"internalType":"bytes","name":"encodedArgs","type":"bytes"}],"stateMutability":"nonpayable","type":"function","name":"installRootModule"},{"inputs":[{"internalType":"ResourceId","name":"tableId","type":"bytes32"},{"internalType":"bytes32[]","name":"keyTuple","type":"bytes32[]"},{"internalType":"uint8","name":"dynamicFieldIndex","type":"uint8"},{"internalType":"uint256","name":"byteLengthToPop","type":"uint256"}],"stateMutability":"nonpayable","type":"function","name":"popFromDynamicField"},{"inputs":[{"internalType":"ResourceId","name":"tableId","type":"bytes32"},{"internalType":"bytes32[]","name":"keyTuple","type":"bytes32[]"},{"internalType":"uint8","name":"dynamicFieldIndex","type":"uint8"},{"internalType":"bytes","name":"dataToPush","type":"bytes"}],"stateMutability":"nonpayable","type":"function","name":"pushToDynamicField"},{"inputs":[{"internalType":"address","name":"delegatee","type":"address"},{"internalType":"ResourceId","name":"delegationControlId","type":"bytes32"},{"internalType":"bytes","name":"initCallData","type":"bytes"}],"stateMutability":"nonpayable","type":"function","name":"registerDelegation"},{"inputs":[{"internalType":"ResourceId","name":"systemId","type":"bytes32"},{"internalType":"string","name":"systemFunctionSignature","type":"string"}],"stateMutability":"nonpayable","type":"function","name":"registerFunctionSelector","outputs":[{"internalType":"bytes4","name":"worldFunctionSelector","type":"bytes4"}]},{"inputs":[{"internalType":"ResourceId","name":"namespaceId","type":"bytes32"}],"stateMutability":"nonpayable","type":"function","name":"registerNamespace"},{"inputs":[{"internalType":"ResourceId","name":"namespaceId","type":"bytes32"},{"internalType":"ResourceId","name":"delegationControlId","type":"bytes32"},{"internalType":"bytes","name":"initCallData","type":"bytes"}],"stateMutability":"nonpayable","type":"function","name":"registerNamespaceDelegation"},{"inputs":[{"internalType":"ResourceId","name":"systemId","type":"bytes32"},{"internalType":"string","name":"worldFunctionSignature","type":"string"},{"internalType":"string","name":"systemFunctionSignature","type":"string"}],"stateMutability":"nonpayable","type":"function","name":"registerRootFunctionSelector","outputs":[{"internalType":"bytes4","name":"worldFunctionSelector","type":"bytes4"}]},{"inputs":[{"internalType":"ResourceId","name":"tableId","type":"bytes32"},{"internalType":"contract IStoreHook","name":"hookAddress","type":"address"},{"internalType":"uint8","name":"enabledHooksBitmap","type":"uint8"}],"stateMutability":"nonpayable","type":"function","name":"registerStoreHook"},{"inputs":[{"internalType":"ResourceId","name":"systemId","type":"bytes32"},{"internalType":"contract System","name":"system","type":"address"},{"internalType":"bool","name":"publicAccess","type":"bool"}],"stateMutability":"nonpayable","type":"function","name":"registerSystem"},{"inputs":[{"internalType":"ResourceId","name":"systemId","type":"bytes32"},{"internalType":"contract ISystemHook","name":"hookAddress","type":"address"},{"internalType":"uint8","name":"enabledHooksBitmap","type":"uint8"}],"stateMutability":"nonpayable","type":"function","name":"registerSystemHook"},{"inputs":[{"internalType":"ResourceId","name":"tableId","type":"bytes32"},{"internalType":"FieldLayout","name":"fieldLayout","type":"bytes32"},{"internalType":"Schema","name":"keySchema","type":"bytes32"},{"internalType":"Schema","name":"valueSchema","type":"bytes32"},{"internalType":"string[]","name":"keyNames","type":"string[]"},{"internalType":"string[]","name":"fieldNames","type":"string[]"}],"stateMutability":"nonpayable","type":"function","name":"registerTable"},{"inputs":[{"internalType":"ResourceId","name":"namespaceId","type":"bytes32"}],"stateMutability":"nonpayable","type":"function","name":"renounceOwnership"},{"inputs":[{"internalType":"ResourceId","name":"resourceId","type":"bytes32"},{"internalType":"address","name":"grantee","type":"address"}],"stateMutability":"nonpayable","type":"function","name":"revokeAccess"},{"inputs":[{"internalType":"ResourceId","name":"tableId","type":"bytes32"},{"internalType":"bytes32[]","name":"keyTuple","type":"bytes32[]"},{"internalType":"uint8","name":"dynamicFieldIndex","type":"uint8"},{"internalType":"bytes","name":"data","type":"bytes"}],"stateMutability":"nonpayable","type":"function","name":"setDynamicField"},{"inputs":[{"internalType":"ResourceId","name":"tableId","type":"bytes32"},{"internalType":"bytes32[]","name":"keyTuple","type":"bytes32[]"},{"internalType":"uint8","name":"fieldIndex","type":"uint8"},{"internalType":"bytes","name":"data","type":"bytes"}],"stateMutability":"nonpayable","type":"function","name":"setField"},{"inputs":[{"internalType":"ResourceId","name":"tableId","type":"bytes32"},{"internalType":"bytes32[]","name":"keyTuple","type":"bytes32[]"},{"internalType":"uint8","name":"fieldIndex","type":"uint8"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"FieldLayout","name":"fieldLayout","type":"bytes32"}],"stateMutability":"nonpayable","type":"function","name":"setField"},{"inputs":[{"internalType":"ResourceId","name":"tableId","type":"bytes32"},{"internalType":"bytes32[]","name":"keyTuple","type":"bytes32[]"},{"internalType":"bytes","name":"staticData","type":"bytes"},{"internalType":"EncodedLengths","name":"encodedLengths","type":"bytes32"},{"internalType":"bytes","name":"dynamicData","type":"bytes"}],"stateMutability":"nonpayable","type":"function","name":"setRecord"},{"inputs":[{"internalType":"ResourceId","name":"tableId","type":"bytes32"},{"internalType":"bytes32[]","name":"keyTuple","type":"bytes32[]"},{"internalType":"uint8","name":"fieldIndex","type":"uint8"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"FieldLayout","name":"fieldLayout","type":"bytes32"}],"stateMutability":"nonpayable","type":"function","name":"setStaticField"},{"inputs":[{"internalType":"ResourceId","name":"tableId","type":"bytes32"},{"internalType":"bytes32[]","name":"keyTuple","type":"bytes32[]"},{"internalType":"uint8","name":"dynamicFieldIndex","type":"uint8"},{"internalType":"uint40","name":"startWithinField","type":"uint40"},{"internalType":"uint40","name":"deleteCount","type":"uint40"},{"internalType":"bytes","name":"data","type":"bytes"}],"stateMutability":"nonpayable","type":"function","name":"spliceDynamicData"},{"inputs":[{"internalType":"ResourceId","name":"tableId","type":"bytes32"},{"internalType":"bytes32[]","name":"keyTuple","type":"bytes32[]"},{"internalType":"uint48","name":"start","type":"uint48"},{"internalType":"bytes","name":"data","type":"bytes"}],"stateMutability":"nonpayable","type":"function","name":"spliceStaticData"},{"inputs":[],"stateMutability":"view","type":"function","name":"storeVersion","outputs":[{"internalType":"bytes32","name":"version","type":"bytes32"}]},{"inputs":[{"internalType":"ResourceId","name":"fromNamespaceId","type":"bytes32"},{"internalType":"address","name":"toAddress","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"nonpayable","type":"function","name":"transferBalanceToAddress"},{"inputs":[{"internalType":"ResourceId","name":"fromNamespaceId","type":"bytes32"},{"internalType":"ResourceId","name":"toNamespaceId","type":"bytes32"},{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"nonpayable","type":"function","name":"transferBalanceToNamespace"},{"inputs":[{"internalType":"ResourceId","name":"namespaceId","type":"bytes32"},{"internalType":"address","name":"newOwner","type":"address"}],"stateMutability":"nonpayable","type":"function","name":"transferOwnership"},{"inputs":[{"internalType":"address","name":"delegatee","type":"address"}],"stateMutability":"nonpayable","type":"function","name":"unregisterDelegation"},{"inputs":[{"internalType":"ResourceId","name":"namespaceId","type":"bytes32"}],"stateMutability":"nonpayable","type":"function","name":"unregisterNamespaceDelegation"},{"inputs":[{"internalType":"ResourceId","name":"tableId","type":"bytes32"},{"internalType":"contract IStoreHook","name":"hookAddress","type":"address"}],"stateMutability":"nonpayable","type":"function","name":"unregisterStoreHook"},{"inputs":[{"internalType":"ResourceId","name":"systemId","type":"bytes32"},{"internalType":"contract ISystemHook","name":"hookAddress","type":"address"}],"stateMutability":"nonpayable","type":"function","name":"unregisterSystemHook"},{"inputs":[],"stateMutability":"view","type":"function","name":"worldVersion","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}]}],"devdoc":{"kind":"dev","methods":{"call(bytes32,bytes)":{"details":"If the system is not public, the caller must have access to the namespace or name (encoded in the system ID).","params":{"callData":"The data to pass with the call, function selector (4 bytes) followed by the ABI encoded parameters.","systemId":"The ID of the system to be called."},"returns":{"_0":"The abi encoded return data from the called system."}},"callFrom(address,bytes32,bytes)":{"details":"If the system is not public, the delegator must have access to the namespace or name (encoded in the system ID).","params":{"callData":"The data to pass with the call, function selector (4 bytes) followed by the ABI encoded parameters.","delegator":"The address on whose behalf the call is made.","systemId":"The ID of the system to be called."},"returns":{"_0":"The abi encoded return data from the called system."}},"creator()":{"returns":{"_0":"The address of the World's creator."}},"initialize(address)":{"details":"Can only be called once by the creator.","params":{"initModule":"The InitModule to be installed during initialization."}},"installRootModule(address,bytes)":{"details":"Requires the caller to own the root namespace. The module is delegatecalled and installed in the root namespace.","params":{"encodedArgs":"The ABI encoded arguments for the module installation.","module":"The module to be installed."}},"storeVersion()":{"returns":{"version":"The protocol version of the Store contract."}},"worldVersion()":{"returns":{"_0":"The protocol version of the World."}}},"version":1},"userdoc":{"kind":"user","methods":{"call(bytes32,bytes)":{"notice":"Call the system at the given system ID."},"callFrom(address,bytes32,bytes)":{"notice":"Call the system at the given system ID on behalf of the given delegator."},"creator()":{"notice":"Retrieve the immutable original deployer of the World."},"getDynamicField(bytes32,bytes32[],uint8)":{"notice":"Get a single dynamic field from the given tableId and key tuple at the given dynamic field index. (Dynamic field index = field index - number of static fields)"},"getDynamicFieldLength(bytes32,bytes32[],uint8)":{"notice":"Get the byte length of a single dynamic field from the given tableId and key tuple"},"getDynamicFieldSlice(bytes32,bytes32[],uint8,uint256,uint256)":{"notice":"Get a byte slice (including start, excluding end) of a single dynamic field from the given tableId and key tuple, with the given value field layout. The slice is unchecked and will return invalid data if `start`:`end` overflow."},"getField(bytes32,bytes32[],uint8)":{"notice":"Get a single field from the given tableId and key tuple, loading the field layout from storage"},"getField(bytes32,bytes32[],uint8,bytes32)":{"notice":"Get a single field from the given tableId and key tuple, with the given field layout"},"getFieldLength(bytes32,bytes32[],uint8)":{"notice":"Get the byte length of a single field from the given tableId and key tuple, loading the field layout from storage"},"getFieldLength(bytes32,bytes32[],uint8,bytes32)":{"notice":"Get the byte length of a single field from the given tableId and key tuple, with the given value field layout"},"getRecord(bytes32,bytes32[])":{"notice":"Get full record (all fields, static and dynamic data) for the given tableId and key tuple, loading the field layout from storage"},"getRecord(bytes32,bytes32[],bytes32)":{"notice":"Get full record (all fields, static and dynamic data) for the given tableId and key tuple, with the given field layout"},"getStaticField(bytes32,bytes32[],uint8,bytes32)":{"notice":"Get a single static field from the given tableId and key tuple, with the given value field layout. Note: the field value is left-aligned in the returned bytes32, the rest of the word is not zeroed out. Consumers are expected to truncate the returned value as needed."},"initialize(address)":{"notice":"Initializes the World."},"installRootModule(address,bytes)":{"notice":"Install the given root module in the World."},"storeVersion()":{"notice":"Returns the protocol version of the Store contract."},"worldVersion()":{"notice":"Retrieve the protocol version of the World."}},"version":1}},"settings":{"remappings":["@codegen/=src/codegen/","@erc1155/=lib/ERC1155-puppet/","@latticexyz/=node_modules/@latticexyz/","@openzeppelin-upgradeable/=node_modules/@openzeppelin/contracts-upgradeable/","@openzeppelin/=node_modules/@openzeppelin/contracts/","@pythnetwork/=node_modules/@pythnetwork/entropy-sdk-solidity/","@systems/=src/systems/","@tables/=src/codegen/tables/","@test/=test/","@world/=src/codegen/world/","ds-test/=node_modules/ds-test/src/","forge-std/=node_modules/forge-std/src/"],"optimizer":{"enabled":true,"runs":3000},"metadata":{"bytecodeHash":"ipfs"},"compilationTarget":{"src/codegen/world/IWorld.sol":"IWorld"},"evmVersion":"paris","libraries":{}},"sources":{"node_modules/@latticexyz/schema-type/src/solidity/SchemaType.sol":{"keccak256":"0x650927696f7518fa216f2d6001835e9fdb419518034c781e86d2a2d33f4ecd2a","urls":["bzz-raw://72e91ac32ed00d36bd22fefeaf4ce1e9420143ddab7080eeb720c668a117bf44","dweb:/ipfs/QmdVqn18WZvx5p84MDJPsB5tfVoXDR86wzm4sLx6WrGYYL"],"license":"MIT"},"node_modules/@latticexyz/store/src/Bytes.sol":{"keccak256":"0x7dec900f9c9e7dff59430fa6f520e76c56338c3e829201aea140d49342e4fef8","urls":["bzz-raw://e55c1dfcda94dcc64b8577949b2e92a9d3fc44f5fba1ae77ceacccfdc8e22e35","dweb:/ipfs/QmS7uRJbEQYkPuZ5Dz5aSNjaaxj9PA8RtxUeUGN2W3jZx6"],"license":"MIT"},"node_modules/@latticexyz/store/src/EncodedLengths.sol":{"keccak256":"0xebc0a6efd611e02b15c05a382382b597fe059eba7f2a9e90da81eeb2f7666774","urls":["bzz-raw://00b2cac12599935e25ea0697e99fc9e6d5af6c1c982761996c16707d9cd6ca09","dweb:/ipfs/QmXccFminkrFtDpNfx6X1pHvW7Tn1nA5XcGu9T17pJyZyK"],"license":"MIT"},"node_modules/@latticexyz/store/src/FieldLayout.sol":{"keccak256":"0x15f698b7eabc062a00ff7a2e02db0ace2dd51f8bd2bc51a45dc0afa88f2ee658","urls":["bzz-raw://f774202c98ad394b3b62be93292512c633dec63bc931c190ed984656c2d54ec7","dweb:/ipfs/Qmd2D9mvP8S88ad2Q8WU54saNVr3Pwc5stPqEKHwcpo8AT"],"license":"MIT"},"node_modules/@latticexyz/store/src/Hook.sol":{"keccak256":"0xd016a2e1260f5a81ff9a8dfac58d7947e114414df8cce7302a2629908ea5f18e","urls":["bzz-raw://0c558a6f3a5f540c0190fa6d642a094a185c5db1acfc2437c7dbde0340f00ac3","dweb:/ipfs/QmViAHvR7U7HNfBiBZEMFiy1TTSHDFNiDzBfQSeLBShCky"],"license":"MIT"},"node_modules/@latticexyz/store/src/IERC165.sol":{"keccak256":"0x0efbf9afc716c585621482221f75e5bd60bcf0e813c9f7800d7c0309dcc3c927","urls":["bzz-raw://31b6aeb5446a0a0d5bd71be15a68c5bde94b08c961369203b83c8abe36f401d2","dweb:/ipfs/QmXhComne4es9ZMKaGNqHCdJZrFoFssxMYgLaqvCXPL1Mg"],"license":"MIT"},"node_modules/@latticexyz/store/src/IEncodedLengthsErrors.sol":{"keccak256":"0x06bb49164f44acc8d51df7b75ecf2f7aeb9281f7a3b357cae7d8d58bd1700dfa","urls":["bzz-raw://719027f4cc60fea30ce01cd4f672462f41fac750ae802e91a1a6d37c929e11ba","dweb:/ipfs/QmWi5DM2jT5V5SGP1afRmFyRgFvuZiGDX2PWHwP19HssF1"],"license":"MIT"},"node_modules/@latticexyz/store/src/IFieldLayoutErrors.sol":{"keccak256":"0xaef70c46e412bded1024ac82c957cea81c1d1ab11878a95635531e2ac9673a53","urls":["bzz-raw://cda2c7dc02ee8f0163b1c8d0f3e1e05d48b2a009e5c7365d2418f17bc3455817","dweb:/ipfs/QmXHDZuCPTxjHaeiEaJhA81koX2NJ3Gj1zt5WVWaz77FL8"],"license":"MIT"},"node_modules/@latticexyz/store/src/ISchemaErrors.sol":{"keccak256":"0x0ac3de36c9d0058a17fcd7f1a905132215fd16ea3ed3b5109de1de04ddd7c441","urls":["bzz-raw://f83fa2546009cfd16b3b3969dcec1d67c9d818d910177b885ba263b6a948c65d","dweb:/ipfs/QmehywHdvFYBL9BTtoPsVVwJXsEA4Xjk8aPWoHw1R45KeY"],"license":"MIT"},"node_modules/@latticexyz/store/src/ISliceErrors.sol":{"keccak256":"0x72684b7dfc1b44537401ccf10d6120186d02323266fcc762bc81859985eded4c","urls":["bzz-raw://e8d037b6937969ae54018ddf647eeaf5eb69a2b0bf9edf9456d3d270316b2883","dweb:/ipfs/QmfYJeyAmzRqpn68FteiM97p5t17iBw62FCET4bK5g4w37"],"license":"MIT"},"node_modules/@latticexyz/store/src/IStore.sol":{"keccak256":"0x42515d1410333a3573f78a460576271ef62c16edad5cf771ef6287b83ca1c706","urls":["bzz-raw://6a58d03c4cf420df57d2b2e2e7932daad877e46e89561b46e1fa9f593a701bdc","dweb:/ipfs/QmeFmKS7J1WqqBAgXkyxxx2fGA8JzuGszUmVsV2T6DYtsL"],"license":"MIT"},"node_modules/@latticexyz/store/src/IStoreErrors.sol":{"keccak256":"0x37e4d2f015dd4005ff9b3f711257c891027804bc268db1791984af4989951912","urls":["bzz-raw://a4a566ea96b69211f503707f69a9f9012d5873a3fd57b3f221549f46a7518df6","dweb:/ipfs/QmVgcE3JufJr3iyeV6xqkvS4YtDcy6Eqyram2yzWUhwoB4"],"license":"MIT"},"node_modules/@latticexyz/store/src/IStoreEvents.sol":{"keccak256":"0x8606e9de37943c74beabb9ac9acd2132f951bed1ef79f2f4f3de83ed1f271f6a","urls":["bzz-raw://d13adeee7ae9e687bf1cd12a8c36223179685fc828a7c468ee9311c879401b08","dweb:/ipfs/QmQeb2ArSoQpE6ujBbDj9LY3xqpVCPiz3bh9SLT6siE8RY"],"license":"MIT"},"node_modules/@latticexyz/store/src/IStoreHook.sol":{"keccak256":"0x6574a30a2bbd8a0de21b2504c55effb8802fdeff62296af82a9380bd753adcc4","urls":["bzz-raw://85a859c533f51b584a9a2e8a64d61b6cf6f69bfcff1b926ad787518b1cae9562","dweb:/ipfs/QmVyjmyJ69ZeqaXHg91JtGLVahRfZ7KtWaessLWZ6rYk9p"],"license":"MIT"},"node_modules/@latticexyz/store/src/IStoreKernel.sol":{"keccak256":"0x37a23dcbabc5937a717f2fda636b6a97963ed4b5a96870a62dfb199a8b692f89","urls":["bzz-raw://ac9741ea6daf21f39699be11afd919ae3ec07df24d948aaaa6549456fefd7fc0","dweb:/ipfs/QmeiPQkZitM4Pc3i6L87thU71Fs1JVWAgMqXnSK8VrCq75"],"license":"MIT"},"node_modules/@latticexyz/store/src/IStoreRead.sol":{"keccak256":"0xdcf28b3293d4d6c1fe2808a8918c1b2122e4e0e49f2793c79ebd2b9ae210ff7b","urls":["bzz-raw://bb3d9cc80f549ed0c5b768aea69fb1b3c364bd4f85d193a3040c411b594d94db","dweb:/ipfs/QmYYdY5CjPHiW5ucXihTva1eHsCPNqBsvL6zYYafH3ap4p"],"license":"MIT"},"node_modules/@latticexyz/store/src/IStoreRegistration.sol":{"keccak256":"0x9e91a73f93cc9ebc00c265c83177f6a3f8a156749a9261202e2845e12aeaa96b","urls":["bzz-raw://a39280d87d22dd0a959d8f55925cb092dba1fee2f11d3dd8e3ffabed45a9ab6a","dweb:/ipfs/QmRMBFLJtT2KN43Xz9P3vUNWxXrP8rLTNBFw2P6Z7EGeaS"],"license":"MIT"},"node_modules/@latticexyz/store/src/IStoreWrite.sol":{"keccak256":"0x120fd448da5806e09ecb5327ad4dba64df01d2ee7232de0979133627e87e24ba","urls":["bzz-raw://7a3cb151b2ddee217f330d61813b2dcd997de94940c903719f6d066a21467890","dweb:/ipfs/Qmbes1RRY6KdtsMohp8834xXyipeQK9GJ41NfgXK1d1QAZ"],"license":"MIT"},"node_modules/@latticexyz/store/src/Memory.sol":{"keccak256":"0xef6e7000b181c2991aeacbf99a9d886f8c4df88878b857713f851185b63a7811","urls":["bzz-raw://b079b4773d140ab2c01bdb04facfa56a78f753aea7122fa445b2bfa133411392","dweb:/ipfs/QmWYWKFpwtsPeGdCSxcANgxXUbwAuMMgR7iMVPDSCZxz2A"],"license":"MIT"},"node_modules/@latticexyz/store/src/ResourceId.sol":{"keccak256":"0x889423054511cf8a83f5dfd65a0f984dc514aba798ef3db139b59d395b2327e2","urls":["bzz-raw://40b9495d455c87db8b063e291ca3973dc3ba1163f09c5d7446241a9e1cb69ed0","dweb:/ipfs/Qmek1JKVjPUpoXnKwu66HfPS9rHstKtWTuBmG8YFxbPEWQ"],"license":"MIT"},"node_modules/@latticexyz/store/src/Schema.sol":{"keccak256":"0x0d2a08030d21292ecbcc850d9111f3817d03f17cd5e02186894848a9152d79d7","urls":["bzz-raw://3f30024c1613fb587aaba4c1dcb8e4e46ed765a2cebd5b63fbebd327d1bf13d3","dweb:/ipfs/QmZzqSnPMYKDYwbFNvUFrvuazMUyQHzQ59w3A9x6juHAm7"],"license":"MIT"},"node_modules/@latticexyz/store/src/Slice.sol":{"keccak256":"0xae6c03881fdfa56cba1879d9c9c6b52c2829e6a278a200176678d8da05a89345","urls":["bzz-raw://3cad7dc4944c0518de2e7f99697485d365ae37aa6cad6967996377c2dd951fe4","dweb:/ipfs/QmW3grFwr8BcgJmLfjLbj3FthnD7NRUBFMFiahbXztHPr7"],"license":"MIT"},"node_modules/@latticexyz/store/src/Storage.sol":{"keccak256":"0x7e735a4c7fa8b8a5fe2371d90801e3287ddb78efed69b31e1a76f0b7b153c4c3","urls":["bzz-raw://9e6db36bd52144b6feeecd91a58fc311127a3892fc96c4171db5b570fe9876ee","dweb:/ipfs/QmS6LqnTZvpMc4eiz5JowBoNnh3RYemG6JHjqtYucT1rQi"],"license":"MIT"},"node_modules/@latticexyz/store/src/StoreCore.sol":{"keccak256":"0x9513dc38e5baadde0ba9b08320a324043b0e88a10702be5c3507da8c3d45e861","urls":["bzz-raw://99c80c65a394763668e4aed69220fec6bb3ed847fb277ddd1ff1d4bfdf452da2","dweb:/ipfs/QmRT2BATKtrYmixWMuWo9Cz8g8oscfLNSmvjxTyiTNA1pc"],"license":"MIT"},"node_modules/@latticexyz/store/src/StoreSwitch.sol":{"keccak256":"0x7edf7c1641408f3a580eb28bda58054583cb846f875608612671c6d40712ba40","urls":["bzz-raw://4146adef610d1daab085a81aa9f2d4fd8c4e5f459b9ef184f3ef23465573cf91","dweb:/ipfs/QmQqZMsbkzSNG6VfYzQLdRCBCsNohBSVQmWoTP6QvKmKUP"],"license":"MIT"},"node_modules/@latticexyz/store/src/codegen/index.sol":{"keccak256":"0x094a6f1e2910b345b6b254e0fc2c8882b3190c673f7ee19742e857057a4d3f85","urls":["bzz-raw://18908e2e7e878635abea72ef99851fddd204371e6b641f010e831ebfa0b1bfd4","dweb:/ipfs/QmSNAxXqxTrzPkZ4rSAQgBnuer1yLPq74hoqnzrZV3WGsb"],"license":"MIT"},"node_modules/@latticexyz/store/src/codegen/tables/Hooks.sol":{"keccak256":"0xfdea5b4cf666720c1c0d81a8acdede68e6220aee45d8a9f3c9834b4edc5da394","urls":["bzz-raw://b3a394dfe123cfb7200f65d379fb0cb3d2c84475b382faf6ee11bf9c45a63b53","dweb:/ipfs/QmRMPHFBbCKtqKBVV9gvd2jhnfsyUKmCBEQkgviMoxi1UG"],"license":"MIT"},"node_modules/@latticexyz/store/src/codegen/tables/ResourceIds.sol":{"keccak256":"0xf192bceab34508cee21dd7c33e4d776f79c4a7ca55ee8905c6c694850ebfdf64","urls":["bzz-raw://c95113f76f6de671cb44710754e0942934182b544660a4330fc90a505e198905","dweb:/ipfs/QmXma5ZxfK8Y9TbvB7QM9hdhfc1ixiMcLpo9BQxnVthHB5"],"license":"MIT"},"node_modules/@latticexyz/store/src/codegen/tables/StoreHooks.sol":{"keccak256":"0xa825218614acc19a4100357dd7ee410b67b994fe7aaa68650d5d0d4202d4ca8c","urls":["bzz-raw://09b0cbb598fe2b75bbcd269b47d686a66fcc89c0c40d9a09807eba7688b81fc6","dweb:/ipfs/QmYk6XQwSLhRumujTCsqxdvugKuP8oLjjB926pMHR445ra"],"license":"MIT"},"node_modules/@latticexyz/store/src/codegen/tables/Tables.sol":{"keccak256":"0x918b977e7f7f3e947d6d5aa189c54c9c7e7c106d0a0d53734ee959ad454abe09","urls":["bzz-raw://3a3de63c04c838bf80c1903cf7464d201d0ece0f86a7aaca35462b730e9338fc","dweb:/ipfs/QmSUkLZ88J7tSwdmR3viBJHU8QVgN2Gji6W8wYLJEDNkc2"],"license":"MIT"},"node_modules/@latticexyz/store/src/constants.sol":{"keccak256":"0x67e0d59237bd37424827ecde1ecdbe71f65376af517b0623cd8f8d5451bca7a6","urls":["bzz-raw://09c5ec7fe73e06140957d44a3d9938587711c783ccbf08ff017638c9279a3168","dweb:/ipfs/QmfS9ZRqHXmBJ1h5B4x4gbU6d18DtMgKZSkxhQgNVRxueu"],"license":"MIT"},"node_modules/@latticexyz/store/src/rightMask.sol":{"keccak256":"0x28887aab8ad5ca598927e59d702999ca6e3b3128f1cddd2b995a381c8d04b275","urls":["bzz-raw://7710847f4689b7f5b81436c7d52ae4395f244a2eebf8d398b2edd43accb06754","dweb:/ipfs/QmTD2wYqryXTynHAn5Vf9wtjUUSGeCJWENZTnWtBAK38pa"],"license":"MIT"},"node_modules/@latticexyz/store/src/storeHookTypes.sol":{"keccak256":"0x4f29001e53690ce74fe405a6d0376a564c9c743d1631d36fab04331865e4d572","urls":["bzz-raw://138c80abd63225a3eeb01ebfa1f9288e188a7ee5b2266b275fb4ed31b5aa30e3","dweb:/ipfs/QmdEx9uHgCCbTcetGwFH5a66Ft7ajmrMDXvP1fW7WjnnE2"],"license":"MIT"},"node_modules/@latticexyz/store/src/storeResourceTypes.sol":{"keccak256":"0x1c4cb6b3ecf76f614479ab304d7de3ade0e99c7ccfd07717b57c92f699a27261","urls":["bzz-raw://2c9b0e0c9b3b5610d6fd65a8ffd7c54df390a34ccc70d58f4a055c49ad1ea586","dweb:/ipfs/QmP6ffpnR7aRyvq9AiUkVNH6LbGfFP3NDq7E2n2PVcHhp2"],"license":"MIT"},"node_modules/@latticexyz/store/src/tightcoder/DecodeSlice.sol":{"keccak256":"0x310523f7f3acca841e62fe50be8d8b042cad5b3c239cb1105d6623cf83e63152","urls":["bzz-raw://1cc40ca233acf6502bc65677b381c05331dd7323953e54b5df969051e47f851e","dweb:/ipfs/QmTxy9mhodT8drezB5K1kPR78AMaARomoJqDyaWpLuCKui"],"license":"MIT"},"node_modules/@latticexyz/store/src/tightcoder/EncodeArray.sol":{"keccak256":"0x259ee545fd9dfd4767f0b7fef31f52fd3c54c4a1c6657d6fbda4927800c937b3","urls":["bzz-raw://0a4e31efa9f476cd267af7c3e11fe0151252206a1f6407a80a4092444c2de8ea","dweb:/ipfs/QmRF4gWYw33mFTMh7nX8DJ1qzx3Ko6yMsnxubzYTRppdyo"],"license":"MIT"},"node_modules/@latticexyz/store/src/tightcoder/TightCoder.sol":{"keccak256":"0x0e74ff88ec94cb33f79d8afc1497c4fdccf02db40ab47f3701c7d02fc305d4d8","urls":["bzz-raw://36b7cd0c2a3f2dcdc83ab7ac5a93f123746ce29c0f1000f2b275ad2c647ff0f3","dweb:/ipfs/QmYdipHYUhHhS78wLdtmKZUK14FEwpto5mFy3rNeZssMLz"],"license":"MIT"},"node_modules/@latticexyz/store/src/version.sol":{"keccak256":"0x78c571906ee999ee7e56d4f7702b8a93c3a9e55e6b552aca115b5f6ac7f1c80a","urls":["bzz-raw://a9f141b2d556b2a2545e7db5606e8a038679a995a22aeaf1702cb3a60320b60a","dweb:/ipfs/QmY7x258Fhj3TT3RT4sNyyfiRphVYdZXhtAnSYpasJ4xVQ"],"license":"MIT"},"node_modules/@latticexyz/world/src/IERC165.sol":{"keccak256":"0xe3d9074a1be3247be67ff4dd2c9e41481650ddaa799285a249736bb85673e33d","urls":["bzz-raw://0b6743ee1e6d0c74927bf17fc1da0cad7575aa7634871b94190ffbdb4c28c2a7","dweb:/ipfs/Qma5bNsPJSBTesWxg3eAAMUBTDE7UjqWaHF7eMiGwP87jr"],"license":"MIT"},"node_modules/@latticexyz/world/src/IModule.sol":{"keccak256":"0xbb926cf64e685bbf2770d60124664cc84ab70bd3038e17a074f2d472c3fc2c57","urls":["bzz-raw://143c3dcbdf1702dd4f9c869629609386c12f7c0247e88a6d062dc4d519ebe0d2","dweb:/ipfs/QmQJSDd8uFL4sssw9fb9NHo4s6zjuDUgmrLHj3zsJuhMo1"],"license":"MIT"},"node_modules/@latticexyz/world/src/IModuleErrors.sol":{"keccak256":"0x60917e029779c81cfea1f5140c389269e51d7adb78987f39101b9e0d7bdad12d","urls":["bzz-raw://513f41920d67ca28c3e0fe247403c28a4d342785192df449c99d5f92db04fcea","dweb:/ipfs/QmeAG2TtxAgcJQR4QxftuSvQrxisYQ1i1GZoyd7oeFQBDJ"],"license":"MIT"},"node_modules/@latticexyz/world/src/ISystemHook.sol":{"keccak256":"0x81f1743d7ca6a9c7efc4997cf95e603ccb2070885265ca0e540f461aa7430721","urls":["bzz-raw://93d99e78b541b33ecd501bf0cd407a78cef490fec8eaef2f188bddb9e293a99f","dweb:/ipfs/QmPrcMDxwhvBZTr2AxoGqJA9L3Mjx27KBc98h3gXSsa3PM"],"license":"MIT"},"node_modules/@latticexyz/world/src/IWorldContextConsumer.sol":{"keccak256":"0xb39e9d8cff4162e255f6c460ef9f9f0ad5b804627f745d967b2f10d0dd509299","urls":["bzz-raw://18d957cd87febccc00d82b9454047f0f5236250c9245befc0f57978671675255","dweb:/ipfs/QmdZ1eXBd15vLpLVqTNJDAAaTzzucpRLD8GPJahLKT4J7x"],"license":"MIT"},"node_modules/@latticexyz/world/src/IWorldErrors.sol":{"keccak256":"0x0abae6f4ed1b3070bddd0ed194c08b83a948b61ae959396202cf627bf1056a2b","urls":["bzz-raw://a7037954f281cc0188a5aafc1d0cca0aabc110fd0234e6c43dca35ad69ed3baf","dweb:/ipfs/Qmbv2nfK1qPpnoAbqNJFqWwo7AuyaX2ZEgZMFspMv7DR5B"],"license":"MIT"},"node_modules/@latticexyz/world/src/IWorldEvents.sol":{"keccak256":"0x39f6d8930db431c04158b85cc2a612c48d43dc81ec998f267076b12293c5d243","urls":["bzz-raw://d68f1543e5e166d639372d1aec57e3e193b5bb3b37270b6cb0488fab2c0ebe57","dweb:/ipfs/QmdJUFDx87AHWFKP3jVrYg8xqAkiPfuT1M3tEotNt7KUoy"],"license":"MIT"},"node_modules/@latticexyz/world/src/IWorldKernel.sol":{"keccak256":"0xdaa1e92439036e392fe79892819ae165732f416b831f84d38050ca3d958e549b","urls":["bzz-raw://ea8dc52e31a62e8971322ea9ed8f2e83d562ec199d7f93a392c293e96ff7f092","dweb:/ipfs/QmSbM8MgHbrJLYP7uzemfZeC4xctqdyKDbspwHUsgeeVJC"],"license":"MIT"},"node_modules/@latticexyz/world/src/System.sol":{"keccak256":"0xadcb32bdc444a4420909b738d81fa662dc63739455fe93d5aa89c93a3ccfd2dd","urls":["bzz-raw://d303094c84ebfb0f9f114c54ff4dfc68bfa1e526d0ebe304be6fbeb7cb2f0d3f","dweb:/ipfs/QmYvUx1mNDhkxZFqxLeswW3w9HkvVqeoJiJKj1HN1SB7Gi"],"license":"MIT"},"node_modules/@latticexyz/world/src/WorldContext.sol":{"keccak256":"0x50ca52bdd89a9f27d6b03ad00ef45c8c5a6884ea9d75e18f8fa53524ac2feed9","urls":["bzz-raw://55febdece37b291527094fb654919d4c8fe0b231792996a14c5e5cc76512b19e","dweb:/ipfs/QmZHFbDDNmdFHWc1uTSvDgMUUgb8NgBPb1cDUJYajswbHT"],"license":"MIT"},"node_modules/@latticexyz/world/src/WorldResourceId.sol":{"keccak256":"0xaff9a22fac8a0f6eee5763b07a7ccb623c829d37922b85e42e914aad2ad417ee","urls":["bzz-raw://e598f0274d6d97c0a09806bf4fd1f0d054c310cf51b2123f5ce6380d6f3186ea","dweb:/ipfs/QmaaVvqm21YsCgxozDyShcM17jKUXJhf2y26bk2YzPYZoM"],"license":"MIT"},"node_modules/@latticexyz/world/src/codegen/interfaces/IAccessManagementSystem.sol":{"keccak256":"0x7e7321b86836bfbf4b96d0fb2a424ed678efcf01b15fa3d0b4ae4f0b975ad5dc","urls":["bzz-raw://ead41554796bd0507e390f2997aa4a8df7bff8b51523b86fa3c5bd8acb1fec48","dweb:/ipfs/QmVe1VUhfbRy8tviA7UcCtS8NjXhsF1E6Re9xLqWS5aRTK"],"license":"MIT"},"node_modules/@latticexyz/world/src/codegen/interfaces/IBalanceTransferSystem.sol":{"keccak256":"0xe57042e82311847c56fa569377ed84459bf55afccdd3123312a5dff90c1d06f4","urls":["bzz-raw://baf3258c9118bf16ba68ebcfecdb5e5ffc85d5c0cdc2815ca298283dfcff2c83","dweb:/ipfs/QmcBVyUBR3PVejz7249VrEBMCMKHi72KoUXQ8DFmMmY48F"],"license":"MIT"},"node_modules/@latticexyz/world/src/codegen/interfaces/IBaseWorld.sol":{"keccak256":"0xf7acdfa0eb01c710d11fba129d613863fe86f1bed352f0bc5630bea81cceae17","urls":["bzz-raw://3e4107681cd20c018cd8f5dff6da72e8a4b02f631c7c59b618e8743482c7bc81","dweb:/ipfs/QmXS8NLaKVXcf97HrD8U4hGHqb9ytYGwdZrTVHHb5EwrRj"],"license":"MIT"},"node_modules/@latticexyz/world/src/codegen/interfaces/IBatchCallSystem.sol":{"keccak256":"0x600cc362780c319e640950ad3520af7fa558171268baab252ff4da4414aa0f1c","urls":["bzz-raw://6d113a833b64bccbbe852f3d0261efd80ad4a0f6771802dc91af79c762a33ff2","dweb:/ipfs/QmaXEdJJaMMQF8nZieWyXdVD15yuXnH89QLZHwD18LAndz"],"license":"MIT"},"node_modules/@latticexyz/world/src/codegen/interfaces/IModuleInstallationSystem.sol":{"keccak256":"0x7070453d969eba7defd90047d58ae979e27e5c1fcf05598daa4d17fedbe84c35","urls":["bzz-raw://ee5c196c5e339ac0222cd1d14fd9d09451d255605f73732abc33397a9512503b","dweb:/ipfs/QmYwNsWnxP24RzDqFYLnBYswZY97YE3nwG6Xf55f5FqNXa"],"license":"MIT"},"node_modules/@latticexyz/world/src/codegen/interfaces/IRegistrationSystem.sol":{"keccak256":"0xe08d3af994098120b5507c71a1c3558763b8c1a88c6eae506aa438c2af78f800","urls":["bzz-raw://bb0c47b16ff524140388765fe9ef99211dd7d9b9374dae09144a9956138de00c","dweb:/ipfs/Qma8ibVu6WZs1hFW3hMnUykV3pPXGZhZ3xJwJXNj6Xu7aL"],"license":"MIT"},"node_modules/@latticexyz/world/src/codegen/interfaces/IWorldRegistrationSystem.sol":{"keccak256":"0x70bed82da026058ddccf52766823c7d55c7d29faad0ab1d76d763786d5277f7c","urls":["bzz-raw://1da6476d62e450d3d935ea8292723612a84fa1d07342fbc052ee851181701a27","dweb:/ipfs/Qmd1FQpmEVbQciLDPkHPXSKB7aYW1YB74BN5JXqn74erhR"],"license":"MIT"},"node_modules/@latticexyz/world/src/constants.sol":{"keccak256":"0xb8320f88ed5519a4fe2554ad94815ce328a50fef7719932375d6ce695265c2f5","urls":["bzz-raw://a8f5de30fbcc63e469e46ad4a4d4bcd7d8e4b4f2d31fcf62a04aca48d999af22","dweb:/ipfs/QmXw1jDQM2szfRY3tAGrRy6fEzte6yVFgebJAqCLMDHndV"],"license":"MIT"},"node_modules/@latticexyz/world/src/modules/init/types.sol":{"keccak256":"0x81b75eb286ec515bde6cbb16c3d089054abb530b744865bbace68343d23177bc","urls":["bzz-raw://afc77bd51e24da666260bb48c44ff611869fb2e550921d732e5aac84a1f09525","dweb:/ipfs/QmeU5N4yeRh5nEA65pvGtQQJNv1GvEPy4PkhMVRYRMoMvh"],"license":"MIT"},"node_modules/@latticexyz/world/src/revertWithBytes.sol":{"keccak256":"0xa1147f218a0152b153d4e8bada0f606bfed40ac1f184fd16a941c2d0033c53f5","urls":["bzz-raw://3f5e0f6d1b51a3a04d4bd84537b2ced373b32824898cf6fbfd13ae1cbdf06359","dweb:/ipfs/QmayYRmBZRUV9m4UnFxuC62VvHriXhkYXeH3HibZ3Gmxxf"],"license":"MIT"},"node_modules/@latticexyz/world/src/worldResourceTypes.sol":{"keccak256":"0xeb042e7d3638430f6fd394107f3237cf14e4325154f0098624e8a7826584d465","urls":["bzz-raw://39e0b8eb87616b661f5a4f2fd7e1a727bd19b7fd8d40ad3d93fda26822f433ea","dweb:/ipfs/QmacYMatKV9pwEwirVRY9a6r89RoNs5yk99ic37ieWA8Dk"],"license":"MIT"},"src/codegen/common.sol":{"keccak256":"0x707897e27fa433c6a12bc59c1d7f531b74503089bcb54f24ac725176cb7f8991","urls":["bzz-raw://b463a6c273e400177cd4ee26186f2ebf7fd65c8d4339e3fec1b9d75f102dfc30","dweb:/ipfs/QmRaHH5dW6PKHST4tr1snoGk7P2NERPT8P9eGygu51mobS"],"license":"MIT"},"src/codegen/tables/CharacterStats.sol":{"keccak256":"0x8609e049f9c40a2990a4d769be61d195385c4e22e403f133be102b4e9662e7ca","urls":["bzz-raw://35be01edf9b7e148303a62ffafba00df314c47f8d57f159f5a56d75b56ccf7fc","dweb:/ipfs/QmQdFFa7U6AHadojoJZSCLMQRmHnzcEPsmJ6j382DF2nvg"],"license":"MIT"},"src/codegen/world/ICharacterSystem.sol":{"keccak256":"0x8bdbad1e2f920aec7ee05447880b01486094eb92869546e5b8bc34ca67fc879d","urls":["bzz-raw://0c492dfa099175c6bb8e6c244a3a06d0acfed5eee99f5a6e2f934434d4344bdc","dweb:/ipfs/QmfXCkjsgMaPGFarjdKiEY4dZmw9MigHfjRxTkZZuW9yPC"],"license":"MIT"},"src/codegen/world/IUltimateDominionConfigSystem.sol":{"keccak256":"0xa0f3ca216ac607c821d482c88f873fd608092c3d967dd38b0f890ab2328c5b93","urls":["bzz-raw://8365b31f2a69315af9bd7a9b756186055a0bf5839c875ce0716033569a8bebdd","dweb:/ipfs/Qme834tRDauXXVne3LTkNBKsGvqW68tsw6jjqGPssLeJ4m"],"license":"MIT"},"src/codegen/world/IWorld.sol":{"keccak256":"0xe1269365767ab0891c6f3a21d432fd872301e04e551ea3b813c87552a76fbc67","urls":["bzz-raw://decd88538987a0e790845443f81eb7bad639c62849cbc0f69042d893c93c9fba","dweb:/ipfs/Qmbug7m6PM9iMftpbUfJwKNp2FyZRritchkQA5vVxcN4a2"],"license":"MIT"}},"version":1},"id":165} \ No newline at end of file +{"abi":[{"type":"function","name":"UD__createItem","inputs":[{"name":"itemType","type":"uint8","internalType":"enum ItemType"},{"name":"supply","type":"uint256","internalType":"uint256"},{"name":"itemMetadataURI","type":"string","internalType":"string"},{"name":"stats","type":"bytes","internalType":"bytes"}],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"nonpayable"},{"type":"function","name":"UD__enterGame","inputs":[{"name":"characterId","type":"uint256","internalType":"uint256"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"UD__getCharacterStats","inputs":[{"name":"characterId","type":"uint256","internalType":"uint256"}],"outputs":[{"name":"","type":"tuple","internalType":"struct CharacterStatsData","components":[{"name":"strength","type":"uint256","internalType":"uint256"},{"name":"agility","type":"uint256","internalType":"uint256"},{"name":"intelligence","type":"uint256","internalType":"uint256"},{"name":"hitPoints","type":"uint256","internalType":"uint256"},{"name":"experience","type":"uint256","internalType":"uint256"}]}],"stateMutability":"view"},{"type":"function","name":"UD__getCharacterToken","inputs":[],"outputs":[{"name":"_characterToken","type":"address","internalType":"address"}],"stateMutability":"view"},{"type":"function","name":"UD__getClass","inputs":[{"name":"characterId","type":"uint256","internalType":"uint256"}],"outputs":[{"name":"_class","type":"uint8","internalType":"enum Classes"}],"stateMutability":"view"},{"type":"function","name":"UD__getEntropy","inputs":[],"outputs":[{"name":"_entropy","type":"address","internalType":"address"}],"stateMutability":"view"},{"type":"function","name":"UD__getExperience","inputs":[{"name":"characterId","type":"uint256","internalType":"uint256"}],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"type":"function","name":"UD__getGoldToken","inputs":[],"outputs":[{"name":"_goldToken","type":"address","internalType":"address"}],"stateMutability":"view"},{"type":"function","name":"UD__getItemsContract","inputs":[],"outputs":[{"name":"_erc1155","type":"address","internalType":"address"}],"stateMutability":"view"},{"type":"function","name":"UD__getName","inputs":[{"name":"characterId","type":"uint256","internalType":"uint256"}],"outputs":[{"name":"_name","type":"bytes32","internalType":"bytes32"}],"stateMutability":"view"},{"type":"function","name":"UD__getOwner","inputs":[{"name":"characterId","type":"uint256","internalType":"uint256"}],"outputs":[{"name":"","type":"address","internalType":"address"}],"stateMutability":"view"},{"type":"function","name":"UD__getPythProvider","inputs":[],"outputs":[{"name":"_provider","type":"address","internalType":"address"}],"stateMutability":"view"},{"type":"function","name":"UD__getTotalSupply","inputs":[{"name":"tokenId","type":"uint256","internalType":"uint256"}],"outputs":[{"name":"_supply","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"type":"function","name":"UD__getWeaponStats","inputs":[{"name":"itemId","type":"uint256","internalType":"uint256"}],"outputs":[{"name":"_weaponStats","type":"tuple","internalType":"struct WeaponStats","components":[{"name":"damage","type":"uint256","internalType":"uint256"},{"name":"speed","type":"uint256","internalType":"uint256"},{"name":"classRestrictions","type":"uint8[]","internalType":"uint8[]"}]}],"stateMutability":"view"},{"type":"function","name":"UD__issueStarterItems","inputs":[{"name":"characterId","type":"uint256","internalType":"uint256"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"UD__mintCharacter","inputs":[{"name":"account","type":"address","internalType":"address"},{"name":"name","type":"bytes32","internalType":"bytes32"},{"name":"tokenUri","type":"string","internalType":"string"}],"outputs":[{"name":"characterId","type":"uint256","internalType":"uint256"}],"stateMutability":"nonpayable"},{"type":"function","name":"UD__rollStats","inputs":[{"name":"userRandomNumber","type":"bytes32","internalType":"bytes32"},{"name":"characterId","type":"uint256","internalType":"uint256"},{"name":"class","type":"uint8","internalType":"enum Classes"}],"outputs":[],"stateMutability":"payable"},{"type":"function","name":"UD__setStarterItems","inputs":[{"name":"class","type":"uint8","internalType":"enum Classes"},{"name":"itemIds","type":"uint256[]","internalType":"uint256[]"},{"name":"amounts","type":"uint256[]","internalType":"uint256[]"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"UD__setTokenUri","inputs":[{"name":"tokenId","type":"uint256","internalType":"uint256"},{"name":"tokenUri","type":"string","internalType":"string"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"batchCall","inputs":[{"name":"systemCalls","type":"tuple[]","internalType":"struct SystemCallData[]","components":[{"name":"systemId","type":"bytes32","internalType":"ResourceId"},{"name":"callData","type":"bytes","internalType":"bytes"}]}],"outputs":[{"name":"returnDatas","type":"bytes[]","internalType":"bytes[]"}],"stateMutability":"nonpayable"},{"type":"function","name":"batchCallFrom","inputs":[{"name":"systemCalls","type":"tuple[]","internalType":"struct SystemCallFromData[]","components":[{"name":"from","type":"address","internalType":"address"},{"name":"systemId","type":"bytes32","internalType":"ResourceId"},{"name":"callData","type":"bytes","internalType":"bytes"}]}],"outputs":[{"name":"returnDatas","type":"bytes[]","internalType":"bytes[]"}],"stateMutability":"nonpayable"},{"type":"function","name":"call","inputs":[{"name":"systemId","type":"bytes32","internalType":"ResourceId"},{"name":"callData","type":"bytes","internalType":"bytes"}],"outputs":[{"name":"","type":"bytes","internalType":"bytes"}],"stateMutability":"payable"},{"type":"function","name":"callFrom","inputs":[{"name":"delegator","type":"address","internalType":"address"},{"name":"systemId","type":"bytes32","internalType":"ResourceId"},{"name":"callData","type":"bytes","internalType":"bytes"}],"outputs":[{"name":"","type":"bytes","internalType":"bytes"}],"stateMutability":"payable"},{"type":"function","name":"creator","inputs":[],"outputs":[{"name":"","type":"address","internalType":"address"}],"stateMutability":"view"},{"type":"function","name":"deleteRecord","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","internalType":"bytes32[]"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"getDynamicField","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","internalType":"bytes32[]"},{"name":"dynamicFieldIndex","type":"uint8","internalType":"uint8"}],"outputs":[{"name":"","type":"bytes","internalType":"bytes"}],"stateMutability":"view"},{"type":"function","name":"getDynamicFieldLength","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","internalType":"bytes32[]"},{"name":"dynamicFieldIndex","type":"uint8","internalType":"uint8"}],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"type":"function","name":"getDynamicFieldSlice","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","internalType":"bytes32[]"},{"name":"dynamicFieldIndex","type":"uint8","internalType":"uint8"},{"name":"start","type":"uint256","internalType":"uint256"},{"name":"end","type":"uint256","internalType":"uint256"}],"outputs":[{"name":"data","type":"bytes","internalType":"bytes"}],"stateMutability":"view"},{"type":"function","name":"getField","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","internalType":"bytes32[]"},{"name":"fieldIndex","type":"uint8","internalType":"uint8"},{"name":"fieldLayout","type":"bytes32","internalType":"FieldLayout"}],"outputs":[{"name":"data","type":"bytes","internalType":"bytes"}],"stateMutability":"view"},{"type":"function","name":"getField","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","internalType":"bytes32[]"},{"name":"fieldIndex","type":"uint8","internalType":"uint8"}],"outputs":[{"name":"data","type":"bytes","internalType":"bytes"}],"stateMutability":"view"},{"type":"function","name":"getFieldLayout","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"}],"outputs":[{"name":"fieldLayout","type":"bytes32","internalType":"FieldLayout"}],"stateMutability":"view"},{"type":"function","name":"getFieldLength","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","internalType":"bytes32[]"},{"name":"fieldIndex","type":"uint8","internalType":"uint8"},{"name":"fieldLayout","type":"bytes32","internalType":"FieldLayout"}],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"type":"function","name":"getFieldLength","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","internalType":"bytes32[]"},{"name":"fieldIndex","type":"uint8","internalType":"uint8"}],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"type":"function","name":"getKeySchema","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"}],"outputs":[{"name":"keySchema","type":"bytes32","internalType":"Schema"}],"stateMutability":"view"},{"type":"function","name":"getRecord","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","internalType":"bytes32[]"},{"name":"fieldLayout","type":"bytes32","internalType":"FieldLayout"}],"outputs":[{"name":"staticData","type":"bytes","internalType":"bytes"},{"name":"encodedLengths","type":"bytes32","internalType":"EncodedLengths"},{"name":"dynamicData","type":"bytes","internalType":"bytes"}],"stateMutability":"view"},{"type":"function","name":"getRecord","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","internalType":"bytes32[]"}],"outputs":[{"name":"staticData","type":"bytes","internalType":"bytes"},{"name":"encodedLengths","type":"bytes32","internalType":"EncodedLengths"},{"name":"dynamicData","type":"bytes","internalType":"bytes"}],"stateMutability":"view"},{"type":"function","name":"getStaticField","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","internalType":"bytes32[]"},{"name":"fieldIndex","type":"uint8","internalType":"uint8"},{"name":"fieldLayout","type":"bytes32","internalType":"FieldLayout"}],"outputs":[{"name":"","type":"bytes32","internalType":"bytes32"}],"stateMutability":"view"},{"type":"function","name":"getValueSchema","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"}],"outputs":[{"name":"valueSchema","type":"bytes32","internalType":"Schema"}],"stateMutability":"view"},{"type":"function","name":"grantAccess","inputs":[{"name":"resourceId","type":"bytes32","internalType":"ResourceId"},{"name":"grantee","type":"address","internalType":"address"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"initialize","inputs":[{"name":"initModule","type":"address","internalType":"contract IModule"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"installModule","inputs":[{"name":"module","type":"address","internalType":"contract IModule"},{"name":"encodedArgs","type":"bytes","internalType":"bytes"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"installRootModule","inputs":[{"name":"module","type":"address","internalType":"contract IModule"},{"name":"encodedArgs","type":"bytes","internalType":"bytes"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"popFromDynamicField","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","internalType":"bytes32[]"},{"name":"dynamicFieldIndex","type":"uint8","internalType":"uint8"},{"name":"byteLengthToPop","type":"uint256","internalType":"uint256"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"pushToDynamicField","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","internalType":"bytes32[]"},{"name":"dynamicFieldIndex","type":"uint8","internalType":"uint8"},{"name":"dataToPush","type":"bytes","internalType":"bytes"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"registerDelegation","inputs":[{"name":"delegatee","type":"address","internalType":"address"},{"name":"delegationControlId","type":"bytes32","internalType":"ResourceId"},{"name":"initCallData","type":"bytes","internalType":"bytes"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"registerFunctionSelector","inputs":[{"name":"systemId","type":"bytes32","internalType":"ResourceId"},{"name":"systemFunctionSignature","type":"string","internalType":"string"}],"outputs":[{"name":"worldFunctionSelector","type":"bytes4","internalType":"bytes4"}],"stateMutability":"nonpayable"},{"type":"function","name":"registerNamespace","inputs":[{"name":"namespaceId","type":"bytes32","internalType":"ResourceId"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"registerNamespaceDelegation","inputs":[{"name":"namespaceId","type":"bytes32","internalType":"ResourceId"},{"name":"delegationControlId","type":"bytes32","internalType":"ResourceId"},{"name":"initCallData","type":"bytes","internalType":"bytes"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"registerRootFunctionSelector","inputs":[{"name":"systemId","type":"bytes32","internalType":"ResourceId"},{"name":"worldFunctionSignature","type":"string","internalType":"string"},{"name":"systemFunctionSignature","type":"string","internalType":"string"}],"outputs":[{"name":"worldFunctionSelector","type":"bytes4","internalType":"bytes4"}],"stateMutability":"nonpayable"},{"type":"function","name":"registerStoreHook","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"hookAddress","type":"address","internalType":"contract IStoreHook"},{"name":"enabledHooksBitmap","type":"uint8","internalType":"uint8"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"registerSystem","inputs":[{"name":"systemId","type":"bytes32","internalType":"ResourceId"},{"name":"system","type":"address","internalType":"contract System"},{"name":"publicAccess","type":"bool","internalType":"bool"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"registerSystemHook","inputs":[{"name":"systemId","type":"bytes32","internalType":"ResourceId"},{"name":"hookAddress","type":"address","internalType":"contract ISystemHook"},{"name":"enabledHooksBitmap","type":"uint8","internalType":"uint8"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"registerTable","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"fieldLayout","type":"bytes32","internalType":"FieldLayout"},{"name":"keySchema","type":"bytes32","internalType":"Schema"},{"name":"valueSchema","type":"bytes32","internalType":"Schema"},{"name":"keyNames","type":"string[]","internalType":"string[]"},{"name":"fieldNames","type":"string[]","internalType":"string[]"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"renounceOwnership","inputs":[{"name":"namespaceId","type":"bytes32","internalType":"ResourceId"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"revokeAccess","inputs":[{"name":"resourceId","type":"bytes32","internalType":"ResourceId"},{"name":"grantee","type":"address","internalType":"address"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"setDynamicField","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","internalType":"bytes32[]"},{"name":"dynamicFieldIndex","type":"uint8","internalType":"uint8"},{"name":"data","type":"bytes","internalType":"bytes"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"setField","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","internalType":"bytes32[]"},{"name":"fieldIndex","type":"uint8","internalType":"uint8"},{"name":"data","type":"bytes","internalType":"bytes"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"setField","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","internalType":"bytes32[]"},{"name":"fieldIndex","type":"uint8","internalType":"uint8"},{"name":"data","type":"bytes","internalType":"bytes"},{"name":"fieldLayout","type":"bytes32","internalType":"FieldLayout"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"setRecord","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","internalType":"bytes32[]"},{"name":"staticData","type":"bytes","internalType":"bytes"},{"name":"encodedLengths","type":"bytes32","internalType":"EncodedLengths"},{"name":"dynamicData","type":"bytes","internalType":"bytes"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"setStaticField","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","internalType":"bytes32[]"},{"name":"fieldIndex","type":"uint8","internalType":"uint8"},{"name":"data","type":"bytes","internalType":"bytes"},{"name":"fieldLayout","type":"bytes32","internalType":"FieldLayout"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"spliceDynamicData","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","internalType":"bytes32[]"},{"name":"dynamicFieldIndex","type":"uint8","internalType":"uint8"},{"name":"startWithinField","type":"uint40","internalType":"uint40"},{"name":"deleteCount","type":"uint40","internalType":"uint40"},{"name":"data","type":"bytes","internalType":"bytes"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"spliceStaticData","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","internalType":"bytes32[]"},{"name":"start","type":"uint48","internalType":"uint48"},{"name":"data","type":"bytes","internalType":"bytes"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"storeVersion","inputs":[],"outputs":[{"name":"version","type":"bytes32","internalType":"bytes32"}],"stateMutability":"view"},{"type":"function","name":"transferBalanceToAddress","inputs":[{"name":"fromNamespaceId","type":"bytes32","internalType":"ResourceId"},{"name":"toAddress","type":"address","internalType":"address"},{"name":"amount","type":"uint256","internalType":"uint256"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"transferBalanceToNamespace","inputs":[{"name":"fromNamespaceId","type":"bytes32","internalType":"ResourceId"},{"name":"toNamespaceId","type":"bytes32","internalType":"ResourceId"},{"name":"amount","type":"uint256","internalType":"uint256"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"transferOwnership","inputs":[{"name":"namespaceId","type":"bytes32","internalType":"ResourceId"},{"name":"newOwner","type":"address","internalType":"address"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"unregisterDelegation","inputs":[{"name":"delegatee","type":"address","internalType":"address"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"unregisterNamespaceDelegation","inputs":[{"name":"namespaceId","type":"bytes32","internalType":"ResourceId"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"unregisterStoreHook","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"hookAddress","type":"address","internalType":"contract IStoreHook"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"unregisterSystemHook","inputs":[{"name":"systemId","type":"bytes32","internalType":"ResourceId"},{"name":"hookAddress","type":"address","internalType":"contract ISystemHook"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"worldVersion","inputs":[],"outputs":[{"name":"","type":"bytes32","internalType":"bytes32"}],"stateMutability":"view"},{"type":"event","name":"HelloStore","inputs":[{"name":"storeVersion","type":"bytes32","indexed":true,"internalType":"bytes32"}],"anonymous":false},{"type":"event","name":"HelloWorld","inputs":[{"name":"worldVersion","type":"bytes32","indexed":true,"internalType":"bytes32"}],"anonymous":false},{"type":"event","name":"Store_DeleteRecord","inputs":[{"name":"tableId","type":"bytes32","indexed":true,"internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","indexed":false,"internalType":"bytes32[]"}],"anonymous":false},{"type":"event","name":"Store_SetRecord","inputs":[{"name":"tableId","type":"bytes32","indexed":true,"internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","indexed":false,"internalType":"bytes32[]"},{"name":"staticData","type":"bytes","indexed":false,"internalType":"bytes"},{"name":"encodedLengths","type":"bytes32","indexed":false,"internalType":"EncodedLengths"},{"name":"dynamicData","type":"bytes","indexed":false,"internalType":"bytes"}],"anonymous":false},{"type":"event","name":"Store_SpliceDynamicData","inputs":[{"name":"tableId","type":"bytes32","indexed":true,"internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","indexed":false,"internalType":"bytes32[]"},{"name":"dynamicFieldIndex","type":"uint8","indexed":false,"internalType":"uint8"},{"name":"start","type":"uint48","indexed":false,"internalType":"uint48"},{"name":"deleteCount","type":"uint40","indexed":false,"internalType":"uint40"},{"name":"encodedLengths","type":"bytes32","indexed":false,"internalType":"EncodedLengths"},{"name":"data","type":"bytes","indexed":false,"internalType":"bytes"}],"anonymous":false},{"type":"event","name":"Store_SpliceStaticData","inputs":[{"name":"tableId","type":"bytes32","indexed":true,"internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","indexed":false,"internalType":"bytes32[]"},{"name":"start","type":"uint48","indexed":false,"internalType":"uint48"},{"name":"data","type":"bytes","indexed":false,"internalType":"bytes"}],"anonymous":false},{"type":"error","name":"EncodedLengths_InvalidLength","inputs":[{"name":"length","type":"uint256","internalType":"uint256"}]},{"type":"error","name":"FieldLayout_Empty","inputs":[]},{"type":"error","name":"FieldLayout_InvalidStaticDataLength","inputs":[{"name":"staticDataLength","type":"uint256","internalType":"uint256"},{"name":"computedStaticDataLength","type":"uint256","internalType":"uint256"}]},{"type":"error","name":"FieldLayout_StaticLengthDoesNotFitInAWord","inputs":[{"name":"index","type":"uint256","internalType":"uint256"}]},{"type":"error","name":"FieldLayout_StaticLengthIsNotZero","inputs":[{"name":"index","type":"uint256","internalType":"uint256"}]},{"type":"error","name":"FieldLayout_StaticLengthIsZero","inputs":[{"name":"index","type":"uint256","internalType":"uint256"}]},{"type":"error","name":"FieldLayout_TooManyDynamicFields","inputs":[{"name":"numFields","type":"uint256","internalType":"uint256"},{"name":"maxFields","type":"uint256","internalType":"uint256"}]},{"type":"error","name":"FieldLayout_TooManyFields","inputs":[{"name":"numFields","type":"uint256","internalType":"uint256"},{"name":"maxFields","type":"uint256","internalType":"uint256"}]},{"type":"error","name":"Module_AlreadyInstalled","inputs":[]},{"type":"error","name":"Module_MissingDependency","inputs":[{"name":"dependency","type":"address","internalType":"address"}]},{"type":"error","name":"Module_NonRootInstallNotSupported","inputs":[]},{"type":"error","name":"Module_RootInstallNotSupported","inputs":[]},{"type":"error","name":"Schema_InvalidLength","inputs":[{"name":"length","type":"uint256","internalType":"uint256"}]},{"type":"error","name":"Schema_StaticTypeAfterDynamicType","inputs":[]},{"type":"error","name":"Slice_OutOfBounds","inputs":[{"name":"data","type":"bytes","internalType":"bytes"},{"name":"start","type":"uint256","internalType":"uint256"},{"name":"end","type":"uint256","internalType":"uint256"}]},{"type":"error","name":"Store_IndexOutOfBounds","inputs":[{"name":"length","type":"uint256","internalType":"uint256"},{"name":"accessedIndex","type":"uint256","internalType":"uint256"}]},{"type":"error","name":"Store_InvalidBounds","inputs":[{"name":"start","type":"uint256","internalType":"uint256"},{"name":"end","type":"uint256","internalType":"uint256"}]},{"type":"error","name":"Store_InvalidFieldNamesLength","inputs":[{"name":"expected","type":"uint256","internalType":"uint256"},{"name":"received","type":"uint256","internalType":"uint256"}]},{"type":"error","name":"Store_InvalidKeyNamesLength","inputs":[{"name":"expected","type":"uint256","internalType":"uint256"},{"name":"received","type":"uint256","internalType":"uint256"}]},{"type":"error","name":"Store_InvalidResourceType","inputs":[{"name":"expected","type":"bytes2","internalType":"bytes2"},{"name":"resourceId","type":"bytes32","internalType":"ResourceId"},{"name":"resourceIdString","type":"string","internalType":"string"}]},{"type":"error","name":"Store_InvalidSplice","inputs":[{"name":"startWithinField","type":"uint40","internalType":"uint40"},{"name":"deleteCount","type":"uint40","internalType":"uint40"},{"name":"fieldLength","type":"uint40","internalType":"uint40"}]},{"type":"error","name":"Store_InvalidStaticDataLength","inputs":[{"name":"expected","type":"uint256","internalType":"uint256"},{"name":"received","type":"uint256","internalType":"uint256"}]},{"type":"error","name":"Store_InvalidValueSchemaDynamicLength","inputs":[{"name":"expected","type":"uint256","internalType":"uint256"},{"name":"received","type":"uint256","internalType":"uint256"}]},{"type":"error","name":"Store_InvalidValueSchemaLength","inputs":[{"name":"expected","type":"uint256","internalType":"uint256"},{"name":"received","type":"uint256","internalType":"uint256"}]},{"type":"error","name":"Store_InvalidValueSchemaStaticLength","inputs":[{"name":"expected","type":"uint256","internalType":"uint256"},{"name":"received","type":"uint256","internalType":"uint256"}]},{"type":"error","name":"Store_TableAlreadyExists","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"tableIdString","type":"string","internalType":"string"}]},{"type":"error","name":"Store_TableNotFound","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"tableIdString","type":"string","internalType":"string"}]},{"type":"error","name":"World_AccessDenied","inputs":[{"name":"resource","type":"string","internalType":"string"},{"name":"caller","type":"address","internalType":"address"}]},{"type":"error","name":"World_AlreadyInitialized","inputs":[]},{"type":"error","name":"World_CallbackNotAllowed","inputs":[{"name":"functionSelector","type":"bytes4","internalType":"bytes4"}]},{"type":"error","name":"World_DelegationNotFound","inputs":[{"name":"delegator","type":"address","internalType":"address"},{"name":"delegatee","type":"address","internalType":"address"}]},{"type":"error","name":"World_FunctionSelectorAlreadyExists","inputs":[{"name":"functionSelector","type":"bytes4","internalType":"bytes4"}]},{"type":"error","name":"World_FunctionSelectorNotFound","inputs":[{"name":"functionSelector","type":"bytes4","internalType":"bytes4"}]},{"type":"error","name":"World_InsufficientBalance","inputs":[{"name":"balance","type":"uint256","internalType":"uint256"},{"name":"amount","type":"uint256","internalType":"uint256"}]},{"type":"error","name":"World_InterfaceNotSupported","inputs":[{"name":"contractAddress","type":"address","internalType":"address"},{"name":"interfaceId","type":"bytes4","internalType":"bytes4"}]},{"type":"error","name":"World_InvalidNamespace","inputs":[{"name":"namespace","type":"bytes14","internalType":"bytes14"}]},{"type":"error","name":"World_InvalidResourceId","inputs":[{"name":"resourceId","type":"bytes32","internalType":"ResourceId"},{"name":"resourceIdString","type":"string","internalType":"string"}]},{"type":"error","name":"World_InvalidResourceType","inputs":[{"name":"expected","type":"bytes2","internalType":"bytes2"},{"name":"resourceId","type":"bytes32","internalType":"ResourceId"},{"name":"resourceIdString","type":"string","internalType":"string"}]},{"type":"error","name":"World_ResourceAlreadyExists","inputs":[{"name":"resourceId","type":"bytes32","internalType":"ResourceId"},{"name":"resourceIdString","type":"string","internalType":"string"}]},{"type":"error","name":"World_ResourceNotFound","inputs":[{"name":"resourceId","type":"bytes32","internalType":"ResourceId"},{"name":"resourceIdString","type":"string","internalType":"string"}]},{"type":"error","name":"World_SystemAlreadyExists","inputs":[{"name":"system","type":"address","internalType":"address"}]},{"type":"error","name":"World_UnlimitedDelegationNotAllowed","inputs":[]}],"bytecode":{"object":"0x","sourceMap":"","linkReferences":{}},"deployedBytecode":{"object":"0x","sourceMap":"","linkReferences":{}},"methodIdentifiers":{"UD__createItem(uint8,uint256,string,bytes)":"72e9b77b","UD__enterGame(uint256)":"cc0f1ab7","UD__getCharacterStats(uint256)":"e1ecef13","UD__getCharacterToken()":"49d8cf02","UD__getClass(uint256)":"5758128c","UD__getEntropy()":"b5c691c7","UD__getExperience(uint256)":"8bc01bf0","UD__getGoldToken()":"8b994e32","UD__getItemsContract()":"997f897a","UD__getName(uint256)":"cf36b62e","UD__getOwner(uint256)":"ef89f17a","UD__getPythProvider()":"e24cefd9","UD__getTotalSupply(uint256)":"37007d40","UD__getWeaponStats(uint256)":"810c1dc1","UD__issueStarterItems(uint256)":"ce2d5a9a","UD__mintCharacter(address,bytes32,string)":"d408a43b","UD__rollStats(bytes32,uint256,uint8)":"1cf705d7","UD__setStarterItems(uint8,uint256[],uint256[])":"2f97d48f","UD__setTokenUri(uint256,string)":"d6556009","batchCall((bytes32,bytes)[])":"ce5e8dd9","batchCallFrom((address,bytes32,bytes)[])":"8fc8cf7e","call(bytes32,bytes)":"3ae7af08","callFrom(address,bytes32,bytes)":"894ecc58","creator()":"02d05d3f","deleteRecord(bytes32,bytes32[])":"505a181d","getDynamicField(bytes32,bytes32[],uint8)":"1e788977","getDynamicFieldLength(bytes32,bytes32[],uint8)":"dbbf0e21","getDynamicFieldSlice(bytes32,bytes32[],uint8,uint256,uint256)":"4dc77d97","getField(bytes32,bytes32[],uint8)":"d03edb8c","getField(bytes32,bytes32[],uint8,bytes32)":"05242d2f","getFieldLayout(bytes32)":"3a77c2c2","getFieldLength(bytes32,bytes32[],uint8)":"a53417ed","getFieldLength(bytes32,bytes32[],uint8,bytes32)":"9f1fcf0a","getKeySchema(bytes32)":"d4285dc2","getRecord(bytes32,bytes32[])":"cc49db7e","getRecord(bytes32,bytes32[],bytes32)":"419b58fd","getStaticField(bytes32,bytes32[],uint8,bytes32)":"8c364d59","getValueSchema(bytes32)":"e228a4a3","grantAccess(bytes32,address)":"40554c3a","initialize(address)":"c4d66de8","installModule(address,bytes)":"8da798da","installRootModule(address,bytes)":"af068c9e","popFromDynamicField(bytes32,bytes32[],uint8,uint256)":"d9c03a04","pushToDynamicField(bytes32,bytes32[],uint8,bytes)":"150f3262","registerDelegation(address,bytes32,bytes)":"1d2257ba","registerFunctionSelector(bytes32,string)":"26d98102","registerNamespace(bytes32)":"b29e4089","registerNamespaceDelegation(bytes32,bytes32,bytes)":"bfdfaff7","registerRootFunctionSelector(bytes32,string,string)":"6548a90a","registerStoreHook(bytes32,address,uint8)":"530f4b60","registerSystem(bytes32,address,bool)":"3350b6a9","registerSystemHook(bytes32,address,uint8)":"d5f8337f","registerTable(bytes32,bytes32,bytes32,bytes32,string[],string[])":"0ba51f49","renounceOwnership(bytes32)":"219adc2e","revokeAccess(bytes32,address)":"8d53b208","setDynamicField(bytes32,bytes32[],uint8,bytes)":"ef6ea862","setField(bytes32,bytes32[],uint8,bytes)":"114a7266","setField(bytes32,bytes32[],uint8,bytes,bytes32)":"3708196e","setRecord(bytes32,bytes32[],bytes,bytes32,bytes)":"298314fb","setStaticField(bytes32,bytes32[],uint8,bytes,bytes32)":"390baae0","spliceDynamicData(bytes32,bytes32[],uint8,uint40,uint40,bytes)":"c0a2895a","spliceStaticData(bytes32,bytes32[],uint48,bytes)":"b047c1eb","storeVersion()":"c1122229","transferBalanceToAddress(bytes32,address,uint256)":"45afd199","transferBalanceToNamespace(bytes32,bytes32,uint256)":"c9c85a60","transferOwnership(bytes32,address)":"ef5d6bbb","unregisterDelegation(address)":"cdc938c5","unregisterNamespaceDelegation(bytes32)":"aa66e9c8","unregisterStoreHook(bytes32,address)":"05609129","unregisterSystemHook(bytes32,address)":"a92813ad","worldVersion()":"6951955d"},"rawMetadata":"{\"compiler\":{\"version\":\"0.8.24+commit.e11b9ed9\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"length\",\"type\":\"uint256\"}],\"name\":\"EncodedLengths_InvalidLength\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"FieldLayout_Empty\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"staticDataLength\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"computedStaticDataLength\",\"type\":\"uint256\"}],\"name\":\"FieldLayout_InvalidStaticDataLength\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"FieldLayout_StaticLengthDoesNotFitInAWord\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"FieldLayout_StaticLengthIsNotZero\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"FieldLayout_StaticLengthIsZero\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"numFields\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxFields\",\"type\":\"uint256\"}],\"name\":\"FieldLayout_TooManyDynamicFields\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"numFields\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxFields\",\"type\":\"uint256\"}],\"name\":\"FieldLayout_TooManyFields\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"Module_AlreadyInstalled\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"dependency\",\"type\":\"address\"}],\"name\":\"Module_MissingDependency\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"Module_NonRootInstallNotSupported\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"Module_RootInstallNotSupported\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"length\",\"type\":\"uint256\"}],\"name\":\"Schema_InvalidLength\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"Schema_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\":\"length\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"accessedIndex\",\"type\":\"uint256\"}],\"name\":\"Store_IndexOutOfBounds\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"start\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"end\",\"type\":\"uint256\"}],\"name\":\"Store_InvalidBounds\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"expected\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"received\",\"type\":\"uint256\"}],\"name\":\"Store_InvalidFieldNamesLength\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"expected\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"received\",\"type\":\"uint256\"}],\"name\":\"Store_InvalidKeyNamesLength\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes2\",\"name\":\"expected\",\"type\":\"bytes2\"},{\"internalType\":\"ResourceId\",\"name\":\"resourceId\",\"type\":\"bytes32\"},{\"internalType\":\"string\",\"name\":\"resourceIdString\",\"type\":\"string\"}],\"name\":\"Store_InvalidResourceType\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint40\",\"name\":\"startWithinField\",\"type\":\"uint40\"},{\"internalType\":\"uint40\",\"name\":\"deleteCount\",\"type\":\"uint40\"},{\"internalType\":\"uint40\",\"name\":\"fieldLength\",\"type\":\"uint40\"}],\"name\":\"Store_InvalidSplice\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"expected\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"received\",\"type\":\"uint256\"}],\"name\":\"Store_InvalidStaticDataLength\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"expected\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"received\",\"type\":\"uint256\"}],\"name\":\"Store_InvalidValueSchemaDynamicLength\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"expected\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"received\",\"type\":\"uint256\"}],\"name\":\"Store_InvalidValueSchemaLength\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"expected\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"received\",\"type\":\"uint256\"}],\"name\":\"Store_InvalidValueSchemaStaticLength\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"tableId\",\"type\":\"bytes32\"},{\"internalType\":\"string\",\"name\":\"tableIdString\",\"type\":\"string\"}],\"name\":\"Store_TableAlreadyExists\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"tableId\",\"type\":\"bytes32\"},{\"internalType\":\"string\",\"name\":\"tableIdString\",\"type\":\"string\"}],\"name\":\"Store_TableNotFound\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"resource\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"}],\"name\":\"World_AccessDenied\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"World_AlreadyInitialized\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"functionSelector\",\"type\":\"bytes4\"}],\"name\":\"World_CallbackNotAllowed\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"delegator\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"delegatee\",\"type\":\"address\"}],\"name\":\"World_DelegationNotFound\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"functionSelector\",\"type\":\"bytes4\"}],\"name\":\"World_FunctionSelectorAlreadyExists\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"functionSelector\",\"type\":\"bytes4\"}],\"name\":\"World_FunctionSelectorNotFound\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"balance\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"World_InsufficientBalance\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"contractAddress\",\"type\":\"address\"},{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"World_InterfaceNotSupported\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes14\",\"name\":\"namespace\",\"type\":\"bytes14\"}],\"name\":\"World_InvalidNamespace\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"resourceId\",\"type\":\"bytes32\"},{\"internalType\":\"string\",\"name\":\"resourceIdString\",\"type\":\"string\"}],\"name\":\"World_InvalidResourceId\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes2\",\"name\":\"expected\",\"type\":\"bytes2\"},{\"internalType\":\"ResourceId\",\"name\":\"resourceId\",\"type\":\"bytes32\"},{\"internalType\":\"string\",\"name\":\"resourceIdString\",\"type\":\"string\"}],\"name\":\"World_InvalidResourceType\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"resourceId\",\"type\":\"bytes32\"},{\"internalType\":\"string\",\"name\":\"resourceIdString\",\"type\":\"string\"}],\"name\":\"World_ResourceAlreadyExists\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"resourceId\",\"type\":\"bytes32\"},{\"internalType\":\"string\",\"name\":\"resourceIdString\",\"type\":\"string\"}],\"name\":\"World_ResourceNotFound\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"system\",\"type\":\"address\"}],\"name\":\"World_SystemAlreadyExists\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"World_UnlimitedDelegationNotAllowed\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"storeVersion\",\"type\":\"bytes32\"}],\"name\":\"HelloStore\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"worldVersion\",\"type\":\"bytes32\"}],\"name\":\"HelloWorld\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"ResourceId\",\"name\":\"tableId\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32[]\",\"name\":\"keyTuple\",\"type\":\"bytes32[]\"}],\"name\":\"Store_DeleteRecord\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"ResourceId\",\"name\":\"tableId\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32[]\",\"name\":\"keyTuple\",\"type\":\"bytes32[]\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"staticData\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"EncodedLengths\",\"name\":\"encodedLengths\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"dynamicData\",\"type\":\"bytes\"}],\"name\":\"Store_SetRecord\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"ResourceId\",\"name\":\"tableId\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32[]\",\"name\":\"keyTuple\",\"type\":\"bytes32[]\"},{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"dynamicFieldIndex\",\"type\":\"uint8\"},{\"indexed\":false,\"internalType\":\"uint48\",\"name\":\"start\",\"type\":\"uint48\"},{\"indexed\":false,\"internalType\":\"uint40\",\"name\":\"deleteCount\",\"type\":\"uint40\"},{\"indexed\":false,\"internalType\":\"EncodedLengths\",\"name\":\"encodedLengths\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"Store_SpliceDynamicData\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"ResourceId\",\"name\":\"tableId\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32[]\",\"name\":\"keyTuple\",\"type\":\"bytes32[]\"},{\"indexed\":false,\"internalType\":\"uint48\",\"name\":\"start\",\"type\":\"uint48\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"Store_SpliceStaticData\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"enum ItemType\",\"name\":\"itemType\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"supply\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"itemMetadataURI\",\"type\":\"string\"},{\"internalType\":\"bytes\",\"name\":\"stats\",\"type\":\"bytes\"}],\"name\":\"UD__createItem\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"characterId\",\"type\":\"uint256\"}],\"name\":\"UD__enterGame\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"characterId\",\"type\":\"uint256\"}],\"name\":\"UD__getCharacterStats\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"strength\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"agility\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"intelligence\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"hitPoints\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"experience\",\"type\":\"uint256\"}],\"internalType\":\"struct CharacterStatsData\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"UD__getCharacterToken\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"_characterToken\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"characterId\",\"type\":\"uint256\"}],\"name\":\"UD__getClass\",\"outputs\":[{\"internalType\":\"enum Classes\",\"name\":\"_class\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"UD__getEntropy\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"_entropy\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"characterId\",\"type\":\"uint256\"}],\"name\":\"UD__getExperience\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"UD__getGoldToken\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"_goldToken\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"UD__getItemsContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"_erc1155\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"characterId\",\"type\":\"uint256\"}],\"name\":\"UD__getName\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"_name\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"characterId\",\"type\":\"uint256\"}],\"name\":\"UD__getOwner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"UD__getPythProvider\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"_provider\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"UD__getTotalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_supply\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"itemId\",\"type\":\"uint256\"}],\"name\":\"UD__getWeaponStats\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"damage\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"speed\",\"type\":\"uint256\"},{\"internalType\":\"uint8[]\",\"name\":\"classRestrictions\",\"type\":\"uint8[]\"}],\"internalType\":\"struct WeaponStats\",\"name\":\"_weaponStats\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"characterId\",\"type\":\"uint256\"}],\"name\":\"UD__issueStarterItems\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"name\",\"type\":\"bytes32\"},{\"internalType\":\"string\",\"name\":\"tokenUri\",\"type\":\"string\"}],\"name\":\"UD__mintCharacter\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"characterId\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"userRandomNumber\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"characterId\",\"type\":\"uint256\"},{\"internalType\":\"enum Classes\",\"name\":\"class\",\"type\":\"uint8\"}],\"name\":\"UD__rollStats\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"enum Classes\",\"name\":\"class\",\"type\":\"uint8\"},{\"internalType\":\"uint256[]\",\"name\":\"itemIds\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"name\":\"UD__setStarterItems\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"tokenUri\",\"type\":\"string\"}],\"name\":\"UD__setTokenUri\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"ResourceId\",\"name\":\"systemId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"callData\",\"type\":\"bytes\"}],\"internalType\":\"struct SystemCallData[]\",\"name\":\"systemCalls\",\"type\":\"tuple[]\"}],\"name\":\"batchCall\",\"outputs\":[{\"internalType\":\"bytes[]\",\"name\":\"returnDatas\",\"type\":\"bytes[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"ResourceId\",\"name\":\"systemId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"callData\",\"type\":\"bytes\"}],\"internalType\":\"struct SystemCallFromData[]\",\"name\":\"systemCalls\",\"type\":\"tuple[]\"}],\"name\":\"batchCallFrom\",\"outputs\":[{\"internalType\":\"bytes[]\",\"name\":\"returnDatas\",\"type\":\"bytes[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"systemId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"callData\",\"type\":\"bytes\"}],\"name\":\"call\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"delegator\",\"type\":\"address\"},{\"internalType\":\"ResourceId\",\"name\":\"systemId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"callData\",\"type\":\"bytes\"}],\"name\":\"callFrom\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"creator\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"tableId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"keyTuple\",\"type\":\"bytes32[]\"}],\"name\":\"deleteRecord\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"tableId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"keyTuple\",\"type\":\"bytes32[]\"},{\"internalType\":\"uint8\",\"name\":\"dynamicFieldIndex\",\"type\":\"uint8\"}],\"name\":\"getDynamicField\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"tableId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"keyTuple\",\"type\":\"bytes32[]\"},{\"internalType\":\"uint8\",\"name\":\"dynamicFieldIndex\",\"type\":\"uint8\"}],\"name\":\"getDynamicFieldLength\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"tableId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"keyTuple\",\"type\":\"bytes32[]\"},{\"internalType\":\"uint8\",\"name\":\"dynamicFieldIndex\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"start\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"end\",\"type\":\"uint256\"}],\"name\":\"getDynamicFieldSlice\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"tableId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"keyTuple\",\"type\":\"bytes32[]\"},{\"internalType\":\"uint8\",\"name\":\"fieldIndex\",\"type\":\"uint8\"},{\"internalType\":\"FieldLayout\",\"name\":\"fieldLayout\",\"type\":\"bytes32\"}],\"name\":\"getField\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"tableId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"keyTuple\",\"type\":\"bytes32[]\"},{\"internalType\":\"uint8\",\"name\":\"fieldIndex\",\"type\":\"uint8\"}],\"name\":\"getField\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"tableId\",\"type\":\"bytes32\"}],\"name\":\"getFieldLayout\",\"outputs\":[{\"internalType\":\"FieldLayout\",\"name\":\"fieldLayout\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"tableId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"keyTuple\",\"type\":\"bytes32[]\"},{\"internalType\":\"uint8\",\"name\":\"fieldIndex\",\"type\":\"uint8\"},{\"internalType\":\"FieldLayout\",\"name\":\"fieldLayout\",\"type\":\"bytes32\"}],\"name\":\"getFieldLength\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"tableId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"keyTuple\",\"type\":\"bytes32[]\"},{\"internalType\":\"uint8\",\"name\":\"fieldIndex\",\"type\":\"uint8\"}],\"name\":\"getFieldLength\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"tableId\",\"type\":\"bytes32\"}],\"name\":\"getKeySchema\",\"outputs\":[{\"internalType\":\"Schema\",\"name\":\"keySchema\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"tableId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"keyTuple\",\"type\":\"bytes32[]\"},{\"internalType\":\"FieldLayout\",\"name\":\"fieldLayout\",\"type\":\"bytes32\"}],\"name\":\"getRecord\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"staticData\",\"type\":\"bytes\"},{\"internalType\":\"EncodedLengths\",\"name\":\"encodedLengths\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"dynamicData\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"tableId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"keyTuple\",\"type\":\"bytes32[]\"}],\"name\":\"getRecord\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"staticData\",\"type\":\"bytes\"},{\"internalType\":\"EncodedLengths\",\"name\":\"encodedLengths\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"dynamicData\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"tableId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"keyTuple\",\"type\":\"bytes32[]\"},{\"internalType\":\"uint8\",\"name\":\"fieldIndex\",\"type\":\"uint8\"},{\"internalType\":\"FieldLayout\",\"name\":\"fieldLayout\",\"type\":\"bytes32\"}],\"name\":\"getStaticField\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"tableId\",\"type\":\"bytes32\"}],\"name\":\"getValueSchema\",\"outputs\":[{\"internalType\":\"Schema\",\"name\":\"valueSchema\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"resourceId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"grantee\",\"type\":\"address\"}],\"name\":\"grantAccess\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IModule\",\"name\":\"initModule\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IModule\",\"name\":\"module\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"encodedArgs\",\"type\":\"bytes\"}],\"name\":\"installModule\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IModule\",\"name\":\"module\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"encodedArgs\",\"type\":\"bytes\"}],\"name\":\"installRootModule\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"tableId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"keyTuple\",\"type\":\"bytes32[]\"},{\"internalType\":\"uint8\",\"name\":\"dynamicFieldIndex\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"byteLengthToPop\",\"type\":\"uint256\"}],\"name\":\"popFromDynamicField\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"tableId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"keyTuple\",\"type\":\"bytes32[]\"},{\"internalType\":\"uint8\",\"name\":\"dynamicFieldIndex\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"dataToPush\",\"type\":\"bytes\"}],\"name\":\"pushToDynamicField\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"delegatee\",\"type\":\"address\"},{\"internalType\":\"ResourceId\",\"name\":\"delegationControlId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"initCallData\",\"type\":\"bytes\"}],\"name\":\"registerDelegation\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"systemId\",\"type\":\"bytes32\"},{\"internalType\":\"string\",\"name\":\"systemFunctionSignature\",\"type\":\"string\"}],\"name\":\"registerFunctionSelector\",\"outputs\":[{\"internalType\":\"bytes4\",\"name\":\"worldFunctionSelector\",\"type\":\"bytes4\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"namespaceId\",\"type\":\"bytes32\"}],\"name\":\"registerNamespace\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"namespaceId\",\"type\":\"bytes32\"},{\"internalType\":\"ResourceId\",\"name\":\"delegationControlId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"initCallData\",\"type\":\"bytes\"}],\"name\":\"registerNamespaceDelegation\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"systemId\",\"type\":\"bytes32\"},{\"internalType\":\"string\",\"name\":\"worldFunctionSignature\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"systemFunctionSignature\",\"type\":\"string\"}],\"name\":\"registerRootFunctionSelector\",\"outputs\":[{\"internalType\":\"bytes4\",\"name\":\"worldFunctionSelector\",\"type\":\"bytes4\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"tableId\",\"type\":\"bytes32\"},{\"internalType\":\"contract IStoreHook\",\"name\":\"hookAddress\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"enabledHooksBitmap\",\"type\":\"uint8\"}],\"name\":\"registerStoreHook\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"systemId\",\"type\":\"bytes32\"},{\"internalType\":\"contract System\",\"name\":\"system\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"publicAccess\",\"type\":\"bool\"}],\"name\":\"registerSystem\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"systemId\",\"type\":\"bytes32\"},{\"internalType\":\"contract ISystemHook\",\"name\":\"hookAddress\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"enabledHooksBitmap\",\"type\":\"uint8\"}],\"name\":\"registerSystemHook\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"tableId\",\"type\":\"bytes32\"},{\"internalType\":\"FieldLayout\",\"name\":\"fieldLayout\",\"type\":\"bytes32\"},{\"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\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"namespaceId\",\"type\":\"bytes32\"}],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"resourceId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"grantee\",\"type\":\"address\"}],\"name\":\"revokeAccess\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"tableId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"keyTuple\",\"type\":\"bytes32[]\"},{\"internalType\":\"uint8\",\"name\":\"dynamicFieldIndex\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"setDynamicField\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"tableId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"keyTuple\",\"type\":\"bytes32[]\"},{\"internalType\":\"uint8\",\"name\":\"fieldIndex\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"setField\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"tableId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"keyTuple\",\"type\":\"bytes32[]\"},{\"internalType\":\"uint8\",\"name\":\"fieldIndex\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"FieldLayout\",\"name\":\"fieldLayout\",\"type\":\"bytes32\"}],\"name\":\"setField\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"tableId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"keyTuple\",\"type\":\"bytes32[]\"},{\"internalType\":\"bytes\",\"name\":\"staticData\",\"type\":\"bytes\"},{\"internalType\":\"EncodedLengths\",\"name\":\"encodedLengths\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"dynamicData\",\"type\":\"bytes\"}],\"name\":\"setRecord\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"tableId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"keyTuple\",\"type\":\"bytes32[]\"},{\"internalType\":\"uint8\",\"name\":\"fieldIndex\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"FieldLayout\",\"name\":\"fieldLayout\",\"type\":\"bytes32\"}],\"name\":\"setStaticField\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"tableId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"keyTuple\",\"type\":\"bytes32[]\"},{\"internalType\":\"uint8\",\"name\":\"dynamicFieldIndex\",\"type\":\"uint8\"},{\"internalType\":\"uint40\",\"name\":\"startWithinField\",\"type\":\"uint40\"},{\"internalType\":\"uint40\",\"name\":\"deleteCount\",\"type\":\"uint40\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"spliceDynamicData\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"tableId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"keyTuple\",\"type\":\"bytes32[]\"},{\"internalType\":\"uint48\",\"name\":\"start\",\"type\":\"uint48\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"spliceStaticData\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"storeVersion\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"version\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"fromNamespaceId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"toAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transferBalanceToAddress\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"fromNamespaceId\",\"type\":\"bytes32\"},{\"internalType\":\"ResourceId\",\"name\":\"toNamespaceId\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transferBalanceToNamespace\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"namespaceId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"delegatee\",\"type\":\"address\"}],\"name\":\"unregisterDelegation\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"namespaceId\",\"type\":\"bytes32\"}],\"name\":\"unregisterNamespaceDelegation\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"tableId\",\"type\":\"bytes32\"},{\"internalType\":\"contract IStoreHook\",\"name\":\"hookAddress\",\"type\":\"address\"}],\"name\":\"unregisterStoreHook\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"ResourceId\",\"name\":\"systemId\",\"type\":\"bytes32\"},{\"internalType\":\"contract ISystemHook\",\"name\":\"hookAddress\",\"type\":\"address\"}],\"name\":\"unregisterSystemHook\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"worldVersion\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"MUD (https://mud.dev) by Lattice (https://lattice.xyz)\",\"details\":\"This is an autogenerated file; do not edit manually.\",\"errors\":{\"EncodedLengths_InvalidLength(uint256)\":[{\"params\":{\"length\":\"The length of the encoded lengths.\"}}],\"FieldLayout_InvalidStaticDataLength(uint256,uint256)\":[{\"params\":{\"computedStaticDataLength\":\"The computed static data length.\",\"staticDataLength\":\"The static data length of the field layout.\"}}],\"FieldLayout_StaticLengthDoesNotFitInAWord(uint256)\":[{\"params\":{\"index\":\"The index of the field.\"}}],\"FieldLayout_StaticLengthIsNotZero(uint256)\":[{\"params\":{\"index\":\"The index of the field.\"}}],\"FieldLayout_StaticLengthIsZero(uint256)\":[{\"params\":{\"index\":\"The index of the field.\"}}],\"FieldLayout_TooManyDynamicFields(uint256,uint256)\":[{\"params\":{\"maxFields\":\"The maximum number of fields a Schema can handle.\",\"numFields\":\"The total number of fields in the field layout.\"}}],\"FieldLayout_TooManyFields(uint256,uint256)\":[{\"params\":{\"maxFields\":\"The maximum number of fields a Schema can handle.\",\"numFields\":\"The total number of fields in the field layout.\"}}],\"Module_MissingDependency(address)\":[{\"params\":{\"dependency\":\"The address of the dependency.\"}}],\"Schema_InvalidLength(uint256)\":[{\"params\":{\"length\":\"The length of the schema.\"}}],\"Slice_OutOfBounds(bytes,uint256,uint256)\":[{\"details\":\"Raised if `start` is greater than `end` or `end` greater than the length of `data`.\",\"params\":{\"data\":\"The bytes array to subslice.\",\"end\":\"The end index for the subslice.\",\"start\":\"The start index for the subslice.\"}}],\"Store_IndexOutOfBounds(uint256,uint256)\":[{\"details\":\"Raised if the start index is larger than the previous length of the field.\",\"params\":{\"accessedIndex\":\"FIXME\",\"length\":\"FIXME\"}}],\"Store_InvalidBounds(uint256,uint256)\":[{\"params\":{\"end\":\"The end index within the dynamic field for the slice operation (exclusive).\",\"start\":\"The start index within the dynamic field for the slice operation (inclusive).\"}}],\"Store_InvalidFieldNamesLength(uint256,uint256)\":[{\"params\":{\"expected\":\"The expected length.\",\"received\":\"The provided length.\"}}],\"Store_InvalidKeyNamesLength(uint256,uint256)\":[{\"params\":{\"expected\":\"The expected length.\",\"received\":\"The provided length.\"}}],\"Store_InvalidResourceType(bytes2,bytes32,string)\":[{\"params\":{\"expected\":\"The expected resource type.\",\"resourceId\":\"The resource ID.\",\"resourceIdString\":\"The stringified resource ID (for easier debugging).\"}}],\"Store_InvalidSplice(uint40,uint40,uint40)\":[{\"details\":\"Raised if the splice total length of the field is changed but the splice is not at the end of the field.\",\"params\":{\"deleteCount\":\"The number of bytes to delete in the splice operation.\",\"fieldLength\":\"The field length for the splice operation.\",\"startWithinField\":\"The start index within the field for the splice operation.\"}}],\"Store_InvalidStaticDataLength(uint256,uint256)\":[{\"params\":{\"expected\":\"The expected length.\",\"received\":\"The provided length.\"}}],\"Store_InvalidValueSchemaDynamicLength(uint256,uint256)\":[{\"params\":{\"expected\":\"The expected length.\",\"received\":\"The provided length.\"}}],\"Store_InvalidValueSchemaLength(uint256,uint256)\":[{\"params\":{\"expected\":\"The expected length.\",\"received\":\"The provided length.\"}}],\"Store_InvalidValueSchemaStaticLength(uint256,uint256)\":[{\"params\":{\"expected\":\"The expected length.\",\"received\":\"The provided length.\"}}],\"Store_TableAlreadyExists(bytes32,string)\":[{\"params\":{\"tableId\":\"The ID of the table.\",\"tableIdString\":\"The stringified ID of the table (for easier debugging if cleartext tableIds are used).\"}}],\"Store_TableNotFound(bytes32,string)\":[{\"params\":{\"tableId\":\"The ID of the table.\",\"tableIdString\":\"The stringified ID of the table (for easier debugging if cleartext tableIds are used).\"}}],\"World_AccessDenied(string,address)\":[{\"params\":{\"caller\":\"The address of the user trying to access the resource.\",\"resource\":\"The resource's identifier.\"}}],\"World_CallbackNotAllowed(bytes4)\":[{\"params\":{\"functionSelector\":\"The function selector of the disallowed callback.\"}}],\"World_DelegationNotFound(address,address)\":[{\"params\":{\"delegatee\":\"The address of the delegatee.\",\"delegator\":\"The address of the delegator.\"}}],\"World_FunctionSelectorAlreadyExists(bytes4)\":[{\"params\":{\"functionSelector\":\"The function selector in question.\"}}],\"World_FunctionSelectorNotFound(bytes4)\":[{\"params\":{\"functionSelector\":\"The function selector in question.\"}}],\"World_InsufficientBalance(uint256,uint256)\":[{\"params\":{\"amount\":\"The amount needed.\",\"balance\":\"The current balance.\"}}],\"World_InterfaceNotSupported(address,bytes4)\":[{\"params\":{\"contractAddress\":\"The address of the contract in question.\",\"interfaceId\":\"The ID of the interface.\"}}],\"World_InvalidNamespace(bytes14)\":[{\"params\":{\"namespace\":\"The invalid namespace.\"}}],\"World_InvalidResourceId(bytes32,string)\":[{\"params\":{\"resourceId\":\"The ID of the resource.\",\"resourceIdString\":\"The string representation of the resource ID.\"}}],\"World_InvalidResourceType(bytes2,bytes32,string)\":[{\"params\":{\"expected\":\"The expected resource type.\",\"resourceId\":\"The ID of the resource.\",\"resourceIdString\":\"The string representation of the resource ID.\"}}],\"World_ResourceAlreadyExists(bytes32,string)\":[{\"params\":{\"resourceId\":\"The ID of the resource.\",\"resourceIdString\":\"The string representation of the resource ID.\"}}],\"World_ResourceNotFound(bytes32,string)\":[{\"params\":{\"resourceId\":\"The ID of the resource.\",\"resourceIdString\":\"The string representation of the resource ID.\"}}],\"World_SystemAlreadyExists(address)\":[{\"params\":{\"system\":\"The address of the system.\"}}]},\"events\":{\"HelloStore(bytes32)\":{\"params\":{\"storeVersion\":\"The protocol version of the Store.\"}},\"HelloWorld(bytes32)\":{\"params\":{\"worldVersion\":\"The protocol version of the World.\"}},\"Store_DeleteRecord(bytes32,bytes32[])\":{\"params\":{\"keyTuple\":\"An array representing the composite key for the record.\",\"tableId\":\"The ID of the table where the record is deleted.\"}},\"Store_SetRecord(bytes32,bytes32[],bytes,bytes32,bytes)\":{\"params\":{\"dynamicData\":\"The dynamic data of the record.\",\"encodedLengths\":\"The encoded lengths of the dynamic data of the record.\",\"keyTuple\":\"An array representing the composite key for the record.\",\"staticData\":\"The static data of the record.\",\"tableId\":\"The ID of the table where the record is set.\"}},\"Store_SpliceDynamicData(bytes32,bytes32[],uint8,uint48,uint40,bytes32,bytes)\":{\"params\":{\"data\":\"The data to insert into the dynamic data of the record at the start byte.\",\"deleteCount\":\"The number of bytes to delete in the splice operation.\",\"dynamicFieldIndex\":\"The index of the dynamic field to splice data, relative to the start of the dynamic fields. (Dynamic field index = field index - number of static fields)\",\"encodedLengths\":\"The encoded lengths of the dynamic data of the record.\",\"keyTuple\":\"An array representing the composite key for the record.\",\"start\":\"The start position in bytes for the splice operation.\",\"tableId\":\"The ID of the table where the data is spliced.\"}},\"Store_SpliceStaticData(bytes32,bytes32[],uint48,bytes)\":{\"details\":\"In static data, data is always overwritten starting at the start position, so the total length of the data remains the same and no data is shifted.\",\"params\":{\"data\":\"The data to write to the static data of the record at the start byte.\",\"keyTuple\":\"An array representing the key for the record.\",\"start\":\"The start position in bytes for the splice operation.\",\"tableId\":\"The ID of the table where the data is spliced.\"}}},\"kind\":\"dev\",\"methods\":{\"call(bytes32,bytes)\":{\"details\":\"If the system is not public, the caller must have access to the namespace or name (encoded in the system ID).\",\"params\":{\"callData\":\"The data to pass with the call, function selector (4 bytes) followed by the ABI encoded parameters.\",\"systemId\":\"The ID of the system to be called.\"},\"returns\":{\"_0\":\"The abi encoded return data from the called system.\"}},\"callFrom(address,bytes32,bytes)\":{\"details\":\"If the system is not public, the delegator must have access to the namespace or name (encoded in the system ID).\",\"params\":{\"callData\":\"The data to pass with the call, function selector (4 bytes) followed by the ABI encoded parameters.\",\"delegator\":\"The address on whose behalf the call is made.\",\"systemId\":\"The ID of the system to be called.\"},\"returns\":{\"_0\":\"The abi encoded return data from the called system.\"}},\"creator()\":{\"returns\":{\"_0\":\"The address of the World's creator.\"}},\"initialize(address)\":{\"details\":\"Can only be called once by the creator.\",\"params\":{\"initModule\":\"The InitModule to be installed during initialization.\"}},\"installRootModule(address,bytes)\":{\"details\":\"Requires the caller to own the root namespace. The module is delegatecalled and installed in the root namespace.\",\"params\":{\"encodedArgs\":\"The ABI encoded arguments for the module installation.\",\"module\":\"The module to be installed.\"}},\"storeVersion()\":{\"returns\":{\"version\":\"The protocol version of the Store contract.\"}},\"worldVersion()\":{\"returns\":{\"_0\":\"The protocol version of the World.\"}}},\"title\":\"IWorld\",\"version\":1},\"userdoc\":{\"errors\":{\"EncodedLengths_InvalidLength(uint256)\":[{\"notice\":\"Error raised when the provided encoded lengths has an invalid length.\"}],\"FieldLayout_Empty()\":[{\"notice\":\"Error raised when the provided field layout is empty.\"}],\"FieldLayout_InvalidStaticDataLength(uint256,uint256)\":[{\"notice\":\"Error raised when the provided field layout has an invalid static data length.\"}],\"FieldLayout_StaticLengthDoesNotFitInAWord(uint256)\":[{\"notice\":\"Error raised when the provided field layout has a static data length that does not fit in a word (32 bytes).\"}],\"FieldLayout_StaticLengthIsNotZero(uint256)\":[{\"notice\":\"Error raised when the provided field layout has a nonzero static data length.\"}],\"FieldLayout_StaticLengthIsZero(uint256)\":[{\"notice\":\"Error raised when the provided field layout has a static data length of zero.\"}],\"FieldLayout_TooManyDynamicFields(uint256,uint256)\":[{\"notice\":\"Error raised when the provided field layout has too many dynamic fields.\"}],\"FieldLayout_TooManyFields(uint256,uint256)\":[{\"notice\":\"Error raised when the provided field layout has too many fields.\"}],\"Module_AlreadyInstalled()\":[{\"notice\":\"Error raised if the provided module is already installed.\"}],\"Module_MissingDependency(address)\":[{\"notice\":\"Error raised if the provided module is missing a dependency.\"}],\"Module_NonRootInstallNotSupported()\":[{\"notice\":\"Error raised if installing in non-root is not supported.\"}],\"Module_RootInstallNotSupported()\":[{\"notice\":\"Error raised if installing in root is not supported.\"}],\"Schema_InvalidLength(uint256)\":[{\"notice\":\"Error raised when the provided schema has an invalid length.\"}],\"Schema_StaticTypeAfterDynamicType()\":[{\"notice\":\"Error raised when a static type is placed after a dynamic type in a schema.\"}],\"Slice_OutOfBounds(bytes,uint256,uint256)\":[{\"notice\":\"Error raised when the provided slice is out of bounds.\"}],\"Store_IndexOutOfBounds(uint256,uint256)\":[{\"notice\":\"Error raised if the provided index is out of bounds.\"}],\"Store_InvalidBounds(uint256,uint256)\":[{\"notice\":\"Error raised if the provided slice bounds are invalid.\"}],\"Store_InvalidFieldNamesLength(uint256,uint256)\":[{\"notice\":\"Error raised if the provided field names length is invalid.\"}],\"Store_InvalidKeyNamesLength(uint256,uint256)\":[{\"notice\":\"Error raised if the provided key names length is invalid.\"}],\"Store_InvalidResourceType(bytes2,bytes32,string)\":[{\"notice\":\"Error raised if the provided resource ID cannot be found.\"}],\"Store_InvalidSplice(uint40,uint40,uint40)\":[{\"notice\":\"Error raised if the provided splice is invalid.\"}],\"Store_InvalidStaticDataLength(uint256,uint256)\":[{\"notice\":\"Error raised if the provided static data length is invalid.\"}],\"Store_InvalidValueSchemaDynamicLength(uint256,uint256)\":[{\"notice\":\"Error raised if the provided schema dynamic length is invalid.\"}],\"Store_InvalidValueSchemaLength(uint256,uint256)\":[{\"notice\":\"Error raised if the provided value schema length is invalid.\"}],\"Store_InvalidValueSchemaStaticLength(uint256,uint256)\":[{\"notice\":\"Error raised if the provided schema static length is invalid.\"}],\"Store_TableAlreadyExists(bytes32,string)\":[{\"notice\":\"Error raised if the provided table already exists.\"}],\"Store_TableNotFound(bytes32,string)\":[{\"notice\":\"Error raised if the provided table cannot be found.\"}],\"World_AccessDenied(string,address)\":[{\"notice\":\"Raised when a user tries to access a resource they don't have permission for.\"}],\"World_AlreadyInitialized()\":[{\"notice\":\"Raised when trying to initialize an already initialized World.\"}],\"World_CallbackNotAllowed(bytes4)\":[{\"notice\":\"Raised when the World is calling itself via an external call.\"}],\"World_DelegationNotFound(address,address)\":[{\"notice\":\"Raised when the specified delegation is not found.\"}],\"World_FunctionSelectorAlreadyExists(bytes4)\":[{\"notice\":\"Raised when trying to register a function selector that already exists.\"}],\"World_FunctionSelectorNotFound(bytes4)\":[{\"notice\":\"Raised when the specified function selector is not found.\"}],\"World_InsufficientBalance(uint256,uint256)\":[{\"notice\":\"Raised when there's an insufficient balance for a particular operation.\"}],\"World_InterfaceNotSupported(address,bytes4)\":[{\"notice\":\"Raised when the specified interface is not supported by the contract.\"}],\"World_InvalidNamespace(bytes14)\":[{\"notice\":\"Raised when an namespace contains an invalid sequence of characters (\\\"__\\\").\"}],\"World_InvalidResourceId(bytes32,string)\":[{\"notice\":\"Raised when an invalid resource ID is provided.\"}],\"World_InvalidResourceType(bytes2,bytes32,string)\":[{\"notice\":\"Raised when an invalid resource type is provided.\"}],\"World_ResourceAlreadyExists(bytes32,string)\":[{\"notice\":\"Raised when trying to register a resource that already exists.\"}],\"World_ResourceNotFound(bytes32,string)\":[{\"notice\":\"Raised when the specified resource is not found.\"}],\"World_SystemAlreadyExists(address)\":[{\"notice\":\"Raised when trying to register a system that already exists.\"}],\"World_UnlimitedDelegationNotAllowed()\":[{\"notice\":\"Raised when trying to create an unlimited delegation in a context where it is not allowed, e.g. when registering a namespace fallback delegation.\"}]},\"events\":{\"HelloStore(bytes32)\":{\"notice\":\"Emitted when the Store is created.\"},\"HelloWorld(bytes32)\":{\"notice\":\"Emitted when the World is created.\"},\"Store_DeleteRecord(bytes32,bytes32[])\":{\"notice\":\"Emitted when a record is deleted from the store.\"},\"Store_SetRecord(bytes32,bytes32[],bytes,bytes32,bytes)\":{\"notice\":\"Emitted when a new record is set in the store.\"},\"Store_SpliceDynamicData(bytes32,bytes32[],uint8,uint48,uint40,bytes32,bytes)\":{\"notice\":\"Emitted when dynamic data in the store is spliced.\"},\"Store_SpliceStaticData(bytes32,bytes32[],uint48,bytes)\":{\"notice\":\"Emitted when static data in the store is spliced.\"}},\"kind\":\"user\",\"methods\":{\"call(bytes32,bytes)\":{\"notice\":\"Call the system at the given system ID.\"},\"callFrom(address,bytes32,bytes)\":{\"notice\":\"Call the system at the given system ID on behalf of the given delegator.\"},\"creator()\":{\"notice\":\"Retrieve the immutable original deployer of the World.\"},\"getDynamicField(bytes32,bytes32[],uint8)\":{\"notice\":\"Get a single dynamic field from the given tableId and key tuple at the given dynamic field index. (Dynamic field index = field index - number of static fields)\"},\"getDynamicFieldLength(bytes32,bytes32[],uint8)\":{\"notice\":\"Get the byte length of a single dynamic field from the given tableId and key tuple\"},\"getDynamicFieldSlice(bytes32,bytes32[],uint8,uint256,uint256)\":{\"notice\":\"Get a byte slice (including start, excluding end) of a single dynamic field from the given tableId and key tuple, with the given value field layout. The slice is unchecked and will return invalid data if `start`:`end` overflow.\"},\"getField(bytes32,bytes32[],uint8)\":{\"notice\":\"Get a single field from the given tableId and key tuple, loading the field layout from storage\"},\"getField(bytes32,bytes32[],uint8,bytes32)\":{\"notice\":\"Get a single field from the given tableId and key tuple, with the given field layout\"},\"getFieldLength(bytes32,bytes32[],uint8)\":{\"notice\":\"Get the byte length of a single field from the given tableId and key tuple, loading the field layout from storage\"},\"getFieldLength(bytes32,bytes32[],uint8,bytes32)\":{\"notice\":\"Get the byte length of a single field from the given tableId and key tuple, with the given value field layout\"},\"getRecord(bytes32,bytes32[])\":{\"notice\":\"Get full record (all fields, static and dynamic data) for the given tableId and key tuple, loading the field layout from storage\"},\"getRecord(bytes32,bytes32[],bytes32)\":{\"notice\":\"Get full record (all fields, static and dynamic data) for the given tableId and key tuple, with the given field layout\"},\"getStaticField(bytes32,bytes32[],uint8,bytes32)\":{\"notice\":\"Get a single static field from the given tableId and key tuple, with the given value field layout. Note: the field value is left-aligned in the returned bytes32, the rest of the word is not zeroed out. Consumers are expected to truncate the returned value as needed.\"},\"initialize(address)\":{\"notice\":\"Initializes the World.\"},\"installRootModule(address,bytes)\":{\"notice\":\"Install the given root module in the World.\"},\"storeVersion()\":{\"notice\":\"Returns the protocol version of the Store contract.\"},\"worldVersion()\":{\"notice\":\"Retrieve the protocol version of the World.\"}},\"notice\":\"This interface integrates all systems and associated function selectors that are dynamically registered in the World during deployment.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/codegen/world/IWorld.sol\":\"IWorld\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":3000},\"remappings\":[\":@codegen/=src/codegen/\",\":@erc1155/=lib/ERC1155-puppet/\",\":@interfaces/=src/interfaces/\",\":@latticexyz/=node_modules/@latticexyz/\",\":@openzeppelin-upgradeable/=node_modules/@openzeppelin/contracts-upgradeable/\",\":@openzeppelin/=node_modules/@openzeppelin/contracts/\",\":@pythnetwork/=node_modules/@pythnetwork/entropy-sdk-solidity/\",\":@systems/=src/systems/\",\":@tables/=src/codegen/tables/\",\":@test/=test/\",\":@world/=src/codegen/world/\",\":ERC1155-puppet/=lib/ERC1155-puppet/\",\":ds-test/=node_modules/ds-test/src/\",\":forge-std/=node_modules/forge-std/src/\"]},\"sources\":{\"node_modules/@latticexyz/schema-type/src/solidity/SchemaType.sol\":{\"keccak256\":\"0x650927696f7518fa216f2d6001835e9fdb419518034c781e86d2a2d33f4ecd2a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://72e91ac32ed00d36bd22fefeaf4ce1e9420143ddab7080eeb720c668a117bf44\",\"dweb:/ipfs/QmdVqn18WZvx5p84MDJPsB5tfVoXDR86wzm4sLx6WrGYYL\"]},\"node_modules/@latticexyz/store/src/Bytes.sol\":{\"keccak256\":\"0x7dec900f9c9e7dff59430fa6f520e76c56338c3e829201aea140d49342e4fef8\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://e55c1dfcda94dcc64b8577949b2e92a9d3fc44f5fba1ae77ceacccfdc8e22e35\",\"dweb:/ipfs/QmS7uRJbEQYkPuZ5Dz5aSNjaaxj9PA8RtxUeUGN2W3jZx6\"]},\"node_modules/@latticexyz/store/src/EncodedLengths.sol\":{\"keccak256\":\"0xebc0a6efd611e02b15c05a382382b597fe059eba7f2a9e90da81eeb2f7666774\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://00b2cac12599935e25ea0697e99fc9e6d5af6c1c982761996c16707d9cd6ca09\",\"dweb:/ipfs/QmXccFminkrFtDpNfx6X1pHvW7Tn1nA5XcGu9T17pJyZyK\"]},\"node_modules/@latticexyz/store/src/FieldLayout.sol\":{\"keccak256\":\"0x15f698b7eabc062a00ff7a2e02db0ace2dd51f8bd2bc51a45dc0afa88f2ee658\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://f774202c98ad394b3b62be93292512c633dec63bc931c190ed984656c2d54ec7\",\"dweb:/ipfs/Qmd2D9mvP8S88ad2Q8WU54saNVr3Pwc5stPqEKHwcpo8AT\"]},\"node_modules/@latticexyz/store/src/Hook.sol\":{\"keccak256\":\"0xd016a2e1260f5a81ff9a8dfac58d7947e114414df8cce7302a2629908ea5f18e\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://0c558a6f3a5f540c0190fa6d642a094a185c5db1acfc2437c7dbde0340f00ac3\",\"dweb:/ipfs/QmViAHvR7U7HNfBiBZEMFiy1TTSHDFNiDzBfQSeLBShCky\"]},\"node_modules/@latticexyz/store/src/IERC165.sol\":{\"keccak256\":\"0x0efbf9afc716c585621482221f75e5bd60bcf0e813c9f7800d7c0309dcc3c927\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://31b6aeb5446a0a0d5bd71be15a68c5bde94b08c961369203b83c8abe36f401d2\",\"dweb:/ipfs/QmXhComne4es9ZMKaGNqHCdJZrFoFssxMYgLaqvCXPL1Mg\"]},\"node_modules/@latticexyz/store/src/IEncodedLengthsErrors.sol\":{\"keccak256\":\"0x06bb49164f44acc8d51df7b75ecf2f7aeb9281f7a3b357cae7d8d58bd1700dfa\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://719027f4cc60fea30ce01cd4f672462f41fac750ae802e91a1a6d37c929e11ba\",\"dweb:/ipfs/QmWi5DM2jT5V5SGP1afRmFyRgFvuZiGDX2PWHwP19HssF1\"]},\"node_modules/@latticexyz/store/src/IFieldLayoutErrors.sol\":{\"keccak256\":\"0xaef70c46e412bded1024ac82c957cea81c1d1ab11878a95635531e2ac9673a53\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://cda2c7dc02ee8f0163b1c8d0f3e1e05d48b2a009e5c7365d2418f17bc3455817\",\"dweb:/ipfs/QmXHDZuCPTxjHaeiEaJhA81koX2NJ3Gj1zt5WVWaz77FL8\"]},\"node_modules/@latticexyz/store/src/ISchemaErrors.sol\":{\"keccak256\":\"0x0ac3de36c9d0058a17fcd7f1a905132215fd16ea3ed3b5109de1de04ddd7c441\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://f83fa2546009cfd16b3b3969dcec1d67c9d818d910177b885ba263b6a948c65d\",\"dweb:/ipfs/QmehywHdvFYBL9BTtoPsVVwJXsEA4Xjk8aPWoHw1R45KeY\"]},\"node_modules/@latticexyz/store/src/ISliceErrors.sol\":{\"keccak256\":\"0x72684b7dfc1b44537401ccf10d6120186d02323266fcc762bc81859985eded4c\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://e8d037b6937969ae54018ddf647eeaf5eb69a2b0bf9edf9456d3d270316b2883\",\"dweb:/ipfs/QmfYJeyAmzRqpn68FteiM97p5t17iBw62FCET4bK5g4w37\"]},\"node_modules/@latticexyz/store/src/IStore.sol\":{\"keccak256\":\"0x42515d1410333a3573f78a460576271ef62c16edad5cf771ef6287b83ca1c706\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://6a58d03c4cf420df57d2b2e2e7932daad877e46e89561b46e1fa9f593a701bdc\",\"dweb:/ipfs/QmeFmKS7J1WqqBAgXkyxxx2fGA8JzuGszUmVsV2T6DYtsL\"]},\"node_modules/@latticexyz/store/src/IStoreErrors.sol\":{\"keccak256\":\"0x37e4d2f015dd4005ff9b3f711257c891027804bc268db1791984af4989951912\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://a4a566ea96b69211f503707f69a9f9012d5873a3fd57b3f221549f46a7518df6\",\"dweb:/ipfs/QmVgcE3JufJr3iyeV6xqkvS4YtDcy6Eqyram2yzWUhwoB4\"]},\"node_modules/@latticexyz/store/src/IStoreEvents.sol\":{\"keccak256\":\"0x8606e9de37943c74beabb9ac9acd2132f951bed1ef79f2f4f3de83ed1f271f6a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://d13adeee7ae9e687bf1cd12a8c36223179685fc828a7c468ee9311c879401b08\",\"dweb:/ipfs/QmQeb2ArSoQpE6ujBbDj9LY3xqpVCPiz3bh9SLT6siE8RY\"]},\"node_modules/@latticexyz/store/src/IStoreHook.sol\":{\"keccak256\":\"0x6574a30a2bbd8a0de21b2504c55effb8802fdeff62296af82a9380bd753adcc4\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://85a859c533f51b584a9a2e8a64d61b6cf6f69bfcff1b926ad787518b1cae9562\",\"dweb:/ipfs/QmVyjmyJ69ZeqaXHg91JtGLVahRfZ7KtWaessLWZ6rYk9p\"]},\"node_modules/@latticexyz/store/src/IStoreKernel.sol\":{\"keccak256\":\"0x37a23dcbabc5937a717f2fda636b6a97963ed4b5a96870a62dfb199a8b692f89\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://ac9741ea6daf21f39699be11afd919ae3ec07df24d948aaaa6549456fefd7fc0\",\"dweb:/ipfs/QmeiPQkZitM4Pc3i6L87thU71Fs1JVWAgMqXnSK8VrCq75\"]},\"node_modules/@latticexyz/store/src/IStoreRead.sol\":{\"keccak256\":\"0xdcf28b3293d4d6c1fe2808a8918c1b2122e4e0e49f2793c79ebd2b9ae210ff7b\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://bb3d9cc80f549ed0c5b768aea69fb1b3c364bd4f85d193a3040c411b594d94db\",\"dweb:/ipfs/QmYYdY5CjPHiW5ucXihTva1eHsCPNqBsvL6zYYafH3ap4p\"]},\"node_modules/@latticexyz/store/src/IStoreRegistration.sol\":{\"keccak256\":\"0x9e91a73f93cc9ebc00c265c83177f6a3f8a156749a9261202e2845e12aeaa96b\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://a39280d87d22dd0a959d8f55925cb092dba1fee2f11d3dd8e3ffabed45a9ab6a\",\"dweb:/ipfs/QmRMBFLJtT2KN43Xz9P3vUNWxXrP8rLTNBFw2P6Z7EGeaS\"]},\"node_modules/@latticexyz/store/src/IStoreWrite.sol\":{\"keccak256\":\"0x120fd448da5806e09ecb5327ad4dba64df01d2ee7232de0979133627e87e24ba\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://7a3cb151b2ddee217f330d61813b2dcd997de94940c903719f6d066a21467890\",\"dweb:/ipfs/Qmbes1RRY6KdtsMohp8834xXyipeQK9GJ41NfgXK1d1QAZ\"]},\"node_modules/@latticexyz/store/src/Memory.sol\":{\"keccak256\":\"0xef6e7000b181c2991aeacbf99a9d886f8c4df88878b857713f851185b63a7811\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://b079b4773d140ab2c01bdb04facfa56a78f753aea7122fa445b2bfa133411392\",\"dweb:/ipfs/QmWYWKFpwtsPeGdCSxcANgxXUbwAuMMgR7iMVPDSCZxz2A\"]},\"node_modules/@latticexyz/store/src/ResourceId.sol\":{\"keccak256\":\"0x889423054511cf8a83f5dfd65a0f984dc514aba798ef3db139b59d395b2327e2\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://40b9495d455c87db8b063e291ca3973dc3ba1163f09c5d7446241a9e1cb69ed0\",\"dweb:/ipfs/Qmek1JKVjPUpoXnKwu66HfPS9rHstKtWTuBmG8YFxbPEWQ\"]},\"node_modules/@latticexyz/store/src/Schema.sol\":{\"keccak256\":\"0x0d2a08030d21292ecbcc850d9111f3817d03f17cd5e02186894848a9152d79d7\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://3f30024c1613fb587aaba4c1dcb8e4e46ed765a2cebd5b63fbebd327d1bf13d3\",\"dweb:/ipfs/QmZzqSnPMYKDYwbFNvUFrvuazMUyQHzQ59w3A9x6juHAm7\"]},\"node_modules/@latticexyz/store/src/Slice.sol\":{\"keccak256\":\"0xae6c03881fdfa56cba1879d9c9c6b52c2829e6a278a200176678d8da05a89345\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://3cad7dc4944c0518de2e7f99697485d365ae37aa6cad6967996377c2dd951fe4\",\"dweb:/ipfs/QmW3grFwr8BcgJmLfjLbj3FthnD7NRUBFMFiahbXztHPr7\"]},\"node_modules/@latticexyz/store/src/Storage.sol\":{\"keccak256\":\"0x7e735a4c7fa8b8a5fe2371d90801e3287ddb78efed69b31e1a76f0b7b153c4c3\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://9e6db36bd52144b6feeecd91a58fc311127a3892fc96c4171db5b570fe9876ee\",\"dweb:/ipfs/QmS6LqnTZvpMc4eiz5JowBoNnh3RYemG6JHjqtYucT1rQi\"]},\"node_modules/@latticexyz/store/src/StoreCore.sol\":{\"keccak256\":\"0x9513dc38e5baadde0ba9b08320a324043b0e88a10702be5c3507da8c3d45e861\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://99c80c65a394763668e4aed69220fec6bb3ed847fb277ddd1ff1d4bfdf452da2\",\"dweb:/ipfs/QmRT2BATKtrYmixWMuWo9Cz8g8oscfLNSmvjxTyiTNA1pc\"]},\"node_modules/@latticexyz/store/src/StoreSwitch.sol\":{\"keccak256\":\"0x7edf7c1641408f3a580eb28bda58054583cb846f875608612671c6d40712ba40\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://4146adef610d1daab085a81aa9f2d4fd8c4e5f459b9ef184f3ef23465573cf91\",\"dweb:/ipfs/QmQqZMsbkzSNG6VfYzQLdRCBCsNohBSVQmWoTP6QvKmKUP\"]},\"node_modules/@latticexyz/store/src/codegen/index.sol\":{\"keccak256\":\"0x094a6f1e2910b345b6b254e0fc2c8882b3190c673f7ee19742e857057a4d3f85\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://18908e2e7e878635abea72ef99851fddd204371e6b641f010e831ebfa0b1bfd4\",\"dweb:/ipfs/QmSNAxXqxTrzPkZ4rSAQgBnuer1yLPq74hoqnzrZV3WGsb\"]},\"node_modules/@latticexyz/store/src/codegen/tables/Hooks.sol\":{\"keccak256\":\"0xfdea5b4cf666720c1c0d81a8acdede68e6220aee45d8a9f3c9834b4edc5da394\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://b3a394dfe123cfb7200f65d379fb0cb3d2c84475b382faf6ee11bf9c45a63b53\",\"dweb:/ipfs/QmRMPHFBbCKtqKBVV9gvd2jhnfsyUKmCBEQkgviMoxi1UG\"]},\"node_modules/@latticexyz/store/src/codegen/tables/ResourceIds.sol\":{\"keccak256\":\"0xf192bceab34508cee21dd7c33e4d776f79c4a7ca55ee8905c6c694850ebfdf64\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://c95113f76f6de671cb44710754e0942934182b544660a4330fc90a505e198905\",\"dweb:/ipfs/QmXma5ZxfK8Y9TbvB7QM9hdhfc1ixiMcLpo9BQxnVthHB5\"]},\"node_modules/@latticexyz/store/src/codegen/tables/StoreHooks.sol\":{\"keccak256\":\"0xa825218614acc19a4100357dd7ee410b67b994fe7aaa68650d5d0d4202d4ca8c\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://09b0cbb598fe2b75bbcd269b47d686a66fcc89c0c40d9a09807eba7688b81fc6\",\"dweb:/ipfs/QmYk6XQwSLhRumujTCsqxdvugKuP8oLjjB926pMHR445ra\"]},\"node_modules/@latticexyz/store/src/codegen/tables/Tables.sol\":{\"keccak256\":\"0x918b977e7f7f3e947d6d5aa189c54c9c7e7c106d0a0d53734ee959ad454abe09\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://3a3de63c04c838bf80c1903cf7464d201d0ece0f86a7aaca35462b730e9338fc\",\"dweb:/ipfs/QmSUkLZ88J7tSwdmR3viBJHU8QVgN2Gji6W8wYLJEDNkc2\"]},\"node_modules/@latticexyz/store/src/constants.sol\":{\"keccak256\":\"0x67e0d59237bd37424827ecde1ecdbe71f65376af517b0623cd8f8d5451bca7a6\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://09c5ec7fe73e06140957d44a3d9938587711c783ccbf08ff017638c9279a3168\",\"dweb:/ipfs/QmfS9ZRqHXmBJ1h5B4x4gbU6d18DtMgKZSkxhQgNVRxueu\"]},\"node_modules/@latticexyz/store/src/rightMask.sol\":{\"keccak256\":\"0x28887aab8ad5ca598927e59d702999ca6e3b3128f1cddd2b995a381c8d04b275\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://7710847f4689b7f5b81436c7d52ae4395f244a2eebf8d398b2edd43accb06754\",\"dweb:/ipfs/QmTD2wYqryXTynHAn5Vf9wtjUUSGeCJWENZTnWtBAK38pa\"]},\"node_modules/@latticexyz/store/src/storeHookTypes.sol\":{\"keccak256\":\"0x4f29001e53690ce74fe405a6d0376a564c9c743d1631d36fab04331865e4d572\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://138c80abd63225a3eeb01ebfa1f9288e188a7ee5b2266b275fb4ed31b5aa30e3\",\"dweb:/ipfs/QmdEx9uHgCCbTcetGwFH5a66Ft7ajmrMDXvP1fW7WjnnE2\"]},\"node_modules/@latticexyz/store/src/storeResourceTypes.sol\":{\"keccak256\":\"0x1c4cb6b3ecf76f614479ab304d7de3ade0e99c7ccfd07717b57c92f699a27261\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://2c9b0e0c9b3b5610d6fd65a8ffd7c54df390a34ccc70d58f4a055c49ad1ea586\",\"dweb:/ipfs/QmP6ffpnR7aRyvq9AiUkVNH6LbGfFP3NDq7E2n2PVcHhp2\"]},\"node_modules/@latticexyz/store/src/tightcoder/DecodeSlice.sol\":{\"keccak256\":\"0x310523f7f3acca841e62fe50be8d8b042cad5b3c239cb1105d6623cf83e63152\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://1cc40ca233acf6502bc65677b381c05331dd7323953e54b5df969051e47f851e\",\"dweb:/ipfs/QmTxy9mhodT8drezB5K1kPR78AMaARomoJqDyaWpLuCKui\"]},\"node_modules/@latticexyz/store/src/tightcoder/EncodeArray.sol\":{\"keccak256\":\"0x259ee545fd9dfd4767f0b7fef31f52fd3c54c4a1c6657d6fbda4927800c937b3\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://0a4e31efa9f476cd267af7c3e11fe0151252206a1f6407a80a4092444c2de8ea\",\"dweb:/ipfs/QmRF4gWYw33mFTMh7nX8DJ1qzx3Ko6yMsnxubzYTRppdyo\"]},\"node_modules/@latticexyz/store/src/tightcoder/TightCoder.sol\":{\"keccak256\":\"0x0e74ff88ec94cb33f79d8afc1497c4fdccf02db40ab47f3701c7d02fc305d4d8\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://36b7cd0c2a3f2dcdc83ab7ac5a93f123746ce29c0f1000f2b275ad2c647ff0f3\",\"dweb:/ipfs/QmYdipHYUhHhS78wLdtmKZUK14FEwpto5mFy3rNeZssMLz\"]},\"node_modules/@latticexyz/store/src/version.sol\":{\"keccak256\":\"0x78c571906ee999ee7e56d4f7702b8a93c3a9e55e6b552aca115b5f6ac7f1c80a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://a9f141b2d556b2a2545e7db5606e8a038679a995a22aeaf1702cb3a60320b60a\",\"dweb:/ipfs/QmY7x258Fhj3TT3RT4sNyyfiRphVYdZXhtAnSYpasJ4xVQ\"]},\"node_modules/@latticexyz/world/src/IERC165.sol\":{\"keccak256\":\"0xe3d9074a1be3247be67ff4dd2c9e41481650ddaa799285a249736bb85673e33d\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://0b6743ee1e6d0c74927bf17fc1da0cad7575aa7634871b94190ffbdb4c28c2a7\",\"dweb:/ipfs/Qma5bNsPJSBTesWxg3eAAMUBTDE7UjqWaHF7eMiGwP87jr\"]},\"node_modules/@latticexyz/world/src/IModule.sol\":{\"keccak256\":\"0xbb926cf64e685bbf2770d60124664cc84ab70bd3038e17a074f2d472c3fc2c57\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://143c3dcbdf1702dd4f9c869629609386c12f7c0247e88a6d062dc4d519ebe0d2\",\"dweb:/ipfs/QmQJSDd8uFL4sssw9fb9NHo4s6zjuDUgmrLHj3zsJuhMo1\"]},\"node_modules/@latticexyz/world/src/IModuleErrors.sol\":{\"keccak256\":\"0x60917e029779c81cfea1f5140c389269e51d7adb78987f39101b9e0d7bdad12d\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://513f41920d67ca28c3e0fe247403c28a4d342785192df449c99d5f92db04fcea\",\"dweb:/ipfs/QmeAG2TtxAgcJQR4QxftuSvQrxisYQ1i1GZoyd7oeFQBDJ\"]},\"node_modules/@latticexyz/world/src/ISystemHook.sol\":{\"keccak256\":\"0x81f1743d7ca6a9c7efc4997cf95e603ccb2070885265ca0e540f461aa7430721\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://93d99e78b541b33ecd501bf0cd407a78cef490fec8eaef2f188bddb9e293a99f\",\"dweb:/ipfs/QmPrcMDxwhvBZTr2AxoGqJA9L3Mjx27KBc98h3gXSsa3PM\"]},\"node_modules/@latticexyz/world/src/IWorldContextConsumer.sol\":{\"keccak256\":\"0xb39e9d8cff4162e255f6c460ef9f9f0ad5b804627f745d967b2f10d0dd509299\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://18d957cd87febccc00d82b9454047f0f5236250c9245befc0f57978671675255\",\"dweb:/ipfs/QmdZ1eXBd15vLpLVqTNJDAAaTzzucpRLD8GPJahLKT4J7x\"]},\"node_modules/@latticexyz/world/src/IWorldErrors.sol\":{\"keccak256\":\"0x0abae6f4ed1b3070bddd0ed194c08b83a948b61ae959396202cf627bf1056a2b\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://a7037954f281cc0188a5aafc1d0cca0aabc110fd0234e6c43dca35ad69ed3baf\",\"dweb:/ipfs/Qmbv2nfK1qPpnoAbqNJFqWwo7AuyaX2ZEgZMFspMv7DR5B\"]},\"node_modules/@latticexyz/world/src/IWorldEvents.sol\":{\"keccak256\":\"0x39f6d8930db431c04158b85cc2a612c48d43dc81ec998f267076b12293c5d243\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://d68f1543e5e166d639372d1aec57e3e193b5bb3b37270b6cb0488fab2c0ebe57\",\"dweb:/ipfs/QmdJUFDx87AHWFKP3jVrYg8xqAkiPfuT1M3tEotNt7KUoy\"]},\"node_modules/@latticexyz/world/src/IWorldKernel.sol\":{\"keccak256\":\"0xdaa1e92439036e392fe79892819ae165732f416b831f84d38050ca3d958e549b\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://ea8dc52e31a62e8971322ea9ed8f2e83d562ec199d7f93a392c293e96ff7f092\",\"dweb:/ipfs/QmSbM8MgHbrJLYP7uzemfZeC4xctqdyKDbspwHUsgeeVJC\"]},\"node_modules/@latticexyz/world/src/System.sol\":{\"keccak256\":\"0xadcb32bdc444a4420909b738d81fa662dc63739455fe93d5aa89c93a3ccfd2dd\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://d303094c84ebfb0f9f114c54ff4dfc68bfa1e526d0ebe304be6fbeb7cb2f0d3f\",\"dweb:/ipfs/QmYvUx1mNDhkxZFqxLeswW3w9HkvVqeoJiJKj1HN1SB7Gi\"]},\"node_modules/@latticexyz/world/src/WorldContext.sol\":{\"keccak256\":\"0x50ca52bdd89a9f27d6b03ad00ef45c8c5a6884ea9d75e18f8fa53524ac2feed9\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://55febdece37b291527094fb654919d4c8fe0b231792996a14c5e5cc76512b19e\",\"dweb:/ipfs/QmZHFbDDNmdFHWc1uTSvDgMUUgb8NgBPb1cDUJYajswbHT\"]},\"node_modules/@latticexyz/world/src/WorldResourceId.sol\":{\"keccak256\":\"0xaff9a22fac8a0f6eee5763b07a7ccb623c829d37922b85e42e914aad2ad417ee\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://e598f0274d6d97c0a09806bf4fd1f0d054c310cf51b2123f5ce6380d6f3186ea\",\"dweb:/ipfs/QmaaVvqm21YsCgxozDyShcM17jKUXJhf2y26bk2YzPYZoM\"]},\"node_modules/@latticexyz/world/src/codegen/interfaces/IAccessManagementSystem.sol\":{\"keccak256\":\"0x7e7321b86836bfbf4b96d0fb2a424ed678efcf01b15fa3d0b4ae4f0b975ad5dc\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://ead41554796bd0507e390f2997aa4a8df7bff8b51523b86fa3c5bd8acb1fec48\",\"dweb:/ipfs/QmVe1VUhfbRy8tviA7UcCtS8NjXhsF1E6Re9xLqWS5aRTK\"]},\"node_modules/@latticexyz/world/src/codegen/interfaces/IBalanceTransferSystem.sol\":{\"keccak256\":\"0xe57042e82311847c56fa569377ed84459bf55afccdd3123312a5dff90c1d06f4\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://baf3258c9118bf16ba68ebcfecdb5e5ffc85d5c0cdc2815ca298283dfcff2c83\",\"dweb:/ipfs/QmcBVyUBR3PVejz7249VrEBMCMKHi72KoUXQ8DFmMmY48F\"]},\"node_modules/@latticexyz/world/src/codegen/interfaces/IBaseWorld.sol\":{\"keccak256\":\"0xf7acdfa0eb01c710d11fba129d613863fe86f1bed352f0bc5630bea81cceae17\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://3e4107681cd20c018cd8f5dff6da72e8a4b02f631c7c59b618e8743482c7bc81\",\"dweb:/ipfs/QmXS8NLaKVXcf97HrD8U4hGHqb9ytYGwdZrTVHHb5EwrRj\"]},\"node_modules/@latticexyz/world/src/codegen/interfaces/IBatchCallSystem.sol\":{\"keccak256\":\"0x600cc362780c319e640950ad3520af7fa558171268baab252ff4da4414aa0f1c\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://6d113a833b64bccbbe852f3d0261efd80ad4a0f6771802dc91af79c762a33ff2\",\"dweb:/ipfs/QmaXEdJJaMMQF8nZieWyXdVD15yuXnH89QLZHwD18LAndz\"]},\"node_modules/@latticexyz/world/src/codegen/interfaces/IModuleInstallationSystem.sol\":{\"keccak256\":\"0x7070453d969eba7defd90047d58ae979e27e5c1fcf05598daa4d17fedbe84c35\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://ee5c196c5e339ac0222cd1d14fd9d09451d255605f73732abc33397a9512503b\",\"dweb:/ipfs/QmYwNsWnxP24RzDqFYLnBYswZY97YE3nwG6Xf55f5FqNXa\"]},\"node_modules/@latticexyz/world/src/codegen/interfaces/IRegistrationSystem.sol\":{\"keccak256\":\"0xe08d3af994098120b5507c71a1c3558763b8c1a88c6eae506aa438c2af78f800\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://bb0c47b16ff524140388765fe9ef99211dd7d9b9374dae09144a9956138de00c\",\"dweb:/ipfs/Qma8ibVu6WZs1hFW3hMnUykV3pPXGZhZ3xJwJXNj6Xu7aL\"]},\"node_modules/@latticexyz/world/src/codegen/interfaces/IWorldRegistrationSystem.sol\":{\"keccak256\":\"0x70bed82da026058ddccf52766823c7d55c7d29faad0ab1d76d763786d5277f7c\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://1da6476d62e450d3d935ea8292723612a84fa1d07342fbc052ee851181701a27\",\"dweb:/ipfs/Qmd1FQpmEVbQciLDPkHPXSKB7aYW1YB74BN5JXqn74erhR\"]},\"node_modules/@latticexyz/world/src/constants.sol\":{\"keccak256\":\"0xb8320f88ed5519a4fe2554ad94815ce328a50fef7719932375d6ce695265c2f5\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://a8f5de30fbcc63e469e46ad4a4d4bcd7d8e4b4f2d31fcf62a04aca48d999af22\",\"dweb:/ipfs/QmXw1jDQM2szfRY3tAGrRy6fEzte6yVFgebJAqCLMDHndV\"]},\"node_modules/@latticexyz/world/src/modules/init/types.sol\":{\"keccak256\":\"0x81b75eb286ec515bde6cbb16c3d089054abb530b744865bbace68343d23177bc\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://afc77bd51e24da666260bb48c44ff611869fb2e550921d732e5aac84a1f09525\",\"dweb:/ipfs/QmeU5N4yeRh5nEA65pvGtQQJNv1GvEPy4PkhMVRYRMoMvh\"]},\"node_modules/@latticexyz/world/src/revertWithBytes.sol\":{\"keccak256\":\"0xa1147f218a0152b153d4e8bada0f606bfed40ac1f184fd16a941c2d0033c53f5\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://3f5e0f6d1b51a3a04d4bd84537b2ced373b32824898cf6fbfd13ae1cbdf06359\",\"dweb:/ipfs/QmayYRmBZRUV9m4UnFxuC62VvHriXhkYXeH3HibZ3Gmxxf\"]},\"node_modules/@latticexyz/world/src/worldResourceTypes.sol\":{\"keccak256\":\"0xeb042e7d3638430f6fd394107f3237cf14e4325154f0098624e8a7826584d465\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://39e0b8eb87616b661f5a4f2fd7e1a727bd19b7fd8d40ad3d93fda26822f433ea\",\"dweb:/ipfs/QmacYMatKV9pwEwirVRY9a6r89RoNs5yk99ic37ieWA8Dk\"]},\"src/codegen/common.sol\":{\"keccak256\":\"0xfccc97e1c19076ce732ca821a1b4b60c37aafc2e371a6e86b580a76f07042927\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://977c3231c794fc735d8dfe13f0c93337d8b9f8c175f58698cc587d148adfd966\",\"dweb:/ipfs/QmW5PXEBTUGgUkwCjPQiSvAnV5tDdg39jQvgge7c7qnJmr\"]},\"src/codegen/tables/CharacterStats.sol\":{\"keccak256\":\"0x8609e049f9c40a2990a4d769be61d195385c4e22e403f133be102b4e9662e7ca\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://35be01edf9b7e148303a62ffafba00df314c47f8d57f159f5a56d75b56ccf7fc\",\"dweb:/ipfs/QmQdFFa7U6AHadojoJZSCLMQRmHnzcEPsmJ6j382DF2nvg\"]},\"src/codegen/world/ICharacterSystem.sol\":{\"keccak256\":\"0x8bdbad1e2f920aec7ee05447880b01486094eb92869546e5b8bc34ca67fc879d\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://0c492dfa099175c6bb8e6c244a3a06d0acfed5eee99f5a6e2f934434d4344bdc\",\"dweb:/ipfs/QmfXCkjsgMaPGFarjdKiEY4dZmw9MigHfjRxTkZZuW9yPC\"]},\"src/codegen/world/IItemsSystem.sol\":{\"keccak256\":\"0x36c2f22999e0c142945064b5b15ba59544ad373124b91761bb92724f8ac04d94\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://c585e7dc7d9dd91fdffe935ca3232f9e921edff17c4bbecf0d1af8c9095170df\",\"dweb:/ipfs/QmXREmQbQ85sJbFSyqL3ZPnzDjBLFoR4TyPeR6kzDa2a32\"]},\"src/codegen/world/IUltimateDominionConfigSystem.sol\":{\"keccak256\":\"0xba90101aabcf40e70392a7cb70705414abd0ae15cc3611ff896a4fac2f7a42d9\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://befe8dc2fb28a22feb31c6ac8f8d6796985db0fe49a411b60d860d34b45813c6\",\"dweb:/ipfs/QmaGKJ9ipwXJKt7uVqEGwGdqo45AkAuQHQdpSgqo1vCTbf\"]},\"src/codegen/world/IWorld.sol\":{\"keccak256\":\"0xf07ca4ff5a7bf83f17864399e206bf7b8c182aff8aeb8849c3331aceeebb23ca\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://1176cc9b919a03c7e4d6705052434af12bb80f47e88d78ed5ab51c1e0a44b004\",\"dweb:/ipfs/QmXKViRAF8yuf8gCP2cJVJ5gxFweV9gWTLPpAV64pY4Q8X\"]},\"src/interfaces/Structs.sol\":{\"keccak256\":\"0x4f60516b86d6f5770ab45f1de93f8e4fc95b4c53b431beb1e165353a774cb606\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://72093895741d5a92e28b57b78a06942796d4ba10435afadd3b801d9c9df81274\",\"dweb:/ipfs/QmWUuhswEadKj3VG48MPTowEE7gPjxzSdaW6zWsDmNb5Sb\"]}},\"version\":1}","metadata":{"compiler":{"version":"0.8.24+commit.e11b9ed9"},"language":"Solidity","output":{"abi":[{"inputs":[{"internalType":"uint256","name":"length","type":"uint256"}],"type":"error","name":"EncodedLengths_InvalidLength"},{"inputs":[],"type":"error","name":"FieldLayout_Empty"},{"inputs":[{"internalType":"uint256","name":"staticDataLength","type":"uint256"},{"internalType":"uint256","name":"computedStaticDataLength","type":"uint256"}],"type":"error","name":"FieldLayout_InvalidStaticDataLength"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"type":"error","name":"FieldLayout_StaticLengthDoesNotFitInAWord"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"type":"error","name":"FieldLayout_StaticLengthIsNotZero"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"type":"error","name":"FieldLayout_StaticLengthIsZero"},{"inputs":[{"internalType":"uint256","name":"numFields","type":"uint256"},{"internalType":"uint256","name":"maxFields","type":"uint256"}],"type":"error","name":"FieldLayout_TooManyDynamicFields"},{"inputs":[{"internalType":"uint256","name":"numFields","type":"uint256"},{"internalType":"uint256","name":"maxFields","type":"uint256"}],"type":"error","name":"FieldLayout_TooManyFields"},{"inputs":[],"type":"error","name":"Module_AlreadyInstalled"},{"inputs":[{"internalType":"address","name":"dependency","type":"address"}],"type":"error","name":"Module_MissingDependency"},{"inputs":[],"type":"error","name":"Module_NonRootInstallNotSupported"},{"inputs":[],"type":"error","name":"Module_RootInstallNotSupported"},{"inputs":[{"internalType":"uint256","name":"length","type":"uint256"}],"type":"error","name":"Schema_InvalidLength"},{"inputs":[],"type":"error","name":"Schema_StaticTypeAfterDynamicType"},{"inputs":[{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"uint256","name":"start","type":"uint256"},{"internalType":"uint256","name":"end","type":"uint256"}],"type":"error","name":"Slice_OutOfBounds"},{"inputs":[{"internalType":"uint256","name":"length","type":"uint256"},{"internalType":"uint256","name":"accessedIndex","type":"uint256"}],"type":"error","name":"Store_IndexOutOfBounds"},{"inputs":[{"internalType":"uint256","name":"start","type":"uint256"},{"internalType":"uint256","name":"end","type":"uint256"}],"type":"error","name":"Store_InvalidBounds"},{"inputs":[{"internalType":"uint256","name":"expected","type":"uint256"},{"internalType":"uint256","name":"received","type":"uint256"}],"type":"error","name":"Store_InvalidFieldNamesLength"},{"inputs":[{"internalType":"uint256","name":"expected","type":"uint256"},{"internalType":"uint256","name":"received","type":"uint256"}],"type":"error","name":"Store_InvalidKeyNamesLength"},{"inputs":[{"internalType":"bytes2","name":"expected","type":"bytes2"},{"internalType":"ResourceId","name":"resourceId","type":"bytes32"},{"internalType":"string","name":"resourceIdString","type":"string"}],"type":"error","name":"Store_InvalidResourceType"},{"inputs":[{"internalType":"uint40","name":"startWithinField","type":"uint40"},{"internalType":"uint40","name":"deleteCount","type":"uint40"},{"internalType":"uint40","name":"fieldLength","type":"uint40"}],"type":"error","name":"Store_InvalidSplice"},{"inputs":[{"internalType":"uint256","name":"expected","type":"uint256"},{"internalType":"uint256","name":"received","type":"uint256"}],"type":"error","name":"Store_InvalidStaticDataLength"},{"inputs":[{"internalType":"uint256","name":"expected","type":"uint256"},{"internalType":"uint256","name":"received","type":"uint256"}],"type":"error","name":"Store_InvalidValueSchemaDynamicLength"},{"inputs":[{"internalType":"uint256","name":"expected","type":"uint256"},{"internalType":"uint256","name":"received","type":"uint256"}],"type":"error","name":"Store_InvalidValueSchemaLength"},{"inputs":[{"internalType":"uint256","name":"expected","type":"uint256"},{"internalType":"uint256","name":"received","type":"uint256"}],"type":"error","name":"Store_InvalidValueSchemaStaticLength"},{"inputs":[{"internalType":"ResourceId","name":"tableId","type":"bytes32"},{"internalType":"string","name":"tableIdString","type":"string"}],"type":"error","name":"Store_TableAlreadyExists"},{"inputs":[{"internalType":"ResourceId","name":"tableId","type":"bytes32"},{"internalType":"string","name":"tableIdString","type":"string"}],"type":"error","name":"Store_TableNotFound"},{"inputs":[{"internalType":"string","name":"resource","type":"string"},{"internalType":"address","name":"caller","type":"address"}],"type":"error","name":"World_AccessDenied"},{"inputs":[],"type":"error","name":"World_AlreadyInitialized"},{"inputs":[{"internalType":"bytes4","name":"functionSelector","type":"bytes4"}],"type":"error","name":"World_CallbackNotAllowed"},{"inputs":[{"internalType":"address","name":"delegator","type":"address"},{"internalType":"address","name":"delegatee","type":"address"}],"type":"error","name":"World_DelegationNotFound"},{"inputs":[{"internalType":"bytes4","name":"functionSelector","type":"bytes4"}],"type":"error","name":"World_FunctionSelectorAlreadyExists"},{"inputs":[{"internalType":"bytes4","name":"functionSelector","type":"bytes4"}],"type":"error","name":"World_FunctionSelectorNotFound"},{"inputs":[{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"type":"error","name":"World_InsufficientBalance"},{"inputs":[{"internalType":"address","name":"contractAddress","type":"address"},{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"type":"error","name":"World_InterfaceNotSupported"},{"inputs":[{"internalType":"bytes14","name":"namespace","type":"bytes14"}],"type":"error","name":"World_InvalidNamespace"},{"inputs":[{"internalType":"ResourceId","name":"resourceId","type":"bytes32"},{"internalType":"string","name":"resourceIdString","type":"string"}],"type":"error","name":"World_InvalidResourceId"},{"inputs":[{"internalType":"bytes2","name":"expected","type":"bytes2"},{"internalType":"ResourceId","name":"resourceId","type":"bytes32"},{"internalType":"string","name":"resourceIdString","type":"string"}],"type":"error","name":"World_InvalidResourceType"},{"inputs":[{"internalType":"ResourceId","name":"resourceId","type":"bytes32"},{"internalType":"string","name":"resourceIdString","type":"string"}],"type":"error","name":"World_ResourceAlreadyExists"},{"inputs":[{"internalType":"ResourceId","name":"resourceId","type":"bytes32"},{"internalType":"string","name":"resourceIdString","type":"string"}],"type":"error","name":"World_ResourceNotFound"},{"inputs":[{"internalType":"address","name":"system","type":"address"}],"type":"error","name":"World_SystemAlreadyExists"},{"inputs":[],"type":"error","name":"World_UnlimitedDelegationNotAllowed"},{"inputs":[{"internalType":"bytes32","name":"storeVersion","type":"bytes32","indexed":true}],"type":"event","name":"HelloStore","anonymous":false},{"inputs":[{"internalType":"bytes32","name":"worldVersion","type":"bytes32","indexed":true}],"type":"event","name":"HelloWorld","anonymous":false},{"inputs":[{"internalType":"ResourceId","name":"tableId","type":"bytes32","indexed":true},{"internalType":"bytes32[]","name":"keyTuple","type":"bytes32[]","indexed":false}],"type":"event","name":"Store_DeleteRecord","anonymous":false},{"inputs":[{"internalType":"ResourceId","name":"tableId","type":"bytes32","indexed":true},{"internalType":"bytes32[]","name":"keyTuple","type":"bytes32[]","indexed":false},{"internalType":"bytes","name":"staticData","type":"bytes","indexed":false},{"internalType":"EncodedLengths","name":"encodedLengths","type":"bytes32","indexed":false},{"internalType":"bytes","name":"dynamicData","type":"bytes","indexed":false}],"type":"event","name":"Store_SetRecord","anonymous":false},{"inputs":[{"internalType":"ResourceId","name":"tableId","type":"bytes32","indexed":true},{"internalType":"bytes32[]","name":"keyTuple","type":"bytes32[]","indexed":false},{"internalType":"uint8","name":"dynamicFieldIndex","type":"uint8","indexed":false},{"internalType":"uint48","name":"start","type":"uint48","indexed":false},{"internalType":"uint40","name":"deleteCount","type":"uint40","indexed":false},{"internalType":"EncodedLengths","name":"encodedLengths","type":"bytes32","indexed":false},{"internalType":"bytes","name":"data","type":"bytes","indexed":false}],"type":"event","name":"Store_SpliceDynamicData","anonymous":false},{"inputs":[{"internalType":"ResourceId","name":"tableId","type":"bytes32","indexed":true},{"internalType":"bytes32[]","name":"keyTuple","type":"bytes32[]","indexed":false},{"internalType":"uint48","name":"start","type":"uint48","indexed":false},{"internalType":"bytes","name":"data","type":"bytes","indexed":false}],"type":"event","name":"Store_SpliceStaticData","anonymous":false},{"inputs":[{"internalType":"enum ItemType","name":"itemType","type":"uint8"},{"internalType":"uint256","name":"supply","type":"uint256"},{"internalType":"string","name":"itemMetadataURI","type":"string"},{"internalType":"bytes","name":"stats","type":"bytes"}],"stateMutability":"nonpayable","type":"function","name":"UD__createItem","outputs":[{"internalType":"uint256","name":"","type":"uint256"}]},{"inputs":[{"internalType":"uint256","name":"characterId","type":"uint256"}],"stateMutability":"nonpayable","type":"function","name":"UD__enterGame"},{"inputs":[{"internalType":"uint256","name":"characterId","type":"uint256"}],"stateMutability":"view","type":"function","name":"UD__getCharacterStats","outputs":[{"internalType":"struct CharacterStatsData","name":"","type":"tuple","components":[{"internalType":"uint256","name":"strength","type":"uint256"},{"internalType":"uint256","name":"agility","type":"uint256"},{"internalType":"uint256","name":"intelligence","type":"uint256"},{"internalType":"uint256","name":"hitPoints","type":"uint256"},{"internalType":"uint256","name":"experience","type":"uint256"}]}]},{"inputs":[],"stateMutability":"view","type":"function","name":"UD__getCharacterToken","outputs":[{"internalType":"address","name":"_characterToken","type":"address"}]},{"inputs":[{"internalType":"uint256","name":"characterId","type":"uint256"}],"stateMutability":"view","type":"function","name":"UD__getClass","outputs":[{"internalType":"enum Classes","name":"_class","type":"uint8"}]},{"inputs":[],"stateMutability":"view","type":"function","name":"UD__getEntropy","outputs":[{"internalType":"address","name":"_entropy","type":"address"}]},{"inputs":[{"internalType":"uint256","name":"characterId","type":"uint256"}],"stateMutability":"view","type":"function","name":"UD__getExperience","outputs":[{"internalType":"uint256","name":"","type":"uint256"}]},{"inputs":[],"stateMutability":"view","type":"function","name":"UD__getGoldToken","outputs":[{"internalType":"address","name":"_goldToken","type":"address"}]},{"inputs":[],"stateMutability":"view","type":"function","name":"UD__getItemsContract","outputs":[{"internalType":"address","name":"_erc1155","type":"address"}]},{"inputs":[{"internalType":"uint256","name":"characterId","type":"uint256"}],"stateMutability":"view","type":"function","name":"UD__getName","outputs":[{"internalType":"bytes32","name":"_name","type":"bytes32"}]},{"inputs":[{"internalType":"uint256","name":"characterId","type":"uint256"}],"stateMutability":"view","type":"function","name":"UD__getOwner","outputs":[{"internalType":"address","name":"","type":"address"}]},{"inputs":[],"stateMutability":"view","type":"function","name":"UD__getPythProvider","outputs":[{"internalType":"address","name":"_provider","type":"address"}]},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"stateMutability":"view","type":"function","name":"UD__getTotalSupply","outputs":[{"internalType":"uint256","name":"_supply","type":"uint256"}]},{"inputs":[{"internalType":"uint256","name":"itemId","type":"uint256"}],"stateMutability":"view","type":"function","name":"UD__getWeaponStats","outputs":[{"internalType":"struct WeaponStats","name":"_weaponStats","type":"tuple","components":[{"internalType":"uint256","name":"damage","type":"uint256"},{"internalType":"uint256","name":"speed","type":"uint256"},{"internalType":"uint8[]","name":"classRestrictions","type":"uint8[]"}]}]},{"inputs":[{"internalType":"uint256","name":"characterId","type":"uint256"}],"stateMutability":"nonpayable","type":"function","name":"UD__issueStarterItems"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bytes32","name":"name","type":"bytes32"},{"internalType":"string","name":"tokenUri","type":"string"}],"stateMutability":"nonpayable","type":"function","name":"UD__mintCharacter","outputs":[{"internalType":"uint256","name":"characterId","type":"uint256"}]},{"inputs":[{"internalType":"bytes32","name":"userRandomNumber","type":"bytes32"},{"internalType":"uint256","name":"characterId","type":"uint256"},{"internalType":"enum Classes","name":"class","type":"uint8"}],"stateMutability":"payable","type":"function","name":"UD__rollStats"},{"inputs":[{"internalType":"enum Classes","name":"class","type":"uint8"},{"internalType":"uint256[]","name":"itemIds","type":"uint256[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"stateMutability":"nonpayable","type":"function","name":"UD__setStarterItems"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"string","name":"tokenUri","type":"string"}],"stateMutability":"nonpayable","type":"function","name":"UD__setTokenUri"},{"inputs":[{"internalType":"struct SystemCallData[]","name":"systemCalls","type":"tuple[]","components":[{"internalType":"ResourceId","name":"systemId","type":"bytes32"},{"internalType":"bytes","name":"callData","type":"bytes"}]}],"stateMutability":"nonpayable","type":"function","name":"batchCall","outputs":[{"internalType":"bytes[]","name":"returnDatas","type":"bytes[]"}]},{"inputs":[{"internalType":"struct SystemCallFromData[]","name":"systemCalls","type":"tuple[]","components":[{"internalType":"address","name":"from","type":"address"},{"internalType":"ResourceId","name":"systemId","type":"bytes32"},{"internalType":"bytes","name":"callData","type":"bytes"}]}],"stateMutability":"nonpayable","type":"function","name":"batchCallFrom","outputs":[{"internalType":"bytes[]","name":"returnDatas","type":"bytes[]"}]},{"inputs":[{"internalType":"ResourceId","name":"systemId","type":"bytes32"},{"internalType":"bytes","name":"callData","type":"bytes"}],"stateMutability":"payable","type":"function","name":"call","outputs":[{"internalType":"bytes","name":"","type":"bytes"}]},{"inputs":[{"internalType":"address","name":"delegator","type":"address"},{"internalType":"ResourceId","name":"systemId","type":"bytes32"},{"internalType":"bytes","name":"callData","type":"bytes"}],"stateMutability":"payable","type":"function","name":"callFrom","outputs":[{"internalType":"bytes","name":"","type":"bytes"}]},{"inputs":[],"stateMutability":"view","type":"function","name":"creator","outputs":[{"internalType":"address","name":"","type":"address"}]},{"inputs":[{"internalType":"ResourceId","name":"tableId","type":"bytes32"},{"internalType":"bytes32[]","name":"keyTuple","type":"bytes32[]"}],"stateMutability":"nonpayable","type":"function","name":"deleteRecord"},{"inputs":[{"internalType":"ResourceId","name":"tableId","type":"bytes32"},{"internalType":"bytes32[]","name":"keyTuple","type":"bytes32[]"},{"internalType":"uint8","name":"dynamicFieldIndex","type":"uint8"}],"stateMutability":"view","type":"function","name":"getDynamicField","outputs":[{"internalType":"bytes","name":"","type":"bytes"}]},{"inputs":[{"internalType":"ResourceId","name":"tableId","type":"bytes32"},{"internalType":"bytes32[]","name":"keyTuple","type":"bytes32[]"},{"internalType":"uint8","name":"dynamicFieldIndex","type":"uint8"}],"stateMutability":"view","type":"function","name":"getDynamicFieldLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}]},{"inputs":[{"internalType":"ResourceId","name":"tableId","type":"bytes32"},{"internalType":"bytes32[]","name":"keyTuple","type":"bytes32[]"},{"internalType":"uint8","name":"dynamicFieldIndex","type":"uint8"},{"internalType":"uint256","name":"start","type":"uint256"},{"internalType":"uint256","name":"end","type":"uint256"}],"stateMutability":"view","type":"function","name":"getDynamicFieldSlice","outputs":[{"internalType":"bytes","name":"data","type":"bytes"}]},{"inputs":[{"internalType":"ResourceId","name":"tableId","type":"bytes32"},{"internalType":"bytes32[]","name":"keyTuple","type":"bytes32[]"},{"internalType":"uint8","name":"fieldIndex","type":"uint8"},{"internalType":"FieldLayout","name":"fieldLayout","type":"bytes32"}],"stateMutability":"view","type":"function","name":"getField","outputs":[{"internalType":"bytes","name":"data","type":"bytes"}]},{"inputs":[{"internalType":"ResourceId","name":"tableId","type":"bytes32"},{"internalType":"bytes32[]","name":"keyTuple","type":"bytes32[]"},{"internalType":"uint8","name":"fieldIndex","type":"uint8"}],"stateMutability":"view","type":"function","name":"getField","outputs":[{"internalType":"bytes","name":"data","type":"bytes"}]},{"inputs":[{"internalType":"ResourceId","name":"tableId","type":"bytes32"}],"stateMutability":"view","type":"function","name":"getFieldLayout","outputs":[{"internalType":"FieldLayout","name":"fieldLayout","type":"bytes32"}]},{"inputs":[{"internalType":"ResourceId","name":"tableId","type":"bytes32"},{"internalType":"bytes32[]","name":"keyTuple","type":"bytes32[]"},{"internalType":"uint8","name":"fieldIndex","type":"uint8"},{"internalType":"FieldLayout","name":"fieldLayout","type":"bytes32"}],"stateMutability":"view","type":"function","name":"getFieldLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}]},{"inputs":[{"internalType":"ResourceId","name":"tableId","type":"bytes32"},{"internalType":"bytes32[]","name":"keyTuple","type":"bytes32[]"},{"internalType":"uint8","name":"fieldIndex","type":"uint8"}],"stateMutability":"view","type":"function","name":"getFieldLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}]},{"inputs":[{"internalType":"ResourceId","name":"tableId","type":"bytes32"}],"stateMutability":"view","type":"function","name":"getKeySchema","outputs":[{"internalType":"Schema","name":"keySchema","type":"bytes32"}]},{"inputs":[{"internalType":"ResourceId","name":"tableId","type":"bytes32"},{"internalType":"bytes32[]","name":"keyTuple","type":"bytes32[]"},{"internalType":"FieldLayout","name":"fieldLayout","type":"bytes32"}],"stateMutability":"view","type":"function","name":"getRecord","outputs":[{"internalType":"bytes","name":"staticData","type":"bytes"},{"internalType":"EncodedLengths","name":"encodedLengths","type":"bytes32"},{"internalType":"bytes","name":"dynamicData","type":"bytes"}]},{"inputs":[{"internalType":"ResourceId","name":"tableId","type":"bytes32"},{"internalType":"bytes32[]","name":"keyTuple","type":"bytes32[]"}],"stateMutability":"view","type":"function","name":"getRecord","outputs":[{"internalType":"bytes","name":"staticData","type":"bytes"},{"internalType":"EncodedLengths","name":"encodedLengths","type":"bytes32"},{"internalType":"bytes","name":"dynamicData","type":"bytes"}]},{"inputs":[{"internalType":"ResourceId","name":"tableId","type":"bytes32"},{"internalType":"bytes32[]","name":"keyTuple","type":"bytes32[]"},{"internalType":"uint8","name":"fieldIndex","type":"uint8"},{"internalType":"FieldLayout","name":"fieldLayout","type":"bytes32"}],"stateMutability":"view","type":"function","name":"getStaticField","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}]},{"inputs":[{"internalType":"ResourceId","name":"tableId","type":"bytes32"}],"stateMutability":"view","type":"function","name":"getValueSchema","outputs":[{"internalType":"Schema","name":"valueSchema","type":"bytes32"}]},{"inputs":[{"internalType":"ResourceId","name":"resourceId","type":"bytes32"},{"internalType":"address","name":"grantee","type":"address"}],"stateMutability":"nonpayable","type":"function","name":"grantAccess"},{"inputs":[{"internalType":"contract IModule","name":"initModule","type":"address"}],"stateMutability":"nonpayable","type":"function","name":"initialize"},{"inputs":[{"internalType":"contract IModule","name":"module","type":"address"},{"internalType":"bytes","name":"encodedArgs","type":"bytes"}],"stateMutability":"nonpayable","type":"function","name":"installModule"},{"inputs":[{"internalType":"contract IModule","name":"module","type":"address"},{"internalType":"bytes","name":"encodedArgs","type":"bytes"}],"stateMutability":"nonpayable","type":"function","name":"installRootModule"},{"inputs":[{"internalType":"ResourceId","name":"tableId","type":"bytes32"},{"internalType":"bytes32[]","name":"keyTuple","type":"bytes32[]"},{"internalType":"uint8","name":"dynamicFieldIndex","type":"uint8"},{"internalType":"uint256","name":"byteLengthToPop","type":"uint256"}],"stateMutability":"nonpayable","type":"function","name":"popFromDynamicField"},{"inputs":[{"internalType":"ResourceId","name":"tableId","type":"bytes32"},{"internalType":"bytes32[]","name":"keyTuple","type":"bytes32[]"},{"internalType":"uint8","name":"dynamicFieldIndex","type":"uint8"},{"internalType":"bytes","name":"dataToPush","type":"bytes"}],"stateMutability":"nonpayable","type":"function","name":"pushToDynamicField"},{"inputs":[{"internalType":"address","name":"delegatee","type":"address"},{"internalType":"ResourceId","name":"delegationControlId","type":"bytes32"},{"internalType":"bytes","name":"initCallData","type":"bytes"}],"stateMutability":"nonpayable","type":"function","name":"registerDelegation"},{"inputs":[{"internalType":"ResourceId","name":"systemId","type":"bytes32"},{"internalType":"string","name":"systemFunctionSignature","type":"string"}],"stateMutability":"nonpayable","type":"function","name":"registerFunctionSelector","outputs":[{"internalType":"bytes4","name":"worldFunctionSelector","type":"bytes4"}]},{"inputs":[{"internalType":"ResourceId","name":"namespaceId","type":"bytes32"}],"stateMutability":"nonpayable","type":"function","name":"registerNamespace"},{"inputs":[{"internalType":"ResourceId","name":"namespaceId","type":"bytes32"},{"internalType":"ResourceId","name":"delegationControlId","type":"bytes32"},{"internalType":"bytes","name":"initCallData","type":"bytes"}],"stateMutability":"nonpayable","type":"function","name":"registerNamespaceDelegation"},{"inputs":[{"internalType":"ResourceId","name":"systemId","type":"bytes32"},{"internalType":"string","name":"worldFunctionSignature","type":"string"},{"internalType":"string","name":"systemFunctionSignature","type":"string"}],"stateMutability":"nonpayable","type":"function","name":"registerRootFunctionSelector","outputs":[{"internalType":"bytes4","name":"worldFunctionSelector","type":"bytes4"}]},{"inputs":[{"internalType":"ResourceId","name":"tableId","type":"bytes32"},{"internalType":"contract IStoreHook","name":"hookAddress","type":"address"},{"internalType":"uint8","name":"enabledHooksBitmap","type":"uint8"}],"stateMutability":"nonpayable","type":"function","name":"registerStoreHook"},{"inputs":[{"internalType":"ResourceId","name":"systemId","type":"bytes32"},{"internalType":"contract System","name":"system","type":"address"},{"internalType":"bool","name":"publicAccess","type":"bool"}],"stateMutability":"nonpayable","type":"function","name":"registerSystem"},{"inputs":[{"internalType":"ResourceId","name":"systemId","type":"bytes32"},{"internalType":"contract ISystemHook","name":"hookAddress","type":"address"},{"internalType":"uint8","name":"enabledHooksBitmap","type":"uint8"}],"stateMutability":"nonpayable","type":"function","name":"registerSystemHook"},{"inputs":[{"internalType":"ResourceId","name":"tableId","type":"bytes32"},{"internalType":"FieldLayout","name":"fieldLayout","type":"bytes32"},{"internalType":"Schema","name":"keySchema","type":"bytes32"},{"internalType":"Schema","name":"valueSchema","type":"bytes32"},{"internalType":"string[]","name":"keyNames","type":"string[]"},{"internalType":"string[]","name":"fieldNames","type":"string[]"}],"stateMutability":"nonpayable","type":"function","name":"registerTable"},{"inputs":[{"internalType":"ResourceId","name":"namespaceId","type":"bytes32"}],"stateMutability":"nonpayable","type":"function","name":"renounceOwnership"},{"inputs":[{"internalType":"ResourceId","name":"resourceId","type":"bytes32"},{"internalType":"address","name":"grantee","type":"address"}],"stateMutability":"nonpayable","type":"function","name":"revokeAccess"},{"inputs":[{"internalType":"ResourceId","name":"tableId","type":"bytes32"},{"internalType":"bytes32[]","name":"keyTuple","type":"bytes32[]"},{"internalType":"uint8","name":"dynamicFieldIndex","type":"uint8"},{"internalType":"bytes","name":"data","type":"bytes"}],"stateMutability":"nonpayable","type":"function","name":"setDynamicField"},{"inputs":[{"internalType":"ResourceId","name":"tableId","type":"bytes32"},{"internalType":"bytes32[]","name":"keyTuple","type":"bytes32[]"},{"internalType":"uint8","name":"fieldIndex","type":"uint8"},{"internalType":"bytes","name":"data","type":"bytes"}],"stateMutability":"nonpayable","type":"function","name":"setField"},{"inputs":[{"internalType":"ResourceId","name":"tableId","type":"bytes32"},{"internalType":"bytes32[]","name":"keyTuple","type":"bytes32[]"},{"internalType":"uint8","name":"fieldIndex","type":"uint8"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"FieldLayout","name":"fieldLayout","type":"bytes32"}],"stateMutability":"nonpayable","type":"function","name":"setField"},{"inputs":[{"internalType":"ResourceId","name":"tableId","type":"bytes32"},{"internalType":"bytes32[]","name":"keyTuple","type":"bytes32[]"},{"internalType":"bytes","name":"staticData","type":"bytes"},{"internalType":"EncodedLengths","name":"encodedLengths","type":"bytes32"},{"internalType":"bytes","name":"dynamicData","type":"bytes"}],"stateMutability":"nonpayable","type":"function","name":"setRecord"},{"inputs":[{"internalType":"ResourceId","name":"tableId","type":"bytes32"},{"internalType":"bytes32[]","name":"keyTuple","type":"bytes32[]"},{"internalType":"uint8","name":"fieldIndex","type":"uint8"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"FieldLayout","name":"fieldLayout","type":"bytes32"}],"stateMutability":"nonpayable","type":"function","name":"setStaticField"},{"inputs":[{"internalType":"ResourceId","name":"tableId","type":"bytes32"},{"internalType":"bytes32[]","name":"keyTuple","type":"bytes32[]"},{"internalType":"uint8","name":"dynamicFieldIndex","type":"uint8"},{"internalType":"uint40","name":"startWithinField","type":"uint40"},{"internalType":"uint40","name":"deleteCount","type":"uint40"},{"internalType":"bytes","name":"data","type":"bytes"}],"stateMutability":"nonpayable","type":"function","name":"spliceDynamicData"},{"inputs":[{"internalType":"ResourceId","name":"tableId","type":"bytes32"},{"internalType":"bytes32[]","name":"keyTuple","type":"bytes32[]"},{"internalType":"uint48","name":"start","type":"uint48"},{"internalType":"bytes","name":"data","type":"bytes"}],"stateMutability":"nonpayable","type":"function","name":"spliceStaticData"},{"inputs":[],"stateMutability":"view","type":"function","name":"storeVersion","outputs":[{"internalType":"bytes32","name":"version","type":"bytes32"}]},{"inputs":[{"internalType":"ResourceId","name":"fromNamespaceId","type":"bytes32"},{"internalType":"address","name":"toAddress","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"nonpayable","type":"function","name":"transferBalanceToAddress"},{"inputs":[{"internalType":"ResourceId","name":"fromNamespaceId","type":"bytes32"},{"internalType":"ResourceId","name":"toNamespaceId","type":"bytes32"},{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"nonpayable","type":"function","name":"transferBalanceToNamespace"},{"inputs":[{"internalType":"ResourceId","name":"namespaceId","type":"bytes32"},{"internalType":"address","name":"newOwner","type":"address"}],"stateMutability":"nonpayable","type":"function","name":"transferOwnership"},{"inputs":[{"internalType":"address","name":"delegatee","type":"address"}],"stateMutability":"nonpayable","type":"function","name":"unregisterDelegation"},{"inputs":[{"internalType":"ResourceId","name":"namespaceId","type":"bytes32"}],"stateMutability":"nonpayable","type":"function","name":"unregisterNamespaceDelegation"},{"inputs":[{"internalType":"ResourceId","name":"tableId","type":"bytes32"},{"internalType":"contract IStoreHook","name":"hookAddress","type":"address"}],"stateMutability":"nonpayable","type":"function","name":"unregisterStoreHook"},{"inputs":[{"internalType":"ResourceId","name":"systemId","type":"bytes32"},{"internalType":"contract ISystemHook","name":"hookAddress","type":"address"}],"stateMutability":"nonpayable","type":"function","name":"unregisterSystemHook"},{"inputs":[],"stateMutability":"view","type":"function","name":"worldVersion","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}]}],"devdoc":{"kind":"dev","methods":{"call(bytes32,bytes)":{"details":"If the system is not public, the caller must have access to the namespace or name (encoded in the system ID).","params":{"callData":"The data to pass with the call, function selector (4 bytes) followed by the ABI encoded parameters.","systemId":"The ID of the system to be called."},"returns":{"_0":"The abi encoded return data from the called system."}},"callFrom(address,bytes32,bytes)":{"details":"If the system is not public, the delegator must have access to the namespace or name (encoded in the system ID).","params":{"callData":"The data to pass with the call, function selector (4 bytes) followed by the ABI encoded parameters.","delegator":"The address on whose behalf the call is made.","systemId":"The ID of the system to be called."},"returns":{"_0":"The abi encoded return data from the called system."}},"creator()":{"returns":{"_0":"The address of the World's creator."}},"initialize(address)":{"details":"Can only be called once by the creator.","params":{"initModule":"The InitModule to be installed during initialization."}},"installRootModule(address,bytes)":{"details":"Requires the caller to own the root namespace. The module is delegatecalled and installed in the root namespace.","params":{"encodedArgs":"The ABI encoded arguments for the module installation.","module":"The module to be installed."}},"storeVersion()":{"returns":{"version":"The protocol version of the Store contract."}},"worldVersion()":{"returns":{"_0":"The protocol version of the World."}}},"version":1},"userdoc":{"kind":"user","methods":{"call(bytes32,bytes)":{"notice":"Call the system at the given system ID."},"callFrom(address,bytes32,bytes)":{"notice":"Call the system at the given system ID on behalf of the given delegator."},"creator()":{"notice":"Retrieve the immutable original deployer of the World."},"getDynamicField(bytes32,bytes32[],uint8)":{"notice":"Get a single dynamic field from the given tableId and key tuple at the given dynamic field index. (Dynamic field index = field index - number of static fields)"},"getDynamicFieldLength(bytes32,bytes32[],uint8)":{"notice":"Get the byte length of a single dynamic field from the given tableId and key tuple"},"getDynamicFieldSlice(bytes32,bytes32[],uint8,uint256,uint256)":{"notice":"Get a byte slice (including start, excluding end) of a single dynamic field from the given tableId and key tuple, with the given value field layout. The slice is unchecked and will return invalid data if `start`:`end` overflow."},"getField(bytes32,bytes32[],uint8)":{"notice":"Get a single field from the given tableId and key tuple, loading the field layout from storage"},"getField(bytes32,bytes32[],uint8,bytes32)":{"notice":"Get a single field from the given tableId and key tuple, with the given field layout"},"getFieldLength(bytes32,bytes32[],uint8)":{"notice":"Get the byte length of a single field from the given tableId and key tuple, loading the field layout from storage"},"getFieldLength(bytes32,bytes32[],uint8,bytes32)":{"notice":"Get the byte length of a single field from the given tableId and key tuple, with the given value field layout"},"getRecord(bytes32,bytes32[])":{"notice":"Get full record (all fields, static and dynamic data) for the given tableId and key tuple, loading the field layout from storage"},"getRecord(bytes32,bytes32[],bytes32)":{"notice":"Get full record (all fields, static and dynamic data) for the given tableId and key tuple, with the given field layout"},"getStaticField(bytes32,bytes32[],uint8,bytes32)":{"notice":"Get a single static field from the given tableId and key tuple, with the given value field layout. Note: the field value is left-aligned in the returned bytes32, the rest of the word is not zeroed out. Consumers are expected to truncate the returned value as needed."},"initialize(address)":{"notice":"Initializes the World."},"installRootModule(address,bytes)":{"notice":"Install the given root module in the World."},"storeVersion()":{"notice":"Returns the protocol version of the Store contract."},"worldVersion()":{"notice":"Retrieve the protocol version of the World."}},"version":1}},"settings":{"remappings":["@codegen/=src/codegen/","@erc1155/=lib/ERC1155-puppet/","@interfaces/=src/interfaces/","@latticexyz/=node_modules/@latticexyz/","@openzeppelin-upgradeable/=node_modules/@openzeppelin/contracts-upgradeable/","@openzeppelin/=node_modules/@openzeppelin/contracts/","@pythnetwork/=node_modules/@pythnetwork/entropy-sdk-solidity/","@systems/=src/systems/","@tables/=src/codegen/tables/","@test/=test/","@world/=src/codegen/world/","ERC1155-puppet/=lib/ERC1155-puppet/","ds-test/=node_modules/ds-test/src/","forge-std/=node_modules/forge-std/src/"],"optimizer":{"enabled":true,"runs":3000},"metadata":{"bytecodeHash":"ipfs"},"compilationTarget":{"src/codegen/world/IWorld.sol":"IWorld"},"evmVersion":"paris","libraries":{}},"sources":{"node_modules/@latticexyz/schema-type/src/solidity/SchemaType.sol":{"keccak256":"0x650927696f7518fa216f2d6001835e9fdb419518034c781e86d2a2d33f4ecd2a","urls":["bzz-raw://72e91ac32ed00d36bd22fefeaf4ce1e9420143ddab7080eeb720c668a117bf44","dweb:/ipfs/QmdVqn18WZvx5p84MDJPsB5tfVoXDR86wzm4sLx6WrGYYL"],"license":"MIT"},"node_modules/@latticexyz/store/src/Bytes.sol":{"keccak256":"0x7dec900f9c9e7dff59430fa6f520e76c56338c3e829201aea140d49342e4fef8","urls":["bzz-raw://e55c1dfcda94dcc64b8577949b2e92a9d3fc44f5fba1ae77ceacccfdc8e22e35","dweb:/ipfs/QmS7uRJbEQYkPuZ5Dz5aSNjaaxj9PA8RtxUeUGN2W3jZx6"],"license":"MIT"},"node_modules/@latticexyz/store/src/EncodedLengths.sol":{"keccak256":"0xebc0a6efd611e02b15c05a382382b597fe059eba7f2a9e90da81eeb2f7666774","urls":["bzz-raw://00b2cac12599935e25ea0697e99fc9e6d5af6c1c982761996c16707d9cd6ca09","dweb:/ipfs/QmXccFminkrFtDpNfx6X1pHvW7Tn1nA5XcGu9T17pJyZyK"],"license":"MIT"},"node_modules/@latticexyz/store/src/FieldLayout.sol":{"keccak256":"0x15f698b7eabc062a00ff7a2e02db0ace2dd51f8bd2bc51a45dc0afa88f2ee658","urls":["bzz-raw://f774202c98ad394b3b62be93292512c633dec63bc931c190ed984656c2d54ec7","dweb:/ipfs/Qmd2D9mvP8S88ad2Q8WU54saNVr3Pwc5stPqEKHwcpo8AT"],"license":"MIT"},"node_modules/@latticexyz/store/src/Hook.sol":{"keccak256":"0xd016a2e1260f5a81ff9a8dfac58d7947e114414df8cce7302a2629908ea5f18e","urls":["bzz-raw://0c558a6f3a5f540c0190fa6d642a094a185c5db1acfc2437c7dbde0340f00ac3","dweb:/ipfs/QmViAHvR7U7HNfBiBZEMFiy1TTSHDFNiDzBfQSeLBShCky"],"license":"MIT"},"node_modules/@latticexyz/store/src/IERC165.sol":{"keccak256":"0x0efbf9afc716c585621482221f75e5bd60bcf0e813c9f7800d7c0309dcc3c927","urls":["bzz-raw://31b6aeb5446a0a0d5bd71be15a68c5bde94b08c961369203b83c8abe36f401d2","dweb:/ipfs/QmXhComne4es9ZMKaGNqHCdJZrFoFssxMYgLaqvCXPL1Mg"],"license":"MIT"},"node_modules/@latticexyz/store/src/IEncodedLengthsErrors.sol":{"keccak256":"0x06bb49164f44acc8d51df7b75ecf2f7aeb9281f7a3b357cae7d8d58bd1700dfa","urls":["bzz-raw://719027f4cc60fea30ce01cd4f672462f41fac750ae802e91a1a6d37c929e11ba","dweb:/ipfs/QmWi5DM2jT5V5SGP1afRmFyRgFvuZiGDX2PWHwP19HssF1"],"license":"MIT"},"node_modules/@latticexyz/store/src/IFieldLayoutErrors.sol":{"keccak256":"0xaef70c46e412bded1024ac82c957cea81c1d1ab11878a95635531e2ac9673a53","urls":["bzz-raw://cda2c7dc02ee8f0163b1c8d0f3e1e05d48b2a009e5c7365d2418f17bc3455817","dweb:/ipfs/QmXHDZuCPTxjHaeiEaJhA81koX2NJ3Gj1zt5WVWaz77FL8"],"license":"MIT"},"node_modules/@latticexyz/store/src/ISchemaErrors.sol":{"keccak256":"0x0ac3de36c9d0058a17fcd7f1a905132215fd16ea3ed3b5109de1de04ddd7c441","urls":["bzz-raw://f83fa2546009cfd16b3b3969dcec1d67c9d818d910177b885ba263b6a948c65d","dweb:/ipfs/QmehywHdvFYBL9BTtoPsVVwJXsEA4Xjk8aPWoHw1R45KeY"],"license":"MIT"},"node_modules/@latticexyz/store/src/ISliceErrors.sol":{"keccak256":"0x72684b7dfc1b44537401ccf10d6120186d02323266fcc762bc81859985eded4c","urls":["bzz-raw://e8d037b6937969ae54018ddf647eeaf5eb69a2b0bf9edf9456d3d270316b2883","dweb:/ipfs/QmfYJeyAmzRqpn68FteiM97p5t17iBw62FCET4bK5g4w37"],"license":"MIT"},"node_modules/@latticexyz/store/src/IStore.sol":{"keccak256":"0x42515d1410333a3573f78a460576271ef62c16edad5cf771ef6287b83ca1c706","urls":["bzz-raw://6a58d03c4cf420df57d2b2e2e7932daad877e46e89561b46e1fa9f593a701bdc","dweb:/ipfs/QmeFmKS7J1WqqBAgXkyxxx2fGA8JzuGszUmVsV2T6DYtsL"],"license":"MIT"},"node_modules/@latticexyz/store/src/IStoreErrors.sol":{"keccak256":"0x37e4d2f015dd4005ff9b3f711257c891027804bc268db1791984af4989951912","urls":["bzz-raw://a4a566ea96b69211f503707f69a9f9012d5873a3fd57b3f221549f46a7518df6","dweb:/ipfs/QmVgcE3JufJr3iyeV6xqkvS4YtDcy6Eqyram2yzWUhwoB4"],"license":"MIT"},"node_modules/@latticexyz/store/src/IStoreEvents.sol":{"keccak256":"0x8606e9de37943c74beabb9ac9acd2132f951bed1ef79f2f4f3de83ed1f271f6a","urls":["bzz-raw://d13adeee7ae9e687bf1cd12a8c36223179685fc828a7c468ee9311c879401b08","dweb:/ipfs/QmQeb2ArSoQpE6ujBbDj9LY3xqpVCPiz3bh9SLT6siE8RY"],"license":"MIT"},"node_modules/@latticexyz/store/src/IStoreHook.sol":{"keccak256":"0x6574a30a2bbd8a0de21b2504c55effb8802fdeff62296af82a9380bd753adcc4","urls":["bzz-raw://85a859c533f51b584a9a2e8a64d61b6cf6f69bfcff1b926ad787518b1cae9562","dweb:/ipfs/QmVyjmyJ69ZeqaXHg91JtGLVahRfZ7KtWaessLWZ6rYk9p"],"license":"MIT"},"node_modules/@latticexyz/store/src/IStoreKernel.sol":{"keccak256":"0x37a23dcbabc5937a717f2fda636b6a97963ed4b5a96870a62dfb199a8b692f89","urls":["bzz-raw://ac9741ea6daf21f39699be11afd919ae3ec07df24d948aaaa6549456fefd7fc0","dweb:/ipfs/QmeiPQkZitM4Pc3i6L87thU71Fs1JVWAgMqXnSK8VrCq75"],"license":"MIT"},"node_modules/@latticexyz/store/src/IStoreRead.sol":{"keccak256":"0xdcf28b3293d4d6c1fe2808a8918c1b2122e4e0e49f2793c79ebd2b9ae210ff7b","urls":["bzz-raw://bb3d9cc80f549ed0c5b768aea69fb1b3c364bd4f85d193a3040c411b594d94db","dweb:/ipfs/QmYYdY5CjPHiW5ucXihTva1eHsCPNqBsvL6zYYafH3ap4p"],"license":"MIT"},"node_modules/@latticexyz/store/src/IStoreRegistration.sol":{"keccak256":"0x9e91a73f93cc9ebc00c265c83177f6a3f8a156749a9261202e2845e12aeaa96b","urls":["bzz-raw://a39280d87d22dd0a959d8f55925cb092dba1fee2f11d3dd8e3ffabed45a9ab6a","dweb:/ipfs/QmRMBFLJtT2KN43Xz9P3vUNWxXrP8rLTNBFw2P6Z7EGeaS"],"license":"MIT"},"node_modules/@latticexyz/store/src/IStoreWrite.sol":{"keccak256":"0x120fd448da5806e09ecb5327ad4dba64df01d2ee7232de0979133627e87e24ba","urls":["bzz-raw://7a3cb151b2ddee217f330d61813b2dcd997de94940c903719f6d066a21467890","dweb:/ipfs/Qmbes1RRY6KdtsMohp8834xXyipeQK9GJ41NfgXK1d1QAZ"],"license":"MIT"},"node_modules/@latticexyz/store/src/Memory.sol":{"keccak256":"0xef6e7000b181c2991aeacbf99a9d886f8c4df88878b857713f851185b63a7811","urls":["bzz-raw://b079b4773d140ab2c01bdb04facfa56a78f753aea7122fa445b2bfa133411392","dweb:/ipfs/QmWYWKFpwtsPeGdCSxcANgxXUbwAuMMgR7iMVPDSCZxz2A"],"license":"MIT"},"node_modules/@latticexyz/store/src/ResourceId.sol":{"keccak256":"0x889423054511cf8a83f5dfd65a0f984dc514aba798ef3db139b59d395b2327e2","urls":["bzz-raw://40b9495d455c87db8b063e291ca3973dc3ba1163f09c5d7446241a9e1cb69ed0","dweb:/ipfs/Qmek1JKVjPUpoXnKwu66HfPS9rHstKtWTuBmG8YFxbPEWQ"],"license":"MIT"},"node_modules/@latticexyz/store/src/Schema.sol":{"keccak256":"0x0d2a08030d21292ecbcc850d9111f3817d03f17cd5e02186894848a9152d79d7","urls":["bzz-raw://3f30024c1613fb587aaba4c1dcb8e4e46ed765a2cebd5b63fbebd327d1bf13d3","dweb:/ipfs/QmZzqSnPMYKDYwbFNvUFrvuazMUyQHzQ59w3A9x6juHAm7"],"license":"MIT"},"node_modules/@latticexyz/store/src/Slice.sol":{"keccak256":"0xae6c03881fdfa56cba1879d9c9c6b52c2829e6a278a200176678d8da05a89345","urls":["bzz-raw://3cad7dc4944c0518de2e7f99697485d365ae37aa6cad6967996377c2dd951fe4","dweb:/ipfs/QmW3grFwr8BcgJmLfjLbj3FthnD7NRUBFMFiahbXztHPr7"],"license":"MIT"},"node_modules/@latticexyz/store/src/Storage.sol":{"keccak256":"0x7e735a4c7fa8b8a5fe2371d90801e3287ddb78efed69b31e1a76f0b7b153c4c3","urls":["bzz-raw://9e6db36bd52144b6feeecd91a58fc311127a3892fc96c4171db5b570fe9876ee","dweb:/ipfs/QmS6LqnTZvpMc4eiz5JowBoNnh3RYemG6JHjqtYucT1rQi"],"license":"MIT"},"node_modules/@latticexyz/store/src/StoreCore.sol":{"keccak256":"0x9513dc38e5baadde0ba9b08320a324043b0e88a10702be5c3507da8c3d45e861","urls":["bzz-raw://99c80c65a394763668e4aed69220fec6bb3ed847fb277ddd1ff1d4bfdf452da2","dweb:/ipfs/QmRT2BATKtrYmixWMuWo9Cz8g8oscfLNSmvjxTyiTNA1pc"],"license":"MIT"},"node_modules/@latticexyz/store/src/StoreSwitch.sol":{"keccak256":"0x7edf7c1641408f3a580eb28bda58054583cb846f875608612671c6d40712ba40","urls":["bzz-raw://4146adef610d1daab085a81aa9f2d4fd8c4e5f459b9ef184f3ef23465573cf91","dweb:/ipfs/QmQqZMsbkzSNG6VfYzQLdRCBCsNohBSVQmWoTP6QvKmKUP"],"license":"MIT"},"node_modules/@latticexyz/store/src/codegen/index.sol":{"keccak256":"0x094a6f1e2910b345b6b254e0fc2c8882b3190c673f7ee19742e857057a4d3f85","urls":["bzz-raw://18908e2e7e878635abea72ef99851fddd204371e6b641f010e831ebfa0b1bfd4","dweb:/ipfs/QmSNAxXqxTrzPkZ4rSAQgBnuer1yLPq74hoqnzrZV3WGsb"],"license":"MIT"},"node_modules/@latticexyz/store/src/codegen/tables/Hooks.sol":{"keccak256":"0xfdea5b4cf666720c1c0d81a8acdede68e6220aee45d8a9f3c9834b4edc5da394","urls":["bzz-raw://b3a394dfe123cfb7200f65d379fb0cb3d2c84475b382faf6ee11bf9c45a63b53","dweb:/ipfs/QmRMPHFBbCKtqKBVV9gvd2jhnfsyUKmCBEQkgviMoxi1UG"],"license":"MIT"},"node_modules/@latticexyz/store/src/codegen/tables/ResourceIds.sol":{"keccak256":"0xf192bceab34508cee21dd7c33e4d776f79c4a7ca55ee8905c6c694850ebfdf64","urls":["bzz-raw://c95113f76f6de671cb44710754e0942934182b544660a4330fc90a505e198905","dweb:/ipfs/QmXma5ZxfK8Y9TbvB7QM9hdhfc1ixiMcLpo9BQxnVthHB5"],"license":"MIT"},"node_modules/@latticexyz/store/src/codegen/tables/StoreHooks.sol":{"keccak256":"0xa825218614acc19a4100357dd7ee410b67b994fe7aaa68650d5d0d4202d4ca8c","urls":["bzz-raw://09b0cbb598fe2b75bbcd269b47d686a66fcc89c0c40d9a09807eba7688b81fc6","dweb:/ipfs/QmYk6XQwSLhRumujTCsqxdvugKuP8oLjjB926pMHR445ra"],"license":"MIT"},"node_modules/@latticexyz/store/src/codegen/tables/Tables.sol":{"keccak256":"0x918b977e7f7f3e947d6d5aa189c54c9c7e7c106d0a0d53734ee959ad454abe09","urls":["bzz-raw://3a3de63c04c838bf80c1903cf7464d201d0ece0f86a7aaca35462b730e9338fc","dweb:/ipfs/QmSUkLZ88J7tSwdmR3viBJHU8QVgN2Gji6W8wYLJEDNkc2"],"license":"MIT"},"node_modules/@latticexyz/store/src/constants.sol":{"keccak256":"0x67e0d59237bd37424827ecde1ecdbe71f65376af517b0623cd8f8d5451bca7a6","urls":["bzz-raw://09c5ec7fe73e06140957d44a3d9938587711c783ccbf08ff017638c9279a3168","dweb:/ipfs/QmfS9ZRqHXmBJ1h5B4x4gbU6d18DtMgKZSkxhQgNVRxueu"],"license":"MIT"},"node_modules/@latticexyz/store/src/rightMask.sol":{"keccak256":"0x28887aab8ad5ca598927e59d702999ca6e3b3128f1cddd2b995a381c8d04b275","urls":["bzz-raw://7710847f4689b7f5b81436c7d52ae4395f244a2eebf8d398b2edd43accb06754","dweb:/ipfs/QmTD2wYqryXTynHAn5Vf9wtjUUSGeCJWENZTnWtBAK38pa"],"license":"MIT"},"node_modules/@latticexyz/store/src/storeHookTypes.sol":{"keccak256":"0x4f29001e53690ce74fe405a6d0376a564c9c743d1631d36fab04331865e4d572","urls":["bzz-raw://138c80abd63225a3eeb01ebfa1f9288e188a7ee5b2266b275fb4ed31b5aa30e3","dweb:/ipfs/QmdEx9uHgCCbTcetGwFH5a66Ft7ajmrMDXvP1fW7WjnnE2"],"license":"MIT"},"node_modules/@latticexyz/store/src/storeResourceTypes.sol":{"keccak256":"0x1c4cb6b3ecf76f614479ab304d7de3ade0e99c7ccfd07717b57c92f699a27261","urls":["bzz-raw://2c9b0e0c9b3b5610d6fd65a8ffd7c54df390a34ccc70d58f4a055c49ad1ea586","dweb:/ipfs/QmP6ffpnR7aRyvq9AiUkVNH6LbGfFP3NDq7E2n2PVcHhp2"],"license":"MIT"},"node_modules/@latticexyz/store/src/tightcoder/DecodeSlice.sol":{"keccak256":"0x310523f7f3acca841e62fe50be8d8b042cad5b3c239cb1105d6623cf83e63152","urls":["bzz-raw://1cc40ca233acf6502bc65677b381c05331dd7323953e54b5df969051e47f851e","dweb:/ipfs/QmTxy9mhodT8drezB5K1kPR78AMaARomoJqDyaWpLuCKui"],"license":"MIT"},"node_modules/@latticexyz/store/src/tightcoder/EncodeArray.sol":{"keccak256":"0x259ee545fd9dfd4767f0b7fef31f52fd3c54c4a1c6657d6fbda4927800c937b3","urls":["bzz-raw://0a4e31efa9f476cd267af7c3e11fe0151252206a1f6407a80a4092444c2de8ea","dweb:/ipfs/QmRF4gWYw33mFTMh7nX8DJ1qzx3Ko6yMsnxubzYTRppdyo"],"license":"MIT"},"node_modules/@latticexyz/store/src/tightcoder/TightCoder.sol":{"keccak256":"0x0e74ff88ec94cb33f79d8afc1497c4fdccf02db40ab47f3701c7d02fc305d4d8","urls":["bzz-raw://36b7cd0c2a3f2dcdc83ab7ac5a93f123746ce29c0f1000f2b275ad2c647ff0f3","dweb:/ipfs/QmYdipHYUhHhS78wLdtmKZUK14FEwpto5mFy3rNeZssMLz"],"license":"MIT"},"node_modules/@latticexyz/store/src/version.sol":{"keccak256":"0x78c571906ee999ee7e56d4f7702b8a93c3a9e55e6b552aca115b5f6ac7f1c80a","urls":["bzz-raw://a9f141b2d556b2a2545e7db5606e8a038679a995a22aeaf1702cb3a60320b60a","dweb:/ipfs/QmY7x258Fhj3TT3RT4sNyyfiRphVYdZXhtAnSYpasJ4xVQ"],"license":"MIT"},"node_modules/@latticexyz/world/src/IERC165.sol":{"keccak256":"0xe3d9074a1be3247be67ff4dd2c9e41481650ddaa799285a249736bb85673e33d","urls":["bzz-raw://0b6743ee1e6d0c74927bf17fc1da0cad7575aa7634871b94190ffbdb4c28c2a7","dweb:/ipfs/Qma5bNsPJSBTesWxg3eAAMUBTDE7UjqWaHF7eMiGwP87jr"],"license":"MIT"},"node_modules/@latticexyz/world/src/IModule.sol":{"keccak256":"0xbb926cf64e685bbf2770d60124664cc84ab70bd3038e17a074f2d472c3fc2c57","urls":["bzz-raw://143c3dcbdf1702dd4f9c869629609386c12f7c0247e88a6d062dc4d519ebe0d2","dweb:/ipfs/QmQJSDd8uFL4sssw9fb9NHo4s6zjuDUgmrLHj3zsJuhMo1"],"license":"MIT"},"node_modules/@latticexyz/world/src/IModuleErrors.sol":{"keccak256":"0x60917e029779c81cfea1f5140c389269e51d7adb78987f39101b9e0d7bdad12d","urls":["bzz-raw://513f41920d67ca28c3e0fe247403c28a4d342785192df449c99d5f92db04fcea","dweb:/ipfs/QmeAG2TtxAgcJQR4QxftuSvQrxisYQ1i1GZoyd7oeFQBDJ"],"license":"MIT"},"node_modules/@latticexyz/world/src/ISystemHook.sol":{"keccak256":"0x81f1743d7ca6a9c7efc4997cf95e603ccb2070885265ca0e540f461aa7430721","urls":["bzz-raw://93d99e78b541b33ecd501bf0cd407a78cef490fec8eaef2f188bddb9e293a99f","dweb:/ipfs/QmPrcMDxwhvBZTr2AxoGqJA9L3Mjx27KBc98h3gXSsa3PM"],"license":"MIT"},"node_modules/@latticexyz/world/src/IWorldContextConsumer.sol":{"keccak256":"0xb39e9d8cff4162e255f6c460ef9f9f0ad5b804627f745d967b2f10d0dd509299","urls":["bzz-raw://18d957cd87febccc00d82b9454047f0f5236250c9245befc0f57978671675255","dweb:/ipfs/QmdZ1eXBd15vLpLVqTNJDAAaTzzucpRLD8GPJahLKT4J7x"],"license":"MIT"},"node_modules/@latticexyz/world/src/IWorldErrors.sol":{"keccak256":"0x0abae6f4ed1b3070bddd0ed194c08b83a948b61ae959396202cf627bf1056a2b","urls":["bzz-raw://a7037954f281cc0188a5aafc1d0cca0aabc110fd0234e6c43dca35ad69ed3baf","dweb:/ipfs/Qmbv2nfK1qPpnoAbqNJFqWwo7AuyaX2ZEgZMFspMv7DR5B"],"license":"MIT"},"node_modules/@latticexyz/world/src/IWorldEvents.sol":{"keccak256":"0x39f6d8930db431c04158b85cc2a612c48d43dc81ec998f267076b12293c5d243","urls":["bzz-raw://d68f1543e5e166d639372d1aec57e3e193b5bb3b37270b6cb0488fab2c0ebe57","dweb:/ipfs/QmdJUFDx87AHWFKP3jVrYg8xqAkiPfuT1M3tEotNt7KUoy"],"license":"MIT"},"node_modules/@latticexyz/world/src/IWorldKernel.sol":{"keccak256":"0xdaa1e92439036e392fe79892819ae165732f416b831f84d38050ca3d958e549b","urls":["bzz-raw://ea8dc52e31a62e8971322ea9ed8f2e83d562ec199d7f93a392c293e96ff7f092","dweb:/ipfs/QmSbM8MgHbrJLYP7uzemfZeC4xctqdyKDbspwHUsgeeVJC"],"license":"MIT"},"node_modules/@latticexyz/world/src/System.sol":{"keccak256":"0xadcb32bdc444a4420909b738d81fa662dc63739455fe93d5aa89c93a3ccfd2dd","urls":["bzz-raw://d303094c84ebfb0f9f114c54ff4dfc68bfa1e526d0ebe304be6fbeb7cb2f0d3f","dweb:/ipfs/QmYvUx1mNDhkxZFqxLeswW3w9HkvVqeoJiJKj1HN1SB7Gi"],"license":"MIT"},"node_modules/@latticexyz/world/src/WorldContext.sol":{"keccak256":"0x50ca52bdd89a9f27d6b03ad00ef45c8c5a6884ea9d75e18f8fa53524ac2feed9","urls":["bzz-raw://55febdece37b291527094fb654919d4c8fe0b231792996a14c5e5cc76512b19e","dweb:/ipfs/QmZHFbDDNmdFHWc1uTSvDgMUUgb8NgBPb1cDUJYajswbHT"],"license":"MIT"},"node_modules/@latticexyz/world/src/WorldResourceId.sol":{"keccak256":"0xaff9a22fac8a0f6eee5763b07a7ccb623c829d37922b85e42e914aad2ad417ee","urls":["bzz-raw://e598f0274d6d97c0a09806bf4fd1f0d054c310cf51b2123f5ce6380d6f3186ea","dweb:/ipfs/QmaaVvqm21YsCgxozDyShcM17jKUXJhf2y26bk2YzPYZoM"],"license":"MIT"},"node_modules/@latticexyz/world/src/codegen/interfaces/IAccessManagementSystem.sol":{"keccak256":"0x7e7321b86836bfbf4b96d0fb2a424ed678efcf01b15fa3d0b4ae4f0b975ad5dc","urls":["bzz-raw://ead41554796bd0507e390f2997aa4a8df7bff8b51523b86fa3c5bd8acb1fec48","dweb:/ipfs/QmVe1VUhfbRy8tviA7UcCtS8NjXhsF1E6Re9xLqWS5aRTK"],"license":"MIT"},"node_modules/@latticexyz/world/src/codegen/interfaces/IBalanceTransferSystem.sol":{"keccak256":"0xe57042e82311847c56fa569377ed84459bf55afccdd3123312a5dff90c1d06f4","urls":["bzz-raw://baf3258c9118bf16ba68ebcfecdb5e5ffc85d5c0cdc2815ca298283dfcff2c83","dweb:/ipfs/QmcBVyUBR3PVejz7249VrEBMCMKHi72KoUXQ8DFmMmY48F"],"license":"MIT"},"node_modules/@latticexyz/world/src/codegen/interfaces/IBaseWorld.sol":{"keccak256":"0xf7acdfa0eb01c710d11fba129d613863fe86f1bed352f0bc5630bea81cceae17","urls":["bzz-raw://3e4107681cd20c018cd8f5dff6da72e8a4b02f631c7c59b618e8743482c7bc81","dweb:/ipfs/QmXS8NLaKVXcf97HrD8U4hGHqb9ytYGwdZrTVHHb5EwrRj"],"license":"MIT"},"node_modules/@latticexyz/world/src/codegen/interfaces/IBatchCallSystem.sol":{"keccak256":"0x600cc362780c319e640950ad3520af7fa558171268baab252ff4da4414aa0f1c","urls":["bzz-raw://6d113a833b64bccbbe852f3d0261efd80ad4a0f6771802dc91af79c762a33ff2","dweb:/ipfs/QmaXEdJJaMMQF8nZieWyXdVD15yuXnH89QLZHwD18LAndz"],"license":"MIT"},"node_modules/@latticexyz/world/src/codegen/interfaces/IModuleInstallationSystem.sol":{"keccak256":"0x7070453d969eba7defd90047d58ae979e27e5c1fcf05598daa4d17fedbe84c35","urls":["bzz-raw://ee5c196c5e339ac0222cd1d14fd9d09451d255605f73732abc33397a9512503b","dweb:/ipfs/QmYwNsWnxP24RzDqFYLnBYswZY97YE3nwG6Xf55f5FqNXa"],"license":"MIT"},"node_modules/@latticexyz/world/src/codegen/interfaces/IRegistrationSystem.sol":{"keccak256":"0xe08d3af994098120b5507c71a1c3558763b8c1a88c6eae506aa438c2af78f800","urls":["bzz-raw://bb0c47b16ff524140388765fe9ef99211dd7d9b9374dae09144a9956138de00c","dweb:/ipfs/Qma8ibVu6WZs1hFW3hMnUykV3pPXGZhZ3xJwJXNj6Xu7aL"],"license":"MIT"},"node_modules/@latticexyz/world/src/codegen/interfaces/IWorldRegistrationSystem.sol":{"keccak256":"0x70bed82da026058ddccf52766823c7d55c7d29faad0ab1d76d763786d5277f7c","urls":["bzz-raw://1da6476d62e450d3d935ea8292723612a84fa1d07342fbc052ee851181701a27","dweb:/ipfs/Qmd1FQpmEVbQciLDPkHPXSKB7aYW1YB74BN5JXqn74erhR"],"license":"MIT"},"node_modules/@latticexyz/world/src/constants.sol":{"keccak256":"0xb8320f88ed5519a4fe2554ad94815ce328a50fef7719932375d6ce695265c2f5","urls":["bzz-raw://a8f5de30fbcc63e469e46ad4a4d4bcd7d8e4b4f2d31fcf62a04aca48d999af22","dweb:/ipfs/QmXw1jDQM2szfRY3tAGrRy6fEzte6yVFgebJAqCLMDHndV"],"license":"MIT"},"node_modules/@latticexyz/world/src/modules/init/types.sol":{"keccak256":"0x81b75eb286ec515bde6cbb16c3d089054abb530b744865bbace68343d23177bc","urls":["bzz-raw://afc77bd51e24da666260bb48c44ff611869fb2e550921d732e5aac84a1f09525","dweb:/ipfs/QmeU5N4yeRh5nEA65pvGtQQJNv1GvEPy4PkhMVRYRMoMvh"],"license":"MIT"},"node_modules/@latticexyz/world/src/revertWithBytes.sol":{"keccak256":"0xa1147f218a0152b153d4e8bada0f606bfed40ac1f184fd16a941c2d0033c53f5","urls":["bzz-raw://3f5e0f6d1b51a3a04d4bd84537b2ced373b32824898cf6fbfd13ae1cbdf06359","dweb:/ipfs/QmayYRmBZRUV9m4UnFxuC62VvHriXhkYXeH3HibZ3Gmxxf"],"license":"MIT"},"node_modules/@latticexyz/world/src/worldResourceTypes.sol":{"keccak256":"0xeb042e7d3638430f6fd394107f3237cf14e4325154f0098624e8a7826584d465","urls":["bzz-raw://39e0b8eb87616b661f5a4f2fd7e1a727bd19b7fd8d40ad3d93fda26822f433ea","dweb:/ipfs/QmacYMatKV9pwEwirVRY9a6r89RoNs5yk99ic37ieWA8Dk"],"license":"MIT"},"src/codegen/common.sol":{"keccak256":"0xfccc97e1c19076ce732ca821a1b4b60c37aafc2e371a6e86b580a76f07042927","urls":["bzz-raw://977c3231c794fc735d8dfe13f0c93337d8b9f8c175f58698cc587d148adfd966","dweb:/ipfs/QmW5PXEBTUGgUkwCjPQiSvAnV5tDdg39jQvgge7c7qnJmr"],"license":"MIT"},"src/codegen/tables/CharacterStats.sol":{"keccak256":"0x8609e049f9c40a2990a4d769be61d195385c4e22e403f133be102b4e9662e7ca","urls":["bzz-raw://35be01edf9b7e148303a62ffafba00df314c47f8d57f159f5a56d75b56ccf7fc","dweb:/ipfs/QmQdFFa7U6AHadojoJZSCLMQRmHnzcEPsmJ6j382DF2nvg"],"license":"MIT"},"src/codegen/world/ICharacterSystem.sol":{"keccak256":"0x8bdbad1e2f920aec7ee05447880b01486094eb92869546e5b8bc34ca67fc879d","urls":["bzz-raw://0c492dfa099175c6bb8e6c244a3a06d0acfed5eee99f5a6e2f934434d4344bdc","dweb:/ipfs/QmfXCkjsgMaPGFarjdKiEY4dZmw9MigHfjRxTkZZuW9yPC"],"license":"MIT"},"src/codegen/world/IItemsSystem.sol":{"keccak256":"0x36c2f22999e0c142945064b5b15ba59544ad373124b91761bb92724f8ac04d94","urls":["bzz-raw://c585e7dc7d9dd91fdffe935ca3232f9e921edff17c4bbecf0d1af8c9095170df","dweb:/ipfs/QmXREmQbQ85sJbFSyqL3ZPnzDjBLFoR4TyPeR6kzDa2a32"],"license":"MIT"},"src/codegen/world/IUltimateDominionConfigSystem.sol":{"keccak256":"0xba90101aabcf40e70392a7cb70705414abd0ae15cc3611ff896a4fac2f7a42d9","urls":["bzz-raw://befe8dc2fb28a22feb31c6ac8f8d6796985db0fe49a411b60d860d34b45813c6","dweb:/ipfs/QmaGKJ9ipwXJKt7uVqEGwGdqo45AkAuQHQdpSgqo1vCTbf"],"license":"MIT"},"src/codegen/world/IWorld.sol":{"keccak256":"0xf07ca4ff5a7bf83f17864399e206bf7b8c182aff8aeb8849c3331aceeebb23ca","urls":["bzz-raw://1176cc9b919a03c7e4d6705052434af12bb80f47e88d78ed5ab51c1e0a44b004","dweb:/ipfs/QmXKViRAF8yuf8gCP2cJVJ5gxFweV9gWTLPpAV64pY4Q8X"],"license":"MIT"},"src/interfaces/Structs.sol":{"keccak256":"0x4f60516b86d6f5770ab45f1de93f8e4fc95b4c53b431beb1e165353a774cb606","urls":["bzz-raw://72093895741d5a92e28b57b78a06942796d4ba10435afadd3b801d9c9df81274","dweb:/ipfs/QmWUuhswEadKj3VG48MPTowEE7gPjxzSdaW6zWsDmNb5Sb"],"license":"MIT"}},"version":1},"id":188} \ No newline at end of file diff --git a/packages/contracts/remappings.txt b/packages/contracts/remappings.txt index 5e3518d82..170e26961 100644 --- a/packages/contracts/remappings.txt +++ b/packages/contracts/remappings.txt @@ -4,6 +4,7 @@ forge-std/=node_modules/forge-std/src/ @pythnetwork/=node_modules/@pythnetwork/entropy-sdk-solidity/ @test/=test/ @systems/=src/systems/ +@interfaces/=src/interfaces/ @tables/=src/codegen/tables/ @world/=src/codegen/world/ @codegen/=src/codegen/ diff --git a/packages/contracts/script/PostDeploy.s.sol b/packages/contracts/script/PostDeploy.s.sol index ef4df0c0f..f2696d4cb 100644 --- a/packages/contracts/script/PostDeploy.s.sol +++ b/packages/contracts/script/PostDeploy.s.sol @@ -1,170 +1,211 @@ // SPDX-License-Identifier: MIT pragma solidity >=0.8.24; -import { Script } from "forge-std/Script.sol"; -import { console } from "forge-std/console.sol"; -import { StoreSwitch } from "@latticexyz/store/src/StoreSwitch.sol"; -import { StoreCore, EncodedLengths } from "@latticexyz/store/src/StoreCore.sol"; -import { MockEntropy } from "@test/mocks/MockEntropy.sol"; -import { PuppetModule } from "@latticexyz/world-modules/src/modules/puppet/PuppetModule.sol"; -import { Systems } from "@latticexyz/world/src/codegen/tables/Systems.sol"; -import { IWorld } from "@world/IWorld.sol"; -import { UltimateDominionConfig } from "../src/codegen/index.sol"; -import { ResourceIdLib } from "@latticexyz/store/src/ResourceId.sol"; -import { ResourceId, WorldResourceIdLib, WorldResourceIdInstance } from "@latticexyz/world/src/WorldResourceId.sol"; -import { RESOURCE_SYSTEM } from "@latticexyz/world/src/worldResourceTypes.sol"; -import { DeployGold } from "./DeployGold.sol"; -import { DeployCharacters } from "./DeployCharacters.sol"; -import { RngSystem } from "../src/systems/RngSystem.sol"; -import { IERC721Mintable } from "@latticexyz/world-modules/src/modules/erc721-puppet/IERC721Mintable.sol"; -import { registerERC721 } from "@latticexyz/world-modules/src/modules/erc721-puppet/registerERC721.sol"; -import { ERC721System } from "@latticexyz/world-modules/src/modules/erc721-puppet/ERC721System.sol"; -import { ERC721MetadataData } from "@latticexyz/world-modules/src/modules/erc721-puppet/tables/ERC721Metadata.sol"; -import { GOLD_NAMESPACE, CHARACTERS_NAMESPACE, ERC721_NAME, ERC721_SYMBOL, TOKEN_URI } from "../constants.sol"; -import { NoTransferHook } from "../src/NoTransferHook.sol"; -import { BEFORE_CALL_SYSTEM } from "@latticexyz/world/src/systemHookTypes.sol"; -import { Classes } from "@codegen/common.sol"; - -import { IERC20Mintable } from "@latticexyz/world-modules/src/modules/erc20-puppet/IERC20Mintable.sol"; -import { ERC20MetadataData } from "@latticexyz/world-modules/src/modules/erc20-puppet/tables/ERC20Metadata.sol"; -import { ERC20System } from "@latticexyz/world-modules/src/modules/erc20-puppet/ERC20System.sol"; -import { registerERC20 } from "@latticexyz/world-modules/src/modules/erc20-puppet/registerERC20.sol"; -import { System } from "@latticexyz/world/src/System.sol"; -import { CharacterSystem } from "../src/systems/CharacterSystem.sol"; +import {Script} from "forge-std/Script.sol"; +import {console} from "forge-std/console.sol"; +import {StoreSwitch} from "@latticexyz/store/src/StoreSwitch.sol"; +import {StoreCore, EncodedLengths} from "@latticexyz/store/src/StoreCore.sol"; +import {MockEntropy} from "@test/mocks/MockEntropy.sol"; +import {PuppetModule} from "@latticexyz/world-modules/src/modules/puppet/PuppetModule.sol"; +import {Systems} from "@latticexyz/world/src/codegen/tables/Systems.sol"; +import {IWorld} from "@world/IWorld.sol"; +import {UltimateDominionConfig} from "../src/codegen/index.sol"; +import {ResourceIdLib} from "@latticexyz/store/src/ResourceId.sol"; +import {ResourceId, WorldResourceIdLib, WorldResourceIdInstance} from "@latticexyz/world/src/WorldResourceId.sol"; +import {RESOURCE_SYSTEM} from "@latticexyz/world/src/worldResourceTypes.sol"; +import {DeployGold} from "./DeployGold.sol"; +import {DeployCharacters} from "./DeployCharacters.sol"; +import {RngSystem} from "../src/systems/RngSystem.sol"; +import {IERC721Mintable} from "@latticexyz/world-modules/src/modules/erc721-puppet/IERC721Mintable.sol"; +import {registerERC721} from "@latticexyz/world-modules/src/modules/erc721-puppet/registerERC721.sol"; +import {ERC721System} from "@latticexyz/world-modules/src/modules/erc721-puppet/ERC721System.sol"; +import {ERC721MetadataData} from "@latticexyz/world-modules/src/modules/erc721-puppet/tables/ERC721Metadata.sol"; +import { + GOLD_NAMESPACE, + CHARACTERS_NAMESPACE, + ERC721_NAME, + ERC721_SYMBOL, + ITEMS_NAMESPACE, + TOKEN_URI +} from "../constants.sol"; +import {NoTransferHook} from "../src/NoTransferHook.sol"; +import {BEFORE_CALL_SYSTEM} from "@latticexyz/world/src/systemHookTypes.sol"; +import {Classes, ItemType} from "@codegen/common.sol"; +import {WeaponStats} from "@interfaces/Structs.sol"; +import {IERC20Mintable} from "@latticexyz/world-modules/src/modules/erc20-puppet/IERC20Mintable.sol"; +import {ERC20MetadataData} from "@latticexyz/world-modules/src/modules/erc20-puppet/tables/ERC20Metadata.sol"; +import {ERC20System} from "@latticexyz/world-modules/src/modules/erc20-puppet/ERC20System.sol"; +import {registerERC20} from "@latticexyz/world-modules/src/modules/erc20-puppet/registerERC20.sol"; +import {System} from "@latticexyz/world/src/System.sol"; +import {CharacterSystem} from "../src/systems/CharacterSystem.sol"; + +import {ERC1155Module} from "@erc1155/ERC1155Module.sol"; +import {ERC1155System} from "@erc1155/ERC1155System.sol"; +import {IERC1155} from "@erc1155/IERC1155.sol"; +import {registerERC1155} from "@erc1155/registerERC1155.sol"; +import {_erc1155SystemId} from "@erc1155/utils.sol"; import "forge-std/console2.sol"; struct ResourceIds { - ResourceId erc721SystemId; - ResourceId erc721NamespaceId; - ResourceId characterSystemId; - ResourceId erc20SystemId; - ResourceId erc20NamespaceId; - ResourceId rngSystemId; + ResourceId erc721SystemId; + ResourceId erc721NamespaceId; + ResourceId characterSystemId; + ResourceId erc20SystemId; + ResourceId erc20NamespaceId; + ResourceId rngSystemId; + ResourceId erc1155SystemId; + ResourceId erc1155NamespaceId; + ResourceId itemsSystemId; } contract PostDeploy is Script { - IWorld public world; - ResourceIds public resourceIds; - address public worldAddress; - function run(address _worldAddress) external { - worldAddress = _worldAddress; - world = IWorld(worldAddress); - // Specify a store so that you can use tables directly in PostDeploy - StoreSwitch.setStoreAddress(worldAddress); - - // Load the private key from the `PRIVATE_KEY` environment variable (in .env) - uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY"); - - // Start broadcasting transactions from the deployer account - vm.startBroadcast(deployerPrivateKey); - if (block.chainid == 31337) { - // Set entropy contracts - address mockEntropy = address(new MockEntropy()); - UltimateDominionConfig.setEntropy(mockEntropy); - UltimateDominionConfig.setPythProvider(address(1)); - } else if (block.chainid == 84532) { - UltimateDominionConfig.setEntropy(0x41c9e39574F40Ad34c79f1C99B66A45eFB830d4c); - UltimateDominionConfig.setPythProvider(0x6CC14824Ea2918f5De5C2f75A9Da968ad4BD6344); - } else if (block.chainid == 8453) { - UltimateDominionConfig.setEntropy(0x6E7D74FA7d5c90FEF9F0512987605a6d546181Bb); - UltimateDominionConfig.setPythProvider(0x52DeaA1c84233F7bb8C8A45baeDE41091c616506); - } + IWorld public world; + ResourceIds public resourceIds; + address public worldAddress; - //install puppet - world.installModule(new PuppetModule(), new bytes(0)); - - _addRngSystem(); - - // install gold module - IERC20Mintable goldToken = registerERC20( - world, - GOLD_NAMESPACE, - ERC20MetadataData({ decimals: 18, name: "GoldToken", symbol: unicode"🜚" }) - ); - - UltimateDominionConfig.setGoldToken(address(goldToken)); - - // characters - IERC721Mintable characters = registerERC721( - world, - CHARACTERS_NAMESPACE, - ERC721MetadataData({ name: ERC721_NAME, symbol: ERC721_SYMBOL, baseURI: TOKEN_URI }) - ); - - UltimateDominionConfig.setCharacterToken(address(characters)); - - { - resourceIds.erc20NamespaceId = WorldResourceIdLib.encodeNamespace(GOLD_NAMESPACE); - resourceIds.erc20SystemId = WorldResourceIdLib.encode({ - typeId: RESOURCE_SYSTEM, - namespace: "Gold", - name: "GoldToken" - }); - - resourceIds.characterSystemId = WorldResourceIdLib.encode({ - typeId: RESOURCE_SYSTEM, - namespace: "UD", - name: "CharacterSystem" - }); - - resourceIds.erc721NamespaceId = WorldResourceIdLib.encodeNamespace(CHARACTERS_NAMESPACE); - - resourceIds.erc721SystemId = WorldResourceIdLib.encode({ - typeId: RESOURCE_SYSTEM, - namespace: "Characters", - name: "ERC721System" - }); - } + function run(address _worldAddress) external { + worldAddress = _worldAddress; + world = IWorld(worldAddress); + // Specify a store so that you can use tables directly in PostDeploy + StoreSwitch.setStoreAddress(worldAddress); + + // Load the private key from the `PRIVATE_KEY` environment variable (in .env) + uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY"); + + // Start broadcasting transactions from the deployer account + vm.startBroadcast(deployerPrivateKey); + if (block.chainid == 31337) { + // Set entropy contracts + address mockEntropy = address(new MockEntropy()); + UltimateDominionConfig.setEntropy(mockEntropy); + UltimateDominionConfig.setPythProvider(address(1)); + } else if (block.chainid == 84532) { + UltimateDominionConfig.setEntropy(0x41c9e39574F40Ad34c79f1C99B66A45eFB830d4c); + UltimateDominionConfig.setPythProvider(0x6CC14824Ea2918f5De5C2f75A9Da968ad4BD6344); + } else if (block.chainid == 8453) { + UltimateDominionConfig.setEntropy(0x6E7D74FA7d5c90FEF9F0512987605a6d546181Bb); + UltimateDominionConfig.setPythProvider(0x52DeaA1c84233F7bb8C8A45baeDE41091c616506); + } + + //install puppet + world.installModule(new PuppetModule(), new bytes(0)); + + _addRngSystem(); + + // install gold module + IERC20Mintable goldToken = registerERC20( + world, GOLD_NAMESPACE, ERC20MetadataData({decimals: 18, name: "GoldToken", symbol: unicode"🜚"}) + ); + + UltimateDominionConfig.setGoldToken(address(goldToken)); + + // characters + IERC721Mintable characters = registerERC721( + world, + CHARACTERS_NAMESPACE, + ERC721MetadataData({name: ERC721_NAME, symbol: ERC721_SYMBOL, baseURI: TOKEN_URI}) + ); + + UltimateDominionConfig.setCharacterToken(address(characters)); + + { + resourceIds.erc20NamespaceId = WorldResourceIdLib.encodeNamespace(GOLD_NAMESPACE); + resourceIds.erc20SystemId = + WorldResourceIdLib.encode({typeId: RESOURCE_SYSTEM, namespace: "Gold", name: "GoldToken"}); + + resourceIds.characterSystemId = + WorldResourceIdLib.encode({typeId: RESOURCE_SYSTEM, namespace: "UD", name: "CharacterSystem"}); - address characterSystemAddress = Systems.getSystem(resourceIds.characterSystemId); + resourceIds.erc721NamespaceId = WorldResourceIdLib.encodeNamespace(CHARACTERS_NAMESPACE); - System goldSystemContract = new ERC20System(); + resourceIds.erc721SystemId = + WorldResourceIdLib.encode({typeId: RESOURCE_SYSTEM, namespace: "Characters", name: "ERC721System"}); - world.registerSystem(resourceIds.erc20SystemId, goldSystemContract, true); + resourceIds.erc1155SystemId = _erc1155SystemId(ITEMS_NAMESPACE); + resourceIds.erc1155NamespaceId = WorldResourceIdLib.encodeNamespace(ITEMS_NAMESPACE); + resourceIds.itemsSystemId = + WorldResourceIdLib.encode({typeId: RESOURCE_SYSTEM, namespace: "UD", name: "ItemsSystem"}); + } - IWorld(worldAddress).grantAccess(resourceIds.erc20NamespaceId, worldAddress); - IWorld(worldAddress).registerFunctionSelector(resourceIds.erc20SystemId, "mint(address,uint256)"); + address characterSystemAddress = Systems.getSystem(resourceIds.characterSystemId); - world.transferOwnership(resourceIds.erc20NamespaceId, address(characterSystemAddress)); + System goldSystemContract = new ERC20System(); - System systemContract = new ERC721System(); - world.registerSystem(resourceIds.erc721SystemId, systemContract, true); + world.registerSystem(resourceIds.erc20SystemId, goldSystemContract, true); - NoTransferHook characterHook = new NoTransferHook(); + IWorld(worldAddress).grantAccess(resourceIds.erc20NamespaceId, worldAddress); + IWorld(worldAddress).registerFunctionSelector(resourceIds.erc20SystemId, "mint(address,uint256)"); - world.registerSystemHook(resourceIds.erc721SystemId, characterHook, BEFORE_CALL_SYSTEM); + world.transferOwnership(resourceIds.erc20NamespaceId, address(characterSystemAddress)); - // Transfer characters namespace to World - world.grantAccess(resourceIds.erc721SystemId, worldAddress); - world.grantAccess(resourceIds.erc721SystemId, characterSystemAddress); - world.transferOwnership(resourceIds.erc721NamespaceId, characterSystemAddress); + System systemContract = new ERC721System(); + world.registerSystem(resourceIds.erc721SystemId, systemContract, true); - vm.stopBroadcast(); - } + NoTransferHook characterHook = new NoTransferHook(); - function _addRngSystem() internal { - System rngSystem = new RngSystem(); + world.registerSystemHook(resourceIds.erc721SystemId, characterHook, BEFORE_CALL_SYSTEM); - resourceIds.rngSystemId = WorldResourceIdLib.encode(RESOURCE_SYSTEM, "", "RngSystem"); + // Transfer characters namespace to World + world.grantAccess(resourceIds.erc721SystemId, worldAddress); + world.grantAccess(resourceIds.erc721SystemId, characterSystemAddress); + world.transferOwnership(resourceIds.erc721NamespaceId, characterSystemAddress); - world.registerSystem(resourceIds.rngSystemId, rngSystem, true); - world.registerRootFunctionSelector( - resourceIds.rngSystemId, - "getRng(bytes32,uint8,bytes)", - "getRng(bytes32,uint8,bytes)" - ); - world.registerRootFunctionSelector( - resourceIds.rngSystemId, - "entropyCallback(uint64,address,bytes32)", - "entropyCallback(uint64,address,bytes32)" - ); - world.registerRootFunctionSelector( - resourceIds.rngSystemId, - "_entropyCallback(uint64,address,bytes32)", - "_entropyCallback(uint64,address,bytes32)" - ); - world.registerRootFunctionSelector(resourceIds.rngSystemId, "getFee()", "getFee()"); - world.registerRootFunctionSelector(resourceIds.rngSystemId, "getEntropy()", "getEntropy()"); - } + address items = _deployErc1155(world, ITEMS_NAMESPACE); + UltimateDominionConfig.setItems(address(items)); + + _createStarterItems(); + + vm.stopBroadcast(); + } + + function _deployErc1155(IWorld _world, bytes14 itemsNamespace) internal returns (address) { + IERC1155 _items = registerERC1155(_world, itemsNamespace, "test_Items_uri/"); + + // ERC1155System erc1155System = new ERC1155System(); + address itemsSystemAddress = Systems.getSystem(resourceIds.itemsSystemId); + + // _world.registerSystem(resourceIds.erc1155SystemId, erc1155System, false); + _world.grantAccess(resourceIds.erc1155SystemId, worldAddress); + world.transferOwnership(resourceIds.erc1155NamespaceId, itemsSystemAddress); + return address(_items); + } + + function _addRngSystem() internal { + System rngSystem = new RngSystem(); + + resourceIds.rngSystemId = WorldResourceIdLib.encode(RESOURCE_SYSTEM, "", "RngSystem"); + + world.registerSystem(resourceIds.rngSystemId, rngSystem, true); + world.registerRootFunctionSelector( + resourceIds.rngSystemId, "getRng(bytes32,uint8,bytes)", "getRng(bytes32,uint8,bytes)" + ); + world.registerRootFunctionSelector( + resourceIds.rngSystemId, + "entropyCallback(uint64,address,bytes32)", + "entropyCallback(uint64,address,bytes32)" + ); + world.registerRootFunctionSelector( + resourceIds.rngSystemId, + "_entropyCallback(uint64,address,bytes32)", + "_entropyCallback(uint64,address,bytes32)" + ); + world.registerRootFunctionSelector(resourceIds.rngSystemId, "getFee()", "getFee()"); + world.registerRootFunctionSelector(resourceIds.rngSystemId, "getEntropy()", "getEntropy()"); + } + + function _createStarterItems() internal { + uint8[] memory restrictions = new uint8[](0); + WeaponStats memory weaponStats = WeaponStats({damage: 1, speed: 2, classRestrictions: restrictions}); + + uint256 starterItemId = + world.UD__createItem(ItemType.Weapon, 10 ether, "starter-weapon-uri/", abi.encode(weaponStats)); + uint256[] memory itemIds = new uint256[](1); + itemIds[0] = starterItemId; + uint256[] memory amounts = new uint256[](1); + amounts[0] = 1; + world.UD__setStarterItems(Classes.Rogue, itemIds, amounts); + world.UD__setStarterItems(Classes.Warrior, itemIds, amounts); + world.UD__setStarterItems(Classes.Mage, itemIds, amounts); + } } diff --git a/packages/contracts/src/codegen/common.sol b/packages/contracts/src/codegen/common.sol index 26e9fe786..827d0cbdd 100644 --- a/packages/contracts/src/codegen/common.sol +++ b/packages/contracts/src/codegen/common.sol @@ -13,3 +13,11 @@ enum RngRequestType { Combat, WorldGeneration } + +enum ItemType { + Weapon, + Armor, + Potion, + Scroll, + Material +} diff --git a/packages/contracts/src/codegen/index.sol b/packages/contracts/src/codegen/index.sol index 181c7a692..04fe901a1 100644 --- a/packages/contracts/src/codegen/index.sol +++ b/packages/contracts/src/codegen/index.sol @@ -7,6 +7,8 @@ import { Admin } from "./tables/Admin.sol"; import { Characters, CharactersData } from "./tables/Characters.sol"; import { CharacterStats, CharacterStatsData } from "./tables/CharacterStats.sol"; import { Counters } from "./tables/Counters.sol"; +import { Items, ItemsData } from "./tables/Items.sol"; +import { StarterItems, StarterItemsData } from "./tables/StarterItems.sol"; import { Name } from "./tables/Name.sol"; import { NameExists } from "./tables/NameExists.sol"; import { RandomNumbers, RandomNumbersData } from "./tables/RandomNumbers.sol"; diff --git a/packages/contracts/src/codegen/tables/Items.sol b/packages/contracts/src/codegen/tables/Items.sol new file mode 100644 index 000000000..062d4d430 --- /dev/null +++ b/packages/contracts/src/codegen/tables/Items.sol @@ -0,0 +1,478 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.8.24; + +/* Autogenerated file. Do not edit manually. */ + +// Import store internals +import { IStore } from "@latticexyz/store/src/IStore.sol"; +import { StoreSwitch } from "@latticexyz/store/src/StoreSwitch.sol"; +import { StoreCore } from "@latticexyz/store/src/StoreCore.sol"; +import { Bytes } from "@latticexyz/store/src/Bytes.sol"; +import { Memory } from "@latticexyz/store/src/Memory.sol"; +import { SliceLib } from "@latticexyz/store/src/Slice.sol"; +import { EncodeArray } from "@latticexyz/store/src/tightcoder/EncodeArray.sol"; +import { FieldLayout } from "@latticexyz/store/src/FieldLayout.sol"; +import { Schema } from "@latticexyz/store/src/Schema.sol"; +import { EncodedLengths, EncodedLengthsLib } from "@latticexyz/store/src/EncodedLengths.sol"; +import { ResourceId } from "@latticexyz/store/src/ResourceId.sol"; + +// Import user types +import { ItemType } from "./../common.sol"; + +struct ItemsData { + ItemType itemType; + bytes stats; +} + +library Items { + // Hex below is the result of `WorldResourceIdLib.encode({ namespace: "UD", name: "Items", typeId: RESOURCE_TABLE });` + ResourceId constant _tableId = ResourceId.wrap(0x746255440000000000000000000000004974656d730000000000000000000000); + + FieldLayout constant _fieldLayout = + FieldLayout.wrap(0x0001010101000000000000000000000000000000000000000000000000000000); + + // Hex-encoded key schema of (uint256) + Schema constant _keySchema = Schema.wrap(0x002001001f000000000000000000000000000000000000000000000000000000); + // Hex-encoded value schema of (uint8, bytes) + Schema constant _valueSchema = Schema.wrap(0x0001010100c40000000000000000000000000000000000000000000000000000); + + /** + * @notice Get the table's key field names. + * @return keyNames An array of strings with the names of key fields. + */ + function getKeyNames() internal pure returns (string[] memory keyNames) { + keyNames = new string[](1); + keyNames[0] = "itemId"; + } + + /** + * @notice Get the table's value field names. + * @return fieldNames An array of strings with the names of value fields. + */ + function getFieldNames() internal pure returns (string[] memory fieldNames) { + fieldNames = new string[](2); + fieldNames[0] = "itemType"; + fieldNames[1] = "stats"; + } + + /** + * @notice Register the table with its config. + */ + function register() internal { + StoreSwitch.registerTable(_tableId, _fieldLayout, _keySchema, _valueSchema, getKeyNames(), getFieldNames()); + } + + /** + * @notice Register the table with its config. + */ + function _register() internal { + StoreCore.registerTable(_tableId, _fieldLayout, _keySchema, _valueSchema, getKeyNames(), getFieldNames()); + } + + /** + * @notice Get itemType. + */ + function getItemType(uint256 itemId) internal view returns (ItemType itemType) { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(itemId)); + + bytes32 _blob = StoreSwitch.getStaticField(_tableId, _keyTuple, 0, _fieldLayout); + return ItemType(uint8(bytes1(_blob))); + } + + /** + * @notice Get itemType. + */ + function _getItemType(uint256 itemId) internal view returns (ItemType itemType) { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(itemId)); + + bytes32 _blob = StoreCore.getStaticField(_tableId, _keyTuple, 0, _fieldLayout); + return ItemType(uint8(bytes1(_blob))); + } + + /** + * @notice Set itemType. + */ + function setItemType(uint256 itemId, ItemType itemType) internal { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(itemId)); + + StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked(uint8(itemType)), _fieldLayout); + } + + /** + * @notice Set itemType. + */ + function _setItemType(uint256 itemId, ItemType itemType) internal { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(itemId)); + + StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked(uint8(itemType)), _fieldLayout); + } + + /** + * @notice Get stats. + */ + function getStats(uint256 itemId) internal view returns (bytes memory stats) { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(itemId)); + + bytes memory _blob = StoreSwitch.getDynamicField(_tableId, _keyTuple, 0); + return (bytes(_blob)); + } + + /** + * @notice Get stats. + */ + function _getStats(uint256 itemId) internal view returns (bytes memory stats) { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(itemId)); + + bytes memory _blob = StoreCore.getDynamicField(_tableId, _keyTuple, 0); + return (bytes(_blob)); + } + + /** + * @notice Set stats. + */ + function setStats(uint256 itemId, bytes memory stats) internal { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(itemId)); + + StoreSwitch.setDynamicField(_tableId, _keyTuple, 0, bytes((stats))); + } + + /** + * @notice Set stats. + */ + function _setStats(uint256 itemId, bytes memory stats) internal { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(itemId)); + + StoreCore.setDynamicField(_tableId, _keyTuple, 0, bytes((stats))); + } + + /** + * @notice Get the length of stats. + */ + function lengthStats(uint256 itemId) internal view returns (uint256) { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(itemId)); + + uint256 _byteLength = StoreSwitch.getDynamicFieldLength(_tableId, _keyTuple, 0); + unchecked { + return _byteLength / 1; + } + } + + /** + * @notice Get the length of stats. + */ + function _lengthStats(uint256 itemId) internal view returns (uint256) { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(itemId)); + + uint256 _byteLength = StoreCore.getDynamicFieldLength(_tableId, _keyTuple, 0); + unchecked { + return _byteLength / 1; + } + } + + /** + * @notice Get an item of stats. + * @dev Reverts with Store_IndexOutOfBounds if `_index` is out of bounds for the array. + */ + function getItemStats(uint256 itemId, uint256 _index) internal view returns (bytes memory) { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(itemId)); + + unchecked { + bytes memory _blob = StoreSwitch.getDynamicFieldSlice(_tableId, _keyTuple, 0, _index * 1, (_index + 1) * 1); + return (bytes(_blob)); + } + } + + /** + * @notice Get an item of stats. + * @dev Reverts with Store_IndexOutOfBounds if `_index` is out of bounds for the array. + */ + function _getItemStats(uint256 itemId, uint256 _index) internal view returns (bytes memory) { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(itemId)); + + unchecked { + bytes memory _blob = StoreCore.getDynamicFieldSlice(_tableId, _keyTuple, 0, _index * 1, (_index + 1) * 1); + return (bytes(_blob)); + } + } + + /** + * @notice Push a slice to stats. + */ + function pushStats(uint256 itemId, bytes memory _slice) internal { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(itemId)); + + StoreSwitch.pushToDynamicField(_tableId, _keyTuple, 0, bytes((_slice))); + } + + /** + * @notice Push a slice to stats. + */ + function _pushStats(uint256 itemId, bytes memory _slice) internal { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(itemId)); + + StoreCore.pushToDynamicField(_tableId, _keyTuple, 0, bytes((_slice))); + } + + /** + * @notice Pop a slice from stats. + */ + function popStats(uint256 itemId) internal { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(itemId)); + + StoreSwitch.popFromDynamicField(_tableId, _keyTuple, 0, 1); + } + + /** + * @notice Pop a slice from stats. + */ + function _popStats(uint256 itemId) internal { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(itemId)); + + StoreCore.popFromDynamicField(_tableId, _keyTuple, 0, 1); + } + + /** + * @notice Update a slice of stats at `_index`. + */ + function updateStats(uint256 itemId, uint256 _index, bytes memory _slice) internal { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(itemId)); + + unchecked { + bytes memory _encoded = bytes((_slice)); + StoreSwitch.spliceDynamicData(_tableId, _keyTuple, 0, uint40(_index * 1), uint40(_encoded.length), _encoded); + } + } + + /** + * @notice Update a slice of stats at `_index`. + */ + function _updateStats(uint256 itemId, uint256 _index, bytes memory _slice) internal { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(itemId)); + + unchecked { + bytes memory _encoded = bytes((_slice)); + StoreCore.spliceDynamicData(_tableId, _keyTuple, 0, uint40(_index * 1), uint40(_encoded.length), _encoded); + } + } + + /** + * @notice Get the full data. + */ + function get(uint256 itemId) internal view returns (ItemsData memory _table) { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(itemId)); + + (bytes memory _staticData, EncodedLengths _encodedLengths, bytes memory _dynamicData) = StoreSwitch.getRecord( + _tableId, + _keyTuple, + _fieldLayout + ); + return decode(_staticData, _encodedLengths, _dynamicData); + } + + /** + * @notice Get the full data. + */ + function _get(uint256 itemId) internal view returns (ItemsData memory _table) { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(itemId)); + + (bytes memory _staticData, EncodedLengths _encodedLengths, bytes memory _dynamicData) = StoreCore.getRecord( + _tableId, + _keyTuple, + _fieldLayout + ); + return decode(_staticData, _encodedLengths, _dynamicData); + } + + /** + * @notice Set the full data using individual values. + */ + function set(uint256 itemId, ItemType itemType, bytes memory stats) internal { + bytes memory _staticData = encodeStatic(itemType); + + EncodedLengths _encodedLengths = encodeLengths(stats); + bytes memory _dynamicData = encodeDynamic(stats); + + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(itemId)); + + StoreSwitch.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData); + } + + /** + * @notice Set the full data using individual values. + */ + function _set(uint256 itemId, ItemType itemType, bytes memory stats) internal { + bytes memory _staticData = encodeStatic(itemType); + + EncodedLengths _encodedLengths = encodeLengths(stats); + bytes memory _dynamicData = encodeDynamic(stats); + + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(itemId)); + + StoreCore.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData, _fieldLayout); + } + + /** + * @notice Set the full data using the data struct. + */ + function set(uint256 itemId, ItemsData memory _table) internal { + bytes memory _staticData = encodeStatic(_table.itemType); + + EncodedLengths _encodedLengths = encodeLengths(_table.stats); + bytes memory _dynamicData = encodeDynamic(_table.stats); + + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(itemId)); + + StoreSwitch.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData); + } + + /** + * @notice Set the full data using the data struct. + */ + function _set(uint256 itemId, ItemsData memory _table) internal { + bytes memory _staticData = encodeStatic(_table.itemType); + + EncodedLengths _encodedLengths = encodeLengths(_table.stats); + bytes memory _dynamicData = encodeDynamic(_table.stats); + + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(itemId)); + + StoreCore.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData, _fieldLayout); + } + + /** + * @notice Decode the tightly packed blob of static data using this table's field layout. + */ + function decodeStatic(bytes memory _blob) internal pure returns (ItemType itemType) { + itemType = ItemType(uint8(Bytes.getBytes1(_blob, 0))); + } + + /** + * @notice Decode the tightly packed blob of dynamic data using the encoded lengths. + */ + function decodeDynamic( + EncodedLengths _encodedLengths, + bytes memory _blob + ) internal pure returns (bytes memory stats) { + uint256 _start; + uint256 _end; + unchecked { + _end = _encodedLengths.atIndex(0); + } + stats = (bytes(SliceLib.getSubslice(_blob, _start, _end).toBytes())); + } + + /** + * @notice Decode the tightly packed blobs using this table's field layout. + * @param _staticData Tightly packed static fields. + * @param _encodedLengths Encoded lengths of dynamic fields. + * @param _dynamicData Tightly packed dynamic fields. + */ + function decode( + bytes memory _staticData, + EncodedLengths _encodedLengths, + bytes memory _dynamicData + ) internal pure returns (ItemsData memory _table) { + (_table.itemType) = decodeStatic(_staticData); + + (_table.stats) = decodeDynamic(_encodedLengths, _dynamicData); + } + + /** + * @notice Delete all data for given keys. + */ + function deleteRecord(uint256 itemId) internal { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(itemId)); + + StoreSwitch.deleteRecord(_tableId, _keyTuple); + } + + /** + * @notice Delete all data for given keys. + */ + function _deleteRecord(uint256 itemId) internal { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(itemId)); + + StoreCore.deleteRecord(_tableId, _keyTuple, _fieldLayout); + } + + /** + * @notice Tightly pack static (fixed length) data using this table's schema. + * @return The static data, encoded into a sequence of bytes. + */ + function encodeStatic(ItemType itemType) internal pure returns (bytes memory) { + return abi.encodePacked(itemType); + } + + /** + * @notice Tightly pack dynamic data lengths using this table's schema. + * @return _encodedLengths The lengths of the dynamic fields (packed into a single bytes32 value). + */ + function encodeLengths(bytes memory stats) internal pure returns (EncodedLengths _encodedLengths) { + // Lengths are effectively checked during copy by 2**40 bytes exceeding gas limits + unchecked { + _encodedLengths = EncodedLengthsLib.pack(bytes(stats).length); + } + } + + /** + * @notice Tightly pack dynamic (variable length) data using this table's schema. + * @return The dynamic data, encoded into a sequence of bytes. + */ + function encodeDynamic(bytes memory stats) internal pure returns (bytes memory) { + return abi.encodePacked(bytes((stats))); + } + + /** + * @notice Encode all of a record's fields. + * @return The static (fixed length) data, encoded into a sequence of bytes. + * @return The lengths of the dynamic fields (packed into a single bytes32 value). + * @return The dynamic (variable length) data, encoded into a sequence of bytes. + */ + function encode( + ItemType itemType, + bytes memory stats + ) internal pure returns (bytes memory, EncodedLengths, bytes memory) { + bytes memory _staticData = encodeStatic(itemType); + + EncodedLengths _encodedLengths = encodeLengths(stats); + bytes memory _dynamicData = encodeDynamic(stats); + + return (_staticData, _encodedLengths, _dynamicData); + } + + /** + * @notice Encode keys as a bytes32 array using this table's field layout. + */ + function encodeKeyTuple(uint256 itemId) internal pure returns (bytes32[] memory) { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(itemId)); + + return _keyTuple; + } +} diff --git a/packages/contracts/src/codegen/tables/StarterItems.sol b/packages/contracts/src/codegen/tables/StarterItems.sol new file mode 100644 index 000000000..7bb79c000 --- /dev/null +++ b/packages/contracts/src/codegen/tables/StarterItems.sol @@ -0,0 +1,585 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.8.24; + +/* Autogenerated file. Do not edit manually. */ + +// Import store internals +import { IStore } from "@latticexyz/store/src/IStore.sol"; +import { StoreSwitch } from "@latticexyz/store/src/StoreSwitch.sol"; +import { StoreCore } from "@latticexyz/store/src/StoreCore.sol"; +import { Bytes } from "@latticexyz/store/src/Bytes.sol"; +import { Memory } from "@latticexyz/store/src/Memory.sol"; +import { SliceLib } from "@latticexyz/store/src/Slice.sol"; +import { EncodeArray } from "@latticexyz/store/src/tightcoder/EncodeArray.sol"; +import { FieldLayout } from "@latticexyz/store/src/FieldLayout.sol"; +import { Schema } from "@latticexyz/store/src/Schema.sol"; +import { EncodedLengths, EncodedLengthsLib } from "@latticexyz/store/src/EncodedLengths.sol"; +import { ResourceId } from "@latticexyz/store/src/ResourceId.sol"; + +// Import user types +import { Classes } from "./../common.sol"; + +struct StarterItemsData { + uint256[] itemIds; + uint256[] amounts; +} + +library StarterItems { + // Hex below is the result of `WorldResourceIdLib.encode({ namespace: "UD", name: "StarterItems", typeId: RESOURCE_TABLE });` + ResourceId constant _tableId = ResourceId.wrap(0x74625544000000000000000000000000537461727465724974656d7300000000); + + FieldLayout constant _fieldLayout = + FieldLayout.wrap(0x0000000200000000000000000000000000000000000000000000000000000000); + + // Hex-encoded key schema of (uint8) + Schema constant _keySchema = Schema.wrap(0x0001010000000000000000000000000000000000000000000000000000000000); + // Hex-encoded value schema of (uint256[], uint256[]) + Schema constant _valueSchema = Schema.wrap(0x0000000281810000000000000000000000000000000000000000000000000000); + + /** + * @notice Get the table's key field names. + * @return keyNames An array of strings with the names of key fields. + */ + function getKeyNames() internal pure returns (string[] memory keyNames) { + keyNames = new string[](1); + keyNames[0] = "class"; + } + + /** + * @notice Get the table's value field names. + * @return fieldNames An array of strings with the names of value fields. + */ + function getFieldNames() internal pure returns (string[] memory fieldNames) { + fieldNames = new string[](2); + fieldNames[0] = "itemIds"; + fieldNames[1] = "amounts"; + } + + /** + * @notice Register the table with its config. + */ + function register() internal { + StoreSwitch.registerTable(_tableId, _fieldLayout, _keySchema, _valueSchema, getKeyNames(), getFieldNames()); + } + + /** + * @notice Register the table with its config. + */ + function _register() internal { + StoreCore.registerTable(_tableId, _fieldLayout, _keySchema, _valueSchema, getKeyNames(), getFieldNames()); + } + + /** + * @notice Get itemIds. + */ + function getItemIds(Classes class) internal view returns (uint256[] memory itemIds) { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(uint8(class))); + + bytes memory _blob = StoreSwitch.getDynamicField(_tableId, _keyTuple, 0); + return (SliceLib.getSubslice(_blob, 0, _blob.length).decodeArray_uint256()); + } + + /** + * @notice Get itemIds. + */ + function _getItemIds(Classes class) internal view returns (uint256[] memory itemIds) { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(uint8(class))); + + bytes memory _blob = StoreCore.getDynamicField(_tableId, _keyTuple, 0); + return (SliceLib.getSubslice(_blob, 0, _blob.length).decodeArray_uint256()); + } + + /** + * @notice Set itemIds. + */ + function setItemIds(Classes class, uint256[] memory itemIds) internal { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(uint8(class))); + + StoreSwitch.setDynamicField(_tableId, _keyTuple, 0, EncodeArray.encode((itemIds))); + } + + /** + * @notice Set itemIds. + */ + function _setItemIds(Classes class, uint256[] memory itemIds) internal { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(uint8(class))); + + StoreCore.setDynamicField(_tableId, _keyTuple, 0, EncodeArray.encode((itemIds))); + } + + /** + * @notice Get the length of itemIds. + */ + function lengthItemIds(Classes class) internal view returns (uint256) { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(uint8(class))); + + uint256 _byteLength = StoreSwitch.getDynamicFieldLength(_tableId, _keyTuple, 0); + unchecked { + return _byteLength / 32; + } + } + + /** + * @notice Get the length of itemIds. + */ + function _lengthItemIds(Classes class) internal view returns (uint256) { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(uint8(class))); + + uint256 _byteLength = StoreCore.getDynamicFieldLength(_tableId, _keyTuple, 0); + unchecked { + return _byteLength / 32; + } + } + + /** + * @notice Get an item of itemIds. + * @dev Reverts with Store_IndexOutOfBounds if `_index` is out of bounds for the array. + */ + function getItemItemIds(Classes class, uint256 _index) internal view returns (uint256) { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(uint8(class))); + + unchecked { + bytes memory _blob = StoreSwitch.getDynamicFieldSlice(_tableId, _keyTuple, 0, _index * 32, (_index + 1) * 32); + return (uint256(bytes32(_blob))); + } + } + + /** + * @notice Get an item of itemIds. + * @dev Reverts with Store_IndexOutOfBounds if `_index` is out of bounds for the array. + */ + function _getItemItemIds(Classes class, uint256 _index) internal view returns (uint256) { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(uint8(class))); + + unchecked { + bytes memory _blob = StoreCore.getDynamicFieldSlice(_tableId, _keyTuple, 0, _index * 32, (_index + 1) * 32); + return (uint256(bytes32(_blob))); + } + } + + /** + * @notice Push an element to itemIds. + */ + function pushItemIds(Classes class, uint256 _element) internal { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(uint8(class))); + + StoreSwitch.pushToDynamicField(_tableId, _keyTuple, 0, abi.encodePacked((_element))); + } + + /** + * @notice Push an element to itemIds. + */ + function _pushItemIds(Classes class, uint256 _element) internal { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(uint8(class))); + + StoreCore.pushToDynamicField(_tableId, _keyTuple, 0, abi.encodePacked((_element))); + } + + /** + * @notice Pop an element from itemIds. + */ + function popItemIds(Classes class) internal { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(uint8(class))); + + StoreSwitch.popFromDynamicField(_tableId, _keyTuple, 0, 32); + } + + /** + * @notice Pop an element from itemIds. + */ + function _popItemIds(Classes class) internal { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(uint8(class))); + + StoreCore.popFromDynamicField(_tableId, _keyTuple, 0, 32); + } + + /** + * @notice Update an element of itemIds at `_index`. + */ + function updateItemIds(Classes class, uint256 _index, uint256 _element) internal { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(uint8(class))); + + unchecked { + bytes memory _encoded = abi.encodePacked((_element)); + StoreSwitch.spliceDynamicData(_tableId, _keyTuple, 0, uint40(_index * 32), uint40(_encoded.length), _encoded); + } + } + + /** + * @notice Update an element of itemIds at `_index`. + */ + function _updateItemIds(Classes class, uint256 _index, uint256 _element) internal { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(uint8(class))); + + unchecked { + bytes memory _encoded = abi.encodePacked((_element)); + StoreCore.spliceDynamicData(_tableId, _keyTuple, 0, uint40(_index * 32), uint40(_encoded.length), _encoded); + } + } + + /** + * @notice Get amounts. + */ + function getAmounts(Classes class) internal view returns (uint256[] memory amounts) { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(uint8(class))); + + bytes memory _blob = StoreSwitch.getDynamicField(_tableId, _keyTuple, 1); + return (SliceLib.getSubslice(_blob, 0, _blob.length).decodeArray_uint256()); + } + + /** + * @notice Get amounts. + */ + function _getAmounts(Classes class) internal view returns (uint256[] memory amounts) { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(uint8(class))); + + bytes memory _blob = StoreCore.getDynamicField(_tableId, _keyTuple, 1); + return (SliceLib.getSubslice(_blob, 0, _blob.length).decodeArray_uint256()); + } + + /** + * @notice Set amounts. + */ + function setAmounts(Classes class, uint256[] memory amounts) internal { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(uint8(class))); + + StoreSwitch.setDynamicField(_tableId, _keyTuple, 1, EncodeArray.encode((amounts))); + } + + /** + * @notice Set amounts. + */ + function _setAmounts(Classes class, uint256[] memory amounts) internal { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(uint8(class))); + + StoreCore.setDynamicField(_tableId, _keyTuple, 1, EncodeArray.encode((amounts))); + } + + /** + * @notice Get the length of amounts. + */ + function lengthAmounts(Classes class) internal view returns (uint256) { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(uint8(class))); + + uint256 _byteLength = StoreSwitch.getDynamicFieldLength(_tableId, _keyTuple, 1); + unchecked { + return _byteLength / 32; + } + } + + /** + * @notice Get the length of amounts. + */ + function _lengthAmounts(Classes class) internal view returns (uint256) { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(uint8(class))); + + uint256 _byteLength = StoreCore.getDynamicFieldLength(_tableId, _keyTuple, 1); + unchecked { + return _byteLength / 32; + } + } + + /** + * @notice Get an item of amounts. + * @dev Reverts with Store_IndexOutOfBounds if `_index` is out of bounds for the array. + */ + function getItemAmounts(Classes class, uint256 _index) internal view returns (uint256) { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(uint8(class))); + + unchecked { + bytes memory _blob = StoreSwitch.getDynamicFieldSlice(_tableId, _keyTuple, 1, _index * 32, (_index + 1) * 32); + return (uint256(bytes32(_blob))); + } + } + + /** + * @notice Get an item of amounts. + * @dev Reverts with Store_IndexOutOfBounds if `_index` is out of bounds for the array. + */ + function _getItemAmounts(Classes class, uint256 _index) internal view returns (uint256) { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(uint8(class))); + + unchecked { + bytes memory _blob = StoreCore.getDynamicFieldSlice(_tableId, _keyTuple, 1, _index * 32, (_index + 1) * 32); + return (uint256(bytes32(_blob))); + } + } + + /** + * @notice Push an element to amounts. + */ + function pushAmounts(Classes class, uint256 _element) internal { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(uint8(class))); + + StoreSwitch.pushToDynamicField(_tableId, _keyTuple, 1, abi.encodePacked((_element))); + } + + /** + * @notice Push an element to amounts. + */ + function _pushAmounts(Classes class, uint256 _element) internal { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(uint8(class))); + + StoreCore.pushToDynamicField(_tableId, _keyTuple, 1, abi.encodePacked((_element))); + } + + /** + * @notice Pop an element from amounts. + */ + function popAmounts(Classes class) internal { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(uint8(class))); + + StoreSwitch.popFromDynamicField(_tableId, _keyTuple, 1, 32); + } + + /** + * @notice Pop an element from amounts. + */ + function _popAmounts(Classes class) internal { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(uint8(class))); + + StoreCore.popFromDynamicField(_tableId, _keyTuple, 1, 32); + } + + /** + * @notice Update an element of amounts at `_index`. + */ + function updateAmounts(Classes class, uint256 _index, uint256 _element) internal { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(uint8(class))); + + unchecked { + bytes memory _encoded = abi.encodePacked((_element)); + StoreSwitch.spliceDynamicData(_tableId, _keyTuple, 1, uint40(_index * 32), uint40(_encoded.length), _encoded); + } + } + + /** + * @notice Update an element of amounts at `_index`. + */ + function _updateAmounts(Classes class, uint256 _index, uint256 _element) internal { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(uint8(class))); + + unchecked { + bytes memory _encoded = abi.encodePacked((_element)); + StoreCore.spliceDynamicData(_tableId, _keyTuple, 1, uint40(_index * 32), uint40(_encoded.length), _encoded); + } + } + + /** + * @notice Get the full data. + */ + function get(Classes class) internal view returns (StarterItemsData memory _table) { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(uint8(class))); + + (bytes memory _staticData, EncodedLengths _encodedLengths, bytes memory _dynamicData) = StoreSwitch.getRecord( + _tableId, + _keyTuple, + _fieldLayout + ); + return decode(_staticData, _encodedLengths, _dynamicData); + } + + /** + * @notice Get the full data. + */ + function _get(Classes class) internal view returns (StarterItemsData memory _table) { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(uint8(class))); + + (bytes memory _staticData, EncodedLengths _encodedLengths, bytes memory _dynamicData) = StoreCore.getRecord( + _tableId, + _keyTuple, + _fieldLayout + ); + return decode(_staticData, _encodedLengths, _dynamicData); + } + + /** + * @notice Set the full data using individual values. + */ + function set(Classes class, uint256[] memory itemIds, uint256[] memory amounts) internal { + bytes memory _staticData; + EncodedLengths _encodedLengths = encodeLengths(itemIds, amounts); + bytes memory _dynamicData = encodeDynamic(itemIds, amounts); + + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(uint8(class))); + + StoreSwitch.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData); + } + + /** + * @notice Set the full data using individual values. + */ + function _set(Classes class, uint256[] memory itemIds, uint256[] memory amounts) internal { + bytes memory _staticData; + EncodedLengths _encodedLengths = encodeLengths(itemIds, amounts); + bytes memory _dynamicData = encodeDynamic(itemIds, amounts); + + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(uint8(class))); + + StoreCore.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData, _fieldLayout); + } + + /** + * @notice Set the full data using the data struct. + */ + function set(Classes class, StarterItemsData memory _table) internal { + bytes memory _staticData; + EncodedLengths _encodedLengths = encodeLengths(_table.itemIds, _table.amounts); + bytes memory _dynamicData = encodeDynamic(_table.itemIds, _table.amounts); + + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(uint8(class))); + + StoreSwitch.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData); + } + + /** + * @notice Set the full data using the data struct. + */ + function _set(Classes class, StarterItemsData memory _table) internal { + bytes memory _staticData; + EncodedLengths _encodedLengths = encodeLengths(_table.itemIds, _table.amounts); + bytes memory _dynamicData = encodeDynamic(_table.itemIds, _table.amounts); + + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(uint8(class))); + + StoreCore.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData, _fieldLayout); + } + + /** + * @notice Decode the tightly packed blob of dynamic data using the encoded lengths. + */ + function decodeDynamic( + EncodedLengths _encodedLengths, + bytes memory _blob + ) internal pure returns (uint256[] memory itemIds, uint256[] memory amounts) { + uint256 _start; + uint256 _end; + unchecked { + _end = _encodedLengths.atIndex(0); + } + itemIds = (SliceLib.getSubslice(_blob, _start, _end).decodeArray_uint256()); + + _start = _end; + unchecked { + _end += _encodedLengths.atIndex(1); + } + amounts = (SliceLib.getSubslice(_blob, _start, _end).decodeArray_uint256()); + } + + /** + * @notice Decode the tightly packed blobs using this table's field layout. + * + * @param _encodedLengths Encoded lengths of dynamic fields. + * @param _dynamicData Tightly packed dynamic fields. + */ + function decode( + bytes memory, + EncodedLengths _encodedLengths, + bytes memory _dynamicData + ) internal pure returns (StarterItemsData memory _table) { + (_table.itemIds, _table.amounts) = decodeDynamic(_encodedLengths, _dynamicData); + } + + /** + * @notice Delete all data for given keys. + */ + function deleteRecord(Classes class) internal { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(uint8(class))); + + StoreSwitch.deleteRecord(_tableId, _keyTuple); + } + + /** + * @notice Delete all data for given keys. + */ + function _deleteRecord(Classes class) internal { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(uint8(class))); + + StoreCore.deleteRecord(_tableId, _keyTuple, _fieldLayout); + } + + /** + * @notice Tightly pack dynamic data lengths using this table's schema. + * @return _encodedLengths The lengths of the dynamic fields (packed into a single bytes32 value). + */ + function encodeLengths( + uint256[] memory itemIds, + uint256[] memory amounts + ) internal pure returns (EncodedLengths _encodedLengths) { + // Lengths are effectively checked during copy by 2**40 bytes exceeding gas limits + unchecked { + _encodedLengths = EncodedLengthsLib.pack(itemIds.length * 32, amounts.length * 32); + } + } + + /** + * @notice Tightly pack dynamic (variable length) data using this table's schema. + * @return The dynamic data, encoded into a sequence of bytes. + */ + function encodeDynamic(uint256[] memory itemIds, uint256[] memory amounts) internal pure returns (bytes memory) { + return abi.encodePacked(EncodeArray.encode((itemIds)), EncodeArray.encode((amounts))); + } + + /** + * @notice Encode all of a record's fields. + * @return The static (fixed length) data, encoded into a sequence of bytes. + * @return The lengths of the dynamic fields (packed into a single bytes32 value). + * @return The dynamic (variable length) data, encoded into a sequence of bytes. + */ + function encode( + uint256[] memory itemIds, + uint256[] memory amounts + ) internal pure returns (bytes memory, EncodedLengths, bytes memory) { + bytes memory _staticData; + EncodedLengths _encodedLengths = encodeLengths(itemIds, amounts); + bytes memory _dynamicData = encodeDynamic(itemIds, amounts); + + return (_staticData, _encodedLengths, _dynamicData); + } + + /** + * @notice Encode keys as a bytes32 array using this table's field layout. + */ + function encodeKeyTuple(Classes class) internal pure returns (bytes32[] memory) { + bytes32[] memory _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32(uint256(uint8(class))); + + return _keyTuple; + } +} diff --git a/packages/contracts/src/codegen/tables/UltimateDominionConfig.sol b/packages/contracts/src/codegen/tables/UltimateDominionConfig.sol index cf8599675..f71d6bcc6 100644 --- a/packages/contracts/src/codegen/tables/UltimateDominionConfig.sol +++ b/packages/contracts/src/codegen/tables/UltimateDominionConfig.sol @@ -22,6 +22,7 @@ struct UltimateDominionConfigData { address characterToken; address entropy; address pythProvider; + address items; } library UltimateDominionConfig { @@ -29,12 +30,12 @@ library UltimateDominionConfig { ResourceId constant _tableId = ResourceId.wrap(0x74625544000000000000000000000000556c74696d617465446f6d696e696f6e); FieldLayout constant _fieldLayout = - FieldLayout.wrap(0x0051050001141414140000000000000000000000000000000000000000000000); + FieldLayout.wrap(0x0065060001141414141400000000000000000000000000000000000000000000); // Hex-encoded key schema of () Schema constant _keySchema = Schema.wrap(0x0000000000000000000000000000000000000000000000000000000000000000); - // Hex-encoded value schema of (bool, address, address, address, address) - Schema constant _valueSchema = Schema.wrap(0x0051050060616161610000000000000000000000000000000000000000000000); + // Hex-encoded value schema of (bool, address, address, address, address, address) + Schema constant _valueSchema = Schema.wrap(0x0065060060616161616100000000000000000000000000000000000000000000); /** * @notice Get the table's key field names. @@ -49,12 +50,13 @@ library UltimateDominionConfig { * @return fieldNames An array of strings with the names of value fields. */ function getFieldNames() internal pure returns (string[] memory fieldNames) { - fieldNames = new string[](5); + fieldNames = new string[](6); fieldNames[0] = "locked"; fieldNames[1] = "goldToken"; fieldNames[2] = "characterToken"; fieldNames[3] = "entropy"; fieldNames[4] = "pythProvider"; + fieldNames[5] = "items"; } /** @@ -261,6 +263,44 @@ library UltimateDominionConfig { StoreCore.setStaticField(_tableId, _keyTuple, 4, abi.encodePacked((pythProvider)), _fieldLayout); } + /** + * @notice Get items. + */ + function getItems() internal view returns (address items) { + bytes32[] memory _keyTuple = new bytes32[](0); + + bytes32 _blob = StoreSwitch.getStaticField(_tableId, _keyTuple, 5, _fieldLayout); + return (address(bytes20(_blob))); + } + + /** + * @notice Get items. + */ + function _getItems() internal view returns (address items) { + bytes32[] memory _keyTuple = new bytes32[](0); + + bytes32 _blob = StoreCore.getStaticField(_tableId, _keyTuple, 5, _fieldLayout); + return (address(bytes20(_blob))); + } + + /** + * @notice Set items. + */ + function setItems(address items) internal { + bytes32[] memory _keyTuple = new bytes32[](0); + + StoreSwitch.setStaticField(_tableId, _keyTuple, 5, abi.encodePacked((items)), _fieldLayout); + } + + /** + * @notice Set items. + */ + function _setItems(address items) internal { + bytes32[] memory _keyTuple = new bytes32[](0); + + StoreCore.setStaticField(_tableId, _keyTuple, 5, abi.encodePacked((items)), _fieldLayout); + } + /** * @notice Get the full data. */ @@ -292,8 +332,15 @@ library UltimateDominionConfig { /** * @notice Set the full data using individual values. */ - function set(bool locked, address goldToken, address characterToken, address entropy, address pythProvider) internal { - bytes memory _staticData = encodeStatic(locked, goldToken, characterToken, entropy, pythProvider); + function set( + bool locked, + address goldToken, + address characterToken, + address entropy, + address pythProvider, + address items + ) internal { + bytes memory _staticData = encodeStatic(locked, goldToken, characterToken, entropy, pythProvider, items); EncodedLengths _encodedLengths; bytes memory _dynamicData; @@ -311,9 +358,10 @@ library UltimateDominionConfig { address goldToken, address characterToken, address entropy, - address pythProvider + address pythProvider, + address items ) internal { - bytes memory _staticData = encodeStatic(locked, goldToken, characterToken, entropy, pythProvider); + bytes memory _staticData = encodeStatic(locked, goldToken, characterToken, entropy, pythProvider, items); EncodedLengths _encodedLengths; bytes memory _dynamicData; @@ -332,7 +380,8 @@ library UltimateDominionConfig { _table.goldToken, _table.characterToken, _table.entropy, - _table.pythProvider + _table.pythProvider, + _table.items ); EncodedLengths _encodedLengths; @@ -352,7 +401,8 @@ library UltimateDominionConfig { _table.goldToken, _table.characterToken, _table.entropy, - _table.pythProvider + _table.pythProvider, + _table.items ); EncodedLengths _encodedLengths; @@ -371,7 +421,14 @@ library UltimateDominionConfig { ) internal pure - returns (bool locked, address goldToken, address characterToken, address entropy, address pythProvider) + returns ( + bool locked, + address goldToken, + address characterToken, + address entropy, + address pythProvider, + address items + ) { locked = (_toBool(uint8(Bytes.getBytes1(_blob, 0)))); @@ -382,6 +439,8 @@ library UltimateDominionConfig { entropy = (address(Bytes.getBytes20(_blob, 41))); pythProvider = (address(Bytes.getBytes20(_blob, 61))); + + items = (address(Bytes.getBytes20(_blob, 81))); } /** @@ -395,9 +454,14 @@ library UltimateDominionConfig { EncodedLengths, bytes memory ) internal pure returns (UltimateDominionConfigData memory _table) { - (_table.locked, _table.goldToken, _table.characterToken, _table.entropy, _table.pythProvider) = decodeStatic( - _staticData - ); + ( + _table.locked, + _table.goldToken, + _table.characterToken, + _table.entropy, + _table.pythProvider, + _table.items + ) = decodeStatic(_staticData); } /** @@ -427,9 +491,10 @@ library UltimateDominionConfig { address goldToken, address characterToken, address entropy, - address pythProvider + address pythProvider, + address items ) internal pure returns (bytes memory) { - return abi.encodePacked(locked, goldToken, characterToken, entropy, pythProvider); + return abi.encodePacked(locked, goldToken, characterToken, entropy, pythProvider, items); } /** @@ -443,9 +508,10 @@ library UltimateDominionConfig { address goldToken, address characterToken, address entropy, - address pythProvider + address pythProvider, + address items ) internal pure returns (bytes memory, EncodedLengths, bytes memory) { - bytes memory _staticData = encodeStatic(locked, goldToken, characterToken, entropy, pythProvider); + bytes memory _staticData = encodeStatic(locked, goldToken, characterToken, entropy, pythProvider, items); EncodedLengths _encodedLengths; bytes memory _dynamicData; diff --git a/packages/contracts/src/codegen/world/IItemsSystem.sol b/packages/contracts/src/codegen/world/IItemsSystem.sol new file mode 100644 index 000000000..151c15b32 --- /dev/null +++ b/packages/contracts/src/codegen/world/IItemsSystem.sol @@ -0,0 +1,31 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.8.24; + +/* Autogenerated file. Do not edit manually. */ + +import { ItemType, Classes } from "@codegen/common.sol"; +import { WeaponStats } from "@interfaces/Structs.sol"; + +/** + * @title IItemsSystem + * @author MUD (https://mud.dev) by Lattice (https://lattice.xyz) + * @dev This interface is automatically generated from the corresponding system contract. Do not edit manually. + */ +interface IItemsSystem { + function UD__createItem( + ItemType itemType, + uint256 supply, + string memory itemMetadataURI, + bytes memory stats + ) external returns (uint256); + + function UD__getTotalSupply(uint256 tokenId) external view returns (uint256 _supply); + + function UD__issueStarterItems(uint256 characterId) external; + + function UD__setTokenUri(uint256 tokenId, string memory tokenUri) external; + + function UD__getWeaponStats(uint256 itemId) external view returns (WeaponStats memory _weaponStats); + + function UD__setStarterItems(Classes class, uint256[] memory itemIds, uint256[] memory amounts) external; +} diff --git a/packages/contracts/src/codegen/world/IUltimateDominionConfigSystem.sol b/packages/contracts/src/codegen/world/IUltimateDominionConfigSystem.sol index 52895c976..938ce61f4 100644 --- a/packages/contracts/src/codegen/world/IUltimateDominionConfigSystem.sol +++ b/packages/contracts/src/codegen/world/IUltimateDominionConfigSystem.sol @@ -16,4 +16,6 @@ interface IUltimateDominionConfigSystem { function UD__getEntropy() external view returns (address _entropy); function UD__getPythProvider() external view returns (address _provider); + + function UD__getItemsContract() external view returns (address _erc1155); } diff --git a/packages/contracts/src/codegen/world/IWorld.sol b/packages/contracts/src/codegen/world/IWorld.sol index 471cc5400..97a628ab4 100644 --- a/packages/contracts/src/codegen/world/IWorld.sol +++ b/packages/contracts/src/codegen/world/IWorld.sol @@ -6,6 +6,7 @@ pragma solidity >=0.8.24; import { IBaseWorld } from "@latticexyz/world/src/codegen/interfaces/IBaseWorld.sol"; import { ICharacterSystem } from "./ICharacterSystem.sol"; +import { IItemsSystem } from "./IItemsSystem.sol"; import { IUltimateDominionConfigSystem } from "./IUltimateDominionConfigSystem.sol"; /** @@ -15,4 +16,4 @@ import { IUltimateDominionConfigSystem } from "./IUltimateDominionConfigSystem.s * that are dynamically registered in the World during deployment. * @dev This is an autogenerated file; do not edit manually. */ -interface IWorld is IBaseWorld, ICharacterSystem, IUltimateDominionConfigSystem {} +interface IWorld is IBaseWorld, ICharacterSystem, IItemsSystem, IUltimateDominionConfigSystem {} diff --git a/packages/contracts/src/interfaces/Structs.sol b/packages/contracts/src/interfaces/Structs.sol new file mode 100644 index 000000000..40e3d4af1 --- /dev/null +++ b/packages/contracts/src/interfaces/Structs.sol @@ -0,0 +1,8 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.8.24; + +struct WeaponStats { + uint256 damage; + uint256 speed; + uint8[] classRestrictions; +} diff --git a/packages/contracts/src/systems/CharacterSystem.sol b/packages/contracts/src/systems/CharacterSystem.sol index 01f82706e..bfabadc3a 100644 --- a/packages/contracts/src/systems/CharacterSystem.sol +++ b/packages/contracts/src/systems/CharacterSystem.sol @@ -11,13 +11,13 @@ import {SystemSwitch} from "@latticexyz/world-modules/src/utils/SystemSwitch.sol import {TokenURI} from "@latticexyz/world-modules/src/modules/erc721-puppet/tables/TokenURI.sol"; import {_tokenUriTableId} from "@latticexyz/world-modules/src/modules/erc721-puppet/utils.sol"; import {IERC20System} from "@latticexyz/world-modules/src/interfaces/IERC20System.sol"; -// import {IItemsSystem} from "@codegen/world/IItemsSystem.sol"; +import {IItemsSystem} from "@codegen/world/IItemsSystem.sol"; import {Classes} from "@codegen/common.sol"; import {Characters, CharactersData} from "@tables/Characters.sol"; import {CharacterStats, CharacterStatsData} from "@tables/CharacterStats.sol"; import {NameExists} from "@tables/NameExists.sol"; import {Counters} from "@tables/Counters.sol"; -// import {IERC1155System} from "@erc1155/IERC1155System.sol"; +import {IERC1155System} from "@erc1155/IERC1155System.sol"; import {ResourceId, WorldResourceIdLib, WorldResourceIdInstance} from "@latticexyz/world/src/WorldResourceId.sol"; import {RESOURCE_SYSTEM} from "@latticexyz/world/src/worldResourceTypes.sol"; import {IWorld} from "@world/IWorld.sol"; @@ -26,8 +26,8 @@ import {LibChunks} from "../libraries/LibChunks.sol"; import "forge-std/console2.sol"; import {IEntropyConsumer} from "@pythnetwork/IEntropyConsumer.sol"; import {IEntropy} from "@pythnetwork/IEntropy.sol"; -import {_erc721SystemId} from "../utils.sol"; //, _erc1155SystemId, _itemsSystemId -import {GOLD_NAMESPACE, CHARACTERS_NAMESPACE, WORLD_NAMESPACE} from "../../constants.sol"; //, ITEMS_NAMESPACE +import {_erc721SystemId, _erc1155SystemId, _itemsSystemId} from "../utils.sol"; +import {GOLD_NAMESPACE, CHARACTERS_NAMESPACE, WORLD_NAMESPACE, ITEMS_NAMESPACE} from "../../constants.sol"; contract CharacterSystem is System { function getName(uint256 characterId) public view returns (bytes32 _name) { @@ -79,7 +79,7 @@ contract CharacterSystem is System { issueGold(characterId, 5 ether); // issue starterWeapon - // IWorld(_world()).UD__issueStarterItems(characterId, 0, 1); + IWorld(_world()).UD__issueStarterItems(characterId); Characters.setLocked(characterId, true); } diff --git a/packages/contracts/src/systems/ItemsSystem.sol b/packages/contracts/src/systems/ItemsSystem.sol new file mode 100644 index 000000000..695bb9b25 --- /dev/null +++ b/packages/contracts/src/systems/ItemsSystem.sol @@ -0,0 +1,106 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.8.24; + +import {System} from "@latticexyz/world/src/System.sol"; +import {Systems} from "@latticexyz/world/src/codegen/tables/Systems.sol"; +import {IWorld} from "@world/IWorld.sol"; +import {IERC1155System} from "@erc1155/IERC1155System.sol"; +import {IERC1155Receiver} from "@erc1155/IERC1155Receiver.sol"; +import { + UltimateDominionConfig, + Items, + ItemsData, + Counters, + StarterItems, + StarterItemsData, + Characters +} from "@codegen/index.sol"; +import {ItemType, Classes} from "@codegen/common.sol"; +import {AccessControlLib} from "@latticexyz/world-modules/src/utils/AccessControlLib.sol"; +import {SystemRegistry} from "@latticexyz/world/src/codegen/tables/SystemRegistry.sol"; +import {_erc1155SystemId, _characterSystemId} from "../utils.sol"; +import {ITEMS_NAMESPACE} from "../../constants.sol"; +import {WeaponStats} from "@interfaces/Structs.sol"; +import {TotalSupply} from "@erc1155/tables/TotalSupply.sol"; +import {ERC1155URIStorage} from "@erc1155/tables/ERC1155URIStorage.sol"; +import {ERC1155MetadataURI} from "@erc1155/tables/ERC1155MetadataURI.sol"; +import {ERC1155System} from "@erc1155/ERC1155System.sol"; +import { + _metadataTableId, + _erc1155URIStorageTableId, + _totalSupplyTableId, + _operatorApprovalTableId, + _ownersTableId +} from "@erc1155/utils.sol"; +import "forge-std/console2.sol"; + +contract ItemsSystem is ERC1155System { + function _items() internal view returns (IERC1155System items) { + items = IERC1155System(UltimateDominionConfig.getItems()); + } + + function createItem(ItemType itemType, uint256 supply, string memory itemMetadataURI, bytes memory stats) + public + returns (uint256) + { + requireOwner(); + uint256 itemId = _incrementItemsCounter(); + IWorld(_world()).call( + _erc1155SystemId(ITEMS_NAMESPACE), + abi.encodeWithSignature("mint(address,uint256,uint256,bytes)", address(this), itemId, supply, "") + ); + + _setTokenUri(ITEMS_NAMESPACE, itemId, itemMetadataURI); + Items.set(itemId, itemType, stats); + + return itemId; + } + + function getTotalSupply(uint256 tokenId) public view returns (uint256 _supply) { + _supply = TotalSupply.getTotalSupply(_totalSupplyTableId(ITEMS_NAMESPACE), tokenId); + } + + function issueStarterItems(uint256 characterId) public { + require(_msgSender() == Systems.getSystem(_characterSystemId("UD")), "ITEMS: Invalid System"); + StarterItemsData memory starterItems = StarterItems.get(Characters.getClass(characterId)); + + address owner = IWorld(_world()).UD__getOwner(characterId); + + for (uint256 i; i < starterItems.itemIds.length; i++) { + _items().transferFrom(address(this), owner, starterItems.itemIds[i], starterItems.amounts[i]); + } + } + + function setTokenUri(uint256 tokenId, string memory tokenUri) public { + requireOwner(); + _setTokenUri(ITEMS_NAMESPACE, tokenId, tokenUri); + } + + function _incrementItemsCounter() internal returns (uint256) { + address itemsContract = UltimateDominionConfig.getItems(); + uint256 itemsCounter = Counters.getCounter(address(itemsContract)); + Counters.setCounter(itemsContract, (itemsCounter + 1)); + return itemsCounter; + } + + function requireOwner() internal view { + AccessControlLib.requireOwner(SystemRegistry.get(address(this)), _msgSender()); + } + + function getWeaponStats(uint256 itemId) public view returns (WeaponStats memory _weaponStats) { + ItemsData memory _data = Items.get(itemId); + require(_data.itemType == ItemType.Weapon, "ITEMS: Not a weapon"); + _weaponStats = abi.decode(_data.stats, (WeaponStats)); + } + + function setStarterItems(Classes class, uint256[] memory itemIds, uint256[] memory amounts) public { + requireOwner(); + require(itemIds.length == amounts.length, "ITEMS: Length mismatch"); + StarterItems.set(class, itemIds, amounts); + } + + // function getArmourStats(uint256 itemId)public view returns(){} + // function getPotionStats(uint256 itemId)public view returns(){} + // function getScrollStats(uint256 itemId)public view returns(){} + // function getMaterialStats(uint256 itemId)public view returns(){} +} diff --git a/packages/contracts/src/systems/UltimateDominionConfigSystem.sol b/packages/contracts/src/systems/UltimateDominionConfigSystem.sol index f3edfa15f..8cb554ba1 100644 --- a/packages/contracts/src/systems/UltimateDominionConfigSystem.sol +++ b/packages/contracts/src/systems/UltimateDominionConfigSystem.sol @@ -1,23 +1,27 @@ // SPDX-License-Identifier: MIT pragma solidity >=0.8.24; -import { System } from "@latticexyz/world/src/System.sol"; -import { UltimateDominionConfig } from "../codegen/index.sol"; +import {System} from "@latticexyz/world/src/System.sol"; +import {UltimateDominionConfig} from "../codegen/index.sol"; contract UltimateDominionConfigSystem is System { - function getCharacterToken() public view returns (address _characterToken) { - _characterToken = UltimateDominionConfig.getCharacterToken(); - } + function getCharacterToken() public view returns (address _characterToken) { + _characterToken = UltimateDominionConfig.getCharacterToken(); + } - function getGoldToken() public view returns (address _goldToken) { - _goldToken = UltimateDominionConfig.getGoldToken(); - } + function getGoldToken() public view returns (address _goldToken) { + _goldToken = UltimateDominionConfig.getGoldToken(); + } - function getEntropy() public view returns (address _entropy) { - _entropy = UltimateDominionConfig.getEntropy(); - } + function getEntropy() public view returns (address _entropy) { + _entropy = UltimateDominionConfig.getEntropy(); + } - function getPythProvider() public view returns (address _provider) { - _provider = UltimateDominionConfig.getPythProvider(); - } + function getPythProvider() public view returns (address _provider) { + _provider = UltimateDominionConfig.getPythProvider(); + } + + function getItemsContract() public view returns (address _erc1155) { + _erc1155 = UltimateDominionConfig.getItems(); + } } diff --git a/packages/contracts/src/utils.sol b/packages/contracts/src/utils.sol index a97613234..bcfb45587 100644 --- a/packages/contracts/src/utils.sol +++ b/packages/contracts/src/utils.sol @@ -1,24 +1,34 @@ // SPDX-License-Identifier: MIT pragma solidity >=0.8.24; -import { ResourceId } from "@latticexyz/store/src/ResourceId.sol"; -import { RESOURCE_TABLE } from "@latticexyz/store/src/storeResourceTypes.sol"; +import {ResourceId} from "@latticexyz/store/src/ResourceId.sol"; +import {RESOURCE_TABLE} from "@latticexyz/store/src/storeResourceTypes.sol"; -import { WorldResourceIdLib } from "@latticexyz/world/src/WorldResourceId.sol"; -import { RESOURCE_SYSTEM } from "@latticexyz/world/src/worldResourceTypes.sol"; +import {WorldResourceIdLib} from "@latticexyz/world/src/WorldResourceId.sol"; +import {RESOURCE_SYSTEM} from "@latticexyz/world/src/worldResourceTypes.sol"; bytes16 constant ERC20_SYSTEM_NAME = "ERC20System"; bytes16 constant ERC721_SYSTEM_NAME = "ERC721System"; +bytes16 constant ERC1155_SYSTEM_NAME = "ERC1155System"; bytes16 constant CHARACTER_SYSTEM_NAME = "CharacterSystem"; +bytes16 constant ITEMS_SYSTEM_NAME = "ItemsSystem"; function _erc20SystemId(bytes14 namespace) pure returns (ResourceId) { - return WorldResourceIdLib.encode({ typeId: RESOURCE_SYSTEM, namespace: namespace, name: ERC20_SYSTEM_NAME }); + return WorldResourceIdLib.encode({typeId: RESOURCE_SYSTEM, namespace: namespace, name: ERC20_SYSTEM_NAME}); } function _erc721SystemId(bytes14 namespace) pure returns (ResourceId) { - return WorldResourceIdLib.encode({ typeId: RESOURCE_SYSTEM, namespace: namespace, name: ERC721_SYSTEM_NAME }); + return WorldResourceIdLib.encode({typeId: RESOURCE_SYSTEM, namespace: namespace, name: ERC721_SYSTEM_NAME}); } function _characterSystemId(bytes14 namespace) pure returns (ResourceId) { - return WorldResourceIdLib.encode({ typeId: RESOURCE_SYSTEM, namespace: namespace, name: CHARACTER_SYSTEM_NAME }); + return WorldResourceIdLib.encode({typeId: RESOURCE_SYSTEM, namespace: namespace, name: CHARACTER_SYSTEM_NAME}); +} + +function _erc1155SystemId(bytes14 namespace) pure returns (ResourceId) { + return WorldResourceIdLib.encode({typeId: RESOURCE_SYSTEM, namespace: namespace, name: ERC1155_SYSTEM_NAME}); +} + +function _itemsSystemId(bytes14 namespace) pure returns (ResourceId) { + return WorldResourceIdLib.encode({typeId: RESOURCE_SYSTEM, namespace: namespace, name: ITEMS_SYSTEM_NAME}); } diff --git a/packages/contracts/test/ItemsSystem.t.sol b/packages/contracts/test/ItemsSystem.t.sol new file mode 100644 index 000000000..31d5bec59 --- /dev/null +++ b/packages/contracts/test/ItemsSystem.t.sol @@ -0,0 +1,75 @@ +pragma solidity >=0.8.24; + +import {SetUp} from "./SetUp.sol"; +import {Classes, ItemType} from "@codegen/common.sol"; +import {CharacterStatsData} from "@tables/CharacterStats.sol"; +import "forge-std/console2.sol"; +import {PuppetModule} from "@latticexyz/world-modules/src/modules/puppet/PuppetModule.sol"; +import {UltimateDominionConfig} from "@codegen/index.sol"; +import {UltimateDominionConfigSystem} from "@systems/UltimateDominionConfigSystem.sol"; +import {ERC1155Module} from "@erc1155/ERC1155Module.sol"; +import {ERC1155System} from "@erc1155/ERC1155System.sol"; +import {IERC1155MetadataURI} from "@erc1155/IERC1155MetadataURI.sol"; +import {IERC1155} from "@erc1155/IERC1155.sol"; +import {registerERC1155} from "@erc1155/registerERC1155.sol"; +import {_erc1155SystemId} from "@erc1155/utils.sol"; +import {WeaponStats} from "@interfaces/Structs.sol"; +import {ResourceIdLib} from "@latticexyz/store/src/ResourceId.sol"; +import {ResourceId, WorldResourceIdLib, WorldResourceIdInstance} from "@latticexyz/world/src/WorldResourceId.sol"; +import { + GOLD_NAMESPACE, + CHARACTERS_NAMESPACE, + ERC721_NAME, + ERC721_SYMBOL, + TOKEN_URI, + ITEMS_NAMESPACE +} from "../constants.sol"; +import {GasReporter} from "@latticexyz/gas-report/src/GasReporter.sol"; + +contract Test_ItemsSystem is SetUp, GasReporter { + function test_CreateItem() public { + startGasReport("creates an item"); + + uint8[] memory restrictions = new uint8[](0); + WeaponStats memory weaponStats = WeaponStats({damage: 1, speed: 2, classRestrictions: restrictions}); + vm.startPrank(deployer); + uint256 firstItemId = + world.UD__createItem(ItemType.Weapon, 10 ether, "test_Weapon_uri1/", abi.encode(weaponStats)); + uint256 newItemId = + world.UD__createItem(ItemType.Weapon, 100 ether, "test_Weapon_uri/", abi.encode(weaponStats)); + + assertEq(newItemId, 2); + assertEq(world.UD__getTotalSupply(newItemId), 100 ether); + assertEq(world.UD__getTotalSupply(firstItemId), 10 ether); + assertEq( + keccak256(abi.encode(erc1155System.uri(newItemId))), + keccak256(abi.encode("test_Items_uri/test_Weapon_uri/")) + ); + + endGasReport(); + } + + function test_CreateItem_Revert_NotNamespaceOwner() public { + uint8[] memory restrictions = new uint8[](0); + WeaponStats memory weaponStats = WeaponStats({damage: 1, speed: 2, classRestrictions: restrictions}); + vm.startPrank(alice); + vm.expectRevert(); + world.UD__createItem(ItemType.Weapon, 100 ether, "test_Weapon_uri1/", abi.encode(weaponStats)); + } + + function test_GetTotalSupply() public { + uint8[] memory restrictions = new uint8[](0); + WeaponStats memory weaponStats = WeaponStats({damage: 1, speed: 2, classRestrictions: restrictions}); + vm.startPrank(deployer); + uint256 id = world.UD__createItem(ItemType.Weapon, 100 ether, "test_Weapon_uri/", abi.encode(weaponStats)); + assertEq(world.UD__getTotalSupply(id), 100 ether); + } + + function test_GetBalance() public { + uint256 fees = entropy.getFee(address(1)); + vm.startPrank(alice); + world.UD__rollStats{value: fees}(alicesRandomness, alicesCharacterId, Classes.Rogue); + world.UD__enterGame(alicesCharacterId); + assertEq(erc1155System.balanceOf(address(alice), 0), 1); + } +} diff --git a/packages/contracts/test/SetUp.sol b/packages/contracts/test/SetUp.sol index 8ad028c07..37b743350 100644 --- a/packages/contracts/test/SetUp.sol +++ b/packages/contracts/test/SetUp.sol @@ -9,6 +9,7 @@ import {getKeysWithValue} from "@latticexyz/world-modules/src/modules/keyswithva import {StoreSwitch} from "@latticexyz/store/src/StoreSwitch.sol"; import {IWorld} from "@codegen/world/IWorld.sol"; import {IEntropy} from "@pythnetwork/IEntropy.sol"; +import {IERC1155System} from "@erc1155/IERC1155System.sol"; import {IERC20Mintable} from "@latticexyz/world-modules/src/modules/erc20-puppet/IERC20Mintable.sol"; import {IERC721Mintable} from "@latticexyz/world-modules/src/modules/erc721-puppet/IERC721Mintable.sol"; import {Characters, CharactersData, UltimateDominionConfig} from "@codegen/index.sol"; @@ -29,6 +30,7 @@ contract SetUp is Test { IERC20Mintable public goldToken; IERC721Mintable public characterToken; + IERC1155System public erc1155System; uint256 alicesCharacterId; bytes32 public alicesRandomness = bytes32(keccak256(abi.encode("alicesRestaurant"))); @@ -45,6 +47,7 @@ contract SetUp is Test { alice = getUser(); goldToken = IERC20Mintable(world.UD__getGoldToken()); characterToken = IERC721Mintable(world.UD__getCharacterToken()); + erc1155System = IERC1155System(world.UD__getItemsContract()); vm.stopPrank(); vm.prank(alice); alicesCharacterId = world.UD__mintCharacter(alice, bytes32("Steve"), "setup_char_uri"); diff --git a/packages/contracts/worlds.json b/packages/contracts/worlds.json index fc37e58ef..d4a2cc3a7 100644 --- a/packages/contracts/worlds.json +++ b/packages/contracts/worlds.json @@ -1,6 +1,6 @@ { "31337": { - "address": "0x6786c55634f438bf21be3b4891b9c5b03a7675f9" + "address": "0x8cf351a944b76876c869f543fc23b4a063195540" }, "84532": { "address": "0xea59f64d860d4be9918dc2c93bf8a5e84c875324", From 17358a95bb23a64000910731831b61adeccd676e Mon Sep 17 00:00:00 2001 From: MrDeadCe11 Date: Sat, 22 Jun 2024 00:31:06 -0500 Subject: [PATCH 4/7] added lib to gitignore and removed lib files from git --- packages/contracts/.gitignore | 1 + .../lib/ERC1155-puppet/ERC1155Module.sol | 102 ---- .../lib/ERC1155-puppet/ERC1155System.sol | 555 ------------------ .../contracts/lib/ERC1155-puppet/IERC1155.sol | 90 --- .../lib/ERC1155-puppet/IERC1155Errors.sol | 63 -- .../lib/ERC1155-puppet/IERC1155Events.sol | 36 -- .../ERC1155-puppet/IERC1155MetadataURI.sol | 19 - .../lib/ERC1155-puppet/IERC1155Receiver.sol | 54 -- .../lib/ERC1155-puppet/IERC1155System.sol | 55 -- .../lib/ERC1155-puppet/constants.sol | 22 - .../ERC1155-puppet/libraries/LibString.sol | 77 --- .../libraries/utils/ERC1155Utils.sol | 85 --- .../libraries/utils/draft-IERC6093.sol | 161 ----- .../lib/ERC1155-puppet/registerERC1155.sol | 37 -- .../tables/ERC1155MetadataURI.sol | 414 ------------- .../ERC1155-puppet/tables/ERC1155Registry.sol | 321 ---------- .../tables/ERC1155URIStorage.sol | 446 -------------- .../tables/OperatorApproval.sol | 220 ------- .../lib/ERC1155-puppet/tables/Owners.sol | 208 ------- .../lib/ERC1155-puppet/tables/TestConfig.sol | 300 ---------- .../lib/ERC1155-puppet/tables/TotalSupply.sol | 318 ---------- .../contracts/lib/ERC1155-puppet/utils.sol | 48 -- 22 files changed, 1 insertion(+), 3631 deletions(-) delete mode 100644 packages/contracts/lib/ERC1155-puppet/ERC1155Module.sol delete mode 100644 packages/contracts/lib/ERC1155-puppet/ERC1155System.sol delete mode 100644 packages/contracts/lib/ERC1155-puppet/IERC1155.sol delete mode 100644 packages/contracts/lib/ERC1155-puppet/IERC1155Errors.sol delete mode 100644 packages/contracts/lib/ERC1155-puppet/IERC1155Events.sol delete mode 100644 packages/contracts/lib/ERC1155-puppet/IERC1155MetadataURI.sol delete mode 100644 packages/contracts/lib/ERC1155-puppet/IERC1155Receiver.sol delete mode 100644 packages/contracts/lib/ERC1155-puppet/IERC1155System.sol delete mode 100644 packages/contracts/lib/ERC1155-puppet/constants.sol delete mode 100644 packages/contracts/lib/ERC1155-puppet/libraries/LibString.sol delete mode 100644 packages/contracts/lib/ERC1155-puppet/libraries/utils/ERC1155Utils.sol delete mode 100644 packages/contracts/lib/ERC1155-puppet/libraries/utils/draft-IERC6093.sol delete mode 100644 packages/contracts/lib/ERC1155-puppet/registerERC1155.sol delete mode 100644 packages/contracts/lib/ERC1155-puppet/tables/ERC1155MetadataURI.sol delete mode 100644 packages/contracts/lib/ERC1155-puppet/tables/ERC1155Registry.sol delete mode 100644 packages/contracts/lib/ERC1155-puppet/tables/ERC1155URIStorage.sol delete mode 100644 packages/contracts/lib/ERC1155-puppet/tables/OperatorApproval.sol delete mode 100644 packages/contracts/lib/ERC1155-puppet/tables/Owners.sol delete mode 100644 packages/contracts/lib/ERC1155-puppet/tables/TestConfig.sol delete mode 100644 packages/contracts/lib/ERC1155-puppet/tables/TotalSupply.sol delete mode 100644 packages/contracts/lib/ERC1155-puppet/utils.sol diff --git a/packages/contracts/.gitignore b/packages/contracts/.gitignore index d8334d9f7..3919f765d 100644 --- a/packages/contracts/.gitignore +++ b/packages/contracts/.gitignore @@ -5,6 +5,7 @@ node_modules/ bindings/ artifacts/ broadcast/ +lib/ # Ignore MUD deploy artifacts deploys/**/*.json diff --git a/packages/contracts/lib/ERC1155-puppet/ERC1155Module.sol b/packages/contracts/lib/ERC1155-puppet/ERC1155Module.sol deleted file mode 100644 index 3a67dcf67..000000000 --- a/packages/contracts/lib/ERC1155-puppet/ERC1155Module.sol +++ /dev/null @@ -1,102 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.20; - -import {ResourceIds} from "@latticexyz/store/src/codegen/tables/ResourceIds.sol"; -import {ResourceId} from "@latticexyz/store/src/ResourceId.sol"; -import {Module} from "@latticexyz/world/src/Module.sol"; -import {WorldResourceIdLib} from "@latticexyz/world/src/WorldResourceId.sol"; -import {IBaseWorld} from "@latticexyz/world/src/codegen/interfaces/IBaseWorld.sol"; -import {InstalledModules} from "@latticexyz/world/src/codegen/tables/InstalledModules.sol"; -import {revertWithBytes} from "@latticexyz/world/src/revertWithBytes.sol"; - -import {Puppet} from "@latticexyz/world-modules/src/modules/puppet/Puppet.sol"; -import {createPuppet} from "@latticexyz/world-modules/src/modules/puppet/createPuppet.sol"; - -import {MODULE_NAMESPACE, MODULE_NAMESPACE_ID, ERC1155_REGISTRY_TABLE_ID} from "./constants.sol"; -import { - _erc1155SystemId, - _totalSupplyTableId, - _erc1155URIStorageSystemId, - _metadataTableId, - _erc1155URIStorageTableId, - _operatorApprovalTableId, - _ownersTableId -} from "./utils.sol"; -import {ERC1155System} from "./ERC1155System.sol"; - -import {Owners} from "./tables/Owners.sol"; -import {OperatorApproval} from "./tables/OperatorApproval.sol"; -import {ERC1155Registry} from "./tables/ERC1155Registry.sol"; -import {ERC1155MetadataURI} from "./tables/ERC1155MetadataURI.sol"; -import {ERC1155URIStorage} from "./tables/ERC1155URIStorage.sol"; -import {TotalSupply} from "./tables/TotalSupply.sol"; -import "forge-std/console2.sol"; - -contract ERC1155Module is Module { - error ERC1155Module_InvalidNamespace(bytes14 namespace); - - address public immutable registrationLibrary = address(new ERC1155ModuleRegistrationLibrary()); - - function install(bytes memory encodedArgs) public { - // Require the module to not be installed with these args yet - requireNotInstalled(__self, encodedArgs); - - // Decode args - (bytes14 namespace, string memory metaDataURI) = abi.decode(encodedArgs, (bytes14, string)); - - // Require the namespace to not be the module's namespace - if (namespace == MODULE_NAMESPACE) { - revert ERC1155Module_InvalidNamespace(namespace); - } - - // Register the ERC1155 tables and system - IBaseWorld world = IBaseWorld(_world()); - (bool success, bytes memory returnData) = registrationLibrary.delegatecall( - abi.encodeCall(ERC1155ModuleRegistrationLibrary.register, (world, namespace)) - ); - if (!success) revertWithBytes(returnData); - - ERC1155MetadataURI.set(_metadataTableId(namespace), metaDataURI); - - // Deploy and register the ERC1155 puppet. - ResourceId erc1155SystemId = _erc1155SystemId(namespace); - address puppet = createPuppet(world, erc1155SystemId); - - // Transfer ownership of the namespace to the caller - ResourceId namespaceId = WorldResourceIdLib.encodeNamespace(namespace); - world.transferOwnership(namespaceId, _msgSender()); - - // Register the ERC1155 in the ERC1155Registry - if (!ResourceIds.getExists(ERC1155_REGISTRY_TABLE_ID)) { - world.registerNamespace(MODULE_NAMESPACE_ID); - ERC1155Registry.register(ERC1155_REGISTRY_TABLE_ID); - } - - ERC1155Registry.setTokenAddress(ERC1155_REGISTRY_TABLE_ID, namespaceId, puppet); - } - - function installRoot(bytes memory) public pure { - revert Module_RootInstallNotSupported(); - } -} - -contract ERC1155ModuleRegistrationLibrary { - /** - * Register systems and tables for a new ERC1155 token in a given namespace - */ - function register(IBaseWorld world, bytes14 namespace) public { - // Register the namespace if it doesn't exist yet - ResourceId tokenNamespace = WorldResourceIdLib.encodeNamespace(namespace); - world.registerNamespace(tokenNamespace); - - // Register the tables - OperatorApproval.register(_operatorApprovalTableId(namespace)); - Owners.register(_ownersTableId(namespace)); - ERC1155MetadataURI.register(_metadataTableId(namespace)); - ERC1155URIStorage.register(_erc1155URIStorageTableId(namespace)); - TotalSupply.register(_totalSupplyTableId(namespace)); - - // Register a new ERC1155System - world.registerSystem(_erc1155SystemId(namespace), new ERC1155System(), true); - } -} diff --git a/packages/contracts/lib/ERC1155-puppet/ERC1155System.sol b/packages/contracts/lib/ERC1155-puppet/ERC1155System.sol deleted file mode 100644 index 3b3e72111..000000000 --- a/packages/contracts/lib/ERC1155-puppet/ERC1155System.sol +++ /dev/null @@ -1,555 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.20; - -import {ResourceId} from "@latticexyz/store/src/ResourceId.sol"; -import {System} from "@latticexyz/world/src/System.sol"; -import {WorldResourceIdInstance} from "@latticexyz/world/src/WorldResourceId.sol"; -import {SystemRegistry} from "@latticexyz/world/src/codegen/tables/SystemRegistry.sol"; - -import {AccessControlLib} from "@latticexyz/world-modules/src/utils/AccessControlLib.sol"; -import {PuppetMaster} from "@latticexyz/world-modules/src/modules/puppet/PuppetMaster.sol"; -import {toTopic} from "@latticexyz/world-modules/src/modules/puppet/utils.sol"; - -import {IERC1155Receiver} from "./IERC1155Receiver.sol"; -import {IERC1155} from "./IERC1155.sol"; -import {IERC1155MetadataURI} from "./IERC1155MetadataURI.sol"; - -import {ERC1155MetadataURI} from "./tables/ERC1155MetadataURI.sol"; -import {ERC1155URIStorage} from "./tables/ERC1155URIStorage.sol"; -import {OperatorApproval} from "./tables/OperatorApproval.sol"; -import {Owners} from "./tables/Owners.sol"; -import {TotalSupply} from "./tables/TotalSupply.sol"; -import {ERC1155Utils} from "./libraries/utils/ERC1155Utils.sol"; - -import { - _metadataTableId, - _erc1155URIStorageTableId, - _totalSupplyTableId, - _operatorApprovalTableId, - _ownersTableId -} from "./utils.sol"; - -import {LibString} from "./libraries/LibString.sol"; -import "forge-std/console2.sol"; - -contract ERC1155System is IERC1155MetadataURI, System, PuppetMaster { - using WorldResourceIdInstance for ResourceId; - using LibString for uint256; - - /** - * @dev See {IERC1155-setApprovalForAll}. - */ - function setApprovalForAll(address operator, bool approved) public virtual { - _setApprovalForAll(_msgSender(), operator, approved); - } - - /** - * @dev See {IERC1155-isApprovedForAll}. - */ - function isApprovedForAll(address owner, address operator) public view virtual returns (bool) { - return OperatorApproval.getApproved(_operatorApprovalTableId(_namespace()), owner, operator); - } - - /** - * @dev See {IERC1155-transferFrom}. - */ - function transferFrom(address from, address to, uint256 tokenId, uint256 value) public virtual { - if (to == address(0)) revert ERC1155InvalidReceiver(to); - // (from != 0). Therefore, it is not needed to verify that the return value is not 0 here. - _transfer(from, to, tokenId, value); - } - - /** - * @dev See {IERC1155-safeTransferFrom}. - */ - function safeTransferFrom(address from, address to, uint256 tokenId, uint256 value, bytes memory data) - public - virtual - { - _safeTransferFrom(from, to, tokenId, value, data); - } - - function safeBatchTransferFrom( - address from, - address to, - uint256[] calldata ids, - uint256[] calldata values, - bytes calldata data - ) external virtual { - if (to == address(0)) revert ERC1155InvalidReceiver(to); - for (uint256 i; i < ids.length; i++) { - _safeTransferFrom(from, to, ids[i], values[i], data); - } - } - - /** - * @dev Mints `tokenId` and transfers it to `to`. - * - * Requirements: - * - * - caller must own the namespace - * - `tokenId` must not exist. - * - `to` cannot be the zero address. - * - * Emits a {Transfer} event. - */ - function mint(address to, uint256 tokenId, uint256 value, bytes memory data) public virtual { - _requireOwner(); - if (to == address(0)) revert ERC1155InvalidReceiver(to); - (uint256[] memory ids, uint256[] memory values) = _asSingletonArrays(tokenId, value); - _update(address(0), to, ids, values); - } - - /** - * @dev Mints `tokenId` and transfers it to `to`. - * - * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible - * - * Requirements: - * - * - `tokenId` must not exist. - * - `to` cannot be the zero address. - * - * Emits a {Transfer} event. - */ - // function _mint(address to, uint256 tokenId, uint256 value, bytes memory data) internal { - // _requireOwner(); - // if(to == address(0))revert ERC1155InvalidReceiver(to); - // (uint256[] memory ids, uint256[] memory values) = _asSingletonArrays(tokenId, value); - // _update(address(0), to, ids, values); - // } - - /** - * @dev Mints `tokenId`, transfers it to `to` and checks for `to` acceptance. - * - * Requirements: - * - * - caller must own the namespace - * - `tokenId` must not exist. - * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received}, which is called upon a safe transfer. - * - * Emits a {Transfer} event. - */ - function safeMint(address to, uint256 tokenId, uint256 value, bytes memory data) public virtual { - mint(to, tokenId, value, data); - _checkOnERC1155Received(address(0), to, tokenId, value, data); - } - - /** - * @dev Destroys `tokenId`. - * The approval is cleared when the token is burned. - * - * Requirements: - * - caller must own the namespace - * - `tokenId` must exist. - * - * Emits a {Transfer} event. - */ - function burn(uint256 tokenId, uint256 value) public { - _burn(_msgSender(), tokenId, value); - } - - /** - * @dev See {IERC1155-balanceOf}. - */ - function balanceOf(address owner, uint256 id) public view virtual returns (uint256) { - return Owners.getBalance(_ownersTableId(_namespace()), owner, id); - } - - /** - * @dev See {IERC1155-balanceOfBatch}. - * - * Requirements: - * - * - `accounts` and `ids` must have the same length. - */ - function balanceOfBatch(address[] memory accounts, uint256[] memory ids) - public - view - virtual - returns (uint256[] memory) - { - if (accounts.length != ids.length) { - revert ERC1155InvalidArrayLength(ids.length, accounts.length); - } - - uint256[] memory batchBalances = new uint256[](accounts.length); - - for (uint256 i = 0; i < accounts.length; ++i) { - batchBalances[i] = balanceOf(accounts[i], ids[i]); - } - - return batchBalances; - } - - /** - * @dev See {IERC1155MetadataURI-uri}. - * - * This implementation returns the same URI for *all* token types. It relies - * on the token type ID substitution mechanism - * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the ERC]. - * - * Clients calling this function must replace the `\{id\}` substring with the - * actual token type ID. - */ - function uri(uint256 tokenId) public view returns (string memory) { - string memory baseURI = ERC1155MetadataURI.getUri(_metadataTableId(_namespace())); - string memory tokenURI = ERC1155URIStorage.getUri(_erc1155URIStorageTableId(_namespace()), tokenId); - - // If token URI is set, concatenate base URI and tokenURI (via string.concat). - return bytes(tokenURI).length > 0 ? string.concat(baseURI, tokenURI) : baseURI; - } - - function _setTokenUri(bytes14 namespace, uint256 tokenId, string memory uri) internal { - _requireOwner(); - ERC1155URIStorage.setUri(_erc1155URIStorageTableId(namespace), tokenId, uri); - } - - /** - * @dev Returns whether `spender` is allowed to manage `owner`'s tokens, or `tokenId` in - * particular (ignoring whether it is owned by `owner`). - * - * WARNING: This function assumes that `owner` is the actual owner of `tokenId` and does not verify this - * assumption. - */ - function _isAuthorized(address owner, address spender) internal view virtual returns (bool) { - return spender != address(0) && (owner == spender || isApprovedForAll(owner, spender)); - } - - /** - * @dev Unsafe write access to the balances, used by extensions that 'mint' tokens using an {ownerOf} override. - * - * NOTE: the value is limited to type(uint128).max. This protect against _balance overflow. It is unrealistic that - * a uint256 would ever overflow from increments when these increments are bounded to uint128 values. - * - * WARNING: Increasing an account's balance using this function tends to be paired with an override of the - * {_ownerOf} function to resolve the ownership of the corresponding tokens so that balances and ownership - * remain consistent with one another. - */ - function _setAccountBalance(address account, uint256 tokenId, int256 delta) internal returns (uint256 balance) { - if (delta < 0) { - balance = uint256(balanceOf(account, tokenId) - uint256(-delta)); - } else { - balance = uint256(balanceOf(account, tokenId) + uint256(delta)); - } - Owners.setBalance(_ownersTableId(_namespace()), account, tokenId, balance); - } - - function _setTotalSupply(uint256 tokenId, int256 delta) internal returns (uint256 supply) { - uint256 totalSupply = TotalSupply.getTotalSupply(_totalSupplyTableId(_namespace()), tokenId); - if (delta < 0) { - supply = totalSupply - uint256(-delta); - } else { - supply = totalSupply + uint256(delta); - } - TotalSupply.setTotalSupply(_totalSupplyTableId(_namespace()), tokenId, supply); - } - - /** - * @dev Transfers `tokenId` from its current owner to `to`, or alternatively mints (or burns) if the current owner - * (or `to`) is the zero address. Returns the owner of the `tokenId` before the update. - * - * The `auth` argument is optional. If the value passed is non 0, then this function will check that - * `auth` is either the owner of the token, or approved to operate on the token (by the owner). - * - * Emits a {Transfer} event. - * - * NOTE: If overriding this function in a way that tracks balances, see also {_increaseBalance}. - */ - function _update(address from, address to, uint256[] memory tokenIds, uint256[] memory _values) - internal - virtual - returns (address) - { - uint256 len = tokenIds.length; - if (len != _values.length) revert ERC1155InvalidArrayLength(len, _values.length); - if (_msgSender() != from && from != address(0)) { - if (!_isAuthorized(from, _msgSender())) revert ERC1155MissingApprovalForAll(_msgSender(), from); - } - - // check if both to and from are address(0) - if (from == address(0) && to == address(0)) revert ERC1155NonexistentToken(10); - uint256 fromBalance; - uint256 tokenId; - uint256 _value; - for (uint256 i; i < len; i++) { - tokenId = tokenIds[i]; - _value = _values[i]; - - if (from == address(0)) { - _requireOwner(); - // Overflow check required: The rest of the code assumes that totalSupply never overflows - _setTotalSupply(tokenId, int256(_value)); - } else { - if (TotalSupply.getTotalSupply(_totalSupplyTableId(_namespace()), tokenId) == 0) { - revert ERC1155NonexistentToken(tokenId); - } - fromBalance = balanceOf(from, tokenId); - if (fromBalance < _value) { - revert ERC1155InsufficientBalance(from, fromBalance, _value, tokenId); - } - } - - // Perform (optional) operator check - if (to != address(0)) { - unchecked { - _setAccountBalance(to, tokenId, int256(_value)); - } - } - - // Execute the update - if (from != address(0)) { - unchecked { - _setAccountBalance(from, tokenId, -int256(_value)); - } - } - } - - if (len == 1) { - // Emit Transfer event on puppet - puppet().log( - TransferSingle.selector, - toTopic(_msgSender()), - toTopic(from), - toTopic(to), - abi.encode(tokenIds[0], _values[0]) - ); - } else { - puppet().log( - TransferBatch.selector, toTopic(_msgSender()), toTopic(from), toTopic(to), abi.encode(tokenIds, _values) - ); - } - return from; - } - - /** - * @dev Destroys `tokenId`. - * The approval is cleared when the token is burned. - * This is an internal function that does not check if the sender is authorized to operate on the token. - * - * Requirements: - * - * - `tokenId` must exist. - * - * Emits a {Transfer} event. - */ - function _burn(address account, uint256 tokenId, uint256 value) internal { - (uint256[] memory ids, uint256[] memory values) = _asSingletonArrays(tokenId, value); - - _update(account, address(0), ids, values); - _setTotalSupply(tokenId, -int256(value)); - } - - /** - * @dev Transfers `tokenId` from `from` to `to`. - * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. - * - * Requirements: - * - * - `to` cannot be the zero address. - * - `tokenId` token must be owned by `from`. - * - * Emits a {Transfer} event. - */ - function _transfer(address from, address to, uint256 tokenId, uint256 value) internal { - if (to == address(0)) { - revert ERC1155InvalidReceiver(address(0)); - } - (uint256[] memory ids, uint256[] memory values) = _asSingletonArrays(tokenId, value); - _update(from, to, ids, values); - } - - /** - * @dev Safely transfers `tokenId` token from `from` to `to`, checking that contract recipients - * are aware of the ERC1155 standard to prevent tokens from being forever locked. - * - * `data` is additional data, it has no specified format and it is sent in call to `to`. - * - * This internal function is like {safeTransferFrom} in the sense that it invokes - * {IERC1155Receiver-onERC1155Received} on the receiver, and can be used to e.g. - * implement alternative mechanisms to perform token transfer, such as signature-based. - * - * Requirements: - * - * - `tokenId` token must exist and be owned by `from`. - * - `to` cannot be the zero address. - * - `from` cannot be the zero address. - * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received}, which is called upon a safe transfer. - * - * Emits a {Transfer} event. - */ - function _safeTransfer(address from, address to, uint256 tokenId, uint256 value) internal { - _safeTransfer(from, to, tokenId, value, ""); - } - - /** - * @dev Transfers a `value` tokens of token type `id` from `from` to `to`. - * - * Emits a {TransferSingle} event. - * - * Requirements: - * - * - `to` cannot be the zero address. - * - `from` must have a balance of tokens of type `id` of at least `value` amount. - * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the - * acceptance magic value. - */ - function _safeTransferFrom(address from, address to, uint256 id, uint256 value, bytes memory data) internal { - if (to == address(0)) { - revert ERC1155InvalidReceiver(address(0)); - } - if (from == address(0)) { - revert ERC1155InvalidSender(address(0)); - } - (uint256[] memory ids, uint256[] memory values) = _asSingletonArrays(id, value); - _updateWithAcceptanceCheck(from, to, ids, values, data); - } - - /** - * @dev Version of {_update} that performs the token acceptance check by calling - * {IERC1155Receiver-onERC1155Received} or {IERC1155Receiver-onERC1155BatchReceived} on the receiver address if it - * contains code (eg. is a smart contract at the moment of execution). - * - * IMPORTANT: Overriding this function is discouraged because it poses a reentrancy risk from the receiver. So any - * update to the contract state after this function would break the check-effect-interaction pattern. Consider - * overriding {_update} instead. - */ - function _updateWithAcceptanceCheck( - address from, - address to, - uint256[] memory ids, - uint256[] memory values, - bytes memory data - ) internal virtual { - // todo create _update that takes an array of ids and values - _update(from, to, ids, values); - if (to != address(0)) { - address operator = _msgSender(); - if (ids.length == 1) { - uint256 id = ids[0]; - uint256 value = values[0]; - ERC1155Utils.checkOnERC1155Received(operator, from, to, id, value, data); - } else { - ERC1155Utils.checkOnERC1155BatchReceived(operator, from, to, ids, values, data); - } - } - } - - /** - * @dev Creates an array in memory with only one value for each of the elements provided. - */ - function _asSingletonArrays(uint256 element1, uint256 element2) - private - pure - returns (uint256[] memory array1, uint256[] memory array2) - { - /// @solidity memory-safe-assembly - assembly { - // Load the free memory pointer - array1 := mload(0x40) - // Set array length to 1 - mstore(array1, 1) - // Store the single element at the next word after the length (where content starts) - mstore(add(array1, 0x20), element1) - - // Repeat for next array locating it right after the first array - array2 := add(array1, 0x40) - mstore(array2, 1) - mstore(add(array2, 0x20), element2) - - // Update the free memory pointer by pointing after the second array - mstore(0x40, add(array2, 0x40)) - } - } - - /** - * @dev Same as {xref-ERC1155-_safeTransfer-address-address-uint256-}[`_safeTransfer`], with an additional `data` parameter which is - * forwarded in {IERC1155Receiver-onERC1155Received} to contract recipients. - */ - function _safeTransfer(address from, address to, uint256 tokenId, uint256 value, bytes memory data) - internal - virtual - { - (uint256[] memory ids, uint256[] memory values) = _asSingletonArrays(tokenId, value); - _updateWithAcceptanceCheck(_msgSender(), to, ids, values, data); - } - - /** - * @dev Approve `operator` to operate on all of `owner` tokens - * - * Requirements: - * - operator can't be the address zero. - * - * Emits an {ApprovalForAll} event. - */ - function _setApprovalForAll(address owner, address operator, bool approved) internal virtual { - if (operator == address(0)) { - revert ERC1155InvalidOperator(operator); - } - OperatorApproval.set(_operatorApprovalTableId(_namespace()), owner, operator, approved); - - // Emit ApprovalForAll event on puppet - puppet().log(ApprovalForAll.selector, toTopic(owner), toTopic(operator), abi.encode(approved)); - } - - /** - * @dev Private function to invoke {IERC1155Receiver-onERC1155Received} on a target address. This will revert if the - * recipient doesn't accept the token transfer. The call is not executed if the target address is not a contract. - * - * @param from address representing the previous owner of the given token ID - * @param to target address that will receive the tokens - * @param tokenId uint256 ID of the token to be transferred - * @param value the amount of a token being sent - * @param data bytes optional data to send along with the call - */ - function _checkOnERC1155Received(address from, address to, uint256 tokenId, uint256 value, bytes memory data) - private - { - if (to.code.length > 0) { - try IERC1155Receiver(to).onERC1155Received(_msgSender(), from, tokenId, value, data) returns (bytes4 retval) - { - if (retval != IERC1155Receiver.onERC1155Received.selector) { - revert ERC1155InvalidReceiver(to); - } - } catch (bytes memory reason) { - if (reason.length == 0) { - revert ERC1155InvalidReceiver(to); - } else { - /// @solidity memory-safe-assembly - assembly { - revert(add(32, reason), mload(reason)) - } - } - } - } - } - - function onERC1155Received( - address, /* to **/ - address, /* from **/ - uint256, /* tokenId **/ - uint256, /* value **/ - bytes calldata /* data **/ - ) external returns (bytes4 retval) { - return IERC1155Receiver.onERC1155Received.selector; - } - - function onERC1155BatchReceived( - address, /* to **/ - address, /* from **/ - uint256[] calldata, /* tokenIds **/ - uint256[] calldata, /* values **/ - bytes calldata /* data **/ - ) external returns (bytes4 retval) { - return IERC1155Receiver.onERC1155Received.selector; - } - - function _namespace() internal view returns (bytes14 namespace) { - ResourceId systemId = SystemRegistry.get(address(this)); - return systemId.getNamespace(); - } - - function _requireOwner() internal view { - AccessControlLib.requireOwner(SystemRegistry.get(address(this)), _msgSender()); - } -} diff --git a/packages/contracts/lib/ERC1155-puppet/IERC1155.sol b/packages/contracts/lib/ERC1155-puppet/IERC1155.sol deleted file mode 100644 index 46035a37a..000000000 --- a/packages/contracts/lib/ERC1155-puppet/IERC1155.sol +++ /dev/null @@ -1,90 +0,0 @@ -// SPDX-License-Identifier: MIT -// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC1155/IERC1155.sol) -pragma solidity ^0.8.20; - -import {IERC1155Events} from "./IERC1155Events.sol"; -import {IERC1155Errors} from "./IERC1155Errors.sol"; - -/** - * @dev Required interface of an ERC1155 compliant contract. - */ -interface IERC1155 is IERC1155Events, IERC1155Errors { - /** - * @dev Returns the value of tokens of token type `id` owned by `account`. - */ - function balanceOf(address account, uint256 id) external view returns (uint256); - - /** - * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}. - * - * Requirements: - * - * - `accounts` and `ids` must have the same length. - */ - function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids) - external - view - returns (uint256[] memory); - - /** - * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`, - * - * Emits an {ApprovalForAll} event. - * - * Requirements: - * - * - `operator` cannot be the zero address. - */ - function setApprovalForAll(address operator, bool approved) external; - - /** - * @dev Returns true if `operator` is approved to transfer ``account``'s tokens. - * - * See {setApprovalForAll}. - */ - function isApprovedForAll(address account, address operator) external view returns (bool); - - /** - * @dev Transfers a `value` amount of tokens of type `id` from `from` to `to`. - * - * WARNING: This function can potentially allow a reentrancy attack when transferring tokens - * to an untrusted contract, when invoking {onERC1155Received} on the receiver. - * Ensure to follow the checks-effects-interactions pattern and consider employing - * reentrancy guards when interacting with untrusted contracts. - * - * Emits a {TransferSingle} event. - * - * Requirements: - * - * - `to` cannot be the zero address. - * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}. - * - `from` must have a balance of tokens of type `id` of at least `value` amount. - * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the - * acceptance magic value. - */ - function safeTransferFrom(address from, address to, uint256 id, uint256 value, bytes calldata data) external; - - /** - * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}. - * - * WARNING: This function can potentially allow a reentrancy attack when transferring tokens - * to an untrusted contract, when invoking {onERC1155BatchReceived} on the receiver. - * Ensure to follow the checks-effects-interactions pattern and consider employing - * reentrancy guards when interacting with untrusted contracts. - * - * Emits either a {TransferSingle} or a {TransferBatch} event, depending on the length of the array arguments. - * - * Requirements: - * - * - `ids` and `values` must have the same length. - * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the - * acceptance magic value. - */ - function safeBatchTransferFrom( - address from, - address to, - uint256[] calldata ids, - uint256[] calldata values, - bytes calldata data - ) external; -} diff --git a/packages/contracts/lib/ERC1155-puppet/IERC1155Errors.sol b/packages/contracts/lib/ERC1155-puppet/IERC1155Errors.sol deleted file mode 100644 index 58c2c41c5..000000000 --- a/packages/contracts/lib/ERC1155-puppet/IERC1155Errors.sol +++ /dev/null @@ -1,63 +0,0 @@ -// SPDX-License-Identifier: MIT -// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC6093.sol) -pragma solidity ^0.8.20; - -/** - * @dev Standard ERC1155 Errors - * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC1155 tokens. - */ -interface IERC1155Errors { - /** - * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers. - * @param sender Address whose tokens are being transferred. - * @param balance Current balance for the interacting account. - * @param needed Minimum amount required to perform a transfer. - * @param tokenId Identifier number of a token. - */ - error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId); - - /** - * @dev Indicates a failure with the token `sender`. Used in transfers. - * @param sender Address whose tokens are being transferred. - */ - error ERC1155InvalidSender(address sender); - - /** - * @dev Indicates a failure with the token `receiver`. Used in transfers. - * @param receiver Address to which tokens are being transferred. - */ - error ERC1155InvalidReceiver(address receiver); - - /** - * @dev Indicates a failure with the `operator`’s approval. Used in transfers. - * @param operator Address that may be allowed to operate on tokens without being their owner. - * @param owner Address of the current owner of a token. - */ - error ERC1155MissingApprovalForAll(address operator, address owner); - - /** - * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals. - * @param approver Address initiating an approval operation. - */ - error ERC1155InvalidApprover(address approver); - - /** - * @dev Indicates a failure with the `operator` to be approved. Used in approvals. - * @param operator Address that may be allowed to operate on tokens without being their owner. - */ - error ERC1155InvalidOperator(address operator); - - /** - * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation. - * Used in batch transfers. - * @param idsLength Length of the array of token identifiers - * @param valuesLength Length of the array of token amounts - */ - error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength); - - /** - * @dev Indicates the attempt to interact with a token ID that has not been created - * @param tokenId the token Id that doesn't exist - */ - error ERC1155NonexistentToken(uint256 tokenId); -} diff --git a/packages/contracts/lib/ERC1155-puppet/IERC1155Events.sol b/packages/contracts/lib/ERC1155-puppet/IERC1155Events.sol deleted file mode 100644 index e9890040f..000000000 --- a/packages/contracts/lib/ERC1155-puppet/IERC1155Events.sol +++ /dev/null @@ -1,36 +0,0 @@ -// SPDX-License-Identifier: MIT -// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC1155/IERC1155.sol) -pragma solidity ^0.8.20; - -/** - * @dev Events emitted by an ERC1155 compliant contract. - */ -interface IERC1155Events { - /** - * @dev Emitted when `value` amount of tokens of type `id` are transferred from `from` to `to` by `operator`. - */ - event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value); - - /** - * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all - * transfers. - */ - event TransferBatch( - address indexed operator, address indexed from, address indexed to, uint256[] ids, uint256[] values - ); - - /** - * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to - * `approved`. - */ - event ApprovalForAll(address indexed account, address indexed operator, bool approved); - - /** - * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI. - * - * If an {URI} event was emitted for `id`, the standard - * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value - * returned by {IERC1155MetadataURI-uri}. - */ - event URI(string value, uint256 indexed id); -} diff --git a/packages/contracts/lib/ERC1155-puppet/IERC1155MetadataURI.sol b/packages/contracts/lib/ERC1155-puppet/IERC1155MetadataURI.sol deleted file mode 100644 index ae2e26e02..000000000 --- a/packages/contracts/lib/ERC1155-puppet/IERC1155MetadataURI.sol +++ /dev/null @@ -1,19 +0,0 @@ -// SPDX-License-Identifier: MIT -// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC1155/extensions/IERC1155Metadata.sol) -pragma solidity ^0.8.20; - -import {IERC1155} from "./IERC1155.sol"; - -/** - * @dev Interface of the optional ERC1155MetadataExtension interface, as defined - * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[ERC]. - */ -interface IERC1155MetadataURI is IERC1155 { - /** - * @dev Returns the URI for token type `id`. - * - * If the `\{id\}` substring is present in the URI, it must be replaced by - * clients with the actual token type ID. - */ - function uri(uint256 id) external view returns (string memory); -} diff --git a/packages/contracts/lib/ERC1155-puppet/IERC1155Receiver.sol b/packages/contracts/lib/ERC1155-puppet/IERC1155Receiver.sol deleted file mode 100644 index 31fe95510..000000000 --- a/packages/contracts/lib/ERC1155-puppet/IERC1155Receiver.sol +++ /dev/null @@ -1,54 +0,0 @@ -// SPDX-License-Identifier: MIT -// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC1155/IERC1155Receiver.sol) -pragma solidity ^0.8.20; - -/** - * @title ERC1155 token receiver interface - * @author MUD (https://mud.dev) by Lattice (https://lattice.xyz) - * @dev Interface for any contract that wants to support safeTransfers - * from ERC1155 asset contracts. - */ -interface IERC1155Receiver { - /** - * @dev Handles the receipt of a single ERC-1155 token type. This function is - * called at the end of a `safeTransferFrom` after the balance has been updated. - * - * NOTE: To accept the transfer, this must return - * `bytes4(keccak256('onERC1155Received(address,address,uint256,uint256,bytes)'))` - * (i.e. 0xf23a6e61, or its own function selector). - * - * @param operator The address which initiated the transfer (i.e. msg.sender) - * @param from The address which previously owned the token - * @param id The ID of the token being transferred - * @param value The amount of tokens being transferred - * @param data Additional data with no specified format - * @return `bytes4(keccak256('onERC1155Received(address,address,uint256,uint256,bytes)'))` if transfer is allowed - */ - function onERC1155Received(address operator, address from, uint256 id, uint256 value, bytes calldata data) - external - returns (bytes4); - - /** - * @dev Handles the receipt of a multiple ERC-1155 token types. This function - * is called at the end of a `safeBatchTransferFrom` after the balances have - * been updated. - * - * NOTE: To accept the transfer(s), this must return - * `bytes4(keccak256('onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)'))` - * (i.e. 0xbc197c81, or its own function selector). - * - * @param operator The address which initiated the batch transfer (i.e. msg.sender) - * @param from The address which previously owned the token - * @param ids An array containing ids of each token being transferred (order and length must match values array) - * @param values An array containing amounts of each token being transferred (order and length must match ids array) - * @param data Additional data with no specified format - * @return `bytes4(keccak256('onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)'))` if transfer is allowed - */ - function onERC1155BatchReceived( - address operator, - address from, - uint256[] calldata ids, - uint256[] calldata values, - bytes calldata data - ) external returns (bytes4); -} diff --git a/packages/contracts/lib/ERC1155-puppet/IERC1155System.sol b/packages/contracts/lib/ERC1155-puppet/IERC1155System.sol deleted file mode 100644 index 58599fe1c..000000000 --- a/packages/contracts/lib/ERC1155-puppet/IERC1155System.sol +++ /dev/null @@ -1,55 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity >=0.8.24; - -/* Autogenerated file. Do not edit manually. */ - -/** - * @title IERC1155System - * @author MUD (https://mud.dev) by Lattice (https://lattice.xyz) - * @dev This interface is automatically generated from the corresponding system contract. Do not edit manually. - */ -interface IERC1155System { - function setApprovalForAll(address operator, bool approved) external; - - function isApprovedForAll(address owner, address operator) external view returns (bool); - - function transferFrom(address from, address to, uint256 tokenId, uint256 value) external; - - function safeTransferFrom(address from, address to, uint256 tokenId, uint256 value) external; - - function safeTransferFrom(address from, address to, uint256 tokenId, uint256 value, bytes memory data) external; - - function safeBatchTransferFrom( - address from, - address to, - uint256[] calldata ids, - uint256[] calldata values, - bytes calldata data - ) external; - - // function mint(address to, uint256 tokenId, uint256 value) external; - - function mint(address to, uint256 tokenId, uint256 value, bytes memory data) external; - - function safeMint(address to, uint256 tokenId, uint256 value) external; - - function safeMint(address to, uint256 tokenId, uint256 value, bytes memory data) external; - - function burn(uint256 tokenId, uint256 value) external; - - function balanceOf(address owner, uint256 id) external view returns (uint256); - - function balanceOfBatch(address[] memory accounts, uint256[] memory ids) external view returns (uint256[] memory); - - function uri(uint256 tokenId) external view returns (string memory); - - function setTokenURI(uint256 tokenId, string memory tokenURI) external; - - function totalSupply(uint256 tokenId) external view returns (uint256 _totalSupply); - - function onERC1155Received(address, address, uint256, uint256, bytes calldata) external returns (bytes4 retval); - - function onERC1155BatchReceived(address, address, uint256[] calldata, uint256[] calldata, bytes calldata) - external - returns (bytes4 retval); -} diff --git a/packages/contracts/lib/ERC1155-puppet/constants.sol b/packages/contracts/lib/ERC1155-puppet/constants.sol deleted file mode 100644 index c11e4e44f..000000000 --- a/packages/contracts/lib/ERC1155-puppet/constants.sol +++ /dev/null @@ -1,22 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.20; - -import {ResourceId} from "@latticexyz/store/src/ResourceId.sol"; -import {RESOURCE_TABLE} from "@latticexyz/store/src/storeResourceTypes.sol"; -import {RESOURCE_SYSTEM, RESOURCE_NAMESPACE} from "@latticexyz/world/src/worldResourceTypes.sol"; - -bytes14 constant MODULE_NAMESPACE = "erc1155puppet"; -ResourceId constant MODULE_NAMESPACE_ID = - ResourceId.wrap(bytes32(abi.encodePacked(RESOURCE_NAMESPACE, MODULE_NAMESPACE))); -bytes16 constant TOKEN_APPROVALSTORAGE_NAME = "ApprovalStorage"; -bytes16 constant TOKEN_URISTORAGE_NAME = "URIStorage"; -bytes16 constant METADATA_NAME = "MetadataURI"; -bytes16 constant OPERATOR_APPROVAL_NAME = "OperatorApproval"; -bytes16 constant OWNERS_NAME = "Owners"; -bytes16 constant TOTAL_SUPPLY_NAME = "TotalSupply"; - -bytes16 constant ERC1155_SYSTEM_NAME = "ERC1155System"; -bytes16 constant ERC1155URISTORAGE_SYSTEM_NAME = "URIStorageSystem"; - -ResourceId constant ERC1155_REGISTRY_TABLE_ID = - ResourceId.wrap(bytes32(abi.encodePacked(RESOURCE_TABLE, MODULE_NAMESPACE, bytes16("ERC1155Registry")))); diff --git a/packages/contracts/lib/ERC1155-puppet/libraries/LibString.sol b/packages/contracts/lib/ERC1155-puppet/libraries/LibString.sol deleted file mode 100644 index 706ab0502..000000000 --- a/packages/contracts/lib/ERC1155-puppet/libraries/LibString.sol +++ /dev/null @@ -1,77 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity >=0.8.0; - -/// @notice Efficient library for creating string representations of integers. -/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/LibString.sol) -/// @author Modified from Solady (https://github.com/Vectorized/solady/blob/main/src/utils/LibString.sol) -library LibString { - function toString(int256 value) internal pure returns (string memory str) { - if (value >= 0) return toString(uint256(value)); - - unchecked { - str = toString(uint256(-value)); - - /// @solidity memory-safe-assembly - assembly { - // Note: This is only safe because we over-allocate memory - // and write the string from right to left in toString(uint256), - // and thus can be sure that sub(str, 1) is an unused memory location. - - let length := mload(str) // Load the string length. - // Put the - character at the start of the string contents. - mstore(str, 45) // 45 is the ASCII code for the - character. - str := sub(str, 1) // Move back the string pointer by a byte. - mstore(str, add(length, 1)) // Update the string length. - } - } - } - - function toString(uint256 value) internal pure returns (string memory str) { - /// @solidity memory-safe-assembly - assembly { - // The maximum value of a uint256 contains 78 digits (1 byte per digit), but we allocate 160 bytes - // to keep the free memory pointer word aligned. We'll need 1 word for the length, 1 word for the - // trailing zeros padding, and 3 other words for a max of 78 digits. In total: 5 * 32 = 160 bytes. - let newFreeMemoryPointer := add(mload(0x40), 160) - - // Update the free memory pointer to avoid overriding our string. - mstore(0x40, newFreeMemoryPointer) - - // Assign str to the end of the zone of newly allocated memory. - str := sub(newFreeMemoryPointer, 32) - - // Clean the last word of memory it may not be overwritten. - mstore(str, 0) - - // Cache the end of the memory to calculate the length later. - let end := str - - // We write the string from rightmost digit to leftmost digit. - // The following is essentially a do-while loop that also handles the zero case. - // prettier-ignore - for { let temp := value } 1 {} { - // Move the pointer 1 byte to the left. - str := sub(str, 1) - - // Write the character to the pointer. - // The ASCII index of the '0' character is 48. - mstore8(str, add(48, mod(temp, 10))) - - // Keep dividing temp until zero. - temp := div(temp, 10) - - // prettier-ignore - if iszero(temp) { break } - } - - // Compute and cache the final total length of the string. - let length := sub(end, str) - - // Move the pointer 32 bytes leftwards to make room for the length. - str := sub(str, 32) - - // Store the string's length at the start of memory allocated for our string. - mstore(str, length) - } - } -} diff --git a/packages/contracts/lib/ERC1155-puppet/libraries/utils/ERC1155Utils.sol b/packages/contracts/lib/ERC1155-puppet/libraries/utils/ERC1155Utils.sol deleted file mode 100644 index 5f40dffbd..000000000 --- a/packages/contracts/lib/ERC1155-puppet/libraries/utils/ERC1155Utils.sol +++ /dev/null @@ -1,85 +0,0 @@ -// SPDX-License-Identifier: MIT - -pragma solidity ^0.8.20; - -import { IERC1155Receiver } from '../../IERC1155Receiver.sol'; -import { IERC1155Errors } from './draft-IERC6093.sol'; - -/** - * @dev Library that provide common ERC-1155 utility functions. - * - * See https://eips.ethereum.org/EIPS/eip-1155[ERC-1155]. - */ -library ERC1155Utils { - /** - * @dev Performs an acceptance check for the provided `operator` by calling {IERC1155-onERC1155Received} - * on the `to` address. The `operator` is generally the address that initiated the token transfer (i.e. `msg.sender`). - * - * The acceptance call is not executed and treated as a no-op if the target address is doesn't contain code (i.e. an EOA). - * Otherwise, the recipient must implement {IERC1155Receiver-onERC1155Received} and return the acceptance magic value to accept - * the transfer. - */ - function checkOnERC1155Received( - address operator, - address from, - address to, - uint256 id, - uint256 value, - bytes memory data - ) internal { - if (to.code.length > 0) { - try IERC1155Receiver(to).onERC1155Received(operator, from, id, value, data) returns (bytes4 response) { - if (response != IERC1155Receiver.onERC1155Received.selector) { - // Tokens rejected - revert IERC1155Errors.ERC1155InvalidReceiver(to); - } - } catch (bytes memory reason) { - if (reason.length == 0) { - // non-IERC1155Receiver implementer - revert IERC1155Errors.ERC1155InvalidReceiver(to); - } else { - /// @solidity memory-safe-assembly - assembly { - revert(add(32, reason), mload(reason)) - } - } - } - } - } - - /** - * @dev Performs a batch acceptance check for the provided `operator` by calling {IERC1155-onERC1155BatchReceived} - * on the `to` address. The `operator` is generally the address that initiated the token transfer (i.e. `msg.sender`). - * - * The acceptance call is not executed and treated as a no-op if the target address is doesn't contain code (i.e. an EOA). - * Otherwise, the recipient must implement {IERC1155Receiver-onERC1155Received} and return the acceptance magic value to accept - * the transfer. - */ - function checkOnERC1155BatchReceived( - address operator, - address from, - address to, - uint256[] memory ids, - uint256[] memory values, - bytes memory data - ) internal { - if (to.code.length > 0) { - try IERC1155Receiver(to).onERC1155BatchReceived(operator, from, ids, values, data) returns (bytes4 response) { - if (response != IERC1155Receiver.onERC1155BatchReceived.selector) { - // Tokens rejected - revert IERC1155Errors.ERC1155InvalidReceiver(to); - } - } catch (bytes memory reason) { - if (reason.length == 0) { - // non-IERC1155Receiver implementer - revert IERC1155Errors.ERC1155InvalidReceiver(to); - } else { - /// @solidity memory-safe-assembly - assembly { - revert(add(32, reason), mload(reason)) - } - } - } - } - } -} diff --git a/packages/contracts/lib/ERC1155-puppet/libraries/utils/draft-IERC6093.sol b/packages/contracts/lib/ERC1155-puppet/libraries/utils/draft-IERC6093.sol deleted file mode 100644 index e7ab69c1b..000000000 --- a/packages/contracts/lib/ERC1155-puppet/libraries/utils/draft-IERC6093.sol +++ /dev/null @@ -1,161 +0,0 @@ -// SPDX-License-Identifier: MIT -// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC6093.sol) -pragma solidity ^0.8.20; - -/** - * @dev Standard ERC-20 Errors - * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-20 tokens. - */ -interface IERC20Errors { - /** - * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers. - * @param sender Address whose tokens are being transferred. - * @param balance Current balance for the interacting account. - * @param needed Minimum amount required to perform a transfer. - */ - error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed); - - /** - * @dev Indicates a failure with the token `sender`. Used in transfers. - * @param sender Address whose tokens are being transferred. - */ - error ERC20InvalidSender(address sender); - - /** - * @dev Indicates a failure with the token `receiver`. Used in transfers. - * @param receiver Address to which tokens are being transferred. - */ - error ERC20InvalidReceiver(address receiver); - - /** - * @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers. - * @param spender Address that may be allowed to operate on tokens without being their owner. - * @param allowance Amount of tokens a `spender` is allowed to operate with. - * @param needed Minimum amount required to perform a transfer. - */ - error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed); - - /** - * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals. - * @param approver Address initiating an approval operation. - */ - error ERC20InvalidApprover(address approver); - - /** - * @dev Indicates a failure with the `spender` to be approved. Used in approvals. - * @param spender Address that may be allowed to operate on tokens without being their owner. - */ - error ERC20InvalidSpender(address spender); -} - -/** - * @dev Standard ERC-721 Errors - * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-721 tokens. - */ -interface IERC721Errors { - /** - * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in ERC-20. - * Used in balance queries. - * @param owner Address of the current owner of a token. - */ - error ERC721InvalidOwner(address owner); - - /** - * @dev Indicates a `tokenId` whose `owner` is the zero address. - * @param tokenId Identifier number of a token. - */ - error ERC721NonexistentToken(uint256 tokenId); - - /** - * @dev Indicates an error related to the ownership over a particular token. Used in transfers. - * @param sender Address whose tokens are being transferred. - * @param tokenId Identifier number of a token. - * @param owner Address of the current owner of a token. - */ - error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner); - - /** - * @dev Indicates a failure with the token `sender`. Used in transfers. - * @param sender Address whose tokens are being transferred. - */ - error ERC721InvalidSender(address sender); - - /** - * @dev Indicates a failure with the token `receiver`. Used in transfers. - * @param receiver Address to which tokens are being transferred. - */ - error ERC721InvalidReceiver(address receiver); - - /** - * @dev Indicates a failure with the `operator`’s approval. Used in transfers. - * @param operator Address that may be allowed to operate on tokens without being their owner. - * @param tokenId Identifier number of a token. - */ - error ERC721InsufficientApproval(address operator, uint256 tokenId); - - /** - * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals. - * @param approver Address initiating an approval operation. - */ - error ERC721InvalidApprover(address approver); - - /** - * @dev Indicates a failure with the `operator` to be approved. Used in approvals. - * @param operator Address that may be allowed to operate on tokens without being their owner. - */ - error ERC721InvalidOperator(address operator); -} - -/** - * @dev Standard ERC-1155 Errors - * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-1155 tokens. - */ -interface IERC1155Errors { - /** - * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers. - * @param sender Address whose tokens are being transferred. - * @param balance Current balance for the interacting account. - * @param needed Minimum amount required to perform a transfer. - * @param tokenId Identifier number of a token. - */ - error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId); - - /** - * @dev Indicates a failure with the token `sender`. Used in transfers. - * @param sender Address whose tokens are being transferred. - */ - error ERC1155InvalidSender(address sender); - - /** - * @dev Indicates a failure with the token `receiver`. Used in transfers. - * @param receiver Address to which tokens are being transferred. - */ - error ERC1155InvalidReceiver(address receiver); - - /** - * @dev Indicates a failure with the `operator`’s approval. Used in transfers. - * @param operator Address that may be allowed to operate on tokens without being their owner. - * @param owner Address of the current owner of a token. - */ - error ERC1155MissingApprovalForAll(address operator, address owner); - - /** - * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals. - * @param approver Address initiating an approval operation. - */ - error ERC1155InvalidApprover(address approver); - - /** - * @dev Indicates a failure with the `operator` to be approved. Used in approvals. - * @param operator Address that may be allowed to operate on tokens without being their owner. - */ - error ERC1155InvalidOperator(address operator); - - /** - * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation. - * Used in batch transfers. - * @param idsLength Length of the array of token identifiers - * @param valuesLength Length of the array of token amounts - */ - error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength); -} diff --git a/packages/contracts/lib/ERC1155-puppet/registerERC1155.sol b/packages/contracts/lib/ERC1155-puppet/registerERC1155.sol deleted file mode 100644 index 0dc886150..000000000 --- a/packages/contracts/lib/ERC1155-puppet/registerERC1155.sol +++ /dev/null @@ -1,37 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.20; - -import {IBaseWorld} from "@latticexyz/world/src/codegen/interfaces/IBaseWorld.sol"; -import {NamespaceOwner} from "@latticexyz/world/src/codegen/tables/NamespaceOwner.sol"; -import {WorldResourceIdLib} from "@latticexyz/world/src/WorldResourceId.sol"; - -import {SystemSwitch} from "@latticexyz/world-modules/src/utils/SystemSwitch.sol"; - -import {ERC1155Module} from "./ERC1155Module.sol"; -import {MODULE_NAMESPACE_ID, ERC1155_REGISTRY_TABLE_ID} from "./constants.sol"; -import {IERC1155} from "./IERC1155.sol"; - -import {ERC1155MetadataURI} from "./tables/ERC1155MetadataURI.sol"; -import {ERC1155Registry} from "./tables/ERC1155Registry.sol"; -import "forge-std/console2.sol"; - -/** - * @notice Register a new ERC1155 token with the given metaDataURI in a given namespace - * @dev This function must be called within a Store context (i.e. using StoreSwitch.setStoreAddress()) - */ -function registerERC1155(IBaseWorld world, bytes14 namespace, string memory metaDataURI) returns (IERC1155 token) { - // Get the ERC1155 module - address owner = NamespaceOwner.get(MODULE_NAMESPACE_ID); - ERC1155Module erc1155Module = ERC1155Module(owner); - if (address(erc1155Module) == address(0)) { - erc1155Module = new ERC1155Module(); - } - - // Install the ERC1155 module with the provided args - world.installModule(erc1155Module, abi.encode(namespace, metaDataURI)); - - // Return the newly created ERC1155 token - token = IERC1155( - ERC1155Registry.getTokenAddress(ERC1155_REGISTRY_TABLE_ID, WorldResourceIdLib.encodeNamespace(namespace)) - ); -} diff --git a/packages/contracts/lib/ERC1155-puppet/tables/ERC1155MetadataURI.sol b/packages/contracts/lib/ERC1155-puppet/tables/ERC1155MetadataURI.sol deleted file mode 100644 index d8d8c0783..000000000 --- a/packages/contracts/lib/ERC1155-puppet/tables/ERC1155MetadataURI.sol +++ /dev/null @@ -1,414 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity >=0.8.24; - -/* Autogenerated file. Do not edit manually. */ - -// Import store internals -import { IStore } from "@latticexyz/store/src/IStore.sol"; -import { StoreSwitch } from "@latticexyz/store/src/StoreSwitch.sol"; -import { StoreCore } from "@latticexyz/store/src/StoreCore.sol"; -import { Bytes } from "@latticexyz/store/src/Bytes.sol"; -import { Memory } from "@latticexyz/store/src/Memory.sol"; -import { SliceLib } from "@latticexyz/store/src/Slice.sol"; -import { EncodeArray } from "@latticexyz/store/src/tightcoder/EncodeArray.sol"; -import { FieldLayout } from "@latticexyz/store/src/FieldLayout.sol"; -import { Schema } from "@latticexyz/store/src/Schema.sol"; -import { EncodedLengths, EncodedLengthsLib } from "@latticexyz/store/src/EncodedLengths.sol"; -import { ResourceId } from "@latticexyz/store/src/ResourceId.sol"; - -library ERC1155MetadataURI { - FieldLayout constant _fieldLayout = - FieldLayout.wrap(0x0000000100000000000000000000000000000000000000000000000000000000); - - // Hex-encoded key schema of () - Schema constant _keySchema = Schema.wrap(0x0000000000000000000000000000000000000000000000000000000000000000); - // Hex-encoded value schema of (string) - Schema constant _valueSchema = Schema.wrap(0x00000001c5000000000000000000000000000000000000000000000000000000); - - /** - * @notice Get the table's key field names. - * @return keyNames An array of strings with the names of key fields. - */ - function getKeyNames() internal pure returns (string[] memory keyNames) { - keyNames = new string[](0); - } - - /** - * @notice Get the table's value field names. - * @return fieldNames An array of strings with the names of value fields. - */ - function getFieldNames() internal pure returns (string[] memory fieldNames) { - fieldNames = new string[](1); - fieldNames[0] = "uri"; - } - - /** - * @notice Register the table with its config. - */ - function register(ResourceId _tableId) internal { - StoreSwitch.registerTable(_tableId, _fieldLayout, _keySchema, _valueSchema, getKeyNames(), getFieldNames()); - } - - /** - * @notice Register the table with its config. - */ - function _register(ResourceId _tableId) internal { - StoreCore.registerTable(_tableId, _fieldLayout, _keySchema, _valueSchema, getKeyNames(), getFieldNames()); - } - - /** - * @notice Get uri. - */ - function getUri(ResourceId _tableId) internal view returns (string memory uri) { - bytes32[] memory _keyTuple = new bytes32[](0); - - bytes memory _blob = StoreSwitch.getDynamicField(_tableId, _keyTuple, 0); - return (string(_blob)); - } - - /** - * @notice Get uri. - */ - function _getUri(ResourceId _tableId) internal view returns (string memory uri) { - bytes32[] memory _keyTuple = new bytes32[](0); - - bytes memory _blob = StoreCore.getDynamicField(_tableId, _keyTuple, 0); - return (string(_blob)); - } - - /** - * @notice Get uri. - */ - function get(ResourceId _tableId) internal view returns (string memory uri) { - bytes32[] memory _keyTuple = new bytes32[](0); - - bytes memory _blob = StoreSwitch.getDynamicField(_tableId, _keyTuple, 0); - return (string(_blob)); - } - - /** - * @notice Get uri. - */ - function _get(ResourceId _tableId) internal view returns (string memory uri) { - bytes32[] memory _keyTuple = new bytes32[](0); - - bytes memory _blob = StoreCore.getDynamicField(_tableId, _keyTuple, 0); - return (string(_blob)); - } - - /** - * @notice Set uri. - */ - function setUri(ResourceId _tableId, string memory uri) internal { - bytes32[] memory _keyTuple = new bytes32[](0); - - StoreSwitch.setDynamicField(_tableId, _keyTuple, 0, bytes((uri))); - } - - /** - * @notice Set uri. - */ - function _setUri(ResourceId _tableId, string memory uri) internal { - bytes32[] memory _keyTuple = new bytes32[](0); - - StoreCore.setDynamicField(_tableId, _keyTuple, 0, bytes((uri))); - } - - /** - * @notice Set uri. - */ - function set(ResourceId _tableId, string memory uri) internal { - bytes32[] memory _keyTuple = new bytes32[](0); - - StoreSwitch.setDynamicField(_tableId, _keyTuple, 0, bytes((uri))); - } - - /** - * @notice Set uri. - */ - function _set(ResourceId _tableId, string memory uri) internal { - bytes32[] memory _keyTuple = new bytes32[](0); - - StoreCore.setDynamicField(_tableId, _keyTuple, 0, bytes((uri))); - } - - /** - * @notice Get the length of uri. - */ - function lengthUri(ResourceId _tableId) internal view returns (uint256) { - bytes32[] memory _keyTuple = new bytes32[](0); - - uint256 _byteLength = StoreSwitch.getDynamicFieldLength(_tableId, _keyTuple, 0); - unchecked { - return _byteLength / 1; - } - } - - /** - * @notice Get the length of uri. - */ - function _lengthUri(ResourceId _tableId) internal view returns (uint256) { - bytes32[] memory _keyTuple = new bytes32[](0); - - uint256 _byteLength = StoreCore.getDynamicFieldLength(_tableId, _keyTuple, 0); - unchecked { - return _byteLength / 1; - } - } - - /** - * @notice Get the length of uri. - */ - function length(ResourceId _tableId) internal view returns (uint256) { - bytes32[] memory _keyTuple = new bytes32[](0); - - uint256 _byteLength = StoreSwitch.getDynamicFieldLength(_tableId, _keyTuple, 0); - unchecked { - return _byteLength / 1; - } - } - - /** - * @notice Get the length of uri. - */ - function _length(ResourceId _tableId) internal view returns (uint256) { - bytes32[] memory _keyTuple = new bytes32[](0); - - uint256 _byteLength = StoreCore.getDynamicFieldLength(_tableId, _keyTuple, 0); - unchecked { - return _byteLength / 1; - } - } - - /** - * @notice Get an item of uri. - * @dev Reverts with Store_IndexOutOfBounds if `_index` is out of bounds for the array. - */ - function getItemUri(ResourceId _tableId, uint256 _index) internal view returns (string memory) { - bytes32[] memory _keyTuple = new bytes32[](0); - - unchecked { - bytes memory _blob = StoreSwitch.getDynamicFieldSlice(_tableId, _keyTuple, 0, _index * 1, (_index + 1) * 1); - return (string(_blob)); - } - } - - /** - * @notice Get an item of uri. - * @dev Reverts with Store_IndexOutOfBounds if `_index` is out of bounds for the array. - */ - function _getItemUri(ResourceId _tableId, uint256 _index) internal view returns (string memory) { - bytes32[] memory _keyTuple = new bytes32[](0); - - unchecked { - bytes memory _blob = StoreCore.getDynamicFieldSlice(_tableId, _keyTuple, 0, _index * 1, (_index + 1) * 1); - return (string(_blob)); - } - } - - /** - * @notice Get an item of uri. - * @dev Reverts with Store_IndexOutOfBounds if `_index` is out of bounds for the array. - */ - function getItem(ResourceId _tableId, uint256 _index) internal view returns (string memory) { - bytes32[] memory _keyTuple = new bytes32[](0); - - unchecked { - bytes memory _blob = StoreSwitch.getDynamicFieldSlice(_tableId, _keyTuple, 0, _index * 1, (_index + 1) * 1); - return (string(_blob)); - } - } - - /** - * @notice Get an item of uri. - * @dev Reverts with Store_IndexOutOfBounds if `_index` is out of bounds for the array. - */ - function _getItem(ResourceId _tableId, uint256 _index) internal view returns (string memory) { - bytes32[] memory _keyTuple = new bytes32[](0); - - unchecked { - bytes memory _blob = StoreCore.getDynamicFieldSlice(_tableId, _keyTuple, 0, _index * 1, (_index + 1) * 1); - return (string(_blob)); - } - } - - /** - * @notice Push a slice to uri. - */ - function pushUri(ResourceId _tableId, string memory _slice) internal { - bytes32[] memory _keyTuple = new bytes32[](0); - - StoreSwitch.pushToDynamicField(_tableId, _keyTuple, 0, bytes((_slice))); - } - - /** - * @notice Push a slice to uri. - */ - function _pushUri(ResourceId _tableId, string memory _slice) internal { - bytes32[] memory _keyTuple = new bytes32[](0); - - StoreCore.pushToDynamicField(_tableId, _keyTuple, 0, bytes((_slice))); - } - - /** - * @notice Push a slice to uri. - */ - function push(ResourceId _tableId, string memory _slice) internal { - bytes32[] memory _keyTuple = new bytes32[](0); - - StoreSwitch.pushToDynamicField(_tableId, _keyTuple, 0, bytes((_slice))); - } - - /** - * @notice Push a slice to uri. - */ - function _push(ResourceId _tableId, string memory _slice) internal { - bytes32[] memory _keyTuple = new bytes32[](0); - - StoreCore.pushToDynamicField(_tableId, _keyTuple, 0, bytes((_slice))); - } - - /** - * @notice Pop a slice from uri. - */ - function popUri(ResourceId _tableId) internal { - bytes32[] memory _keyTuple = new bytes32[](0); - - StoreSwitch.popFromDynamicField(_tableId, _keyTuple, 0, 1); - } - - /** - * @notice Pop a slice from uri. - */ - function _popUri(ResourceId _tableId) internal { - bytes32[] memory _keyTuple = new bytes32[](0); - - StoreCore.popFromDynamicField(_tableId, _keyTuple, 0, 1); - } - - /** - * @notice Pop a slice from uri. - */ - function pop(ResourceId _tableId) internal { - bytes32[] memory _keyTuple = new bytes32[](0); - - StoreSwitch.popFromDynamicField(_tableId, _keyTuple, 0, 1); - } - - /** - * @notice Pop a slice from uri. - */ - function _pop(ResourceId _tableId) internal { - bytes32[] memory _keyTuple = new bytes32[](0); - - StoreCore.popFromDynamicField(_tableId, _keyTuple, 0, 1); - } - - /** - * @notice Update a slice of uri at `_index`. - */ - function updateUri(ResourceId _tableId, uint256 _index, string memory _slice) internal { - bytes32[] memory _keyTuple = new bytes32[](0); - - unchecked { - bytes memory _encoded = bytes((_slice)); - StoreSwitch.spliceDynamicData(_tableId, _keyTuple, 0, uint40(_index * 1), uint40(_encoded.length), _encoded); - } - } - - /** - * @notice Update a slice of uri at `_index`. - */ - function _updateUri(ResourceId _tableId, uint256 _index, string memory _slice) internal { - bytes32[] memory _keyTuple = new bytes32[](0); - - unchecked { - bytes memory _encoded = bytes((_slice)); - StoreCore.spliceDynamicData(_tableId, _keyTuple, 0, uint40(_index * 1), uint40(_encoded.length), _encoded); - } - } - - /** - * @notice Update a slice of uri at `_index`. - */ - function update(ResourceId _tableId, uint256 _index, string memory _slice) internal { - bytes32[] memory _keyTuple = new bytes32[](0); - - unchecked { - bytes memory _encoded = bytes((_slice)); - StoreSwitch.spliceDynamicData(_tableId, _keyTuple, 0, uint40(_index * 1), uint40(_encoded.length), _encoded); - } - } - - /** - * @notice Update a slice of uri at `_index`. - */ - function _update(ResourceId _tableId, uint256 _index, string memory _slice) internal { - bytes32[] memory _keyTuple = new bytes32[](0); - - unchecked { - bytes memory _encoded = bytes((_slice)); - StoreCore.spliceDynamicData(_tableId, _keyTuple, 0, uint40(_index * 1), uint40(_encoded.length), _encoded); - } - } - - /** - * @notice Delete all data for given keys. - */ - function deleteRecord(ResourceId _tableId) internal { - bytes32[] memory _keyTuple = new bytes32[](0); - - StoreSwitch.deleteRecord(_tableId, _keyTuple); - } - - /** - * @notice Delete all data for given keys. - */ - function _deleteRecord(ResourceId _tableId) internal { - bytes32[] memory _keyTuple = new bytes32[](0); - - StoreCore.deleteRecord(_tableId, _keyTuple, _fieldLayout); - } - - /** - * @notice Tightly pack dynamic data lengths using this table's schema. - * @return _encodedLengths The lengths of the dynamic fields (packed into a single bytes32 value). - */ - function encodeLengths(string memory uri) internal pure returns (EncodedLengths _encodedLengths) { - // Lengths are effectively checked during copy by 2**40 bytes exceeding gas limits - unchecked { - _encodedLengths = EncodedLengthsLib.pack(bytes(uri).length); - } - } - - /** - * @notice Tightly pack dynamic (variable length) data using this table's schema. - * @return The dynamic data, encoded into a sequence of bytes. - */ - function encodeDynamic(string memory uri) internal pure returns (bytes memory) { - return abi.encodePacked(bytes((uri))); - } - - /** - * @notice Encode all of a record's fields. - * @return The static (fixed length) data, encoded into a sequence of bytes. - * @return The lengths of the dynamic fields (packed into a single bytes32 value). - * @return The dynamic (variable length) data, encoded into a sequence of bytes. - */ - function encode(string memory uri) internal pure returns (bytes memory, EncodedLengths, bytes memory) { - bytes memory _staticData; - EncodedLengths _encodedLengths = encodeLengths(uri); - bytes memory _dynamicData = encodeDynamic(uri); - - return (_staticData, _encodedLengths, _dynamicData); - } - - /** - * @notice Encode keys as a bytes32 array using this table's field layout. - */ - function encodeKeyTuple() internal pure returns (bytes32[] memory) { - bytes32[] memory _keyTuple = new bytes32[](0); - - return _keyTuple; - } -} diff --git a/packages/contracts/lib/ERC1155-puppet/tables/ERC1155Registry.sol b/packages/contracts/lib/ERC1155-puppet/tables/ERC1155Registry.sol deleted file mode 100644 index 269edbdc5..000000000 --- a/packages/contracts/lib/ERC1155-puppet/tables/ERC1155Registry.sol +++ /dev/null @@ -1,321 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity >=0.8.24; - -/* Autogenerated file. Do not edit manually. */ - -// Import store internals -import { IStore } from "@latticexyz/store/src/IStore.sol"; -import { StoreSwitch } from "@latticexyz/store/src/StoreSwitch.sol"; -import { StoreCore } from "@latticexyz/store/src/StoreCore.sol"; -import { Bytes } from "@latticexyz/store/src/Bytes.sol"; -import { Memory } from "@latticexyz/store/src/Memory.sol"; -import { SliceLib } from "@latticexyz/store/src/Slice.sol"; -import { EncodeArray } from "@latticexyz/store/src/tightcoder/EncodeArray.sol"; -import { FieldLayout } from "@latticexyz/store/src/FieldLayout.sol"; -import { Schema } from "@latticexyz/store/src/Schema.sol"; -import { EncodedLengths, EncodedLengthsLib } from "@latticexyz/store/src/EncodedLengths.sol"; -import { ResourceId } from "@latticexyz/store/src/ResourceId.sol"; - -// Import user types -import { ResourceId } from "@latticexyz/store/src/ResourceId.sol"; - -struct ERC1155RegistryData { - address tokenAddress; - address uriStorage; -} - -library ERC1155Registry { - FieldLayout constant _fieldLayout = - FieldLayout.wrap(0x0028020014140000000000000000000000000000000000000000000000000000); - - // Hex-encoded key schema of (bytes32) - Schema constant _keySchema = Schema.wrap(0x002001005f000000000000000000000000000000000000000000000000000000); - // Hex-encoded value schema of (address, address) - Schema constant _valueSchema = Schema.wrap(0x0028020061610000000000000000000000000000000000000000000000000000); - - /** - * @notice Get the table's key field names. - * @return keyNames An array of strings with the names of key fields. - */ - function getKeyNames() internal pure returns (string[] memory keyNames) { - keyNames = new string[](1); - keyNames[0] = "namespaceId"; - } - - /** - * @notice Get the table's value field names. - * @return fieldNames An array of strings with the names of value fields. - */ - function getFieldNames() internal pure returns (string[] memory fieldNames) { - fieldNames = new string[](2); - fieldNames[0] = "tokenAddress"; - fieldNames[1] = "uriStorage"; - } - - /** - * @notice Register the table with its config. - */ - function register(ResourceId _tableId) internal { - StoreSwitch.registerTable(_tableId, _fieldLayout, _keySchema, _valueSchema, getKeyNames(), getFieldNames()); - } - - /** - * @notice Register the table with its config. - */ - function _register(ResourceId _tableId) internal { - StoreCore.registerTable(_tableId, _fieldLayout, _keySchema, _valueSchema, getKeyNames(), getFieldNames()); - } - - /** - * @notice Get tokenAddress. - */ - function getTokenAddress(ResourceId _tableId, ResourceId namespaceId) internal view returns (address tokenAddress) { - bytes32[] memory _keyTuple = new bytes32[](1); - _keyTuple[0] = ResourceId.unwrap(namespaceId); - - bytes32 _blob = StoreSwitch.getStaticField(_tableId, _keyTuple, 0, _fieldLayout); - return (address(bytes20(_blob))); - } - - /** - * @notice Get tokenAddress. - */ - function _getTokenAddress(ResourceId _tableId, ResourceId namespaceId) internal view returns (address tokenAddress) { - bytes32[] memory _keyTuple = new bytes32[](1); - _keyTuple[0] = ResourceId.unwrap(namespaceId); - - bytes32 _blob = StoreCore.getStaticField(_tableId, _keyTuple, 0, _fieldLayout); - return (address(bytes20(_blob))); - } - - /** - * @notice Set tokenAddress. - */ - function setTokenAddress(ResourceId _tableId, ResourceId namespaceId, address tokenAddress) internal { - bytes32[] memory _keyTuple = new bytes32[](1); - _keyTuple[0] = ResourceId.unwrap(namespaceId); - - StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((tokenAddress)), _fieldLayout); - } - - /** - * @notice Set tokenAddress. - */ - function _setTokenAddress(ResourceId _tableId, ResourceId namespaceId, address tokenAddress) internal { - bytes32[] memory _keyTuple = new bytes32[](1); - _keyTuple[0] = ResourceId.unwrap(namespaceId); - - StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((tokenAddress)), _fieldLayout); - } - - /** - * @notice Get uriStorage. - */ - function getUriStorage(ResourceId _tableId, ResourceId namespaceId) internal view returns (address uriStorage) { - bytes32[] memory _keyTuple = new bytes32[](1); - _keyTuple[0] = ResourceId.unwrap(namespaceId); - - bytes32 _blob = StoreSwitch.getStaticField(_tableId, _keyTuple, 1, _fieldLayout); - return (address(bytes20(_blob))); - } - - /** - * @notice Get uriStorage. - */ - function _getUriStorage(ResourceId _tableId, ResourceId namespaceId) internal view returns (address uriStorage) { - bytes32[] memory _keyTuple = new bytes32[](1); - _keyTuple[0] = ResourceId.unwrap(namespaceId); - - bytes32 _blob = StoreCore.getStaticField(_tableId, _keyTuple, 1, _fieldLayout); - return (address(bytes20(_blob))); - } - - /** - * @notice Set uriStorage. - */ - function setUriStorage(ResourceId _tableId, ResourceId namespaceId, address uriStorage) internal { - bytes32[] memory _keyTuple = new bytes32[](1); - _keyTuple[0] = ResourceId.unwrap(namespaceId); - - StoreSwitch.setStaticField(_tableId, _keyTuple, 1, abi.encodePacked((uriStorage)), _fieldLayout); - } - - /** - * @notice Set uriStorage. - */ - function _setUriStorage(ResourceId _tableId, ResourceId namespaceId, address uriStorage) internal { - bytes32[] memory _keyTuple = new bytes32[](1); - _keyTuple[0] = ResourceId.unwrap(namespaceId); - - StoreCore.setStaticField(_tableId, _keyTuple, 1, abi.encodePacked((uriStorage)), _fieldLayout); - } - - /** - * @notice Get the full data. - */ - function get(ResourceId _tableId, ResourceId namespaceId) internal view returns (ERC1155RegistryData memory _table) { - bytes32[] memory _keyTuple = new bytes32[](1); - _keyTuple[0] = ResourceId.unwrap(namespaceId); - - (bytes memory _staticData, EncodedLengths _encodedLengths, bytes memory _dynamicData) = StoreSwitch.getRecord( - _tableId, - _keyTuple, - _fieldLayout - ); - return decode(_staticData, _encodedLengths, _dynamicData); - } - - /** - * @notice Get the full data. - */ - function _get(ResourceId _tableId, ResourceId namespaceId) internal view returns (ERC1155RegistryData memory _table) { - bytes32[] memory _keyTuple = new bytes32[](1); - _keyTuple[0] = ResourceId.unwrap(namespaceId); - - (bytes memory _staticData, EncodedLengths _encodedLengths, bytes memory _dynamicData) = StoreCore.getRecord( - _tableId, - _keyTuple, - _fieldLayout - ); - return decode(_staticData, _encodedLengths, _dynamicData); - } - - /** - * @notice Set the full data using individual values. - */ - function set(ResourceId _tableId, ResourceId namespaceId, address tokenAddress, address uriStorage) internal { - bytes memory _staticData = encodeStatic(tokenAddress, uriStorage); - - EncodedLengths _encodedLengths; - bytes memory _dynamicData; - - bytes32[] memory _keyTuple = new bytes32[](1); - _keyTuple[0] = ResourceId.unwrap(namespaceId); - - StoreSwitch.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData); - } - - /** - * @notice Set the full data using individual values. - */ - function _set(ResourceId _tableId, ResourceId namespaceId, address tokenAddress, address uriStorage) internal { - bytes memory _staticData = encodeStatic(tokenAddress, uriStorage); - - EncodedLengths _encodedLengths; - bytes memory _dynamicData; - - bytes32[] memory _keyTuple = new bytes32[](1); - _keyTuple[0] = ResourceId.unwrap(namespaceId); - - StoreCore.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData, _fieldLayout); - } - - /** - * @notice Set the full data using the data struct. - */ - function set(ResourceId _tableId, ResourceId namespaceId, ERC1155RegistryData memory _table) internal { - bytes memory _staticData = encodeStatic(_table.tokenAddress, _table.uriStorage); - - EncodedLengths _encodedLengths; - bytes memory _dynamicData; - - bytes32[] memory _keyTuple = new bytes32[](1); - _keyTuple[0] = ResourceId.unwrap(namespaceId); - - StoreSwitch.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData); - } - - /** - * @notice Set the full data using the data struct. - */ - function _set(ResourceId _tableId, ResourceId namespaceId, ERC1155RegistryData memory _table) internal { - bytes memory _staticData = encodeStatic(_table.tokenAddress, _table.uriStorage); - - EncodedLengths _encodedLengths; - bytes memory _dynamicData; - - bytes32[] memory _keyTuple = new bytes32[](1); - _keyTuple[0] = ResourceId.unwrap(namespaceId); - - StoreCore.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData, _fieldLayout); - } - - /** - * @notice Decode the tightly packed blob of static data using this table's field layout. - */ - function decodeStatic(bytes memory _blob) internal pure returns (address tokenAddress, address uriStorage) { - tokenAddress = (address(Bytes.getBytes20(_blob, 0))); - - uriStorage = (address(Bytes.getBytes20(_blob, 20))); - } - - /** - * @notice Decode the tightly packed blobs using this table's field layout. - * @param _staticData Tightly packed static fields. - * - * - */ - function decode( - bytes memory _staticData, - EncodedLengths, - bytes memory - ) internal pure returns (ERC1155RegistryData memory _table) { - (_table.tokenAddress, _table.uriStorage) = decodeStatic(_staticData); - } - - /** - * @notice Delete all data for given keys. - */ - function deleteRecord(ResourceId _tableId, ResourceId namespaceId) internal { - bytes32[] memory _keyTuple = new bytes32[](1); - _keyTuple[0] = ResourceId.unwrap(namespaceId); - - StoreSwitch.deleteRecord(_tableId, _keyTuple); - } - - /** - * @notice Delete all data for given keys. - */ - function _deleteRecord(ResourceId _tableId, ResourceId namespaceId) internal { - bytes32[] memory _keyTuple = new bytes32[](1); - _keyTuple[0] = ResourceId.unwrap(namespaceId); - - StoreCore.deleteRecord(_tableId, _keyTuple, _fieldLayout); - } - - /** - * @notice Tightly pack static (fixed length) data using this table's schema. - * @return The static data, encoded into a sequence of bytes. - */ - function encodeStatic(address tokenAddress, address uriStorage) internal pure returns (bytes memory) { - return abi.encodePacked(tokenAddress, uriStorage); - } - - /** - * @notice Encode all of a record's fields. - * @return The static (fixed length) data, encoded into a sequence of bytes. - * @return The lengths of the dynamic fields (packed into a single bytes32 value). - * @return The dynamic (variable length) data, encoded into a sequence of bytes. - */ - function encode( - address tokenAddress, - address uriStorage - ) internal pure returns (bytes memory, EncodedLengths, bytes memory) { - bytes memory _staticData = encodeStatic(tokenAddress, uriStorage); - - EncodedLengths _encodedLengths; - bytes memory _dynamicData; - - return (_staticData, _encodedLengths, _dynamicData); - } - - /** - * @notice Encode keys as a bytes32 array using this table's field layout. - */ - function encodeKeyTuple(ResourceId namespaceId) internal pure returns (bytes32[] memory) { - bytes32[] memory _keyTuple = new bytes32[](1); - _keyTuple[0] = ResourceId.unwrap(namespaceId); - - return _keyTuple; - } -} diff --git a/packages/contracts/lib/ERC1155-puppet/tables/ERC1155URIStorage.sol b/packages/contracts/lib/ERC1155-puppet/tables/ERC1155URIStorage.sol deleted file mode 100644 index aeb86f162..000000000 --- a/packages/contracts/lib/ERC1155-puppet/tables/ERC1155URIStorage.sol +++ /dev/null @@ -1,446 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity >=0.8.24; - -/* Autogenerated file. Do not edit manually. */ - -// Import store internals -import { IStore } from "@latticexyz/store/src/IStore.sol"; -import { StoreSwitch } from "@latticexyz/store/src/StoreSwitch.sol"; -import { StoreCore } from "@latticexyz/store/src/StoreCore.sol"; -import { Bytes } from "@latticexyz/store/src/Bytes.sol"; -import { Memory } from "@latticexyz/store/src/Memory.sol"; -import { SliceLib } from "@latticexyz/store/src/Slice.sol"; -import { EncodeArray } from "@latticexyz/store/src/tightcoder/EncodeArray.sol"; -import { FieldLayout } from "@latticexyz/store/src/FieldLayout.sol"; -import { Schema } from "@latticexyz/store/src/Schema.sol"; -import { EncodedLengths, EncodedLengthsLib } from "@latticexyz/store/src/EncodedLengths.sol"; -import { ResourceId } from "@latticexyz/store/src/ResourceId.sol"; - -library ERC1155URIStorage { - FieldLayout constant _fieldLayout = - FieldLayout.wrap(0x0000000100000000000000000000000000000000000000000000000000000000); - - // Hex-encoded key schema of (uint256) - Schema constant _keySchema = Schema.wrap(0x002001001f000000000000000000000000000000000000000000000000000000); - // Hex-encoded value schema of (string) - Schema constant _valueSchema = Schema.wrap(0x00000001c5000000000000000000000000000000000000000000000000000000); - - /** - * @notice Get the table's key field names. - * @return keyNames An array of strings with the names of key fields. - */ - function getKeyNames() internal pure returns (string[] memory keyNames) { - keyNames = new string[](1); - keyNames[0] = "tokenId"; - } - - /** - * @notice Get the table's value field names. - * @return fieldNames An array of strings with the names of value fields. - */ - function getFieldNames() internal pure returns (string[] memory fieldNames) { - fieldNames = new string[](1); - fieldNames[0] = "uri"; - } - - /** - * @notice Register the table with its config. - */ - function register(ResourceId _tableId) internal { - StoreSwitch.registerTable(_tableId, _fieldLayout, _keySchema, _valueSchema, getKeyNames(), getFieldNames()); - } - - /** - * @notice Register the table with its config. - */ - function _register(ResourceId _tableId) internal { - StoreCore.registerTable(_tableId, _fieldLayout, _keySchema, _valueSchema, getKeyNames(), getFieldNames()); - } - - /** - * @notice Get uri. - */ - function getUri(ResourceId _tableId, uint256 tokenId) internal view returns (string memory uri) { - bytes32[] memory _keyTuple = new bytes32[](1); - _keyTuple[0] = bytes32(uint256(tokenId)); - - bytes memory _blob = StoreSwitch.getDynamicField(_tableId, _keyTuple, 0); - return (string(_blob)); - } - - /** - * @notice Get uri. - */ - function _getUri(ResourceId _tableId, uint256 tokenId) internal view returns (string memory uri) { - bytes32[] memory _keyTuple = new bytes32[](1); - _keyTuple[0] = bytes32(uint256(tokenId)); - - bytes memory _blob = StoreCore.getDynamicField(_tableId, _keyTuple, 0); - return (string(_blob)); - } - - /** - * @notice Get uri. - */ - function get(ResourceId _tableId, uint256 tokenId) internal view returns (string memory uri) { - bytes32[] memory _keyTuple = new bytes32[](1); - _keyTuple[0] = bytes32(uint256(tokenId)); - - bytes memory _blob = StoreSwitch.getDynamicField(_tableId, _keyTuple, 0); - return (string(_blob)); - } - - /** - * @notice Get uri. - */ - function _get(ResourceId _tableId, uint256 tokenId) internal view returns (string memory uri) { - bytes32[] memory _keyTuple = new bytes32[](1); - _keyTuple[0] = bytes32(uint256(tokenId)); - - bytes memory _blob = StoreCore.getDynamicField(_tableId, _keyTuple, 0); - return (string(_blob)); - } - - /** - * @notice Set uri. - */ - function setUri(ResourceId _tableId, uint256 tokenId, string memory uri) internal { - bytes32[] memory _keyTuple = new bytes32[](1); - _keyTuple[0] = bytes32(uint256(tokenId)); - - StoreSwitch.setDynamicField(_tableId, _keyTuple, 0, bytes((uri))); - } - - /** - * @notice Set uri. - */ - function _setUri(ResourceId _tableId, uint256 tokenId, string memory uri) internal { - bytes32[] memory _keyTuple = new bytes32[](1); - _keyTuple[0] = bytes32(uint256(tokenId)); - - StoreCore.setDynamicField(_tableId, _keyTuple, 0, bytes((uri))); - } - - /** - * @notice Set uri. - */ - function set(ResourceId _tableId, uint256 tokenId, string memory uri) internal { - bytes32[] memory _keyTuple = new bytes32[](1); - _keyTuple[0] = bytes32(uint256(tokenId)); - - StoreSwitch.setDynamicField(_tableId, _keyTuple, 0, bytes((uri))); - } - - /** - * @notice Set uri. - */ - function _set(ResourceId _tableId, uint256 tokenId, string memory uri) internal { - bytes32[] memory _keyTuple = new bytes32[](1); - _keyTuple[0] = bytes32(uint256(tokenId)); - - StoreCore.setDynamicField(_tableId, _keyTuple, 0, bytes((uri))); - } - - /** - * @notice Get the length of uri. - */ - function lengthUri(ResourceId _tableId, uint256 tokenId) internal view returns (uint256) { - bytes32[] memory _keyTuple = new bytes32[](1); - _keyTuple[0] = bytes32(uint256(tokenId)); - - uint256 _byteLength = StoreSwitch.getDynamicFieldLength(_tableId, _keyTuple, 0); - unchecked { - return _byteLength / 1; - } - } - - /** - * @notice Get the length of uri. - */ - function _lengthUri(ResourceId _tableId, uint256 tokenId) internal view returns (uint256) { - bytes32[] memory _keyTuple = new bytes32[](1); - _keyTuple[0] = bytes32(uint256(tokenId)); - - uint256 _byteLength = StoreCore.getDynamicFieldLength(_tableId, _keyTuple, 0); - unchecked { - return _byteLength / 1; - } - } - - /** - * @notice Get the length of uri. - */ - function length(ResourceId _tableId, uint256 tokenId) internal view returns (uint256) { - bytes32[] memory _keyTuple = new bytes32[](1); - _keyTuple[0] = bytes32(uint256(tokenId)); - - uint256 _byteLength = StoreSwitch.getDynamicFieldLength(_tableId, _keyTuple, 0); - unchecked { - return _byteLength / 1; - } - } - - /** - * @notice Get the length of uri. - */ - function _length(ResourceId _tableId, uint256 tokenId) internal view returns (uint256) { - bytes32[] memory _keyTuple = new bytes32[](1); - _keyTuple[0] = bytes32(uint256(tokenId)); - - uint256 _byteLength = StoreCore.getDynamicFieldLength(_tableId, _keyTuple, 0); - unchecked { - return _byteLength / 1; - } - } - - /** - * @notice Get an item of uri. - * @dev Reverts with Store_IndexOutOfBounds if `_index` is out of bounds for the array. - */ - function getItemUri(ResourceId _tableId, uint256 tokenId, uint256 _index) internal view returns (string memory) { - bytes32[] memory _keyTuple = new bytes32[](1); - _keyTuple[0] = bytes32(uint256(tokenId)); - - unchecked { - bytes memory _blob = StoreSwitch.getDynamicFieldSlice(_tableId, _keyTuple, 0, _index * 1, (_index + 1) * 1); - return (string(_blob)); - } - } - - /** - * @notice Get an item of uri. - * @dev Reverts with Store_IndexOutOfBounds if `_index` is out of bounds for the array. - */ - function _getItemUri(ResourceId _tableId, uint256 tokenId, uint256 _index) internal view returns (string memory) { - bytes32[] memory _keyTuple = new bytes32[](1); - _keyTuple[0] = bytes32(uint256(tokenId)); - - unchecked { - bytes memory _blob = StoreCore.getDynamicFieldSlice(_tableId, _keyTuple, 0, _index * 1, (_index + 1) * 1); - return (string(_blob)); - } - } - - /** - * @notice Get an item of uri. - * @dev Reverts with Store_IndexOutOfBounds if `_index` is out of bounds for the array. - */ - function getItem(ResourceId _tableId, uint256 tokenId, uint256 _index) internal view returns (string memory) { - bytes32[] memory _keyTuple = new bytes32[](1); - _keyTuple[0] = bytes32(uint256(tokenId)); - - unchecked { - bytes memory _blob = StoreSwitch.getDynamicFieldSlice(_tableId, _keyTuple, 0, _index * 1, (_index + 1) * 1); - return (string(_blob)); - } - } - - /** - * @notice Get an item of uri. - * @dev Reverts with Store_IndexOutOfBounds if `_index` is out of bounds for the array. - */ - function _getItem(ResourceId _tableId, uint256 tokenId, uint256 _index) internal view returns (string memory) { - bytes32[] memory _keyTuple = new bytes32[](1); - _keyTuple[0] = bytes32(uint256(tokenId)); - - unchecked { - bytes memory _blob = StoreCore.getDynamicFieldSlice(_tableId, _keyTuple, 0, _index * 1, (_index + 1) * 1); - return (string(_blob)); - } - } - - /** - * @notice Push a slice to uri. - */ - function pushUri(ResourceId _tableId, uint256 tokenId, string memory _slice) internal { - bytes32[] memory _keyTuple = new bytes32[](1); - _keyTuple[0] = bytes32(uint256(tokenId)); - - StoreSwitch.pushToDynamicField(_tableId, _keyTuple, 0, bytes((_slice))); - } - - /** - * @notice Push a slice to uri. - */ - function _pushUri(ResourceId _tableId, uint256 tokenId, string memory _slice) internal { - bytes32[] memory _keyTuple = new bytes32[](1); - _keyTuple[0] = bytes32(uint256(tokenId)); - - StoreCore.pushToDynamicField(_tableId, _keyTuple, 0, bytes((_slice))); - } - - /** - * @notice Push a slice to uri. - */ - function push(ResourceId _tableId, uint256 tokenId, string memory _slice) internal { - bytes32[] memory _keyTuple = new bytes32[](1); - _keyTuple[0] = bytes32(uint256(tokenId)); - - StoreSwitch.pushToDynamicField(_tableId, _keyTuple, 0, bytes((_slice))); - } - - /** - * @notice Push a slice to uri. - */ - function _push(ResourceId _tableId, uint256 tokenId, string memory _slice) internal { - bytes32[] memory _keyTuple = new bytes32[](1); - _keyTuple[0] = bytes32(uint256(tokenId)); - - StoreCore.pushToDynamicField(_tableId, _keyTuple, 0, bytes((_slice))); - } - - /** - * @notice Pop a slice from uri. - */ - function popUri(ResourceId _tableId, uint256 tokenId) internal { - bytes32[] memory _keyTuple = new bytes32[](1); - _keyTuple[0] = bytes32(uint256(tokenId)); - - StoreSwitch.popFromDynamicField(_tableId, _keyTuple, 0, 1); - } - - /** - * @notice Pop a slice from uri. - */ - function _popUri(ResourceId _tableId, uint256 tokenId) internal { - bytes32[] memory _keyTuple = new bytes32[](1); - _keyTuple[0] = bytes32(uint256(tokenId)); - - StoreCore.popFromDynamicField(_tableId, _keyTuple, 0, 1); - } - - /** - * @notice Pop a slice from uri. - */ - function pop(ResourceId _tableId, uint256 tokenId) internal { - bytes32[] memory _keyTuple = new bytes32[](1); - _keyTuple[0] = bytes32(uint256(tokenId)); - - StoreSwitch.popFromDynamicField(_tableId, _keyTuple, 0, 1); - } - - /** - * @notice Pop a slice from uri. - */ - function _pop(ResourceId _tableId, uint256 tokenId) internal { - bytes32[] memory _keyTuple = new bytes32[](1); - _keyTuple[0] = bytes32(uint256(tokenId)); - - StoreCore.popFromDynamicField(_tableId, _keyTuple, 0, 1); - } - - /** - * @notice Update a slice of uri at `_index`. - */ - function updateUri(ResourceId _tableId, uint256 tokenId, uint256 _index, string memory _slice) internal { - bytes32[] memory _keyTuple = new bytes32[](1); - _keyTuple[0] = bytes32(uint256(tokenId)); - - unchecked { - bytes memory _encoded = bytes((_slice)); - StoreSwitch.spliceDynamicData(_tableId, _keyTuple, 0, uint40(_index * 1), uint40(_encoded.length), _encoded); - } - } - - /** - * @notice Update a slice of uri at `_index`. - */ - function _updateUri(ResourceId _tableId, uint256 tokenId, uint256 _index, string memory _slice) internal { - bytes32[] memory _keyTuple = new bytes32[](1); - _keyTuple[0] = bytes32(uint256(tokenId)); - - unchecked { - bytes memory _encoded = bytes((_slice)); - StoreCore.spliceDynamicData(_tableId, _keyTuple, 0, uint40(_index * 1), uint40(_encoded.length), _encoded); - } - } - - /** - * @notice Update a slice of uri at `_index`. - */ - function update(ResourceId _tableId, uint256 tokenId, uint256 _index, string memory _slice) internal { - bytes32[] memory _keyTuple = new bytes32[](1); - _keyTuple[0] = bytes32(uint256(tokenId)); - - unchecked { - bytes memory _encoded = bytes((_slice)); - StoreSwitch.spliceDynamicData(_tableId, _keyTuple, 0, uint40(_index * 1), uint40(_encoded.length), _encoded); - } - } - - /** - * @notice Update a slice of uri at `_index`. - */ - function _update(ResourceId _tableId, uint256 tokenId, uint256 _index, string memory _slice) internal { - bytes32[] memory _keyTuple = new bytes32[](1); - _keyTuple[0] = bytes32(uint256(tokenId)); - - unchecked { - bytes memory _encoded = bytes((_slice)); - StoreCore.spliceDynamicData(_tableId, _keyTuple, 0, uint40(_index * 1), uint40(_encoded.length), _encoded); - } - } - - /** - * @notice Delete all data for given keys. - */ - function deleteRecord(ResourceId _tableId, uint256 tokenId) internal { - bytes32[] memory _keyTuple = new bytes32[](1); - _keyTuple[0] = bytes32(uint256(tokenId)); - - StoreSwitch.deleteRecord(_tableId, _keyTuple); - } - - /** - * @notice Delete all data for given keys. - */ - function _deleteRecord(ResourceId _tableId, uint256 tokenId) internal { - bytes32[] memory _keyTuple = new bytes32[](1); - _keyTuple[0] = bytes32(uint256(tokenId)); - - StoreCore.deleteRecord(_tableId, _keyTuple, _fieldLayout); - } - - /** - * @notice Tightly pack dynamic data lengths using this table's schema. - * @return _encodedLengths The lengths of the dynamic fields (packed into a single bytes32 value). - */ - function encodeLengths(string memory uri) internal pure returns (EncodedLengths _encodedLengths) { - // Lengths are effectively checked during copy by 2**40 bytes exceeding gas limits - unchecked { - _encodedLengths = EncodedLengthsLib.pack(bytes(uri).length); - } - } - - /** - * @notice Tightly pack dynamic (variable length) data using this table's schema. - * @return The dynamic data, encoded into a sequence of bytes. - */ - function encodeDynamic(string memory uri) internal pure returns (bytes memory) { - return abi.encodePacked(bytes((uri))); - } - - /** - * @notice Encode all of a record's fields. - * @return The static (fixed length) data, encoded into a sequence of bytes. - * @return The lengths of the dynamic fields (packed into a single bytes32 value). - * @return The dynamic (variable length) data, encoded into a sequence of bytes. - */ - function encode(string memory uri) internal pure returns (bytes memory, EncodedLengths, bytes memory) { - bytes memory _staticData; - EncodedLengths _encodedLengths = encodeLengths(uri); - bytes memory _dynamicData = encodeDynamic(uri); - - return (_staticData, _encodedLengths, _dynamicData); - } - - /** - * @notice Encode keys as a bytes32 array using this table's field layout. - */ - function encodeKeyTuple(uint256 tokenId) internal pure returns (bytes32[] memory) { - bytes32[] memory _keyTuple = new bytes32[](1); - _keyTuple[0] = bytes32(uint256(tokenId)); - - return _keyTuple; - } -} diff --git a/packages/contracts/lib/ERC1155-puppet/tables/OperatorApproval.sol b/packages/contracts/lib/ERC1155-puppet/tables/OperatorApproval.sol deleted file mode 100644 index 8a77fc84d..000000000 --- a/packages/contracts/lib/ERC1155-puppet/tables/OperatorApproval.sol +++ /dev/null @@ -1,220 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity >=0.8.24; - -/* Autogenerated file. Do not edit manually. */ - -// Import store internals -import { IStore } from "@latticexyz/store/src/IStore.sol"; -import { StoreSwitch } from "@latticexyz/store/src/StoreSwitch.sol"; -import { StoreCore } from "@latticexyz/store/src/StoreCore.sol"; -import { Bytes } from "@latticexyz/store/src/Bytes.sol"; -import { Memory } from "@latticexyz/store/src/Memory.sol"; -import { SliceLib } from "@latticexyz/store/src/Slice.sol"; -import { EncodeArray } from "@latticexyz/store/src/tightcoder/EncodeArray.sol"; -import { FieldLayout } from "@latticexyz/store/src/FieldLayout.sol"; -import { Schema } from "@latticexyz/store/src/Schema.sol"; -import { EncodedLengths, EncodedLengthsLib } from "@latticexyz/store/src/EncodedLengths.sol"; -import { ResourceId } from "@latticexyz/store/src/ResourceId.sol"; - -library OperatorApproval { - FieldLayout constant _fieldLayout = - FieldLayout.wrap(0x0001010001000000000000000000000000000000000000000000000000000000); - - // Hex-encoded key schema of (address, address) - Schema constant _keySchema = Schema.wrap(0x0028020061610000000000000000000000000000000000000000000000000000); - // Hex-encoded value schema of (bool) - Schema constant _valueSchema = Schema.wrap(0x0001010060000000000000000000000000000000000000000000000000000000); - - /** - * @notice Get the table's key field names. - * @return keyNames An array of strings with the names of key fields. - */ - function getKeyNames() internal pure returns (string[] memory keyNames) { - keyNames = new string[](2); - keyNames[0] = "owner"; - keyNames[1] = "operator"; - } - - /** - * @notice Get the table's value field names. - * @return fieldNames An array of strings with the names of value fields. - */ - function getFieldNames() internal pure returns (string[] memory fieldNames) { - fieldNames = new string[](1); - fieldNames[0] = "approved"; - } - - /** - * @notice Register the table with its config. - */ - function register(ResourceId _tableId) internal { - StoreSwitch.registerTable(_tableId, _fieldLayout, _keySchema, _valueSchema, getKeyNames(), getFieldNames()); - } - - /** - * @notice Register the table with its config. - */ - function _register(ResourceId _tableId) internal { - StoreCore.registerTable(_tableId, _fieldLayout, _keySchema, _valueSchema, getKeyNames(), getFieldNames()); - } - - /** - * @notice Get approved. - */ - function getApproved(ResourceId _tableId, address owner, address operator) internal view returns (bool approved) { - bytes32[] memory _keyTuple = new bytes32[](2); - _keyTuple[0] = bytes32(uint256(uint160(owner))); - _keyTuple[1] = bytes32(uint256(uint160(operator))); - - bytes32 _blob = StoreSwitch.getStaticField(_tableId, _keyTuple, 0, _fieldLayout); - return (_toBool(uint8(bytes1(_blob)))); - } - - /** - * @notice Get approved. - */ - function _getApproved(ResourceId _tableId, address owner, address operator) internal view returns (bool approved) { - bytes32[] memory _keyTuple = new bytes32[](2); - _keyTuple[0] = bytes32(uint256(uint160(owner))); - _keyTuple[1] = bytes32(uint256(uint160(operator))); - - bytes32 _blob = StoreCore.getStaticField(_tableId, _keyTuple, 0, _fieldLayout); - return (_toBool(uint8(bytes1(_blob)))); - } - - /** - * @notice Get approved. - */ - function get(ResourceId _tableId, address owner, address operator) internal view returns (bool approved) { - bytes32[] memory _keyTuple = new bytes32[](2); - _keyTuple[0] = bytes32(uint256(uint160(owner))); - _keyTuple[1] = bytes32(uint256(uint160(operator))); - - bytes32 _blob = StoreSwitch.getStaticField(_tableId, _keyTuple, 0, _fieldLayout); - return (_toBool(uint8(bytes1(_blob)))); - } - - /** - * @notice Get approved. - */ - function _get(ResourceId _tableId, address owner, address operator) internal view returns (bool approved) { - bytes32[] memory _keyTuple = new bytes32[](2); - _keyTuple[0] = bytes32(uint256(uint160(owner))); - _keyTuple[1] = bytes32(uint256(uint160(operator))); - - bytes32 _blob = StoreCore.getStaticField(_tableId, _keyTuple, 0, _fieldLayout); - return (_toBool(uint8(bytes1(_blob)))); - } - - /** - * @notice Set approved. - */ - function setApproved(ResourceId _tableId, address owner, address operator, bool approved) internal { - bytes32[] memory _keyTuple = new bytes32[](2); - _keyTuple[0] = bytes32(uint256(uint160(owner))); - _keyTuple[1] = bytes32(uint256(uint160(operator))); - - StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((approved)), _fieldLayout); - } - - /** - * @notice Set approved. - */ - function _setApproved(ResourceId _tableId, address owner, address operator, bool approved) internal { - bytes32[] memory _keyTuple = new bytes32[](2); - _keyTuple[0] = bytes32(uint256(uint160(owner))); - _keyTuple[1] = bytes32(uint256(uint160(operator))); - - StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((approved)), _fieldLayout); - } - - /** - * @notice Set approved. - */ - function set(ResourceId _tableId, address owner, address operator, bool approved) internal { - bytes32[] memory _keyTuple = new bytes32[](2); - _keyTuple[0] = bytes32(uint256(uint160(owner))); - _keyTuple[1] = bytes32(uint256(uint160(operator))); - - StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((approved)), _fieldLayout); - } - - /** - * @notice Set approved. - */ - function _set(ResourceId _tableId, address owner, address operator, bool approved) internal { - bytes32[] memory _keyTuple = new bytes32[](2); - _keyTuple[0] = bytes32(uint256(uint160(owner))); - _keyTuple[1] = bytes32(uint256(uint160(operator))); - - StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((approved)), _fieldLayout); - } - - /** - * @notice Delete all data for given keys. - */ - function deleteRecord(ResourceId _tableId, address owner, address operator) internal { - bytes32[] memory _keyTuple = new bytes32[](2); - _keyTuple[0] = bytes32(uint256(uint160(owner))); - _keyTuple[1] = bytes32(uint256(uint160(operator))); - - StoreSwitch.deleteRecord(_tableId, _keyTuple); - } - - /** - * @notice Delete all data for given keys. - */ - function _deleteRecord(ResourceId _tableId, address owner, address operator) internal { - bytes32[] memory _keyTuple = new bytes32[](2); - _keyTuple[0] = bytes32(uint256(uint160(owner))); - _keyTuple[1] = bytes32(uint256(uint160(operator))); - - StoreCore.deleteRecord(_tableId, _keyTuple, _fieldLayout); - } - - /** - * @notice Tightly pack static (fixed length) data using this table's schema. - * @return The static data, encoded into a sequence of bytes. - */ - function encodeStatic(bool approved) internal pure returns (bytes memory) { - return abi.encodePacked(approved); - } - - /** - * @notice Encode all of a record's fields. - * @return The static (fixed length) data, encoded into a sequence of bytes. - * @return The lengths of the dynamic fields (packed into a single bytes32 value). - * @return The dynamic (variable length) data, encoded into a sequence of bytes. - */ - function encode(bool approved) internal pure returns (bytes memory, EncodedLengths, bytes memory) { - bytes memory _staticData = encodeStatic(approved); - - EncodedLengths _encodedLengths; - bytes memory _dynamicData; - - return (_staticData, _encodedLengths, _dynamicData); - } - - /** - * @notice Encode keys as a bytes32 array using this table's field layout. - */ - function encodeKeyTuple(address owner, address operator) internal pure returns (bytes32[] memory) { - bytes32[] memory _keyTuple = new bytes32[](2); - _keyTuple[0] = bytes32(uint256(uint160(owner))); - _keyTuple[1] = bytes32(uint256(uint160(operator))); - - return _keyTuple; - } -} - -/** - * @notice Cast a value to a bool. - * @dev Boolean values are encoded as uint8 (1 = true, 0 = false), but Solidity doesn't allow casting between uint8 and bool. - * @param value The uint8 value to convert. - * @return result The boolean value. - */ -function _toBool(uint8 value) pure returns (bool result) { - assembly { - result := value - } -} diff --git a/packages/contracts/lib/ERC1155-puppet/tables/Owners.sol b/packages/contracts/lib/ERC1155-puppet/tables/Owners.sol deleted file mode 100644 index 92385749e..000000000 --- a/packages/contracts/lib/ERC1155-puppet/tables/Owners.sol +++ /dev/null @@ -1,208 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity >=0.8.24; - -/* Autogenerated file. Do not edit manually. */ - -// Import store internals -import { IStore } from "@latticexyz/store/src/IStore.sol"; -import { StoreSwitch } from "@latticexyz/store/src/StoreSwitch.sol"; -import { StoreCore } from "@latticexyz/store/src/StoreCore.sol"; -import { Bytes } from "@latticexyz/store/src/Bytes.sol"; -import { Memory } from "@latticexyz/store/src/Memory.sol"; -import { SliceLib } from "@latticexyz/store/src/Slice.sol"; -import { EncodeArray } from "@latticexyz/store/src/tightcoder/EncodeArray.sol"; -import { FieldLayout } from "@latticexyz/store/src/FieldLayout.sol"; -import { Schema } from "@latticexyz/store/src/Schema.sol"; -import { EncodedLengths, EncodedLengthsLib } from "@latticexyz/store/src/EncodedLengths.sol"; -import { ResourceId } from "@latticexyz/store/src/ResourceId.sol"; - -library Owners { - FieldLayout constant _fieldLayout = - FieldLayout.wrap(0x0020010020000000000000000000000000000000000000000000000000000000); - - // Hex-encoded key schema of (address, uint256) - Schema constant _keySchema = Schema.wrap(0x00340200611f0000000000000000000000000000000000000000000000000000); - // Hex-encoded value schema of (uint256) - Schema constant _valueSchema = Schema.wrap(0x002001001f000000000000000000000000000000000000000000000000000000); - - /** - * @notice Get the table's key field names. - * @return keyNames An array of strings with the names of key fields. - */ - function getKeyNames() internal pure returns (string[] memory keyNames) { - keyNames = new string[](2); - keyNames[0] = "owner"; - keyNames[1] = "tokenId"; - } - - /** - * @notice Get the table's value field names. - * @return fieldNames An array of strings with the names of value fields. - */ - function getFieldNames() internal pure returns (string[] memory fieldNames) { - fieldNames = new string[](1); - fieldNames[0] = "balance"; - } - - /** - * @notice Register the table with its config. - */ - function register(ResourceId _tableId) internal { - StoreSwitch.registerTable(_tableId, _fieldLayout, _keySchema, _valueSchema, getKeyNames(), getFieldNames()); - } - - /** - * @notice Register the table with its config. - */ - function _register(ResourceId _tableId) internal { - StoreCore.registerTable(_tableId, _fieldLayout, _keySchema, _valueSchema, getKeyNames(), getFieldNames()); - } - - /** - * @notice Get balance. - */ - function getBalance(ResourceId _tableId, address owner, uint256 tokenId) internal view returns (uint256 balance) { - bytes32[] memory _keyTuple = new bytes32[](2); - _keyTuple[0] = bytes32(uint256(uint160(owner))); - _keyTuple[1] = bytes32(uint256(tokenId)); - - bytes32 _blob = StoreSwitch.getStaticField(_tableId, _keyTuple, 0, _fieldLayout); - return (uint256(bytes32(_blob))); - } - - /** - * @notice Get balance. - */ - function _getBalance(ResourceId _tableId, address owner, uint256 tokenId) internal view returns (uint256 balance) { - bytes32[] memory _keyTuple = new bytes32[](2); - _keyTuple[0] = bytes32(uint256(uint160(owner))); - _keyTuple[1] = bytes32(uint256(tokenId)); - - bytes32 _blob = StoreCore.getStaticField(_tableId, _keyTuple, 0, _fieldLayout); - return (uint256(bytes32(_blob))); - } - - /** - * @notice Get balance. - */ - function get(ResourceId _tableId, address owner, uint256 tokenId) internal view returns (uint256 balance) { - bytes32[] memory _keyTuple = new bytes32[](2); - _keyTuple[0] = bytes32(uint256(uint160(owner))); - _keyTuple[1] = bytes32(uint256(tokenId)); - - bytes32 _blob = StoreSwitch.getStaticField(_tableId, _keyTuple, 0, _fieldLayout); - return (uint256(bytes32(_blob))); - } - - /** - * @notice Get balance. - */ - function _get(ResourceId _tableId, address owner, uint256 tokenId) internal view returns (uint256 balance) { - bytes32[] memory _keyTuple = new bytes32[](2); - _keyTuple[0] = bytes32(uint256(uint160(owner))); - _keyTuple[1] = bytes32(uint256(tokenId)); - - bytes32 _blob = StoreCore.getStaticField(_tableId, _keyTuple, 0, _fieldLayout); - return (uint256(bytes32(_blob))); - } - - /** - * @notice Set balance. - */ - function setBalance(ResourceId _tableId, address owner, uint256 tokenId, uint256 balance) internal { - bytes32[] memory _keyTuple = new bytes32[](2); - _keyTuple[0] = bytes32(uint256(uint160(owner))); - _keyTuple[1] = bytes32(uint256(tokenId)); - - StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((balance)), _fieldLayout); - } - - /** - * @notice Set balance. - */ - function _setBalance(ResourceId _tableId, address owner, uint256 tokenId, uint256 balance) internal { - bytes32[] memory _keyTuple = new bytes32[](2); - _keyTuple[0] = bytes32(uint256(uint160(owner))); - _keyTuple[1] = bytes32(uint256(tokenId)); - - StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((balance)), _fieldLayout); - } - - /** - * @notice Set balance. - */ - function set(ResourceId _tableId, address owner, uint256 tokenId, uint256 balance) internal { - bytes32[] memory _keyTuple = new bytes32[](2); - _keyTuple[0] = bytes32(uint256(uint160(owner))); - _keyTuple[1] = bytes32(uint256(tokenId)); - - StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((balance)), _fieldLayout); - } - - /** - * @notice Set balance. - */ - function _set(ResourceId _tableId, address owner, uint256 tokenId, uint256 balance) internal { - bytes32[] memory _keyTuple = new bytes32[](2); - _keyTuple[0] = bytes32(uint256(uint160(owner))); - _keyTuple[1] = bytes32(uint256(tokenId)); - - StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((balance)), _fieldLayout); - } - - /** - * @notice Delete all data for given keys. - */ - function deleteRecord(ResourceId _tableId, address owner, uint256 tokenId) internal { - bytes32[] memory _keyTuple = new bytes32[](2); - _keyTuple[0] = bytes32(uint256(uint160(owner))); - _keyTuple[1] = bytes32(uint256(tokenId)); - - StoreSwitch.deleteRecord(_tableId, _keyTuple); - } - - /** - * @notice Delete all data for given keys. - */ - function _deleteRecord(ResourceId _tableId, address owner, uint256 tokenId) internal { - bytes32[] memory _keyTuple = new bytes32[](2); - _keyTuple[0] = bytes32(uint256(uint160(owner))); - _keyTuple[1] = bytes32(uint256(tokenId)); - - StoreCore.deleteRecord(_tableId, _keyTuple, _fieldLayout); - } - - /** - * @notice Tightly pack static (fixed length) data using this table's schema. - * @return The static data, encoded into a sequence of bytes. - */ - function encodeStatic(uint256 balance) internal pure returns (bytes memory) { - return abi.encodePacked(balance); - } - - /** - * @notice Encode all of a record's fields. - * @return The static (fixed length) data, encoded into a sequence of bytes. - * @return The lengths of the dynamic fields (packed into a single bytes32 value). - * @return The dynamic (variable length) data, encoded into a sequence of bytes. - */ - function encode(uint256 balance) internal pure returns (bytes memory, EncodedLengths, bytes memory) { - bytes memory _staticData = encodeStatic(balance); - - EncodedLengths _encodedLengths; - bytes memory _dynamicData; - - return (_staticData, _encodedLengths, _dynamicData); - } - - /** - * @notice Encode keys as a bytes32 array using this table's field layout. - */ - function encodeKeyTuple(address owner, uint256 tokenId) internal pure returns (bytes32[] memory) { - bytes32[] memory _keyTuple = new bytes32[](2); - _keyTuple[0] = bytes32(uint256(uint160(owner))); - _keyTuple[1] = bytes32(uint256(tokenId)); - - return _keyTuple; - } -} diff --git a/packages/contracts/lib/ERC1155-puppet/tables/TestConfig.sol b/packages/contracts/lib/ERC1155-puppet/tables/TestConfig.sol deleted file mode 100644 index 59c7c4074..000000000 --- a/packages/contracts/lib/ERC1155-puppet/tables/TestConfig.sol +++ /dev/null @@ -1,300 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity >=0.8.24; - -/* Autogenerated file. Do not edit manually. */ - -// Import store internals -import { IStore } from "@latticexyz/store/src/IStore.sol"; -import { StoreSwitch } from "@latticexyz/store/src/StoreSwitch.sol"; -import { StoreCore } from "@latticexyz/store/src/StoreCore.sol"; -import { Bytes } from "@latticexyz/store/src/Bytes.sol"; -import { Memory } from "@latticexyz/store/src/Memory.sol"; -import { SliceLib } from "@latticexyz/store/src/Slice.sol"; -import { EncodeArray } from "@latticexyz/store/src/tightcoder/EncodeArray.sol"; -import { FieldLayout } from "@latticexyz/store/src/FieldLayout.sol"; -import { Schema } from "@latticexyz/store/src/Schema.sol"; -import { EncodedLengths, EncodedLengthsLib } from "@latticexyz/store/src/EncodedLengths.sol"; -import { ResourceId } from "@latticexyz/store/src/ResourceId.sol"; - -struct TestConfigData { - address erc721; - address erc1155; -} - -library TestConfig { - // Hex below is the result of `WorldResourceIdLib.encode({ namespace: "TST", name: "TestConfig", typeId: RESOURCE_TABLE });` - ResourceId constant _tableId = ResourceId.wrap(0x7462545354000000000000000000000054657374436f6e666967000000000000); - - FieldLayout constant _fieldLayout = - FieldLayout.wrap(0x0028020014140000000000000000000000000000000000000000000000000000); - - // Hex-encoded key schema of () - Schema constant _keySchema = Schema.wrap(0x0000000000000000000000000000000000000000000000000000000000000000); - // Hex-encoded value schema of (address, address) - Schema constant _valueSchema = Schema.wrap(0x0028020061610000000000000000000000000000000000000000000000000000); - - /** - * @notice Get the table's key field names. - * @return keyNames An array of strings with the names of key fields. - */ - function getKeyNames() internal pure returns (string[] memory keyNames) { - keyNames = new string[](0); - } - - /** - * @notice Get the table's value field names. - * @return fieldNames An array of strings with the names of value fields. - */ - function getFieldNames() internal pure returns (string[] memory fieldNames) { - fieldNames = new string[](2); - fieldNames[0] = "erc721"; - fieldNames[1] = "erc1155"; - } - - /** - * @notice Register the table with its config. - */ - function register() internal { - StoreSwitch.registerTable(_tableId, _fieldLayout, _keySchema, _valueSchema, getKeyNames(), getFieldNames()); - } - - /** - * @notice Register the table with its config. - */ - function _register() internal { - StoreCore.registerTable(_tableId, _fieldLayout, _keySchema, _valueSchema, getKeyNames(), getFieldNames()); - } - - /** - * @notice Get erc721. - */ - function getErc721() internal view returns (address erc721) { - bytes32[] memory _keyTuple = new bytes32[](0); - - bytes32 _blob = StoreSwitch.getStaticField(_tableId, _keyTuple, 0, _fieldLayout); - return (address(bytes20(_blob))); - } - - /** - * @notice Get erc721. - */ - function _getErc721() internal view returns (address erc721) { - bytes32[] memory _keyTuple = new bytes32[](0); - - bytes32 _blob = StoreCore.getStaticField(_tableId, _keyTuple, 0, _fieldLayout); - return (address(bytes20(_blob))); - } - - /** - * @notice Set erc721. - */ - function setErc721(address erc721) internal { - bytes32[] memory _keyTuple = new bytes32[](0); - - StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((erc721)), _fieldLayout); - } - - /** - * @notice Set erc721. - */ - function _setErc721(address erc721) internal { - bytes32[] memory _keyTuple = new bytes32[](0); - - StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((erc721)), _fieldLayout); - } - - /** - * @notice Get erc1155. - */ - function getErc1155() internal view returns (address erc1155) { - bytes32[] memory _keyTuple = new bytes32[](0); - - bytes32 _blob = StoreSwitch.getStaticField(_tableId, _keyTuple, 1, _fieldLayout); - return (address(bytes20(_blob))); - } - - /** - * @notice Get erc1155. - */ - function _getErc1155() internal view returns (address erc1155) { - bytes32[] memory _keyTuple = new bytes32[](0); - - bytes32 _blob = StoreCore.getStaticField(_tableId, _keyTuple, 1, _fieldLayout); - return (address(bytes20(_blob))); - } - - /** - * @notice Set erc1155. - */ - function setErc1155(address erc1155) internal { - bytes32[] memory _keyTuple = new bytes32[](0); - - StoreSwitch.setStaticField(_tableId, _keyTuple, 1, abi.encodePacked((erc1155)), _fieldLayout); - } - - /** - * @notice Set erc1155. - */ - function _setErc1155(address erc1155) internal { - bytes32[] memory _keyTuple = new bytes32[](0); - - StoreCore.setStaticField(_tableId, _keyTuple, 1, abi.encodePacked((erc1155)), _fieldLayout); - } - - /** - * @notice Get the full data. - */ - function get() internal view returns (TestConfigData memory _table) { - bytes32[] memory _keyTuple = new bytes32[](0); - - (bytes memory _staticData, EncodedLengths _encodedLengths, bytes memory _dynamicData) = StoreSwitch.getRecord( - _tableId, - _keyTuple, - _fieldLayout - ); - return decode(_staticData, _encodedLengths, _dynamicData); - } - - /** - * @notice Get the full data. - */ - function _get() internal view returns (TestConfigData memory _table) { - bytes32[] memory _keyTuple = new bytes32[](0); - - (bytes memory _staticData, EncodedLengths _encodedLengths, bytes memory _dynamicData) = StoreCore.getRecord( - _tableId, - _keyTuple, - _fieldLayout - ); - return decode(_staticData, _encodedLengths, _dynamicData); - } - - /** - * @notice Set the full data using individual values. - */ - function set(address erc721, address erc1155) internal { - bytes memory _staticData = encodeStatic(erc721, erc1155); - - EncodedLengths _encodedLengths; - bytes memory _dynamicData; - - bytes32[] memory _keyTuple = new bytes32[](0); - - StoreSwitch.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData); - } - - /** - * @notice Set the full data using individual values. - */ - function _set(address erc721, address erc1155) internal { - bytes memory _staticData = encodeStatic(erc721, erc1155); - - EncodedLengths _encodedLengths; - bytes memory _dynamicData; - - bytes32[] memory _keyTuple = new bytes32[](0); - - StoreCore.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData, _fieldLayout); - } - - /** - * @notice Set the full data using the data struct. - */ - function set(TestConfigData memory _table) internal { - bytes memory _staticData = encodeStatic(_table.erc721, _table.erc1155); - - EncodedLengths _encodedLengths; - bytes memory _dynamicData; - - bytes32[] memory _keyTuple = new bytes32[](0); - - StoreSwitch.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData); - } - - /** - * @notice Set the full data using the data struct. - */ - function _set(TestConfigData memory _table) internal { - bytes memory _staticData = encodeStatic(_table.erc721, _table.erc1155); - - EncodedLengths _encodedLengths; - bytes memory _dynamicData; - - bytes32[] memory _keyTuple = new bytes32[](0); - - StoreCore.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData, _fieldLayout); - } - - /** - * @notice Decode the tightly packed blob of static data using this table's field layout. - */ - function decodeStatic(bytes memory _blob) internal pure returns (address erc721, address erc1155) { - erc721 = (address(Bytes.getBytes20(_blob, 0))); - - erc1155 = (address(Bytes.getBytes20(_blob, 20))); - } - - /** - * @notice Decode the tightly packed blobs using this table's field layout. - * @param _staticData Tightly packed static fields. - * - * - */ - function decode( - bytes memory _staticData, - EncodedLengths, - bytes memory - ) internal pure returns (TestConfigData memory _table) { - (_table.erc721, _table.erc1155) = decodeStatic(_staticData); - } - - /** - * @notice Delete all data for given keys. - */ - function deleteRecord() internal { - bytes32[] memory _keyTuple = new bytes32[](0); - - StoreSwitch.deleteRecord(_tableId, _keyTuple); - } - - /** - * @notice Delete all data for given keys. - */ - function _deleteRecord() internal { - bytes32[] memory _keyTuple = new bytes32[](0); - - StoreCore.deleteRecord(_tableId, _keyTuple, _fieldLayout); - } - - /** - * @notice Tightly pack static (fixed length) data using this table's schema. - * @return The static data, encoded into a sequence of bytes. - */ - function encodeStatic(address erc721, address erc1155) internal pure returns (bytes memory) { - return abi.encodePacked(erc721, erc1155); - } - - /** - * @notice Encode all of a record's fields. - * @return The static (fixed length) data, encoded into a sequence of bytes. - * @return The lengths of the dynamic fields (packed into a single bytes32 value). - * @return The dynamic (variable length) data, encoded into a sequence of bytes. - */ - function encode(address erc721, address erc1155) internal pure returns (bytes memory, EncodedLengths, bytes memory) { - bytes memory _staticData = encodeStatic(erc721, erc1155); - - EncodedLengths _encodedLengths; - bytes memory _dynamicData; - - return (_staticData, _encodedLengths, _dynamicData); - } - - /** - * @notice Encode keys as a bytes32 array using this table's field layout. - */ - function encodeKeyTuple() internal pure returns (bytes32[] memory) { - bytes32[] memory _keyTuple = new bytes32[](0); - - return _keyTuple; - } -} diff --git a/packages/contracts/lib/ERC1155-puppet/tables/TotalSupply.sol b/packages/contracts/lib/ERC1155-puppet/tables/TotalSupply.sol deleted file mode 100644 index aca5ea6f8..000000000 --- a/packages/contracts/lib/ERC1155-puppet/tables/TotalSupply.sol +++ /dev/null @@ -1,318 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity >=0.8.24; - -/* Autogenerated file. Do not edit manually. */ - -// Import store internals -import { IStore } from "@latticexyz/store/src/IStore.sol"; -import { StoreSwitch } from "@latticexyz/store/src/StoreSwitch.sol"; -import { StoreCore } from "@latticexyz/store/src/StoreCore.sol"; -import { Bytes } from "@latticexyz/store/src/Bytes.sol"; -import { Memory } from "@latticexyz/store/src/Memory.sol"; -import { SliceLib } from "@latticexyz/store/src/Slice.sol"; -import { EncodeArray } from "@latticexyz/store/src/tightcoder/EncodeArray.sol"; -import { FieldLayout } from "@latticexyz/store/src/FieldLayout.sol"; -import { Schema } from "@latticexyz/store/src/Schema.sol"; -import { EncodedLengths, EncodedLengthsLib } from "@latticexyz/store/src/EncodedLengths.sol"; -import { ResourceId } from "@latticexyz/store/src/ResourceId.sol"; - -struct TotalSupplyData { - uint256 currentSupply; - uint256 totalSupply; -} - -library TotalSupply { - FieldLayout constant _fieldLayout = - FieldLayout.wrap(0x0040020020200000000000000000000000000000000000000000000000000000); - - // Hex-encoded key schema of (uint256) - Schema constant _keySchema = Schema.wrap(0x002001001f000000000000000000000000000000000000000000000000000000); - // Hex-encoded value schema of (uint256, uint256) - Schema constant _valueSchema = Schema.wrap(0x004002001f1f0000000000000000000000000000000000000000000000000000); - - /** - * @notice Get the table's key field names. - * @return keyNames An array of strings with the names of key fields. - */ - function getKeyNames() internal pure returns (string[] memory keyNames) { - keyNames = new string[](1); - keyNames[0] = "tokenId"; - } - - /** - * @notice Get the table's value field names. - * @return fieldNames An array of strings with the names of value fields. - */ - function getFieldNames() internal pure returns (string[] memory fieldNames) { - fieldNames = new string[](2); - fieldNames[0] = "currentSupply"; - fieldNames[1] = "totalSupply"; - } - - /** - * @notice Register the table with its config. - */ - function register(ResourceId _tableId) internal { - StoreSwitch.registerTable(_tableId, _fieldLayout, _keySchema, _valueSchema, getKeyNames(), getFieldNames()); - } - - /** - * @notice Register the table with its config. - */ - function _register(ResourceId _tableId) internal { - StoreCore.registerTable(_tableId, _fieldLayout, _keySchema, _valueSchema, getKeyNames(), getFieldNames()); - } - - /** - * @notice Get currentSupply. - */ - function getCurrentSupply(ResourceId _tableId, uint256 tokenId) internal view returns (uint256 currentSupply) { - bytes32[] memory _keyTuple = new bytes32[](1); - _keyTuple[0] = bytes32(uint256(tokenId)); - - bytes32 _blob = StoreSwitch.getStaticField(_tableId, _keyTuple, 0, _fieldLayout); - return (uint256(bytes32(_blob))); - } - - /** - * @notice Get currentSupply. - */ - function _getCurrentSupply(ResourceId _tableId, uint256 tokenId) internal view returns (uint256 currentSupply) { - bytes32[] memory _keyTuple = new bytes32[](1); - _keyTuple[0] = bytes32(uint256(tokenId)); - - bytes32 _blob = StoreCore.getStaticField(_tableId, _keyTuple, 0, _fieldLayout); - return (uint256(bytes32(_blob))); - } - - /** - * @notice Set currentSupply. - */ - function setCurrentSupply(ResourceId _tableId, uint256 tokenId, uint256 currentSupply) internal { - bytes32[] memory _keyTuple = new bytes32[](1); - _keyTuple[0] = bytes32(uint256(tokenId)); - - StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((currentSupply)), _fieldLayout); - } - - /** - * @notice Set currentSupply. - */ - function _setCurrentSupply(ResourceId _tableId, uint256 tokenId, uint256 currentSupply) internal { - bytes32[] memory _keyTuple = new bytes32[](1); - _keyTuple[0] = bytes32(uint256(tokenId)); - - StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((currentSupply)), _fieldLayout); - } - - /** - * @notice Get totalSupply. - */ - function getTotalSupply(ResourceId _tableId, uint256 tokenId) internal view returns (uint256 totalSupply) { - bytes32[] memory _keyTuple = new bytes32[](1); - _keyTuple[0] = bytes32(uint256(tokenId)); - - bytes32 _blob = StoreSwitch.getStaticField(_tableId, _keyTuple, 1, _fieldLayout); - return (uint256(bytes32(_blob))); - } - - /** - * @notice Get totalSupply. - */ - function _getTotalSupply(ResourceId _tableId, uint256 tokenId) internal view returns (uint256 totalSupply) { - bytes32[] memory _keyTuple = new bytes32[](1); - _keyTuple[0] = bytes32(uint256(tokenId)); - - bytes32 _blob = StoreCore.getStaticField(_tableId, _keyTuple, 1, _fieldLayout); - return (uint256(bytes32(_blob))); - } - - /** - * @notice Set totalSupply. - */ - function setTotalSupply(ResourceId _tableId, uint256 tokenId, uint256 totalSupply) internal { - bytes32[] memory _keyTuple = new bytes32[](1); - _keyTuple[0] = bytes32(uint256(tokenId)); - - StoreSwitch.setStaticField(_tableId, _keyTuple, 1, abi.encodePacked((totalSupply)), _fieldLayout); - } - - /** - * @notice Set totalSupply. - */ - function _setTotalSupply(ResourceId _tableId, uint256 tokenId, uint256 totalSupply) internal { - bytes32[] memory _keyTuple = new bytes32[](1); - _keyTuple[0] = bytes32(uint256(tokenId)); - - StoreCore.setStaticField(_tableId, _keyTuple, 1, abi.encodePacked((totalSupply)), _fieldLayout); - } - - /** - * @notice Get the full data. - */ - function get(ResourceId _tableId, uint256 tokenId) internal view returns (TotalSupplyData memory _table) { - bytes32[] memory _keyTuple = new bytes32[](1); - _keyTuple[0] = bytes32(uint256(tokenId)); - - (bytes memory _staticData, EncodedLengths _encodedLengths, bytes memory _dynamicData) = StoreSwitch.getRecord( - _tableId, - _keyTuple, - _fieldLayout - ); - return decode(_staticData, _encodedLengths, _dynamicData); - } - - /** - * @notice Get the full data. - */ - function _get(ResourceId _tableId, uint256 tokenId) internal view returns (TotalSupplyData memory _table) { - bytes32[] memory _keyTuple = new bytes32[](1); - _keyTuple[0] = bytes32(uint256(tokenId)); - - (bytes memory _staticData, EncodedLengths _encodedLengths, bytes memory _dynamicData) = StoreCore.getRecord( - _tableId, - _keyTuple, - _fieldLayout - ); - return decode(_staticData, _encodedLengths, _dynamicData); - } - - /** - * @notice Set the full data using individual values. - */ - function set(ResourceId _tableId, uint256 tokenId, uint256 currentSupply, uint256 totalSupply) internal { - bytes memory _staticData = encodeStatic(currentSupply, totalSupply); - - EncodedLengths _encodedLengths; - bytes memory _dynamicData; - - bytes32[] memory _keyTuple = new bytes32[](1); - _keyTuple[0] = bytes32(uint256(tokenId)); - - StoreSwitch.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData); - } - - /** - * @notice Set the full data using individual values. - */ - function _set(ResourceId _tableId, uint256 tokenId, uint256 currentSupply, uint256 totalSupply) internal { - bytes memory _staticData = encodeStatic(currentSupply, totalSupply); - - EncodedLengths _encodedLengths; - bytes memory _dynamicData; - - bytes32[] memory _keyTuple = new bytes32[](1); - _keyTuple[0] = bytes32(uint256(tokenId)); - - StoreCore.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData, _fieldLayout); - } - - /** - * @notice Set the full data using the data struct. - */ - function set(ResourceId _tableId, uint256 tokenId, TotalSupplyData memory _table) internal { - bytes memory _staticData = encodeStatic(_table.currentSupply, _table.totalSupply); - - EncodedLengths _encodedLengths; - bytes memory _dynamicData; - - bytes32[] memory _keyTuple = new bytes32[](1); - _keyTuple[0] = bytes32(uint256(tokenId)); - - StoreSwitch.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData); - } - - /** - * @notice Set the full data using the data struct. - */ - function _set(ResourceId _tableId, uint256 tokenId, TotalSupplyData memory _table) internal { - bytes memory _staticData = encodeStatic(_table.currentSupply, _table.totalSupply); - - EncodedLengths _encodedLengths; - bytes memory _dynamicData; - - bytes32[] memory _keyTuple = new bytes32[](1); - _keyTuple[0] = bytes32(uint256(tokenId)); - - StoreCore.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData, _fieldLayout); - } - - /** - * @notice Decode the tightly packed blob of static data using this table's field layout. - */ - function decodeStatic(bytes memory _blob) internal pure returns (uint256 currentSupply, uint256 totalSupply) { - currentSupply = (uint256(Bytes.getBytes32(_blob, 0))); - - totalSupply = (uint256(Bytes.getBytes32(_blob, 32))); - } - - /** - * @notice Decode the tightly packed blobs using this table's field layout. - * @param _staticData Tightly packed static fields. - * - * - */ - function decode( - bytes memory _staticData, - EncodedLengths, - bytes memory - ) internal pure returns (TotalSupplyData memory _table) { - (_table.currentSupply, _table.totalSupply) = decodeStatic(_staticData); - } - - /** - * @notice Delete all data for given keys. - */ - function deleteRecord(ResourceId _tableId, uint256 tokenId) internal { - bytes32[] memory _keyTuple = new bytes32[](1); - _keyTuple[0] = bytes32(uint256(tokenId)); - - StoreSwitch.deleteRecord(_tableId, _keyTuple); - } - - /** - * @notice Delete all data for given keys. - */ - function _deleteRecord(ResourceId _tableId, uint256 tokenId) internal { - bytes32[] memory _keyTuple = new bytes32[](1); - _keyTuple[0] = bytes32(uint256(tokenId)); - - StoreCore.deleteRecord(_tableId, _keyTuple, _fieldLayout); - } - - /** - * @notice Tightly pack static (fixed length) data using this table's schema. - * @return The static data, encoded into a sequence of bytes. - */ - function encodeStatic(uint256 currentSupply, uint256 totalSupply) internal pure returns (bytes memory) { - return abi.encodePacked(currentSupply, totalSupply); - } - - /** - * @notice Encode all of a record's fields. - * @return The static (fixed length) data, encoded into a sequence of bytes. - * @return The lengths of the dynamic fields (packed into a single bytes32 value). - * @return The dynamic (variable length) data, encoded into a sequence of bytes. - */ - function encode( - uint256 currentSupply, - uint256 totalSupply - ) internal pure returns (bytes memory, EncodedLengths, bytes memory) { - bytes memory _staticData = encodeStatic(currentSupply, totalSupply); - - EncodedLengths _encodedLengths; - bytes memory _dynamicData; - - return (_staticData, _encodedLengths, _dynamicData); - } - - /** - * @notice Encode keys as a bytes32 array using this table's field layout. - */ - function encodeKeyTuple(uint256 tokenId) internal pure returns (bytes32[] memory) { - bytes32[] memory _keyTuple = new bytes32[](1); - _keyTuple[0] = bytes32(uint256(tokenId)); - - return _keyTuple; - } -} diff --git a/packages/contracts/lib/ERC1155-puppet/utils.sol b/packages/contracts/lib/ERC1155-puppet/utils.sol deleted file mode 100644 index a191baba5..000000000 --- a/packages/contracts/lib/ERC1155-puppet/utils.sol +++ /dev/null @@ -1,48 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.20; - -import {ResourceId} from "@latticexyz/store/src/ResourceId.sol"; -import {RESOURCE_TABLE} from "@latticexyz/store/src/storeResourceTypes.sol"; - -import {WorldResourceIdLib} from "@latticexyz/world/src/WorldResourceId.sol"; -import {RESOURCE_SYSTEM} from "@latticexyz/world/src/worldResourceTypes.sol"; - -import { - ERC1155_SYSTEM_NAME, - TOTAL_SUPPLY_NAME, - METADATA_NAME, - ERC1155URISTORAGE_SYSTEM_NAME, - OPERATOR_APPROVAL_NAME, - OWNERS_NAME, - TOKEN_URISTORAGE_NAME -} from "./constants.sol"; -//solhint-disable - -function _erc1155URIStorageTableId(bytes14 namespace) pure returns (ResourceId) { - return WorldResourceIdLib.encode({typeId: RESOURCE_TABLE, namespace: namespace, name: TOKEN_URISTORAGE_NAME}); -} - -function _metadataTableId(bytes14 namespace) pure returns (ResourceId) { - return WorldResourceIdLib.encode({typeId: RESOURCE_TABLE, namespace: namespace, name: METADATA_NAME}); -} - -function _operatorApprovalTableId(bytes14 namespace) pure returns (ResourceId) { - return WorldResourceIdLib.encode({typeId: RESOURCE_TABLE, namespace: namespace, name: OPERATOR_APPROVAL_NAME}); -} - -function _ownersTableId(bytes14 namespace) pure returns (ResourceId) { - return WorldResourceIdLib.encode({typeId: RESOURCE_TABLE, namespace: namespace, name: OWNERS_NAME}); -} - -function _totalSupplyTableId(bytes14 namespace) pure returns (ResourceId) { - return WorldResourceIdLib.encode({typeId: RESOURCE_TABLE, namespace: namespace, name: TOTAL_SUPPLY_NAME}); -} - -function _erc1155SystemId(bytes14 namespace) pure returns (ResourceId) { - return WorldResourceIdLib.encode({typeId: RESOURCE_SYSTEM, namespace: namespace, name: ERC1155_SYSTEM_NAME}); -} - -function _erc1155URIStorageSystemId(bytes14 namespace) pure returns (ResourceId) { - return - WorldResourceIdLib.encode({typeId: RESOURCE_SYSTEM, namespace: namespace, name: ERC1155URISTORAGE_SYSTEM_NAME}); -} From 93788971a2ea4098f6b031bfe11ce9829f880c04 Mon Sep 17 00:00:00 2001 From: MrDeadCe11 Date: Sat, 22 Jun 2024 00:35:46 -0500 Subject: [PATCH 5/7] updated gitignore again --- packages/contracts/.gitignore | 2 +- packages/contracts/.gitmodules | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) delete mode 100644 packages/contracts/.gitmodules diff --git a/packages/contracts/.gitignore b/packages/contracts/.gitignore index 3919f765d..df828261b 100644 --- a/packages/contracts/.gitignore +++ b/packages/contracts/.gitignore @@ -5,7 +5,7 @@ node_modules/ bindings/ artifacts/ broadcast/ -lib/ +lib/* # Ignore MUD deploy artifacts deploys/**/*.json diff --git a/packages/contracts/.gitmodules b/packages/contracts/.gitmodules deleted file mode 100644 index 8d1427b1f..000000000 --- a/packages/contracts/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "lib/ERC1155-puppet"] - path = lib/ERC1155-puppet - url = https://github.com/MrDeadCe11/ERC1155-puppet From 139b0ca4843ec1e4933377f693a81c2d9ac8574d Mon Sep 17 00:00:00 2001 From: MrDeadCe11 Date: Sat, 22 Jun 2024 00:36:45 -0500 Subject: [PATCH 6/7] gitmodules --- packages/contracts/.gitmodules | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 packages/contracts/.gitmodules diff --git a/packages/contracts/.gitmodules b/packages/contracts/.gitmodules new file mode 100644 index 000000000..86e891039 --- /dev/null +++ b/packages/contracts/.gitmodules @@ -0,0 +1,3 @@ +[submodule "lib/ERC1155-puppet"] +path = lib/ERC1155-puppet +url = https://github.com/MrDeadCe11/ERC1155-puppet From f48dc00510abb0d20dfe12d13614bfa87c3201e8 Mon Sep 17 00:00:00 2001 From: MrDeadCe11 Date: Sat, 22 Jun 2024 00:37:07 -0500 Subject: [PATCH 7/7] forge install: ERC1155-puppet --- .gitmodules | 3 +++ packages/contracts/lib/ERC1155-puppet | 1 + 2 files changed, 4 insertions(+) create mode 100644 .gitmodules create mode 160000 packages/contracts/lib/ERC1155-puppet diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 000000000..3fc02732f --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "packages/contracts/lib/ERC1155-puppet"] + path = packages/contracts/lib/ERC1155-puppet + url = https://github.com/MrDeadCe11/ERC1155-puppet diff --git a/packages/contracts/lib/ERC1155-puppet b/packages/contracts/lib/ERC1155-puppet new file mode 160000 index 000000000..3988bc4d4 --- /dev/null +++ b/packages/contracts/lib/ERC1155-puppet @@ -0,0 +1 @@ +Subproject commit 3988bc4d4ec1cfcb32f2cefcec5475b74951e77c