0

Hi I'm building a game and wanted to implement a marketplace. The user puts the token on the marketplace and then someone buys it. I've already managed to implement something to create the market place, the problem is how to transfer the token to whoever buys it. Because when I click on buy, it gives an error saying that you don't own the token and that you can't transfer it.

1
  • Can you include the contract in your question? It hard to say what needs to be fixed without it.
    – Ismael
    Commented Nov 19, 2021 at 14:20

1 Answer 1

0

First, the seller has to Approve() the marketplace contract manually or automatically, it depends on your design characteristics, for that token. Then marketplace could take care of transferring the ERC721 token from seller to buyer whenever the asked amount from the seller is completely paid.

This is the solution if your error is like this: "Caller is not approved nor the owner "

Go check out Approve() section of the ERC721 contract. I think it may help you. If your problem is something else, please provide more information.

3
  • And How i make the seller Approve() the marketplace contract automatically when the buyer press the buy button? Commented Nov 18, 2021 at 13:36
  • You have to design a button that whenever it is clicked, it should ask the seller for permission, like e Metamask pop up, to Approve the marketplace smart contract. It is more related to Web3 stuff and you should search the net for more precise information. Commented Nov 18, 2021 at 13:48
  • If you are using Remix, you have to do it by selecting the seller account and doing it manually. But if you are trying to make a user interface you should use Web3 and ask for permission by a pop-up from the seller. Commented Nov 18, 2021 at 13:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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