question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[ethers] Function fragments with struct arrays are falsely represented as `tuple[]`

See original GitHub issue

Typechain generates these function fragments:

  functions: {
    "requestExec(address,bytes,uint64,uint256,uint256,tuple[])": FunctionFragment;
    "requestExecWithTimeout(address,bytes,uint64,uint256,uint256,tuple[],uint256)": FunctionFragment;
  };

However when outputting the actual function fragments you will see that the fragment keys do not align. This is because typechain represents a (address,uint256)[] tuple-array as just tuple[].

{

  'requestExec(address,bytes,uint64,uint256,uint256,(address,uint256)[])': FunctionFragment {
    type: 'function',
    name: 'requestExec',
    constant: false,
    inputs: [
      [ParamType],
      [ParamType],
      [ParamType],
      [ParamType],
      [ParamType],
      [ParamType]
    ],
    outputs: [ [ParamType] ],
    payable: false,
    stateMutability: 'nonpayable',
    gas: BigNumber { _hex: '0xaeb690', _isBigNumber: true },
    _isFragment: true
  },
  'requestExecWithTimeout(address,bytes,uint64,uint256,uint256,(address,uint256)[],uint256)': FunctionFragment {
    type: 'function',
    name: 'requestExecWithTimeout',
    constant: false,
    inputs: [
      [ParamType],
      [ParamType],
      [ParamType],
      [ParamType],
      [ParamType],
      [ParamType],
      [ParamType]
    ],
    outputs: [ [ParamType] ],
    payable: false,
    stateMutability: 'nonpayable',
    gas: BigNumber { _hex: '0xaeb690', _isBigNumber: true },
    _isFragment: true
  },
}

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
krzkaczorcommented, May 30, 2021

@TransmissionsDev tbh I am swamped with work. It would be super useful if you could create a PR for this.

1reaction
krzkaczorcommented, May 24, 2021

@TransmissionsDev thanks for this issue. Interesting bug. It might be a problem in out abi parser but not sure. Can you create a minimal repro somewhere? or just post here a solidity code that would generate such ABI?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Interface - Ethers.js
Create a new Interface from a JSON string or object representing abi. The abi may be a JSON string or the ... All...
Read more >
How to pass array of structs as argument on etherscan ...
I'm trying to pass the format of array of structs as argument on smart contract write function on etherscan,. This is solidity example:....
Read more >
Documentation - ethers
The ethers.js library aims to be a complete and compact library for interacting with the Ethereum Blockchain and its ecosystem. It was originally...
Read more >
solidity - tuple[] for a function input. How to use it?
When you write a struct in Solidity, it gets mapped as tuple in the ABI. The actual structure of the struct can be...
Read more >
SMT-Friendly Formalization of the Solidity Memory Model
ure 1, and the abstract syntax of the targeted fragment is presented in Figure 2. ... other hand, are passed by reference and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found