This document describes the compliance and reporting capabilities implemented for the marketplace contract.
The implementation covers:
- Transaction reporting
- Holder reporting
- Volume and taxable volume reporting
- Regulatory report generation and export formats
- Historical and real-time compliance monitoring
- Report scheduling
- Audit trail generation
- Regulatory compliance checks
Primary models in contracts/src/marketplace.rs:
AssetComplianceSnapshotRegulatoryReportReportExportReportScheduleAuditTrailEntryTransferRestrictionConfigTransferApprovalRequest
The contract exposes reporting methods:
get_total_tokenized_value(asset_id, time_range)get_transaction_volume(asset_id, time_range)get_holder_count(asset_id, time_range)get_taxable_volume(asset_id, time_range)run_regulatory_checks()generate_regulatory_report(admin, asset_id, time_range, format)export_report(report_id)schedule_report(admin, asset_id, cadence_seconds, format)run_due_reports(admin)get_historical_compliance(asset_id, time_range)get_real_time_compliance(asset_id)
Report exports support:
ReportFormat::JsonReportFormat::Csv
The contract returns the typed ReportExport enum so clients can serialize to final file formats off-chain.
Compliance-sensitive actions append immutable audit entries:
- asset registration/migration/deprecation
- listing creation/cancellation
- transfer approval request/review
- purchases and restricted transfers
- bulk whitelist operations
Each entry captures actor, action, asset, amount, and timestamp.
- Each purchase snapshots compliance metrics into
ComplianceHistory(asset_id). - Historical queries filter snapshots by time range.
- Real-time queries provide the latest computed snapshot for an asset.
Reports are scheduled per asset with cadence in seconds. The scheduler stores next run timestamp and can be triggered by automation (bot/relayer) using run_due_reports.
- Time-range validation rejects invalid ranges.
- Admin-only operations are authorization-gated.
- Restricted transfer violations increment compliance-failure counters.
- Deprecated assets are blocked from new listings.
Coverage includes:
- report generation and export
- scheduling and due-run execution
- transfer restrictions with approval workflow
- multi-asset isolation analytics
Run:
cd contracts
cargo test