IMaverickV2Factory

Functions

deployParameters

Called by deployer library to initialize a pool.

function deployParameters()
    external
    view
    returns (
        uint64 feeAIn,
        uint64 feeBIn,
        uint32 lookback,
        int32 activeTick,
        uint64 tokenAScale,
        uint64 tokenBScale,
        IERC20 tokenA,
        IERC20 tokenB,
        uint16 tickSpacing,
        uint8 kinds,
        address accessor
    );

create

Create a new MaverickV2Pool with symmetric swap fees.

function create(
    uint64 fee,
    uint16 tickSpacing,
    uint32 lookback,
    IERC20 tokenA,
    IERC20 tokenB,
    int32 activeTick,
    uint8 kinds
) external returns (IMaverickV2Pool);

Parameters

NameTypeDescription

fee

uint64

Fraction of the pool swap amount that is retained as an LP in D18 scale.

tickSpacing

uint16

Tick spacing of pool where 1.0001^tickSpacing is the bin width.

lookback

uint32

Pool lookback in second in D2 scale.

tokenA

IERC20

Address of tokenA.

tokenB

IERC20

Address of tokenB.

activeTick

int32

Tick position that contains the active bins.

kinds

uint8

1-15 number to represent the active kinds 0b0001 = static; 0b0010 = right; 0b0100 = left; 0b1000 = both. E.g. a pool with all 4 modes will have kinds = b1111 = 15

create

Create a new MaverickV2Pool.

function create(
    uint64 feeAIn,
    uint64 feeBIn,
    uint16 tickSpacing,
    uint32 lookback,
    IERC20 tokenA,
    IERC20 tokenB,
    int32 activeTick,
    uint8 kinds
) external returns (IMaverickV2Pool);

Parameters

NameTypeDescription

feeAIn

uint64

Fraction of the pool swap amount for tokenA-input swaps that is retained as an LP in D18 scale.

feeBIn

uint64

Fraction of the pool swap amount for tokenB-input swaps that is retained as an LP in D18 scale.

tickSpacing

uint16

Tick spacing of pool where 1.0001^tickSpacing is the bin width.

lookback

uint32

Pool lookback in second in D2 scale.

tokenA

IERC20

Address of tokenA.

tokenB

IERC20

Address of tokenB.

activeTick

int32

Tick position that contains the active bins.

kinds

uint8

1-15 number to represent the active kinds 0b0001 = static; 0b0010 = right; 0b0100 = left; 0b1000 = both. e.g. a pool with all 4 modes will have kinds = b1111 = 15

createPermissioned

Create a new MaverickV2PoolPermissioned with symmetric swap fees.

function createPermissioned(
    uint64 fee,
    uint16 tickSpacing,
    uint32 lookback,
    IERC20 tokenA,
    IERC20 tokenB,
    int32 activeTick,
    uint8 kinds,
    address accessor
) external returns (IMaverickV2Pool);

Parameters

NameTypeDescription

fee

uint64

Fraction of the pool swap amount that is retained as an LP in D18 scale.

tickSpacing

uint16

Tick spacing of pool where 1.0001^tickSpacing is the bin width.

lookback

uint32

Pool lookback in second in D2 scale.

tokenA

IERC20

Address of tokenA.

tokenB

IERC20

Address of tokenB.

activeTick

int32

Tick position that contains the active bins.

kinds

uint8

1-15 number to represent the active kinds 0b0001 = static; 0b0010 = right; 0b0100 = left; 0b1000 = both. E.g. a pool with all 4 modes will have kinds = b1111 = 15

accessor

address

Only address that can access the pool's public write functions.

createPermissioned

Create a new MaverickV2PoolPermissioned.

function createPermissioned(
    uint64 feeAIn,
    uint64 feeBIn,
    uint16 tickSpacing,
    uint32 lookback,
    IERC20 tokenA,
    IERC20 tokenB,
    int32 activeTick,
    uint8 kinds,
    address accessor
) external returns (IMaverickV2Pool);

Parameters

NameTypeDescription

feeAIn

uint64

Fraction of the pool swap amount for tokenA-input swaps that is retained as an LP in D18 scale.

feeBIn

uint64

Fraction of the pool swap amount for tokenB-input swaps that is retained as an LP in D18 scale.

tickSpacing

uint16

Tick spacing of pool where 1.0001^tickSpacing is the bin width.

lookback

uint32

Pool lookback in second in D2 scale.

tokenA

IERC20

Address of tokenA.

tokenB

IERC20

Address of tokenB.

activeTick

int32

Tick position that contains the active bins.

kinds

uint8

1-15 number to represent the active kinds 0b0001 = static; 0b0010 = right; 0b0100 = left; 0b1000 = both. E.g. a pool with all 4 modes will have kinds = b1111 = 15

accessor

address

only address that can access the pool's public write functions.

updateProtocolFeeRatioForPool

Update the protocol fee ratio for a pool. Can be called permissionlessly allowing any user to sync the pool protocol fee value with the factory protocol fee value.

function updateProtocolFeeRatioForPool(IMaverickV2Pool pool) external;

Parameters

NameTypeDescription

pool

IMaverickV2Pool

The pool for which to update.

updateProtocolLendingFeeRateForPool

Update the protocol lending fee rate for a pool. Can be called permissionlessly allowing any user to sync the pool protocol lending fee rate value with the factory value.

function updateProtocolLendingFeeRateForPool(IMaverickV2Pool pool) external;

Parameters

NameTypeDescription

pool

IMaverickV2Pool

The pool for which to update.

claimProtocolFeeForPool

Claim protocol fee for a pool and transfer it to the protocolFeeReceiver.

function claimProtocolFeeForPool(IMaverickV2Pool pool, bool isTokenA) external;

Parameters

NameTypeDescription

pool

IMaverickV2Pool

The pool from which to claim the protocol fee.

isTokenA

bool

A boolean indicating whether tokenA (true) or tokenB (false) is being collected.

claimProtocolFeeForPool

Claim protocol fee for a pool and transfer it to the protocolFeeReceiver.

function claimProtocolFeeForPool(IMaverickV2Pool pool) external;

Parameters

NameTypeDescription

pool

IMaverickV2Pool

The pool from which to claim the protocol fee.

isFactoryPool

Bool indicating whether the pool was deployed from this factory.

function isFactoryPool(IMaverickV2Pool pool) external view returns (bool);

protocolFeeReceiver

Address that receives the protocol fee when users call claimProtocolFeeForPool.

function protocolFeeReceiver() external view returns (address);

isFactoryPoolPermissioned

Bool indicating whether the pool was deployed from this factory.

function isFactoryPoolPermissioned(IMaverickV2Pool pool) external view returns (bool);

lookupPermissioned

Lookup a pool for given parameters.

function lookupPermissioned(
    uint256 feeAIn,
    uint256 feeBIn,
    uint256 tickSpacing,
    uint256 lookback,
    IERC20 tokenA,
    IERC20 tokenB,
    uint8 kinds,
    address accessor
) external view returns (IMaverickV2Pool);

lookupPermissioned

Lookup a pool for given parameters.

function lookupPermissioned(IERC20 _tokenA, IERC20 _tokenB, address accessor, uint256 startIndex, uint256 endIndex)
    external
    view
    returns (IMaverickV2Pool[] memory pools);

lookupPermissioned

Lookup a pool for given parameters.

function lookupPermissioned(uint256 startIndex, uint256 endIndex)
    external
    view
    returns (IMaverickV2Pool[] memory pools);

lookup

Lookup a pool for given parameters.

function lookup(
    uint256 feeAIn,
    uint256 feeBIn,
    uint256 tickSpacing,
    uint256 lookback,
    IERC20 tokenA,
    IERC20 tokenB,
    uint8 kinds
) external view returns (IMaverickV2Pool);

lookup

Lookup a pool for given parameters.

function lookup(IERC20 _tokenA, IERC20 _tokenB, uint256 startIndex, uint256 endIndex)
    external
    view
    returns (IMaverickV2Pool[] memory pools);

lookup

Lookup a pool for given parameters.

function lookup(uint256 startIndex, uint256 endIndex) external view returns (IMaverickV2Pool[] memory pools);

owner

Get the current factory owner.

function owner() external view returns (address);

protocolFeeRatioD3

Proportion of protocol fee to collect on each swap. Value is in 3-decimal format with a maximum value of 0.25e3.

function protocolFeeRatioD3() external view returns (uint8);

protocolLendingFeeRateD18

Fee rate charged by the protocol for flashloans. Value is in 18-decimal format with a maximum value of 0.02e18.

function protocolLendingFeeRateD18() external view returns (uint256);

poolAddress

Address of a permissionless pool.

function poolAddress(
    uint256 feeAIn,
    uint256 feeBIn,
    uint256 tickSpacing,
    uint256 lookback,
    IERC20 tokenA,
    IERC20 tokenB,
    uint8 kinds
) external view returns (IMaverickV2Pool pool);

poolAddress

Address of a permissioned pool.

function poolAddress(
    uint256 feeAIn,
    uint256 feeBIn,
    uint256 tickSpacing,
    uint256 lookback,
    IERC20 tokenA,
    IERC20 tokenB,
    uint8 kinds,
    address accessor
) external view returns (IMaverickV2Pool pool);

Events

PoolCreated

event PoolCreated(
    IMaverickV2Pool poolAddress,
    uint8 protocolFeeRatio,
    uint256 feeAIn,
    uint256 feeBIn,
    uint256 tickSpacing,
    uint256 lookback,
    int32 activeTick,
    IERC20 tokenA,
    IERC20 tokenB,
    uint8 kinds,
    address accessor
);

SetFactoryProtocolFeeRatio

event SetFactoryProtocolFeeRatio(uint8 protocolFeeRatioD3);

SetFactoryProtocolLendingFeeRate

event SetFactoryProtocolLendingFeeRate(uint256 lendingFeeRateD18);

SetFactoryProtocolFeeReceiver

event SetFactoryProtocolFeeReceiver(address receiver);

Errors

FactoryInvalidProtocolFeeRatio

error FactoryInvalidProtocolFeeRatio(uint8 protocolFeeRatioD3);

FactoryInvalidLendingFeeRate

error FactoryInvalidLendingFeeRate(uint256 protocolLendingFeeRateD18);

FactoryProtocolFeeOnRenounce

error FactoryProtocolFeeOnRenounce(uint8 protocolFeeRatioD3);

FactorAlreadyInitialized

error FactorAlreadyInitialized();

FactorNotInitialized

error FactorNotInitialized();

FactoryInvalidTokenOrder

error FactoryInvalidTokenOrder(IERC20 _tokenA, IERC20 _tokenB);

FactoryInvalidFee

error FactoryInvalidFee();

FactoryInvalidKinds

error FactoryInvalidKinds(uint8 kinds);

FactoryInvalidTickSpacing

error FactoryInvalidTickSpacing(uint256 tickSpacing);

FactoryInvalidLookback

error FactoryInvalidLookback(uint256 lookback);

FactoryInvalidTokenDecimals

error FactoryInvalidTokenDecimals(uint8 decimalsA, uint8 decimalsB);

FactoryPoolAlreadyExists

error FactoryPoolAlreadyExists(
    uint256 feeAIn,
    uint256 feeBIn,
    uint256 tickSpacing,
    uint256 lookback,
    IERC20 tokenA,
    IERC20 tokenB,
    uint8 kinds,
    address accessor
);

FactoryAccessorMustBeNonZero

error FactoryAccessorMustBeNonZero();

Structs

DeployParameters

struct DeployParameters {
    uint64 feeAIn;
    uint64 feeBIn;
    uint32 lookback;
    int32 activeTick;
    uint64 tokenAScale;
    uint64 tokenBScale;
    IERC20 tokenA;
    IERC20 tokenB;
    uint16 tickSpacing;
    uint8 kinds;
    address accessor;
}

Last updated