Ethereum Boilerplate Questions

okay thanks let me take a look into it~

okay @Coups, just tried it out :raised_hands: seems like you are right it gets empty white page, but after I removed the homepage field in the package.json seems like it is working and you can try it out~

Thanks, got it working! Highly appreciate :+1:

1 Like

Hello everyone! I am testing out the ethereum boilerplate mainly the ethereum NFT marketplace boilerplate but I wanted to ask is there some way that I make it so that the users can only strictly use my coin on the marketplace. Thanks in advance!

Yes it is possible, you just need to have that in your ERC20 coin defined/hard coded in your smart contract :raised_hands: for more questions related to the NFT marketplace boilerplate, I recommend you to post your questions here, the creator of the boilerplate can help you directly there. Cheers~

ok thanks a lot appreciate it

1 Like

Hi. How can I limit the NFTs displayed on “NFT Balances” to just one contract? I want to display all the NFTs the user owns for just one contract. I can do this with REST but unsure where to approach it in this boilerplate code.

When I go to transfer an NFT it gives me “Undefined” after all the steps. When I console.log all of the props they come up fine. Is there a setting missing?

Hello again, Still looking into this. Any help?

guys how do i paste my ABI into moralisdapprovider in string format like the video says

i was not able to figure out the issue. I have the test website at
I’m using the latest git pull.

Let me know what I’m missing here.
Thank you.

I got it to work. Thank you.

Thanks, ivan.
I’m now following the tutorial on YouTube(now reached the middle stage) (about 1 hour passed)
But i have a problem here on selling functionality.
Once I clicked on the Sell button, metamask window popup, but it says something has gone wrong.
I’ll attach the image now.
Can you tell me why this happens?


Hey @crazy010323, which function are you executing? can you show some solidity code? thank you~

thanks, YosephKS
Here’s my Sol code.


import React, { useState } from "react";
import { useMoralis, useWeb3ExecuteFunction } from "react-moralis";
import { Card, Image, Tooltip, Modal, Input } from "antd";
import { useNFTBalance } from "hooks/useNFTBalance";
import { FileSearchOutlined, SendOutlined, ShoppingCartOutlined } from "@ant-design/icons";
import { useMoralisDapp } from "providers/MoralisDappProvider/MoralisDappProvider";
import { getExplorer } from "helpers/networks";
import { List } from "antd/lib/form/Form";
const { Meta } = Card;

const styles = {
  NFTs: {
    display: "flex",
    flexWrap: "wrap",
    WebkitBoxPack: "start",
    justifyContent: "flex-start",
    margin: "0 auto",
    maxWidth: "1000px",
    gap: "10px",

function NFTBalance() {
  const { NFTBalance } = useNFTBalance();
  const { chainId, marketAddress, contractABI } = useMoralisDapp();
  const { Moralis } = useMoralis();

  const [visible, setVisibility] = useState(false);
  const [price, setPrice] = useState();
  const [nftToSell, setNftToSell] = useState(null);
  const [isPending, setIsPending] = useState(false);

  const contractProcessor = useWeb3ExecuteFunction();
  const contractABIJson = JSON.parse(contractABI);
  const listItemFunction = "createMarketItem";

  const list = async (nft, currentPrice) => {
    const p = currentPrice * ("1e" + 18);
    const ops = {
      contractAddress: marketAddress,
      functionName: listItemFunction,
      abi: contractABIJson,
      params: {
        nftContract: nft.token_address,
        tokenId: nft.token_id,
        price: String(p)

    await contractProcessor.fetch({
      params: ops,
      onSuccss: () => alert("item sold"),
      onError: () => alert("Something went wrong!")

  const handleSellClick = (nft) => {

  return (
      <div style={styles.NFTs}>
        {NFTBalance &&
, index) => (
                <Tooltip title="View On Blockexplorer">
                    onClick={() =>
            `${getExplorer(chainId)}address/${nft.token_address}`, "_blank")
                <Tooltip title="Sell this NFT">
                  <ShoppingCartOutlined onClick={() => handleSellClick(nft)} />
              style={{ width: 240, border: "2px solid #e7eaf3" }}
                  src={nft?.image || "error"}
                  style={{ height: "300px" }}
              <Meta title={} description={nft.token_address} />
        title={`Sell ${nftToSell?.name || "NFT"}`}
        onCancel={() => setVisibility(false)}
        onOk={() => list(nftToSell, price)}
            width: "250px",
            margin: "auto",
            borderRadius: "10px",
            marginBottom: "15px",
        <Input autoFocus placeholder="Set Price in ETH" onChange={evt => setPrice(}></Input>

export default NFTBalance;

I mean like the smart contract solidity code

I used the code provided on GitHub as a sample.

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

import "";
import "";
import "";

contract marketPlaceBoilerPlate is ReentrancyGuard {
    using Counters for Counters.Counter;
    Counters.Counter private _itemIds;
    Counters.Counter private _itemsSold;
    address public owner;
    constructor() {
        owner = msg.sender;
    struct MarketItem {
        uint itemId;
        address nftContract;
        uint256 tokenId;
        address payable seller;
        address payable owner;
        uint256 price;
        bool sold;
    mapping(uint256 => MarketItem) private idToMarketItem;
    event MarketItemCreated (
        uint indexed itemId,
        address indexed nftContract,
        uint256 indexed tokenId,
        address seller,
        address owner,
        uint256 price,
        bool sold
    event MarketItemSold (
        uint indexed itemId,
        address owner
    function createMarketItem(
        address nftContract,
        uint256 tokenId,
        uint256 price
        ) public payable nonReentrant {
            require(price > 0, "Price must be greater than 0");
            uint256 itemId = _itemIds.current();
            idToMarketItem[itemId] =  MarketItem(
            IERC721(nftContract).transferFrom(msg.sender, address(this), tokenId);
            emit MarketItemCreated(
    function createMarketSale(
        address nftContract,
        uint256 itemId
        ) public payable nonReentrant {
            uint price = idToMarketItem[itemId].price;
            uint tokenId = idToMarketItem[itemId].tokenId;
            bool sold = idToMarketItem[itemId].sold;
            require(msg.value == price, "Please submit the asking price in order to complete the purchase");
            require(sold != true, "This Sale has alredy finnished");
            emit MarketItemSold(

            IERC721(nftContract).transferFrom(address(this), msg.sender, tokenId);
            idToMarketItem[itemId].owner = payable(msg.sender);
            idToMarketItem[itemId].sold = true;
    function fetchMarketItems() public view returns (MarketItem[] memory) {
        uint itemCount = _itemIds.current();
        uint unsoldItemCount = _itemIds.current() - _itemsSold.current();
        uint currentIndex = 0;

        MarketItem[] memory items = new MarketItem[](unsoldItemCount);
        for (uint i = 0; i < itemCount; i++) {
            if (idToMarketItem[i + 1].owner == address(0)) {
                uint currentId = i + 1;
                MarketItem storage currentItem = idToMarketItem[currentId];
                items[currentIndex] = currentItem;
                currentIndex += 1;
        return items;

Looks like there is transferFrom here to have the Marketplace contract to take ERC721 from your wallet

IERC721(nftContract).transferFrom(msg.sender, address(this), tokenId);

So did you approve the transfer yet?

Can you explain in more details?
What shall I do now to fix this bug?