Contracts with `toString()` functions panic when deployed
See original GitHub issueDescribe the bug
ethers fails to deploy contracts with a toString()
function. (I was developing a library, but I assume normal contracts have the same issue). There are probably other function names that conflict with native js functions. valueOf()
is likely another one.
Reproduction steps
Create a contract with a toString()
function
library MyLibrary {
function toString(uint256 value) public returns(string){
// ...
}
}
Then, attempting to deploy that contract using ethers and hardhat…
const myLibFactory = await ethers.getContractFactory('MyLibrary')
const myLib = await myLibFactory.deploy() // errors
yields this error message:
TypeError: uniqueNames[name_1].push is not a function
at /.../@ethersproject/contracts/src.ts/index.ts:717:35
Environment: Hardhat 2.4.1, ethers 5.4.6
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
How to Build a Full Stack NFT Marketplace - V2 (2022)
Has anyone received the following error? Ran into it while trying out the UI locally after running the deploy script for the first...
Read more >1. Preparation
Our trigger contract is useless if we can't verify it works properly. So before we start developing our trigger contract, we'll need to...
Read more >Is it considered good practice to use contract functions ...
However, the needs may change in the future and it is perfectly fine to use setters, but it is good to keep some...
Read more >Getting Deep Into EVM: How Ethereum Works Backstage
The first thing that happens when a new contract is deployed to the Ethereum blockchain is that its account is created. As you...
Read more >revert" in Truffle test and Truffle dev in Crowdsale - Contracts
TokenSPC.deployed().then(instance => token = instance) ... function () { // Deploy a new token and crowdsale contract for each test ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Can be reproduced with
Closing, as this seems to be fixed in 5.5.X. Thank you @ricmoo.