Skip to main content

btctax_core/
lib.rs

1//! btctax-core: domain model + pure deterministic event-sourced projection for the bitcoin_tax ledger.
2//! The projection (`project`) is total and never panics (spec §7.1); only `persistence` performs I/O.
3pub mod conventions;
4pub mod donation;
5pub mod event;
6pub mod forms;
7pub mod identity;
8pub mod optimize;
9pub mod persistence;
10pub mod price;
11pub mod project;
12pub mod state;
13pub mod tax;
14pub mod void;
15
16pub use conventions::{Sat, TaxDate, Usd};
17pub use donation::DonationDetails;
18pub use event::*;
19pub use forms::{
20    form_8283, form_8949, schedule_d, year_donation_deduction, Form8283HowAcquired, Form8283Row,
21    Form8283Section, Form8949Box, Form8949Part, Form8949Row, ScheduleDPart, ScheduleDTotals,
22};
23pub use identity::{EventId, Fingerprint, LotId, Source, SourceRef, WalletId};
24pub use optimize::{
25    consult_sale, optimize_year, score_assignment, ApproxReason, ConsultReport, ConsultRequest,
26    DisposalProposal, OptimizeError, OptimizeProposal, Persistability, TimingInsight,
27};
28pub use price::PriceProvider;
29pub use project::{
30    conservation_report, disposal_compliance, evaluate_disposal, project, CandidateDisposal,
31    ComplianceStatus, ConservationReport, DisposalCompliance, EvaluateError, EvaluateOutcome,
32    FeeTreatment, LotMethod, ProjectionConfig,
33};
34pub use state::*;
35pub use tax::{
36    carryforward_consistency, compute_se_tax, compute_tax_year, loss_limit, niit_threshold,
37    se_addl_medicare_threshold, se_net_income, Carryforward, FilingStatus, LtcgBreakpoints,
38    MarginalRates, OrdinaryBracket, OrdinarySchedule, SeTaxResult, TaxOutcome, TaxProfile,
39    TaxResult, TaxTable, TaxTables, NIIT_RATE, QUALIFIED_APPRAISAL_THRESHOLD,
40    SE_NET_EARNINGS_FACTOR, SE_RATE_ADDL_MEDICARE, SE_RATE_MEDICARE, SE_RATE_SS,
41};
42pub use void::{is_revocable_payload, voidable_decisions};
43
44#[derive(Debug, thiserror::Error)]
45pub enum CoreError {
46    #[error("sqlite: {0}")]
47    Sqlite(#[from] rusqlite::Error),
48    #[error("event (de)serialization: {0}")]
49    Serde(#[from] serde_json::Error),
50    #[error("persistence: {0}")]
51    Persistence(String),
52}