Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Block ERC721 transfers #67

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion src/ERC4973.sol
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ abstract contract ERC4973 is EIP712, ERC721URIStorage, IERC4973 {
string memory uri = decodeURI(metadata);
_safeMint(msg.sender, tokenId);
_setTokenURI(tokenId, uri);
transferFrom(msg.sender, to, tokenId);
_transfer(msg.sender, to, tokenId);
_usedHashes.set(tokenId);
return tokenId;
}
Expand Down Expand Up @@ -110,4 +110,22 @@ abstract contract ERC4973 is EIP712, ERC721URIStorage, IERC4973 {
);
return _hashTypedDataV4(structHash);
}

// Block the ERC721 transfers

function transferFrom(address, address, uint256) public virtual override {
revert("Not implemented");
}

function safeTransferFrom(address, address, uint256) public virtual override {
revert("Not implemented");
}

function safeTransferFrom(address, address, uint256, bytes memory)
public
virtual
override
{
revert("Not implemented");
}
}
33 changes: 33 additions & 0 deletions src/ERC4973.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -358,4 +358,37 @@ contract ERC4973Test is Test, ERC721Holder {
vm.expectRevert(bytes("take: cannot take from self"));
aa.take(address(abt), from, bytes(tokenURI), signature);
}

function testTryTransferFromABT() public {
address to = address(approver);
bytes memory signature;

uint256 tokenId = abt.give(to, bytes(tokenURI), signature);

vm.prank(to);
vm.expectRevert(bytes("Not implemented"));
abt.transferFrom(to, address(abt), tokenId);
}

function testTrySafeTransferFromABT() public {
address to = address(approver);
bytes memory signature;

uint256 tokenId = abt.give(to, bytes(tokenURI), signature);

vm.prank(to);
vm.expectRevert(bytes("Not implemented"));
abt.safeTransferFrom(to, address(abt), tokenId);
}

function testTrySafeTransferFromWithDataABT() public {
address to = address(approver);
bytes memory signature;

uint256 tokenId = abt.give(to, bytes(tokenURI), signature);

vm.prank(to);
vm.expectRevert(bytes("Not implemented"));
abt.safeTransferFrom(to, address(abt), tokenId, "");
}
}