Skip to content

Latest commit

 

History

History

Examples

README.md

Examples

Contracts used to develop and exercise the framework. Each directory holds one contract: its Stele specification (Spec.lean, with Solidity-like surface syntax in SpecSyntax.lean), the exact compiled bytecode as a Lean byte array (Bytecode.lean), and the refinement proof, assembled in Correct.lean. The top-level theorem of each example is named in the table.

All proofs are complete.

Example Source Compiler Top-level theorem
Truth Hand-written one-getter contract solc 0.8.35, optimizer off, Shanghai truthCorrect
Pow Hand-written loop (exponentiation) solc 0.8.35, optimizer off, Shanghai powCorrect
Caller Hand-written external-call contract solc 0.8.35, optimizer off, Shanghai callerCorrect
CtorTruth Truth plus its real solc constructor solc 0.8.35, --no-cbor-metadata, Shanghai ctorTruthRuntimeCorrect
CtorStore Hand-written minimal initcode storing one word solc 0.8.35 runtime, hand-written creation bytecode ctorStoreRuntimeCorrect
ERC20 Minimal hand-written ERC20 solc 0.8.35, optimizer off, Shanghai erc20Correct
VyperERC20 Hand-written Vyper version of the minimal ERC20 vyper 0.4.3 runtimeCorrect
StringStoreLite Hand-written string-storage contract solc 0.8.35, optimizer off, Shanghai stringStoreLiteCorrect
TinyImmutable Hand-written immutables contract solc 0.8.35, standard-json tinyImmutableCorrect
Reuse Two functions sharing a code block solc 0.8.35, optimizer on, Shanghai cCorrect
Ballot Solidity docs: Voting solc 0.8.35, optimizer on, Shanghai ballotCorrect
SimpleAuction Solidity docs: Simple Open Auction solc 0.8.35, optimizer on, Shanghai simpleAuctionCorrect
BlindAuction Solidity docs: Blind Auction solc 0.8.35, optimizer on, Shanghai blindAuctionCorrect
OpenZeppelinBench/Ownable2Step OpenZeppelin Ownable2Step.sol (master snapshot, 2026-06-23) solc 0.8.35, optimizer on, Shanghai ownable2StepCorrect
OpenZeppelinBench/AccessControl OpenZeppelin AccessControl.sol (same snapshot) solc 0.8.35, optimizer on, Shanghai accessControlCorrect
OpenZeppelinBench/Pausable OpenZeppelin Pausable.sol (same snapshot) solc 0.8.35, optimizer on, Shanghai pausableCorrect
OpenZeppelinBench/ERC6909 OpenZeppelin ERC6909.sol (same snapshot) solc 0.8.35, optimizer on, Shanghai erc6909Correct
UniswapV2Pair Uniswap/v2-core v1.0.1 solc 0.5.16, optimizer on (200 runs) uniswapV2PairCorrect

File conventions

  • Spec.lean — the Stele contract: storage layout, transitions, external-call hooks.
  • SpecSyntax.lean — the same spec in Solidity-like surface syntax, proved equal to Spec.lean.
  • Bytecode.lean — the compiled bytecode as a byte array, with the compiler invocation recorded in the header, plus the verified jump-destination table.
  • Correct.lean — the top-level theorem; per-function proofs live in sibling files.
  • .sol/.vy sources are checked in next to the Lean files.

Trusted base

Jump-destination tables are verified with native_decide, which trusts the Lean compiler.