Skip to content
LogoLogo

amm.getPool

Gets the reserves for a liquidity pool.

Usage

import {  } from './viem.config'
 
const  = await .amm.getPool({
  : '0x20c0000000000000000000000000000000000000',
  : '0x20c0000000000000000000000000000000000001',
})
 
.('User token reserve:', .reserveUserToken)
User token reserve: 1000000000000000000000n
.('Validator token reserve:', .reserveValidatorToken)
Validator token reserve: 1000000000000000000000n
.('Total supply:', .totalSupply)
Total supply: 1000000000000000000000n

Return Type

type ReturnType = {
  /** Reserve of user token */
  reserveUserToken: bigint
  /** Reserve of validator token */
  reserveValidatorToken: bigint
  /** Total supply of LP tokens */
  totalSupply: bigint
}

Parameters

userToken

  • Type: Address | bigint

Address or ID of the user token.

validatorToken

  • Type: Address | bigint

Address or ID of the validator token.

blockNumber (optional)

  • Type: bigint

Block number to read the state from.

blockOverrides (optional)

  • Type: BlockOverrides

Block overrides to apply to the state.

blockTag (optional)

  • Type: BlockTag

Block tag to read the state from.

stateOverride (optional)

  • Type: StateOverride

State override to apply.