Cloning OpenSea NFT Boilerplate Questions

Feel free to ask Questions about the OpenSea Cloning video https://youtu.be/WZWCzsB1xUE

4 Likes

Its possible create a real marketplace with user collections, etcā€¦ ? or just a one to sell from a single user ?

Hey @angelini!

The marketplace created in the tutorial, allows ANY user to login to the dApp using their wallet, view their own NFTā€™s and put them up for sale on the marketplace (not limited to one single seller). Also any user of the dApp can then purchase NFTs that are put up for sale.

This is a boilerplate, so you are more than welcome to add functionality where a user could mint new collections etcā€¦ :slight_smile:

i still try learning programing to do one NFT mktplace in brazil, with 50 years is tuff! hehehe!

2 Likes

Hi guys, getting this error "NoMoralisContextProviderError: Make sure to only call useMoralis within a " after I run yarn start.

but when I look at video, about the smart contract part, do I actually need to have my own smart contract to test this repo?

and this part in the GitHub repo ā€œLocate the MoralisDappProvider in src/providers/MoralisDappProvider/MoralisDappProvider.js and paste the deployed marketplace smart contract address and ABIā€

const [contractABI, setContractABI] = useState();
const [marketAddress, setMarketAddress] = useState();

do you guys have an example?

also the smart contract is deployed to which chain ? since this is cross-chain ???

thanks

Hi @m33lucky!

You will have to deploy the contract yourself and provide the ABI and marketplace address in string format over in the MoralisDappProvider.js file. Also you will likely want to add NFT collections you hold items in, into the helpers/collections.js if you wish to test out the selling and buying these NFTā€™s using the marketplace. If you really want to use the already deployed contract I will paste the ABI and market address in the comment below.

Also, Moralis allows this marketplace to be built cross chain, but for every chain you wish to use, you will need to deploy the contract on said chain (this one is on Mumbai testnet).

Hopefully this helps.

2 Likes

Here is the ABI and contract address used in the tutorial:

const [contractABI, setContractABI] = useState('[ { "inputs": [], "stateMutability": "nonpayable", "type": "constructor" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "uint256", "name": "itemId", "type": "uint256" }, { "indexed": true, "internalType": "address", "name": "nftContract", "type": "address" }, { "indexed": true, "internalType": "uint256", "name": "tokenId", "type": "uint256" }, { "indexed": false, "internalType": "address", "name": "seller", "type": "address" }, { "indexed": false, "internalType": "address", "name": "owner", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "price", "type": "uint256" }, { "indexed": false, "internalType": "bool", "name": "sold", "type": "bool" } ], "name": "MarketItemCreated", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "uint256", "name": "itemId", "type": "uint256" }, { "indexed": false, "internalType": "address", "name": "owner", "type": "address" } ], "name": "MarketItemSold", "type": "event" }, { "inputs": [ { "internalType": "address", "name": "nftContract", "type": "address" }, { "internalType": "uint256", "name": "tokenId", "type": "uint256" }, { "internalType": "uint256", "name": "price", "type": "uint256" } ], "name": "createMarketItem", "outputs": [], "stateMutability": "payable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "nftContract", "type": "address" }, { "internalType": "uint256", "name": "itemId", "type": "uint256" } ], "name": "createMarketSale", "outputs": [], "stateMutability": "payable", "type": "function" }, { "inputs": [], "name": "fetchMarketItems", "outputs": [ { "components": [ { "internalType": "uint256", "name": "itemId", "type": "uint256" }, { "internalType": "address", "name": "nftContract", "type": "address" }, { "internalType": "uint256", "name": "tokenId", "type": "uint256" }, { "internalType": "address payable", "name": "seller", "type": "address" }, { "internalType": "address payable", "name": "owner", "type": "address" }, { "internalType": "uint256", "name": "price", "type": "uint256" }, { "internalType": "bool", "name": "sold", "type": "bool" } ], "internalType": "struct marketPlaceBoilerPlate.MarketItem[]", "name": "", "type": "tuple[]" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "owner", "outputs": [ { "internalType": "address", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function"}]')
const [marketAddress, setMarketAddress] = useState("0xa3dDf4B68CCda6c9CB35AE1962c60aA5cb226E90")

2 Likes

thank you for the quick reply,
noted, so each chain will need a smart contract. I have done eth mainnet before, so I can use remix to deploy for polygon also ?

in the event I have more than 1 contract how would I fit the contractABI & marketAddress ?

like so ? useState("0xa3xxxxx", "0xa3ffffff")

so I copy and paste and this is what I get


doesnā€™t seem right the const is white in color

If you want to have the marketplace contract on multiple chains I would have the setMarketAddress and setContractABI, set these to the correct contract based on which chain the user is currently on for example in the useEffect() in the MoralisDappProvider.js.

And yes remix is good for testing out your contracts, you can connect your metamask on different chains, to deploy on the network you would like.

:+1:

2 Likes

Donā€™t really know what is going one in your screenshot, canā€™t reproduce and it works fine on my endā€¦ you could try and start typing the const out and see where it goes wrong :thinking:

Hello there, Iā€™m following along with the Youtube video but seems that the boilerplate has changed.
Iā€™m finding issues with the hooks (Which I solved copy-pasting the ones on the final template).

But I do also have issues with the following:


Is there any way to pull the boilerplate you used in the video?
Thank you in advance

I think itā€™s a common issue with @m33lucky

Hello, when I run " yarn start" from the terminal, I keep getting an error that says ā€œcouldnā€™t find a package.json fileā€. Does anyone know how to solve this issue?

Hey @Ulvur!

Thanks for you message, we update the Ethereum-Boilerplate very frequently, so you are correct in assuming there may be some conflicts if you clone the latest version of that :+1:. You should be able to get the version of the boilerplate at the time of recording by cloning the repo and then checking out an earlier commit. I believe the following should be the one at time of recording:

git clone https://github.com/ethereum-boilerplate/ethereum-boilerplate.git
cd ethereum-boilerplate
git checkout cfffb45755287226ab01f560343a5442cd9ec313

Hope this works out!

Also @ronlawrence5 I would suggest going through the same steps as above this should bring in the whole repository :slight_smile:

4 Likes

I need help adding a commission function to my nft.
Can you help me with this?

Thank you man! That was fast :smiley:
Itā€™s looking good atm.

Thank you for your effort on the video. Very helpfull introducing Moralis tools!

1 Like

Hi @matrixone,

We mostly focused on how Moralis integrates with the smart contract in this tutorial, but adding such functionality shouldnt be overly complicated.

You can have a browse at different smart contracts online and see how they accomplish this. There will be numerous ways to go about it. Wether you want to add a pre-set listing price that has has to be sent by the address placing an NFT for sale, or then taking a percentage of the price the NFT is sold for, these will have different implementations.

Good Luck! :+1:

1 Like

Hello !
The App.jsx code from the ethereum-boilerplate is different from the one followed in the tutorial, which makes it pretty difficult to follow up.