getLiquidityValue

function getLiquidityValue(
    address _tokenA,
    address _tokenB,
    uint256 _liquidityAmount
) external view returns (
    uint256 tokenAAmount,
    uint256 tokenBAmount
)

μœ λ™μ„± ν’€ Token을 톡해 각 ν† ν°μ˜ 개수λ₯Ό 얻을 λ•Œ μ‚¬μš©

Parameters

TypeValueDescription

address

_tokenA

LP 토큰A μ£Όμ†Œ

address

_tokenB

LP 토큰B μ£Όμ†Œ

uint256

_liquidityAmount

LP 토큰 개수

Return Values

TypeValueDescription

uint256

tokenAAmount

tokenA의 개수

uint256

tokenBAmount

tokenB의 개수

Example

// μœ λ™μ„±ν’€μ„ ν†΅ν•œ 토큰 개수 μ–»κΈ°
await ComputeContract.connect(accounts[0]).getLiquidityValue(
    mockToken0Contract.address,
    mockToken1Contract.address,
    1000000
)

// κ²°κ³Ό (토큰A, 토큰B 개수)
[ BigNumber { value: "1414213" }, BigNumber { value: "707106" } ]

2022.12.22

Last updated