Pool
The Pool entity represents a token pair with a balance of each of its tokens.
#
Methods#
reserveOfReturns reserve0 or reserve1, depending on whether token0 or token1 is passed in.
#
virtualReserveOfReturns virtual reserve0 or reserve1, depending on whether token0 or token1 is passed in.
#
getOutputAmountReturns maximum output amount based on current pool and the new balances of the pools if the trade were executed.
#
getInputAmountReturns minimum input amount based on current reserves and the new balances of the tokens in the respective pools
#
getLiquidityMintedcalculates the exact amount of liquidity tokens minted.
- totalSupply requires on-chain lookup.
- The value returned from this function cannot be used as an input to getLiquidityValue.
#
getLiquidityValueCalculates the exact amount of token0 or token1 that the given amount of liquidity tokens represent.
- totalSupply, kLast involves on-chain lookup.
- Values returned from this function cannot be used as inputs to getLiquidityMinted.
#
Static Methods#
involvesTokenReturns true if the token is either token0 or token1
#
priceOfReturns the price of the given token in terms of the other token in the pair.
#
reserve0returns token0 amount of the reserve.
#
virtualReserve0returns virtual token0 amount of virtual reserve.
#
reserve1returns token1 amount of the reserve.
#
virtualReserve1returns virtual token1 amount of virtual reserve.