1

I have 2 contracts : Registry, Factory. Registry contract is compatible with ERC721 contract like this:

pragma solidity ^0.4.24;

import "../openzeppelin-solidity/contracts/token/ERC721/ERC721MetadataMintable.sol";

contract Registry is ERC721MetadataMintable {
    string public name;
    string public symbol;

    constructor(
        string _name,
        string _symbol
    ) ERC721MetadataMintable() public payable {
        name = _name;
        symbol = _symbol;
    }
}

Factory contract is like this below:

pragma solidity ^0.4.24;

import "./Registry.sol";

contract Factory {

    function _createRegistry (
        string _name,
        string _symbol
    ) internal returns (address) {
        return new Registry(_name, _symbol);
    }
}

However I get error just like this below:

browser/Factory.sol:15:16: TypeError: Trying to create an instance of an abstract contract.
    return new Registry(_name, _symbol);
           ^----------^
browser/ERC721Metadata.sol:28:5: Missing implementation:
constructor (string name, string symbol) public {
^ (Relevant source part starts here and spans across multiple lines).
1

Contract Registry inherits from contract ERC721MetadataMintable.

Contract ERC721MetadataMintable inherits from contract ERC721Metadata.

The constructor of contract ERC721Metadata takes two string parameters as input.

You should therefore make sure to call this constructor in the constructor of contract Registry:

constructor(
    string _name,
    string _symbol
) ERC721MetadataMintable() ERC721Metadata(_name, _symbol) public payable {
    ...
}
  • Yes, it worked with no error. I should've check all the inheritance relations of those ERC721 contracts. Thank you so much. – kphex Dec 27 '18 at 0:56

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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