Skip to content

Latest commit

 

History

History
39 lines (23 loc) · 1.36 KB

File metadata and controls

39 lines (23 loc) · 1.36 KB

token-withdraw Tutorial

token-withdraw shows how to move ERC20 tokens from Arbitrum (Layer 2) into Ethereum (Layer 1).

Note that this repo covers initiating a token withdrawal; for a demo on (later) releasing the funds from the Outbox, see outbox-execute

How it works (Under the hood)

To withdraw a token from Arbitrum, a message is send from a Gateway contract which burns the token on L2, and sends a message to L1, which allow the token to be released from escrow once the dispute period is expired. For more info, see Outgoing messages documentation.


Standard ERC20 Withdrawal

In this demo, we deploy a fresh token and then deposit some to L2. Then, we use these new tokens to trigger a withdrawal back to L1.

We use our Arbitrum SDK library for the token bridge interactions.

See ./exec.js for inline explanation.

Config Environment Variables

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)

Run

yarn withdraw-token