Introduction to Aztec Standards
Relevant source files
The following files were used as context for generating this wiki page:
Aztec Standards is a comprehensive suite of reusable, standardized smart contracts and libraries designed for the Aztec Network. It provides a robust foundation of token primitives, including fungible tokens (AIP-20), non-fungible tokens (AIP-721), and tokenized vaults (AIP-4626), specifically optimized for Aztec's privacy-preserving architecture.
The project aims to empower developers to build confidential applications by providing "plug-and-play" contracts that handle both private and public operations. These standards facilitate interoperability within the Aztec ecosystem by defining common interfaces and implementation patterns for digital assets and escrow logic. Sources: README.md:1-10
Core Contract Modules
The repository is organized into several distinct modules, each addressing a specific asset class or utility requirement within the network.
Token Contract (AIP-20)
The Token contract implements an ERC-20-like interface with native privacy extensions. It manages dual states: public balances (transparent) and private balances (confidential notes). Developers can utilize this for standard fungible assets. Sources: README.md:21-26
NFT Contract (AIP-721)
The NFT contract provides non-fungible token functionality. Like the fungible token, it supports both private and public ownership, allowing unique assets to be held or transferred without revealing the owner's identity or the specific asset being moved. Sources: README.md:37-41, src/nft_contract/README.md:1-6
Tokenized Vault (AIP-4626)
A specialized configuration of the Token contract that functions as a yield-bearing vault. It issues share tokens in exchange for deposits of an underlying AIP-20 compliant asset. Sources: README.md:28-35
Escrow Standard and Logic Library
This module consists of a minimal private contract for holding assets and a companion library for implementing custom release logic. It allows for complex financial primitives like vesting or clawbacks while maintaining full privacy of the underlying funds. Sources: README.md:43-50, src/escrow_contract/README.md:1-10
| Component | Description | Standards Compliance |
|---|---|---|
| Token | Fungible token with private/public balances | AIP-20 (ERC-20 style) |
| NFT | Unique asset with private/public ownership | AIP-721 (ERC-721 style) |
| Vault | Yield-bearing asset management | AIP-4626 |
| Escrow | Private asset holding with delegated logic | Custom / Extension |
| Dripper | Faucet mechanism for devnet/testing | Utility |
Sources: README.md:14-53
Technical Architecture and Privacy Model
The architecture of Aztec Standards relies on the separation of Public and Private state. Public state is managed on-chain and is visible to all, while Private state is managed through UTXO-like "notes" encrypted for specific owners.
State Transitions
The following diagram illustrates how assets move between different privacy zones within the standard contracts:
The system supports four primary transfer modes: Public-to-Public, Public-to-Private (shielding), Private-to-Public (unshielding), and Private-to-Private (fully confidential). Sources: src/nft_contract/README.md:31-105, src/ts/test/utils.ts:316-330
Address and Commitment Constants
Standardized constants are used across the repository to maintain consistency in event logs and address handling.
| Constant | Value / Description | File Reference |
|---|---|---|
PRIVATE_ADDRESS | 0x1ea7...264n (Sentinel for private side of transfers) | src/ts/test/utils.ts:285-288 |
MAX_U128_VALUE | 2^128 - 1 (Standard cap for token amounts) | src/ts/test/utils.ts:103-104 |
AMOUNT | Default test unit (1000n) | src/ts/test/utils.ts:125 |
Escrow and Logic Logic Separation
The Escrow system uses a unique architecture where the "Escrow Contract" is a minimal shell, and the "Logic Contract" defines the rules for fund release.
This separation ensures that the Escrow contract itself does not need complex storage or initialization. Its owner is defined by an AztecAddress encoded into the contract instance salt. Sources: src/escrow_contract/README.md:12-20, src/ts/test/utils.ts:401-415
Developer Tooling and Integration
The project includes a robust TypeScript testing and benchmarking framework to ensure contract reliability and gas efficiency.
- Codegen: Automated generation of TypeScript wrappers from Noir artifacts using
aztec codegen. - Benchmarking: A dedicated benchmarking suite (using
@defi-wonderland/aztec-benchmark) to measure the performance of private and public functions. - Testing Utilities: Helper functions for balance assertions (
expectTokenBalances), event verification (expectTransferEvents), and log decryption (decryptRawPrivateLog).
Sources: package.json:11-20, src/ts/test/utils.ts:108-123, src/ts/test/utils.ts:333-352
Summary
Aztec Standards provides the essential building blocks for decentralized finance on the Aztec Network. By standardizing interfaces for tokens (AIP-20), NFTs (AIP-721), and Vaults (AIP-4626), and introducing a flexible Escrow-Logic separation, the repository establishes a consistent development pattern that prioritizes both user privacy and developer ease of use.