Solidity starter combining foundry and hardhat because both are great and I can't live without either...

Overview

Combination Pizza Hut & Taco Bell

Foundry && HardHat starter template.

Motivation

I like them both. With this set-up we get:

  • Unit tests written in solidity
  • Foundry's cast
  • Integration testing with Hardhat
  • Hardhat test coverage
  • Hardhat deploy & verify
  • Typescript

Foundry

Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.

Foundry consists of:

  • Forge: Ethereum testing framework (like Truffle, Hardhat and Dapptools).
  • Cast: Swiss army knife for interacting with EVM smart contracts, sending transactions and getting chain data.

Need help getting started with Foundry? Read the ๐Ÿ“– Foundry Book (WIP)!

Hardhat

Hardhat is an Ethereum development environment for professionals. It facilitates performing frequent tasks, such as running tests, automatically checking code for mistakes or interacting with a smart contract.

On Hardhat's website you will find:

Directory Structure

integration
|- mover.test.ts - "Hardhat integration tests"
lib
|- ds-test - "Test dependency"
|- forge-std - "Test dependency"
|- solmate - "Test dependency"
scripts
`- deploy.ts - "hardhat deploy script"
src
|- test
|  |- mocks
|  |  `- MockNFT.sol - "Mock NFT for testing"
|  `- Mover.t.sol - "Unit testi in solidity"
`- Mover.sol - "Solidity contract"
.env.example - "Expamle dot env"
.gitignore - "Ignore workfiles"
.gitmodules -  "Dependecy modules"
.solcover.js - "Configure coverage"
.solhint.json - "Configure solidity lint"
foundry.toml - "Configure foundry"
hardhat.config.ts - "Configure hardhat"
package.json - "Node dependencies"
README.md - "This file"
remappings.txt - "Forge dependcy mappings"
slither.config.json - "Configure slither"

Installation

Foundry

First run the command below to get foundryup, the Foundry toolchain installer:

curl -L https://foundry.paradigm.xyz | bash

If you do not want to use the redirect, feel free to manually download the foundryup installation script from here.

Then, in a new terminal session or after reloading your PATH, run it to get the latest forge and cast binaries:

foundryup

Advanced ways to use foundryup, and other documentation, can be found in the foundryup package. Happy forging!

Hardhat

npm install or yarn

NPM Commands

Scripts available via `npm run-script`:
  compile
    npx hardhat compile
  coverage
    npx hardhat coverage --solcoverjs .solcover.js
  deploy
    npx hardhat run scripts/deploy.ts
  integration
    npx hardhat test
  verify
    npx hardhat verify
You might also like...

Introductory fullstack ethereum dapp using: solidity, hardhat, react.js, ethers.js

Intro to Fullstack Ethereum Development Check out deployed dapp here! (Make sure you're connected to the Rinkeby Testnet) This article will help you e

Dec 21, 2022

This is a fully functional DAO, a Web3 project made using Solidity, Hardhat, JS, Next.js, Openzeppelin, CSS, HTML, using the Rinkerby network!

My First DAO! This is made for a DAO-Tutorial via learnweb3.io This is a DAO, a decentralised autonomous organisation, essentially a more collective a

Jun 20, 2022

A professional truffle solidity template with all necessary libraries that support developer to develop, debug, test, deploy solidity smart contract

solidity-truffle-template A professional truffle solidity template with necessary libraries that support to develop, compile, test, deploy, upgrade, v

Nov 4, 2022

Google-Drive-Directory-Index | Combining the power of Cloudflare Workers and Google Drive API will allow you to index your Google Drive files on the browser.

๐Ÿฟ Google-Drive-Directory-Index Combining the power of Cloudflare Workers and Google Drive will allow you to index your Google Drive files on the brow

Jan 2, 2023

Strcmp-node - A cli string comparison tool, because apparently one doesn't exist.

Strcmp-node - A cli string comparison tool, because apparently one doesn't exist.

strcmp-node I couldn't find a string comparison command, so i made my own. its probably the ugliest thing since godzilla with makeup on, but it works.

Jan 1, 2022

Combining R & Observable with Quarto

Quarto Examples Quarto is an open-source scientific and technical publishing system built on Pandoc. It allows to create dynamic content with Python,

Oct 17, 2022

An easy to implement marquee JQuery plugin with pause on hover support. I know its easy because even I can use it.

Simple-Marquee Copyright (C) 2016 Fabian Valle An easy to implement marquee plugin. I know its easy because even I can use it. Forked from: https://gi

Aug 29, 2022

made a game of life because i can't stop myself from writing code?

๐Ÿชธ Life I was reading something today that mentioned Conway's Game of Life. I remember making a rudimentary version for my terminal with Python when I

Nov 21, 2022

A web3 starter project using Typescript, Hardhat, ethers.js and @web3-react

A web3 starter project using Typescript, Hardhat, ethers.js and @web3-react

Starter React Typescript Ethers.js Hardhat Project This repo contains a Hardhat and React Dapp starter project. The React Dapp in the frontend dir of

Dec 31, 2022
Comments
  • Forge dependency / library install instructions

    Forge dependency / library install instructions

    Hello @gaslimitreached, thanks for putting this repository together!

    For example, the basic usage in this tutorial does: forge install OpenZeppelin/openzeppelin-contracts

    Under normal conditions this will add it to ./lib. For some reason when trying it with this template, I get:

    forge install OpenZeppelin/openzeppelin-contracts
    Installing openzeppelin-contracts in "<..>/foundry-hardhat-template/lib/openzeppelin-contracts", (url: https://github.com/OpenZeppelin/openzeppelin-contracts, tag: None)
    Error: 
       0: A git directory for 'lib/openzeppelin-contracts' is found locally with remote(s):
            origin  https://github.com/OpenZeppelin/openzeppelin-contracts
          If you want to reuse this local git directory instead of cloning again from
            https://github.com/OpenZeppelin/openzeppelin-contracts
          use the '--force' option. If the local git directory is not the correct repo
          or you are unsure what this means choose another name with the '--name' option.
    

    Is there some special instructions for adding dependencies / libs with Foundry such that we can use them in forge test for unit/fuzzing tests?

    Also, curious on when we should be duplicating the dependencies with yarn/npm. For example, if our contracts have a dependancy on OpenZeppelin contracts, should we do both yarn add @openzeppelin/contracts and forge install OpenZeppelin/openzeppelin-contracts?

    Thanks again for your help, this is the best forge + hardhat I've found.

    opened by 0xKudo 6
Owner
Cache Monet
๐Ÿงฑ โ›“ ๐Ÿค“
Cache Monet
A hardhat solidity template with necessary libraries that support to develop, compile, test, deploy, upgrade, verify solidity smart contract

solidity-hardhat-template A solidity hardhat template with necessary libraries that support to develop, compile, test, deploy, upgrade, verify solidit

ChimGoKien 4 Oct 16, 2022
Solidity Quickstart is an extensive solidity guide for the solidity newbies out there.

?? Solidity Quickstart Solidity Quickstart is an extensive solidity guide for the solidity newbies out there. ?? How does it work? All the guides rela

Kira 8 Aug 6, 2022
Use Hardhat & Foundry in the same project

Hardhat Foundry Starter This is a solidity starter template which lets you use both, Hardhat and Foundry. Why use both the tools? Foundry has some awe

Rajdeep Bharati 12 Aug 23, 2022
Minimal template to get started with Foundry + Hardhat

Hardhat x Foundry Template Template repository for getting started quickly with Hardhat and Foundry in one project Getting Started Use Foundry: forge

Foundry 158 Jan 3, 2023
HackFest is a 36-hour long hackathon wherein you have to put on your hacker hats and build anything that falls in either or both the domain of full-stack web development

HackFest is a 36-hour long hackathon wherein you have to put on your hacker hats and build anything that falls in either or both the domain of full-stack web development (the stack we learn in full-stack web developer roadmap on codedamn).

Shivam Kumar 2 Jun 6, 2022
A Bed and Breakfast dApp run on Ethereum. Includes a token + schedule system (Solidity) and full front-end (React + ethers.js) built with Hardhat.

Hotel ETH - Watch Demo Video Hotel ETH A (fictional) Bed-and-Breakfast run on Ethereum Come Book a Room on Kovan or Rinkeby Networks View the Demo ยป C

Ryan Lambert 20 Aug 20, 2022
Build a Full Stack Marketplace on Ethereum with React, Solidity, Hardhat, and Ethers.js

Building a Digital Marketplace on Ethereum The technologies used in this workshop are React, Next.js, Tailwind CSS, HardHat, Solidity, and Ethers. Get

Nader Dabit 114 Nov 15, 2022
An NFT Marketplace built with NextJS, Hardhat and Solidity

??๏ธ NFT Marketplace This is a fullstack DApp NFT Marketplace built as a study project to learn more about blockchain and smart contract development. M

Marcelo Kopmann 99 Dec 31, 2022
Kittos is NFT Marketplace built with Next Js, Hardhat, Solidity, Arweave + Bundlr Client and All The CSS Magic with TailwindCSS. ๐Ÿ˜บ

Kittos NFT Marketplace ?? Built with Next Js, Hardhat, Solidity, Arweave, Bundlr and Tailwind CSS. Functionalities New Listed Assets Mint NFT Buy NFT

Aakrut 7 Dec 24, 2022
Decentralized twitter using Solidity, Ethereum, hardhat, ethers, IPFS, Next.JS, TypeScript, TailwindCSS.

DWITTER: Decentralized Twitter Check out the deployed version of this app at https://dwtr.wajeshubham.in Transactions on Ethereum are slow. Therefore,

Shubham Waje 12 Sep 2, 2022