0

I have moved forward with the contract of a marketplace in a modularised way, that is, I define a contract for the marketplace itself and another one for the auction. In the main contract I extend ERC721BurnableUpgradeable and in the Auction contract I extend ERC721HolderUpgradeable. To the ERC721HolderUpgradeable contract I pass in its migration the address of the main contract (which has an IERC721Upgradeable interface).

Everything went smoothly, mint, auction creation, 1-2-x placeBid... Now when I want to make the claim from the admin account I have this error that I don't understand why I get when I execute the safeTransferFrom method...

tokenContract.safeTransferFrom(msg.sender, _auction_bidder[tokenContract][tokenId], tokenId);

reason: 'ERC721: transfer caller is not owner nor approved'...

Any suggestions?

thanks

2

It seems like you are not adding an approval for the transfer.

There are two ways to transfer tokens:

  1. Direct transfer with transfer function. You own the tokens and you send them to an arbitrary recipient

  2. An indirect transfer. You give address X allowance (approve function) to withdraw some amount of your tokens. Typically, in a second transaction, you tell the other contract (X) to do whatever it needed the tokens for - for example a trade. So X then withdraws the tokens from you (with transferFrom) using the allowance you gave it earlier.

2
  • You are so good! You are so right!👍
    – zmy
    Aug 17 at 9:12
  • Thank you for your response. I have seen things related to what you say, about authorising an account. But I am making the claim with the admin account, with which I created the contract. I should not authorise the admin of the contract? I think I'm failing in something else.... I leave the code of my contract for you to see. pastebin.com/EkjWZWYY Aug 17 at 9:43

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.