A collection of Solidity interfaces, libraries, and mock implementations for Base precompiles.
forge install base/base-stdsrc ├── StdPrecompiles.sol: Collection of precompiles and their interfaces └── interfaces ├── IB20.sol: Core Token Standard ├── IB20Stablecoin.sol: Stablecoin variant of B20 ├── IB20Security.sol: Security variant of B20 ├── IPolicyRegistry.sol: Policy registry shared across B20s └── ITokenFactory.sol: B20 factory contract
forge build
forge testSolidity version: 0.8.30 for reference implementations. Interfaces are
written for broader compatibility (>=0.8.20 <0.9.0) so consumers can
import them without forcing a specific compiler.
The unit suite can run against a chain hosting the live Rust precompile implementations to verify the Rust impls match the Solidity reference's behavior and storage layout. The same test bodies are reused — only the backend changes.
LIVE_PRECOMPILES=true FOUNDRY_PROFILE=fork forge test --fork-url vibenetWhat each flag does:
--fork-url vibenet— selects the RPC endpoint defined infoundry.tomlunder[rpc_endpoints](currentlyhttps://rpc.vibes.base.org/). Foundry forks the chain in a sandboxed copy-on-write state; tests mutate the fork without touching the real chain.LIVE_PRECOMPILES=true— tellsBaseTest.setUpto skip the mock-etching step. Without it,vm.etchwould clobber the live precompile addresses with the mock bytecode, silently routing every call back through the Solidity reference and producing false-pass results.FOUNDRY_PROFILE=fork— switches to a reduced-fuzz-runs profile (10 instead of 256). Each fuzz iteration may trigger RPC round-trips against the live precompiles; the goal at this stage is "does the layout / behavior match" rather than fuzz coverage. Drop this flag to use the default fuzz runs.
A test failure under this command means one of three things, in diagnostic order: (1) the feature isn't activated yet in the ActivationRegistry, (2) the precompile isn't deployed at its canonical address on the forked chain, or (3) the Rust impl's storage layout / behavior diverges from the Solidity reference at the asserted slot.
MIT