Expand description
§jiminy-lending
Collateralization, liquidation, interest, utilization.
Every lending protocol does the same math: collateral ratios, health checks, liquidation thresholds, interest rate curves, utilization rates. This crate gives you the building blocks so you write the logic once and get it right. All basis-point denominated, all overflow-checked.
Re-exports§
pub use pinocchio;
Functions§
- check_
healthy - Fail if the position is under-collateralized (ratio < threshold).
- check_
liquidatable - Fail if the position is NOT eligible for liquidation (ratio >= threshold).
- collateralization_
ratio_ bps - Collateralization ratio in basis points.
- liquidation_
seize_ amount - Collateral seized by the liquidator.
- max_
liquidation_ amount - Maximum debt repayable in a single liquidation call.
- simple_
interest - Simple interest:
principal * rate_bps * periods / 10_000. - utilization_
rate_ bps - Utilization rate in basis points:
borrows * 10_000 / (cash + borrows).