Skip to content

Commit

Permalink
feat: testing with foundry
Browse files Browse the repository at this point in the history
  • Loading branch information
princeibs committed Sep 9, 2024
1 parent 5040e4f commit 579ba36
Show file tree
Hide file tree
Showing 82 changed files with 27,450 additions and 8,506 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: CI

on:
push:
pull_request:
workflow_dispatch:

env:
FOUNDRY_PROFILE: ci

jobs:
check:
strategy:
fail-fast: true

name: Foundry project
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly

- name: Show Forge version
run: |
forge --version
- name: Run Forge fmt
run: |
forge fmt --check
id: fmt

- name: Run Forge build
run: |
forge build --sizes
id: build

- name: Run Forge tests
run: |
forge test -vvv
id: test
25 changes: 11 additions & 14 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
node_modules
.env

# Hardhat files
/cache
/artifacts
# Compiler files
cache/
out/

# TypeChain files
/typechain
/typechain-types
# Ignores development broadcast logs
!/broadcast
/broadcast/*/31337/
/broadcast/**/dry-run/

# solidity-coverage files
/coverage
/coverage.json
# Docs
docs/

# Hardhat Ignition default folder for deployments against a local node
ignition/deployments/chain-31337
# Dotenv file
.env
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "lib/forge-std"]
path = lib/forge-std
url = https://github.com/foundry-rs/forge-std
5 changes: 0 additions & 5 deletions .prettierrc

This file was deleted.

3 changes: 0 additions & 3 deletions .vscode/settings.json

This file was deleted.

68 changes: 66 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,66 @@
# BlockHeaderWeb3 Cohort 5
Introduction to the fundamentals of EVM-based smart contract development
## 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.
- **Anvil**: Local Ethereum node, akin to Ganache, Hardhat Network.
- **Chisel**: Fast, utilitarian, and verbose solidity REPL.

## Documentation

https://book.getfoundry.sh/

## Usage

### Build

```shell
$ forge build
```

### Test

```shell
$ forge test
```

### Format

```shell
$ forge fmt
```

### Gas Snapshots

```shell
$ forge snapshot
```

### Anvil

```shell
$ anvil
```

### Deploy

```shell
$ forge script script/Counter.s.sol:CounterScript --rpc-url <your_rpc_url> --private-key <your_private_key>
```

### Cast

```shell
$ cast <subcommand>
```

### Help

```shell
$ forge --help
$ anvil --help
$ cast --help
```
27 changes: 0 additions & 27 deletions contracts/Counter.sol

This file was deleted.

18 changes: 0 additions & 18 deletions contracts/IStudentRegistry.so

This file was deleted.

18 changes: 0 additions & 18 deletions contracts/IStudentRegistry.sol

This file was deleted.

48 changes: 0 additions & 48 deletions contracts/IStudentRegistry.soo

This file was deleted.

60 changes: 0 additions & 60 deletions contracts/Ownable.sol

This file was deleted.

11 changes: 0 additions & 11 deletions contracts/Student.sol

This file was deleted.

35 changes: 0 additions & 35 deletions contracts/StudentCounter.sol

This file was deleted.

Loading

0 comments on commit 579ba36

Please sign in to comment.