Antler by Autoflux

Core

Holds shared protocol state, invariant checks, and the global accounting ledger.

Path: core

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.

Core Module

Core is the single source of truth for all user balances, debt positions, and protocol-wide parameters. No module is permitted to store user accounting state independently — all reads and writes flow through Core.

Storage Layout

  • vaults mapping(address => Vault) — per-user collateral and debt record
  • markets mapping(address => Market) — per-asset market configuration
  • totalDebt uint256 — sum of all outstanding borrows across all markets
  • totalCollateral uint256 — sum of all deposited collateral (USD value)
  • globalParams — min collateral ratio, liquidation bonus, protocol fee bps

Invariants

Core enforces these invariants on every write:

  1. Solvency: totalCollateral ≥ totalDebt × minRatio
  2. No negative balances: vault.collateral and vault.debt are always ≥ 0
  3. Authorised callers only: only registered modules (Auth-checked) may call mutating functions

Examples

Read a user's full position

Read a user's full position
typescript
const vault = await core.getVault(userAddress);
const market = await core.getMarket(USDC_ADDRESS);
 
const collateralUsd = vault.collateral * latestPrice / 1e18;
const maxBorrow = collateralUsd * market.collateralFactor / 1e18;
console.log("Max additional borrow:", ethers.formatEther(maxBorrow), "USD");
STATUSexample

Combine vault and market data to compute the user's available borrow capacity.

Edge Cases

  • healthFactor returns type(uint256).max when vault.debt === 0
  • updateCollateral with a negative delta that would underflow reverts with InsufficientCollateral()
  • setMarket cannot reduce collateralFactor for an asset that has outstanding borrows without a governance vote

Interface

Interface
solidity
struct Vault {
uint256 collateral; // scaled 1e18
uint256 debt; // scaled 1e18
uint64 updatedAt; // block timestamp of last write
}
 
struct Market {
address asset;
uint256 collateralFactor; // 0–1e18 (e.g. 0.75e18 = 75%)
uint256 liquidationThreshold;
bool active;
}
 
interface ICore {
function getVault(address user) external view returns (Vault memory);
function getMarket(address asset) external view returns (Market memory);
function updateCollateral(address user, int256 delta) external;
function updateDebt(address user, int256 delta) external;
function healthFactor(address user) external view returns (uint256);
function setMarket(address asset, Market calldata market) external; // OPERATOR_ROLE
}
 
STATUSinterface