mirror of
https://github.com/lens-protocol/core.git
synced 2026-01-10 22:58:08 -05:00
fix: zero token approveFollow allowed as a way to clear approval
This commit is contained in:
@@ -137,8 +137,8 @@ contract FollowNFT is HubRestricted, LensBaseERC721, ERC2981CollectionRoyalties,
|
||||
if (!IERC721Timestamped(HUB).exists(followerProfileId)) {
|
||||
revert Errors.TokenDoesNotExist();
|
||||
}
|
||||
address followTokenOwner = _unsafeOwnerOf(followTokenId);
|
||||
if (followTokenOwner == address(0)) {
|
||||
// `followTokenId` allowed to be zero as a way to clear the approval.
|
||||
if (followTokenId != 0 && _unsafeOwnerOf(followTokenId) == address(0)) {
|
||||
revert OnlyWrappedFollowTokens();
|
||||
}
|
||||
if (_isApprovedOrOwner(msg.sender, followTokenId)) {
|
||||
|
||||
@@ -1643,6 +1643,7 @@ contract FollowNFTTest is BaseTest, LensBaseERC721Test {
|
||||
}
|
||||
|
||||
function testCannotApproveFollowForUnexistentFollowToken(uint256 unexistentFollowTokenId) public {
|
||||
vm.assume(unexistentFollowTokenId != 0);
|
||||
vm.assume(!followNFT.exists(unexistentFollowTokenId));
|
||||
vm.assume(followNFT.getFollowerProfileId(unexistentFollowTokenId) == 0);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user