hardhat-copy
hardhat-copy
helps you import an Ethereum mainnet smart contract onto your local Hardhat node, enabling you to rapidly experiment with production smart contracts from the safety of your local environment.
๐
getting started
Make sure you have downloaded the Node.js library from npm and have also installed Hardhat. Then just use npx hardhat-copy
to generate a project which clones and deploys your desired mainnet smart contract onto your local branch:
# Try it!
CONTRACT_ADDRESS=0xef0182dc0574cd5874494a120750fd222fdb909a npx hardhat-copy
This will create a hardhat project in your working directory, i.e.:
HardhatCopy_0xef0182dc0574cd5874494a120750fd222fdb909a/
If you cd
into this project, you can execute the included Mocha unit tests using the HRE:
npx hardhat test
By default, this simply deploys the specified smart contract onto your local environment; the included unit tests can then be extended for your own experimentation!