Skip to content

Commit d2d9b33

Browse files
committed
Fix unauthorized transfer check in ERC404NullOwnerCappedUpgradeable contract
- Updated the `_transferERC721` function to revert with `Unauthorized()` if the `from_` address does not match the owner of the token, enhancing security and ownership validation during transfers.
1 parent 45e7482 commit d2d9b33

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

contracts/src/ERC404NullOwnerCappedUpgradeable.sol

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -373,11 +373,11 @@ abstract contract ERC404NullOwnerCappedUpgradeable is
373373
function _transferERC721(address from_, address to_, uint256 id_) internal virtual {
374374
TokenStorage storage $ = _getS();
375375
TokenData storage t = $.tokens[id_];
376-
377-
if (!t.exists) {
378-
revert NotFound();
376+
377+
if (from_ != ownerOf(id_)) {
378+
revert Unauthorized();
379379
}
380-
380+
381381
if (from_ != address(0)) {
382382
// Clear approval
383383
delete $.getApproved[id_];

0 commit comments

Comments
 (0)