0

I got this NFT marketplace smart contract. Still at the proof of concept stage, so I got 2 options to go with, I was just wondering if someone tried, or has knowledge about it:

Here is the deal, I was thinking, when a user creates an item listing, instead of locking their listed item in my marketplace contract (user transfers it to the contract address), which is the mentioned option one, what if I cut down that process by letting them keep their NFT item, until someone purchases it, then transferring given NFT from sellers address to whoever bought it.

Now the question is (and it's a tricky one) if it's even possible to let the seller approve my marketplace contract on a given NFT item (when they create a listing) that I can use to process transferFrom function from seller address to buyer address when a buyer clicks on purchase function.

Will approval make that possible?

1 Answer 1

0

Yes, you can do that. You need to get approval on the target contract. The function looks like this:

approve(address to, uint256 tokenId)

Approves another address to transfer the given token ID The zero address indicates there is no approved address. There can only be one approved address per token at a given time. Can only be called by the token owner or an approved operator.

More details: OpenZeppelin ERC721 Docs

Your Answer

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

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