From f2e82f742de633ebae8fa813507b6f0169f9beff Mon Sep 17 00:00:00 2001 From: Doug <4741454+douglance@users.noreply.github.com> Date: Wed, 10 Jul 2024 11:44:33 -0400 Subject: [PATCH 1/2] chore: update childChain to childNetwork on public methods for bridgers --- src/lib/assetBridger/assetBridger.ts | 15 ++-- src/lib/assetBridger/erc20Bridger.ts | 74 +++++++++---------- src/lib/assetBridger/ethBridger.ts | 30 ++++---- .../customFeeTokenEthBridger.test.ts | 8 +- tests/integration/eth.test.ts | 4 +- tests/integration/testHelpers.ts | 4 +- 6 files changed, 69 insertions(+), 66 deletions(-) diff --git a/src/lib/assetBridger/assetBridger.ts b/src/lib/assetBridger/assetBridger.ts index 75c2962611..fa4e6fda5c 100644 --- a/src/lib/assetBridger/assetBridger.ts +++ b/src/lib/assetBridger/assetBridger.ts @@ -34,12 +34,12 @@ export abstract class AssetBridger { /** * In case of a chain that uses ETH as its native/gas token, this is either `undefined` or the zero address * - * In case of a chain that uses an ERC-20 token from the parent chain as its native/gas token, this is the address of said token on the parent chain + * In case of a chain that uses an ERC-20 token from the parent network as its native/gas token, this is the address of said token on the parent network */ public readonly nativeToken?: string - public constructor(public readonly childChain: ArbitrumNetwork) { - this.nativeToken = childChain.nativeToken + public constructor(public readonly childNetwork: ArbitrumNetwork) { + this.nativeToken = childNetwork.nativeToken } /** @@ -49,16 +49,19 @@ export abstract class AssetBridger { protected async checkParentChain(sop: SignerOrProvider): Promise { await SignerProviderUtils.checkNetworkMatches( sop, - this.childChain.parentChainId + this.childNetwork.parentChainId ) } /** - * Check the signer/provider matches the childChain, throws if not + * Check the signer/provider matches the childNetwork, throws if not * @param sop */ protected async checkChildChain(sop: SignerOrProvider): Promise { - await SignerProviderUtils.checkNetworkMatches(sop, this.childChain.chainId) + await SignerProviderUtils.checkNetworkMatches( + sop, + this.childNetwork.chainId + ) } /** diff --git a/src/lib/assetBridger/erc20Bridger.ts b/src/lib/assetBridger/erc20Bridger.ts index c00a0d24c7..b46204c47e 100644 --- a/src/lib/assetBridger/erc20Bridger.ts +++ b/src/lib/assetBridger/erc20Bridger.ts @@ -82,7 +82,7 @@ import { getErc20ParentAddressFromParentToChildTxRequest } from '../utils/callda export interface TokenApproveParams { /** - * Parent chain address of the ERC20 token contract + * Parent network address of the ERC20 token contract */ erc20ParentAddress: string /** @@ -101,11 +101,11 @@ export interface Erc20DepositParams extends EthDepositParams { */ childProvider: Provider /** - * Parent chain address of the token ERC20 contract + * Parent network address of the token ERC20 contract */ erc20ParentAddress: string /** - * Child chain address of the entity receiving the funds. Defaults to the l1FromAddress + * Child network address of the entity receiving the funds. Defaults to the l1FromAddress */ destinationAddress?: string /** @@ -132,7 +132,7 @@ export interface Erc20DepositParams extends EthDepositParams { export interface Erc20WithdrawParams extends EthWithdrawParams { /** - * Parent chain address of the token ERC20 contract + * Parent network address of the token ERC20 contract */ erc20ParentAddress: string } @@ -191,17 +191,17 @@ export class Erc20Bridger extends AssetBridger< public static MAX_APPROVAL: BigNumber = MaxUint256 public static MIN_CUSTOM_DEPOSIT_GAS_LIMIT = BigNumber.from(275000) - public readonly childChain: ArbitrumNetwork & { + public readonly childNetwork: ArbitrumNetwork & { tokenBridge: TokenBridge } /** * Bridger for moving ERC20 tokens back and forth between parent-to-child */ - public constructor(childChain: ArbitrumNetwork) { - super(childChain) - assertArbitrumNetworkHasTokenBridge(childChain) - this.childChain = childChain + public constructor(childNetwork: ArbitrumNetwork) { + super(childNetwork) + assertArbitrumNetworkHasTokenBridge(childNetwork) + this.childNetwork = childNetwork } /** @@ -226,7 +226,7 @@ export class Erc20Bridger extends AssetBridger< await this.checkParentChain(parentProvider) return await L1GatewayRouter__factory.connect( - this.childChain.tokenBridge.parentGatewayRouter, + this.childNetwork.tokenBridge.parentGatewayRouter, parentProvider ).getGateway(erc20ParentAddress) } @@ -244,13 +244,13 @@ export class Erc20Bridger extends AssetBridger< await this.checkChildChain(childProvider) return await L2GatewayRouter__factory.connect( - this.childChain.tokenBridge.childGatewayRouter, + this.childNetwork.tokenBridge.childGatewayRouter, childProvider ).getGateway(erc20ParentAddress) } /** - * Creates a transaction request for approving the custom gas token to be spent by the relevant gateway on the parent chain + * Creates a transaction request for approving the custom gas token to be spent by the relevant gateway on the parent network * @param params */ public async getApproveGasTokenRequest( @@ -266,7 +266,7 @@ export class Erc20Bridger extends AssetBridger< } /** - * Approves the custom gas token to be spent by the relevant gateway on the parent chain + * Approves the custom gas token to be spent by the relevant gateway on the parent network * @param params */ public async approveGasToken( @@ -352,7 +352,7 @@ export class Erc20Bridger extends AssetBridger< } /** - * Get the child chain events created by a withdrawal + * Get the child network events created by a withdrawal * @param childProvider * @param gatewayAddress * @param parentTokenAddress @@ -433,8 +433,8 @@ export class Erc20Bridger extends AssetBridger< gatewayAddress: string, parentProvider: Provider ): Promise { - const wethAddress = this.childChain.tokenBridge.parentWethGateway - if (this.childChain.isCustom) { + const wethAddress = this.childNetwork.tokenBridge.parentWethGateway + if (this.childNetwork.isCustom) { // For custom network, we do an ad-hoc check to see if it's a WETH gateway if (await this.looksLikeWethGateway(gatewayAddress, parentProvider)) { return true @@ -447,7 +447,7 @@ export class Erc20Bridger extends AssetBridger< } /** - * Get the child chain token contract at the provided address + * Get the child network 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. @@ -479,7 +479,7 @@ export class Erc20Bridger extends AssetBridger< } /** - * Get the corresponding child chain token address for the provided parent chain token + * Get the corresponding child network token address for the provided parent network token * @param erc20ParentAddress * @param parentProvider * @returns @@ -491,7 +491,7 @@ export class Erc20Bridger extends AssetBridger< await this.checkParentChain(parentProvider) const parentGatewayRouter = L1GatewayRouter__factory.connect( - this.childChain.tokenBridge.parentGatewayRouter, + this.childNetwork.tokenBridge.parentGatewayRouter, parentProvider ) @@ -501,8 +501,8 @@ export class Erc20Bridger extends AssetBridger< } /** - * Get the corresponding parent chain address for the provided child chain token - * Validates the returned address against the child chain router to ensure it is correctly mapped to the provided erc20ChildChainAddress + * Get the corresponding parent network address for the provided child network token + * Validates the returned address against the child network router to ensure it is correctly mapped to the provided erc20ChildChainAddress * @param erc20ChildChainAddress * @param childProvider * @returns @@ -513,12 +513,12 @@ export class Erc20Bridger extends AssetBridger< ): Promise { await this.checkChildChain(childProvider) - // child chain WETH contract doesn't have the parentAddress method on it + // child network WETH contract doesn't have the parentAddress method on it if ( erc20ChildChainAddress.toLowerCase() === - this.childChain.tokenBridge.childWeth.toLowerCase() + this.childNetwork.tokenBridge.childWeth.toLowerCase() ) { - return this.childChain.tokenBridge.parentWeth + return this.childNetwork.tokenBridge.parentWeth } const arbERC20 = L2GatewayToken__factory.connect( @@ -531,7 +531,7 @@ export class Erc20Bridger extends AssetBridger< // check that this l1 address is indeed registered to this child token const childGatewayRouter = L2GatewayRouter__factory.connect( - this.childChain.tokenBridge.childGatewayRouter, + this.childNetwork.tokenBridge.childGatewayRouter, childProvider ) @@ -560,7 +560,7 @@ export class Erc20Bridger extends AssetBridger< await this.checkParentChain(parentProvider) const parentGatewayRouter = L1GatewayRouter__factory.connect( - this.childChain.tokenBridge.parentGatewayRouter, + this.childNetwork.tokenBridge.parentGatewayRouter, parentProvider ) @@ -666,7 +666,7 @@ export class Erc20Bridger extends AssetBridger< let tokenGasOverrides: GasOverrides | undefined = retryableGasOverrides // we also add a hardcoded minimum gas limit for custom gateway deposits if ( - parentGatewayAddress === this.childChain.tokenBridge.parentCustomGateway + parentGatewayAddress === this.childNetwork.tokenBridge.parentCustomGateway ) { if (!tokenGasOverrides) tokenGasOverrides = {} if (!tokenGasOverrides.gasLimit) tokenGasOverrides.gasLimit = {} @@ -708,7 +708,7 @@ export class Erc20Bridger extends AssetBridger< return { data: functionData, - to: this.childChain.tokenBridge.parentGatewayRouter, + to: this.childNetwork.tokenBridge.parentGatewayRouter, from: defaultedParams.from, value: this.getDepositRequestCallValue(depositParams), } @@ -723,7 +723,7 @@ export class Erc20Bridger extends AssetBridger< return { txRequest: { - to: this.childChain.tokenBridge.parentGatewayRouter, + to: this.childNetwork.tokenBridge.parentGatewayRouter, data: estimates.data, value: estimates.value, from: params.from, @@ -747,7 +747,7 @@ export class Erc20Bridger extends AssetBridger< } /** - * Execute a token deposit from parent to child chain + * Execute a token deposit from parent to child network * @param params * @returns */ @@ -834,7 +834,7 @@ export class Erc20Bridger extends AssetBridger< return { txRequest: { data: functionData, - to: this.childChain.tokenBridge.childGatewayRouter, + to: this.childNetwork.tokenBridge.childGatewayRouter, value: BigNumber.from(0), from: params.from, }, @@ -867,7 +867,7 @@ export class Erc20Bridger extends AssetBridger< } /** - * Withdraw tokens from child to parent chain + * Withdraw tokens from child to parent network * @param params * @returns */ @@ -914,7 +914,7 @@ export class Erc20Bridger extends AssetBridger< childProvider: Provider }) { const parentStandardGatewayAddressFromChainConfig = - this.childChain.tokenBridge.parentErc20Gateway + this.childNetwork.tokenBridge.parentErc20Gateway const parentGatewayAddressFromParentGatewayRouter = await this.getParentGatewayAddress(erc20ParentAddress, parentProvider) @@ -1181,7 +1181,7 @@ export class AdminErc20Bridger extends Erc20Bridger { await this.checkParentChain(parentProvider) const parentGatewayRouterAddress = - this.childChain.tokenBridge.parentGatewayRouter + this.childNetwork.tokenBridge.parentGatewayRouter const eventFetcher = new EventFetcher(parentProvider) return ( await eventFetcher.getEvents( @@ -1203,7 +1203,7 @@ export class AdminErc20Bridger extends Erc20Bridger { filter: { fromBlock: BlockTag; toBlock: BlockTag }, customNetworkL2GatewayRouter?: string ): Promise[]> { - if (this.childChain.isCustom && !customNetworkL2GatewayRouter) { + if (this.childNetwork.isCustom && !customNetworkL2GatewayRouter) { throw new ArbSdkError( 'Must supply customNetworkL2GatewayRouter for custom network ' ) @@ -1212,7 +1212,7 @@ export class AdminErc20Bridger extends Erc20Bridger { const childGatewayRouterAddress = customNetworkL2GatewayRouter || - this.childChain.tokenBridge.childGatewayRouter + this.childNetwork.tokenBridge.childGatewayRouter const eventFetcher = new EventFetcher(childProvider) return ( @@ -1246,7 +1246,7 @@ export class AdminErc20Bridger extends Erc20Bridger { const from = await parentSigner.getAddress() const parentGatewayRouter = L1GatewayRouter__factory.connect( - this.childChain.tokenBridge.parentGatewayRouter, + this.childNetwork.tokenBridge.parentGatewayRouter, parentSigner ) diff --git a/src/lib/assetBridger/ethBridger.ts b/src/lib/assetBridger/ethBridger.ts index af8461209d..88caae160e 100644 --- a/src/lib/assetBridger/ethBridger.ts +++ b/src/lib/assetBridger/ethBridger.ts @@ -86,7 +86,7 @@ export interface EthWithdrawParams { */ amount: BigNumber /** - * The parent chain address to receive the value. + * The parent network address to receive the value. */ destinationAddress: string /** @@ -101,7 +101,7 @@ export interface EthWithdrawParams { export type EthDepositParams = { /** - * Parent chain provider or signer + * Parent network provider or signer */ parentSigner: Signer /** @@ -116,11 +116,11 @@ export type EthDepositParams = { export type EthDepositToParams = EthDepositParams & { /** - * Child chain provider + * Child network provider */ childProvider: Provider /** - * Child chain address of the entity receiving the funds + * Child network address of the entity receiving the funds */ destinationAddress: string /** @@ -149,7 +149,7 @@ type EthDepositToRequestParams = OmitTyped< 'overrides' | 'parentSigner' > & { /** - * Parent chain provider + * Parent network provider */ parentProvider: Provider /** @@ -159,14 +159,14 @@ type EthDepositToRequestParams = OmitTyped< } /** - * Bridger for moving either ETH or custom gas tokens back and forth between parent and child chains + * Bridger for moving either ETH or custom gas tokens back and forth between parent and child networks */ export class EthBridger extends AssetBridger< EthDepositParams | EthDepositToParams | ParentToChildTxReqAndSigner, EthWithdrawParams | ChildToParentTxReqAndSigner > { /** - * Instantiates a new EthBridger from a child chain Provider + * Instantiates a new EthBridger from a child network Provider * @param childProvider * @returns */ @@ -185,7 +185,7 @@ export class EthBridger extends AssetBridger< } /** - * Creates a transaction request for approving the custom gas token to be spent by the inbox on the parent chain + * Creates a transaction request for approving the custom gas token to be spent by the inbox on the parent network * @param params */ public getApproveGasTokenRequest( @@ -199,7 +199,7 @@ export class EthBridger extends AssetBridger< 'approve', [ // spender - this.childChain.ethBridge.inbox, + this.childNetwork.ethBridge.inbox, // value params?.amount ?? constants.MaxUint256, ] @@ -213,7 +213,7 @@ export class EthBridger extends AssetBridger< } /** - * Approves the custom gas token to be spent by the Inbox on the parent chain. + * Approves the custom gas token to be spent by the Inbox on the parent network. * @param params */ public async approveGasToken( @@ -270,7 +270,7 @@ export class EthBridger extends AssetBridger< ): Promise> { return { txRequest: { - to: this.childChain.ethBridge.inbox, + to: this.childNetwork.ethBridge.inbox, value: this.nativeTokenIsEth ? params.amount : 0, data: this.getDepositRequestData(params), from: params.from, @@ -280,7 +280,7 @@ export class EthBridger extends AssetBridger< } /** - * Deposit ETH from Parent onto Child chain + * Deposit ETH from Parent onto Child network * @param params * @returns */ @@ -305,7 +305,7 @@ export class EthBridger extends AssetBridger< } /** - * Get a transaction request for an ETH deposit to a different child chain address using Retryables + * Get a transaction request for an ETH deposit to a different child network address using Retryables * @param params * @returns */ @@ -332,7 +332,7 @@ export class EthBridger extends AssetBridger< } /** - * Deposit ETH from parent chain onto a different child chain address + * Deposit ETH from parent network onto a different child network address * @param params * @returns */ @@ -401,7 +401,7 @@ export class EthBridger extends AssetBridger< } /** - * Withdraw ETH from child chain onto parent chain + * Withdraw ETH from child network onto parent network * @param params * @returns */ diff --git a/tests/integration/custom-fee-token/customFeeTokenEthBridger.test.ts b/tests/integration/custom-fee-token/customFeeTokenEthBridger.test.ts index 4ce32939ad..5964b017d5 100644 --- a/tests/integration/custom-fee-token/customFeeTokenEthBridger.test.ts +++ b/tests/integration/custom-fee-token/customFeeTokenEthBridger.test.ts @@ -65,7 +65,7 @@ describeOnlyWhenCustomGasToken( const allowance = await nativeTokenContract.allowance( await parentSigner.getAddress(), - ethBridger.childChain.ethBridge.inbox + ethBridger.childNetwork.ethBridge.inbox ) expect(allowance.toString()).to.equal( @@ -89,7 +89,7 @@ describeOnlyWhenCustomGasToken( const allowance = await nativeTokenContract.allowance( await parentSigner.getAddress(), - ethBridger.childChain.ethBridge.inbox + ethBridger.childNetwork.ethBridge.inbox ) expect(allowance.toString()).to.equal( @@ -106,7 +106,7 @@ describeOnlyWhenCustomGasToken( childSigner, childProvider, } = await testSetup() - const bridge = ethBridger.childChain.ethBridge.bridge + const bridge = ethBridger.childNetwork.ethBridge.bridge const amount = parseEther('2') await fundParentSignerEther(parentSigner) @@ -167,7 +167,7 @@ describeOnlyWhenCustomGasToken( ethBridger, nativeTokenContract, } = await testSetup() - const bridge = ethBridger.childChain.ethBridge.bridge + const bridge = ethBridger.childNetwork.ethBridge.bridge const amount = parseEther('0.2') await fundParentSignerEther(parentSigner) diff --git a/tests/integration/eth.test.ts b/tests/integration/eth.test.ts index f5a553ae17..d69dcf5912 100644 --- a/tests/integration/eth.test.ts +++ b/tests/integration/eth.test.ts @@ -102,7 +102,7 @@ describe('Ether', async () => { const { ethBridger, parentSigner, childSigner } = await testSetup() await fundParentSigner(parentSigner) - const inboxAddress = ethBridger.childChain.ethBridge.inbox + const inboxAddress = ethBridger.childNetwork.ethBridge.inbox const initialInboxBalance = await parentSigner.provider!.getBalance( inboxAddress @@ -162,7 +162,7 @@ describe('Ether', async () => { const { ethBridger, parentSigner, childSigner } = await testSetup() await fundParentSigner(parentSigner) - const inboxAddress = ethBridger.childChain.ethBridge.inbox + const inboxAddress = ethBridger.childNetwork.ethBridge.inbox const destWallet = Wallet.createRandom() const initialInboxBalance = await parentSigner.provider!.getBalance( diff --git a/tests/integration/testHelpers.ts b/tests/integration/testHelpers.ts index 68fedb1737..2106c009c6 100644 --- a/tests/integration/testHelpers.ts +++ b/tests/integration/testHelpers.ts @@ -139,7 +139,7 @@ export const withdrawToken = async (params: WithdrawalParams) => { const { expectedL2Gateway } = getGateways( params.gatewayType, - params.erc20Bridger.childChain + params.erc20Bridger.childNetwork ) expect(gatewayAddress, 'Gateway is not custom gateway').to.eq( expectedL2Gateway @@ -348,7 +348,7 @@ export const depositToken = async ({ const { expectedL1Gateway, expectedL2Gateway } = getGateways( expectedGatewayType, - erc20Bridger.childChain + erc20Bridger.childNetwork ) const parentGateway = await erc20Bridger.getParentGatewayAddress( From 498615863808b7f009fca7b1b4c03b3934f6bc89 Mon Sep 17 00:00:00 2001 From: Doug <4741454+douglance@users.noreply.github.com> Date: Wed, 10 Jul 2024 12:24:54 -0400 Subject: [PATCH 2/2] change checkParentChain/checkChildChain to network --- src/lib/assetBridger/assetBridger.ts | 8 +++--- src/lib/assetBridger/erc20Bridger.ts | 38 ++++++++++++++-------------- src/lib/assetBridger/ethBridger.ts | 8 +++--- 3 files changed, 27 insertions(+), 27 deletions(-) diff --git a/src/lib/assetBridger/assetBridger.ts b/src/lib/assetBridger/assetBridger.ts index fa4e6fda5c..6ef1d549d1 100644 --- a/src/lib/assetBridger/assetBridger.ts +++ b/src/lib/assetBridger/assetBridger.ts @@ -43,10 +43,10 @@ export abstract class AssetBridger { } /** - * Check the signer/provider matches the parentChain, throws if not + * Check the signer/provider matches the parent network, throws if not * @param sop */ - protected async checkParentChain(sop: SignerOrProvider): Promise { + protected async checkParentNetwork(sop: SignerOrProvider): Promise { await SignerProviderUtils.checkNetworkMatches( sop, this.childNetwork.parentChainId @@ -54,10 +54,10 @@ export abstract class AssetBridger { } /** - * Check the signer/provider matches the childNetwork, throws if not + * Check the signer/provider matches the child network, throws if not * @param sop */ - protected async checkChildChain(sop: SignerOrProvider): Promise { + protected async checkChildNetwork(sop: SignerOrProvider): Promise { await SignerProviderUtils.checkNetworkMatches( sop, this.childNetwork.chainId diff --git a/src/lib/assetBridger/erc20Bridger.ts b/src/lib/assetBridger/erc20Bridger.ts index b46204c47e..84ceed3b0b 100644 --- a/src/lib/assetBridger/erc20Bridger.ts +++ b/src/lib/assetBridger/erc20Bridger.ts @@ -223,7 +223,7 @@ export class Erc20Bridger extends AssetBridger< erc20ParentAddress: string, parentProvider: Provider ): Promise { - await this.checkParentChain(parentProvider) + await this.checkParentNetwork(parentProvider) return await L1GatewayRouter__factory.connect( this.childNetwork.tokenBridge.parentGatewayRouter, @@ -241,7 +241,7 @@ export class Erc20Bridger extends AssetBridger< erc20ParentAddress: string, childProvider: Provider ): Promise { - await this.checkChildChain(childProvider) + await this.checkChildNetwork(childProvider) return await L2GatewayRouter__factory.connect( this.childNetwork.tokenBridge.childGatewayRouter, @@ -276,7 +276,7 @@ export class Erc20Bridger extends AssetBridger< throw new Error('chain uses ETH as its native/gas token') } - await this.checkParentChain(params.parentSigner) + await this.checkParentNetwork(params.parentSigner) const approveGasTokenRequest = this.isApproveParams(params) ? await this.getApproveGasTokenRequest({ @@ -335,7 +335,7 @@ export class Erc20Bridger extends AssetBridger< public async approveToken( params: ApproveParamsOrTxRequest ): Promise { - await this.checkParentChain(params.parentSigner) + await this.checkParentNetwork(params.parentSigner) const approveRequest = this.isApproveParams(params) ? await this.getApproveTokenRequest({ @@ -368,7 +368,7 @@ export class Erc20Bridger extends AssetBridger< fromAddress?: string, toAddress?: string ): Promise<(EventArgs & { txHash: string })[]> { - await this.checkChildChain(childProvider) + await this.checkChildNetwork(childProvider) const eventFetcher = new EventFetcher(childProvider) const events = ( @@ -488,7 +488,7 @@ export class Erc20Bridger extends AssetBridger< erc20ParentAddress: string, parentProvider: Provider ): Promise { - await this.checkParentChain(parentProvider) + await this.checkParentNetwork(parentProvider) const parentGatewayRouter = L1GatewayRouter__factory.connect( this.childNetwork.tokenBridge.parentGatewayRouter, @@ -511,7 +511,7 @@ export class Erc20Bridger extends AssetBridger< erc20ChildChainAddress: string, childProvider: Provider ): Promise { - await this.checkChildChain(childProvider) + await this.checkChildNetwork(childProvider) // child network WETH contract doesn't have the parentAddress method on it if ( @@ -557,7 +557,7 @@ export class Erc20Bridger extends AssetBridger< parentTokenAddress: string, parentProvider: Provider ): Promise { - await this.checkParentChain(parentProvider) + await this.checkParentNetwork(parentProvider) const parentGatewayRouter = L1GatewayRouter__factory.connect( this.childNetwork.tokenBridge.parentGatewayRouter, @@ -647,8 +647,8 @@ export class Erc20Bridger extends AssetBridger< public async getDepositRequest( params: DepositRequest ): Promise { - await this.checkParentChain(params.parentProvider) - await this.checkChildChain(params.childProvider) + await this.checkParentNetwork(params.parentProvider) + await this.checkChildNetwork(params.childProvider) const defaultedParams = this.applyDefaults(params) const { amount, @@ -754,7 +754,7 @@ export class Erc20Bridger extends AssetBridger< public async deposit( params: Erc20DepositParams | ParentToChildTxReqAndSignerProvider ): Promise { - await this.checkParentChain(params.parentSigner) + await this.checkParentNetwork(params.parentSigner) // Although the types prevent should alert callers that value is not // a valid override, it is possible that they pass it in anyway as it's a common override @@ -879,7 +879,7 @@ export class Erc20Bridger extends AssetBridger< if (!SignerProviderUtils.signerHasProvider(params.childSigner)) { throw new MissingProviderArbSdkError('childSigner') } - await this.checkChildChain(params.childSigner) + await this.checkChildNetwork(params.childSigner) const withdrawalRequest = isChildToParentTransactionRequest< OmitTyped & { childSigner: Signer } @@ -989,7 +989,7 @@ export class AdminErc20Bridger extends Erc20Bridger { throw new Error('chain uses ETH as its native/gas token') } - await this.checkParentChain(params.parentSigner) + await this.checkParentNetwork(params.parentSigner) const approveGasTokenRequest = this.isApproveParams(params) ? this.getApproveGasTokenForCustomTokenRegistrationRequest({ @@ -1024,8 +1024,8 @@ export class AdminErc20Bridger extends Erc20Bridger { if (!SignerProviderUtils.signerHasProvider(parentSigner)) { throw new MissingProviderArbSdkError('parentSigner') } - await this.checkParentChain(parentSigner) - await this.checkChildChain(childProvider) + await this.checkParentNetwork(parentSigner) + await this.checkChildNetwork(childProvider) const parentProvider = parentSigner.provider! const parentSenderAddress = await parentSigner.getAddress() @@ -1178,7 +1178,7 @@ export class AdminErc20Bridger extends Erc20Bridger { parentProvider: Provider, filter: { fromBlock: BlockTag; toBlock: BlockTag } ): Promise[]> { - await this.checkParentChain(parentProvider) + await this.checkParentNetwork(parentProvider) const parentGatewayRouterAddress = this.childNetwork.tokenBridge.parentGatewayRouter @@ -1208,7 +1208,7 @@ export class AdminErc20Bridger extends Erc20Bridger { 'Must supply customNetworkL2GatewayRouter for custom network ' ) } - await this.checkChildChain(childProvider) + await this.checkChildNetwork(childProvider) const childGatewayRouterAddress = customNetworkL2GatewayRouter || @@ -1240,8 +1240,8 @@ export class AdminErc20Bridger extends Erc20Bridger { if (!SignerProviderUtils.signerHasProvider(parentSigner)) { throw new MissingProviderArbSdkError('parentSigner') } - await this.checkParentChain(parentSigner) - await this.checkChildChain(childProvider) + await this.checkParentNetwork(parentSigner) + await this.checkChildNetwork(childProvider) const from = await parentSigner.getAddress() diff --git a/src/lib/assetBridger/ethBridger.ts b/src/lib/assetBridger/ethBridger.ts index 88caae160e..61dd02bc12 100644 --- a/src/lib/assetBridger/ethBridger.ts +++ b/src/lib/assetBridger/ethBridger.ts @@ -287,7 +287,7 @@ export class EthBridger extends AssetBridger< public async deposit( params: EthDepositParams | ParentToChildTxReqAndSigner ): Promise { - await this.checkParentChain(params.parentSigner) + await this.checkParentNetwork(params.parentSigner) const ethDeposit = isParentToChildTransactionRequest(params) ? params @@ -341,8 +341,8 @@ export class EthBridger extends AssetBridger< | EthDepositToParams | (ParentToChildTxReqAndSigner & { childProvider: Provider }) ): Promise { - await this.checkParentChain(params.parentSigner) - await this.checkChildChain(params.childProvider) + await this.checkParentNetwork(params.parentSigner) + await this.checkChildNetwork(params.childProvider) const retryableTicketRequest = isParentToChildTransactionRequest(params) ? params @@ -413,7 +413,7 @@ export class EthBridger extends AssetBridger< if (!SignerProviderUtils.signerHasProvider(params.childSigner)) { throw new MissingProviderArbSdkError('childSigner') } - await this.checkChildChain(params.childSigner) + await this.checkChildNetwork(params.childSigner) const request = isChildToParentTransactionRequest< EthWithdrawParams & { childSigner: Signer }