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

event FactoryNewAdmin(address newAdmin);

Emitted when the factory admin is changed in acceptAdmin function.

FactoryNewPendingEmergencyAdmin

event FactoryNewPendingEmergencyAdmin(address newPendingEmergencyAdmin);

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

FactoryNewEmergencyAdmin

event FactoryNewEmergencyAdmin(address newEmergencyAdmin);

Emitted when the factory admin is changed in acceptEmergencyAdmin function.

ExchangeReserveAddressChanged

event ExchangeReserveAddressChanged(
    address newExchangeReserve
);

Emitted when vExchangeReserve instance address is changed in changeAdmin function.

FactoryVPoolManagerChanged

event FactoryVPoolManagerChanged(address newVPoolManager);

Emitted when vPoolManager address is changed in setVPoolManagerAddress function.

State-Changing Functions

createPair

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

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

function setPendingAdmin(
      address newPendingAdmin
  ) external override onlyAdmin

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

function acceptAdmin() external override 

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

function setPendingEmergencyAdmin(
      address newPendingAdmin
  ) external override onlyAdmin

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

function acceptEmergencyAdmin() external override 

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

function setDefaultAllowList(
    address[] calldata _defaultAllowList
) external override onlyAdmin

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

function changeAdmin(
    address _exchangeReserves
) external override onlyAdmin

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

✏️Can only be called by the Admin

function setVPoolManagerAddress

function setVPoolManagerAddress(
      address _vPoolManager
) external override onlyAdminin

Sets the active vPoolManager instance for the Factory.

Emits FactoryVPoolManagerChanged event.

✏️Can only be called by the Admin

Read-only Functions

function pairs

function pairs(
    address tokenA,
    address tokenB
) external view returns (address);

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

function allPairsLength

function allPairsLength() external view override returns (uint256) 

Returns the number of Pairs currently available in the system.

function getInitCodeHash

function getInitCodeHash() external pure returns (bytes32) 

Returns the hash of vPair type creation code.

function allPairs

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

Returns the array of vPair instances created by the Factory.

function vPoolManager

function vPoolManager() 
    external view 
returns (address);

Returns the address of vPoolManager instance.

function admin

function admin() 
    external view 
returns (address);

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

function emergencyAdmin

function emergencyAdmin() 
    external view 
returns (address);

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

function pendingEmergencyAdmin

function pendingEmergencyAdmin() 
    external view 
returns (address);

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

Last updated