function getLiquidityPair(
address _tokenA,
address _tokenB,
uint256 _amountIn
) external view returns (
uint256 amountA,
uint256 amountB
)
ํ์ด ํ ํฐ์ ํตํด ๊ฐ ํ ํฐ์ ๋น์จ์ ์ป์ ๋ ์ฌ์ฉ(ํ์ด์คํ
์ดํน)
uint amountB = (amountA*reserveB) / reserveA;
// ์ ๋์ฑํ์ ํตํ ํ ํฐ ๊ฐ์ ์ป๊ธฐ
await ComputeContract.connect(accounts[0]).getLiquidityPair(
mockToken0Contract.address,
mockToken1Contract.address,
1000000
)
// ๊ฒฐ๊ณผ (ํ ํฐA, ํ ํฐB ๊ฐ์)
[ BigNumber { value: "1000000" }, BigNumber { value: "500000" } ]