https://github.com/foundry-rs/foundry
- Install
curl -L https://foundry.paradigm.xyz | bash
foundryup
- Init
forge init
- Basic commands
forge build
forge test
forge test --match-path test/HelloWorld -vvvv
- Test
- counter app
- test setup, ok, fail
- match
- verbose
- gas report
forge test --match-path test/Counter.t.sol -vvv --gas-report
- Solidity version and optimizer settings
https://github.com/foundry-rs/foundry/tree/master/config
- Remapping
forge remappings
forge install rari-capital/solmate
forge update lib/solmate
forge remove solmate
npm i @openzeppelin/contracts
- Formatter
forge fmt
- console (Counter, test, log int)
forge test --match-path test/Console.t.sol -vv
-
Test auth
-
Test error
vm.expectRevert
require
error message- custom error
- label assertions
-
Test event (expectEmit)
-
TODO: Test time (
Auction.sol
) -
Test send eth (
Wallet.sol
)- hoax, deal
-
Test signature
-
TODO: Cheatcode
- env
-
TODO: test multisig, auction?
- mainnet fork
forge test --fork-url $FORK_URL --match-path test/Fork.t.sol -vvv
TODO: not working right now
-
crosschain fork
- token bridge
-
Fuzzing (assume, bound)
-
Invariant
-
FFI
-
Differential testing
# virtual env
python3 -m pip install --user virtualenv
virtualenv -p python3 venv
source venv/bin/activate
pip install eth-abi
-
forge geiger
-
Vyper
https://github.com/0xKitsune/Foundry-Vyper
- Install vyper
# virtual env
python3 -m pip install --user virtualenv
virtualenv -p python3 venv
source venv/bin/activate
pip3 install vyper==0.3.7
# Check installation
vyper --version
- Put Vyper contract inside
vyper_contracts
- Declare Solidity interface inside
src
- Copy & paste
lib/utils/VyperDeployer.sol
- Write test
- print vyper
print("HERE", convert(123, uint256), hardhat_compat=True)
forge test --match-path test/Vyper.t.sol --ffi
- ignore error code
ignored_error_codes = ["license", "unused-param", "unused-var"]
- Forge geiger
forge geiger
- chisel?
- debugger?
- forge snapshot?
- script?