1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
//! Bonding curve pricing module
//!
//! This module provides various bonding curve implementations for token pricing,
//! fee calculation, and liquidity mining rewards.
//!
//! # Bonding Curves
//!
//! The [`bonding_curve`] module contains multiple curve implementations:
//!
//! - [`LinearBondingCurve`] - Simple linear price growth
//! - [`BancorBondingCurve`] - Constant reserve ratio with power approximation
//! - [`SigmoidBondingCurve`] - S-curve for price stabilization
//! - [`ExponentialBondingCurve`] - Exponential growth
//! - [`AdaptiveBondingCurve`] - Phase-based curve switching
//! - [`SquareRootBondingCurve`] - Square root curve for gentler growth
//! - [`LogarithmicBondingCurve`] - Logarithmic curve with diminishing growth
//!
//! All curves implement the [`BondingCurve`] trait which provides:
//! - `buy_price()` - Calculate total cost to buy tokens
//! - `sell_price()` - Calculate total proceeds from selling tokens
//! - `current_price()` - Get current spot price
//! - `market_cap()` - Calculate total market capitalization
//! - `price_impact()` - Estimate price impact of a trade
//!
//! # Fee System
//!
//! The [`fees`] module provides:
//! - Platform fee calculation with reputation discounts
//! - Volume-based fee tiers
//! - Maker/taker fee differentiation
//! - Fee distribution to stakers
//!
//! # Analytics
//!
//! The [`analytics`] module offers:
//! - Market data aggregation (OHLCV, VWAP, TWAP)
//! - Trading statistics and volume tracking
//! - Price change and volatility metrics
//!
//! # Price Oracles
//!
//! The [`oracle`] module provides:
//! - External price data integration (BTC/USD, etc.)
//! - Multi-source price aggregation
//! - Price staleness detection
//! - Spread and deviation analysis
//!
//! # Example
//!
//! ```rust,no_run
//! use kaccy_core::pricing::{LinearBondingCurve, BondingCurve};
//! use rust_decimal_macros::dec;
//!
//! // Create a linear curve with slope 0.001 and initial price 1.0
//! let curve = LinearBondingCurve::new(dec!(0.001), dec!(1.0));
//!
//! // Calculate price to buy 100 tokens when supply is 1000
//! let buy_cost = curve.buy_price(dec!(1000), dec!(100));
//! println!("Cost to buy: {}", buy_cost);
//!
//! // Calculate proceeds from selling 50 tokens
//! let sell_proceeds = curve.sell_price(dec!(1100), dec!(50));
//! println!("Proceeds from sell: {}", sell_proceeds);
//! ```
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use ;
pub use *;
pub use *;
pub use *;
pub use ;
pub use *;