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 conservative;
4pub mod conservative_promote;
5pub mod conventions;
6pub mod defensive;
7pub mod donation;
8pub mod event;
9pub mod experimental;
10pub mod forms;
11pub mod identity;
12pub mod optimize;
13pub mod persistence;
14pub mod price;
15pub mod project;
16pub mod state;
17pub mod tax;
18pub mod tranche_guard;
19pub mod void;
20pub mod whatif;
21
22pub use conventions::{Sat, TaxDate, Usd};
23pub use donation::DonationDetails;
24pub use event::*;
25pub use forms::{
26    form_8283, form_8949, schedule_d, year_donation_deduction, Form8283HowAcquired, Form8283Row,
27    Form8283Section, Form8949Box, Form8949Part, Form8949Row, ScheduleDPart, ScheduleDTotals,
28    DIGITAL_ASSET_8949_FIRST_YEAR,
29};
30pub use identity::{EventId, Fingerprint, LotId, Source, SourceRef, WalletId};
31pub use optimize::{
32    consult_sale, optimize_year, score_assignment, ApproxReason, ConsultReport, ConsultRequest,
33    DisposalProposal, OptimizeError, OptimizeProposal, Persistability, TimingInsight,
34};
35pub use price::PriceProvider;
36pub use project::{
37    conservation_report, disposal_compliance, evaluate_disposal, in_force_methods, project,
38    pseudo_plan, would_conflict, CandidateDisposal, ComplianceStatus, ConservationReport,
39    DisposalCompliance, EvaluateError, EvaluateOutcome, FeeTreatment, InForceMethod, LotMethod,
40    ProjectionConfig, PseudoDefault, PseudoKind,
41};
42pub use state::*;
43pub use tax::{
44    apply_carryover_writeback, assemble_absolute, carryforward_consistency, compute_se_tax,
45    compute_tax_year, loss_limit, niit_threshold, screen_absolute, se_addl_medicare_threshold,
46    se_net_income, AbsoluteReturn, Carryforward, FilingStatus, LtcgBreakpoints, MarginalRates,
47    OrdinaryBracket, OrdinarySchedule, PrefSplit, SeTaxResult, TaxOutcome, TaxProfile, TaxResult,
48    TaxTable, TaxTables, NIIT_RATE, QUALIFIED_APPRAISAL_THRESHOLD, SE_NET_EARNINGS_FACTOR,
49    SE_RATE_ADDL_MEDICARE, SE_RATE_MEDICARE, SE_RATE_SS,
50};
51pub use void::{is_revocable_payload, voidable_decisions};
52pub use whatif::{
53    CarryforwardDelta, ConsumedLot, HarvestReport, HarvestRequest, HarvestStatus, HarvestTarget,
54    LtcgBracket, SellMethod, SellReport, SellRequest, SellStatus, WhatIfError, HARVEST_TAU_SAT,
55};
56
57#[derive(Debug, thiserror::Error)]
58pub enum CoreError {
59    #[error("sqlite: {0}")]
60    Sqlite(#[from] rusqlite::Error),
61    #[error("event (de)serialization: {0}")]
62    Serde(#[from] serde_json::Error),
63    #[error("persistence: {0}")]
64    Persistence(String),
65}