"amountIn" 在 UniswapV2Router02 合约中有什么单位?

What unit does "amountIn" have in UniswapV2Router02 contracts?

我试图理解这个合约中的“getAmountOut”函数(它是 SushiSwaps-router-contract):

https://etherscan.io/address/0xd9e1cE17f2641f24aE83637ab66a2cca9C378B9F#readContract

有2个参数:

amountIn (uint256)
path (address[])

假设我想将 WETH 与另一个代币进行比较。当我在 amountIn 中输入 1000 时。 1000 是什么单位?

WETH 有 18 位小数,那么 1000 是否意味着 0.0000000000001000 WETH?

正如您在该合同上看到的那样

// given an input amount of an asset and pair reserves, returns the maximum output amount of the other asset

有了这个功能你可以找到

每个令牌都必须声明所有小数点,所以如果 WETH 有 18 个小数点,而你想放 1000 WETH,你需要写 1000000000000000000000

代币也一样