Installation
To start developing with Solidity, you will need to install the following and its dependencies:
Verify that foundry is installed and working:
foundryup
forge --version
Solidity Quickstart
Create a new project
We are using pnpm to manage dependencies, to use git submodules to manage dependencies do read the foundry guide
Use the template to create a new project:
Create project
git clone git@github.com:satlayer/my-bvs-service.git --depth 1
Enter project
cd my-bvs-service
Simplified project structure:
- Deployment.s.sol
- MyBVSService.sol
- MyBVSService.t.sol
- foundry.toml
- package.json
- remappings.txt
src
: your contracts (e.g., src/MyBVSService.sol)test
: Forge tests (e.g., test/MyBVSService.t.sol)foundry.toml
: configuration file for Foundrypackage.json
: manage dependencies with pnpmremappings.txt
: list of remappings for dependencies
Build and test
Build & Test
pnpm install
forge build
forge test -vvv
Add common dependencies (optional)
Install dependencies as needed. For example, to install OpenZeppelin:
Install deps
pnpm install @openzeppelin/contracts
To use submodules to manage dependencies, you will need to install deps with forge install
.
Configure networks (optional)
Add or edit foundry.toml
to include RPC endpoints and other settings for your preferred EVM chain:
foundry.toml
[profile.default]
src = "src"
out = "out"
tests = "test"
libs = ["node_modules"]
solc = "0.8.24"
optimizer = true
optimizer_runs = 20_000
[rpc_endpoints]
# Replace with your endpoints
sepolia = "https://sepolia.infura.io/v3/${INFURA_KEY}"
Next Steps
Last updated on