skalenetwork / blockscout

Blockchain explorer for Ethereum based network and a tool for inspecting and analyzing EVM based blockchains.
http://docs.blockscout.com
GNU General Public License v3.0
1 stars 8 forks source link

NFT name and tag do not show up / Also does not update metadata when metadata is changed #54

Closed hydraerozine closed 2 months ago

hydraerozine commented 5 months ago

Description

// SPDX-License-Identifier: MIT pragma solidity 0.8.19;

import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; import "@openzeppelin/contracts/interfaces/IERC2981.sol";

contract MarsTigerV2 is ERC721Enumerable, Ownable, IERC2981 { uint public constant MAX_NFT = 300; bool public hasSaleStarted = false; uint256 public counter = 0; mapping(address => bool) public hasMinted; string private _baseTokenURI;

address payable public constant royaltyRecipient = payable(0xBd0eC103EcEeF5BcE770E826C776b868Bdcf3584);
uint256 public constant royaltyPercentage = 7;

constructor(string memory baseURI) 
    ERC721("MillKav Mars Tiger Skin", "SGMTS")
    Ownable()
{
    _baseTokenURI = baseURI;
}

function _baseURI() internal view virtual override returns (string memory) {
    return _baseTokenURI;
}

function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
    require(ownerOf(tokenId) != address(0), "ERC721Metadata: URI query for nonexistent token");
    string memory base = _baseURI();
    return bytes(base).length > 0
        ? string(abi.encodePacked(base, Strings.toString(tokenId), ".json"))
        : '';
}

function mintNFT(uint numberOfNfts) public {
    require(numberOfNfts == 1, "Can only mint one NFT at a time");
    require(hasSaleStarted == true, "Sale hasn't started");
    require(totalSupply() < MAX_NFT, "Would exceed max supply");
    require(!hasMinted[msg.sender], "This wallet has already minted an NFT");

    uint mintIndex = counter++;
    _safeMint(msg.sender, mintIndex);
    hasMinted[msg.sender] = true;
}

function startSale() external onlyOwner {
    hasSaleStarted = true;
}

function royaltyInfo(uint256 /* _tokenId */, uint256 _salePrice) external pure override returns (address receiver, uint256 royaltyAmount) {
uint256 _royaltyAmount = (_salePrice * royaltyPercentage) / 100;
return (royaltyRecipient, _royaltyAmount);
}

}

the name and tag do not show up ERC721("MillKav Mars Tiger Skin", "SGMTS")

Type of the installation

Docker-compose

Type of the JSON RPC archive node

none

Type of the chain

No response

Link to the page

No response

Steps to reproduce

use the contract I sent.

Backend version

latest

Frontend version

No response

Elixir & Erlang/OTP versions

latest

Operating system

No response

Additional information

No response

hydraerozine commented 5 months ago

Also tested using another contract and the URI does not change on explorer. I did test with opensea on bsc testnet and worked

yavrsky commented 1 month ago
  1. Navigate to the REST API web page.
  2. Locate the method /tokens/{address_hash}/instances/{id}/refetch-metadata.
  3. Enter the contract address and the token ID you wish to update.
  4. Generate a recaptcha_response token by following these steps:
    • Open any address details page and click the Download CSV button.
    • Open the browser's developer tools (press F12) and solve the CAPTCHA by clicking "I'm not a robot."
    • In the Network tab, filter requests by the name "userverify." image
    • In the Preview section, copy the value associated with the key "1." In the example image, the token starts with "03AFcWeA5jWiu...". This is your recaptcha_response token.
    • Return to the REST API page and input the recaptcha_response token.
  5. Click Execute. If the request is successful, the response will include "message": "OK".
yatsunastya commented 1 month ago

Checked :white_check_mark: Version: 2.1.0-beta.2

:heavy_check_mark: setTokenURI transaction. :heavy_check_mark: Follow all the steps in the instruction.

NFT metadata and URI are changed on explorer. (https://prickly-wary-sirius.legacy-explorer.skalenodes.com/token/0x4BE95bA56fa3FfAbd5ff228cb04f0c5d86F2dDDA/instance/1)