> For the complete documentation index, see [llms.txt](https://docs.virtuswap.io/virtuswap-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.virtuswap.io/virtuswap-documentation/technical-reference/smart-contracts-v1/dex-contracts/vpoolmanager.md).

# vPoolManager

Helper contract for building and accessing VirtuSwap Virtual Pools

## Read-only functions

### function getVirtualPool

```solidity
function getVirtualPool(
     address jkPair,
     address ikPair
) public view override returns (VirtualPoolModel memory vPool)
```

Returns a Virtual Pool constructed from a given Active Pool and a given Reference Pool. If a Virtual Pool pool cannot be constructed from the given pair of pools, an error occurs.

See [How Virtual Pools Work](/virtuswap-documentation/virtuswap-basics/virtuswap-technology/how-virtual-pools-work.md) for details on how Virtual Pools are constructed.

Parameters:

<table><thead><tr><th width="293">Name</th><th width="181">Type</th><th>Description</th></tr></thead><tbody><tr><td>jkPair</td><td><code>address</code></td><td>Address of the Active Pool</td></tr><tr><td>ikPair</td><td><code>address</code></td><td>Address of the Reference Pool</td></tr></tbody></table>

### function getVirtualPools

```solidity
function getVirtualPools(
    address token0,
    address token1
) external view override returns (VirtualPoolModel[] memory vPools)
```

Returns all Virtual Pools that are available between two given tokens.&#x20;

See [How Virtual Pools Work](/virtuswap-documentation/virtuswap-basics/virtuswap-technology/how-virtual-pools-work.md) for details on how Virtual Pools are constructed.

Parameters:

<table><thead><tr><th width="293">Name</th><th width="181">Type</th><th>Description</th></tr></thead><tbody><tr><td>token0</td><td><code>address</code></td><td>First token</td></tr><tr><td>token1</td><td><code>address</code></td><td>Second token</td></tr></tbody></table>

#### function pairFactory

```solidity
function pairFactory() 
    external view 
returns (address);
```

Returns the [`vPairFactory`](/virtuswap-documentation/technical-reference/smart-contracts-v1/dex-contracts/vpairfactory.md) instance.

## State-changing functions

### function updateVirtualPoolBalances

```solidity
function updateVirtualPoolBalances(
        VirtualPoolModel memory vPool,
        uint256 balance0,
        uint256 balance1
    ) external overrides)
```

Updates balances of a Virtual Pool. This function is called by `swapNativeToReserve` and `swapReserveToNative` methods of the [`vPair`](/virtuswap-documentation/technical-reference/smart-contracts-v1/dex-contracts/vpair.md) contract after a trade is executed using the Virtual Pool. The goal is to make Virtual Pool behave exactly like a regular AMM pool would, i.e. that every trade immediately effects the liquidity of the pool.

Parameters:

<table><thead><tr><th width="170">Name</th><th width="213">Type</th><th>Description</th></tr></thead><tbody><tr><td>vPool</td><td><code>VirtualPoolModel</code></td><td>The Virtual Pool to be updated</td></tr><tr><td>balance0</td><td><code>uint256</code></td><td>Balance of asset0 in the Virtual Pool</td></tr><tr><td>balance1 </td><td><code>uint256</code></td><td>Balance of asset1 in the Virtual Pool</td></tr></tbody></table>
