Skip to content

How getApproved return correct address to correct marketplace?? #1530

Discussion options

You must be logged in to vote

Hii, _tokenApprovals is mapping used to track approvals for a particular token ID and its 1-1 it means that at particular instance of time there can be only one approved address(Marketplace)....So if you first approve A and then approve B the address of marketplcae B will override the _tokenApprovals mapping for that tokenId...And when you call getApproved(tokenId) function it returns this _tokenApprovals[tokenId] in our case it will return address of B
You can take a look at this function implementd here : https://github.com/OpenZeppelin/openzeppelin-contracts/blob/ec825d8999538f110e572605dc56ef7bf44cc574/contracts/token/ERC721/ERC721.sol#L127

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Muhammad-Abdullah012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants