Skip to main content

jiminy_finance/
lib.rs

1#![no_std]
2//! # jiminy-finance
3//!
4//! AMM math, slippage guards, price impact, economic bounds.
5//!
6//! This is the DeFi math crate. Integer square root, constant-product swap
7//! formulas, K-invariant verification, LP token minting, and every slippage
8//! check you need so your users don't get sandwich-attacked into oblivion.
9//! All u128 intermediates, all overflow-checked, all `#[inline(always)]`.
10//!
11//! ```rust,ignore
12//! use jiminy_finance::prelude::*;
13//! ```
14
15pub mod amm;
16pub mod prelude;
17pub mod slippage;
18
19// ── Re-exports ───────────────────────────────────────────────────────────────
20
21pub use amm::{
22    isqrt, constant_product_out, constant_product_in, check_k_invariant,
23    price_impact_bps, initial_lp_amount, proportional_lp_amount,
24};
25pub use slippage::{
26    check_max_amount, check_max_input, check_min_amount, check_nonzero,
27    check_price_bounds, check_slippage, check_within_bps,
28};
29pub use pinocchio;