Solved my issue yesterday by writing a custom function to tranfer tokens on my NFT contract. Like this:
contractNFTisERC721URIStorage{(...)functiontransferToken(addressfrom,addressto,uint256tokenId)external{require(ownerOf(tokenId)==from,"From address must be token owner");_transfer(from,to,tokenId);}}
Hi, thank you for posting this, i would like to use your function on my code but it says "onlyItemOwner(itemId)" never used, am i missing something? thanks again!
Hey there! its a modifier that you're missing. I added this to my contract so I can use it in functions to ensure only the item's owner can execute it:
modifieronlyItemOwner(uint256id){require(idToMarketItem[id].owner==msg.sender,"Only product owner can do this operation");_;}
Solved my issue yesterday by writing a custom function to tranfer tokens on my NFT contract. Like this:
And in my Market Contract:
Don't know all the implications of this solutions and if it may fail or cause security issues somehow but it solved my problem for know.
Thanks that solution works but I agree with the implications it may bring if any. Thank you though! Ill update you if I find another stable solution.
my pleasure! Keep me posted about the solutions you may find.
Hi, thank you for posting this, i would like to use your function on my code but it says "onlyItemOwner(itemId)" never used, am i missing something? thanks again!
Hey there! its a modifier that you're missing. I added this to my contract so I can use it in functions to ensure only the item's owner can execute it:
thanksss