← Back to all products

Vault Accounting Engine

$13

Off-chain accounting reconciliation for vault share pricing with anomaly detection.

📁 15 files
TOMLPythonMarkdownYAML

📁 File Structure 15 files

vault-accounting-engine/ ├── LICENSE ├── README.md ├── config/ │ ├── default.yaml │ └── vaults.yaml ├── pyproject.toml ├── security-notes.md ├── src/ │ ├── abi.py │ ├── cli.py │ ├── engine.py │ ├── fee_tracker.py │ ├── reconciler.py │ ├── report_generator.py │ ├── snapshot.py │ └── utils.py └── templates/ └── report.html

📖 Documentation Preview README excerpt

vault-accounting-engine

Off-chain accounting reconciliation engine for ERC-4626 vault share pricing.

Price: $12.99 | Store: vault-forge | Product #9


Overview

vault-accounting-engine is a Python tool that independently verifies vault share pricing by comparing on-chain state against calculated expected values. It detects accounting anomalies — share price deviations, incorrect fee accrual, unexpected TVL changes — before they become exploitable.

Why You Need This

Vault share price bugs are the #1 cause of DeFi exploits. A share price manipulation (inflation attack, rounding error, fee miscalculation) can drain a vault in a single transaction. Off-chain reconciliation catches these issues early.

Features

FeatureDescription
Share price reconciliationCompares on-chain share price vs independently calculated value
Fee accrual validationVerifies management + performance fee shares match expected amounts
Invariant checkingValidates 7 vault invariants (positive supply, fee caps, etc.)
Time-series snapshotsStores periodic vault state for trend analysis
Anomaly detectionConfigurable thresholds with severity classification
Multi-format reportsCSV, JSON, and HTML (dark themed) audit reports
Continuous monitoringLong-running monitor with configurable check interval

Anomaly Severity Levels

SeverityDescriptionExample
LOWInformationalMinor rounding differences
MEDIUMInvestigateTVL changed > 10%, fee deviation > 0.1%
HIGHAction neededShare price decreased, fee exceeds cap
CRITICALEmergencyNegative totalAssets, zero share price with supply

Installation


# Install from source
pip install -e .

# Or install dependencies manually
pip install click web3 pandas rich pyyaml jinja2 python-dotenv

Prerequisites

  • Python 3.10+
  • An RPC endpoint (Alchemy, Infura, or self-hosted)

Quick Start

1. Configure

... continues with setup instructions, usage examples, and more.

📄 Code Sample .py preview

src/abi.py """ vault-accounting-engine — Vault ABI constants Minimal ABI definitions for read-only vault operations used by the accounting engine. Matches the CryptoForge ERC-4626 vault interface. """ VAULT_ABI = [ # ERC-4626 standard view functions {"name": "totalAssets", "type": "function", "stateMutability": "view", "inputs": [], "outputs": [{"type": "uint256"}]}, {"name": "totalSupply", "type": "function", "stateMutability": "view", "inputs": [], "outputs": [{"type": "uint256"}]}, {"name": "asset", "type": "function", "stateMutability": "view", "inputs": [], "outputs": [{"type": "address"}]}, {"name": "decimals", "type": "function", "stateMutability": "view", "inputs": [], "outputs": [{"type": "uint8"}]}, {"name": "name", "type": "function", "stateMutability": "view", "inputs": [], "outputs": [{"type": "string"}]}, {"name": "symbol", "type": "function", "stateMutability": "view", "inputs": [], "outputs": [{"type": "string"}]}, {"name": "balanceOf", "type": "function", "stateMutability": "view", "inputs": [{"name": "account", "type": "address"}], "outputs": [{"type": "uint256"}]}, {"name": "convertToAssets", "type": "function", "stateMutability": "view", "inputs": [{"name": "shares", "type": "uint256"}], "outputs": [{"type": "uint256"}]}, {"name": "convertToShares", "type": "function", "stateMutability": "view", "inputs": [{"name": "assets", "type": "uint256"}], "outputs": [{"type": "uint256"}]}, # CryptoForge vault-specific view functions {"name": "managementFee", "type": "function", "stateMutability": "view", "inputs": [], "outputs": [{"type": "uint16"}]}, {"name": "performanceFee", "type": "function", "stateMutability": "view", "inputs": [], "outputs": [{"type": "uint16"}]}, {"name": "feeRecipient", "type": "function", "stateMutability": "view", "inputs": [], "outputs": [{"type": "address"}]}, {"name": "strategy", "type": "function", "stateMutability": "view", "inputs": [], "outputs": [{"type": "address"}]}, {"name": "highWaterMark", "type": "function", "stateMutability": "view", "inputs": [], "outputs": [{"type": "uint256"}]}, {"name": "paused", "type": "function", "stateMutability": "view", "inputs": [], "outputs": [{"type": "bool"}]}, # Events (for log parsing) { "name": "Deposit", "type": "event", "inputs": [ {"name": "sender", "type": "address", "indexed": True}, {"name": "owner", "type": "address", "indexed": True}, {"name": "assets", "type": "uint256", "indexed": False}, {"name": "shares", "type": "uint256", "indexed": False}, ], }, { "name": "Withdraw", "type": "event", "inputs": [ {"name": "sender", "type": "address", "indexed": True}, {"name": "receiver", "type": "address", "indexed": True}, {"name": "owner", "type": "address", "indexed": True}, {"name": "assets", "type": "uint256", "indexed": False}, {"name": "shares", "type": "uint256", "indexed": False}, ], }, { # ... 10 more lines ...
Buy Now — $13 Back to Products