NomicFoundation / hardhat

Hardhat is a development environment to compile, deploy, test, and debug your Ethereum software.
https://hardhat.org
Other
7.3k stars 1.41k forks source link

Plugin for Ganache #259

Closed daniel-iobuilders closed 5 years ago

daniel-iobuilders commented 5 years ago

I would like to start to work on a plugin to manage Ganache. Could you give me some hints, what's the best way to start with the plugin?

alcuadrado commented 5 years ago

Hey Daniel! Thanks for offering your help 🙌🏻

We've been thinking about how to implement this. The main issue we see is that there's not a finished standard about what a javascript ethereum provider should be. There's EIP1193 but it's not ready yet. This complicates integration with the different plugins (e.g. buidler-ethers and buidler-web3).

What we have in mind, as a temporal solution, is to implement something similar to this script.

The idea is to override the test task to do this:

  1. Check if the network is develop. If it's not, do nothing special.
  2. Check if ganache-cli is running in the right port, if it's running, do nothing special.
  3. Start ganache-cli as a subprocess.
  4. Wait for ganache-cli to start working (the linked script does it with nc and sleep).
  5. Run the tests
  6. Gracefully kill ganache-cli.

What do you think?

I've just pushed a branch with an empty plugin with all of its boilerplate ready. You should be able to implement this in its index.ts, and to test it here.

Also, I created a CONTRIBUTING.md file with some info about our dev workflow.

You may also want to check out this guide

fzeoli commented 5 years ago

any updates?

daniel-iobuilders commented 5 years ago

@fzeoli Yes! I have working on it and opened a draft pull request for it. It's still a draft because I'm not sure how to test the the test task. I've written a test for, which executes a dummy tests, but I don't get any more feedback than that. So I would need some help to properly test this.

alcuadrado commented 5 years ago

This plugin has finally been released today.

Thanks @daniel-iobuilders for your help!