1

If I have contract A and contract B (which follows erc721 standards), both have implemented the OnERC721Received function, how does the transfer of any tokenId take place atomically?

If I have a token with tokenId X (uint256) in contract A and owned by Y( address) and the contract B also has a minted token with the same tokenId X, will transferring that token from A to B takes place, if yes doesn't the tokenId collide? how does it work under the hood, does it change the owner to contract B or mint a new token in contract B and burn from A?

Any help would be really appreciated!

1

The transfer won't collide even the tokenID is the same between two different contracts.

In fact, whenever we talk about "transferring" tokens, this means updating the balance within the token contract and assigning a new ownership (after the approval). This is an example from an ERC721 implementation of the mapping where the ownership is updated after a transfer:

// Mapping from token ID to owner address
mapping (uint256 => address) private _owners;

Therefore, in your example, a transfer of tokenId X from contract A to contract B will just update the ownership in contract A for tokenId X with the contract B address.

2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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