Supported Standards
Relevant source files
The following files were used as context for generating this wiki page:
Aztec Standards is a comprehensive collection of reusable, standardized contracts designed for the Aztec Network. It provides a robust foundation of token primitives and utilities that support both private and public operations, enabling developers to build privacy-preserving applications using standardized interfaces.
The project implements several key standards including the AIP-20 Aztec Token Standard, the AIP-4626 Tokenized Vault Standard, and privacy-enhanced NFT implementations. These standards allow for seamless transitions between private and public ownership states while maintaining the confidentiality features inherent to the Aztec protocol.
Sources: README.md:1-12, src/token_contract/README.md
AIP-20 Aztec Token Standard
The Token contract implements an ERC-20-like token with Aztec-specific privacy extensions. It supports transfers and interactions across two distinct balance types: private balances (hidden via notes) and public balances (transparent on-chain).
Hybrid Balance Architecture
The system utilizes a dual-state approach for asset management. Private balances are managed through PrivateSet collections of UintNote, while public balances are managed via standard mappings.
The following diagram illustrates the flow of tokens between different privacy states:
Sources: README.md:19-25, src/token_contract/README.md
Key Token Functions
| Function | Type | Description |
|---|---|---|
mint_to_public | Public | Mints tokens to a transparent public balance. |
mint_to_private | Private | Mints tokens directly into a private note set. |
transfer_public_to_public | Public | Standard ERC20-style transparent transfer. |
transfer_private_to_private | Private | Confidential transfer between two private addresses. |
transfer_public_to_private | Private | Converts public funds into private notes (Shielding). |
transfer_private_to_public | Private | Converts private notes into public balance (Unshielding). |
Sources: src/token_contract/README.md
AIP-4626 Tokenized Vault Standard
The Tokenized Vault is an extension of the Token contract that issues yield-bearing shares representing deposits of an underlying AIP-20 compliant asset. It can be initialized using the constructor_with_asset() function.
Vault Operations
The vault supports four primary operations across public and private domains:
- Deposit: User provides assets to receive a specific amount of shares.
- Mint/Issue: User receives a specific amount of shares by providing the necessary assets.
- Withdraw: User provides shares to receive a specific amount of assets.
- Redeem: User provides a specific amount of shares to receive the underlying assets.
Inflation Protection
To prevent inflation attacks (where an attacker manipulates the share price by donating assets to a vault with low supply), the implementation supports initial deposits that create "locked shares" to dilute manipulation attempts.
NFT Standard (ERC-721 Extension)
The NFT contract implements unique asset ownership with the same privacy transitions as the fungible token standard. It maps token IDs to either a public owner address or a private note.
Ownership Management
- Private Ownership: Managed via
PrivateSet<NFTNote>. - Public Ownership: Managed via a mapping of
token_idtoAztecAddress.
Transfer Mechanisms
The NFT standard supports complex transfer paths, including transfers to "commitments." A commitment allows a recipient to pre-authorize a "privacy entrance," enabling a sender to transfer an NFT to a partial note that the recipient can later complete.
Escrow Standard
The Escrow Standard consists of a minimal Escrow Contract for holding private balances and a Logic Library for managing release conditions.
Components
- Escrow Contract: A private-only contract that holds keys allowing it to own and spend AIP-20 and AIP-721 tokens. It only exposes
withdrawandwithdraw_nftmethods. - Logic Contract: A separate contract (e.g., for vesting or clawbacks) that owns the Escrow. It uses the Logic Library to manage key distribution and withdrawal authorization.
Data Flow for Escrow Release
The Logic contract manages the "policy," while the Escrow contract executes the "movement" of private funds.
| Function | Description |
|---|---|
_get_escrow | Computes the escrow address from master secret keys and class ID. |
_share_escrow | Emits a private log containing keys needed by a participant to discover the escrow. |
_withdraw | Instructs the escrow to move tokens to a recipient's private balance. |
Sources: src/escrow_contract/README.md, src/ts/test/escrow.test.ts:327-345
Utility and Infrastructure
Dripper Contract
The Dripper acts as a faucet, allowing users to request tokens for testing. It interacts with the Token Standard to mint assets into requested private or public balances.
Sources: README.md:15-17, src/dripper/Nargo.toml
Authentication Witnesses (AuthWit)
All standards utilize a non-zero nonce for actions requiring authorization. Users can provide AuthWitness structures to allow third-party callers (like a Vault or Logic contract) to execute actions on their behalf.
Sources: src/ts/test/utils.ts:219-245, src/ts/test/token.test.ts:145-170
Conclusion
The Aztec Standards repository provides a unified framework for privacy-preserving assets. By implementing AIP-20, AIP-4626, and NFT standards with both public and private state handlers, the project ensures that developers can build complex financial primitives (like yield-bearing vaults and governed escrows) while leveraging the full privacy capabilities of the Aztec Network.