Comment on page
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.
- Name : IFactory
- Solidity Version : ^0.8.0
- SPDX License-Identifier : GPL-2.0-or-later
Factory
is Deployed to
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
: Theaddress
of the created poolfee
: The rate inprbmath 60x18
decimal formattickSpacing
: The bin width represented as1.0001^tickSpacing
activeTick
: The initial active tick of the poollookback
: The time-weighted average price (TWAP) lookback in whole secondsprotocolFeeRatio
: The ratio of the swap fee that is kept for the protocoltokenA
: TheERC20
token A used in the pooltokenB
: TheERC20
token B used in the pool
Event emitted when the protocol fee ratio is updated.
event SetFactoryProtocolFeeRatio(uint64 protocolFeeRatio);
- Parameters :
protocolFeeRatio
: The new protocol fee ratio
Event emitted when the owner of the factory is updated.
event SetFactoryOwner(address owner);
- Parameters :
owner
: The new owneraddress
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 inprbmath 60x18
decimal format_tickSpacing
: The bin width represented as1.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 theIPool
interface representing the created pool
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 inprbmath 60x18
decimal formattickSpacing
: The bin width represented as1.0001^tickSpacing
lookback
: The time-weighted average price (TWAP) lookback in wholeseconds
tokenA
: TheERC20
token A used in the pooltokenB
: TheERC20
token B used in the pool
- Returns :
IPool
: An instance of theIPool
interface representing the found pool, or azero
address if no pool matches the parameters
Retrieves the address of the factory owner.
function owner() external view returns (address);
- Returns :
address
: Theaddress
of the factory owner
Retrieves the IPosition interface associated with the factory.
function position() external view returns (IPosition);
- Returns :
IPosition
: An instance of theIPosition
interface associated with the factory
Retrieves the current protocol fee ratio.
function protocolFeeRatio() external view returns (uint64);
- Returns :
- The current protocol fee ratio in
uint64
.
Checks if a pool is owned by the factory.
function isFactoryPool(IPool pool) external view returns (bool);
- Parameters :
pool
: An instance of theIPool
interface representing the pool to check.
- Returns :
- A
boolean
indicating whether the pool is owned by the factory.
Last modified 5mo ago