Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
spsjvc committed Oct 24, 2024
1 parent ca7d835 commit d3a4c16
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions src/createRollupPrepareTransactionRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { isCustomFeeTokenAddress } from './utils/isCustomFeeTokenAddress';
import { ChainConfig } from './types/ChainConfig';
import { isAnyTrustChainConfig } from './utils/isAnyTrustChainConfig';
import { getRollupCreatorAddress } from './utils/getRollupCreatorAddress';
import { fetchDecimals } from './utils/erc20';
import { TransactionRequestGasOverrides, applyPercentIncrease } from './utils/gasOverrides';

import { Prettify } from './types/utils';
Expand All @@ -18,8 +19,6 @@ import {
WithRollupCreatorAddressOverride,
} from './types/createRollupTypes';
import { isKnownWasmModuleRoot, getConsensusReleaseByWasmModuleRoot } from './wasmModuleRoot';
import { getNativeTokenDecimals, scaleToNativeTokenDecimals } from './utils/decimals';
import { fetchDecimals } from './utils/erc20';

function createRollupEncodeFunctionData(args: CreateRollupFunctionInputs) {
return encodeFunctionData({
Expand Down Expand Up @@ -68,16 +67,12 @@ export async function createRollupPrepareTransactionRequest<TChain extends Chain
`"params.nativeToken" can only be used on AnyTrust chains. Set "arbitrum.DataAvailabilityCommittee" to "true" in the chain config.`,
);
}
}

// custom fee token is only allowed to have 18 decimals
if (
params.nativeToken &&
(await getNativeTokenDecimals({ nativeTokenAddress: params.nativeToken, publicClient })) > 36n
) {
throw new Error(
`"params.nativeToken" can only be configured with a token that uses 36 decimals or less.`,
);
if ((await fetchDecimals({ address: params.nativeToken, publicClient })) > 36) {
throw new Error(
`"params.nativeToken" can only be configured with a token that uses 36 decimals or less.`,
);
}
}

let maxDataSize: bigint;
Expand Down

0 comments on commit d3a4c16

Please sign in to comment.