vPairFactory

Creates and keeps track of vPair instances and the vExchangeReserve instance

Events

PairCreated

event PairCreated(
    address poolAddress,
    address factory,
    address token0,
    address token1,
    uint16 fee,
    uint16 vFee,
    uint256 maxReserveRatio
);

Emitted when a new pair is created in the createPair function.

DefaultAllowListChanged

event DefaultAllowListChanged(address[] allowList);

Emitted when the default allow list changes in setDefaultAllowList method.

FactoryNewPendingAdmin

event FactoryNewPendingAdmin(address newPendingAdmin);

Emitted when a new pending admin is set in setPendingAdmin method.

FactoryNewAdmin

Emitted when the factory admin is changed in acceptAdmin function.

FactoryNewPendingEmergencyAdmin

Emitted when a new pending Emergency admin is set in setPendingEmergencyAdmin method.

FactoryNewEmergencyAdmin

Emitted when the factory admin is changed in acceptEmergencyAdmin function.

ExchangeReserveAddressChanged

Emitted when vExchangeReserve instance address is changed in changeAdmin function.

FactoryVPoolManagerChanged

Emitted when vPoolManager address is changed in setVPoolManagerAddress function.

State-Changing Functions

createPair

Creates a new vPair instance between two to given tokens. Emits PairCreated event.

✏️If the pair already exist, the function fails.

Parameters:

Name
Type
Description

tokenA

address

First ERC-20 token in the pair

tokenB

address

Second ERC-20 token in the pair

function setPendingAdmin

The first step in updating the address of the admin wallet for the vPairFactory instance. After this method is called, acceptAdmin must be called to complete the process of changing the Admin

The admin wallet is the only wallet that can call the setExchangeReserveAddress and the setPendingAdmin functions.

Emits FatoryNewPendingAdmin event

✏️Can only be called by the current Admin

function acceptAdmin

The second step in updating the address of the admin wallet for the VirtuSwap DEX

The admin wallet is the only wallet that can call the setExchangeReserveAddress and the setPendingAdmin functions.

Emits FactoryNewAdmin event.

✏️Can only be called by the Pending Admin set by setPendingAdmin method.

function setPendingEmergencyAdmin

The first step in updating the address of the Emergency Admin wallet for VirtuSwap DEX. After this method is called, acceptEmergencyAdmin must be called to complete the process of changing the Emergency Admin

The Emergency Admin wallet is the only wallet that can set the ReseveRatioWarningThreshold and perform liquidation of reserves.

Emits FactoryNewPendingEmergencyAdmin event.

✏️Can only be called by the current Emergency Admin

function acceptEmergencyAdmin

The second step in updating the address of the Emergency Admin wallet for VirtuSwap DEX

The Emergency Admin wallet is the only wallet that can set the ReseveRatioWarningThreshold and perform liquidation of reserves.

Emits FactoryNewEmergencyAdmin event.

✏️Can only be called by the pending Emergency Admin set by setPendingEmergencyAdmin method.

function setDefaultAllowList

Sets the default AllowList (see Allowed Reserves) to be used with for any new pool created with createPair method.

emits DefaultAllowListChanged event

✏️Can only be called by the Admin

Parameters:

Name
Type
Description

_defaultAllowList

address[]

Array of addresses of tokens that should be accepted as reserves by default

function setExchangeReservesAddress

Updates the address of the vExchangeReserves contract instance for the vPairFactory instance.

✏️Can only be called by the Admin

function setVPoolManagerAddress

Sets the active vPoolManager instance for the Factory.

Emits FactoryVPoolManagerChanged event.

✏️Can only be called by the Admin

Read-only Functions

function pairs

Given a two tokens, returns the address of the vPair pool between those two tokens.

function allPairsLength

Returns the number of Pairs currently available in the system.

function getInitCodeHash

Returns the hash of vPair type creation code.

function allPairs

Returns the array of vPair instances created by the Factory.

function vPoolManager

Returns the address of vPoolManager instance.

function admin

Returns the the address of the Admin wallet. See Administrative Privileges.

function emergencyAdmin

Returns the the address of the Emergency Admin wallet. See Administrative Privileges.

function pendingEmergencyAdmin

Returns the the address of the pending Emergency Admin. See setPendingEmergencyAdmin and Administrative Privileges.

Last updated