Minting & Administrative Functions
Relevant source files
The following files were used as context for generating this wiki page:
Minting and administrative functions within the Aztec Standards repository provide the core logic for asset creation, ownership management, and contract governance. These functions are designed to support Aztec's unique dual-state architecture, allowing for operations that affect both public and private balances while maintaining confidentiality where required.
The scope of these functions includes initial contract deployment via constructors, the issuance of new fungible (AIP-20) and non-fungible (AIP-721) tokens, and administrative upgrades. These capabilities are central to the Token Contract, NFT Contract, and the Dripper Contract, which serves as a specialized developer utility for rapid asset acquisition.
Contract Initialization & Roles
Administrative control begins at the deployment phase. Contracts utilize specific initializers to define critical roles such as the minter and the upgrade_authority. The minter is the only address authorized to call minting functions, while the upgrade_authority manages the transition of the contract to new class IDs.
Initialization Parameters
| Parameter | Type | Description |
|---|---|---|
name | str<31> | The human-readable name of the token or NFT collection. |
symbol | str<31> | The short ticker or symbol for the asset. |
decimals | u8 | (Fungible only) The number of decimal places for the token. |
minter | AztecAddress | The account authorized to create new tokens. |
upgrade_authority | AztecAddress | The account authorized to perform contract upgrades. |
Sources: src/nft_contract/README.md:31-41, src/ts/test/token.test.ts:54-61, src/ts/test/utils.ts:168-177
Administrative Flow
The following diagram illustrates the deployment and role assignment process for a standard contract.
Minting Mechanisms
Minting functions are divided based on the target visibility: Public or Private. This allows the authorized minter to choose whether the newly created assets appear on the public ledger or are obscured within the private state.
Public Minting
Public minting increases the total_supply and updates the public balance or ownership mapping. In the Token contract, this is executed via mint_to_public, which emits a public Transfer event from the zero address to the recipient.
Private Minting
Private minting creates new notes within the private state. For fungible tokens, this often involves enqueuing an internal call to increase total supply while creating a private balance note for the recipient. For NFTs, the mint_to_private function removes the need for public ownership records, asserting only that the caller is the authorized minter.
Key Minting Functions
| Function | Contract | Logic |
|---|---|---|
mint_to_public | Token/NFT | Increases supply and sets public owner/balance. |
mint_to_private | Token/NFT | Increases supply and creates private balance/NFT notes. |
drip_to_public | Dripper | Faucet-style public minting for dev testing. |
drip_to_private | Dripper | Faucet-style private minting for dev testing. |
Sources: src/nft_contract/README.md:118-132, src/dripper/README.md:11-28, src/ts/test/token.test.ts:108-112, benchmarks/token_contract.benchmark.ts:74-81
Minting Sequence Diagram
The following sequence demonstrates how a minter interacts with a contract to issue private assets.
Faucet & Developer Utilities
The Dripper contract is a specialized administrative utility designed for development environments. It provides a simplified interface for any user to mint tokens for themselves, bypassing the traditional authorized minter restriction found in standard Token or NFT contracts.
- drip_to_public: Mints tokens directly into the caller's public balance using a
u64amount (converted tou128internally). - drip_to_private: Mints tokens into the caller's private balance.
Sources: src/dripper/README.md:1-28
Contract Upgrades
The administrative lifecycle includes the ability to upgrade contract logic. This is governed by the upgrade_authority defined during construction.
upgrade_contract
The upgrade_contract function allows the authority to point the contract instance to a new contract_class_id. This function asserts that the upgrade_authority is set and that the caller matches this address. The upgrade becomes effective only after a mandatory delay has passed.
Sources: src/nft_contract/README.md:25, 142-148
Summary
Minting and Administrative functions in Aztec Standards ensure that asset creation and governance are both secure and flexible. By utilizing role-based access control (minters and authorities) and supporting both public and private operations, the system allows developers to manage asset lifecycles while leveraging Aztec's privacy features. Utilities like the Dripper contract further enhance the developer experience by providing easy access to test assets.