Best practice to assign NFT ownership by contract role (ERC721 Ownable)

Hi there! So far we know the contract deployer is the Owner and can mint NFTs for his/her address.

The use case I'm thinking about is when the owner transfers the contract through transferOwnership the NFTs still owned by the deployer are transferred with the contract.
Also, if an NFT was transferred to another address, that address remains the owner of that token.

Should I implement a function that checks who is the owner and receiver and transfers all the NFTs when transferOwnership is triggered?

Or is there a better way to assign the tokens/contract ownership, based on roles?

Thanks in advance!

So you mean, if Alice deploys contract, and then she mint herself 10 ERC721 tokens, next, she transfers the ownership to Bob, and at the same time, Bob should be the new owner of the 10 tokens that Alice owns, right?
I think it is ok if you want to do so, the only question is that if she owns many 721 tokens, maybe 1,000 tokens, so if you want to transfer them at one time, maybe it will need lots of gas.
And maybe you will need this contract, openzeppelin-contracts/ERC721Enumerable.sol

So if Alice transfers one 721 token to Bob, now, both of them own this token, right?
For now, the relationship is defined as mapping(uint256 => address) private _owners; this maps from token ID to owner address, so you need to redefine the relationship, maybe it can be mapping(uint256 => mapping(address => bool)).

Yeah, you can.

1 Like

Thanks for the reply!

Exactly! I'm thinking about customizing various things related to ERC721, since I'm trying to build something more than a platform, than a single use-case, so trying to think about many scenarios.

Haven't implemented this scenario yet, but will do so in the upcoming week. Will be checking the link provided. :pray: