6/22/2023 0 Comments Optimism token list![]() ![]() ![]() If the address of either the L1 cross domain messenger or the L2 token bridge changes, we create a new proxy and a new bridge that calls it. The initialize function should only be called once. It includes functions and definitions required for bridging ERC-20 tokens. This interface is defined here (opens in a new tab) ↗. This is the code that runs on L1, the Ethereum Mainnet. The L1 bridge transfers the appropriate asset (ETH or ERC-20) to the appropriate address.Came from the cross domain message mechanism.The L1 bridge verifies the call to finalizeETHWithdrawal or finalizeERC20Withdrawal is legitimate:.The L2 bridge uses the cross-domain message mechanism to call finalizeETHWithdrawal or finalizeERC20Withdrawal on the L1 bridge.The L2 bridge burns the appropriate number of tokens belonging to msg.sender.The withdrawer calls the L2 bridge ( withdraw or withdrawTo).If not, start a withdrawal process to allow the user to claim the tokens on L1. If the L2 contract is the correct one, call it to mint the appropriate number of tokens to the appropriate address.The L2 contract reports that it supports the correct interface ( using ERC-165 (opens in a new tab) ↗).The L2 contract reports that its L1 counterpart is the same as the one the tokens came from on L1.The L2 bridge checks if the ERC-20 token contract on L2 is the correct one:.Came from the cross domain message contract.The L2 bridge verifies the call to finalizeDeposit is legitimate:.The L1 bridge uses the cross-domain message mechanism to call finalizeDeposit on the L2 bridge.ERC-20: The asset is transferred by the bridge to itself using the allowance provided by the depositor.ETH: The asset is transferred by the depositor as part of the call.The L1 bridge takes possession of the bridged asset.The depositor calls the L1 bridge ( depositERC20, depositERC20To, depositETH, or depositETHTo).If depositing an ERC-20, the depositor gives the bridge an allowance to spend the amount being deposited.In this article we go over the source code for that bridge to see how it works and study it as an example of well written Solidity code. This is the way the Optimism standard bridge (opens in a new tab) ↗ works. When doing this, the assets are burned on L2 and then released back to the user on L1. One way to achieve this is for users to lock assets (ETH and ERC-20 tokens (opens in a new tab) ↗ are the most common ones) on L1, and receive equivalent assets to use on L2.Įventually, whoever ends up with them might want to bridge them back to L1. To use L1 assets on Optimism (or any other L2), the assets need to be bridged. Optimistic rollups can process transactions for a much lower price than Ethereum Mainnet (also known as layer 1 or L1) because transactions are only processed by a few nodes, instead of every node on the network.Īt the same time, the data is all written to L1 so everything can be proved and reconstructed with all the integrity and availability guarantees of Mainnet. Optimism (opens in a new tab) ↗ is an Optimistic Rollup. ![]()
0 Comments
Leave a Reply. |