Skip to content

Commit 03aa026

Browse files
jolycaojolycao
jolycao
authored and
jolycao
committed
fromat code style and fix config file
1 parent 51c0c94 commit 03aa026

File tree

6 files changed

+20
-11
lines changed

6 files changed

+20
-11
lines changed

Diff for: basic/25-multi-sig-wallet/.env.example

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
PRIVATE_KEY=xxxxxxxxxxxxxxxx
2+
INFURA_ID=yyyyyyyy

Diff for: basic/25-multi-sig-wallet/contracts/Hello.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
pragma solidity ^0.6.0;
1+
pragma solidity ^0.6.12;
22

33
contract Hello {
44
uint256 public balance;

Diff for: basic/25-multi-sig-wallet/contracts/MultiSigWallet.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
pragma solidity ^0.6.0;
1+
pragma solidity ^0.6.12;
22

33

44
/// @title Multisignature wallet - Allows multiple parties to agree on transactions before execution.

Diff for: basic/25-multi-sig-wallet/hardhat.config.js

+9-8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
require("@nomiclabs/hardhat-waffle");
22
const fs = require("fs");
3+
require('dotenv').config()
34

45
// This is a sample Hardhat task. To learn how to create your own go to
56
// https://hardhat.org/guides/create-task.html
@@ -13,9 +14,9 @@ task("accounts", "Prints the list of accounts", async () => {
1314

1415
function mnemonic() {
1516

16-
return fs.readFileSync("./sk.txt").toString().trim();
17-
18-
}
17+
return process.env.PRIVATE_KEY
18+
19+
}
1920

2021
/**
2122
* @type import('hardhat/config').HardhatUserConfig
@@ -24,7 +25,7 @@ module.exports = {
2425
solidity: {
2526
compilers: [
2627
{
27-
version: "0.6.0"
28+
version: "0.6.12"
2829
},
2930
{
3031
version: "0.8.0",
@@ -46,25 +47,25 @@ module.exports = {
4647
*/
4748
},
4849
rinkeby: {
49-
url: "https://rinkeby.infura.io/v3/0aae8358bfe04803b8e75bb4755eaf07", //<---- YOUR INFURA ID! (or it won't work)
50+
url: "https://rinkeby.infura.io/v3/" + process.env.INFURA_ID, //<---- YOUR INFURA ID! (or it won't work)
5051
accounts: [
5152
mnemonic()
5253
],
5354
},
5455
kovan: {
55-
url: "https://kovan.infura.io/v3/0aae8358bfe04803b8e75bb4755eaf07", //<---- YOUR INFURA ID! (or it won't work)
56+
url: "https://kovan.infura.io/v3/" + process.env.INFURA_ID, //<---- YOUR INFURA ID! (or it won't work)
5657
accounts: [
5758
mnemonic()
5859
],
5960
},
6061
mainnet: {
61-
url: "https://mainnet.infura.io/v3/0aae8358bfe04803b8e75bb4755eaf07", //<---- YOUR INFURA ID! (or it won't work)
62+
url: "https://mainnet.infura.io/v3/" + process.env.INFURA_ID, //<---- YOUR INFURA ID! (or it won't work)
6263
accounts: [
6364
mnemonic()
6465
],
6566
},
6667
ropsten: {
67-
url: "https://ropsten.infura.io/v3/0aae8358bfe04803b8e75bb4755eaf07", //<---- YOUR INFURA ID! (or it won't work)
68+
url: "https://ropsten.infura.io/v3/" + process.env.INFURA_ID, //<---- YOUR INFURA ID! (or it won't work)
6869
accounts: [
6970
mnemonic()
7071
],

Diff for: basic/25-multi-sig-wallet/package.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,8 @@
1616
"ethers": "^5.3.1",
1717
"hardhat": "^2.4.1"
1818
},
19-
"description": ""
19+
"description": "",
20+
"dependencies": {
21+
"dotenv": "^10.0.0"
22+
}
2023
}

Diff for: basic/25-multi-sig-wallet/test/test.js

+3
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ describe("MultiSigWallet test",function(){
5151
const submitTransaction = await multiSigWallet.submitTransaction(hello.address, 0, payload);
5252
const transactionReceipt = await submitTransaction.wait();
5353
//console.log("transactionReceipt:",transactionReceipt);
54+
55+
// 检查结果
56+
expect((await hello.balance()).toString()).to.equal("233");
5457

5558

5659
// await multiSigWallet.queryFilter("Submission" , transactionReceipt.blockNumber ,transactionReceipt.blockNumber)

0 commit comments

Comments
 (0)