Skip to main content

IButtonswapFactory

Inherits: IButtonswapFactoryErrors, IButtonswapFactoryEvents

Functions

feeTo

Returns the current address for feeTo. The owner of this address receives the protocol fee as it is collected over time.

function feeTo() external view returns (address _feeTo);

Returns

NameTypeDescription
_feeToaddressThe feeTo address

feeToSetter

Returns the current address for feeToSetter. The owner of this address has the power to update both feeToSetter and feeTo.

function feeToSetter() external view returns (address _feeToSetter);

Returns

NameTypeDescription
_feeToSetteraddressThe feeToSetter address

tokenName

The name of the ERC20 liquidity token.

function tokenName() external view returns (string memory _tokenName);

Returns

NameTypeDescription
_tokenNamestringThe tokenName

tokenSymbol

The symbol of the ERC20 liquidity token.

function tokenSymbol() external view returns (string memory _tokenSymbol);

Returns

NameTypeDescription
_tokenSymbolstringThe tokenSymbol

isCreationRestricted

Returns the current state of restricted creation. If true, then no new pairs, only feeToSetter can create new pairs

function isCreationRestricted() external view returns (bool _isCreationRestricted);

Returns

NameTypeDescription
_isCreationRestrictedboolThe isCreationRestricted state

isCreationRestrictedSetter

Returns the current address for isCreationRestrictedSetter. The owner of this address has the power to update both isCreationRestrictedSetter and isCreationRestricted.

function isCreationRestrictedSetter() external view returns (address _isCreationRestrictedSetter);

Returns

NameTypeDescription
_isCreationRestrictedSetteraddressThe isCreationRestrictedSetter address

getPair

Get the (unique) Pair address created for the given combination of tokenA and tokenB. If the Pair does not exist then zero address is returned.

function getPair(address tokenA, address tokenB) external view returns (address pair);

Parameters

NameTypeDescription
tokenAaddressThe first unsorted token
tokenBaddressThe second unsorted token

Returns

NameTypeDescription
pairaddressThe address of the Pair instance

allPairs

Get the Pair address at the given index, ordered chronologically.

function allPairs(uint256 index) external view returns (address pair);

Parameters

NameTypeDescription
indexuint256The index to query

Returns

NameTypeDescription
pairaddressThe address of the Pair created at the given index

allPairsLength

Get the current total number of Pairs created

function allPairsLength() external view returns (uint256 count);

Returns

NameTypeDescription
countuint256The total number of Pairs created

createPair

Creates a new {ButtonswapPair} instance for the given unsorted tokens tokenA and tokenB.

The tokens are sorted later, but can be provided to this method in either order.

function createPair(address tokenA, address tokenB) external returns (address pair);

Parameters

NameTypeDescription
tokenAaddressThe first unsorted token address
tokenBaddressThe second unsorted token address

Returns

NameTypeDescription
pairaddressThe address of the new {ButtonswapPair} instance

setFeeTo

Updates the address that receives the protocol fee. This can only be called by the feeToSetter address.

function setFeeTo(address _feeTo) external;

Parameters

NameTypeDescription
_feeToaddressThe new address

setFeeToSetter

Updates the address that has the power to set the feeToSetter and feeTo addresses. This can only be called by the feeToSetter address.

function setFeeToSetter(address _feeToSetter) external;

Parameters

NameTypeDescription
_feeToSetteraddressThe new address

setIsCreationRestricted

Updates the state of restricted creation. This can only be called by the feeToSetter address.

function setIsCreationRestricted(bool _isCreationRestricted) external;

Parameters

NameTypeDescription
_isCreationRestrictedboolThe new state

setIsCreationRestrictedSetter

Updates the address that has the power to set the isCreationRestrictedSetter and isCreationRestricted. This can only be called by the isCreationRestrictedSetter address.

function setIsCreationRestrictedSetter(address _isCreationRestrictedSetter) external;

Parameters

NameTypeDescription
_isCreationRestrictedSetteraddressThe new address

isPausedSetter

Returns the current address for isPausedSetter. The owner of this address has the power to update both isPausedSetter and call setIsPaused.

function isPausedSetter() external view returns (address _isPausedSetter);

Returns

NameTypeDescription
_isPausedSetteraddressThe isPausedSetter address

setIsPausedSetter

Updates the address that has the power to set the isPausedSetter and call setIsPaused. This can only be called by the isPausedSetter address.

function setIsPausedSetter(address _isPausedSetter) external;

Parameters

NameTypeDescription
_isPausedSetteraddressThe new address

setIsPaused

Updates the pause state of given Pairs. This can only be called by the feeToSetter address.

function setIsPaused(address[] calldata pairs, bool isPausedNew) external;

Parameters

NameTypeDescription
pairsaddress[]A list of addresses for the pairs that should be updated
isPausedNewboolThe new pause state

paramSetter

Returns the current address for paramSetter. The owner of this address has the power to update paramSetter, default parameters, and current parameters on existing pairs

function paramSetter() external view returns (address _paramSetter);

Returns

NameTypeDescription
_paramSetteraddressThe paramSetter address

setParamSetter

Updates the address that has the power to set the paramSetter and update the default params. This can only be called by the paramSetter address.

function setParamSetter(address _paramSetter) external;

Parameters

NameTypeDescription
_paramSetteraddressThe new address

defaultMovingAverageWindow

Returns the default value of movingAverageWindow used for new pairs.

function defaultMovingAverageWindow() external view returns (uint32 _defaultMovingAverageWindow);

Returns

NameTypeDescription
_defaultMovingAverageWindowuint32The defaultMovingAverageWindow value

defaultMaxVolatilityBps

Returns the default value of maxVolatilityBps used for new pairs.

function defaultMaxVolatilityBps() external view returns (uint16 _defaultMaxVolatilityBps);

Returns

NameTypeDescription
_defaultMaxVolatilityBpsuint16The defaultMaxVolatilityBps value

defaultMinTimelockDuration

Returns the default value of minTimelockDuration used for new pairs.

function defaultMinTimelockDuration() external view returns (uint32 _defaultMinTimelockDuration);

Returns

NameTypeDescription
_defaultMinTimelockDurationuint32The defaultMinTimelockDuration value

defaultMaxTimelockDuration

Returns the default value of maxTimelockDuration used for new pairs.

function defaultMaxTimelockDuration() external view returns (uint32 _defaultMaxTimelockDuration);

Returns

NameTypeDescription
_defaultMaxTimelockDurationuint32The defaultMaxTimelockDuration value

defaultMaxSwappableReservoirLimitBps

Returns the default value of maxSwappableReservoirLimitBps used for new pairs.

function defaultMaxSwappableReservoirLimitBps() external view returns (uint16 _defaultMaxSwappableReservoirLimitBps);

Returns

NameTypeDescription
_defaultMaxSwappableReservoirLimitBpsuint16The defaultMaxSwappableReservoirLimitBps value

defaultSwappableReservoirGrowthWindow

Returns the default value of swappableReservoirGrowthWindow used for new pairs.

function defaultSwappableReservoirGrowthWindow()
external
view
returns (uint32 _defaultSwappableReservoirGrowthWindow);

Returns

NameTypeDescription
_defaultSwappableReservoirGrowthWindowuint32The defaultSwappableReservoirGrowthWindow value

setDefaultParameters

Updates the default parameters used for new pairs. This can only be called by the paramSetter address.

function setDefaultParameters(
uint32 newDefaultMovingAverageWindow,
uint16 newDefaultMaxVolatilityBps,
uint32 newDefaultMinTimelockDuration,
uint32 newDefaultMaxTimelockDuration,
uint16 newDefaultMaxSwappableReservoirLimitBps,
uint32 newDefaultSwappableReservoirGrowthWindow
) external;

Parameters

NameTypeDescription
newDefaultMovingAverageWindowuint32The new defaultMovingAverageWindow
newDefaultMaxVolatilityBpsuint16The new defaultMaxVolatilityBps
newDefaultMinTimelockDurationuint32The new defaultMinTimelockDuration
newDefaultMaxTimelockDurationuint32The new defaultMaxTimelockDuration
newDefaultMaxSwappableReservoirLimitBpsuint16The new defaultMaxSwappableReservoirLimitBps
newDefaultSwappableReservoirGrowthWindowuint32The new defaultSwappableReservoirGrowthWindow

setMovingAverageWindow

Updates the movingAverageWindow value of given Pairs. This can only be called by the paramSetter address.

function setMovingAverageWindow(address[] calldata pairs, uint32 newMovingAverageWindow) external;

Parameters

NameTypeDescription
pairsaddress[]A list of addresses for the pairs that should be updated
newMovingAverageWindowuint32The new movingAverageWindow value

setMaxVolatilityBps

Updates the maxVolatilityBps value of given Pairs. This can only be called by the paramSetter address.

function setMaxVolatilityBps(address[] calldata pairs, uint16 newMaxVolatilityBps) external;

Parameters

NameTypeDescription
pairsaddress[]A list of addresses for the pairs that should be updated
newMaxVolatilityBpsuint16The new maxVolatilityBps value

setMinTimelockDuration

Updates the minTimelockDuration value of given Pairs. This can only be called by the paramSetter address.

function setMinTimelockDuration(address[] calldata pairs, uint32 newMinTimelockDuration) external;

Parameters

NameTypeDescription
pairsaddress[]A list of addresses for the pairs that should be updated
newMinTimelockDurationuint32The new minTimelockDuration value

setMaxTimelockDuration

Updates the maxTimelockDuration value of given Pairs. This can only be called by the paramSetter address.

function setMaxTimelockDuration(address[] calldata pairs, uint32 newMaxTimelockDuration) external;

Parameters

NameTypeDescription
pairsaddress[]A list of addresses for the pairs that should be updated
newMaxTimelockDurationuint32The new maxTimelockDuration value

setMaxSwappableReservoirLimitBps

Updates the maxSwappableReservoirLimitBps value of given Pairs. This can only be called by the paramSetter address.

function setMaxSwappableReservoirLimitBps(address[] calldata pairs, uint16 newMaxSwappableReservoirLimitBps) external;

Parameters

NameTypeDescription
pairsaddress[]A list of addresses for the pairs that should be updated
newMaxSwappableReservoirLimitBpsuint16The new maxSwappableReservoirLimitBps value

setSwappableReservoirGrowthWindow

Updates the swappableReservoirGrowthWindow value of given Pairs. This can only be called by the paramSetter address.

function setSwappableReservoirGrowthWindow(address[] calldata pairs, uint32 newSwappableReservoirGrowthWindow)
external;

Parameters

NameTypeDescription
pairsaddress[]A list of addresses for the pairs that should be updated
newSwappableReservoirGrowthWindowuint32The new swappableReservoirGrowthWindow value

lastCreatedTokensAndParameters

Returns the last token pair created and the parameters used.

function lastCreatedTokensAndParameters()
external
returns (
address token0,
address token1,
uint32 movingAverageWindow,
uint16 maxVolatilityBps,
uint32 minTimelockDuration,
uint32 maxTimelockDuration,
uint16 maxSwappableReservoirLimitBps,
uint32 swappableReservoirGrowthWindow
);

Returns

NameTypeDescription
token0addressThe first token address
token1addressThe second token address
movingAverageWindowuint32The moving average window
maxVolatilityBpsuint16The max volatility bps
minTimelockDurationuint32The minimum time lock duration
maxTimelockDurationuint32The maximum time lock duration
maxSwappableReservoirLimitBpsuint16The max swappable reservoir limit bps
swappableReservoirGrowthWindowuint32The swappable reservoir growth window