Cloning OpenSea NFT Boilerplate Questions

10000 NFT Minting Web Dapp for your NFT Collection (No coding) - YouTube

I donā€™t think so, your use case is very specific you might need to implement it yourself :raised_hands:

you can start here https://github.com/ethereum-boilerplate/ethereum-nft-marketplace-boilerplate/blob/main/src/contracts/marketplaceBoilerplate.sol#L48

where you can change the createMarketItem params all to arrays of the same type, and wrap all the logic into a loop that iterates over those arrays

1 Like

Thank you very much, Iā€™ve change it to: Is this right? it will work or not?
The idea is all parameters here are constant, nftContract, price, the only change is tokenId, so I define as array and loop transfer through:

function createMarketItem(
address nftContract,
//uint256 tokenId,
uint256[] tokenId,
uint256 price

    ) public payable nonReentrant {
        require(price > 0, "Price must be greater than 0");
        
        _itemIds.increment();
        uint256 itemId = _itemIds.current();

        idToMarketItem[itemId] =  MarketItem(
            itemId,
            nftContract,
            tokenId,
            payable(msg.sender),
            payable(address(0)),
            price,
            false
        );
        
        //IERC721(nftContract).transferFrom(msg.sender, address(this), tokenId);
            
        for(uint256 i=0; i < tokenId.length; i++) {
        IERC721(nftContract).transferFrom(msg.sender, address(this), tokenId[i]);
        }

        emit MarketItemCreated(
            itemId,
            nftContract,
            tokenId,
            msg.sender,
            address(0),
            price,
            false
        );
    }

yeahh something like so, I do recommend you emit the event inside the loop as well :raised_hands:

thanks for your suggestion,
but lets say I deployed this contract and everything work fine and I list all my NFTs on the Marketplace as one go (or I can specify inside the for loop from 0 to 10 as an example) but now the issue is that lets say one buy NFT from Marketplace then it will show under Your Collection tap, then if he wish to sale it again and list it on the Marketplace, it will call the Market contract (for loop)?

Hmmm no I donā€™t think so, coz it will use different function I believe

ohhh btw I just rechecked again, while your modified function is alright and usable, I think would be better if we make it more extendable by making the nftContract and price to be array as awell so that when you call createMarketItem, then you can customize the listing for individual contract.

Otherwise, at the moment, when you do multiple listing it will just be confined to one NFT contract with one single price :raised_hands:

yes for nftContract and price is a great idea but as you said if we want at the moment a fix price for one contract, then we can only use tokenId as an array,
but my concern is that this function will get called to everyone trying to list, because at the moment I used the same list button in Your collections tab
so lets say one has three or four NFTs under Your Collections tab and he only want list one of them, so when he pressed list button that will called createMaketItem that will loop over his NFTs Id and list all of them?
what is your suggestion here?

Please i see you are highly knowledgeable,i have a problem.
i created a different minting contract to mint nft for use on the moralis nft marketplace contract,but the pictures of the nfts i mint do not show in ā€˜your collectionsā€™ page.
Everything is working fine,but the nfts i mint do not show with pictures and it rerads the error ā€˜Unable to fetch all NFT metadataā€¦ We are searching for a solution, please try again later!ā€™
all the nft that came with moralis boilerplate is showing properly and the test nft i minted on opensea testnet is showing properly.
i believe i may not be pointing the metadata properly,please how do i mint using ipfs and json file and mint it correctly so the nft pictures can show.

@IAmJaysWay @therealmoneymikes @cryptokid

I have the same issue. builds OK.
But, when i Run. The localhost browser after some time eventually shows the Address Bar with text ā€œNFT Marketplace Boilerplateā€ but the rest is Blank Screen

Some details:
App.jsx is identical as on git server
git /ethereum-boilerplate/ethereum-nft-marketplace-boilerplate/blob/main/src/App.jsx

Metamask Matic Mumbai Testnet. Smart contract successfully Deployed, ABI & Bytecode = OK as well as sync and watch contract events = OK.

THanks for the help

Can you debug it to see what wheel doesnā€™t work?

how can i add filter to show only those NFTs on marketplace page which are on sale? Thank You

Hi,

Iā€™ve gotten the boilerplate up and running on mumbai and now Iā€™ messing around with the marketplace contract. How would I go about creating a payout split with marketplaceBoilerplate.sol? Iā€™m interested in creating a secondary royalty system that looks something like seller gets 98% of a sale and the marketplace gets 2%.

So far I have been attempting to make changes in the createMarketSale function within the contract and was thinking of hardcoding in the address where the royalty should split, But Iā€™m having trouble deciphering how the initial transaction to the seller takes place.

Any insights or help are greatly appreciated. Thanks!

Iā€™m working on this contract for reference:

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

import "github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/Counters.sol";
import "github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC721/ERC721.sol";
import "github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/security/ReentrancyGuard.sol";

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");
            
            _itemIds.increment();
            uint256 itemId = _itemIds.current();
  
            idToMarketItem[itemId] =  MarketItem(
                itemId,
                nftContract,
                tokenId,
                payable(msg.sender),
                payable(address(0)),
                price,
                false
            );
            
            IERC721(nftContract).transferFrom(msg.sender, address(this), tokenId);
                
            emit MarketItemCreated(
                itemId,
                nftContract,
                tokenId,
                msg.sender,
                address(0),
                price,
                false
            );
        }
        
    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(
                itemId,
                msg.sender
                );

            idToMarketItem[itemId].seller.transfer(msg.value);
            IERC721(nftContract).transferFrom(address(this), msg.sender, tokenId);
            idToMarketItem[itemId].owner = payable(msg.sender);
            _itemsSold.increment();
            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;
    }
      
}

Hey @beagle, yes it should take place in createMarketSale. Iā€™m not sure what you mean by deciphering the initial transactions

Thank you for helping narrow that down @YosephKS,

Sorry for my poor wordingā€¦ I guess my question is rather, how do I interject logic to split the transaction two ways within createMarketSale?

I hope Iā€™m correct in saying, that I understand the transfer of nft from the seller to the buyer takes place in this part of the createMarketSale function:

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

But I need help deciphering where the transfer of currency from the buyer to the seller takes place. If I could focus on that portion of the function, then maybe I could divide the paymentā€¦ then figure out how to send the dividends between the sellerā€™s address and another address.

Thanks again for the help, much appreciated!

I had removed the *.sol since it was giving me build errors, and i didnt see why should it be part of REPO since the deployment happens elsewhere in Remix IDE.

I undeleted the file and installed solidity extension to my VS Code. Consequently i am able to run the project.

Please where can I find a copy of the smart contract itself?

Please can you provide a link to where you found the original smart contract?

which smart contract are you talking about? I can help you with the link

Good day friends, Who is able to integrate mint function into the dapp??
I need help with mine please

Hereā€™s where in the tutorialā€™s repo you can find the original smart contract: https://github.com/ethereum-boilerplate/ethereum-nft-marketplace-boilerplate/blob/main/src/contracts/marketplaceBoilerplate.sol