Antler by Autoflux

Vaults

Manages collateral custody, asset accounting, and vault lifecycle.

Path: vaults

Third-party documentation. This is independently authored analysis of the public Aurum Protocol codebase — not the official docs, and not reviewed or endorsed by the Aurum Protocol team.

Vaults Module

Vaults are the collateral custody layer. Each user has at most one vault per market. The Vaults module is responsible for holding ERC-20 assets on behalf of users and enforcing withdrawal rules.

Vault Lifecycle

  1. Open: created automatically on first deposit — no explicit create call needed
  2. Active: has collateral and/or debt
  3. At-risk: health-factor between 1.0 and 1.1 — eligible for warning notifications
  4. Liquidatable: health-factor < 1.0
  5. Closed: zero collateral and zero debt — vault record is wiped from storage (gas refund)

Multi-asset Collateral

A single vault can hold multiple collateral assets simultaneously. The health-factor is computed as the sum of all collateral values (weighted by collateral factor) divided by total debt.

Vault Delegation

Vault owners can delegate specific operations (deposit, withdraw, borrow) to another address using EIP-712 typed signatures. This enables smart-account and multisig integrations without transferring vault ownership.

Examples

Open a vault and deposit multiple assets

Open a vault and deposit multiple assets
typescript
const vaultId = await vaults.openVault();
 
// Deposit USDC
await usdc.approve(vaults.address, usdcAmount);
await vaults.depositCollateral(vaultId, USDC_ADDRESS, usdcAmount);
 
// Deposit WBTC in the same vault
await wbtc.approve(vaults.address, wbtcAmount);
await vaults.depositCollateral(vaultId, WBTC_ADDRESS, wbtcAmount);
 
console.log("Vault", vaultId, "opened with 2 collateral assets");
STATUSexample

A single vault can hold multiple collateral types for cross-asset margin.

Delegate withdraw to a smart account

Delegate withdraw to a smart account
typescript
const sig = await owner.signTypedData(
domain,
{ Delegation: [...fields] },
{ vaultId, delegate: smartAccount, selector: WITHDRAW_SELECTOR, expiry }
);
await vaults.delegateOperation(vaultId, smartAccount, WITHDRAW_SELECTOR, expiry, sig);
STATUSexample

Enable a smart account to withdraw collateral on behalf of the vault owner.

Edge Cases

  • closeVault reverts with ActivePositions() if the vault has any remaining collateral or debt
  • withdrawCollateral enforces the health-factor check after the withdrawal is simulated
  • Delegated operations expire at the given timestamp — replay after expiry reverts with DelegationExpired()
  • Vaults cannot be transferred between owners — a new vault must be opened

Interface

Interface
solidity
interface IVaults {
function openVault() external returns (uint256 vaultId);
function closeVault(uint256 vaultId) external; // reverts if active positions remain
function depositCollateral(uint256 vaultId, address asset, uint256 amount) external;
function withdrawCollateral(uint256 vaultId, address asset, uint256 amount) external;
function delegateOperation(
uint256 vaultId,
address delegate,
bytes4 selector,
uint64 expiry,
bytes calldata sig
) external;
function getVaultAssets(uint256 vaultId)
external view
returns (address[] memory assets, uint256[] memory balances);
 
event VaultOpened(address indexed owner, uint256 vaultId);
event VaultClosed(address indexed owner, uint256 vaultId);
event CollateralDeposited(uint256 indexed vaultId, address asset, uint256 amount);
}
 
STATUSinterface