Skip to content

Commit 6c01d3a

Browse files
committed
Migrate to Hardhat
1 parent 49b4651 commit 6c01d3a

15 files changed

+7212
-12387
lines changed

.gitignore

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
node_modules
22
.idea
33

4-
#Buidler files
4+
#Hardhat files
55
cache
66
artifacts
7-

README.md

+20-20
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
# Buidler Hackathon Boilerplate
1+
# Hardhat Hackathon Boilerplate
22

33
This repository contains a sample project that you can use as the starting point
44
for your Ethereum project. It's also a great fit for learning the basics of
55
smart contract development.
66

77
This project is intended to be used with the
8-
[Buidler Beginners Tutorial](http://buidler.dev/tutorial), but you should be
8+
[Hardhat Beginners Tutorial](https://hardhat.org/tutorial), but you should be
99
able to follow it by yourself by reading the README and exploring its
1010
`contracts`, `tests`, `scripts` and `frontend` directories.
1111

@@ -15,22 +15,22 @@ The first things you need to do are cloning this repository and installing its
1515
dependencies:
1616

1717
```sh
18-
git clone https://github.com/nomiclabs/buidler-hackathon-boilerplate.git
19-
cd buidler-hackathon-boilerplate
18+
git clone https://github.com/nomiclabs/hardhat-hackathon-boilerplate.git
19+
cd hardhat-hackathon-boilerplate
2020
npm install
2121
```
2222

23-
Once installed, let's run Buidler's testing network:
23+
Once installed, let's run Hardhat's testing network:
2424

2525
```sh
26-
npx buidler node
26+
npx hardhat node
2727
```
2828

2929
Then, on a new terminal, go to the repository's root folder and run this to
3030
deploy your contract:
3131

3232
```sh
33-
npx buidler run scripts/deploy.js --network localhost
33+
npx hardhat run scripts/deploy.js --network localhost
3434
```
3535

3636
Finally, we can run the frontend with:
@@ -42,26 +42,26 @@ npm start
4242
```
4343

4444
Open [http://localhost:3000/](http://localhost:3000/) to see your Dapp. You will
45-
need to have [Metamask](http://metamask.io) installed and listening to
45+
need to have [Metamask](https://metamask.io) installed and listening to
4646
`localhost 8545`.
4747

4848
## User Guide
4949

50-
You can find detailed instructions on using this repository and many tips in [its documentation](http://buidler.dev/tutorial).
50+
You can find detailed instructions on using this repository and many tips in [its documentation](https://hardhat.org/tutorial).
5151

52-
- [Project description (Token.sol)](http://buidler.dev/tutorial/4-contracts/)
53-
- [Setting up the environment](http://buidler.dev/tutorial/1-setup/)
54-
- [Testing with Buidler, Mocha and Waffle](http://buidler.dev/tutorial/5-test/)
55-
- [Setting up Metamask](http://buidler.dev/tutorial/8-frontend/#setting-up-metamask)
56-
- [Buidler's full documentation](https://buidler.dev/getting-started/)
52+
- [Project description (Token.sol)](https://hardhat.org/tutorial/4-contracts/)
53+
- [Setting up the environment](https://hardhat.org/tutorial/1-setup/)
54+
- [Testing with Hardhat, Mocha and Waffle](https://hardhat.org/tutorial/5-test/)
55+
- [Setting up Metamask](https://hardhat.org/tutorial/8-frontend/#setting-up-metamask)
56+
- [Hardhat's full documentation](https://hardhat.org/getting-started/)
5757

58-
For a complete introduction to Buidler, refer to [this guide](https://buidler.dev/getting-started/#overview).
58+
For a complete introduction to Hardhat, refer to [this guide](https://hardhat.org/getting-started/#overview).
5959

6060
## What’s Included?
6161

62-
Your environment will have everything you need to build a Dapp powered by Buidler and React.
62+
Your environment will have everything you need to build a Dapp powered by Hardhat and React.
6363

64-
- [Buidler](https://buidler.dev/): An Ethereum development task runner and testing network.
64+
- [Hardhat](https://hardhat.org/): An Ethereum development task runner and testing network.
6565
- [Mocha](https://mochajs.org/): A JavaScript test runner.
6666
- [Chai](https://www.chaijs.com/): A JavaScript assertion library.
6767
- [ethers.js](https://docs.ethers.io/ethers.js/html/): A JavaScript library for interacting with Ethereum.
@@ -70,16 +70,16 @@ Your environment will have everything you need to build a Dapp powered by Buidle
7070

7171
## Troubleshooting
7272

73-
- `Invalid nonce` errors: if you are seeing this error on the `buidler node`
73+
- `Invalid nonce` errors: if you are seeing this error on the `npx hardhat node`
7474
console, try resetting your Metamask account. This will reset the account's
7575
transaction history and also the nonce. Open Metamask, click on your account
7676
followed by `Settings > Advanced > Reset Account`.
7777

7878
## Feedback, help and news
7979

8080
We'd love to have your feedback on this tutorial. Feel free to reach us through
81-
this repository or [our Telegram Support Group](https://t.me/BuidlerSupport).
81+
this repository or [our Discord server](https://invite.gg/HardhatSupport).
8282

83-
Also you can [follow Nomic Labs on Twitter](https://twitter.com/nomiclabs).
83+
Also you can [follow us on Twitter](https://twitter.com/HardhatHQ).
8484

8585
**Happy _buidling_!**

buidler.config.js

-8
This file was deleted.

contracts/Token.sol

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
1+
//SPDX-License-Identifier: UNLICENSED
2+
13
// Solidity files have to start with this pragma.
24
// It will be used by the Solidity compiler to validate its version.
3-
pragma solidity ^0.5.15;
5+
pragma solidity ^0.7.0;
46

57
// We import this library to be able to use console.log
6-
import "@nomiclabs/buidler/console.sol";
8+
import "hardhat/console.sol";
79

810

911
// This is the main building block for smart contracts.
1012
contract Token {
1113
// Some string type variables to identify the token.
12-
string public name = "My Buidler Token";
13-
string public symbol = "MBT";
14+
string public name = "My Hardhat Token";
15+
string public symbol = "MHT";
1416

1517
// The fixed amount of tokens stored in an unsigned integer type variable.
1618
uint256 public totalSupply = 1000000;
@@ -27,7 +29,7 @@ contract Token {
2729
* The `constructor` is executed only once when the contract is created.
2830
* The `public` modifier makes a function callable from outside the contract.
2931
*/
30-
constructor() public {
32+
constructor() {
3133
// The totalSupply is assigned to transaction sender, which is the account
3234
// that is deploying the contract.
3335
balances[msg.sender] = totalSupply;

frontend/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ this project, and what can be reused.
3232
## Feedback, help and news
3333

3434
Feel free to reach us through this repository or
35-
[our Telegram Support Group](https://t.me/BuidlerSupport).
35+
[our Discord server](https://invite.gg/HardhatSupport).
3636

37-
Also you can [follow Nomic Labs on Twitter](https://twitter.com/nomiclabs).
37+
Also you can [follow us on Twitter](https://twitter.com/HardhatHQ).
3838

3939
**Happy _buidling_!**

frontend/public/index.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<meta name="theme-color" content="#000000" />
88
<meta
99
name="description"
10-
content="Buidler React Dapp"
10+
content="Hardhat React Dapp"
1111
/>
1212
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
1313
<!--
@@ -24,7 +24,7 @@
2424
work correctly both with client-side routing and a non-root public URL.
2525
Learn how to configure a non-root public URL by running `npm run build`.
2626
-->
27-
<title>Buidler + React App = Dapp</title>
27+
<title>Hardhat + React App = Dapp</title>
2828
</head>
2929
<body>
3030
<noscript>You need to enable JavaScript to run this app.</noscript>

frontend/public/manifest.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"short_name": "Buidler React Dapp",
3-
"name": "Buidler Create React Dapp Sample",
2+
"short_name": "Hardhat React Dapp",
3+
"name": "Hardhat Create React Dapp Sample",
44
"icons": [
55
{
66
"src": "favicon.ico",

frontend/src/components/Dapp.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ import { TransactionErrorMessage } from "./TransactionErrorMessage";
1919
import { WaitingForTransactionMessage } from "./WaitingForTransactionMessage";
2020
import { NoTokensMessage } from "./NoTokensMessage";
2121

22-
// This is the Buidler EVM network id, you might change it in the buidler.config.js
22+
// This is the Hardhat Network id, you might change it in the hardhat.config.js
2323
// Here's a list of network ids https://docs.metamask.io/guide/ethereum-provider.html#properties
2424
// to use when deploying to other networks.
25-
const BUIDLER_EVM_NETWORK_ID = '31337';
25+
const HARDHAT_NETWORK_ID = '31337';
2626

2727
// This is an error code that indicates that the user canceled a transaction
2828
const ERROR_CODE_TX_REJECTED_BY_USER = 4001;
@@ -278,7 +278,7 @@ export class Dapp extends React.Component {
278278
// - It can fail before reaching the ethereum network (i.e. if the user
279279
// doesn't have ETH for paying for the tx's gas)
280280
// - It has to be mined, so it isn't immediately confirmed.
281-
// Note that some testing networks, like Buidler EVM, do mine
281+
// Note that some testing networks, like Hardhat Network, do mine
282282
// transactions immediately, but your dapp should be prepared for
283283
// other networks.
284284
// - It can fail once mined.
@@ -356,7 +356,7 @@ export class Dapp extends React.Component {
356356

357357
// This method checks if Metamask selected network is Localhost:8545
358358
_checkNetwork() {
359-
if (window.ethereum.networkVersion === BUIDLER_EVM_NETWORK_ID) {
359+
if (window.ethereum.networkVersion === HARDHAT_NETWORK_ID) {
360360
return true;
361361
}
362362

frontend/src/components/NoTokensMessage.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export function NoTokensMessage({ selectedAddress }) {
88
To get some tokens, open a terminal in the root of the repository and run:
99
<br />
1010
<br />
11-
<code>npx buidler --network localhost faucet {selectedAddress}</code>
11+
<code>npx hardhat --network localhost faucet {selectedAddress}</code>
1212
</p>
1313
</>
1414
);

hardhat.config.js

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
require("@nomiclabs/hardhat-waffle");
2+
3+
// The next line is part of the sample project, you don't need it in your
4+
// project. It imports a Hardhat task definition, that can be used for
5+
// testing the frontend.
6+
require("./tasks/faucet");
7+
8+
module.exports = {
9+
solidity: "0.7.3"
10+
};

0 commit comments

Comments
 (0)