Skip to content

Could not parse type with internal type: undefined for custom structure #688

@wbt

Description

@wbt

I have some contracts using a library structure data storage, compiled using an older version of Solidity, but which throw an error asking me to make a report here.

In the libraryType.sol contract I have something like this:

library PersonLib {
    struct Data {
        bool   isActive;
        bytes  hashOfData;
        string handle;
    }
    function handle(Data storage self) public view returns (string) {
        return self.handle;
    }
    function markActive(Data storage self) internal {
        self.isActive = true;
    }
    //other getters & setters omitted
}

In other contracts, the library contract is imported and the type of a variable or struct member might be PersonLib.Data - sometimes, there are more than one of the same type in the same file (e.g. a Requester and a Contributor with wrapper functions similar to this:

    function requesterHandle() public view returns (string) {
        return requester.handle;
    }
    function updateRequesterHandle(string newHandle) public {
        emit RequesterHandleUpdated(newHandle);
        PersonLib.updateHandle(requester, newHandle);
    }

That works fine in Solidity, but when trying to generate types with TypeChain, that triggers an error like this:

Could not parse type: PersonLib.Data storage with internal type: undefined.

Please submit a GitHub Issue to the TypeChain team with the failing contract/library.

This error report is hereby filed per request.
Hopefully I haven't missed something important when attempting to make it a minimal example for the report.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions