GithubHelp home page GithubHelp logo

foundry-d2's Introduction

Foundry-Demo

This is a demostration of Foundry capabilities and Solidity smart contract features.

Check Solidity contracts under src folder.

Each of those contracts is targeted at a specific Solidity feature and/or Foundry feature.

Each of those contracts has a corresponding test file under test folder, with a few exceptions if the test file is not written yet or that feature is not important enough.

Each test file describes scenarios for the contract's operation.

You can find many script names in package.json file.

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.
  • Anvil: Local Ethereum node, akin to Ganache, Hardhat Network.
  • Chisel: Fast, utilitarian, and verbose solidity REPL.

Installation

Install Foundry according to doc: https://book.getfoundry.sh/getting-started/installation

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

To install dependencies used in this repo: make install

To clean then install: make all

To build: make build https://book.getfoundry.sh/getting-started/installation

Run Tests

To run test: forge test --match-path test/Counter.t.sol -vv

Environment Variables

Implement the .env file and run source .env before you run any package.json script that requires environment variables.

Make .env file from .env.example.

Then fill out the following in that .env file:

MAINNET_RPC_URL=
SEPOLIA_RPC_URL=
GOERLI_RPC_URL=
ANVIL_RPC=http://127.0.0.1:8545
ETHERSCAN_API_KEY=

# Live Network Contracts
TOKEN_ADDR=
NFT_ADDR=
PoolAddressesProviderAaveV3Sepolia=

# Deploy Properties
MNEMONIC=
SIGNER=
PRIVATE_KEY=
ANVIL4=
ANVIL4_PRIVATE_KEY=

Run each package.json script via bun run <script_name>

Documentation

https://book.getfoundry.sh/

Usage

Build

$ forge build

Test

$ forge test

Gas Snapshots

$ forge snapshot

Deploy Locally to Anvil

$ bun run anvil
$ bun run deployAnvil

Deploy Remotely

$ bun run deploySepolia

Copy the contract ABIs and deployed contract addresses to your frontend repository

[Note] Edit to makeAbi.ts to set where to copy the abi from, and where to paste it to( your frontend repository)

$ bun run makeAbi

Cast

$ cast <subcommand>

Help

$ forge --help
$ anvil --help
$ cast --help

foundry-d2's People

Contributors

auroralantean 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.