Replies: 4 comments
-
It can’t know which you mean though, because the string of an address, looks like a normal hexadecimal value for a uint256. Ethers will never guess if the situation is ambiguous by its value. But this is why v6 introduced the Typed API, you can use Does that make sense? |
Beta Was this translation helpful? Give feedback.
-
OK but couldn't the number of arguments determine which function to execute? |
Beta Was this translation helpful? Give feedback.
-
Constraining by the number of arguments is possible, but since a Contract method allows an overrides, it cannot tell whether you were calling In general, I think the Does that make sense? (I'm moving this to discussion ;)) |
Beta Was this translation helpful? Give feedback.
-
It seems we have not found a solution to this yet? In my case, I have two mint functions, each one with a distinct list of parameters and its types. Ethers is being able to compile ok, at the generated artifact`s abi, I can see both functions were created. But by trying to invoke one of them, ethers will still complain about "TypeError: ambiguous function description (i.e. matches "mint(address,uint256,uint256,bytes)", "mint(address,uint256,string,string,uint256)")". |
Beta Was this translation helpful? Give feedback.
-
Ethers Version
6.7.0
Search Terms
No response
Describe the Problem
I added function
burn(address account, uint256 amount) public onlyRole(BURNER_ROLE)
to an ERC20 contract. It compiles successfully.But after deployment and calling the function like this:
await contract.burn(signer2.address, 1)
this error appears:
I would have expected that it would determine which function should be executed by checking the argument list of the call. i.e. the function signatures are different enough that there should have been no ambiguity.
Code Snippet
Contract ABI
Errors
No response
Environment
Hardhat
Environment (Other)
No response
Beta Was this translation helpful? Give feedback.
All reactions