AxonVaultFactory Reference
Reference for the AxonVaultFactory contract: deployment, versioning, and events.
AxonVaultFactory Reference
AxonVaultFactory deploys new AxonVault instances from a master template. Every vault deployed through the factory shares the same audited bytecode for that version, so one audit covers all vaults on the same version.
Factory Pattern
The factory holds a reference to a master vault template. When an owner calls deployVault, the factory creates a new vault instance with the caller as the owner.
AxonVaultFactory (v4)
|
|-- master template: AxonVault v4 (audited once)
|
|-- deployVault() --> new AxonVault (owned by caller)
|-- deployVault() --> new AxonVault (owned by caller)
|-- deployVault() --> new AxonVault (owned by caller)
When a new contract version is needed, Axon deploys a new factory with a new template. Existing vaults are unaffected. Owners migrate only when they choose to.
Deploy Vault
function deployVault() external returns (address vault)Deploys a new AxonVault with the caller as the owner. The AxonRegistry address is set by the factory itself (configured at factory deployment time), not passed as a parameter. Intent hash tracking is always enabled.
Returns: the address of the newly deployed vault.
Emits: VaultDeployed(msg.sender, vault, version)
The caller becomes the vault owner via Ownable2Step. After deployment, the owner should:
- Set an operator (optional) via
setOperator() - Configure operator ceilings via
setOperatorCeilings() - Register bots via
addBot() - Deposit funds via
deposit()
Events
event VaultDeployed(address indexed owner, address indexed vault, uint16 version);Emitted on every deployment. Indexers, the dashboard, and the relayer watch this event to discover new vaults.
Version Tracking
The factory stores the version of the template it deploys:
uint16 public constant VERSION = 4;This matches the VERSION constant on the vault contract itself. The version is included in the VaultDeployed event so indexers can filter by version.
Deploying from the SDK
Using the TypeScript SDK:
import { deployVault, createAxonPublicClient, createAxonWalletClient, Chain } from '@axonfi/sdk';
const publicClient = createAxonPublicClient(Chain.Base, 'https://mainnet.base.org');
const walletClient = createAxonWalletClient(process.env.OWNER_PRIVATE_KEY, Chain.Base);
const vaultAddress = await deployVault(walletClient, publicClient, '0xFACTORY_ADDRESS');
console.log('Vault deployed at:', vaultAddress);Deploying from the Dashboard
The Axon dashboard provides a guided deployment flow:
- Select chain -- choose which chain to deploy on (Base, Arbitrum, Optimism, Polygon)
- Review -- see the factory address, estimated gas cost, and USDC address for the selected chain
- Deploy -- sign the factory transaction with your connected wallet
- Confirm -- dashboard waits for confirmation and displays the new vault address
After deployment, the dashboard walks you through bot registration and initial configuration.
An owner can deploy multiple vaults: one per chain where their bots operate, or multiple vaults on the same chain for different product lines. All vaults are managed from a single dashboard workspace.