Skip to main content

l1l3Bridger

Classes

Erc20L1L3Bridger

Bridger for moving ERC20 tokens from L1 to L3

Extends

  • BaseL1L3Bridger

Properties

PropertyModifierTypeDefault valueDescription
_l1FeeTokenAddressprotectedundefined | stringundefinedIf the L3 network uses a custom fee token, this is the address of that token on L1
l2ForwarderFactoryDefaultGasLimitreadonlyBigNumber...Default gas limit for L2ForwarderFactory.callForwarder of 1,000,000

Measured Standard: 361746

Measured OnlyGasToken: 220416

Measured NonGasTokenToCustomGas: 373449
l2GasTokenAddressreadonlyundefined | stringundefinedIf the L3 network uses a custom (non-eth) fee token, this is the address of that token on L2
teleporterreadonlyTeleporterundefinedAddresses of teleporter contracts on L2

Methods

_checkL1Network()
protected _checkL1Network(sop: SignerOrProvider): Promise<void>

Check the signer/provider matches the l1Network, throws if not

Parameters
ParameterTypeDescription
sopSignerOrProvider
Returns

Promise<void>

Inherited from

BaseL1L3Bridger._checkL1Network

Source

assetBridger/l1l3Bridger.ts:306

_checkL2Network()
protected _checkL2Network(sop: SignerOrProvider): Promise<void>

Check the signer/provider matches the l2Network, throws if not

Parameters
ParameterTypeDescription
sopSignerOrProvider
Returns

Promise<void>

Inherited from

BaseL1L3Bridger._checkL2Network

Source

assetBridger/l1l3Bridger.ts:314

_checkL3Network()
protected _checkL3Network(sop: SignerOrProvider): Promise<void>

Check the signer/provider matches the l3Network, throws if not

Parameters
ParameterTypeDescription
sopSignerOrProvider
Returns

Promise<void>

Inherited from

BaseL1L3Bridger._checkL3Network

Source

assetBridger/l1l3Bridger.ts:322

_decodeCallForwarderCalldata()
protected _decodeCallForwarderCalldata(data: string): L2ForwarderParamsStruct

Given raw calldata for a callForwarder call, decode the parameters

Parameters
ParameterType
datastring
Returns

L2ForwarderParamsStruct

Source

assetBridger/l1l3Bridger.ts:1402

_decodeTeleportCalldata()
protected _decodeTeleportCalldata(data: string): TeleportParamsStruct

Given raw calldata for a teleport tx, decode the teleport parameters

Parameters
ParameterType
datastring
Returns

TeleportParamsStruct

Source

assetBridger/l1l3Bridger.ts:1388

_fillPartialTeleportParams()
protected _fillPartialTeleportParams(
partialTeleportParams: OmitTyped<TeleportParamsStruct, "gasParams">,
retryableOverrides: Erc20L1L3DepositRequestRetryableOverrides,
l1Provider: Provider,
l2Provider: Provider,
l3Provider: Provider): Promise<object>

Given TeleportParams without the gas parameters, return TeleportParams with gas parameters populated. Does not modify the input parameters.

Parameters
ParameterType
partialTeleportParamsOmitTyped<TeleportParamsStruct, "gasParams">
retryableOverridesErc20L1L3DepositRequestRetryableOverrides
l1ProviderProvider
l2ProviderProvider
l3ProviderProvider
Returns

Promise<object>

MemberType
costs[BigNumber, BigNumber, number, RetryableGasCostsStructOutput] & object
teleportParamsobject
teleportParams.amountBigNumberish
teleportParams.gasParamsRetryableGasParamsStruct
teleportParams.l1Tokenstring
teleportParams.l1l2Routerstring
teleportParams.l2l3RouterOrInboxstring
teleportParams.l3FeeTokenL1Addrstring
teleportParams.tostring
Source

assetBridger/l1l3Bridger.ts:1194

_getL1L2FeeTokenBridgeGasEstimates()
protected _getL1L2FeeTokenBridgeGasEstimates(params: object): Promise<RetryableGasValues>

Estimate the gasLimit and maxSubmissionFee for the L1 to L2 fee token bridge leg of a teleportation

Parameters
ParameterType
paramsobject
params.feeTokenAmountBigNumber
params.l1GasPriceBigNumber
params.l1ProviderProvider
params.l2ForwarderAddressstring
params.l2ProviderProvider
params.l3FeeTokenL1Addrstring
Returns

Promise<RetryableGasValues>

Source

assetBridger/l1l3Bridger.ts:1056

_getL1L2TokenBridgeGasEstimates()
protected _getL1L2TokenBridgeGasEstimates(params: object): Promise<RetryableGasValues>

Estimate the gasLimit and maxSubmissionFee for the L1 to L2 token bridge leg of a teleportation

Parameters
ParameterType
paramsobject
params.amountBigNumberish
params.l1GasPriceBigNumber
params.l1ProviderProvider
params.l1Tokenstring
params.l2ForwarderAddressstring
params.l2ProviderProvider
Returns

Promise<RetryableGasValues>

Source

assetBridger/l1l3Bridger.ts:1024

_getL2ForwarderFactoryGasEstimates()
protected _getL2ForwarderFactoryGasEstimates(l1GasPrice: BigNumber, l1Provider: Provider): Promise<RetryableGasValues>

Estimate the gasLimit and maxSubmissionFee for L2ForwarderFactory.callForwarder leg of a teleportation. Gas limit is hardcoded to 1,000,000

Parameters
ParameterType
l1GasPriceBigNumber
l1ProviderProvider
Returns

Promise<RetryableGasValues>

Source

assetBridger/l1l3Bridger.ts:1095

_getL2L3BridgeGasEstimates()
protected _getL2L3BridgeGasEstimates(params: object): Promise<RetryableGasValues>

Estimate the gasLimit and maxSubmissionFee for the L2 -> L3 leg of a teleportation.

Parameters
ParameterType
paramsobject
params.l1ProviderProvider
params.l2ForwarderAddressstring
params.l2GasPriceBigNumber
params.l2ProviderProvider
params.l3ProviderProvider
params.partialTeleportParamsOmitTyped<TeleportParamsStruct, "gasParams">
Returns

Promise<RetryableGasValues>

Source

assetBridger/l1l3Bridger.ts:1117

_getTokenBridgeGasEstimates()
protected _getTokenBridgeGasEstimates(params: object): Promise<RetryableGasValues>

Estimate the gasLimit and maxSubmissionFee for a token bridge retryable

Parameters
ParameterType
paramsobject
params.amountBigNumber
params.childProviderProvider
params.fromstring
params.isWethboolean
params.parentErc20Addressstring
params.parentGasPriceBigNumber
params.parentGatewayAddressstring
params.parentProviderProvider
params.tostring
Returns

Promise<RetryableGasValues>

Source

assetBridger/l1l3Bridger.ts:976

_l2ForwarderFactoryCalldataSize()
protected _l2ForwarderFactoryCalldataSize(): number
Returns

number

The size of the calldata for a call to L2ForwarderFactory.callForwarder

Source

assetBridger/l1l3Bridger.ts:1366

approveGasToken()
approveGasToken(params: TxRequestParams | object): Promise<ContractTransaction>

Approve the L3's fee token for teleportation. The tokens will be approved for L1Teleporter. Will throw if the L3 network uses ETH for fees or the fee token doesn't exist on L1.

Parameters
ParameterType
paramsTxRequestParams | object
Returns

Promise<ContractTransaction>

Source

assetBridger/l1l3Bridger.ts:701

approveToken()
approveToken(params: TxRequestParams | TokenApproveParams & object): Promise<ContractTransaction>

Approve tokens for teleportation. The tokens will be approved for L1Teleporter.

Parameters
ParameterType
paramsTxRequestParams | TokenApproveParams & object
Returns

Promise<ContractTransaction>

Source

assetBridger/l1l3Bridger.ts:659

deposit()
deposit(params: TxRequestParams | Erc20L1L3DepositRequestParams & object): Promise<ParentContractCallTransaction>

Execute a teleportation of some tokens from L1 to L3.

Parameters
ParameterType
paramsTxRequestParams | Erc20L1L3DepositRequestParams & object
Returns

Promise<ParentContractCallTransaction>

Source

assetBridger/l1l3Bridger.ts:811

getApproveGasTokenRequest()
getApproveGasTokenRequest(params: object): Promise<Required<Pick<TransactionRequest, "data" | "value" | "to">>>

Get a tx request to approve the L3's fee token for teleportation. The tokens will be approved for L1Teleporter. Will throw if the L3 network uses ETH for fees or the fee token doesn't exist on L1.

Parameters
ParameterType
paramsobject
params.amount?BigNumber
params.l1ProviderProvider
params.l2ProviderProvider
Returns

Promise<Required<Pick<TransactionRequest, "data" | "value" | "to">>>

Source

assetBridger/l1l3Bridger.ts:682

getApproveTokenRequest()
getApproveTokenRequest(params: TokenApproveParams): Promise<Required<Pick<TransactionRequest, "data" | "value" | "to">>>

Get a tx request to approve tokens for teleportation. The tokens will be approved for L1Teleporter.

Parameters
ParameterType
paramsTokenApproveParams
Returns

Promise<Required<Pick<TransactionRequest, "data" | "value" | "to">>>

Source

assetBridger/l1l3Bridger.ts:640

getDepositParameters()
getDepositParameters(params: object & TxReference): Promise<object>

Given a teleportation tx, get the L1Teleporter parameters, L2Forwarder parameters, and L2Forwarder address

Parameters
ParameterType
paramsobject & TxReference
Returns

Promise<object>

MemberType
l2ForwarderAddressPromise<string>
l2ForwarderParamsL2ForwarderParamsStruct
teleportParamsTeleportParamsStruct
Source

assetBridger/l1l3Bridger.ts:837

getDepositRequest()
getDepositRequest(params: Erc20L1L3DepositRequestParams & object | object): Promise<DepositRequestResult>

Get a tx request for teleporting some tokens from L1 to L3. Also returns the amount of fee tokens required for teleportation.

Parameters
ParameterType
paramsErc20L1L3DepositRequestParams & object | object
Returns

Promise<DepositRequestResult>

Source

assetBridger/l1l3Bridger.ts:732

getDepositStatus()
getDepositStatus(params: GetL1L3DepositStatusParams): Promise<Erc20L1L3DepositStatus>

Fetch the cross chain messages and their status

Can provide either the txHash, the tx, or the txReceipt

Parameters
ParameterType
paramsGetL1L3DepositStatusParams
Returns

Promise<Erc20L1L3DepositStatus>

Source

assetBridger/l1l3Bridger.ts:878

getGasTokenOnL1()
getGasTokenOnL1(l1Provider: Provider, l2Provider: Provider): Promise<string>

If the L3 network uses a custom gas token, return the address of that token on L1. If the fee token is not available on L1, does not use 18 decimals on L1 and L2, or the L3 network uses ETH for fees, throw.

Parameters
ParameterType
l1ProviderProvider
l2ProviderProvider
Returns

Promise<string>

Source

assetBridger/l1l3Bridger.ts:431

getL1L2GatewayAddress()
getL1L2GatewayAddress(erc20L1Address: string, l1Provider: Provider): Promise<string>

Given an L1 token's address, get the address of the token's L1 <-> L2 gateway on L1

Parameters
ParameterType
erc20L1Addressstring
l1ProviderProvider
Returns

Promise<string>

Source

assetBridger/l1l3Bridger.ts:532

getL1TokenContract()
getL1TokenContract(l1TokenAddr: string, l1Provider: Provider): IERC20

Get the L1 token contract at the provided address Note: This function just returns a typed ethers object for the provided address, it doesn't check the underlying form of the contract bytecode to see if it's an erc20, and doesn't ensure the validity of any of the underlying functions on that contract.

Parameters
ParameterType
l1TokenAddrstring
l1ProviderProvider
Returns

IERC20

Source

assetBridger/l1l3Bridger.ts:560

getL2Erc20Address()
getL2Erc20Address(erc20L1Address: string, l1Provider: Provider): Promise<string>

Get the corresponding L2 token address for the provided L1 token

Parameters
ParameterType
erc20L1Addressstring
l1ProviderProvider
Returns

Promise<string>

Source

assetBridger/l1l3Bridger.ts:508

getL2L3GatewayAddress()
getL2L3GatewayAddress(
erc20L1Address: string,
l1Provider: Provider,
l2Provider: Provider): Promise<string>

Get the address of the L2 <-> L3 gateway on L2 given an L1 token address

Parameters
ParameterType
erc20L1Addressstring
l1ProviderProvider
l2ProviderProvider
Returns

Promise<string>

Source

assetBridger/l1l3Bridger.ts:545

getL2TokenContract()
getL2TokenContract(l2TokenAddr: string, l2Provider: Provider): L2GatewayToken

Get the L2 token contract at the provided address Note: This function just returns a typed ethers object for the provided address, it doesn't check the underlying form of the contract bytecode to see if it's an erc20, and doesn't ensure the validity of any of the underlying functions on that contract.

Parameters
ParameterType
l2TokenAddrstring
l2ProviderProvider
Returns

L2GatewayToken

Source

assetBridger/l1l3Bridger.ts:570

getL3Erc20Address()
getL3Erc20Address(
erc20L1Address: string,
l1Provider: Provider,
l2Provider: Provider): Promise<string>

Get the corresponding L3 token address for the provided L1 token

Parameters
ParameterType
erc20L1Addressstring
l1ProviderProvider
l2ProviderProvider
Returns

Promise<string>

Source

assetBridger/l1l3Bridger.ts:518

getL3TokenContract()
getL3TokenContract(l3TokenAddr: string, l3Provider: Provider): L2GatewayToken

Get the L3 token contract at the provided address Note: This function just returns a typed ethers object for the provided address, it doesn't check the underlying form of the contract bytecode to see if it's an erc20, and doesn't ensure the validity of any of the underlying functions on that contract.

Parameters
ParameterType
l3TokenAddrstring
l3ProviderProvider
Returns

L2GatewayToken

Source

assetBridger/l1l3Bridger.ts:583

l1TokenIsDisabled()
l1TokenIsDisabled(l1TokenAddress: string, l1Provider: Provider): Promise<boolean>

Whether the L1 token has been disabled on the L1 <-> L2 router given an L1 token address

Parameters
ParameterType
l1TokenAddressstring
l1ProviderProvider
Returns

Promise<boolean>

Source

assetBridger/l1l3Bridger.ts:593

l2ForwarderAddress()
l2ForwarderAddress(
owner: string,
routerOrInbox: string,
destinationAddress: string,
l1OrL2Provider: Provider): Promise<string>

Given some L2Forwarder parameters, get the address of the L2Forwarder contract

Parameters
ParameterType
ownerstring
routerOrInboxstring
destinationAddressstring
l1OrL2ProviderProvider
Returns

Promise<string>

Source

assetBridger/l1l3Bridger.ts:613

l2TokenIsDisabled()
l2TokenIsDisabled(l2TokenAddress: string, l2Provider: Provider): Promise<boolean>

Whether the L2 token has been disabled on the L2 <-> L3 router given an L2 token address

Parameters
ParameterType
l2TokenAddressstring
l2ProviderProvider
Returns

Promise<boolean>

Source

assetBridger/l1l3Bridger.ts:603

teleportationType()
teleportationType(partialTeleportParams: Pick<TeleportParamsStruct, "l1Token" | "l3FeeTokenL1Addr">): TeleportationType

Get the type of teleportation from the l1Token and l3FeeTokenL1Addr teleport parameters

Parameters
ParameterType
partialTeleportParamsPick<TeleportParamsStruct, "l1Token" | "l3FeeTokenL1Addr">
Returns

TeleportationType

Source

assetBridger/l1l3Bridger.ts:953


EthL1L3Bridger

Bridge ETH from L1 to L3 using a double retryable ticket

Extends

  • BaseL1L3Bridger

Methods

_checkL1Network()
protected _checkL1Network(sop: SignerOrProvider): Promise<void>

Check the signer/provider matches the l1Network, throws if not

Parameters
ParameterTypeDescription
sopSignerOrProvider
Returns

Promise<void>

Inherited from

BaseL1L3Bridger._checkL1Network

Source

assetBridger/l1l3Bridger.ts:306

_checkL2Network()
protected _checkL2Network(sop: SignerOrProvider): Promise<void>

Check the signer/provider matches the l2Network, throws if not

Parameters
ParameterTypeDescription
sopSignerOrProvider
Returns

Promise<void>

Inherited from

BaseL1L3Bridger._checkL2Network

Source

assetBridger/l1l3Bridger.ts:314

_checkL3Network()
protected _checkL3Network(sop: SignerOrProvider): Promise<void>

Check the signer/provider matches the l3Network, throws if not

Parameters
ParameterTypeDescription
sopSignerOrProvider
Returns

Promise<void>

Inherited from

BaseL1L3Bridger._checkL3Network

Source

assetBridger/l1l3Bridger.ts:322

deposit()
deposit(params: TxRequestParams | EthL1L3DepositRequestParams & object): Promise<ParentContractCallTransaction>

Deposit ETH to L3 via a double retryable ticket

Parameters
ParameterType
paramsTxRequestParams | EthL1L3DepositRequestParams & object
Returns

Promise<ParentContractCallTransaction>

Source

assetBridger/l1l3Bridger.ts:1521

getDepositParameters()
getDepositParameters(params: object & TxReference): Promise<object>

Given an L1 transaction, get the retryable parameters for both l2 and l3 tickets

Parameters
ParameterType
paramsobject & TxReference
Returns

Promise<object>

MemberType
l1l2TicketDataRetryableMessageParams
l2l3TicketDataRetryableMessageParams
Source

assetBridger/l1l3Bridger.ts:1547

getDepositRequest()
getDepositRequest(params: EthL1L3DepositRequestParams & object | object): Promise<ParentToChildTransactionRequest>

Get a tx request to deposit ETH to L3 via a double retryable ticket

Parameters
ParameterType
paramsEthL1L3DepositRequestParams & object | object
Returns

Promise <ParentToChildTransactionRequest>

Source

assetBridger/l1l3Bridger.ts:1463

getDepositStatus()
getDepositStatus(params: GetL1L3DepositStatusParams): Promise<EthL1L3DepositStatus>

Get the status of a deposit given an L1 tx receipt. Does not check if the tx is actually a deposit tx.

Parameters
ParameterType
paramsGetL1L3DepositStatusParams
Returns

Promise<EthL1L3DepositStatus>

Information regarding each step of the deposit and EthL1L3DepositStatus.completed which indicates whether the deposit has fully completed.

Source

assetBridger/l1l3Bridger.ts:1577