eth-deposit-to-different-address
shows how to move Ether (or your chain's native token if you're using a custom gas token) from the parent chain into an Arbitrum or Orbit chain, to an address different than the depositor.
For the common case of depositing Ether (or your chain's native token) to the same account on the child chain, use the tutorial eth-deposit.
In this specific case, we will use a retryable ticket (Arbitrum's canonical method for creating cross-chain messages) to deposit the chain's native token (e.g. Ether) into a different address. We will use the parameter l2CallValue
of the retryable ticket to specify the amount of assets to deposit, and callValueRefundAddress
to specify the destination address. For more info on retryable tickets, see this page of the Arbitrum documentation.
Our Arbitrum SDK provides a simply convenience method for depositing Ether (or your chain's native token), abstracting away the need for the client to connect to any contracts manually.
See ./exec.js for inline explanation.
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., PRIVATE_KEY
, CHAIN_RPC
and PARENT_CHAIN_RPC
.
Note that you can also set the environment variables in an .env
file in the root of the monorepo, which will be available in all tutorials.
yarn run exec