Overview of Joe V2: Liquidity Book components
mainJoe V2 consists of several core smart contracts that manage liquidity, swaps, and routing. Understanding the role of each contract is essential for correct interaction:
- LBPair: Contains the core logic for swaps, liquidity additions/removals, and fee claiming. Warning: Do not deploy this contract directly; always use the LBFactory.
- LBToken: A token standard used to calculate user shares. It is similar to ERC-1155 but lacks callbacks and ERC-721-related functionality for enhanced safety.
- LBFactory: The registry for all pairs and the mechanism for deploying them. It also manages privileged parameters like fee settings, flashloan fees, pair implementations, quoter settings, and presets. Pair creation is restricted to the owner unless
creationUnlockedis set totrue. - LBRouter: The primary entry point for users. It provides additional security checks and should be used instead of interacting with pairs directly.
- LBQuoter: A utility contract used to determine the best route among several options. It should be consulted before performing a swap to ensure optimal returns.