Pool Module
The Pool module is the core component of the DAMM protocol, defining trading pairs and handling all operations related to trading, liquidity management, and advanced fee mechanisms.
Overview
Data Structures
Pool Struct
struct Pool<phantom CoinTypeA, phantom CoinTypeB> has key, store {
id: UID,
creator: address,
parameters: PairParameters,
coin_a: Balance<CoinTypeA>,
coin_b: Balance<CoinTypeB>,
liquidity: u128,
whitelisted: VecSet<address>,
collect_fee_mode: u8,
is_quote_y: bool,
fee_growth_global_a: u128,
fee_growth_global_b: u128,
fee_protocol_coin_a: u64,
fee_protocol_coin_b: u64,
tick_manager: TickManager,
rewarder_manager: RewarderManager,
position_manager: PositionManager,
is_pause: bool,
index: u64,
url: String,
}Field
Type
Description
Receipt Structs
CalculatedSwapResult
Core Functions
1. Position Management
Parameter
Description
2. Liquidity Management
3. Trading
Parameter
Description
4. Flash Loans
5. Fee and Reward Collection
6. Fee Configuration
7. Whitelist Management
8. Pool Management
Query Functions
Pool Information
Position Information
Calculate and Update Functions
Events
SwapEvent
AddLiquidityEvent
RemoveLiquidityEvent
OpenPositionEvent
LockPositionEvent
FlashLoanEvent
Error Codes
Code
Constant
Description
Fee Collection Modes
COLLECT_FEE_ON_BOTH (0)
COLLECT_FEE_ON_QUOTE (1)
Usage Examples
Complete Swap Flow
Adding Liquidity
Security Considerations
Last updated