TypeChain icon indicating copy to clipboard operation
TypeChain copied to clipboard

Overloads not generated for encode/decodeFunctionData

Open yahgwai opened this issue 2 years ago • 1 comments

The following contract:

contract Overloads {
    function myFunc(uint a) public {}
    function myFunc(bool b) public {}
}

generates an interface like this:

export interface OverloadInterface extends utils.Interface {
  contractName: "Overload";
  functions: {
    "myFunc(bool)": FunctionFragment;
  };

  encodeFunctionData(functionFragment: "myFunc", values: [boolean]): string;

  decodeFunctionResult(functionFragment: "myFunc", data: BytesLike): Result;

  events: {};
}

which has an incomplete functionsobject, and invalid encodeFunctionData and decodeFunctionData.

It should be:

export interface OverloadInterface extends utils.Interface {
  contractName: "Overload";
  functions: {
    "myFunc(bool)": FunctionFragment;
    "myFunc(uint256)": FunctionFragment;
  };

  encodeFunctionData(functionFragment: "myFunc(bool)", values: [boolean]): string;
  encodeFunctionData(functionFragment: "myFunc(uint256)", values: [BigNumberish]): string;

  decodeFunctionResult(functionFragment: "myFunc(bool)", data: BytesLike): Result;
  decodeFunctionResult(functionFragment: "myFunc(uint256)", data: BytesLike): Result;

  events: {};
}

yahgwai avatar Aug 15 '22 15:08 yahgwai

I'm having the same issue, any update on this?

clauBv23 avatar Apr 29 '24 10:04 clauBv23