Hey everyone, I’m having trouble with my ERC1155 NFT marketplace contract. The NFTs are minting fine, but they’re not showing up in the marketplace. I can’t buy them either. I’m getting this error:
ERC1155: caller is not owner nor approved
I’ve already tried using setApprovedForAll when minting, but it didn’t help. Here’s a quick rundown of what my contract does:
- Mints ERC1155 tokens
- Creates market items
- Handles buying and selling NFTs
- Manages token URIs
Has anyone run into this issue before? I’m wondering if there’s a problem with my approval process or maybe I’m missing a step somewhere in the buying process. Any ideas on how to fix this would be super helpful!
I can share more of my code if needed, but I’m hoping someone might spot the issue from this description. Thanks in advance for any help!
hey SingingSnow! that error message is def frustrating. have you double-checked that your marketplace contract address is correct when you’re calling setApprovalForAll? sometimes we accidentally use an old address after updates 
also, just curious - are you able to see the NFTs in your wallet even tho they’re not showing up in the marketplace? that could give us a clue about where the issue might be.
oh, and one more thing - have you tried monitoring the events emitted by your contract? that can be super helpful for tracking down approval issues. let me know if you want some tips on how to do that!
I’ve encountered similar issues before. One often overlooked aspect is the timing of approvals. Ensure you’re calling setApprovalForAll after minting but before attempting to list or sell the NFTs. Also, verify that the approval is being set for the correct operator address (your marketplace contract).
Another potential cause could be a mismatch between the token IDs you’re trying to sell and the ones actually minted. Double-check that the IDs align correctly throughout your contract logic.
Lastly, consider implementing a function to check approval status before transactions. This can help pinpoint where exactly the approval is failing in your contract flow.
hey there! sounds like a tricky issue.
have u confirmed the marketplace contract has proper approvals? sometimes its easy to overlook using the correct token id when calling approve. hope that helps!