Introducing the Web 3.0 Lottery Smart Contract - the ultimate solution for automating the distribution of funds to the lucky winner. Execute via Chainlink VRF (Verifiable Randomness Function) and Chainlink Upkeep Automation. Built With 2 Type of Latest Most Popular Development Framework: (1) Solidity + Hardhat (2) Solidity + Foundry https://www.hoelee.com
Go to file
hoelee be54471760
Some checks failed
CI / Foundry project (push) Has been cancelled
Added front-end Javascript
2024-08-17 12:19:13 +08:00
.github/workflows chore: forge init 2024-08-13 04:13:15 +08:00
artifacts-dbg Fixed InsufficientBalance VRF Mock 2024-08-16 04:06:04 +08:00
contracts BUG FIXEDhh test 2024-08-16 09:52:26 +08:00
deploy chore: forge init 2024-08-13 04:13:15 +08:00
lib Added Full Test 2024-08-15 16:45:28 +08:00
pages Added front-end Javascript 2024-08-17 12:19:13 +08:00
script bug 2024-08-16 08:43:04 +08:00
test Added Makefile 2024-08-17 01:50:54 +08:00
utils Random, Upkeep, Mock Ready 2024-08-11 07:38:17 +08:00
.gas-snapshot README.md Updated 2024-08-16 12:41:38 +08:00
.gitignore Added front-end Javascript 2024-08-17 12:19:13 +08:00
.gitmodules Added Full Test 2024-08-15 16:45:28 +08:00
.prettierignore Updated Correct v2.5 VRF 2024-08-08 03:56:57 +08:00
.prettierrc Before Add Random 2024-08-08 03:23:14 +08:00
dbg.project.json Added Full Test 2024-08-15 16:45:28 +08:00
Foundry.md Added Makefile 2024-08-17 01:50:54 +08:00
foundry.toml Added Full Test 2024-08-15 16:45:28 +08:00
FrontEnd.md Added front-end Javascript 2024-08-17 12:19:13 +08:00
hardhat.config.js Done Converted Into Foundary 2024-08-14 01:01:18 +08:00
Hardhat.md README.md Updated 2024-08-16 12:41:38 +08:00
helper-hardhat-config.js Random, Upkeep, Mock Ready 2024-08-11 07:38:17 +08:00
Hoelee.md README.md Updated 2024-08-16 12:41:38 +08:00
Makefile Added Makefile 2024-08-17 01:50:54 +08:00
package.json Added front-end Javascript 2024-08-17 12:19:13 +08:00
README.md README.md Updated 2024-08-16 12:41:38 +08:00
yarn.lock Added front-end Javascript 2024-08-17 12:19:13 +08:00

Hoelee Smart Contract - Automate Lottery

Grand Porject Overview

This Project Smart Contract Created With

  1. Solidity Contract + Hardhat + node.js for Test
  2. Solidity Contract & Test + Foundry

Hardhat Project

A fully functional Smart Contract wrriten with solidity, node.js and using Hardhat to show usage of all kinds of standard development features, including:

  • running blockchain node in localhost - hardhat & ganache
  • solidity prettier code beautifier setup
  • standard of developing Smart Contract with solidity
  • standard of developing node.js script to use hardhat library efficiently
  • 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.

Read More in Hardhat Project's Note Page.


Foundry Project

Same Lottery Project, Use Of Solidity to test smart contract, ensure high coverage of function correctness. Feature included:

  • Modular Enable Test In Multiple Networks With Different Conditions
  • Local Network Using Of Anvil + Mock VRF (Verifiable Randomness Function)
  • Testnet Use of Latest V2.5 Chainlink VRF Subscription With Consumer Subscription
  • Use of Custom LinkToken on Sepolia Testnet
  • Smart Contract Test With High Coverage To Ensure Correctness
  • Private Key Encrypted With Keystore, Safer Usage With Password
  • Smart Contract Layer-2 Ready (ZKsync)

Read More In Foundry Project's Note Page.

Success Deploy & Verified Smart Contract In Sepolia Testnet

0xc2022b56eBC140B5FebCf9FBaB14c17db4C315C4 https://sepolia.etherscan.io/address/0xc2022b56eBC140B5FebCf9FBaB14c17db4C315C4#code Via deploy.js https://sepolia.etherscan.io/address/0x3a827C119e1D746bb3C7bcbbf95c55246C8CcBdd#code Via yarn hardhat deploy --network sepolia

Public Reported Hacked Code References:

This website is records of all kind previous hacked smart contract:

https://rekt.news/leaderboard/

1. Understanding Of Known Vulnerabilities

  • Reentrancy Attack
    • Locked with modifier while running withdraw function
    • Update variable immediately before call external function
  • Integer Overflow / Underflow
    • Use compiler version >0.8.0 have check in place
  • Front-Running
    • Use average gas fee / off peak times
    • Use commit-reveal schema
    • Use submarine send

2. Other Explored Features

  1. Generate Random Words
  2. New Time Based Trigger Automation Through Chainlink UpKeep
    • Same As VRF Subscription, V2.5 Optional Reduced Steps
    • Setup At https://automation.chain.link/
    • After Subscription Created, Funded, & Setup Interval:
      • VRFCoordinator will call checkUpkeep(bytes memory checkData)
      • checkUpkeep true will call internal contract performUpkeep(bytes calldata performData)

3. Looking Web 3.0 Developer For Your Project?

Mr Hoelee is Welcome Web 3.0 Remote Job, Contact Me Immediately Via WhatsApp +60175885290

Or You can email me@hoelee.com now. Thanks.

4. Like this project?

If you are feeling generous, buy me a coffee! - buymeacoffee.com/hoelee