Skip to content

Commit

Permalink
fix(basic): update task 09 with the hardhat 2.22.2
Browse files Browse the repository at this point in the history
  • Loading branch information
gongtao245 committed Mar 29, 2024
1 parent 2c864dd commit 774d81a
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 159 deletions.
2 changes: 1 addition & 1 deletion basic/09-hardhat-react/README-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Dapp 开发中很重要的部分便是前端展示,本样例代码使用 hardh
2. 部署合约

```sh
npx hardhat run scripts/deploy.js --network goerli
npx hardhat run scripts/deploy.js --network sepolia
```

3. 启动 react
Expand Down
2 changes: 1 addition & 1 deletion basic/09-hardhat-react/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Put your private key in .env for easy access, formatted with "PRIVATE_KEY=xxxx".
2. Deploy contracts

```sh
npx hardhat run scripts/deploy.js --network goerli
npx hardhat run scripts/deploy.js --network sepolia
```

3. Startup react
Expand Down
7 changes: 2 additions & 5 deletions basic/09-hardhat-react/hardhat.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
require('@nomiclabs/hardhat-waffle');

// The next line is part of the sample project, you don't need it in your
// project. It imports a Hardhat task definition, that can be used for
// testing the frontend.
require("@nomicfoundation/hardhat-toolbox");
require('./tasks/faucet');
const fs = require('fs');
require('dotenv').config();
Expand All @@ -11,6 +7,7 @@ function mnemonic() {
return process.env.PRIVATE_KEY;
}

/** @type import('hardhat/config').HardhatUserConfig */
module.exports = {
solidity: '0.8.0',
networks: {
Expand Down
44 changes: 13 additions & 31 deletions basic/09-hardhat-react/package.json
Original file line number Diff line number Diff line change
@@ -1,39 +1,21 @@
{
"name": "hardhat-hackathon-boilerplate",
"name": "09-hardhat-react",
"version": "1.0.0",
"description": "A boilerplate repository to get you started with Hardhat and Ethereum development",
"directories": {
"test": "test"
},
"description": "",
"main": "index.js",
"scripts": {
"test": "npx hardhat test"
},
"repository": {
"type": "git",
"url": "git+https://github.com/nomiclabs/hardhat-hackathon-boilerplate.git"
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [
"hardhat",
"ethereum",
"hackathon"
],
"author": "Nomic Labs",
"license": "MIT",
"bugs": {
"url": "https://github.com/nomiclabs/hardhat-hackathon-boilerplate/issues"
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"@openzeppelin/contracts": "^4.1.0",
"dotenv": "^16.4.5",
"hardhat": "^2.22.2",
"ipfs-api": "^26.1.2"
},
"homepage": "https://github.com/nomiclabs/hardhat-hackathon-boilerplate#readme",
"devDependencies": {
"@nomiclabs/hardhat-ethers": "^2.0.0",
"@nomiclabs/hardhat-waffle": "^2.0.0",
"chai": "^4.2.0",
"ethereum-waffle": "^3.1.1",
"ethers": "^5.0.0",
"hardhat": "^2.0.4",
"husky": "^4.2.5"
},
"dependencies": {
"@openzeppelin/contracts": "^4.4.2",
"dotenv": "^10.0.0"
"@nomicfoundation/hardhat-toolbox": "^5.0.0"
}
}
6 changes: 3 additions & 3 deletions basic/09-hardhat-react/scripts/deploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ async function main() {
await deployer.getAddress()
)

console.log('Account balance:', (await deployer.getBalance()).toString())
console.log('Account balance:', (await ethers.provider.getBalance(deployer.address)).toString())

const Token = await ethers.getContractFactory('SimpleToken')
const token = await Token.deploy('Hello', 'Token', 1, 10000)
await token.deployed()
await token.waitForDeployment()

console.log('SimpleToken address:', token.address)
console.log('SimpleToken address:', token.target)

// We also save the contract's artifacts and address in the frontend directory
saveFrontendFiles(token, deployer)
Expand Down
118 changes: 0 additions & 118 deletions basic/09-hardhat-react/test/SimpleToken.js

This file was deleted.

0 comments on commit 774d81a

Please sign in to comment.