Precompiles Hooks
Hooks for interacting with Avalanche precompiled contracts.
Precompile Hooks
BuilderKit provides a set of React hooks for interacting with Avalanche's precompiled contracts. These hooks simplify the interaction with L1-level functionality and administrative operations.
Available Hooks
Integration with Transaction Components
All precompile hooks return transaction data that can be used with the TransactionButton or TransactionManager components.
Access Control with useAllowList
Most precompiles in Avalanche use a role-based access control system managed through the useAllowList
hook. This means that before using precompile functions, you need to ensure the calling address has the appropriate role.
The role system has three levels:
- None (0): No permissions
- Enabled (1): Basic permissions for operations
- Admin (2): Full control over the precompile
Here's how roles work across precompiles:
Precompile | Required Role | Operations |
---|---|---|
NativeMinter | Admin | - Set roles for other addresses - Mint native tokens |
Enabled | - Mint native tokens | |
FeeManager | Admin | - Set roles for other addresses - Configure gas fees - Set minimum block cost - Set block gas cost step |
RewardManager | Admin | - Set roles for other addresses - Configure reward address - Enable/disable fee recipients - Set reward address |
WarpMessenger | Admin | - Set roles for other addresses - Send cross-chain messages - Get verified messages |
Enabled | - Send cross-chain messages - Get verified messages | |
TransactionAllowList | Admin | - Set roles for other addresses - Enable/disable addresses for transactions |
Enabled | - Submit transactions (if enabled) | |
DeployerAllowList | Admin | - Set roles for other addresses - Enable/disable addresses for deployments |
Enabled | - Deploy contracts (if enabled) |
Example of checking and setting roles:
Precompile Addresses
Precompile | Address | Description |
---|---|---|
NativeMinter | 0x0200000000000000000000000000000000000001 | Mint native tokens |
TransactionAllowList | 0x0200000000000000000000000000000000000002 | Control transaction permissions |
FeeManager | 0x0200000000000000000000000000000000000003 | Configure chain fees |
RewardManager | 0x0200000000000000000000000000000000000004 | Manage reward distribution |
WarpMessenger | 0x0200000000000000000000000000000000000005 | Cross-chain messaging |
DeployerAllowList | 0x0200000000000000000000000000000000000000 | Control deployment permissions |
Edit on GitHub
Last updated on