Thanks for your interest in contributing to BETH. This guide explains how to set up the repo, coding standards, testing, and analysis tooling.
- Install Foundry: https://book.getfoundry.sh/getting-started/installation
- Clone and enter the project directory.
- Install dependencies:
forge install- Or
make install
- Build & test:
forge buildforge test -vvv
- Solidity 0.8.24 (see
foundry.toml) - Full NatSpec for contracts/functions/events/errors:
@title,@notice,@dev,@param,@returnwhere applicable
- Use OpenZeppelin primitives where appropriate
- No ownership, no upgradeability, no privileged access
- Keep code minimal, explicit, and readable; avoid unnecessary complexity
- All Solidity files must use MIT SPDX. Keep a single SPDX header at the top.
- Unit:
test/unit/*.t.sol - Fuzz:
test/fuzz/*.t.sol - Invariants:
test/invariants/*.t.sol - Exploits/edge:
test/exploits/*.t.sol
- Run all tests with gas report:
forge test --gas-report - Match by contract/test name:
forge test --match-contract BETH --match-test test_Deposit - Snapshot gas:
forge snapshot - Coverage (lcov):
forge coverage --report lcov - Mainnet fork (set
RPC_URL):RPC_URL=$RPC_URL forge test --match-contract MainnetFork
- Slither (static analysis):
- Install:
pip3 install slither-analyzer solc-select && solc-select install 0.8.24 && solc-select use 0.8.24 - Run:
slither . --config-file slither.config.json
- Install:
- Solhint (NatSpec/style):
- Install:
npm i -g solhintor usenpx --yes solhint - Run:
npx --yes solhint -f table "src/**/*.sol" "test/**/*.sol"
- Install:
- Format:
forge fmt --check(ormake fmt) - Local CI bundle:
scripts/ci-local.sh(ormake ci-local) - Selector surface check:
scripts/check_selectors.sh
- Copy
.env.exampleto.envand set:RPC_URL,PRIVATE_KEY,ETHERSCAN_API_KEY,BETH_ADDRESS
GitHub Actions runs formatting, build, tests with gas report, Slither (fails on Medium+), and coverage enforcement (≥95% total lines, 100% for src/BETH.sol).
- Keep commits focused and descriptive
- Include tests for behavior changes
- Ensure
forge testpasses and no new Slither/Solhint issues