I have created a contract which takes care of buy and sell of NFT's or ERC721 tokens. So i have approved the contract to sell the NFT. Now my questions are:-

  1. Once I have transferred the contract to a buyer can the previous owner have the access to it as well or is it like after transfer the approval is also removed from the owner? If not then how can I revoke their access or maybe disapprove the previous owner after selling an ERC721 token. Code for transfer:-

    IERC721(nftContractAddress).transferFrom( idMarketItem[itemId].owner, msg.sender, tokenId );

  2. How can I disapprove a buy/sell contract from its ownership on an NFT contract? Is it the following code that will disapprove the contract:-

    IERC721(nftContractAddress).setApprovalForAll( address(this), false );

1 Answer 1

  1. Once you transfer an NFT, the old owner does not have access to it any more.
  2. Approving and revoking user's allowances can only be done by the user, this cannot be done on behalf of them. So if users have to set an approval to your marketplace contract and they no longer wish to keep that allowance, they need to revoke it themselves. Revoke.cash, a website I created, does exactly that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.