1

I am developing an NFT Drop site contract. I want my NFT Contract to be named from ERC1155 to provide a name in the constructor. I have watched and followed many tutorials. They all work the same and so I am following them. But my Token Tracker name is ERC1155. Can Anyone please suggest to me how to solve this issue???

Here is my contract Link: https://mumbai.polygonscan.com/address/0x69A66176A9d8E5EB207CA8Ed66bdBF318f965523#code

What I am getting

enter image description here

What I should be getting

enter image description here

2 Answers 2

1

You can add name function on your 1155 contract.

pragma solidity 0.8.13;

import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";

contract ItemSFT is ERC1155("") {
constructor() {
    _mint(msg.sender, 1, 1, "");

}

function name() public view returns(string memory){
    return "TEST";
   }
}

Contract Example

3
  • i fixed the code here as it can't verify at the moment
    – prenszuko
    May 12 at 15:05
  • Please do so that I may see the code. May 12 at 15:59
  • How it will set the name of contract??? Still, let me try if it works May 12 at 16:02
0

You need to setup the name of your contract:

string public name;
string public symbol;
constructor(string memory _name, string memory _symbol )ERC1155(""){    
    name = _name;
    symbol = _symbol
}
1
  • I am doing the same code you can see it in the contract I provided above. But it is not showing the contract name. May 12 at 15:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.