Skip to content

sx-network/arbitrum-orbit-scripts

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Arbitrum Orbit Deposit and Withdrawal Scripts

Introduction

This repository contains scripts for performing deposit and withdrawal operations using the Arbitrum SDK. The scripts allow you to deposit ETH from L1 to L2 and withdraw it back to L1, demonstrating the interoperability between Ethereum and Arbitrum networks.

Setup

Before running the scripts, ensure you have the necessary dependencies installed and the environment variables configured.

Prerequisites

  • Node.js
  • Environment Variable:
    • DEVNET_PRIVKEY: Your private key
    • L1RPC: L1 RPC URL
    • L2RPC: L2 RPC URL

Scripts

Deposit

Logic

  1. Initialize Providers and Wallets:
    • Set up L1 and L2 providers using RPC URLs.
    • Create wallets using the provided private key.
  2. Configure L2 Network:
    • Define and register a custom L2 network configuration.
  3. Deposit ETH:
    • Specify the amount of ETH to deposit.
    • Create an EthBridger instance.
    • Execute the deposit and wait for confirmation on both L1 and L2.

User-triggered transaction on Parent Chain: Transaction Link

Automatically triggered transaction to deposit on user's wallet on Orbit Chain: Transaction Link

Withdrawal

Step 1: Trigger Withdrawal

  1. Initialize Providers and Wallets:
    • Set up L1 and L2 providers using RPC URLs.
    • Create wallets using the provided private key.
  2. Configure L2 Network:
    • Define and register a custom L2 network configuration.
  3. Trigger Withdrawal:
    • Retrieve the transaction receipt for the deposit.
    • Get the L2 to L1 messages from the receipt.
    • Check if the message has already been executed.
    • Wait for the outbox entry to be created and then execute the withdrawal transaction on L2.

Trigger withdrawal on Orbit Chain: Transaction Link

Step 2: Execute Withdrawal

  1. Execute Withdrawal on L1:
    • Once the outbox entry is created, execute the transaction on the parent chain to complete the withdrawal process.

Execute transaction on Parent Chain: Transaction Link

Running the scripts

To run the scripts, follow these steps:

For deposits: npm run start
For Withdraw Step 1: npm run step:1
For Withdraw Step 2: npm run step:2

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 100.0%