Opensea clone CreateMarketItem in database won't populate

Hi @alex
I redeployed the smart contract to Mumbai and I put the new market address in my Moralis Dapp Provider and into my sync and event contract but I couldnā€™t list the NFT with the new market address. I have deleted the old contract but if i put the old market address into my Moralis Dapp Provider i can list my NFTā€™s successfully but the database doesnā€™t populate. I understand it needs to be the new one only but how come after i deleted the smart contract and i put the new market address in nothing works?
Iā€™m confused how it works with the old market address still after i have redeployed the smart contract?

@johnversus @alex
Is anyone active right now and can help please?
Thanks in advance

Hope you are using the same market contract address in your app and in your server to sync in database.

Do you see any errors in your browser console?

Hi @johnversus
Yes i was using the new market address in both my app and in my server. Nothing would work but if i change it back to old market address that i deleted i can list the NFTs successfully but the data wonā€™t go to the database. Its like the server remembers the old market address even know i redeployed and changed everything to the new one. Iā€™m confused why it does this after i have changed everything to the new market address. I have no errors in my console.

Are you able to list the nft with new contract address?

After adding the contract sync with new address, did you updated the table name in your app to match it with the database table?

@johnversus
no I canā€™t list the NFT with my new market address 0x3F5aF94a3f145C619e3f1d1cdC6c25E6f42c76fc. My NFTs only list when i put this 0xd9145CCE52D386f254917e481eB44e9943F39138 which is the first market address i had in my MoralisDappProvider.js. I tried putting this first market address i had in my sync and event contract but that didnt let it populate the database. The table name matches the function name in my app

can you share your server url

https://c7bbvbsmzold.usemoralis.com:2053/server


The transaction from the new contract address is failed due to an error from the contract. You can check the error for more details.

And in the old contract transactions, I donā€™t see any events for MarketItemCreated emitted on the polygonScan. Please check if you are using the correct contract code which has an event defined for MarketItemCreated .

Thanks for you reply. I am using the Marketplace contract from the final repo.

Can you try deploy and test the function on Remix?

I can test it after sometime, however I have seen other people in forum who cloned this project so I know this contract works as shown in the tutorial.

@johnversus
Ok can you try in spare time? Iā€™m struggling to get past this issue and Iā€™m doing everything iā€™ve been told and i canā€™t get it to work.

Can you share your latest code on github. So I can test the new contract directly in you app and also i can check if there are any errors somewhere in your app.

@johnversus
Yes Here it is.

Your code is correct.

I have used a new contract 0xabD7b4667F57870bc8B7B92C3DBEc6214ecD26Eb in the same code and everything is working as expected, without any errors.

And the listed marketitems are also synced to the app after adding contract event sync in server with table name as MarketItems.

I suggest you to check the process again from the tutorial, to verify if you are doing it right.

1 Like

@johnversus
Ok ill start a new server and deploy a new contract and try again. It should work then if it works for you.
thank you for your help

Hey @johnversus @alex
Iā€™ve been able to fix the issue with the listing of NFTs and the MarketItems class in the Moralis database does populate too. The only thing Iā€™m trying to solve now is after the NFT has been listed, they donā€™t end up in the transaction history in the transaction section of the dapp. I also donā€™t see the NFT that was listed on the explore page or anywhere in the dapp itself. Its like it has disappeared.
appreciate all the help you guys have been giving.
Cheers :slight_smile:

Continue all discussions here.