简体   繁体   English

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

[英]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.

相关问题 在 swapExactTokensForTokens 期间恢复交易(UniswapV2Router02,web3.js) - Transaction reverted during swapExactTokensForTokens (UniswapV2Router02, web3.js) UniswapV2 Router 的 addLiquidity 方法示例 - Example for addLiquidity method of UniswapV2 Router 链上和已安装的智能合约有什么区别? - What is the difference between On chain and installed smart contracts? 扎实性:.sol文件中收集合同的最佳名称/术语是什么? - Solidity: What is the best name/term for the collection of contracts in a .sol file? 在工厂合约中部署/克隆合约的最佳方法是什么? - What is the best method to deploy/clone contracts in a Factory contract? 部署实现 IUniswapV2Router02 的智能合约时出错 - Error when deploying a smart contract that implements IUniswapV2Router02 NEAR Protocol Rust 合约 - 近 sdk-rs 数据结构和标准数据结构有什么区别? - NEAR Protocol Rust contracts - what's the difference between near-sdk-rs data structures and std ones? 在 Solidity 语言中,当 function 在不同合约上具有给定参数但为接口存储不同类型的数据时会发生什么? - In Solidity Language, what happens when a function with given parameters on different contracts but different types of data stored for Interface? 为什么在私有以太坊区块链上部署智能合约需要消耗gas费,而调用不需要? - Why does the deployment of smart contracts on the private Ethereum blockchain need to consume gas fee, while the invocation does not? 关于UniswapV2Pair.sol中mint、burn功能的问题 - Questions about mint, burn function in UniswapV2Pair.sol
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM