Search code examples
methodsethereumsoliditysignaturesmartcontracts

Solidity Function Signature - question about part of signature


I'm looking at examples of Smart Contracts written in Solidity and I found a constructor with the signature:

constructor() ERC721Full("<Token name>", "<Token Symbol>") public {

}

what is the ERC721Full("", "") part of the signature? And how am I able to pass arguments into it?


Solution

  • You can hardcode it, or modify your constructor to have more parameters.

    Code example:

    contract A {
        string public name;
        constructor(string tokenName) public {
            name = tokenName;
        }
    }
    
    // Hardcode
    contract B is A {
        constructor() A("My tokenName") public {
    
        }
    }
    
    // Add params to constructor
    contract C is A {
        constructor(string tokenName) A(tokenName) public {
    
        }
    }