fhevm-control-flow
FHE Control Flow
Use this skill when writing or reviewing any Solidity logic that needs to branch on
encrypted conditions. Normal Solidity control flow does not work with encrypted values.
Every if, require, and ternary operator on encrypted state must be replaced with
FHE.select for inline encrypted branching, or with an async public-decryption flow if the
result must drive plaintext business logic.
When To Use
- Replacing
if/elseblocks that depend on encrypted balances or state - Replacing
require()guards that check encrypted conditions - Designing error handling and user feedback for confidential operations
- Reviewing contracts for illegal branching on encrypted values
- Planning product UX around silent-failure semantics
Core Mental Model
In standard Solidity, a failed guard often reverts immediately. In FHEVM, a guard that depends
More from z-korp/fhevm-cookbook
fhevm-router
Routes Zama FHEVM tasks to the right official docs path and next step
11fhevm-testing
Use when writing, structuring, or debugging tests for FHEVM contracts. Covers mocked mode vs real protocol, Hardhat decrypt helpers, input encryption in tests, and the false-confidence gap between local and testnet behavior.
11fhevm-acl-lifecycle
Use when granting, auditing, or debugging ACL permissions on encrypted handles in FHEVM. Covers FHE.allow, FHE.allowThis, FHE.allowTransient, and the critical rule that new handles do not inherit prior persistent ACL grants.
11oz-utils-safemath
Use when you need overflow-safe encrypted arithmetic on euint64 values. Covers the OpenZeppelin FHESafeMath library (tryIncrease, tryDecrease, tryAdd, trySub), uninitialized-handle semantics, and when to prefer it over raw FHE.add / FHE.sub.
11fhevm-public-decryption
Use when implementing two-step public decryption for state-changing operations in FHEVM. Covers makePubliclyDecryptable, off-chain proof retrieval, onchain verification with checkSignatures, and the critical single-step unwrap bug.
11fhevm-cross-contract
Use when passing encrypted handles between contracts, designing multi-contract FHE flows, or debugging handle-not-accessible errors at contract boundaries. Covers allowTransient, allow, permission chains, and factory patterns.
11