title: Uniswap getAmountsOut() rounds value down to nearest Ether
body: <p>I'm calling <code>getAmountsOut()</code> from the UniswapV2Router02 contract using ethers.js, where I'm checking the amount of ETH I can get for 50000 DAI.</p>
  <p>Using the below code, the output amount tells me I can currently get exactly 15 ETH. For testing purposes I'm using the Uniswap contract directly instead of the Uniswap SDK.</p>
  <pre class="lang-js prettyprint-override"><code>const UNISWAPV2_ROUTER02_ADDRESS = &quot;0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D&quot;;
  const UNISWAPV2_ROUTER02_ABI = [{ &quot;inputs&quot;: [{ &quot;internalType&quot;: &quot;uint256&quot;, &quot;name&quot;: &quot;amountIn&quot;, &quot;type&quot;: &quot;uint256&quot; }, { &quot;internalType&quot;: &quot;address[]&quot;, &quot;name&quot;: &quot;path&quot;, &quot;type&quot;: &quot;address[]&quot; }], &quot;name&quot;: &quot;getAmountsOut&quot;, &quot;outputs&quot;: [{ &quot;internalType&quot;: &quot;uint256[]&quot;, &quot;name&quot;: &quot;amounts&quot;, &quot;type&quot;: &quot;uint256[]&quot; }], &quot;stateMutability&quot;: &quot;view&quot;, &quot;type&quot;: &quot;function&quot; }]
  
  const DAI_ADDRESS = &quot;0x6b175474e89094c44da98b954eedeac495271d0f&quot;;
  const WETH_ADDRESS = &quot;0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2&quot;;
  
  const uniswap = new ethers.Contract(
      UNISWAPV2_ROUTER02_ADDRESS,
      UNISWAPV2_ROUTER02_ABI,
      ethers.provider,
  );
  
  let amountEthFromDAI = await uniswap.getAmountsOut(
      50000,
      [DAI_ADDRESS, WETH_ADDRESS]
  )
  
  console.log(&quot;Amount of ETH from DAI: &quot;, amountEthFromDAI[1]);
  </code></pre>
  <p>However on the actual Uniswap interface it's telling me I can get a total of 15.8832 ETH which is significantly more.</p>
  <p><a href="https://i.stack.imgur.com/7GQkO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7GQkO.png" alt="Uniswap ETH output from DAI" /></a></p>
  <p>It seems <code>getAmountsOut()</code> is rounding down to the nearest Ether. How can I get the output amount in units of wei so it accurately reflects what I see on the Uniswap interface?</p>