DLMM SDK
This SDK provides tools and utilities to interact with the Bean Spot DEX protocol on Monad, built upon the DLMM (Discrete Liquidity Market Maker) architecture inspired by the Liquidity Book model. It enables developers to simulate swaps, fetch bin-level liquidity data, compute fee structures, and integrate seamlessly with the spot pool logic on-chain.
1. Overview
Protocol: Bean
Architecture: Discrete Liquidity Market Maker (DLMM)
Chain: Monad
Package:
@bean-exchange/spot-sdkLicense: MIT
This SDK is designed for developers building:
Front-end dApps (swap UI, LP dashboards)
Trading bots / aggregators
Analytics / research tools
Automated liquidity strategies
2. Installation
Install the SDK via npm or yarn:
npm install @bean-exchange/spot-sdk
# or
yarn add @bean-exchange/spot-sdk3. Building & Testing
Compile and run tests using standard workflows:
4. Usage Example
5. Core Classes & Interfaces
Pool
PoolRepresents a DLMM pool and provides utilities for:
price computation
swap simulation
fee calculation
liquidity distribution
Constructor:
Key Methods:
getCurrentPrice(): BigNumbersimulateSwap(inputAmount: BigInt, tokenIn: Address): SwapResultgetLiquidityDistribution(): BinData[]calculateFees(): FeeBreakdown
SwapResult
SwapResultBinData
BinDataFeeBreakdown
FeeBreakdown6. Fee Architecture
Total Fee = Base Fee + Variable Fee
Base Fee
Ensures minimum compensation for LPs.
Variable Fee
Adapts to short-term volatility, compensates LPs during turbulent markets.
7. Volatility Management
Volatility Accumulator:
Decay Logic:
< filterTime → ignore update (anti-manipulation)
< decayTime → partial decay
> decayTime → full reset
8. Composition Fee
Applied to deposits that unbalance a bin:
Discourages single-token dumps into active bins.
9. Fee Distribution
Protocol Share: Configurable (max 25%)
LP Share: Remainder of fees
10. MIT License
This SDK is released under the MIT License.
11. Repository
GitHub: BeanExchange/spot-sdk
Maintainer: @bean-exchange
For bug reports, contributions, or feature requests, please open an issue or submit a ticket on GitHub.
Last updated