Solving common problems [Rarible Clone]

Developers sometimes have problems with creating a project using tutorial I CLONED RARIBLE IN 24 HOURS.

We decided to create a checklist for finding quick solutions for your possible problems.

  • Items not displaying for sale on Rarible clone code [Solution]

  • Change in the cloud code NFTTokenOwners -> EthNFTOwners

  • Change in the Market Code modifier OnlyItemOwner :
    getApproved(tokenId)-> ownerOf(tokenId)

  • Check SERVER URL and APPID (you should input them in " ")

  • Check your Sync and Watch plugin settings (Example)

  • Check your ganache and frpc.exe settings

  • Check your devchain proxy status:

  • Find defferences in your code and code from the tutorial Tutorial GitHub Repo (diffchecker can help you)

  • When buying (not minting) NFT transaction seem to stuck in pending (Solution)

  • 107 Received an error with invalid JSON format from Parse (Solution)

  • Truffle init Syntax error: unexpected token (Solution)

  • RaribleClone Duplicate Value, Unauthorized, RPC error (Solution)

  • Check your logs in Moralis Dashboard. This can help you find the error.

  • If you have problems with Ganache you can try your smart contract on the public testnets or on Remix.

Hope it will help you and you will find solution.
We are always ready to help you and answer your questions

Happy BUIDLing :man_mechanic:

9 Likes

I keep getting the error, tokenContract is not defined, even though I have this in my code:

const tokenContract = new web3.eth.Contract(tokenContractAbi, TOKEN_CONTRACT_ADDRESS);

Any idea on whatโ€™s going on?

Hi @devin,

Please create a new post with your complete code and ABI so that we check whatโ€™s going wrong.

Thanks.

Hi, thanks for the reply. I decided to start over to see where I went wrong, and I think I found the error in the migration. When I use the command truffle --reset after creating my 2_token_migration file, I get this error:

2_token_migration.js
====================

Error: Migration /Users/devin/Desktop/Productive/contracts/migrations/2_token_migration.js invalid or does not take any parameters
    at Migration._load (/Users/devin/.nvm/versions/node/v16.8.0/lib/node_modules/truffle/build/webpack:/packages/migrate/Migration.js:50:1)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at Migration.run (/Users/devin/.nvm/versions/node/v16.8.0/lib/node_modules/truffle/build/webpack:/packages/migrate/Migration.js:217:1)
    at Object.runMigrations (/Users/devin/.nvm/versions/node/v16.8.0/lib/node_modules/truffle/build/webpack:/packages/migrate/index.js:150:1)
    at Object.runFrom (/Users/devin/.nvm/versions/node/v16.8.0/lib/node_modules/truffle/build/webpack:/packages/migrate/index.js:110:1)
    at Object.runAll (/Users/devin/.nvm/versions/node/v16.8.0/lib/node_modules/truffle/build/webpack:/packages/migrate/index.js:114:1)
    at Object.run (/Users/devin/.nvm/versions/node/v16.8.0/lib/node_modules/truffle/build/webpack:/packages/migrate/index.js:79:1)
    at runMigrations (/Users/devin/.nvm/versions/node/v16.8.0/lib/node_modules/truffle/build/webpack:/packages/core/lib/commands/migrate.js:258:1)
    at Object.run (/Users/devin/.nvm/versions/node/v16.8.0/lib/node_modules/truffle/build/webpack:/packages/core/lib/commands/migrate.js:223:1)
    at Command.run (/Users/devin/.nvm/versions/node/v16.8.0/lib/node_modules/truffle/build/webpack:/packages/core/lib/command.js:172:1)
Truffle v5.4.8 (core: 5.4.8)
Node v16.8.0
devin@Devins-MBP contracts %

Here is the file for my token, ProductiveToken.sol:

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../node_modules/@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "../node_modules/@openzeppelin/contracts/utils/Counters.sol";

contract ProductiveToken is ERC721 {
    using Counters for Counters.Counter;
    Counters.Counter private _tokenIds;

    constructor () ERC721("ProductiveToken", "PROD"){}

    struct Item {
        uint256 id;
        address creator;
        string uri;
    }

    mapping (uint256 => Item) public Items;

    function createItem(string memory uri) public returns (uint256){
        _tokenIds.increment();
        uint256 newItemId = _tokenIds.current();
        _safeMint(msg.sender, newItemId);

        Items[newItemId] = Item(newItemId, msg.sender, uri);

        return newItemId;
    }

    function tokenURI(uint256 tokenId) public view override returns (string memory) {
        require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");

       return Items[tokenId].uri;
    }
}

And here is the file for the migration, 2_token_migration.js:

const ProductiveToken = artifacts.require("ProductiveToken");

module.exports = function (deployer) {
  deployer.deploy(ProductiveToken);
};

Really not sure where I went wrong or whether I am missing something.

Hey @devin

Please create a new post :raised_hands:

1 Like