Overview
HideMe consists of four independently deployable contracts. Each contract has its ownhardhat-deploy script in contracts/deploy/ and its own --tags flag. You can deploy them individually or as a full suite.
All contracts inherit from Zama’s ZamaEthereumConfig (via @fhevm/solidity), which automatically injects the correct ACL, KMS, InputVerifier, and Gateway contract addresses for the target network at construction time — you do not need to pass these as constructor arguments.
The contracts are already deployed on mainnet. You only need to follow this guide if you are forking the project, deploying to Sepolia for testing, or redeploying after contract changes.
Prerequisites
Before deploying, make sure you have:- Installed dependencies:
cd contracts && npm install - Compiled the contracts:
npx hardhat compile - Set your deployer mnemonic and RPC key:
m/44'/60'/0'/0/0) is used as the deployer. Ensure this account holds enough ETH to cover deployment gas on your target network.
Deployment Sequence
Deploy the contracts in the order below. Some contracts depend on addresses from earlier deployments.Deploy HideMeFactory
HideMeFactory is the token registry. It deploys new HideMeToken instances and stores on-chain metadata for the frontend registry. It has no constructor dependencies.contracts/deploy/deployHideMe.ts:NEXT_PUBLIC_FACTORY_ADDRESS_MAINNET in your frontend .env.local.Deploy WrapperFactory
WrapperFactory manages deployment of ConfidentialWrapper instances. Each wrapper converts a standard ERC-20 into a confidential cToken. WrapperFactory must be deployed before the router, because the router takes the factory address as a constructor argument.contracts/deploy/deployWrapperFactory.ts:WrapperFactory address.Deploy ConfidentialPaymentRouterV2
ConfidentialPaymentRouterV2 is the one-click confidential payment router. It takes the WrapperFactory address as a constructor argument so it can look up or deploy wrappers on demand.Before deploying, open contracts/deploy/deployRouterV2.ts and update WRAPPER_FACTORY if you deployed a new WrapperFactory in the previous step:Deploy ConfidentialPayments
ConfidentialPayments handles payment links for native HideMeTokens. Merchants create fixed-amount payment links; payers fulfill them via payLink(), which triggers an on-chain encrypted transfer. This contract has no constructor dependencies.contracts/deploy/deployPayments.ts:Mainnet Contract Addresses
The following contracts are already deployed on Ethereum mainnet and are used by the production frontend.| Contract | Address |
|---|---|
| HideMeFactory | 0x46E16F6E248dfa735D50345b1d2657C8dBC5d60B |
| WrapperFactory | 0xde8d3122329916968BA9c5E034Bbade431687408 |
| PaymentRouterV2 | 0x087D50Bb21a4C7A5E9394E9739809cB3AA6576Fa |
| ConfidentialPayments | 0xA12c43CFCe337f0f8b831551Fbd273A61b0488d5 |
Deploying to Sepolia
All four deploy commands accept--network sepolia in place of --network mainnet. The Hardhat config points Sepolia to https://sepolia.infura.io/v3/${INFURA_API_KEY} and uses chain ID 11155111.
Post-Deployment: Update the Frontend
After deploying new contract instances, update the frontend to point at your new addresses.- Open
frontend/src/lib/constants.tsand update the hardcoded addresses forPAYMENTS_ADDRESS,WRAPPER_FACTORY_ADDRESS, andROUTER_V2_ADDRESSif you redeployed those contracts. - Update
.env.localwith the new factory address:
The
PAYMENTS_ADDRESS, WRAPPER_FACTORY_ADDRESS, and ROUTER_V2_ADDRESS constants in constants.ts are currently hardcoded to the production mainnet addresses. If you deploy your own instances, update these values directly in the source file.Zama fhEVM Configuration
Every HideMe contract inherits from Zama’sZamaEthereumConfig (provided by @fhevm/solidity). This base contract sets the ACL, KMS verifier, InputVerifier, and Gateway contract addresses for the target network automatically at construction time, based on the block.chainid.
You do not pass these addresses manually. The configuration in frontend/src/lib/constants.ts mirrors these values on the client side for the TFHE SDK initialization: