caelum0x 94c26e9496 feat: QIE Forge — clean-room AMM + lending vault, SDK, and CLI for QIE
Initial build for QIE Mainnet Hackathon 3.0 (DeFi & Financial
Infrastructure track). Includes:

- packages/contracts: constant-product AMM (factory/pair/router),
  over-collateralized lending vault, and an oracle adapter wrapping
  QIE's real deployed price-feed contracts. 25/25 Foundry tests pass
  locally. Clean-room: no existing DEX/lending protocol source was
  read or copied.
- packages/core: TypeScript SDK (viem-based) for QIE's chain, the
  real (corrected) oracle ABI, a fail-closed QUSDC helper, a
  Blockscout explorer client, and QIE Wallet connection constants.
  Live-verified against real testnet (chain 1983) and mainnet
  (chain 1990) RPCs and the real oracle contracts.
- packages/cli: a small CLI built on @qie-forge/core.

Real findings from building this, documented in README.md and
docs/STATUS.md: the previously-documented testnet RPC URL is dead
(replacement found and verified live); QIE's own oracle docs describe
a getPrice(string) function that reverts on the real deployed
contracts, which actually implement a Chainlink AggregatorV3-style
interface (verified live via raw eth_call); the oracle is deployed on
Mainnet only, not Testnet.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-26 23:34:51 +03:00

3.1 KiB

Running formal verification tool

These instructions detail the process for running Formal Verification Tool on OpenZeppelin Contracts.

Documentation for CVT and the specification language is available here.

Prerequisites

Follow the Certora installation guide in order to get the Certora Prover Package and the solc executable folder in your path.

Note

An API Key is required for local testing. In CI the prover runs on any pull request whose diff reaches a spec, a harness, a contract one of them verifies, or a patch in fv/diff applied to one, with one job per affected configuration. That selection is computed by scripts/list-dependencies.js.

Running the verification

The Formal Verification Tool proves specs for contracts, which are defined by per-spec .conf files located under fv/specs/ along with their pre-configured options.

The verification script ./run.js is used to submit verification jobs to the Certora Verification service.

You can run it from the root of the repository with the following command:

node fv/run.js [SPEC_NAME | fv/specs/NAME.conf] [--all] [-p N] [-v]

Where:

  • SPEC_NAME is the base name of a configuration file in fv/specs/ without extension. For example, AccessControl maps to fv/specs/AccessControl.conf.
  • Alternatively, you may pass an explicit path to a .conf file under fv/specs/.
  • Supported script options are --all, --parallel/-p, and --verbose/-v.

Note

A single spec may be configured to run for multiple contracts, whereas a single contract may run multiple specs.

Example usage:

node fv/run.js AccessControl # Run the AccessControl configuration (fv/specs/AccessControl.conf) using its harness and spec

Adapting to changes in the contracts

Some of our rules require the code to be simplified in various ways. Our primary tool for performing these simplifications is to run verification on a contract that extends the original contracts and overrides some of the methods. These "harness" contracts can be found in the fv/harnesses directory.

This pattern does require some modifications to the original code: some methods need to be made virtual or public, for example. These changes are handled by applying a patch to the code before verification by running:

make -C fv apply

Before running the fv/run.js script, it's required to apply the corresponding patches to the contracts directory, placing the output in the fv/patched directory. Then, the contracts are verified by running the verification for the fv/patched directory.

If the original contracts change, it is possible to create a conflict with the patch. In this case, the verify scripts will report an error message and output rejected changes in the patched directory. After merging the changes, run make record in the fv directory; this will regenerate the patch file, which can then be checked into git.

For more information about the make scripts available, run:

make -C fv help