Project Ready

This commit is contained in:
2024-08-06 20:52:02 +08:00
parent a76b612818
commit d1b444988e
7 changed files with 420 additions and 280 deletions
+55 -10
View File
@@ -5,9 +5,13 @@ A fully functional Smart Contract wrriten with ```solidity```, ```node.js``` and
* solidity prettier code beautifier setup
* standard of developing Smart Contract with ```solidity```
* standard of developing ```node.js``` script to use ```hardhat``` library efficiently
* auto verify contract in Etherscan.io
* creating automate test cases
* check gas fee & gas price in real-time, with usage of ```coverage```
* auto verify contract on Etherscan.io
* creating automate test cases - unit test & staging test
* creating tasks etc.
* refactor codes to reduce gas fee
* write code in best practice, with usage of ```solhint```
* prettier ```solidity``` & ```node.js``` code
* gitea version control
This project mainly to keep as a reference for future Web 3.0 Developments.
@@ -46,13 +50,23 @@ Standard Update:
git add .
git commit -m "Describe what changes"
git push -u origin main
// After set this, later easier usage via below line
git push
git pull
```
Development need exlude file can create root file with name .gitignore
```
.env
node_modules
.encryptedkey.json
package.json
img
artifacts
cache
coverage
.env
.*
README.md
coverage.json
```
## 2. Setup Visual Studio Code Development Environment
@@ -100,8 +114,14 @@ yarn hardhat
yarn add --dev prettier prettier-plugin-solidity
yarn add --dev dotenv
yarn add --dev @nomiclabs/hardhat-etherscan // Auto verify Etherscan Samrt Contract
yarn add --dev @nomiclabs/hardhat-waffle
yarn add --dev solhint
yarn add --dev @nomiclabs/hardhat-ethers@npm:hardhat-deploy-ethers ethers
yarn add --dev hardhat-gas-reporter
yarn add --dev solidity-coverage
yarn add --dev solhint
```
Other Terminal Useful Command
Other Terminal Useful Command 1:
```
// For Debuging Hardhat
npx hardhat --versose
@@ -120,20 +140,45 @@ yarn hardhat custom-task-name
// Need create file in /tasks/custom-task-name.js
// Add import in hardhat.config.js -> requir("/tasks/custom-task-name");
yarn hardhat test
yarn hardhat test --grep customKeyword
// Only will run the test with describe test that contain "customKeyword"
yarn hardhat test --grep customSearchKeyword
// Only will run the test with describe test that contain "customSearchKeyword"
```
Other Terminal Useful Command 2:
```
// For Getting Gas Used & Gas Price
yarn hardhat test
// Will create a file in ./gas-report.txt
// With .env of etherscan API key
// For Getting Coverage
yarn hardhat coverage
// Checking code usage & tested percentage
// For Checking Code Best Practice
yarn solhint contracts/*.sol
// For Get Fake Price Feed On Localhost & Ganache
yarn hardhat deploy --tags mocks --network localhost
```
Debug ```Node.js``` need to open **Javascript Debug Terminal** first, via ```ctrl + shift + p```
#### Reduce Gas Used:
* Prioritize use ```private``` instead of ```public```
* Use ```constant``` which declare once in constructor
* Use ```immutable ``` which declare once only
This is because blockchain will have higher ```read``` and ```store``` gas fee on storage block, lesser in bytes code block.
## 3. Known Issue
* Cannot use ```expect``` in test, most probably due to the dependencies mismatched. Future will upgrade and test newer version dependencies.
* Dependencies combination is old, need update...
* ...
### Find a bug?
If you found an issue or would like to submit an improvement to this demo project, please submit an issue using the issues tab above.
## 4. Looking Web 3.0 Developer For Your Project?
Mr Hoelee is Welcome Web 3.0 Remote Job, Contact Me Immediately Via WhatsApp <a href="https://wa.me/60175885290">+60175885290</a>
. Or You can email <a href="mailto:me@hoelee.com">me@hoelee.com</a> now. Thanks.
**Mr Hoelee** is Welcome Web 3.0 Remote Job, Contact Me Immediately Via WhatsApp <a href="https://wa.me/60175885290">+60175885290</a>
.
Or You can email <a href="mailto:me@hoelee.com">me@hoelee.com</a> now. Thanks.
## 5. Like this project?
If you are feeling generous, buy me a coffee! - <a href="https://buymeacoffee.com/hoelee">buymeacoffee.com/hoelee</a>