getLiquidityPair

function getLiquidityPair(
    address _tokenA,
    address _tokenB,
    uint256 _amountIn
) external view returns (
    uint256 amountA,
    uint256 amountB
)

νŽ˜μ–΄ 토큰을 톡해 각 ν† ν°μ˜ λΉ„μœ¨μ„ 얻을 λ•Œ μ‚¬μš©(νŽ˜μ–΄μŠ€ν…Œμ΄ν‚Ή)

Parameters

Return Values

β€»Reservesλ₯Ό ν†΅ν•œ μ—°μ‚° 방법

uint amountB = (amountA*reserveB) / reserveA;

Example

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

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

2023.01.11

Last updated