-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updating dependencies, using ethers for tasks, few cleanups (#1)
* removed ropsten, rinkeby as they will be depreciated, adding goerli * updated: dependencies, tests
- Loading branch information
1 parent
8b6e2d6
commit 4bd0387
Showing
8 changed files
with
2,518 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,27 @@ | ||
# Basic Sample Hardhat Project | ||
# hardhat-boilerplate | ||
|
||
This project demonstrates a basic Hardhat use case. It comes with a sample contract, a test for that contract, a sample script that deploys that contract, and an example of a task implementation, which simply lists the available accounts. | ||
This project demonstrates a basic Hardhat use case. It comes with a sample contract, a test for that contract, a sample script that deploys that contract, and an example of a task implementation, which simply lists the available accounts with balances. | ||
|
||
Try running some of the following tasks: | ||
|
||
```shell | ||
npx hardhat node # starts local node | ||
npx hardhat accounts # list accounts | ||
npx hardhat balance --account '0x47a9...' # show balance eth of specified account | ||
npx hardhat compile # compiles contracts | ||
npx hardhat deploy # deploys contract defined in tasks | ||
node scripts/deployContract.js | ||
npx hardhat run --network local scripts/deployContract.js # deplys contract on specified network | ||
npx hardhat clean | ||
npx hardhat test | ||
npx hardhat help | ||
yarn install | ||
|
||
yarn hardhat node # starts local node | ||
|
||
yarn hardhat accounts # list accounts with balances | ||
|
||
yarn hardhat balance --account '0x47a9...' # show balance eth of specified account | ||
|
||
yarn hardhat compile # compiles contracts | ||
|
||
yarn hardhat deploy --network local # deploys contract defined in tasks on specified network | ||
|
||
yarn hardhat run --network local scripts/deploy.js # deploys contract in scripts/deploy.js | ||
|
||
yarn hardhat test # runs tests | ||
|
||
yarn hardhat clean # removes all compiled and deployed artifacts | ||
|
||
yarn hardhat help # shows help | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,20 @@ | ||
{ | ||
"name": "hardhat-boilerplate", | ||
"version": "1.0.0", | ||
"description": "hardhat and ethersjs boilerplate for ethereum development", | ||
"description": "hardhat and ethersjs boilerplate for Dapp development", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
"test": "yarn hardhat test", | ||
"compile": "yarn hardhat compile", | ||
"deploy": "yarn hardhat deploy" | ||
}, | ||
"keywords": [], | ||
"author": "", | ||
"author": "Salman Dabbakuti", | ||
"license": "ISC", | ||
"devDependencies": { | ||
"@nomiclabs/hardhat-ethers": "^2.0.2", | ||
"@nomiclabs/hardhat-waffle": "^2.0.1", | ||
"@nomiclabs/hardhat-web3": "^2.0.0", | ||
"chai": "^4.3.4", | ||
"ethers": "^5.4.7", | ||
"hardhat": "^2.6.4", | ||
"web3": "^1.5.3" | ||
"@nomiclabs/hardhat-ethers": "^2.1.1", | ||
"chai": "^4.3.6", | ||
"ethers": "^5.7.0", | ||
"hardhat": "^2.10.2" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
|
||
async function main() { | ||
const contractFactory = await ethers.getContractFactory("greeter"); | ||
const contract = await contractFactory.deploy("Hello, Hardhat!"); | ||
await contract.deployed(); | ||
return contract; | ||
} | ||
|
||
main() | ||
.then(async (contract) => { | ||
console.log("Contract deployed at:", contract.address); | ||
// Write to contract | ||
const tx = await contract.setGreeting("Hello Ethereum Devs!"); | ||
await tx.wait(); | ||
// Read from contract | ||
const greeting = await contract.getGreeting(); | ||
console.log('Greeting from contract:', greeting); | ||
}) | ||
.catch((error) => { | ||
console.error(error); | ||
}); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
const { expect } = require("chai"); | ||
const { ethers } = require("hardhat"); | ||
|
||
describe("Greeter", function () { | ||
describe("Contract Tests", function () { | ||
it("Should return the new greeting once it's changed", async function () { | ||
const Greeter = await ethers.getContractFactory("greeter"); | ||
const greeter = await Greeter.deploy("Hello, world!"); | ||
await greeter.deployed(); | ||
const contractFactory = await ethers.getContractFactory("greeter"); | ||
const contract = await contractFactory.deploy("Hello, world!"); | ||
await contract.deployed(); | ||
|
||
expect(await greeter.getGreeting()).to.equal("Hello, world!"); | ||
const setGreetingTx = await greeter.setGreeting("Hola, mundo!"); | ||
expect(await contract.getGreeting()).to.equal("Hello, world!"); | ||
const setGreetingTx = await contract.setGreeting("Hola, mundo!"); | ||
// wait for the transaction to be mined | ||
await setGreetingTx.wait(); | ||
expect(await greeter.getGreeting()).to.equal("Hola, mundo!"); | ||
expect(await contract.getGreeting()).to.equal("Hola, mundo!"); | ||
}); | ||
}); |
Oops, something went wrong.