From 344a649ef2611a5c1b546e8927c431021429f075 Mon Sep 17 00:00:00 2001 From: dk1a Date: Tue, 30 Apr 2024 23:11:29 +0300 Subject: [PATCH] fix(world-modules): use requireAccess for token mint and burn --- .../src/modules/erc20-puppet/ERC20System.sol | 8 ++++---- .../src/modules/erc721-puppet/ERC721System.sol | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/world-modules/src/modules/erc20-puppet/ERC20System.sol b/packages/world-modules/src/modules/erc20-puppet/ERC20System.sol index c28d5cedb4..4c7eed67e8 100644 --- a/packages/world-modules/src/modules/erc20-puppet/ERC20System.sol +++ b/packages/world-modules/src/modules/erc20-puppet/ERC20System.sol @@ -144,7 +144,7 @@ contract ERC20System is System, IERC20Mintable, PuppetMaster { */ function mint(address account, uint256 value) public { // Require the caller to own the namespace - _requireOwner(); + _requireAccess(); if (account == address(0)) { revert ERC20InvalidReceiver(address(0)); @@ -163,7 +163,7 @@ contract ERC20System is System, IERC20Mintable, PuppetMaster { */ function burn(address account, uint256 value) public { // Require the caller to own the namespace - _requireOwner(); + _requireAccess(); if (account == address(0)) { revert ERC20InvalidSender(address(0)); @@ -280,7 +280,7 @@ contract ERC20System is System, IERC20Mintable, PuppetMaster { return systemId.getNamespace(); } - function _requireOwner() internal view { - AccessControlLib.requireOwner(SystemRegistry.get(address(this)), _msgSender()); + function _requireAccess() internal view { + AccessControlLib.requireAccess(SystemRegistry.get(address(this)), _msgSender()); } } diff --git a/packages/world-modules/src/modules/erc721-puppet/ERC721System.sol b/packages/world-modules/src/modules/erc721-puppet/ERC721System.sol index bb8c58f16a..9c5f8eb3ba 100644 --- a/packages/world-modules/src/modules/erc721-puppet/ERC721System.sol +++ b/packages/world-modules/src/modules/erc721-puppet/ERC721System.sol @@ -150,7 +150,7 @@ contract ERC721System is IERC721Mintable, System, PuppetMaster { * Emits a {Transfer} event. */ function mint(address to, uint256 tokenId) public virtual { - _requireOwner(); + _requireAccess(); _mint(to, tokenId); } @@ -166,7 +166,7 @@ contract ERC721System is IERC721Mintable, System, PuppetMaster { * Emits a {Transfer} event. */ function safeMint(address to, uint256 tokenId) public { - _requireOwner(); + _requireAccess(); _safeMint(to, tokenId, ""); } @@ -175,7 +175,7 @@ contract ERC721System is IERC721Mintable, System, PuppetMaster { * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function safeMint(address to, uint256 tokenId, bytes memory data) public virtual { - _requireOwner(); + _requireAccess(); _safeMint(to, tokenId, data); } @@ -190,7 +190,7 @@ contract ERC721System is IERC721Mintable, System, PuppetMaster { * Emits a {Transfer} event. */ function burn(uint256 tokenId) public { - _requireOwner(); + _requireAccess(); _burn(tokenId); } @@ -525,7 +525,7 @@ contract ERC721System is IERC721Mintable, System, PuppetMaster { return systemId.getNamespace(); } - function _requireOwner() internal view { - AccessControlLib.requireOwner(SystemRegistry.get(address(this)), _msgSender()); + function _requireAccess() internal view { + AccessControlLib.requireAccess(SystemRegistry.get(address(this)), _msgSender()); } }