diff --git a/.changeset/dull-otters-smash.md b/.changeset/dull-otters-smash.md new file mode 100644 index 0000000000..d53d909197 --- /dev/null +++ b/.changeset/dull-otters-smash.md @@ -0,0 +1,5 @@ +--- +"@latticexyz/world-modules": patch +--- + +ERC20 and ERC721 implementations now always register the token namespace, instead of checking if it has already been registered. This prevents issues with registering the namespace beforehand, namely that only the owner of a system can create a puppet for it. diff --git a/packages/world-modules/src/modules/erc20-puppet/ERC20Module.sol b/packages/world-modules/src/modules/erc20-puppet/ERC20Module.sol index 3fce7e97cd..4a4c84e595 100644 --- a/packages/world-modules/src/modules/erc20-puppet/ERC20Module.sol +++ b/packages/world-modules/src/modules/erc20-puppet/ERC20Module.sol @@ -75,9 +75,7 @@ contract ERC20ModuleRegistrationLibrary { function register(IBaseWorld world, bytes14 namespace) public { // Register the namespace if it doesn't exist yet ResourceId tokenNamespace = WorldResourceIdLib.encodeNamespace(namespace); - if (!ResourceIds.getExists(tokenNamespace)) { - world.registerNamespace(tokenNamespace); - } + world.registerNamespace(tokenNamespace); // Register the tables Allowances.register(_allowancesTableId(namespace)); diff --git a/packages/world-modules/src/modules/erc721-puppet/ERC721Module.sol b/packages/world-modules/src/modules/erc721-puppet/ERC721Module.sol index 78e7c5ef91..33cbb8d858 100644 --- a/packages/world-modules/src/modules/erc721-puppet/ERC721Module.sol +++ b/packages/world-modules/src/modules/erc721-puppet/ERC721Module.sol @@ -79,9 +79,7 @@ contract ERC721ModuleRegistrationLibrary { function register(IBaseWorld world, bytes14 namespace) public { // Register the namespace if it doesn't exist yet ResourceId tokenNamespace = WorldResourceIdLib.encodeNamespace(namespace); - if (!ResourceIds.getExists(tokenNamespace)) { - world.registerNamespace(tokenNamespace); - } + world.registerNamespace(tokenNamespace); // Register the tables OperatorApproval.register(_operatorApprovalTableId(namespace));