Factory
This documentation provides an overview of the IFactory.sol. This contract defines the functions and events for creating and managing pools on Maverick AMM.
Table of Contents
Contract Details
- Name : IFactory 
- Solidity Version : ^0.8.0 
- SPDX License-Identifier : GPL-2.0-or-later 
- Factoryis Deployed to- ZKSync Era: - 0x2C1a605f843A2E18b7d7772f0Ce23c236acCF7f5
 
- Code: Github 
Events
PoolCreated
Event emitted when a new pool is created.
event PoolCreated(
    address poolAddress,
    uint256 fee,
    uint256 tickSpacing,
    int32 activeTick,
    int256 lookback,
    uint64 protocolFeeRatio,
    IERC20 tokenA,
    IERC20 tokenB
);- Parameters : - poolAddress: The- addressof the created pool
- fee: The rate in- prbmath 60x18decimal format
- tickSpacing: The bin width represented as- 1.0001^tickSpacing
- activeTick: The initial active tick of the pool
- lookback: The time-weighted average price (TWAP) lookback in whole seconds
- protocolFeeRatio: The ratio of the swap fee that is kept for the protocol
- tokenA: The- ERC20token A used in the pool
- tokenB: The- ERC20token B used in the pool
 
SetFactoryProtocolFeeRatio
Event emitted when the protocol fee ratio is updated.
event SetFactoryProtocolFeeRatio(uint64 protocolFeeRatio);- Parameters : - protocolFeeRatio: The new protocol fee ratio
 
SetFactoryOwner
Event emitted when the owner of the factory is updated.
event SetFactoryOwner(address owner);- Parameters : - owner: The new owner- address
 
Functions
create()
Creates a new pool.
function create(
    uint256 _fee,
    uint256 _tickSpacing,
    int256 _lookback,
    int32 _activeTick,
    IERC20 _tokenA,
    IERC20 _tokenB
) external returns (IPool);- Parameters : - _fee: The rate in- prbmath 60x18decimal format
- _tickSpacing: The bin width represented as- 1.0001^tickSpacing
- _lookback: The time-weighted average price (TWAP) lookback in whole seconds
- _activeTick: The initial active tick of the pool
- _tokenA: The ERC20 token A to be used in the pool
- _tokenB: The ERC20 token B to be used in the pool
 
- Returns : - IPool: An instance of the- IPoolinterface representing the created pool
 
lookup()
Looks up an existing pool based on the specified parameters.
function lookup(
    uint256 fee,
    uint256 tickSpacing,
    int256 lookback,
    IERC20 tokenA,
    IERC20 tokenB
) external view returns (IPool);- Parameters : - fee: The rate in- prbmath 60x18decimal format
- tickSpacing: The bin width represented as- 1.0001^tickSpacing
- lookback: The time-weighted average price (TWAP) lookback in whole- seconds
- tokenA: The- ERC20token A used in the pool
- tokenB: The- ERC20token B used in the pool
 
- Returns : - IPool: An instance of the- IPoolinterface representing the found pool, or a- zeroaddress if no pool matches the parameters
 
owner()
Retrieves the address of the factory owner.
function owner() external view returns (address);- Returns : - address: The- addressof the factory owner
 
position()
Retrieves the IPosition interface associated with the factory.
function position() external view returns (IPosition);- Returns : - IPosition: An instance of the- IPositioninterface associated with the factory
 
protocolFeeRatio()
Retrieves the current protocol fee ratio.
function protocolFeeRatio() external view returns (uint64);- Returns : - The current protocol fee ratio in - uint64.
 
isFactoryPool(IPool pool)
Checks if a pool is owned by the factory.
function isFactoryPool(IPool pool) external view returns (bool);- Parameters : - pool: An instance of the- IPoolinterface representing the pool to check.
 
- Returns : - A - booleanindicating whether the pool is owned by the factory.
 
Last updated
