function getSwapAmountsOut(
uint _amountIn,
address[] memory _path
) public view virtual returns (uint[] memory amounts)
//์์๋ฃ ์ฌ์ฉ ์ ๋ฌด์ ๋ฐ๋ผ swapFee ์ง์ (30 = 0.03%)
uint amountInWithFee = amountIn*(10000-swapFee)
uint numerator = amountInWithFee*(reserveOut);
uint denominator = (reserveIn*10000)+amountInWithFee;
amountOut = numerator / denominator;
// swap ํ ํฐ ๊ฐ์ ์ป๊ธฐ
await routerContract.getSwapAmountsOut(
10000
[mockToken0Contract.address, mockToken1Contract.address]
)
// ๊ฒฐ๊ณผ
[ BigNumber { value: "10000" }, BigNumber { value: "4984" } ]