Pool Master
The pool master contract is the registry and entrance of all liquidity pools.
The SyncSwap Pool Master contract is a central component in the SyncSwap ecosystem, designed to manage swap fees, whitelist factories, oversee protocol fees, and maintain a registry of pools. This contract provides a unified interface for querying and managing fees across different pool types and serves as a unique registry for all pools within the SyncSwap network.
Features:
Fee Management:
The Pool Master contract interacts with a Fee Manager to handle swap fees and protocol fees.
It provides functions to query the swap fee and protocol fee for a specific pool.
Factory Whitelisting:
Only whitelisted factories are allowed to create and register pools.
The contract maintains a mapping to track which factories are whitelisted.
Pool Registry:
The contract keeps a registry of all pools, including their configuration and types.
Pools are registered by their factory upon creation and are indexed by a hash of their configuration.
Pool Creation and Registration:
Factories can create new pools and register them with the Pool Master.
During registration, the contract checks for duplication to ensure each pool is unique.
Events:
The contract emits various events to notify about key actions:
SetFactoryWhitelisted
: Emitted when a factory's whitelist status is updated.RegisterPool
: Emitted when a new pool is registered.UpdateForwarderRegistry
: Emitted when the forwarder registry is updated.UpdateFeeManager
: Emitted when the fee manager is updated.
Main Functions:
setForwarderRegistry(address newForwarderRegistry)
: Updates the forwarder registry address.setFeeManager(address newFeeManager)
: Updates the fee manager address.setFactoryWhitelisted(address factory, bool whitelisted)
: Adds or removes a factory from the whitelist.createPool(address factory, bytes calldata data)
: Creates a new pool using a whitelisted factory.registerPool(address pool, uint16 poolType, bytes calldata data, address token0, address token1)
: Registers a newly created pool.
The SyncSwap Pool Master contract is a critical component that ensures the smooth operation and governance of pools within the SyncSwap ecosystem. It centralizes the management of fees, factory whitelisting, and pool registry, providing a robust and secure infrastructure for liquidity pools.
Last updated