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.
$ forge build
$ forge test
$ forge fmt
$ forge snapshot
$ anvil
$ forge script script/Counter.s.sol:CounterScript --rpc-url <your_rpc_url> --private-key <your_private_key>
$ cast <subcommand>
$ forge --help
$ anvil --help
$ cast --help
forge create SimpleStorage --interactive
and then pass the private key this will deploy our contract on local anvil chain if you want to add another chain you must paasss rpc-url and priavte key to an acoount on that chain
.s.sol - is a convention to tell that its a script
forge script script/DeploySimpleStorage.s.sol --rpc-url http://127.0.0.1:8545 --broadcast
--private-key 0x00000000000000000000000000000000000000000000000000000000000000
000
this is how we deploy on anvil local chain
erc2335
needs : node, npm, npx docker, zksync
# start foundry zksync
foundryup-zksync
# Start docker and check if running by
docker --version
# configure the dev cli you will be using
npx zksync-cli dev config
# start the docker container
npx zksync-cli dev start
# check of docker process running
docker ps
# Output looks like
#CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
#ff3d5a0e448c zkcli-in-memory-node-zksync "era_test_node run" 7 days ago Up 22 seconds 0.0.0.0:8011->8011/tcp zkcli-in-memory-node-zksync-1
forge create src/SimpleStorage.sol:SimpleStorage --rpc-url http://127.0.0.1:8011 --private-key 0 --legacy --zksync
its too much pricy to use ethurium directly so we use L2