Skip to content

Commit

Permalink
Merge branch 'master' into nightly
Browse files Browse the repository at this point in the history
  • Loading branch information
zerosnacks committed Jan 22, 2025
2 parents 7707d88 + 18f4ec0 commit e4cdaf8
Show file tree
Hide file tree
Showing 36 changed files with 890 additions and 95 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ As a small change in the Foundry CLIs can have a large impact on the book, most

Each output file has three anchors you can use:

**Display the command *and* the output**
**Display the command _and_ the output**

```handlebars
{{#include ../output/abc/xyz:all}}
Expand Down
5 changes: 5 additions & 0 deletions src/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ Foundry is a smart contract development toolchain.

Foundry manages your dependencies, compiles your project, runs tests, deploys, and lets you interact with the chain from the command-line and via Solidity scripts.

> **Announcements**
>
> [Stay up to date](./announcements.md) with the latest changes to Foundry.
> 📖 **Contributing**
>
> You can contribute to this book on [GitHub](https://github.com/foundry-rs/book).
Expand Down Expand Up @@ -66,6 +70,7 @@ Help us improve Foundry: [Contributing](./contributing.md)

References, troubleshooting, and more.

- [Announcements](./announcements.md)
- [FAQ](./faq.md)
- [CLI Reference](./reference/cli/)
- [forge Commands](./reference/forge/)
Expand Down
11 changes: 7 additions & 4 deletions src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

# Forge Overview

- [Overview of Forge](forge/README.md)
- [Forge](forge/README.md)
- [Tests](./forge/tests.md)
- [Writing Tests](./forge/writing-tests.md)
- [Cheatcodes](./forge/cheatcodes.md)
Expand All @@ -45,15 +45,15 @@

# Cast Overview

- [Overview of Cast](./cast/README.md)
- [Cast](./cast/README.md)

# Anvil Overview

- [Overview of Anvil](./anvil/README.md)
- [Anvil](./anvil/README.md)

# Chisel Overview

- [Overview of Chisel](./chisel/README.md)
- [Chisel](./chisel/README.md)

# Configuration

Expand All @@ -79,6 +79,7 @@

# Appendix

- [Announcements](./announcements.md)
- [FAQ](./faq.md)
- [Help us improve Foundry](./contributing.md)
- [References](./reference/README.md)
Expand All @@ -98,6 +99,7 @@
- [`forge config`](./reference/cli/forge/config.md)
- [`forge coverage`](./reference/cli/forge/coverage.md)
- [`forge create`](./reference/cli/forge/create.md)
- [`forge debug`](./reference/cli/forge/debug.md)
- [`forge doc`](./reference/cli/forge/doc.md)
- [`forge eip712`](./reference/cli/forge/eip712.md)
- [`forge flatten`](./reference/cli/forge/flatten.md)
Expand Down Expand Up @@ -285,6 +287,7 @@
- [forge verify-check](./reference/forge/forge-verify-check.md)
- [forge flatten](./reference/forge/forge-flatten.md)
- [Utility Commands](./reference/forge/utility-commands.md)
- [forge debug](./reference/forge/forge-debug.md)
- [forge bind](./reference/forge/forge-bind.md)
- [forge cache](./reference/forge/forge-cache.md)
- [forge cache clean](./reference/forge/forge-cache-clean.md)
Expand Down
131 changes: 131 additions & 0 deletions src/announcements.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
## Announcements

Stay up to date with the latest changes to Foundry.

## 🚨 Actions required

Upgrade your installation of `foundryup`!

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

Upgrading ensures your installation defaults to updating to the **latest stable release** instead of the **latest nightly build**.

If you do not upgrade you will **continue to receive nightly builds by default** which will start to contain more **significant breaking changes**.

## Releases

### 0.3 (stable)

The Foundry [`0.3` release](https://github.com/foundry-rs/foundry/releases/tag/v0.3.0) marks an exciting new chapter for Foundry. By moving to [stable releases](https://github.com/foundry-rs/foundry/releases/tag/stable), we aim to provide a reliable development environment for the EVM ecosystem. Our next priority is the `1.0` release in early 2025, polishing Foundry for the long term.

Big shoutout to the Foundry community - your bug reports, feature requests and contributions have shaped what Foundry is today.

## FAQ

#### How do I know which version I have installed?

The latest version of `foundryup` is `0.3.1`.

If you run `foundryup --version` and it does not return this or returns an error you are not up to date.

#### How do I update `foundryup`?

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

As a security best practice it is recommended you manually follow the [redirect](https://foundry.paradigm.xyz), inspect the [installer](https://raw.githubusercontent.com/foundry-rs/foundry/master/foundryup/install) you are about to run and the new version of [`foundryup`](https://raw.githubusercontent.com/foundry-rs/foundry/master/foundryup/foundryup) you are about to install.

After the initial update you'll be able to update to the latest version of `foundryup` by running:

```sh
foundryup --update
```

#### How do I install multiple versions?

Easily install different versions using:

```sh
foundryup --install <version>
```

e.g.

```sh
foundryup --install nightly
foundryup --install stable
foundryup --install 0.3.0
```

#### How do I know which versions I have installed?

Run

```sh
foundryup --list
```

This will output a list as follows:

```sh
foundryup: nightly
foundryup: - forge 0.3.0 (017c59d 2025-01-14T00:25:28.977200980Z)
foundryup: - cast 0.3.0 (017c59d 2025-01-14T00:25:28.933986754Z)
foundryup: - anvil 0.3.0 (017c59d 2025-01-14T00:25:29.065516554Z)
foundryup: - chisel 0.3.0 (017c59d 2025-01-14T00:25:29.021147876Z)

foundryup: stable
foundryup: - forge 0.3.0 (5a8bd89 2024-12-20T08:46:21.555250780Z)
foundryup: - cast 0.3.0 (5a8bd89 2024-12-20T08:46:21.564365462Z)
foundryup: - anvil 0.3.0 (5a8bd89 2024-12-20T08:46:21.565569027Z)
foundryup: - chisel 0.3.0 (5a8bd89 2024-12-20T08:46:21.536871477Z)

foundryup: v0.3.0
foundryup: - forge 0.3.0 (5a8bd89 2024-12-19T17:17:10.245193696Z)
foundryup: - cast 0.3.0 (5a8bd89 2024-12-19T17:17:10.252265834Z)
foundryup: - anvil 0.3.0 (5a8bd89 2024-12-19T17:17:10.248488022Z)
foundryup: - chisel 0.3.0 (5a8bd89 2024-12-19T17:17:10.201917651Z)
```

#### How do I switch between versions?

Easily manage your installations with:

```sh
foundryup --use <version>
```

e.g.

```sh
foundryup --use nightly
foundryup --use stable
foundryup --use 0.3.0
```

#### How do I configure `foundry-toolchain`?

The `foundry-toolchain` GitHub Action will use the latest `stable` release by default.

If you would prefer to use a different release you can set the `version` key:

```yml
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: <version>
```
e.g.
```yml
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly
```
#### I prefer using nightly builds.
You are still able to receive the latest `nightly` builds by running `foundryup --install nightly`

**Be cautious — nightly builds may include breaking changes that are difficult to debug without context.**
92 changes: 76 additions & 16 deletions src/anvil/README.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,91 @@
## Overview of Anvil
## Anvil

Anvil is a local testnet node shipped with Foundry. You can use it for testing your contracts from frontends or for interacting over RPC.
Anvil is a fast local Ethereum development node.

Anvil is part of the Foundry suite and is installed alongside `forge`, `cast`, and `chisel`. If you haven't installed Foundry yet, see [Foundry installation](../getting-started/installation.md).
Anvil is part of the Foundry suite and is installed alongside `forge`, `cast` and `chisel`. If you haven't installed Foundry
yet, see [Foundry installation](../getting-started/installation.md).

> Note: If you have an older version of Foundry installed, you'll need to re-install `foundryup` in order for Anvil to be downloaded.
### Getting started

### How to use Anvil
To use Anvil, simply type `anvil`. To fork against a live Ethereum network run `anvil --fork-url <RPC_URL>`.

To use Anvil, simply type `anvil`. You should see a list of accounts and private keys available for use, as well as the address and port that the node is listening on.
Let's fork Ethereum mainnet at the latest block:

Anvil is highly configurable. You can run `anvil -h` to see all the configuration options.
```console
$ anvil --fork-url https://eth.merkle.io

Some basic options are:

```bash
# Number of dev accounts to generate and configure. [default: 10]
anvil -a, --accounts <ACCOUNTS>
_ _
(_) | |
__ _ _ __ __ __ _ | |
/ _` | | '_ \ \ \ / / | | | |
| (_| | | | | | \ V / | | | |
\__,_| |_| |_| \_/ |_| |_|

# The EVM hardfork to use. [default: latest]
anvil --hardfork <HARDFORK>
0.2.0 (c4fcf12 2024-12-12T00:23:45.094165202Z)
https://github.com/foundry-rs/foundry

# Port number to listen on. [default: 8545]
anvil -p, --port <PORT>
Available Accounts
==================

(0) 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 (10000.000000000000000000 ETH)
(1) 0x70997970C51812dc3A010C7d01b50e0d17dc79C8 (10000.000000000000000000 ETH)
(2) 0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC (10000.000000000000000000 ETH)
(3) 0x90F79bf6EB2c4f870365E785982E1f101E93b906 (10000.000000000000000000 ETH)
(4) 0x15d34AAf54267DB7D7c367839AAf71A00a2C6A65 (10000.000000000000000000 ETH)
(5) 0x9965507D1a55bcC2695C58ba16FB37d819B0A4dc (10000.000000000000000000 ETH)
(6) 0x976EA74026E726554dB657fA54763abd0C3a0aa9 (10000.000000000000000000 ETH)
(7) 0x14dC79964da2C08b23698B3D3cc7Ca32193d9955 (10000.000000000000000000 ETH)
(8) 0x23618e81E3f5cdF7f54C3d65f7FBc0aBf5B21E8f (10000.000000000000000000 ETH)
(9) 0xa0Ee7A142d267C1f36714E4a8F75612F20a79720 (10000.000000000000000000 ETH)

Private Keys
==================

(0) 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
(1) 0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d
(2) 0x5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a
(3) 0x7c852118294e51e653712a81e05800f419141751be58f605c371e15141b007a6
(4) 0x47e179ec197488593b187f80a00eb0da91f1b9d0b13f8733639f19c30a34926a
(5) 0x8b3a350cf5c34c9194ca85829a2df0ec3153be0318b5e2d3348e872092edffba
(6) 0x92db14e403b83dfe3df233f83dfa3a0d7096f21ca9b0d6d6b8d88b2b4ec1564e
(7) 0x4bbbf85ce3377467afe5d46f804f221813b2bb87f24d81f60f1fcdbf7cbf4356
(8) 0xdbda1821b80551c9d65939329250298aa3472ba22feea921c0cf5d620ea67b97
(9) 0x2a871d0798f97d79848a013d4936a73bf4cc922c825d33c1cf7073dff6d409c6

Wallet
==================
Mnemonic: test test test test test test test test test test test junk
Derivation path: m/44'/60'/0'/0/


Fork
==================
Endpoint: https://eth.merkle.io
Block number: 21387064
Block hash: 0x904aee789b82ac0412448bc2ea9bb3774d10c2dae4a0e5b7f6451ac2ecd0787a
Chain ID: 1

Base Fee
==================

26049293674

Gas Limit
==================

30000000

Genesis Timestamp
==================

1734014216

Listening on 127.0.0.1:8545
```

<br>

> 📚 **Reference**
>
> See the [`anvil` Reference](../reference/anvil/) for in depth information on Anvil and its capabilities.
49 changes: 34 additions & 15 deletions src/cast/README.md
Original file line number Diff line number Diff line change
@@ -1,37 +1,56 @@
## Overview of Cast
## Cast

Cast is Foundry's command-line tool for performing Ethereum RPC calls. You can make smart contract calls, send transactions, or retrieve any type of chain data - all from your command-line!
Cast is a Swiss Army knife for interacting with Ethereum applications from the command line. You can make smart contract calls, send transactions, or retrieve any type of chain data - all from your command-line!

### How to use Cast
The `cast` binary can be used both within and outside of a Foundry project.

To use Cast, run the [`cast`](../reference/cast/cast.md) command followed by a subcommand:
Cast is part of the Foundry suite and is installed alongside `forge`, `chisel`, and `anvil`. If you haven't installed Foundry
yet, see [Foundry installation](../getting-started/installation.md).

```bash
$ cast <subcommand>
### Getting started

Here are a few examples of what you can do:

**Check the latest block on Ethereum Mainnet**:

```sh
cast block-number --rpc-url https://eth.merkle.io
```

**Check the Ether balance of `vitalik.eth`**

```sh
cast balance vitalik.eth --ether --rpc-url https://eth.merkle.io
```

**Replay and trace a transaction**

```sh
cast run 0x9c32042f5e997e27e67f82583839548eb19dc78c4769ad6218657c17f2a5ed31 --rpc-url https://eth.merkle.io
```

#### Examples
Optionally, pass `--etherscan-api-key <API_KEY>` to decode transaction traces using verified source maps, providing more detailed and human-readable information.

Let's use `cast` to retrieve the total supply of the DAI token:
**Retrieve the total supply of the DAI token**

```bash
```sh
{{#include ../output/cast/cast-call:all}}
```

`cast` also provides many convenient subcommands, such as for decoding calldata:
**Decode calldata**

```bash
```sh
{{#include ../output/cast/cast-4byte-decode:all}}
```

You can also use `cast` to send arbitrary messages. Here's an example of sending a message between two Anvil accounts.
**Send messages between two Anvil accounts**

```bash
$ cast send --private-key <Your Private Key> 0x3c44cdddb6a900fa2b585dd299e03d12fa4293bc $(cast from-utf8 "hello world") --rpc-url http://127.0.0.1:8545/
```sh
cast send --private-key <PRIVATE_KEY> 0x3c44cdddb6a900fa2b585dd299e03d12fa4293bc $(cast from-utf8 "hello world") --rpc-url http://127.0.0.1:8545/
```

<br>

> 📚 **Reference**
>
>
> See the [`cast` Reference](../reference/cast/) for a complete overview of all the available subcommands.
Loading

0 comments on commit e4cdaf8

Please sign in to comment.