DEV Community

How to create a resell token functionality in your NFT marketplace smart contract

Mateus Ferreira on December 07, 2021

This article is intended to be a continuation of @dabit3's great tutorial on how to create a NFT Marketplace on Ethereum with Polygon. So, if you h...
Collapse
 
hotarumoon profile image
Ege

Thank you so much for the post, I have been trying to do this myself. Really appreciate it.

Collapse
 
mcmaurok profile image
mcmaurok

This is what I need to create a resell function, thanks Mateus. Could you upload the market.sol file? I'm getting an error when adding the "creator" attribute to other existing functions in the market.sol file and getting an error because of this. What functions did you add the "creator" attribute?

Collapse
 
mateusasferreira profile image
Mateus Ferreira

hey! there you go: github.com/mateusasferreira/nft-ma...
but I would take some parts of this code with a grain of salt as this is a work in progress (currently paused)

Collapse
 
mcmaurok profile image
mcmaurok

Yes, I will be verifying the code. Thank you so much I really appreciated it, just what I needed!

Collapse
 
latonet profile image
latonet

I get the message after adding your code to NFTMarket.sol ..... can't move forward with running the app. Any solution? Thanks

[{
"resource": "/C:/Users/admin/nft-marketplace/contracts/NFTMarket.sol",
"owner": "generated_diagnostic_collection_name#2",
"severity": 8,
"message": "Member \"transferToken\" not found or not visible after argument-dependent lookup in contract NFT.",
"startLineNumber": 209,
"startColumn": 9,
"endLineNumber": 209,
"endColumn": 36
}]

Collapse
 
izadgashb profile image
Crypto

I got the unhandled error
TypeError: marketContract.fetchItemsCreated() is not a function
Source: pages\creator-dashboard.js (31:38)
in this line:
const data = await marketContract.fetchItemsCreated()

Collapse
 
michaelblythe profile image
michaelblythe

Great work on this, I'm using this code and but seem to be getting the below error - any ideas? I get this when attempting to mint OR buy, using an EVM based chain where the contracts are successfully written to.

code: -32000
message: "gas required exceeds allowance or always failing transaction"
[[Prototype]]: Object
message: "Internal JSON-RPC error."
[[Prototype]]: Object

Collapse
 
livando profile image
Don Livanec

anyone getting this error when trying to upload an NFT to a test network?

message: 'execution reverted: ERC721: transfer caller is not owner nor approved'
Enter fullscreen mode Exit fullscreen mode
Collapse
 
kanishksharma8 profile image
KanishkSharma8

Hey! the code works well till the NFT is relisted for selling. But when I try to buy that relisted NFT it gives me this error..
code: -32603, message: 'Internal JSON-RPC error.'
data: {code: -32603, message: 'Error: Transaction reverted: function call failed to execute'}
Please help I have been stuck on it.. tried every solution there is.. Is there something that I'm missing?

Collapse
 
thalesbmc profile image
Thales Brederodes

Good job Mateus.

Amazing explanation!!

Collapse
 
kingjulien profile image
Abusomwan Santos

Hey, how i'm struggling with the ipfs, please can I pin IPFS to bsc

Collapse
 
silviarainicorn profile image
Silvia Barros

Hi Mateus!
I just wanted to thank you for the code. I think I have it working properly. Thanks a lot for sharing your solution!