Skip to content

Commit

Permalink
feat: updated docs
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinrodriguez-io committed Sep 5, 2024
1 parent b62021e commit 05c815d
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 83 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

105 changes: 24 additions & 81 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,105 +1,48 @@
# Magic Curves
# 🪄 Magic Curves

![Crates.io](https://img.shields.io/crates/v/magic-curves.svg)
[![Crates.io](https://img.shields.io/crates/v/magic-curves.svg)](https://crates.io/crates/magic-curves)
[![Docs.rs](https://docs.rs/magic-curves/badge.svg)](https://docs.rs/magic-curves)
![License](https://img.shields.io/crates/l/magic-curves.svg)
[![License](https://img.shields.io/crates/l/magic-curves.svg)](LICENSE.md)

**Magic Curves** is your go-to Rust library for working with a bonding curves. Whether you're building decentralized finance applications, tokenomics models, or scientific simulations, Magic Curves has got you covered!

**Magic Curves** is a Rust library that provides a suite of tools for working with various bonding curves. This includes implementations of linear, quadratic, exponential, logarithmic, and sigmoid bonding curves.
## 🌟 Features

## Description
- 📊 Multiple curve types: Linear, Quadratic, Exponential, Logarithmic, and Sigmoid
- 🔢 Support for both floating-point and fixed-point arithmetic
- 🚀 High-performance calculations
- 🧮 Precision-focused implementations
- 🛠️ Easy-to-use API

Magic Curves is designed for applications requiring precise curve calculations, useful in finance, economics, and various scientific fields. The library supports both floating-point and fixed-point arithmetic for high precision in critical applications.
## 🚀 Quick Start

## Installation

Add this to your `Cargo.toml`:
Add Magic Curves to your project:

```toml
[dependencies]
magic-curves = "0.1.0"
magic-curves = "1.0.0"
```

Then, build your project with:
or using `cargo`:

```sh
cargo build
```

## Usage

Here are examples of how to use the different bonding curves provided by the `magic_curves` library:

### Linear Bonding Curve

```rust
use magic_curves::core::linear::LinearBondingCurve;

fn main() {
let linear = 500_000_000u128;
let base = 1_000_000_000u128;
let curve = LinearBondingCurve::new(linear, base);

let price = curve.calculate_price(0);
println!("Price at supply 0: {}", price); // Outputs base price

let price = curve.calculate_price(1);
println!("Price at supply 1: {}", price); // Outputs increased price
}
```

### Exponential Bonding Curve

```rust
use magic_curves::ExponentialBondingCurve;

fn main() {
let curve = ExponentialBondingCurve::new(0.01, 0.02);
let price = curve.calculate_price_lossy(100);
println!("Price at supply 100: {}", price);
}
```

### Logarithmic Bonding Curve

```rust
use magic_curves::LogarithmicBondingCurve;

fn main() {
let curve = LogarithmicBondingCurve::new(0.01, 0.02);
let price = curve.calculate_price_lossy(100);
println!("Price at supply 100: {}", price);
}
$ cargo add magic-curves
```

### Quadratic Bonding Curve
## 📚 Documentation

```rust
use magic_curves::QuadraticBondingCurve;
For detailed information on how to use Magic Curves, please refer to the [official documentation](https://docs.rs/magic-curves).

fn main() {
let curve = QuadraticBondingCurve::new(10_000_000, 500_000_000, 1_000_000_000);
let price = curve.calculate_price(1);
println!("Price at supply 1: {}", price); // Example price calculation
}
```
## 🤝 Contributing

### Sigmoid Bonding Curve
We welcome contributions! Please read our [contributing guidelines](CONTRIBUTING.md) for more details.

```rust
use magic_curves::SigmoidBondingCurve;

fn main() {
let curve = SigmoidBondingCurve::new(100.0, 0.01, 500);
let price = curve.calculate_price_lossy(480);
println!("Price at supply 480: {}", price);
}
```
## 📜 License

## Contributing
This project is licensed under the MIT License. See the [LICENSE](LICENSE.md) file for more details.

Contributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for more details.
If you find Magic Curves useful, please consider giving us a star on GitHub. It helps us know that you appreciate our work and encourages further development!

## License
---

This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details.
Built with ❤️ by Kevin Rodríguez.
2 changes: 1 addition & 1 deletion crates/magic-curves/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "magic-curves"
version = "0.1.0"
version = "1.0.0"
edition = "2021"
authors = ["Kevin Rodriguez <[email protected]>"]
description = "A Rust library to deal with bonding curves."
Expand Down

0 comments on commit 05c815d

Please sign in to comment.