Template overview
Before reading this guide, follow the Oracle component tutorial to learn the basics of building a WAVS service.
Use the info in this guide to customize the template to create your own custom service. Check out the WAVS design considerations page to learn which use-cases WAVS is best suited for.
Foundry Template structure
The WAVS template is made up of the following main files:
wavs-foundry-template/├── README.md├── makefile # Commands, variables, and configs├── components/ # WASI components│ └── evm-price-oracle/│ ├── src/│ │ ├── lib.rs # Main Component logic│ │ ├── trigger.rs # Trigger handling│ │ └── bindings.rs # Bindings generated by `make build`│ └── Cargo.toml # Component dependencies├── compiled/ # WASM files compiled by `make build`├── src/│ ├── contracts/ # Trigger and submission contracts│ └── interfaces/ # Solidity interfaces├── script/ # Deployment & interaction scripts├── wavs.toml # WAVS service configuration├── docs/ # Documentation├── .cursor/rules/ # Cursor AI rulefiles├── claude.md # Claude AI rulefile└── .env # Private environment variables
- The
READMEfile contains the tutorial commands. - The
makefilecontains commands for building and deploying the service. It also contains configurable variables for the service and deployment. - The
componentsdirectory contains the component logic for your service. Runningmake wasi-buildwill automatically generate bindings and compile components into thecompileddirectory. - The
srcdirectory contains the Solidity contracts and interfaces for trigger and submission contracts. - The
scriptdirectory contains the scripts used in the makefile commands to deploy, trigger, and test the service. - The
.envfile contains private environment variables and keys. Usecp .env.example .envto copy the example.envfile. - The
.cursor/rulesdirectory andclaude.mdfile contain rulefiles for building components with Cursor AI and Claude AI agents.
Toml files
There are several toml files in the template that are used to configure the service:
wavs.tomlis used to configure the WAVS service itself, including chains (local, testnets, mainnet) and configurations.Cargo.tomlin the root directory is used to configure the workspace and includes dependencies, build settings, and component metadata.components/*/Cargo.tomlin each component directory is used to configure the Rust component and includes dependencies, build settings, and component metadata. It can inherit dependencies from the rootCargo.tomlfile usingworkspace = true.
These files can be customized to suit your specific needs, and many settings can be overridden using environment variables.
The following is an example of a component's Cargo.toml file structure:
[package]name = "evm-price-oracle"edition.workspace = trueversion.workspace = trueauthors.workspace = truerust-version.workspace = truerepository.workspace = true[dependencies]wit-bindgen-rt ={ workspace = true }wavs-wasi-utils = { workspace = true }serde = { workspace = true }serde_json = { workspace = true }alloy-sol-macro = { workspace = true }wstd = { workspace = true }alloy-sol-types = { workspace = true }anyhow = { workspace = true }[lib]crate-type = ["cdylib"][profile.release]codegen-units = 1opt-level = "s"debug = falsestrip = truelto = true[package.metadata.component]package = "component:evm-price-oracle"
wavs.toml config
The wavs.toml file contains configuration settings for all WAVS components:
- Default general settings (shared across all processes)
- WAVS server-specific settings
- CLI-specific settings
- Aggregator-specific settings
Environment Variable Overrides
Environment variables can override configuration values using these patterns:
- WAVS server settings:
WAVS_<UPPERCASE_KEY> - CLI settings:
WAVS_CLI_<UPPERCASE_KEY> - Aggregator settings:
WAVS_AGGREGATOR_<UPPERCASE_KEY>
