Documentation Index
Fetch the complete documentation index at: https://mintlify.com/circlefin/evm-cctp-contracts/llms.txt
Use this file to discover all available pages before exploring further.
Overview
TokenMinterV2 is responsible for minting and burning tokens on the local domain. It inherits from the V1 TokenMinter contract and adds support for minting to multiple recipients in a single transaction, enabling efficient fee distribution.
Contract Location: src/v2/TokenMinterV2.sol
Key Features
New Features vs V1
- Multi-Recipient Minting: Mint to two recipients in a single transaction (useful for separating fees)
- Efficient Fee Distribution: Mint principal amount to recipient and fee to fee recipient atomically
- Backward Compatible: Inherits all V1 functionality for single-recipient minting
Constructor
Parameters
_tokenController(address): Token controller address
Core Functions
mint (Multi-Recipient)
sourceDomain, burnToken) pair.
Reference: src/v2/TokenMinterV2.sol:54
Parameters
sourceDomain(uint32): Source domain whereburnTokenwas burnedburnToken(bytes32): Burned token address as bytes32recipientOne(address): Address to receiveamountOneof minted tokensrecipientTwo(address): Address to receiveamountTwoof minted tokensamountOne(uint256): Amount of tokens to mint torecipientOneamountTwo(uint256): Amount of tokens to mint torecipientTwo
Returns
mintToken(address): Address of the token that was minted
Requirements
- Contract must not be paused
- Caller must be the local TokenMessenger
- The (
sourceDomain,burnToken) pair must map to a nonzero local token address - Both mint operations must succeed
Behavior
This function performs two sequential mint operations:- Mints
amountOnetorecipientOne - Mints
amountTwotorecipientTwo
Inherited Functions
FromTokenMinter (V1):
mint (Single-Recipient)
amount of local tokens corresponding to the given (sourceDomain, burnToken) pair, to to address.
Reference: src/TokenMinter.sol:85
Parameters
sourceDomain(uint32): Source domain whereburnTokenwas burnedburnToken(bytes32): Burned token address as bytes32to(address): Address to receive minted tokensamount(uint256): Amount of tokens to mint
Returns
mintToken(address): Token that was minted
burn
src/TokenMinter.sol:111
Parameters
burnToken(address): Burnable token addressburnAmount(uint256): Amount of tokens to burn (must be greater than 0 and less than or equal to maximum burn amount per message)
Requirements
- Contract must not be paused
- Caller must be the local TokenMessenger
- Burn amount must be within the burn limit for the token
Token Controller Functions
linkTokenPair
unlinkTokenPair
setMaxBurnAmountPerMessage
getLocalToken
Local TokenMessenger Management
addLocalTokenMessenger
mint() and burn() on this TokenMinter.
Reference: src/TokenMinter.sol:128
removeLocalTokenMessenger
src/TokenMinter.sol:151
setTokenController
src/TokenMinter.sol:168
State Variables
Inherited from TokenMinter
localTokenMessenger(address): Local TokenMessenger with permission to call mint and burntokenController(address): Token controller address (inherited from TokenController)
Inherited from TokenController
burnLimitsPerMessage(mapping): Per-token burn limitsremoteTokensToLocalTokens(mapping): Remote token to local token mappings
Integration Example
Multi-Recipient Mint (V2)
Single-Recipient Mint (V1 Compatibility)
Burn Tokens
Differences from V1
| Feature | V1 | V2 | |---------|----|----|| | Single-recipient mint | ✓ | ✓ (inherited) | | Multi-recipient mint | ✗ | ✓ | | Burn functionality | ✓ | ✓ (inherited) | | Token controller | ✓ | ✓ (inherited) | | Burn limits | ✓ | ✓ (inherited) |Multi-Recipient Use Cases
- Fee Distribution: Mint principal to recipient and fee to protocol in one transaction
- Gas Optimization: Reduce gas costs by combining multiple mints
- Atomic Operations: Ensure both mints succeed or both fail
- Simplified Logic: Remove need for TokenMessenger to call mint twice
Function Signatures
V2 Multi-Recipient Mint
V1 Single-Recipient Mint
Security Considerations
- Burn Limit Controls: Enhanced burn limit enforcement prevents excessive burns per message
- Permission System: Only the registered local TokenMessenger can mint or burn
- Token Pairing: Strict token pairing validation ensures correct cross-chain token mappings
- Atomic Minting: Multi-recipient minting is atomic - both mints succeed or both fail
- Access Control: Token controller, owner, and pauser roles enforce proper authorization