Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
File renamed without changes.
File renamed without changes.
114 changes: 88 additions & 26 deletions docs/evm/bridging/bridging-evm.mdx

Large diffs are not rendered by default.

203 changes: 194 additions & 9 deletions docs/evm/bridging/bridging-fa-how.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/evm/bridging/bridging-fa-transactions.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ Because the Etherlink EVM<!--TEVM--> tokens are compatible with the ERC-20 stand
## Withdrawing FA tokens from Etherlink EVM<!--TEVM--> to layer 1

It takes two transactions to withdraw an FA token back to layer 1: one to initiate the withdrawal and another to run the outbox transaction on Tezos layer 1.
As described in [Bridging FA tokens](/evm/bridging/bridging-fa), you must wait two weeks to run the outbox transaction due to the Smart Rollup refutation period.
As described in [Bridging FA tokens](/evm/bridging/bridging-fa), you must wait for the two-week Smart Rollup refutation period before running the outbox transaction (withdrawals complete in about 15 days end to end).

Normally, an automated system run by Optimistic Labs runs these outbox transactions as soon as the refutation period is over, which sends the withdrawn tez to the layer 1 account.
However, pending outbox transactions expire after a period equal to the refutation period.
Expand Down
2 changes: 1 addition & 1 deletion docs/evm/bridging/bridging-fa.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: Bridging FA tokens between Tezos layer 1 and Etherlink EVM # tevm
sidebar_label: Bridging FA tokens
---

import CementingDelayNote from '@site/docs/conrefs/cementing-delay.md';
import CementingDelayNote from '@site/docs/conrefs/_cementing-delay.md';

You can bridge FA standards-compliant tokens in and out of Etherlink EVM<!--TEVM--> by deploying contracts that move the tokens.
Then you can create dApps that use these contracts to move tokens or send a request to the Etherlink<!--TX--> team to add your tokens to the bridge at https://bridge.etherlink.com/tezos.
Expand Down
148 changes: 143 additions & 5 deletions docs/evm/bridging/bridging-tezos.md

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions docs/evm/bridging/bridging.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@ title: Bridging tokens
id: bridging
---

You can move tokens in and out of Etherlink EVM{/* TEVM */} through a process called _bridging_.
You can move tokens in and out of Etherlink EVM<!--TEVM--> through a process called _bridging_.
See these related pages for more information:

- [Bridging XTZ between Tezos layer 1 and Etherlink EVM{/* TEVM */}](/evm/bridging/bridging-tezos)
- [Bridging FA tokens between Tezos layer 1 and Etherlink EVM{/* TEVM */}](/evm/bridging/bridging-fa)
- [Bridging tokens between Etherlink EVM{/* TEVM */} and other EVM networks](/evm/bridging/bridging-evm)
- [Bridging XTZ between Tezos layer 1 and Etherlink EVM<!--TEVM-->](/evm/bridging/bridging-tezos)
- [Bridging FA tokens between Tezos layer 1 and Etherlink EVM<!--TEVM-->](/evm/bridging/bridging-fa)
- [Bridging tokens between Etherlink EVM<!--TEVM--> and other EVM networks](/evm/bridging/bridging-evm)

## Explorer

The explorer at https://bridge.explorer.etherlink.com shows bridging transactions between Tezos Mainnet and Etherlink{/* TX */} Mainnet.
The explorer at https://bridge.explorer.etherlink.com shows bridging transactions between Tezos Mainnet and Etherlink<!--TX--> Mainnet.

## Native bridges

Etherlink{/* TX */} developers have created web-based bridges for different situations.
Etherlink<!--TX--> developers have created web-based bridges for different situations.
These bridges are permissionless; anyone can use them without restrictions or the intervention of a third party.

<div class="customTableContainerWrapper">
Expand All @@ -32,13 +32,13 @@ These bridges are permissionless; anyone can use them without restrictions or th
<tbody>
<tr>
<td>Tezos bridge</td>
<td>Bridges XTZ and approved FA tokens from Tezos layer 1 to Etherlink EVM{/* TEVM */} and back</td>
<td>Bridges XTZ and approved FA tokens from Tezos layer 1 to Etherlink EVM<!--TEVM--> and back</td>
<td><a href="https://bridge.etherlink.com/tezos" target="_blank" rel="noopener noreferrer">Mainnet</a></td>
<td><a href="https://shadownet.bridge.etherlink.com/tezos" target="_blank" rel="noopener noreferrer">Shadownet Testnet</a></td>
</tr>
<tr>
<td>EVM bridge</td>
<td>Bridges assets from EVM chains to wrapped assets on Etherlink EVM{/* TEVM */} and back</td>
<td>Bridges assets from EVM chains to wrapped assets on Etherlink EVM<!--TEVM--> and back</td>
<td><a href="https://bridge.etherlink.com/evm" target="_blank" rel="noopener noreferrer">Mainnet</a></td>
<td><a href="https://shadownet.bridge.etherlink.com/evm" target="_blank" rel="noopener noreferrer">Shadownet Testnet</a></td>
</tr>
Expand Down
2 changes: 1 addition & 1 deletion docs/evm/developing/deploying-contracts.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ dependencies:
ethers: 6.13.5
---

import PublicRpcRateLimitNote from '@site/docs/conrefs/rate-limit.md';
import PublicRpcRateLimitNote from '@site/docs/conrefs/_rate-limit.md';

As an EVM-compatible chain, Etherlink EVM<!--TEVM--> runs Solidity contracts.
You can deploy Solidity smart contracts in any way that you would deploy them to an EVM-compatible chain.
Expand Down
4 changes: 2 additions & 2 deletions docs/evm/developing/estimating-fees.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: Estimating fees
---

import GasPriceWarning from '@site/docs/conrefs/gas-price-warning.md';
import GasPriceWarning from '@site/docs/conrefs/_gas-price-warning.md';

The Etherlink EVM<!--TEVM--> gas price (and therefore the fee for a given transaction) varies based on the activity on the chain.
As activity increases, fees increase, and vice versa.
Expand Down Expand Up @@ -44,7 +44,7 @@ This gas price is the cost per unit of computation required by a transaction.

<GasPriceWarning />

To calculate the fee estimate for a given transaction, you can send the transaction to the `eth_estimateGas` endpoint to obtain the estimated gas usage for the the transaction (as in this example), and then calculate the total expected gas fee:
To calculate the fee estimate for a given transaction, you can send the transaction to the `eth_estimateGas` endpoint to obtain the estimated gas usage for the transaction (as in this example), and then calculate the total expected gas fee:

```bash
curl --request POST \
Expand Down
4 changes: 2 additions & 2 deletions docs/evm/developing/indexing-graph.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ sidebar_label: Indexing contracts

Getting historical data on a smart contract can be frustrating when building a dApp. [The Graph](https://thegraph.com/) provides an easy way to query smart contract data through APIs known as subgraphs. The Graph's infrastructure relies on a decentralized network of indexers, enabling your dApp to become truly decentralized.

Both Etherlink{/* TX */} Mainnet and Shadownet Testnet are supported by The Graph.
Both Etherlink<!--TX--> Mainnet and Shadownet Testnet are supported by The Graph.

## Quick start

Expand Down Expand Up @@ -90,7 +90,7 @@ Here's a step by step walk through:

![Publish screen](/img/thegraph-studio-publish-modal.png)

> **Note:** The Graph's smart contracts are all on Arbitrum One, even though your subgraph is indexing data from Etherlink EVM{/* TEVM */}, Ethereum or any other [supported chain](https://thegraph.com/docs/en/developing/supported-networks/).
> **Note:** The Graph's smart contracts are all on Arbitrum One, even though your subgraph is indexing data from Etherlink EVM<!--TEVM-->, Ethereum or any other [supported chain](https://thegraph.com/docs/en/developing/supported-networks/).

## Query your subgraph

Expand Down
20 changes: 10 additions & 10 deletions docs/evm/developing/information.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ dependencies:
ethers: 6.13.5
---

import PublicRpcRateLimitNote from '@site/docs/conrefs/rate-limit.md';
import PublicRpcRateLimitNote from '@site/docs/conrefs/_rate-limit.md';

The EVM interface supports standard EVM endpoints that allow you to get information about the Etherlink<!--TX--> network and its accounts, including user accounts and smart contract accounts.

Expand All @@ -15,7 +15,7 @@ The EVM interface supports standard EVM endpoints that allow you to get informat

## Getting the balance of accounts

To get the balance of a user account or smart contract, pass the account address to the [`eth_getBalance`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getbalance) endpoint, as in this example:
To get the balance of a user account or smart contract, pass the account address to the [`eth_getBalance`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth-getbalance) endpoint, as in this example:

```bash
curl --request POST \
Expand All @@ -36,7 +36,7 @@ The response includes the balance in XTZ in hexadecimal:

## Getting the chain ID

Etherlink EVM<!--TEVM--> supports the standard EVM [`eth_chainId`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_chainid) and [`net_version`](https://ethereum.org/en/developers/docs/apis/json-rpc/#net_version) endpoints to get the ID of the current network.
Etherlink EVM<!--TEVM--> supports the standard EVM [`eth_chainId`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth-chainid) and [`net_version`](https://ethereum.org/en/developers/docs/apis/json-rpc/#net-version) endpoints to get the ID of the current network.
The `eth_chainId` endpoint returns the chain ID in hexadecimal and the `net_version` endpoint returns it in decimal, as in this example:

```bash
Expand All @@ -49,7 +49,7 @@ curl --request POST \

## Getting information about smart contracts

Etherlink EVM<!--TEVM--> supports the standard EVM [`eth_getCode`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getcode) and [`eth_getStorageAt`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getstorageat) endpoints to get the code of a contract and its storage in hexadecimal, as in this example:
Etherlink EVM<!--TEVM--> supports the standard EVM [`eth_getCode`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth-getcode) and [`eth_getStorageAt`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth-getstorageat) endpoints to get the code of a contract and its storage in hexadecimal, as in this example:

```bash
curl --request POST \
Expand All @@ -63,12 +63,12 @@ curl --request POST \

Etherlink EVM<!--TEVM--> supports several standard Ethereum endpoints to get information about transactions:

- [`eth_getTransactionByBlockNumberAndIndex`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_gettransactionbyblocknumberandindex)
- [`eth_getTransactionByBlockHashAndIndex`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_gettransactionbyblockhashandindex)
- [`eth_getTransactionByHash`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_gettransactionbyhash)
- [`eth_getTransactionReceipt`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_gettransactionreceipt)
- [`eth_getTransactionCount`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_gettransactioncount)
- [`eth_getTransactionByHash`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_gettransactionbyhash)
- [`eth_getTransactionByBlockNumberAndIndex`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth-gettransactionbyblocknumberandindex)
- [`eth_getTransactionByBlockHashAndIndex`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth-gettransactionbyblockhashandindex)
- [`eth_getTransactionByHash`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth-gettransactionbyhash)
- [`eth_getTransactionReceipt`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth-gettransactionreceipt)
- [`eth_getTransactionCount`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth-gettransactioncount)
- [`eth_getTransactionByHash`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth-gettransactionbyhash)

For example, you can get information about a transaction by passing its hash to the `eth_getTransactionByHash` or `eth_getTransactionReceipt` endpoints, as in this example:

Expand Down
28 changes: 14 additions & 14 deletions docs/evm/developing/tokens.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ title: Tokens

import InlineCopy from '@site/src/components/InlineCopy';

The native coin on Etherlink EVM{/* TEVM */} has the symbol XTZ, like the [tez tokens on Tezos layer 1](https://docs.tezos.com/architecture/tokens).
The native coin on Etherlink EVM<!--TEVM--> has the symbol XTZ, like the [tez tokens on Tezos layer 1](https://docs.tezos.com/architecture/tokens).
You can get XTZ from many [exchanges](/evm/tools/exchanges) and [on-ramps](/evm/tools/onramps).

Etherlink EVM{/* TEVM */} provides a wrapped version of XTZ named WXTZ that is an [ERC-20-compliant](https://ethereum.org/en/developers/docs/standards/tokens/erc-20/) token for ease of interacting with decentralized applications.
Etherlink EVM<!--TEVM--> provides a wrapped version of XTZ named WXTZ that is an [ERC-20-compliant](https://ethereum.org/en/developers/docs/standards/tokens/erc-20/) token for ease of interacting with decentralized applications.
For more information about WXTZ, see [WXTZ](#wxtz).

## Token addresses

These are some of the other tokens that are available on Etherlink EVM{/* TEVM */}.
These are some of the other tokens that are available on Etherlink EVM<!--TEVM-->.
Click the address to go to the block explorer page for the token:

<table class="customTableContainer">
Expand Down Expand Up @@ -84,7 +84,7 @@ Click the address to go to the block explorer page for the token:

## WXTZ

WXTZ is a token created to replicate the functionality of Wrapped Ether (WETH), but specifically for the XTZ native token on Etherlink EVM{/* TEVM */}.
WXTZ is a token created to replicate the functionality of Wrapped Ether (WETH), but specifically for the XTZ native token on Etherlink EVM<!--TEVM-->.
The goal of WXTZ is to facilitate the use of XTZ in decentralized applications (dApps) and protocols that require ERC-20-like tokens.

For more information and the code of the token, see the [etherlinkcom/token-deployments repository](https://github.com/etherlinkcom/token-deployments/tree/main).
Expand Down Expand Up @@ -119,7 +119,7 @@ Here are the chains the token is deployed on:
</thead>
<tbody>
<tr>
<td>Etherlink EVM{/* TEVM */}</td>
<td>Etherlink EVM<!--TEVM--></td>
<td><InlineCopy code="0xc9B53AB2679f573e480d01e0f49e2B5CFB7a3EAb" href="https://explorer.etherlink.com/address/0xc9B53AB2679f573e480d01e0f49e2B5CFB7a3EAb" abbreviate="5,4"></InlineCopy></td>
</tr>
<tr>
Expand Down Expand Up @@ -154,20 +154,20 @@ The WXTZ contract was audited by [Omniscia.io](https://omniscia.io/).
The final report is here: https://omniscia.io/reports/etherlink-cross-chain-token-665c8ac479e20900180f383b

WXTZ supports OFT to simplify cross-chain compatibility.
However, if the OFT bridge gets compromised, all the XTZ in the contract on Etherlink EVM{/* TEVM */} could be stolen by a malicious attacker with these steps:
However, if the OFT bridge gets compromised, all the XTZ in the contract on Etherlink EVM<!--TEVM--> could be stolen by a malicious attacker with these steps:

1. Create and deploy a fake WXTZ contract on another EVM chain
2. Mint a maximum amount of WXTZ on the other chain
3. Connect to the contract on Etherlink EVM{/* TEVM */} using `setPeer()`
4. Transfer the WXTZ to Etherlink EVM{/* TEVM */}
5. Withdraw the XTZ locked in the WXTZ contract on Etherlink EVM{/* TEVM */}
3. Connect to the contract on Etherlink EVM<!--TEVM--> using `setPeer()`
4. Transfer the WXTZ to Etherlink EVM<!--TEVM-->
5. Withdraw the XTZ locked in the WXTZ contract on Etherlink EVM<!--TEVM-->

The Etherlink{/* TX */} team has taken measures to protect users native to Etherlink EVM{/* TEVM */} and bridged across EVM chains.
The Etherlink<!--TX--> team has taken measures to protect users native to Etherlink EVM<!--TEVM--> and bridged across EVM chains.

These are the measures to protect Etherlink EVM{/* TEVM */} users:
These are the measures to protect Etherlink EVM<!--TEVM--> users:

- We overrode the `_credit` method used by LayerZero to bridge tokens between chains. We added a condition checking that the receiving amount of WXTZ can't exceed the amount of XTZ stored in the contract. The result is that **only the WXTZ supply bridged** using the LayerZero protocol should be at risk, and not the local WXTZ on Etherlink EVM{/* TEVM */}. If an attacker succeeds in hacking the bridge, they will only be able to transfer the difference between the amount of XTZ stored in the contract and the local total supply of WXTZ on Etherlink EVM{/* TEVM */}. In this way, all Etherlink EVM{/* TEVM */} users who own their WXTZ locally will still have their WXTZ backed 1:1 by XTZ in the contract.
- We overrode the `_credit` method used by LayerZero to bridge tokens between chains. We added a condition checking that the receiving amount of WXTZ can't exceed the amount of XTZ stored in the contract. The result is that **only the WXTZ supply bridged** using the LayerZero protocol should be at risk, and not the local WXTZ on Etherlink EVM<!--TEVM-->. If an attacker succeeds in hacking the bridge, they will only be able to transfer the difference between the amount of XTZ stored in the contract and the local total supply of WXTZ on Etherlink EVM<!--TEVM-->. In this way, all Etherlink EVM<!--TEVM--> users who own their WXTZ locally will still have their WXTZ backed 1:1 by XTZ in the contract.

- To protect bridged users, the Etherlink{/* TX */} team overrode the `setPeer()` method that connects and disconnects WXTZ contracts on different chains.
- To protect bridged users, the Etherlink<!--TX--> team overrode the `setPeer()` method that connects and disconnects WXTZ contracts on different chains.
By adding a 2 day timelock to the `setPeer()` method, there is a 2 day delay between initially creating a connection and the connection being executed.
If a hacker takes ownership of the contracts and starts connecting or disconnecting, **bridged users will have 2 days to bridge back all their funds on Etherlink EVM{/* TEVM */} and withdraw their XTZ**.
If a hacker takes ownership of the contracts and starts connecting or disconnecting, **bridged users will have 2 days to bridge back all their funds on Etherlink EVM<!--TEVM--> and withdraw their XTZ**.
8 changes: 4 additions & 4 deletions docs/evm/developing/transactions.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ dependencies:
viem: 0
---

import PublicRpcRateLimitNote from '@site/docs/conrefs/rate-limit.md';
import PublicRpcRateLimitNote from '@site/docs/conrefs/_rate-limit.md';

import GasPriceWarning from '@site/docs/conrefs/gas-price-warning.md';
import GasPriceWarning from '@site/docs/conrefs/_gas-price-warning.md';

Etherlink EVM<!--TEVM--> supports the standard Ethereum `eth_call` and `eth_sendRawTransaction` RPC endpoints for calling smart contracts and sending transactions.

Expand Down Expand Up @@ -329,7 +329,7 @@ If you pass `latest` instead of `pending`, the node waits until the transaction
Etherlink EVM<!--TEVM--> supports this `pending` value only on the `eth_sendRawTransactionSync` method, not on any other methods.

When the sequencer enqueues the transaction for the next block, it notifies the nodes of the transaction and the nodes return a receipt for the transaction that includes information such as its gas price and gas cost.
This receipt matches the specification for the [`eth_getTransactionReceipt`](https://ethereum.org/developers/docs/apis/json-rpc/#eth_gettransactionreceipt) endpoint except that the `blockHash` field is always `0x000...` because the block has not been created yet.
This receipt matches the specification for the [`eth_getTransactionReceipt`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth-gettransactionreceipt) endpoint except that the `blockHash` field is always `0x000...` because the block has not been created yet.
You can take this response as a confirmation that the sequencer will put the transaction in the next block.
If the sequencer does not intend to put the transaction in the next block (such as if the block is nearly complete or the transaction volume is high), the nodes wait to provide the receipt until the transaction will be in the next block.

Expand Down Expand Up @@ -624,7 +624,7 @@ The response includes information about the matching events:
}
```

For other filters, see [`eth_getLogs`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getstorageat) in the Ethereum JSON-RPC API reference.
For other filters, see [`eth_getLogs`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth-getstorageat) in the Ethereum JSON-RPC API reference.

## Tracing transactions

Expand Down
2 changes: 1 addition & 1 deletion docs/evm/developing/verifying-contracts.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ title: Verifying contracts

Verifying a smart contract provides a link to its source code and attests that the source code matches the deployed bytecode.

Follow these steps to verify a contract on the Etherlink EVM{/* TEVM */} block explorer:
Follow these steps to verify a contract on the Etherlink EVM<!--TEVM--> block explorer:

1. Find the deployed contract on https://explorer.etherlink.com/, https://testnet.explorer.etherlink.com/, or https://shadownet.explorer.etherlink.com/.

Expand Down
Loading
Loading