fhenix-contracts

Write confidential Solidity contracts using Fhenix CoFHE encrypted types and ACL patterns.

1|Updated Sep 4, 2025
One-click install
npx skills add https://github.com/FuzzysTodd/The-Nexus-Protocol-Token-DAO --skill fhenix-contracts-fuzzystodd
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: fhenix-contracts
Source: https://github.com/FuzzysTodd/The-Nexus-Protocol-Token-DAO/tree/main/skills/fhenix-contracts
Command: npx skills add https://github.com/FuzzysTodd/The-Nexus-Protocol-Token-DAO --skill fhenix-contracts-fuzzystodd

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Writing smart contracts with fully homomorphic encryption on Fhenix CoFHE introduces non-obvious pitfalls: branching on encrypted booleans, missing ACL grants that break state reuse, and choosing the wrong decryption flow. This Skill encodes the hard rules and patterns so confidential contracts work correctly on the first pass. ## Core Features & Use Cases - Hard-rule enforcement: Twelve non-negotiable rules covering branchless updates with FHE.select, mandatory FHE.allowThis after encrypted writes, and irreversible allowPublic grants. - ACL and decryption guidance: Decision tables for the four ACL verbs (allowThis, allowSender, allow, allowPublic) and the two decryption flows (client decrypts with on-chain verification vs client-side reveal only). - Token standards picker: Guidance for choosing between ERC20Confidential, vendored FHERC20, and ERC-7984 for confidential token implementations. - Use Case: A developer building a sealed-bid auction contract uses the Skill to implement branchless bid comparison with FHE.select, grant ACL permissions correctly, and wire the allowPublic plus verifyDecryptResult settlement flow. ## Quick Start Use the fhenix-contracts skill to write a confidential ERC-20 token contract using Fhenix CoFHE with correct ACL grants and branchless transfer logic.

Frequently Asked Questions about fhenix-contracts

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write a confidential smart contract with Fhenix CoFHE?▼

Import @fhenixprotocol/cofhe-contracts/FHE.sol, accept InEuintXX calldata inputs, convert them with FHE.asEuintXX, and perform branchless operations with FHE.select. Call FHE.allowThis after every stored encrypted write so the contract can reuse the value in later transactions.

How do I use FHE.select instead of if statements on encrypted values?▼

FHE.select(cond, a, b) replaces if or require on ebool values because encrypted conditions cannot branch on-chain. Both arms always execute, so for eaddress use FHE.asEaddress(address(0)) as the false-arm sentinel.

What is the difference between FHE.allow, allowThis, allowSender, and allowPublic?▼

allowThis grants the current contract access and is mandatory after stored writes. allowSender lets the caller decrypt off-chain, allow grants a specific address or downstream contract, and allowPublic publishes the value to everyone irreversibly.

ERC20Confidential vs FHERC20 vs ERC-7984 for confidential tokens?▼

Use Fhenix's ERC20Confidential for vanilla confidential ERC-20 behavior, a vendored FHERC20 when you need custom transfer semantics like callbacks or approval flows, and ERC-7984 when you want composability with the emerging Ethereum standard.

Why does my Fhenix contract fail to reuse encrypted state across transactions?▼

The contract lacks an ACL grant on the stored ciphertext. Call FHE.allowThis(x) after every encrypted write that gets stored, otherwise the contract cannot access that handle in the next transaction.

When should I use FHE.allowTransient instead of FHE.allow?▼

Use allowTransient only for grants that should not survive the current transaction, such as passing a ciphertext within a single call chain. Never use it for SDK decrypts, since off-chain decryption requires a persistent allow grant.