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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
//! # Tokenomics Simulator
//!
//!
//! An open-source engine for simulating the tokenomics of a project.
//!
//! It allows users to simulate trades, calculate various metrics, and predict user behaviour over different time intervals.
//!
//! <p align="center">
//! <picture><img src="https://raw.githubusercontent.com/slavik-pastushenko/tokenomics-simulator-rs/refs/heads/main/examples/preview.png" alt="An open-source engine for simulating the tokenomics of a project." style="width:auto;"></picture>
//! </p>
//!
//! ## Examples
//!
//! In addition to the usage example below, there are more examples available in the [`examples`](https://github.com/slavik-pastushenko/tokenomics-simulator-rs/tree/main/examples) directory of the repository.
//!
//! These examples demonstrate various ways to use the `tokenomics-simulator` crate.
//!
//! ## Usage
//!
//! To use the `tokenomics-simulator` crate in your project, add it to your `Cargo.toml`:
//!
//! ```toml
//! [dependencies]
//! tokenomics-simulator = "0.5.7"
//! ```
//!
//! You can also include additional features, such as logging, by specifying them in your `Cargo.toml`:
//!
//! ```toml
//! [dependencies]
//! tokenomics-simulator = { version = "0.5.7", features = ["log", "serde"] }
//! ```
//!
//! Below is an example of how to create and run a simulation using the crate.
//! This example demonstrates how to build simulation options, create a simulation, and run it with a token.
//!
//! ```rust
//! use tokenomics_simulator::{Simulation, SimulationError};
//!
//! fn main() -> Result<(), SimulationError> {
//! // Build a new token
//! let token = Simulation::token_builder()
//! .name("Token".to_string())
//! .symbol("TKN".to_string())
//! .total_supply(1_000_000)
//! .airdrop_percentage(5.0)
//! .burn_rate(1.0)
//! .build()?;
//!
//! // Build the simulation options
//! let options = Simulation::options_builder()
//! .total_users(100)
//! .market_volatility(0.5)
//! .build()?;
//!
//! // Build a new simulation with the token and options
//! let mut simulation = Simulation::builder()
//! .name("Simulation".to_string())
//! .description("Initial simulation".to_string())
//! .token(token)
//! .options(options)
//! .build()?;
//!
//! // Run the simulation
//! simulation.run()?;
//!
//! // Get the simulation interval reports
//! for report in simulation.interval_reports.iter() {
//! println!("Interval report: {:#?}", report);
//! }
//!
//! // Get the final simulation report
//! println!("Final report: {:#?}", simulation.report);
//!
//! Ok(())
//! }
//! ```
//!
//! ## Benchmarks
//!
//! We use the `criterion` crate to benchmark the performance of the `tokenomics-simulator` crate.
//!
//! Benchmarks help us understand the performance characteristics of the simulation engine and identify areas for optimization.
//!
//! ### Running Benchmarks
//!
//! To run the benchmarks, use the following command:
//!
//! ```sh
//! cargo bench
//! ```
//!
//! ### Benchmark Scenarios
//!
//! We have several benchmark scenarios to test different aspects of the simulation engine:
//!
//! - **Small Simulation**: Tests a simulation with 100 users.
//! - **Large Simulation**: Tests a simulation with 500,000 users.
//! - **Extreme Simulation**: Tests a simulation with 1,000,000 users.
//!
//! For more detailed benchmark scenarios, please refer to the [`benches`](https://github.com/slavik-pastushenko/tokenomics-simulator-rs/tree/main/benches) directory in the repository.
//!
//! ## Safety
//!
//! This crate uses `#![forbid(unsafe_code)]` to ensure everything is implemented in 100% safe Rust.
//!
//! ## Contributing
//!
//! 🎈 Thanks for your help improving the project! We are so happy to have you!
//!
//! We have a [contributing guide](https://github.com/slavik-pastushenko/tokenomics-simulator-rs/blob/main/CONTRIBUTING.md) to help you get involved in the project.
use Error;
/// Engine module.
/// Is used to run the simulation with the desired configuration.
/// Engine builder module.
/// Is used to create a new engine with the desired configuration.
/// Engine configuration module.
/// Is used to create a new engine configuration.
/// Report module.
/// Is used to generate reports.
/// Token module.
/// Is used to apply token related operations for the simulation.
/// Token builder module.
/// Is used to create a new token with the desired configuration.
/// User module.
/// Is used to apply user related operations for the simulation.
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
/// Simulation error.
/// A list of possible errors that can occur during the simulation.