Lock a Token / NFT from reselling meanwhile owner wants it

Hello everyone,

I have a business process where I want the NFT owner to been able to let them "lock for selling" their tokens to get some benefits in our environment.
I put in a check in the beforeTransfer method, if a token is "locked".

Is this a feasible way to do so? Testing a bit with Opensea, seems that this has some issues with that.
Is there a better way? What am I missing?

Thanks in advance.

Please take a look at our ERC721Pausable contract, I think this does what you are trying to accomplish by instead of locking it it pauses it.

In case this is not what you need please include the locking code you came up with, and explain why are you saying it didn't work.


indeed, its like the Pausable but on token level, not for the entire contract:

function _beforeTokenTransfer(
        address from,
        address to,
        uint256 tokenId
        override(ERC721Upgradeable, ERC721EnumerableUpgradeable)
        require(!(_exists(tokenId) && isLocked(tokenId)), "Token locked!"); //here I check the locking
        super._beforeTokenTransfer(from, to, tokenId);

I think @JulissaDantes is right you can use the pausable contract to do that...

I tested pausable and then the entire contract is paused so ALL tokens, not specific once.