(opens new window)
(opens new window)
Hardhat (opens new window) plugin for integration with TruffleContract from Truffle 5. This allows tests and scripts written for Truffle to work with Hardhat.
This plugin brings to Hardhat TruffleContracts from Truffle 5. With it you can call contract() and artifacts.require() (opens new window) like you normally would with Truffle. Interact with your contracts with a familiar API from tasks, scripts and tests.
This plugin requires hardhat-web3 (opens new window) as a prerequisite.
npm install --save-dev @nomiclabs/hardhat-truffle5 @nomiclabs/hardhat-web3 web3
And add the following statement to your hardhat.config.js:
require("@nomiclabs/hardhat-truffle5");
Or, if you are using TypeScript, add this to your hardhat.config.ts:
import "@nomiclabs/hardhat-truffle5";
This plugin creates no additional tasks.
An instance of TruffleEnvironmentArtifacts (opens new window) is injected into env.artifacts and the method contract() is injected into the global scope for using in tests.
There are no additional steps you need to take for this plugin to work. Install it, run npx hardhat test and your Truffle tests should run with no need to make any modifications.
Take a look at the testing guide (opens new window) for a tutorial using it.