Skip to content

Commit

Permalink
fix(world-modules): use requireAccess for token mint and burn
Browse files Browse the repository at this point in the history
  • Loading branch information
dk1a committed Apr 30, 2024
1 parent 14cb092 commit 344a649
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand All @@ -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));
Expand Down Expand Up @@ -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());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand All @@ -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, "");
}

Expand All @@ -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);
}

Expand All @@ -190,7 +190,7 @@ contract ERC721System is IERC721Mintable, System, PuppetMaster {
* Emits a {Transfer} event.
*/
function burn(uint256 tokenId) public {
_requireOwner();
_requireAccess();
_burn(tokenId);
}

Expand Down Expand Up @@ -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());
}
}

0 comments on commit 344a649

Please sign in to comment.