When you list an NFT for sale on one of the NFT Marketplaces (like say OpenSea, Rarible, LooksRare, etc.) and someone then buys your NFT, which party is calling the
safeTransferFrom() function at that point to make the transferring of that NFT happen from you to the Buyer? Is it that Marketplace's smart-contract that's calling
safeTransferFrom(), or is it the SELLER - meaning the current owner of the NFT that's calling it?
As a quick reminder, here's the method's signature --> and note how
from is the very first argument in it:
safeTransferFrom(address from, address to, uint256 tokenId)
I'm asking because I looked at some recent sale transactions on Etherscan and found the info there to be inconsistent - and also just plain confusing.
For starters, we don't even always see
safeTransferFrom() being called. Sometimes its a function called
fulfillBasicOrder(tuple parameters) that gets called (this is with an OpenSea sale transaction.)
Of course, I'm assuming they wrap
safeTransferFrom() inside of their
fulfillBasicOrder() function, but either way - who is
from in this case?
I think a bit of clarification is needed - judging from the responses I got...
I was trying to understand who
from is in
safeTransferFrom(address from, address to, uint256 tokenId).
I knew that
from is the owner of the token being transferred - but then who is actually doing the calling of this
safeTransferFrom() function? Meaning where is that call coming from?
So these two different "froms" confused me.
Then I realized that when we call
safeTransferFrom(from, to, tokenId) it is NOT necessarily the case that the caller of this function is the
owner of the token.
Actually, when it comes to NFT Marketplaces, it's probably never the case.
And if we did want to find out and examine where the call was coming from, all we would have to do is use...
safeTransferFrom() call is coming from
msg.sender, and the token it's transferring is
from it's owner - just as we would expect it to be.
End of confusion.