Skip to content

Commit

Permalink
Merge branch 'main' into tx-exclusion-api
Browse files Browse the repository at this point in the history
  • Loading branch information
jlwllmr committed Sep 19, 2024
2 parents 952fafc + 1a9473c commit afd8284
Show file tree
Hide file tree
Showing 37 changed files with 131 additions and 91 deletions.
46 changes: 23 additions & 23 deletions docs/developers/guides/bridge/how-to-bridge-erc20-tokens.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ image: /img/socialCards/bridge-erc-20-tokens-between-ethereum-and-linea.jpg

:::note

We recommend that only tech operators that are providing liquidity use Linea's native bridge to transfer
ERC-20 tokens.
We recommend that only tech operators that are providing liquidity use Linea's native bridge to
transfer ERC-20 tokens.

For everyday bridge transfers, we recommend you use the
[MetaMask Portfolio bridge](https://portfolio.metamask.io/bridge), which aggregates bridging options
across Linea and shows you the best rates. Alternatively, use one of the
[third-party bridges](https://bridge.linea.build/) available to users.

:::

ERC-20 tokens can only be bridged using manual claiming, which
Expand All @@ -27,23 +28,23 @@ transferred token amount, this could be a
the value is displayed. The chance of encountering this is quite low, but still good to know about.
:::

The guide on [how to bridge ETH](./how-to-bridge-eth.md) shows how to use our bridge
The guide on [how to bridge ETH](./how-to-bridge-eth.mdx) shows how to use our bridge
and appropriately fund your wallet.

1. Go to the Linea [token bridge](https://bridge.linea.build/).
1. Go to the [Linea bridge](https://bridge.linea.build/).

2. Connect your wallet in the top-right corner of the page.

<div class="center-container">
<div class="img-medium">
<div class="img-large">
<img
src="/img/article_images/Use_Linea/Bridge_your_tokens/How_to_bridge_ERC20_tokens_between_Ethereum_and_Linea/Linea_Bridge_connect_wallet_button.png"
src="/img/article_images/Use_Linea/Bridge_your_tokens/How_to_bridge_ETH_between_Ethereum_and_Linea/Linea_Bridge_connect_wallet_button.png"
alt="Linea bridge connect wallet button"
/>
</div>
</div>

3. On the [token bridge](https://bridge.linea.build/), go to the token selection menu by clicking on the current token symbol (ETH in this case).
3. Enter the token selection menu by clicking on the current token symbol (ETH in this case).

<div class="center-container">
<div class="img-medium">
Expand All @@ -54,7 +55,9 @@ and appropriately fund your wallet.
</div>
</div>

4. Select one of the available tokens in the list. If the token is not in the list, paste the address of the token you want to add into the search bar.
4. Select one of the available tokens in the list. If the token is not in the list, use the search
bar to find it by contract address, symbol, or its full name. Click on your preferred token to
select it.

<div class="center-container">
<div class="img-medium">
Expand All @@ -65,9 +68,7 @@ and appropriately fund your wallet.
</div>
</div>

5. Click on the token to select it.

6. You now can bridge this token, and it will be saved in your token list for future bridging.
5. You now can bridge this token, and it will be saved in your token list for future bridging.

<div class="center-container">
<div class="img-medium">
Expand All @@ -80,17 +81,16 @@ and appropriately fund your wallet.

## Token bridge decimal mismatch

When a user bridges an ERC-20 token from one chain to the other (e.g. Mainnet to Linea) and the token
has not been deployed on the destination chain, the Token Bridge Smart Contract will attempt to
determine the “decimals” of the ERC-20 token. If the "decimals" cannot be determined by reading the
origin ERC-20 token contract (e.g. a token contract does not adhere to the
[ERC-20 standard](https://ethereum.org/en/developers/docs/standards/tokens/erc-20/)), it will default
to 18 decimals.
When an ERC-20 token is bridged from one chain to the other and the token has not been deployed on
the destination chain, the Token Bridge Smart Contract will attempt to determine the “decimals” of
the ERC-20 token. If the decimals cannot be determined by reading the origin ERC-20 token contract
(e.g. a token contract does not adhere to the [ERC-20 standard](https://ethereum.org/en/developers/docs/standards/tokens/erc-20/)),
it will default to 18 decimals.

It's important to note that encountering this situation is uncommon, as most tokens with specified
decimals usually adhere to the ERC-20 standards.
This can result in the token quantities displaying incorrectly on the destination chain. For example,
if a token has 16 decimals on L1 but doesn't specify the decimals in token contract, it will
default to 18 decimals on Linea. Bridging 1 token from L1 will show up as 0.01 on L2. When you
bridge back the 0.01 to L1, it'll become 1 token again.

Here's a simple example to help you understand what this means: if a token has 16 decimals on L1 but
doesn't specify the decimals in token contract, then it defaults to 18 decimals on Linea due to
missing information. Bridging 1 token from L1 will show up as 0.01 on L2. When you bridge back the
0.01 to L1, it'll become 1 token again.
Decimal mismatches are rare, since most tokens with specified decimals usually adhere to the ERC-20
standards.
Loading

0 comments on commit afd8284

Please sign in to comment.