Token Decimals And Swap Amounts

Token Decimals And Swap Amounts


Token decimals decide how a token’s smallest on-chain units appear as readable amounts. They affect the numbers you see for a swap, but they do not change the token’s market price or the pool’s fee.

Keep these three points in mind:

  • Each token can use a different number of decimal places.
  • A displayed amount represents an integer number of tiny units.
  • Check the token and the quoted output before approving a swap.

What do token decimals change?

Decimals tell a wallet or exchange where to place the decimal point when showing a token balance. For example, with six decimals, 1 token is stored as 1,000,000 smallest units; with 18 decimals, it is stored as 1,000,000,000,000,000,000 units.

The ERC-20 specification describes decimals as optional display information. The contract still handles whole-number units, and the interface converts between those units and the amount a person reads. Avalanche’s developer documentation explains the same conversion as multiplying a token amount by 10 to the power of its decimal count.

If you are checking a pool swap on Avalanche, Blackhole Swap exchange lets you compare the amount you enter with the output the pool quotes. Read each token’s amount using its own decimals; the input token’s setting does not carry over to the output.

How does a swap turn input into output?

A swap interface first turns your typed amount into the input token’s smallest units. It then asks the pool, a smart contract holding token reserves, how many output units the trade would return. The interface converts that integer using the output token’s decimals.

For example, say you enter 1.25 units of a six-decimal token. The contract receives 1,250,000 units. If the quote is 0.0042 of an 18-decimal token, that output is 4,200,000,000,000,000 smallest units.

The before-and-after amounts can look strikingly different because their decimal counts differ. That does not mean the swap multiplied your value by a trillion. Compare the readable token amounts and the quoted exchange rate, which means how much output you get per input token.

Pool reserves and the trade size determine the quote. A larger trade can move the pool price more, while the fee reduces the amount returned. Decimals only set how those amounts are displayed and encoded. Some values also cannot be represented exactly: a token with six decimals cannot transfer half of its smallest unit, so interfaces round amounts to available precision.

How can you compare amounts before swapping?

I would use the swap screen’s quote for a normal trade, then check the token symbols and amounts before signing. For an independent check, use a wallet or token viewer that reads the token contract’s decimal setting; typing a guessed conversion into a calculator is easier to get wrong.

  1. Select the intended input and output tokens, and check their symbols.
  2. Enter the amount in readable tokens, not smallest units.
  3. Read the quoted output in the output token’s units.
  4. Check the minimum received, the least amount allowed after price movement.
  5. Confirm the wallet transaction shows the same input token and amount.

The minimum received is often lower than the quote because the swap allows for slippage, a possible price change before execution. A decimal mismatch can make the displayed amount look wrong by a factor of ten or more, so pause if the token identity or scale seems unexpected. Blackhole Swap uses the same basic unit conversion as other pool swaps; the quoted output still depends on the pool and trade conditions.

When comparing routes, judge the readable output after fees and the minimum received, rather than the number of digits alone. Blackhole Swap is one option to inspect when you want to see a pool’s quote for your Avalanche token pair.

Report Page