I am follwing the tutorials on youtube - i cloned rarible in 24 hours and have some issues with my smartcontract.
‘’’’’
pragma solidity ^0.8.0;
import "../node_modules/@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "../node_modules/@openzeppelin/contracts/utils/Counters.sol";
contract MorarableToken is ERC721 {
using Counters for Counters.Counter;
Counters.Counter private _tokenIds;
constructor () ERC721("MorarableToken", "MORA"){}
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;
}
}
the error i am getting is
‘’’’’’’’
inpage.js:1 MetaMask - RPC Error: Error: [ethjs-query] while formatting outputs from RPC '{"value":{"code":-32603,"data":{"message":"VM Exception while processing transaction: revert","code":-32000,"data":{"0x5dd8a7967eec87c4f3fecc6e6135c6269db3d61d1de19c0ec753c8ee5b575ccf":{"error":"revert","program_counter":70,"return":"0x"},"stack":"RuntimeError: VM Exception while processing transaction: revert\n at Function.RuntimeError.fromResults (C:\\Program Files\\WindowsApps\\GanacheUI_2.5.4.0_x64__5dg5pnz03psnj\\app\\resources\\static\\node\\node_modules\\ganache-core\\lib\\utils\\runtimeerror.js:94:13)\n at BlockchainDouble.processBlock (C:\\Program Files\\WindowsApps\\GanacheUI_2.5.4.0_x64__5dg5pnz03psnj\\app\\resources\\static\\node\\node_modules\\ganache-core\\lib\\blockchain_double.js:627:24)\n at runMicrotasks (<anonymous>)\n at processTicksAndRejections (internal/process/task_queues.js:93:5)","name":"RuntimeError"}}}}' {code: -32603, message: "Error: [ethjs-query] while formatting outputs from…/task_queues.js:93:5)\",\"name\":\"RuntimeError\"}}}}'"}
(anonymous) @ inpage.js:1
(anonymous) @ inpage.js:17
_runReturnHandlers @ inpage.js:17
_processRequest @ inpage.js:17
async function (async)
_processRequest @ inpage.js:17
_handle @ inpage.js:17
handle @ inpage.js:17
_rpcRequest @ inpage.js:1
(anonymous) @ inpage.js:1
request @ inpage.js:1
bound bound request @ util.js:693
c.send @ index.js:156
h @ index.js:615
(anonymous) @ index.js:633
o @ index.js:533
a @ util.js:689
b.run @ browser.js:153
p @ browser.js:123
setTimeout (async)
u @ browser.js:41
o.nextTick @ browser.js:143
(anonymous) @ util.js:694
Promise.then (async)
bound bound request @ util.js:694
c.send @ index.js:156
h @ index.js:615
n @ index.js:642
n @ index.js:624
d._executeMethod @ index.js:841
mintNft @ main.js:135
createItem @ main.js:114
async function (async)
createItem @ main.js:109
main.js:131 Uncaught (in promise) {code: -32603, message: "Error: [ethjs-query] while formatting outputs from…/task_queues.js:93:5)\",\"name\":\"RuntimeError\"}}}}'", stack: "Error: Error: [ethjs-query] while formatting outpu…/task_queues.js:93:5)\",\"name\":\"RuntimeError\"}}}}'"
‘’’’’’’’