I've some question about ERC721 processing. I'd like to make an user to give aproval to an external smart contract for transfering one of its NFT.
To do it I'm using approve(to, tokenId)
.
Then, in some situation, the contract should be able to revoke its own autorisation by calling approve(address(0), tokenId)
(The NFT owner calls a cancel method from the smart contract that perform some operations and revokes its own permission on the token)
At this step, I got the following error: ERC721: approve caller is not owner nor approved
My understanding is that in order to make the contract able to call approve, the NFT owner should have approved it with setApprovalForAll(operator, _approved)
?
What about others NFT from the same collection owned by the user ? Would the contract be able to manage them too ?
I'd like to limit as much as possible the smart contract's permissions and stick to a very specific NFT transfer (with its token_id)
Can someone enlighten me on the right way to do it ?