From 7e7b839950f693f5fe4ad84ca110cf110204a00a Mon Sep 17 00:00:00 2001 From: Gaston Needleman Date: Wed, 11 Nov 2020 09:53:21 -0300 Subject: [PATCH] migration buidler to hardhat (with some extra fixes) --- buidler.config.js => hardhat.config.js | 18 +++++----- package.json | 33 +++++++++---------- .../{buidler-hooks.js => hardhat-hooks.js} | 4 +-- 3 files changed, 28 insertions(+), 27 deletions(-) rename buidler.config.js => hardhat.config.js (84%) rename scripts/{buidler-hooks.js => hardhat-hooks.js} (96%) diff --git a/buidler.config.js b/hardhat.config.js similarity index 84% rename from buidler.config.js rename to hardhat.config.js index 5ab2ba1..683c65d 100644 --- a/buidler.config.js +++ b/hardhat.config.js @@ -1,10 +1,10 @@ -const { usePlugin } = require('@nomiclabs/buidler/config') -const hooks = require('./scripts/buidler-hooks') +const { usePlugin } = require('hardhat/config') +const hooks = require('./scripts/hardhat-hooks') -usePlugin('@aragon/buidler-aragon') -usePlugin('@nomiclabs/buidler-solhint') -usePlugin('buidler-gas-reporter') -usePlugin('solidity-coverage') +require('@aragon/buidler-aragon') +require('@nomiclabs/hardhat-solhint') +require('hardhat-gas-reporter') +require('solidity-coverage') const ACCOUNTS = (process.env.ETH_KEYS ? process.env.ETH_KEYS.split(',') : []) .map(key => key.trim()) @@ -41,7 +41,7 @@ module.exports = { // to have Frame running on your machine. Download it from: // https://frame.sh frame: { - httpHeaders: { origin: 'buidler' }, + httpHeaders: { origin: 'hardhat' }, url: 'http://localhost:1248', }, // xDAI network configured with Aragon node. @@ -54,10 +54,12 @@ module.exports = { }, solc: { version: '0.4.24', - optimizer: { + settings: { + optimizer: { enabled: true, runs: 10000, }, + } }, gasReporter: { enabled: !!process.env.GAS_REPORTER, diff --git a/package.json b/package.json index 8632474..c3d7a29 100644 --- a/package.json +++ b/package.json @@ -11,15 +11,13 @@ "@aragon/buidler-aragon": "^0.2.9", "@aragon/templates-shared": "^1.0.1", "@aragon/test-helpers": "^2.0.0", - "@nomiclabs/buidler": "^1.4.3", - "@nomiclabs/buidler-etherscan": "^1.3.3", - "@nomiclabs/buidler-ganache": "^1.3.3", - "@nomiclabs/buidler-solhint": "^1.3.3", - "@nomiclabs/buidler-truffle5": "^1.3.4", - "@nomiclabs/buidler-web3": "^1.3.4", + "@nomiclabs/hardhat-etherscan": "^2.0.0", + "@nomiclabs/hardhat-ganache": "^2.0.0", + "@nomiclabs/hardhat-solhint": "^2.0.0", + "@nomiclabs/hardhat-truffle5": "^2.0.0", + "@nomiclabs/hardhat-web3": "^2.0.0", "babel-eslint": "^10.0.2", - "buidler-extract": "^1.0.0", - "buidler-gas-reporter": "^0.1.3", + "hardhat-gas-reporter": "^1.0.1", "cross-env": "^5.2.0", "eslint": "^6.0.1", "eslint-config-prettier": "^6.0.0", @@ -33,6 +31,7 @@ "eslint-plugin-standard": "^4.0.0", "ethlint": "^1.2.4", "fs-extra": "^8.1.0", + "hardhat": "^2.0.2", "prettier": "^1.18.2", "solidity-coverage": "^0.7.9", "solium": "^1.2.5", @@ -41,15 +40,15 @@ "scripts": { "postinstall": "npm run compile && npm run build-app", "build-app": "cd app && npm install && cd ..", - "compile": "buidler compile --force", + "compile": "hardhat compile --force", "lint": "solium --dir ./contracts", - "test": "buidler test --network buidlerevm", - "test:gas": "REPORT_GAS=true buidler test --network localhost", - "coverage": "buidler coverage --network coverage", - "abi:extract": "buidler-extract --output abi/ --keys abi", - "start": "buidler start", - "publish:major": "buidler publish major", - "publish:minor": "buidler publish minor", - "publish:patch": "buidler publish patch" + "test": "hardhat test --network hardhatevm", + "test:gas": "REPORT_GAS=true hardhat test --network localhost", + "coverage": "hardhat coverage --network coverage", + "abi:extract": "hardhat-extract --output abi/ --keys abi", + "start": "hardhat start", + "publish:major": "hardhat publish major", + "publish:minor": "hardhat publish minor", + "publish:patch": "hardhat publish patch" } } diff --git a/scripts/buidler-hooks.js b/scripts/hardhat-hooks.js similarity index 96% rename from scripts/buidler-hooks.js rename to scripts/hardhat-hooks.js index fba709a..8c9cf61 100644 --- a/scripts/buidler-hooks.js +++ b/scripts/hardhat-hooks.js @@ -1,11 +1,11 @@ /* * These hooks are called by the Aragon Buidler plugin during the start task's lifecycle. Use them to perform custom tasks at certain entry points of the development build process, like deploying a token before a proxy is initialized, etc. * - * Link them to the main buidler config file (buidler.config.js) in the `aragon.hooks` property. + * Link them to the main hardhat config file (hardhat.config.js) in the `aragon.hooks` property. * * All hooks receive two parameters: * 1) A params object that may contain other objects that pertain to the particular hook. - * 2) A "bre" or BuidlerRuntimeEnvironment object that contains enviroment objects like web3, Truffle artifacts, etc. + * 2) A "hre" or HardhatRuntimeEnvironment object that contains enviroment objects like web3, Truffle artifacts, etc. * * Please see AragonConfigHooks, in the plugin's types for further details on these interfaces. * https://github.com/aragon/buidler-aragon/blob/develop/src/types.ts#L31