Skip to content

Commit

Permalink
w1-2
Browse files Browse the repository at this point in the history
  • Loading branch information
0xyue committed Mar 12, 2023
1 parent 37ce650 commit 281baad
Show file tree
Hide file tree
Showing 10 changed files with 16,233 additions and 5 deletions.
17 changes: 12 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,15 @@
豋链社区 区块链技术集训营第二期
https://learnblockchain.cn/course/28

## Week1-1
作业题
01-安装metamask
02-执行一次转账
03-使用remix创建一个Counter合约并部署,Counter合约有一个add(x)方法
## W1-1 作业题

### 01-安装metamask
### 02-执行一次转账
### 03-使用remix创建一个Counter合约并部署,Counter合约有一个add(x)方法


## W1-2 作业题

### 01-使⽤ Hardhat 部署修改后的 Counter
### 02-使⽤ Hardhat 测试 Counter
### 03-写⼀个脚本调⽤ count()
11 changes: 11 additions & 0 deletions w1-2/counter/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
node_modules
.env
coverage
coverage.json
typechain
typechain-types

# Hardhat files
cache
artifacts

13 changes: 13 additions & 0 deletions w1-2/counter/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Sample Hardhat Project

This project demonstrates a basic Hardhat use case. It comes with a sample contract, a test for that contract, and a script that deploys that contract.

Try running some of the following tasks:

```shell
npx hardhat help
npx hardhat test
REPORT_GAS=true npx hardhat test
npx hardhat node
npx hardhat run scripts/deploy.js
```
19 changes: 19 additions & 0 deletions w1-2/counter/contracts/Counter.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.9;

// Uncomment this line to use console.log
// import "hardhat/console.sol";

contract Counter {
uint public counter;

function add1() public returns(uint){
counter += 1;
return counter;
}

function addx(uint x) public returns(uint){
counter = counter + x;
return counter;
}
}
37 changes: 37 additions & 0 deletions w1-2/counter/hardhat.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
require("@nomicfoundation/hardhat-toolbox");
require("@nomiclabs/hardhat-etherscan");
const dotenv = require("dotenv");

dotenv.config();

// set proxy
// const { ProxyAgent, setGlobalDispatcher } = require("undici");
// const proxyAgent = new ProxyAgent('http://127.0.0.1:10010'); // change to yours
// setGlobalDispatcher(proxyAgent);


// This is a sample Hardhat task. To learn how to create your own go to
// https://hardhat.org/guides/create-task.html
task("accounts", "Prints the list of accounts", async (taskArgs, hre) => {
const accounts = await hre.ethers.getSigners();

for (const account of accounts) {
console.log(account.address);
}
});

/** @type import('hardhat/config').HardhatUserConfig */
module.exports = {
solidity: "0.8.18",
networks: {
hardhat: {},
goerli: {
url: process.env.GOERLI_RPC_URL,
accounts: [process.env.PRIVATE_KEY]
}
},
etherscan: {
apiKey: process.env.ETHERSCAN_KEY
},

};
Loading

0 comments on commit 281baad

Please sign in to comment.