An invariant is a property that must stay true across all possible state transitions — no matter what sequence of calls a contract receives. SolidScript turns methods decorated withDocumentation Index
Fetch the complete documentation index at: https://docs.solidscipt.zoracle.xyz/llms.txt
Use this file to discover all available pages before exploring further.
@invariant into Forge invariant tests and runs them as part of the verification pipeline. This guide shows you how to annotate a contract with invariant methods and run the invariant gate locally.
Add invariant methods to a contract
Decorate methods with@invariant to declare properties that must always hold. Each method should return a boolean:
YieldVault.ts
- Return
boolean - Read contract state
- Avoid changing state
- Assert one property at a time
Run the invariant gate
Run all verification checks, including the invariant gate, with:--skip invariants:
The invariant gate is generated from your TypeScript annotations. You still need to choose properties that matter for the contract’s trust model.