Skip to main content
Here’s the complete implementation of the confidential ERC20 token contract. You can find this code in ConfidentialERC20.sol if you’re using the Hardhat template.

Contract Structure

Imports

  • Inco libraries for encryption - OpenZeppelin for ownership management

State

  • Public token details - Encrypted total supply - Encrypted balances and allowances

Functions

  • Standard ERC20 interface - Encrypted variants for privacy - Internal helpers

Deployment

To deploy the contract using Hardhat Ignition:
  1. Create a deployment module in ignition/modules/ConfidentialToken.ts:
  1. Deploy using the following command:
  1. Run tests to verify the deployment:

The contract will be deployed with: - Name: “Confidential USD” - Symbol: “cUSD” - Decimals: 18 - Owner: The deploying address (msg.sender)
Make sure to save the deployed contract address for future interactions. You’ll need it when integrating with your frontend or other contracts.