moonproof-contracts 0.2.2

Node-side host orchestration for the moonproof contract pipeline — providers, deploy/call/maintenance lifecycle, fee balancing, submission, indexer-driven sync
Documentation
//! Static IR taint and privacy analyzer for compiled Compact contracts.
//!
//! Core analysis lives in [`moonproof_privacy_audit`] so both native
//! toolchains and `wasm32` browser builds run the exact same inter-procedural
//! `MP001`–`MP005` engine. This module re-exports the full public API and adds
//! the filesystem convenience wrapper [`audit_ir_path`].

use std::path::Path;

pub use moonproof_privacy_audit::*;

use crate::error::{ContractRuntimeError, Result};

/// Load `contract.mpir` from `ir_path` and run [`audit_ir`].
///
/// # Errors
///
/// Returns an error if `ir_path` cannot be read or decoded as a [`MoonIr`].
pub fn audit_ir_path(
    contract_name: &str,
    ir_path: &Path,
    opts: &StaticAuditOptions,
) -> Result<ContractAuditReport> {
    let ir =
        moonproof_runtime_ir::from_path(ir_path).map_err(|e| ContractRuntimeError::Provider {
            provider: "static-audit",
            message: format!("loading {}: {e}", ir_path.display()),
        })?;
    Ok(audit_ir(contract_name, &ir, opts))
}