Giter Site home page Giter Site logo

ethernaut-exercises's Introduction

Hardhat TypeScript Solidity License

πŸ›  Hardhat Base Project for Smart Contract Development

This repository serves as a robust starting point for smart contract development using Hardhat. It comes pre-configured with essential contracts, scripts, and tests. (It is not finished yet and there are several writeups pending...☺️)


πŸš€ Quick Start

  1. Clone the Repository
    git clone https://github.com/your-repo.git
    
  2. Install Dependencies
    npm install
    

πŸ“¦ Dependencies

The project comes with the following pre-installed packages:

  • TypeScript
  • ts-node
  • hardhat
  • nomicfoundation/hardhat-toolbox
  • hardhat-deploy
  • openzeppelin/hardhat-upgrades
  • openzeppelin/contracts-upgradeable
  • solidity-docgen
  • dotenv

πŸ—ƒ Project Structure

./contracts

Contains two subfolders: interfaces and tokens, along with basic contractsβ€”some utilizing proxies and some not.

./deploy

Includes scripts for both deploying and verifying contracts, with examples to differentiate proxy-based and non-proxy deployments.

./gasReporter

Stores automatically generated gas reports. The folder must be manually created as the gas reporter can't create it itself.

./scripts

Features utility scripts, including one for interacting with deployed contracts and a delay function for real-world script execution.

./test

Hosts a test-helpers folder with utilities like constants, snapshots, and time functions, along with basic test setups.


πŸ–‹ Commands

  • npm install: Install all required dependencies.
  • npx hardhat compile: Compile smart contracts.
  • npx hardhat test: Run tests and generate gas reports.
  • npx hardhat coverage: Display code coverage.
  • npx hardhat docgen: Generate documentation from NatSpec comments.

πŸ”’ .env Example

Sensitive data like API keys and private keys are stored in a .env file. Below is an example layout:

# -----------------------------
# DEPLOYMENT PRIVATE KEYS
# -----------------------------
DEPLOYER_PRIVATE_KEY=
ATTACKER_PRIVATE_KEY=
# -----------------------------
# API KEYS
# -----------------------------
ETHERSCAN_API_KEY=
BSCSCAN_API_KEY=
POLYGONSCAN_API_KEY=
INFURA_PROJECT_KEY=
COINMARKETCAP_API_KEY=

# -----------------------------
# RPC URL
# -----------------------------
BNB_TESTNET_RPC_URL=

# -----------------------------
# GAS REPORTER CONFIG
# -----------------------------
GAS_REPORTER_STATUS=true
GAS_REPORTER_CURRENCY=USD
GAS_REPORTER_GAS_PRICE=6
GAS_REPORTER_TOKEN=BNB
GAS_REPORTER_OUTPUT_REPORT=./gasReporter/GasReport.txt
GAS_REPORTER_COLORS=true
GAS_REPORTER_TIMESPENT=true

# -----------------------------
# OTHER CONFIG
# -----------------------------

πŸ›‘ .gitignore

Ensure your .gitignore file lists .env to prevent uploading sensitive information, even in a private repository.

ethernaut-exercises's People

Contributors

ibcaos avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.