L2 Alias Control and Fund Transfer Guide
is a simple demonstration of how Arbitrum facilitates sending deposits from an L1 contract to L2.
It will deposit funds to l2 via a l1 contract, and because the inbox contract will alias the sender address if it is a contract, this tutorial shows how to control the alias address on l2 via its l1 contract address.
This tutorial demonstrates depositing funds to L2 using an L1 contract. Since the Inbox contract changes the sender address if it's a contract (a.k.a address aliasing), it explains how to manage the new L2 address using the L1 contract address. It's a basic example of how an L1 contract controls its L2 alias and transfers its alias funds to another address. For practical use, we recommend our funds recovery tool.
The script and contracts demonstrate how to interact with Arbitrum's core bridge contracts to create these retryable messages, how to calculate and forward appropriate fees from L1 to L2, and how to use Arbitrum's L1-to-L2 message address aliasing.
See ./exec.js for inline explanations.
Click here for more info on retryable tickets.
yarn start
Set the values shown in .env-sample
as environmental variables. To copy it into a .env
file:
cp .env-sample .env
(you'll still need to edit some variables, i.e., DEVNET_PRIVKEY
)