This page covers the smart contract implementation details. See Glossary.
Prerequisites
- Foundry installed and available on
PATH - A Vehicle contract implementing
IVehicle - Working knowledge of the STEAM standard
Create the base test contract
Place the test file attest/vehicles/<your_vehicle>/<YourVehicle>Vehicle.t.sol and inherit from STEAMSingleAssetTester to activate the conformance suite.
Configure the test environment
The base tester exposes internal hooks for optional components. Each defaults toaddress(0); override the ones your Vehicle depends on.
Add vehicle-specific tests
STEAMSingleAssetTester covers the generic state machine. Extend it with tests that exercise your adapter’s protocol-specific logic — constructor guards, custom data field parsing, protocol edge cases.
Test composition pattern
Exercise the Vehicle under each supported configuration by creating variant test files that extend the base contract and override the component hooks.Baseline (no optional components)
MyVehicle.t.sol — the base file defined above. All hooks resolve to address(0).Key helper methods
STEAMSingleAssetTester exposes the following internal helpers for use in custom test cases:
| Helper | Description |
|---|---|
_get_and_prepare_query(user, receiver, mode, amount, salt) | Mints and approves the input asset, then returns a fully-formed Query struct |
_get_run_config(query) | Builds a RunConfig used to drive the query through the STEAM state machine |
_compute_amount(uint256) | Clamps a fuzzed value to a bounded range (1–1000 units) |
_unit(count) | Scales an integer count by the asset’s decimals (e.g., _unit(1) == 1e18 for WETH) |
Inherited test categories
Inheriting fromSTEAMSingleAssetTester activates coverage across the following areas:
- State machine — valid and invalid transitions across every STEAM state
- Input validation — zero amounts, unsupported assets, invalid receivers
- Access control — enforcement of caller permissions on lifecycle methods
- Fee handling — correct accrual and settlement of deposit and redeem fees
- Module execution — interaction with protocol modules through
ModulesManager