Algebra Factory

Algebra factory

Is used to deploy pools and its plugins

Version: Algebra Integral

Inherits: IAlgebraFactory Ownable2Step AccessControlEnumerable

Public variables

POOLS_ADMINISTRATOR_ROLE

bytes32 constant POOLS_ADMINISTRATOR_ROLE = 0xb73ce166ead2f8e9add217713a7989e4edfba9625f71dfd2516204bb67ad3442

Selector: 0xb500a48b

role that can change communityFee and tickspacing in pools

poolDeployer

address immutable poolDeployer

Selector: 0x3119049a

Returns the current poolDeployerAddress

communityVault

address immutable communityVault

Selector: 0x53e97868

Returns the current communityVaultAddress

defaultCommunityFee

uint16 defaultCommunityFee

Selector: 0x2f8a39dd

Returns the default community fee

defaultFee

uint16 defaultFee

Selector: 0x5a6c72d0

Returns the default fee

defaultTickspacing

int24 defaultTickspacing

Selector: 0x29bc3446

Returns the default tickspacing

renounceOwnershipStartTimestamp

uint256 renounceOwnershipStartTimestamp

Selector: 0x084bfff9

defaultPluginFactory

contract IAlgebraPluginFactory defaultPluginFactory

Selector: 0xd0ad2792

Return the current pluginFactory address

poolByPair

mapping(address => mapping(address => address)) poolByPair

Selector: 0xd9a641e1

Returns the pool address for a given pair of tokens, or address 0 if it does not exist

Developer note: tokenA and tokenB may be passed in either token0/token1 or token1/token0 order

POOL_INIT_CODE_HASH

bytes32 constant POOL_INIT_CODE_HASH = 0x177d5fbf994f4d130c008797563306f1a168dc689f81b2fa23b4396931014d91

Selector: 0xdc6fd8ab

returns keccak256 of AlgebraPool init bytecode.

Developer note: keccak256 of AlgebraPool init bytecode. Used to compute pool address deterministically

Functions

constructor

constructor(address _poolDeployer) public
NameTypeDescription

_poolDeployer

address

owner

function owner() public view returns (address)

Selector: 0x8da5cb5b

Returns the current owner of the factory

Developer note: Can be changed by the current owner via transferOwnership(address newOwner)

Returns:

NameTypeDescription

[0]

address

The address of the factory owner

hasRoleOrOwner

function hasRoleOrOwner(bytes32 role, address account) public view returns (bool)

Selector: 0xe8ae2b69

Returns `true` if `account` has been granted `role` or `account` is owner.

NameTypeDescription

role

bytes32

The hash corresponding to the role

account

address

The address for which the role is checked

Returns:

NameTypeDescription

[0]

bool

bool Whether the address has this role or the owner role or not

defaultConfigurationForPool

function defaultConfigurationForPool() external view returns (uint16 communityFee, int24 tickSpacing, uint16 fee)

Selector: 0x25b355d6

Returns the default communityFee and tickspacing

Returns:

NameTypeDescription

communityFee

uint16

which will be set at the creation of the pool

tickSpacing

int24

which will be set at the creation of the pool

fee

uint16

which will be set at the creation of the pool

computePoolAddress

function computePoolAddress(address token0, address token1) public view returns (address pool)

Selector: 0xd8ed2241

Deterministically computes the pool address given the token0 and token1

Developer note: The method does not check if such a pool has been created

NameTypeDescription

token0

address

first token

token1

address

second token

Returns:

NameTypeDescription

pool

address

The contract address of the Algebra pool

createPool

function createPool(address tokenA, address tokenB) external returns (address pool)

Selector: 0xe3433615

Creates a pool for the given two tokens

Developer note: tokenA and tokenB may be passed in either order: token0/token1 or token1/token0. The call will revert if the pool already exists or the token arguments are invalid.

NameTypeDescription

tokenA

address

One of the two tokens in the desired pool

tokenB

address

The other of the two tokens in the desired pool

Returns:

NameTypeDescription

pool

address

The address of the newly created pool

setDefaultCommunityFee

function setDefaultCommunityFee(uint16 newDefaultCommunityFee) external

Selector: 0x8d5a8711

Developer note: updates default community fee for new pools

NameTypeDescription

newDefaultCommunityFee

uint16

The new community fee, must be <= MAX_COMMUNITY_FEE

setDefaultFee

function setDefaultFee(uint16 newDefaultFee) external

Selector: 0x77326584

Developer note: updates default fee for new pools

NameTypeDescription

newDefaultFee

uint16

The new fee, must be <= MAX_DEFAULT_FEE

setDefaultTickspacing

function setDefaultTickspacing(int24 newDefaultTickspacing) external

Selector: 0xf09489ac

Developer note: updates default tickspacing for new pools

NameTypeDescription

newDefaultTickspacing

int24

The new tickspacing, must be <= MAX_TICK_SPACING and >= MIN_TICK_SPACING

setDefaultPluginFactory

function setDefaultPluginFactory(address newDefaultPluginFactory) external

Selector: 0x2939dd97

Developer note: updates pluginFactory address

NameTypeDescription

newDefaultPluginFactory

address

address of new plugin factory

startRenounceOwnership

function startRenounceOwnership() external

Selector: 0x469388c4

Starts process of renounceOwnership. After that, a certain period of time must pass before the ownership renounce can be completed.

stopRenounceOwnership

function stopRenounceOwnership() external

Selector: 0x238a1d74

Stops process of renounceOwnership and removes timer.

renounceOwnership

function renounceOwnership() public

Selector: 0x715018a6

Developer note: Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner if RENOUNCE_OWNERSHIP_DELAY seconds have passed since the call to the startRenounceOwnership() function.

Events

RenounceOwnershipStart

event RenounceOwnershipStart(uint256 timestamp, uint256 finishTimestamp)

Emitted when a process of ownership renounce is started

NameTypeDescription

timestamp

uint256

The timestamp of event

finishTimestamp

uint256

The timestamp when ownership renounce will be possible to finish

RenounceOwnershipStop

event RenounceOwnershipStop(uint256 timestamp)

Emitted when a process of ownership renounce cancelled

NameTypeDescription

timestamp

uint256

The timestamp of event

RenounceOwnershipFinish

event RenounceOwnershipFinish(uint256 timestamp)

Emitted when a process of ownership renounce finished

NameTypeDescription

timestamp

uint256

The timestamp of ownership renouncement

Pool

event Pool(address token0, address token1, address pool)

Emitted when a pool is created

NameTypeDescription

token0

address

The first token of the pool by address sort order

token1

address

The second token of the pool by address sort order

pool

address

The address of the created pool

DefaultCommunityFee

event DefaultCommunityFee(uint16 newDefaultCommunityFee)

Emitted when the default community fee is changed

NameTypeDescription

newDefaultCommunityFee

uint16

The new default community fee value

DefaultTickspacing

event DefaultTickspacing(int24 newDefaultTickspacing)

Emitted when the default tickspacing is changed

NameTypeDescription

newDefaultTickspacing

int24

The new default tickspacing value

DefaultFee

event DefaultFee(uint16 newDefaultFee)

Emitted when the default fee is changed

NameTypeDescription

newDefaultFee

uint16

The new default fee value

DefaultPluginFactory

event DefaultPluginFactory(address defaultPluginFactoryAddress)

Emitted when the defaultPluginFactory address is changed

NameTypeDescription

defaultPluginFactoryAddress

address

The new defaultPluginFactory address