foundry-rs / foundry
- воскресенье, 8 мая 2022 г. в 00:28:57
Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.
Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.
Foundry consists of:
Need help getting started with Foundry? Read the
Having issues? See the troubleshooting section.
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, run foundryup
in a new terminal session or after reloading your PATH
.
Other ways to use foundryup
, and other documentation, can be found here. Happy forging!
For people that want to install from source, you can do so like below:
git clone https://github.com/foundry-rs/foundry
cd foundry
cargo install --path ./cli --bins --locked --force
Or via cargo install --git https://github.com/foundry-rs/foundry --locked
Foundry maintains a Docker image repository.
You can pull the latest release image like so:
docker pull ghcr.io/foundry-rs/foundry:latest
For examples and guides on using this image, see the Docker section in the book.
You can manually download nightly releases here.
~/.svm
)DsTest
's emitted logsconsole.sol
contractForge is quite fast at both compiling (leveraging ethers-solc) and testing.
See the benchmarks below. More benchmarks can be found in the v0.2.0 announcement post and in the Convex Shutdown Simulation repository.
Testing Benchmarks
Project | Forge | DappTools | Speedup |
---|---|---|---|
maple-labs/loan | 800ms | 4m28s | 335x |
Rari-Capital/solmate | 2.8s | 6m34s | 140x |
reflexer-labs/geb | 0.4s | 23s | 57.5x |
Rari-Capital/vaults | 0.28s | 6.5s | 23x |
Note: In the above benchmarks, compilation was always skipped
Compilation Benchmarks
Takeaway: Forge compilation is consistently faster by a factor of 1.7-11.3x, depending on the amount of caching involved.
Cast is a swiss army knife for interacting with Ethereum applications from the command line.
More documentation can be found in the cast package.
foundry.toml
Foundry is designed to be very configurable. You can configure Foundry using a file called
foundry.toml
in the root of your project, or any other parent
director. See
config package for all available options.
Configuration can be arbitrarily namespaced by profiles. The default profile is named default
(see "Default Profile").
You can select another profile using the FOUNDRY_PROFILE
environment variable.
You can also override parts of your configuration using FOUNDRY_
or DAPP_
prefixed environment variables, like FOUNDRY_SRC
.
forge init
creates a basic, extendable foundry.toml
file.
To see your current configuration, run forge config
. To see only basic
options (as set with forge init
), run forge config --basic
. This can be used
to create a new foundry.toml
file with forge config --basic > foundry.toml
.
By default forge config
shows the currently selected foundry profile and its values. It also accepts the same arguments as forge build
.
You can re-use your .dapprc
environment variabless by running source .dapprc
beforehand using a Foundry tool.
You can find additional setup and configurations guides in the Foundry Book:
libusb
error when running forge
/cast
If you are using the binaries as released, you may see the following error on MacOS:
dyld: Library not loaded: /usr/local/opt/libusb/lib/libusb-1.0.0.dylib
In order to fix this, you must install libusb
like so:
brew install libusb
GLIBC
error when running forge
from default foundryup
install:If you run into an error resembling the following when using foundryup
:
forge: /lib/x86_64-linux-gnu/libc.so.6: version 'GLIBC_2.29' not found (required by forge)
There are 2 workarounds:
foundryup -b master
See our contributing guidelines.
First, see if the answer to your question can be found in book, or in the relevant crate.
If the answer is not there:
If you want to contribute, or follow along with contributor discussion, you can use our main telegram to chat with us about the development of Foundry!
abigen
macros.