From d49d5e893e091d2292b031012997fca07d8ddf1a Mon Sep 17 00:00:00 2001 From: donosonaumczuk Date: Fri, 2 Feb 2024 17:50:02 -0300 Subject: [PATCH] feat: transferFromKeepingDelegates implemented at LensProfiles file --- contracts/base/LensProfiles.sol | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/contracts/base/LensProfiles.sol b/contracts/base/LensProfiles.sol index 9c88b49..0b00429 100644 --- a/contracts/base/LensProfiles.sol +++ b/contracts/base/LensProfiles.sol @@ -129,23 +129,22 @@ abstract contract LensProfiles is LensBaseERC721, ERC2981CollectionRoyalties, IL LensBaseERC721.supportsInterface(interfaceId) || ERC2981CollectionRoyalties.supportsInterface(interfaceId); } - /** - * @dev See {ILensERC721-transferFromWithData}. - */ function transferFromKeepingDelegates(address from, address to, uint256 tokenId) external { //solhint-disable-next-line max-line-length if (!_isApprovedOrOwner(msg.sender, tokenId)) { revert Errors.NotOwnerOrApproved(); } - if (!StorageLib.profileCreatorWhitelisted()[from]) { - // Delegates can be maintained on transfer only during mint tx (block) for onboarding UX purposes. + if (!StorageLib.profileCreatorWhitelisted()[msg.sender]) { + // Delegates can be maintained on transfers only when executed by whitelisted profile creators, which are + // trusted entities, for the sake of a better onboarding UX. revert Errors.NotAllowed(); } if (ownerOf(tokenId) != from) { revert Errors.InvalidOwner(); } + if (to == address(0)) { revert Errors.InvalidParameter(); } @@ -156,10 +155,11 @@ abstract contract LensProfiles is LensBaseERC721, ERC2981CollectionRoyalties, IL _approve(address(0), tokenId); unchecked { - --_balances[from]; - ++_balances[to]; + --StorageLib.balances()[from]; + ++StorageLib.balances()[to]; } - _tokenData[tokenId].owner = to; + + StorageLib.getTokenData(tokenId).owner = to; emit Transfer(from, to, tokenId); }