openzeppelin-test-environment icon indicating copy to clipboard operation
openzeppelin-test-environment copied to clipboard

please god, please ethers support

Open SilentCicero opened this issue 5 years ago • 2 comments

Hi all,

Really happy to see some Truffle suite alternatives.

But, I have one comment: ethers.js, ethers.js, ethers.js, ethers.js

Please support ethers.js contracts / preferences.

Best, Ethereum Friend.

SilentCicero avatar Aug 03 '20 14:08 SilentCicero

Thank you for the feedback @SilentCicero. We will definitely keep this in mind for planning.

frangio avatar Aug 03 '20 20:08 frangio

I'd also love to see ethers.js support.

This will spill over into @openzeppelin/test-helpers, since expectEvent doesn't support ethers-style receipts, though I assume you're already aware of this.

Another thing to consider when supporting this is to make sure it supports ganache forks properly. I tried using ethers in testing manually, but as soon as contract development progressed to the stage of needing to fork the mainnet, transactions started failing.

For example, these lines worked until I started forking the mainnet:

const TestToken = contract.fromArtifact('TestToken');
const tokenFactory = new ethers.ContractFactory(TestToken.abi, TestToken.bytecode, wallet);
usdc = await tokenFactory.deploy('USD Coin', 'USDC');
await usdc.deployTransaction.wait();

When forking, the above fails with Error: Missing required chain parameter: networkId

You can confirm the issue is related to ethers.js usage because if you refactor to the below, the transaction succeeds again:

const TestToken = contract.fromArtifact('TestToken');
const usdc = await TestToken.new("USD Coin", "USDC");

mds1 avatar Aug 20 '20 01:08 mds1