Skip to content

Commit

Permalink
Use the new TokenBridgeCreator override to fix the failing integratio…
Browse files Browse the repository at this point in the history
…n test
  • Loading branch information
TucksonDev committed Feb 28, 2024
1 parent 3ed5f2e commit d428e9a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
3 changes: 1 addition & 2 deletions src/createTokenBridge.integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import {
createPublicClient,
encodeFunctionData,
http,
maxInt256,
parseEther,
zeroAddress,
parseAbi,
Expand All @@ -17,7 +16,6 @@ import { createTokenBridgePrepareTransactionReceipt } from './createTokenBridgeP
import { deployTokenBridgeCreator } from './createTokenBridge-testHelpers';
import {
CreateTokenBridgeEnoughCustomFeeTokenAllowanceParams,
createTokenBridgeEnoughCustomFeeTokenAllowance,
} from './createTokenBridgeEnoughCustomFeeTokenAllowance';
import { createTokenBridgePrepareCustomFeeTokenApprovalTransactionRequest } from './createTokenBridgePrepareCustomFeeTokenApprovalTransactionRequest';
import { erc20 } from './contracts';
Expand Down Expand Up @@ -176,6 +174,7 @@ it(`successfully deploys token bridge contracts through token bridge creator`, a
base: 100_000n,
},
},
tokenBridgeCreatorAddressOverride: tokenBridgeCreator,
});

// sign and send the transaction
Expand Down
22 changes: 14 additions & 8 deletions src/createTokenBridgePrepareSetWethGatewayTransactionRequest.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,31 @@
import { Address, PublicClient, encodeFunctionData, parseAbi } from 'viem';

import { validParentChainId } from './types/ParentChain';
import { isCustomFeeTokenChain } from './utils/isCustomFeeTokenChain';
import { upgradeExecutorEncodeFunctionData } from './upgradeExecutor';
import { createTokenBridgeFetchTokenBridgeContracts } from './createTokenBridgeFetchTokenBridgeContracts';
import { createRollupFetchCoreContracts } from './createRollupFetchCoreContracts';
import { publicClientToProvider } from './ethers-compat/publicClientToProvider';
import { getEstimateForSettingGateway } from './createTokenBridge-ethers';
import { GasOverrideOptions, applyPercentIncrease } from './utils/gasOverrides';
import { Prettify } from './types/utils';
import { validParentChainId } from './types/ParentChain';
import { WithTokenBridgeCreatorAddressOverride } from './types/createTokenBridgeTypes';

export type TransactionRequestRetryableGasOverrides = {
gasLimit?: GasOverrideOptions;
maxFeePerGas?: GasOverrideOptions;
maxSubmissionCost?: GasOverrideOptions;
};

export type CreateTokenBridgePrepareRegisterWethGatewayTransactionRequestParams = {
rollup: Address;
parentChainPublicClient: PublicClient;
orbitChainPublicClient: PublicClient;
account: Address;
retryableGasOverrides?: TransactionRequestRetryableGasOverrides;
};
export type CreateTokenBridgePrepareRegisterWethGatewayTransactionRequestParams = Prettify<
WithTokenBridgeCreatorAddressOverride<{
rollup: Address;
parentChainPublicClient: PublicClient;
orbitChainPublicClient: PublicClient;
account: Address;
retryableGasOverrides?: TransactionRequestRetryableGasOverrides;
}>
>;

const parentChainGatewayRouterAbi = [
{
Expand Down Expand Up @@ -90,6 +94,7 @@ export async function createTokenBridgePrepareSetWethGatewayTransactionRequest({
orbitChainPublicClient,
account,
retryableGasOverrides,
tokenBridgeCreatorAddressOverride,
}: CreateTokenBridgePrepareRegisterWethGatewayTransactionRequestParams) {
const chainId = parentChainPublicClient.chain?.id;

Expand Down Expand Up @@ -118,6 +123,7 @@ export async function createTokenBridgePrepareSetWethGatewayTransactionRequest({
const tokenBridgeContracts = await createTokenBridgeFetchTokenBridgeContracts({
inbox,
parentChainPublicClient,
tokenBridgeCreatorAddressOverride,
});

// check whether the weth gateway is already registered in the router
Expand Down

0 comments on commit d428e9a

Please sign in to comment.