[英]What unit does "amountIn" have in UniswapV2Router02 contracts?
I am trying to understand the "getAmountOut"-function in this contract (it's SushiSwaps-router-contract):我试图理解这个合约中的“getAmountOut”函数(它是 SushiSwaps-router-contract):
https://etherscan.io/address/0xd9e1cE17f2641f24aE83637ab66a2cca9C378B9F#readContract https://etherscan.io/address/0xd9e1cE17f2641f24aE83637ab66a2cca9C378B9F#readContract
There are 2 parameters:有2个参数:
amountIn (uint256)
path (address[])
Let's say I want to compare WETH to another token.假设我想将 WETH 与另一个令牌进行比较。 When I enter 1000 in amountIn.当我在 amountIn 中输入 1000 时。 What unit are the 1000? 1000是什么单位?
WETH has 18 decimals so would 1000 mean 0.0000000000001000 WETH? WETH 有 18 位小数,那么 1000 是否意味着 0.0000000000001000 WETH?
as you can read on that contract正如你在合同上看到的那样
// given an input amount of an asset and pair reserves, returns the maximum output amount of the other asset
with that function u can find that有了那个 function 你可以找到
every token have to be declared with all their decimals, so if WETH have 18 decimals, and you want to put 1000 WETH, you need to write 1000000000000000000000每个令牌都必须声明所有小数点,所以如果 WETH 有 18 个小数点,并且你想放 1000 WETH,你需要写 1000000000000000000000
same thing for tokens代币也一样
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.