moccajoghurt
moccajoghurt

Reputation: 181

What unit does "amountIn" have in UniswapV2Router02 contracts?

I am trying to understand the "getAmountOut"-function in this contract (it's SushiSwaps-router-contract):

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

There are 2 parameters:

amountIn (uint256)
path (address[])

Let's say I want to compare WETH to another token. When I enter 1000 in amountIn. What unit are the 1000?

WETH has 18 decimals so would 1000 mean 0.0000000000001000 WETH?

Upvotes: 0

Views: 228

Answers (1)

Jacopo Mosconi
Jacopo Mosconi

Reputation: 1062

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

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

same thing for tokens

Upvotes: 2

Related Questions