How habuskid/veil-protocol works
Purpose and Entry Points
Veil Protocol is a React/Vite dApp for discovering and operating Sepolia ERC-20 ↔ confidential ERC-7984 wrapper pairs in the Zama FHEVM ecosystem. The browser application starts at src/main.jsx, renders the shell in src/App.jsx, and is deployed as a static Vercel site via vercel.json.
Application Shell and Wallet Boundary
src/App.jsx coordinates the tab-oriented UI and shared connected-wallet state. src/components/ConnectWallet.jsx is the EIP-1193 wallet boundary: it obtains the user account/provider and enables transaction-capable Ethers v6 contract interactions. The application targets Sepolia; chain addresses are centralized in src/config/addresses.js.
Registry Discovery and Resilient Pair Catalog
src/components/RegistryTab.jsx presents available wrapper pairs. It reads the official on-chain Wrappers Registry as the primary source, but merges/falls back to the locally bundled catalog in src/config/pairs.json when RPC metadata calls fail or are rate-limited. This separates pair availability from optional ERC-20 display metadata, preserving actionable addresses under degraded RPC conditions.
Wrap / Unwrap Transaction Flow
src/components/RegistryTab.jsx drives public-to-confidential wrapping and confidential-to-public unwrapping for a selected pair. The flow crosses a signing boundary through the connected wallet: ERC-20 approval is submitted before wrapper conversion, then the corresponding wrapper contract transaction is submitted and awaited. Contract addresses and ABI assumptions are supplied through src/config/addresses.js and the repository ABI artifact abi.json.
Confidential Balance Decryption
src/components/DecryptTab.jsx lets a wallet holder provide an ERC-7984 address and request a readable confidential balance. Zama integration is isolated in src/lib/zama.js, which interfaces with fhevmjs/the FHEVM relayer flow. The user signs the required KMS EIP-712 authorization; decryption occurs through Zama FHEVM infrastructure rather than by exposing plaintext balances in contract state.
Faucet and Test-Asset Acquisition
src/components/FaucetTab.jsx exposes minting/claiming of supported test ERC-20 assets, allowing users to acquire tokens before testing wrap and unwrap. It consumes the same configured pair set in src/config/pairs.json, keeping faucet eligibility aligned with registry-rendered assets.
History and External Runtime Dependencies
src/components/HistoryTab.jsx provides the UI surface for transaction/activity history. Core runtime dependencies are React/Vite in package.json, Ethers.js v6 for wallet/RPC/contracts, and Zama fhevmjs for confidential-token operations. External boundaries are the Sepolia RPC/provider and deployed contracts, the user’s browser wallet, and Zama’s FHEVM/KMS relayer services.
Contract Development Surface
A separate Hardhat project under contracts-project/ contains deployable contract infrastructure and deployment automation. contracts-project/scripts/deploy.js is its deployment entry point, with network/compiler configuration in contracts-project/hardhat.config.js; the frontend consumes already deployed Sepolia addresses rather than hosting contract execution itself.
Main entry points: App.jsx App shell · RegistryTab.jsx Registry & conversion · ConnectWallet.jsx Connect wallet · FaucetTab.jsx Faucet
Components 16
Browser dApp
React/Vite application running as a static site.
- Vite entry
src/main.jsx - App shell · Owns tabs and connected-wallet state.
src/App.jsx - Connect wallet · Provides account, provider, and transaction signing.
src/components/ConnectWallet.jsx - Registry & conversion · Discovers pairs and drives wrap or unwrap transactions.
src/components/RegistryTab.jsx - Decrypt balance
src/components/DecryptTab.jsx - Faucet
src/components/FaucetTab.jsx - History
src/components/HistoryTab.jsx - Zama client · Handles relayer flow and KMS authorization.
src/lib/zama.js
Catalog & Contracts
Shared deployed-address and pair metadata.
- Sepolia addresses
src/config/addresses.js - Bundled pair catalog · Preserves actionable pair addresses during RPC degradation.
src/config/pairs.json - Contract ABI
abi.json
External Boundaries
Wallet, Sepolia, and Zama services.
- Browser wallet
- Sepolia RPC & contracts · Registry, ERC-20, and ERC-7984 wrapper contracts.
- Zama FHEVM & KMS · Processes EIP-712 authorization and confidential decryption.
Contract Development
Separate Hardhat deployment project.
- Deployment script
contracts-project/scripts/deploy.js - Hardhat config
contracts-project/hardhat.config.js
Connections 21
- Vite entry → App shell: renders
- App shell → Connect wallet: shares wallet state
- App shell → Registry & conversion: selects tab
- App shell → Decrypt balance: selects tab
- App shell → Faucet: selects tab
- App shell → History: selects tab
- Connect wallet → Browser wallet: EIP-1193 account & signatures
- Registry & conversion → Sepolia RPC & contracts: reads registry; approves and converts
- Registry & conversion → Bundled pair catalog: merges / falls back
- Registry & conversion → Sepolia addresses: uses deployed addresses
- Registry & conversion → Contract ABI: uses contract interface
- Registry & conversion → Connect wallet: submits transactions
- Decrypt balance → Zama client: requests balance decryption
- Decrypt balance → Connect wallet: requests KMS authorization signature
- Zama client → Zama FHEVM & KMS: relayer and KMS flow
- Faucet → Bundled pair catalog: lists supported assets
- Faucet → Connect wallet: submits mint or claim
- Faucet → Sepolia RPC & contracts: calls test asset contracts
- Deployment script → Hardhat config: uses network configuration
- Deployment script → Sepolia RPC & contracts: deploys contract infrastructure
- Sepolia addresses → Sepolia RPC & contracts: references deployed contracts