FHEVM Cookbook Thin skills catalog for working on Zama FHEVM. Current scope: - fhevm-router: skills/fhevm-router/SKILL.md - oz-erc7984-confidential-tokens: skills/oz-erc7984-confidential-tokens/SKILL.md - fhevm-privacy-constraints: skills/fhevm-privacy-constraints/SKILL.md - fhevm-acl-lifecycle: skills/fhevm-acl-lifecycle/SKILL.md - fhevm-control-flow: skills/fhevm-control-flow/SKILL.md - fhevm-encrypted-inputs: skills/fhevm-encrypted-inputs/SKILL.md - fhevm-user-decryption: skills/fhevm-user-decryption/SKILL.md - fhevm-public-decryption: skills/fhevm-public-decryption/SKILL.md - fhevm-security-audit: skills/fhevm-security-audit/SKILL.md - oz-erc7984-compliance-patterns: skills/oz-erc7984-compliance-patterns/SKILL.md - fhevm-arithmetic-ops: skills/fhevm-arithmetic-ops/SKILL.md - fhevm-testing: skills/fhevm-testing/SKILL.md - fhevm-token-registry: skills/fhevm-token-registry/SKILL.md - fhevm-frontend-integration: skills/fhevm-frontend-integration/SKILL.md - fhevm-cross-contract: skills/fhevm-cross-contract/SKILL.md - oz-erc7984-confidential-governance: skills/oz-erc7984-confidential-governance/SKILL.md - oz-erc7984-custodian-omnibus: skills/oz-erc7984-custodian-omnibus/SKILL.md - oz-utils-safemath: skills/oz-utils-safemath/SKILL.md Raw skill URLs: - fhevm-router: https://raw.githubusercontent.com/z-korp/fhevm-cookbook/main/skills/fhevm-router/SKILL.md - oz-erc7984-confidential-tokens: https://raw.githubusercontent.com/z-korp/fhevm-cookbook/main/skills/oz-erc7984-confidential-tokens/SKILL.md - fhevm-privacy-constraints: https://raw.githubusercontent.com/z-korp/fhevm-cookbook/main/skills/fhevm-privacy-constraints/SKILL.md - fhevm-acl-lifecycle: https://raw.githubusercontent.com/z-korp/fhevm-cookbook/main/skills/fhevm-acl-lifecycle/SKILL.md - fhevm-control-flow: https://raw.githubusercontent.com/z-korp/fhevm-cookbook/main/skills/fhevm-control-flow/SKILL.md - fhevm-encrypted-inputs: https://raw.githubusercontent.com/z-korp/fhevm-cookbook/main/skills/fhevm-encrypted-inputs/SKILL.md - fhevm-user-decryption: https://raw.githubusercontent.com/z-korp/fhevm-cookbook/main/skills/fhevm-user-decryption/SKILL.md - fhevm-public-decryption: https://raw.githubusercontent.com/z-korp/fhevm-cookbook/main/skills/fhevm-public-decryption/SKILL.md - fhevm-security-audit: https://raw.githubusercontent.com/z-korp/fhevm-cookbook/main/skills/fhevm-security-audit/SKILL.md - oz-erc7984-compliance-patterns: https://raw.githubusercontent.com/z-korp/fhevm-cookbook/main/skills/oz-erc7984-compliance-patterns/SKILL.md - fhevm-arithmetic-ops: https://raw.githubusercontent.com/z-korp/fhevm-cookbook/main/skills/fhevm-arithmetic-ops/SKILL.md - fhevm-testing: https://raw.githubusercontent.com/z-korp/fhevm-cookbook/main/skills/fhevm-testing/SKILL.md - fhevm-token-registry: https://raw.githubusercontent.com/z-korp/fhevm-cookbook/main/skills/fhevm-token-registry/SKILL.md - fhevm-frontend-integration: https://raw.githubusercontent.com/z-korp/fhevm-cookbook/main/skills/fhevm-frontend-integration/SKILL.md - fhevm-cross-contract: https://raw.githubusercontent.com/z-korp/fhevm-cookbook/main/skills/fhevm-cross-contract/SKILL.md - oz-erc7984-confidential-governance: https://raw.githubusercontent.com/z-korp/fhevm-cookbook/main/skills/oz-erc7984-confidential-governance/SKILL.md - oz-erc7984-custodian-omnibus: https://raw.githubusercontent.com/z-korp/fhevm-cookbook/main/skills/oz-erc7984-custodian-omnibus/SKILL.md - oz-utils-safemath: https://raw.githubusercontent.com/z-korp/fhevm-cookbook/main/skills/oz-utils-safemath/SKILL.md What the skills cover: - fhevm-router: Classifies the task as contract, frontend, wallet, or review oriented - fhevm-router: Points to the narrowest official Zama docs page to keep open while working - fhevm-router: Calls out trust boundaries, ACL concerns, and decryption boundaries early - fhevm-router: Keeps the repo honest about current scope instead of routing to missing modules - oz-erc7984-confidential-tokens: Frames ERC7984 around token, caller, decryption, and proof-verification boundaries - oz-erc7984-confidential-tokens: Calls out operator semantics instead of drifting back to ERC20 allowance mental models - oz-erc7984-confidential-tokens: Keeps unwrap flows honest as async decrypt-and-verify, not single-step plaintext settlement - oz-erc7984-confidential-tokens: Maps custom designs back to the smallest OpenZeppelin confidential token module set - fhevm-privacy-constraints: Separates what is public, hidden, user-readable, or only available after async decrypt - fhevm-privacy-constraints: Explains why balance-based rewards and threshold checks break under confidential transfers - fhevm-privacy-constraints: Forces ACL access plans to be explicit before proposing on-chain reads or enforcement - fhevm-privacy-constraints: Reframes blocked mechanisms toward wrap activity, lockups, utility, or user-initiated proofs - fhevm-acl-lifecycle: Explains why FHE operations return NEW handles that need fresh ACL grants - fhevm-acl-lifecycle: Distinguishes allow, allowThis, and allowTransient for different trust scenarios - fhevm-acl-lifecycle: Traces permission chains across multi-step encrypted computations - fhevm-acl-lifecycle: Catches the #1 FHEVM bug: assuming permissions transfer to derived values - fhevm-control-flow: Explains why require(ebool) does not exist and what replaces it - fhevm-control-flow: Shows FHE.select as the only way to branch on encrypted conditions - fhevm-control-flow: Covers silent fallback to zero and its impact on user experience - fhevm-control-flow: Guides product design for non-reverting failure modes - fhevm-encrypted-inputs: Explains the FHE.fromExternal(ciphertext, inputProof) ingestion pattern - fhevm-encrypted-inputs: Shows how input proofs bind ciphertext to msg.sender and contract address - fhevm-encrypted-inputs: Covers client-side encryption with the Zama SDK - fhevm-encrypted-inputs: Prevents replay and cross-contract ciphertext injection attacks - fhevm-user-decryption: Explains the off-chain reencryption flow: sign, decrypt, display - fhevm-user-decryption: Shows ACL pre-grant as a prerequisite for user decryption - fhevm-user-decryption: Covers EIP-712 typed signatures for reencryption authorization - fhevm-user-decryption: Guides React and Next.js integration with the relayer SDK - fhevm-public-decryption: Explains the two-step pattern: compute encrypted result, then finalize with proof - fhevm-public-decryption: Shows FHE.makePubliclyDecryptable and relayer publicDecrypt flow - fhevm-public-decryption: Covers on-chain proof verification with FHE.checkSignatures - fhevm-public-decryption: Prevents the single-step unwrap bug where user-claimed plaintext bypasses FHE checks - fhevm-security-audit: Provides a systematic audit checklist for FHEVM contracts - fhevm-security-audit: Traces ACL permission flows across multi-step operations - fhevm-security-audit: Catalogs known footguns: missing ACL, silent zero, wrong unwrap, handle reuse - fhevm-security-audit: Covers arithmetic constraint verification and overflow behavior - oz-erc7984-compliance-patterns: Maps OpenZeppelin compliance modules: ObserverAccess, Freezable, Restricted, Rwa - oz-erc7984-compliance-patterns: Explains selective transparency for auditors without breaking user privacy - oz-erc7984-compliance-patterns: Covers force-transfer, pause, and encrypted freeze amount mechanics - oz-erc7984-compliance-patterns: Guides institutional adoption: how to satisfy regulators while preserving confidentiality - fhevm-arithmetic-ops: Lists supported vs unsupported FHE operations with type constraints - fhevm-arithmetic-ops: Explains why ciphertext-scalar is far cheaper than ciphertext-ciphertext - fhevm-arithmetic-ops: Shows division requires a plaintext divisor (no encrypted denominators) - fhevm-arithmetic-ops: Covers euint64 overflow behavior and safe arithmetic patterns - fhevm-testing: Shows @fhevm/hardhat-plugin and @fhevm/mock-utils setup for local testing - fhevm-testing: Explains mocked mode vs real protocol: what each catches and misses - fhevm-testing: Covers debug decrypt for inspecting encrypted values during development - fhevm-testing: Guides end-to-end validation on testnet before mainnet deployment - fhevm-token-registry: Looks up official plain-token and confidential-token addresses by network - fhevm-token-registry: Keeps `c*` token decimals and start blocks aligned with the right deployment - fhevm-token-registry: Uses the wrappers registry as the canonical validation layer for official confidential tokens - fhevm-token-registry: Prevents wrong-network or wrong-token wiring in apps, indexers, scripts, and test fixtures - fhevm-frontend-integration: Shows @zama-fhe/react-sdk and @zama-fhe/sdk setup in React and Next.js - fhevm-frontend-integration: Explains SSR boundaries: SDK must run client-side only - fhevm-frontend-integration: Covers relayer SDK integration for reencryption and decryption - fhevm-frontend-integration: Guides WalletConnect vs Privy auth patterns for different user bases - fhevm-cross-contract: Explains how to pass encrypted handles across contract boundaries - fhevm-cross-contract: Shows multi-contract ACL grant chains: allowTransient for immediate forwarding - fhevm-cross-contract: Covers factory and proxy patterns that preserve encrypted state - fhevm-cross-contract: Guides composable DeFi flows where encrypted values traverse multiple protocols - oz-erc7984-confidential-governance: Explains ERC7984Votes: delegation is public but voting power stays encrypted - oz-erc7984-confidential-governance: Shows private ballot casting without revealing token holdings - oz-erc7984-confidential-governance: Covers tally and reveal patterns for confidential vote counting - oz-erc7984-confidential-governance: Guides integration with existing DAO governance frameworks - oz-erc7984-custodian-omnibus: Explains ERC7984Omnibus for managing sub-accounts under one on-chain address - oz-erc7984-custodian-omnibus: Shows exchange deposit and withdrawal flows with encrypted amounts - oz-erc7984-custodian-omnibus: Covers per-user accounting within omnibus wallets - oz-erc7984-custodian-omnibus: Guides reconciliation and audit patterns under encrypted custodian state - oz-utils-safemath: Wraps raw FHE.add/sub with encrypted success flags so overflow does not corrupt balances - oz-utils-safemath: Distinguishes tryIncrease/tryDecrease (fall back to old value) from tryAdd/trySub (fall back to zero) - oz-utils-safemath: Explains uninitialized-handle semantics so mappings with unset slots stay correct - oz-utils-safemath: Calls out the ACL plumbing the library does NOT do for you Machine-readable artifacts: - /llms.txt - /data/site-data.json - /data/skills.json References: - fhevm-router / Solidity guides: https://docs.zama.org/protocol/solidity-guides - fhevm-router / User decryption: https://docs.zama.org/protocol/relayer-sdk-guides/fhevm-relayer/decryption/user-decryption - fhevm-router / Public decryption: https://docs.zama.org/protocol/relayer-sdk-guides/fhevm-relayer/decryption/public-decryption - fhevm-router / Web app guide: https://docs.zama.org/protocol/relayer-sdk-guides/development-guide/webapp - fhevm-router / ERC7984 integration: https://docs.zama.org/protocol/examples/openzeppelin-confidential-contracts/integration-guide - oz-erc7984-confidential-tokens / ERC7984 integration: https://docs.zama.org/protocol/examples/openzeppelin-confidential-contracts/integration-guide - oz-erc7984-confidential-tokens / Examples: https://docs.zama.org/protocol/examples - oz-erc7984-confidential-tokens / Solidity guides: https://docs.zama.org/protocol/solidity-guides - fhevm-privacy-constraints / Examples: https://docs.zama.org/protocol/examples - fhevm-privacy-constraints / Solidity guides: https://docs.zama.org/protocol/solidity-guides - fhevm-privacy-constraints / ERC7984 integration: https://docs.zama.org/protocol/examples/openzeppelin-confidential-contracts/integration-guide - fhevm-acl-lifecycle / ACL semantics: https://docs.zama.org/protocol/solidity-guides/smart-contract/acl - fhevm-acl-lifecycle / Solidity guides: https://docs.zama.org/protocol/solidity-guides - fhevm-control-flow / Solidity guides: https://docs.zama.org/protocol/solidity-guides - fhevm-control-flow / Operations: https://docs.zama.org/protocol/solidity-guides/smart-contract/operations - fhevm-encrypted-inputs / Input handling: https://docs.zama.org/protocol/solidity-guides/smart-contract/inputs - fhevm-encrypted-inputs / Solidity guides: https://docs.zama.org/protocol/solidity-guides - fhevm-user-decryption / User decryption: https://docs.zama.org/protocol/relayer-sdk-guides/fhevm-relayer/decryption/user-decryption - fhevm-user-decryption / Relayer guides: https://docs.zama.org/protocol/relayer-sdk-guides - fhevm-public-decryption / Public decryption: https://docs.zama.org/protocol/relayer-sdk-guides/fhevm-relayer/decryption/public-decryption - fhevm-public-decryption / Relayer guides: https://docs.zama.org/protocol/relayer-sdk-guides - fhevm-security-audit / Solidity guides: https://docs.zama.org/protocol/solidity-guides - fhevm-security-audit / Examples: https://docs.zama.org/protocol/examples - oz-erc7984-compliance-patterns / ERC7984 integration: https://docs.zama.org/protocol/examples/openzeppelin-confidential-contracts/integration-guide - oz-erc7984-compliance-patterns / Examples: https://docs.zama.org/protocol/examples - fhevm-arithmetic-ops / Operations: https://docs.zama.org/protocol/solidity-guides/smart-contract/operations - fhevm-arithmetic-ops / Solidity guides: https://docs.zama.org/protocol/solidity-guides - fhevm-testing / Testing: https://docs.zama.org/protocol/solidity-guides/getting-started/write-contract/testing - fhevm-testing / Examples: https://docs.zama.org/protocol/examples - fhevm-token-registry / Wrapper registry: https://docs.zama.org/protocol/protocol-apps/confidential-tokens/wrapper-registry - fhevm-token-registry / ERC7984 integration: https://docs.zama.org/protocol/examples/openzeppelin-confidential-contracts/integration-guide - fhevm-frontend-integration / Web app guide: https://docs.zama.org/protocol/relayer-sdk-guides/development-guide/webapp - fhevm-frontend-integration / Relayer guides: https://docs.zama.org/protocol/relayer-sdk-guides - fhevm-cross-contract / ACL semantics: https://docs.zama.org/protocol/solidity-guides/smart-contract/acl - fhevm-cross-contract / Solidity guides: https://docs.zama.org/protocol/solidity-guides - oz-erc7984-confidential-governance / ERC7984 integration: https://docs.zama.org/protocol/examples/openzeppelin-confidential-contracts/integration-guide - oz-erc7984-confidential-governance / Examples: https://docs.zama.org/protocol/examples - oz-erc7984-custodian-omnibus / ERC7984 integration: https://docs.zama.org/protocol/examples/openzeppelin-confidential-contracts/integration-guide - oz-erc7984-custodian-omnibus / Examples: https://docs.zama.org/protocol/examples - oz-utils-safemath / Operations: https://docs.zama.org/protocol/solidity-guides/smart-contract/operations - oz-utils-safemath / Solidity guides: https://docs.zama.org/protocol/solidity-guides