Skip to content

Human generated abi format created with ethers v6 throws an error #4479

@ra-sun-god

Description

@ra-sun-god

Ethers Version

6.8.1

Search Terms

abi, contract

Describe the Problem

I created a script which converts solidity abi to a human readable format, specifically multicall3's abi, but after, using the new abi resulted in an error below:

TypeError: mCallContract.tryAggregate is not a function. (In 'mCallContract.tryAggregate(revertOnError, inputs)', 'mCallContract.tryAggregate.staticCall' is undefined) —

Code Snippet

let mCallContract = new Contract(mCallContractAddr, multicall3Abi)
let resultsArr =  await mCallContract.tryAggregate.staticCall(revertOnError, inputs)

Contract ABI

`["function aggregate(tuple(address,bytes)(address target, bytes callData)[] calls) payable returns (uint256 blockNumber, bytes[] returnData)","function aggregate3(tuple(address,bool,bytes)(address target, bool allowFailure, bytes callData)[] calls) payable returns (tuple(bool,bytes)(bool success, bytes returnData)[] returnData)","function aggregate3Value(tuple(address,bool,uint256,bytes)(address target, bool allowFailure, uint256 value, bytes callData)[] calls) payable returns (tuple(bool,bytes)(bool success, bytes returnData)[] returnData)","function blockAndAggregate(tuple(address,bytes)(address target, bytes callData)[] calls) payable returns (uint256 blockNumber, bytes32 blockHash, tuple(bool,bytes)(bool success, bytes returnData)[] returnData)","function getBasefee() view returns (uint256 basefee)","function getBlockHash(uint256 blockNumber) view returns (bytes32 blockHash)","function getBlockNumber() view returns (uint256 blockNumber)","function getChainId() view returns (uint256 chainid)","function getCurrentBlockCoinbase() view returns (address coinbase)","function getCurrentBlockDifficulty() view returns (uint256 difficulty)","function getCurrentBlockGasLimit() view returns (uint256 gaslimit)","function getCurrentBlockTimestamp() view returns (uint256 timestamp)","function getEthBalance(address addr) view returns (uint256 balance)","function getLastBlockHash() view returns (bytes32 blockHash)","function tryAggregate(bool requireSuccess, tuple(address,bytes)(address target, bytes callData)[] calls) payable returns (tuple(bool,bytes)(bool success, bytes returnData)[] returnData)","function tryBlockAndAggregate(bool requireSuccess, tuple(address,bytes)(address target, bytes callData)[] calls) payable returns (uint256 blockNumber, bytes32 blockHash, tuple(bool,bytes)(bool success, bytes returnData)[] returnData)"]`

Errors

TypeError: mCallContract.tryAggregate is not a function. (In 'mCallContract.tryAggregate(revertOnError, inputs)', 'mCallContract.tryAggregate.staticCall' is undefined) —

Environment

No response

Environment (Other)

No response

Metadata

Metadata

Assignees

Labels

bugVerified to be an issue.fixed/completeThis Bug is fixed or Enhancement is complete and published.v6Issues regarding v6

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions