0

I have made a smart contract for nft minting where there is a small part . while compiling I am getting this error .

here is the part where the error is

    /**
     * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
     */
    constructor (string memory name_, string memory symbol_) {
        name = name;
        symbol = symbol;
    }

1 Answer 1

2
constructor (string memory name_, string memory symbol_) { 
  name = name;
  symbol = symbol; 
}

You're assigning name and symbol to themselves. Here is your error:

name = name;
symbol = symbol; 

As you can see name is equal to itself.

You can fix it by assigning the variable properly by using name_ and symbol_:

name = name_; 
symbol = symbol_; 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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