AssetBridger

class arbitrum_py.asset_bridger.asset_bridger.AssetBridger(child_network)[source]

Bases: ABC, Generic[DepositParams, WithdrawParams]

Base class for bridging assets between parent and child chains.

This abstract base class provides the foundation for implementing asset bridging functionality between parent (L1-like) and child (L2-like) chains in the Arbitrum ecosystem. It handles basic network validation and provides abstract methods for deposit and withdrawal operations.

Variables:
  • child_network (ArbitrumNetwork) – Network configuration for the child chain

  • native_token (Optional[str]) – Address of the native token on the parent chain. - For chains using ETH as native token: None or zero address - For chains using ERC-20 as native token: Address of token on parent chain

__init__(child_network)[source]

Initialize the AssetBridger.

Parameters:

child_network (ArbitrumNetwork) – ArbitrumNetwork instance containing chain configuration including chain IDs and network properties.

Raises:

ArbSdkError – If child_network is invalid or parent chain ID is undefined

check_parent_network(sop)[source]

Verify the signer/provider matches the parent network.

Parameters:

sop (SignerOrProvider) – SignerOrProvider instance for the parent chain

Raises:

ArbSdkError – If the network does not match child_network.parent_chain_id

Return type:

None

check_child_network(sop)[source]

Verify the signer/provider matches the child network.

Parameters:

sop (SignerOrProvider) – SignerOrProvider instance for the child chain

Raises:

ArbSdkError – If the network does not match child_network.chain_id

Return type:

None

property native_token_is_eth: bool

Check if the child network uses ETH as its native token.

Returns:

True if the native token is ETH, False if it’s an ERC-20 token

Return type:

bool

abstract deposit(params)[source]

Transfer assets from parent chain to child chain.

Parameters:

params (TypeVar(DepositParams)) – Parameters required for the deposit operation

Returns:

Transaction object for the deposit

Return type:

ParentContractTransaction

Raises:

ArbSdkError – If the deposit operation fails

abstract withdraw(params)[source]

Transfer assets from child chain to parent chain.

Parameters:

params (TypeVar(WithdrawParams)) – Parameters required for the withdrawal operation

Returns:

Transaction object for the withdrawal

Return type:

ChildContractTransaction

Raises:

ArbSdkError – If the withdrawal operation fails