eth-deposit
shows how to move Ether from Ethereum (Layer 1) into the Arbitrum (Layer 2) chain.
A user deposits Ether onto Arbitrum using Arbitrum's general L1-to-L2 message passing system, and simply passing the desired Ether as callvalue and no additional data. For more info, see Retryable Tickets documentation.
In this repo we show 3 different examples of how a client may trigger an Ether deposit.
Inbox.sol
is an Arbitrum core protocol contract; it includes a depositEth
method which triggers an L1-to-L2 message that will deposit Ether to the destination address. In this demo, a client connects to this contract directly to trigger their Ether deposit.
See ./exec-viaInbox.js for inline explanation.
To run:
yarn deposit:inbox
Deposit.sol is a contract which itself triggers an Eth deposit. Here we show a client connecting to Deposit.sol and triggering and Eth deposit that way.
See ./exec-viaDapp.js for inline explanation.
To run:
yarn deposit:dapp
Finally, our arb-ts provides a simply convenience method for depositing Ether, abstracting away the need for the client to connect to any contracts manually.
See ./exec-viaLib.js for inline explanation.
To run:
yarn deposit:arb-ts
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
)
Once the script is successfully executed, you can go to the Arbitrum block explorer, enter your address, and see the amount of ETH that has been assigned to your address on the Arbitrum chain!