Ultimate NFT / Moralis cli error- please help!

Hi,

I’m working on Philip’s Ultimate NFT course (https://www.youtube.com/watch?v=tBMk1iZa85Y), and have encountered two problem, maybe related.

First, after deploying the Moralis admin cli and getting the url that hosts the index.html, while I can see the two json files in the folder, when I modify the url to display either of the two image files I have in the folder (called ‘artwork.png’ and ‘photo.jpg’ (same file names as the tutorial), the browser states ‘not found’ (error 404).

Then, when trying to compile the contract in in Remix, I get the following error:

‘Declaration not found or not unique.
unit256 public constant ARTWORK = 0’

Do I need to upgrade to a paid version of Moralis to get the image files to be hosted via the cli? Or is there another issue?

Many thanks!

Do I need to upgrade to a paid version of Moralis to get the image files to be hosted via the cli? Or is there another issue?

No you don’t need to upgrade.

when I modify the url to display either of the two image files I have in the folder (called ‘artwork.png’ and ‘photo.jpg’

What do you mean by this, can you give an example and what the folder/files look like when you uploaded them.

You can post your contract code, if you’re using any variables, make sure they exist and that they’re unique.

Hi glad,

Thanks for getting back to me, let me try to explain in more detail:

I tried this again and now the first error is resolved, so when I run ‘morlais-admin-cli deploy’ to host the folder with the index.html and the two image files, I can get the index.html file and now also the two image files to display in the browser, (previously I got the "Not found 404 error’ when I added the image file name to the url).

However, the second error still occurs:
When I try to deploy the contract in Remix I can’t select the contract as it is not complied, so while trying to compile the contract* I get the following error:
Remix - not found error

Here is my code, which is the same as the code in the video:

Code in video:

Please explain what this error means and, ideally, what is causing it?

*In the video tutorial, it does not show Philip compiling the Remix code, but assume this is done as he can deploy it?

Many thanks, your help is certainly appreciated!

Best,
Seb

can you paste that code that you try to compile in remix?

you could always modify the code in the lines 14 and 15 to replace the constants with numbers

Sure, here you go:

pragma solidity ^0.8.0;

//Import ERC1155 token contract from Openzeppelin

import “https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC1155/ERC1155.sol”;

import “https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol”;

contract NFTContract is ERC1155, Ownable {

unit256 public constant ARTWORK = 0;

unit256 public constant PHOTO = 1;

constructor() ERC1155("https://2zthy4iouskw.usemoralis.com/{id}.json") {

    _mint(msg.sender, ARTWORK, 1, "");

    _mint(msg.sender, PHOTO, 2, "");

}

function mint(address account, unit256 id, unit256 amount) public onlyOwner {

    _mint(account, id, amount, "");

}

function burn(address account, unit256 id, unit256 amount) public {

    require(msg.sender == account);

    burn(account. id. amount);

}

}

you can see here how to format code on forum:

did you try to remove those constants and use the values directly?

No, I’m not even sure how one would do that, could you give me an example?

…but I did change ‘unit’ to ‘uint’ and it worked!

My Solidity is not very solid yet, but your tutorials are so good I can build stuff!

Thanks again for the support!

Best,
Zeb

1 Like