vPoolManager
Helper contract for building and accessing VirtuSwap Virtual Pools
Read-only functions
function getVirtualPool
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 for details on how Virtual Pools are constructed.
Parameters:
jkPair
address
Address of the Active Pool
ikPair
address
Address of the Reference Pool
function getVirtualPools
Returns all Virtual Pools that are available between two given tokens.
See How Virtual Pools Work for details on how Virtual Pools are constructed.
Parameters:
token0
address
First token
token1
address
Second token
function pairFactory
Returns the vPairFactory
instance.
State-changing functions
function updateVirtualPoolBalances
Updates balances of a Virtual Pool. This function is called by swapNativeToReserve
and swapReserveToNative
methods of the vPair
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:
vPool
VirtualPoolModel
The Virtual Pool to be updated
balance0
uint256
Balance of asset0 in the Virtual Pool
balance1
uint256
Balance of asset1 in the Virtual Pool
Last updated