Skip to content

Commit

Permalink
Fix typing with decimals
Browse files Browse the repository at this point in the history
  • Loading branch information
chrstph-dvx committed Oct 23, 2024
1 parent 95aac42 commit 36d5f96
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/createRollup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ export async function createRollup<TChain extends Chain | undefined>({
});
const maxFeePerGas = nativeTokenDecimalsTo18Decimals({
amount: params.maxFeePerGasForRetryables ?? createRollupDefaults.maxFeePerGasForRetryables,
decimals,
decimals: Number(decimals),
});

// prepare the transaction for deploying the core contracts
Expand Down
2 changes: 1 addition & 1 deletion src/createRollupPrepareTransactionRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export async function createRollupPrepareTransactionRequest<TChain extends Chain
});
paramsWithDefaults.maxFeePerGasForRetryables = scaleToNativeTokenDecimals({
amount: paramsWithDefaults.maxFeePerGasForRetryables,
decimals,
decimals: Number(decimals),
});
}

Expand Down
2 changes: 1 addition & 1 deletion src/createTokenBridge.integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ async function checkWethGateways(
expect(tokenBridgeContracts.orbitChainContracts.wethGateway).not.toEqual(zeroAddress);
}

const nativeTokenDecimals = Number(process.env.DECIMALS) ?? 18;
const nativeTokenDecimals = process.env.DECIMALS ? Number(process.env.DECIMALS) : 18;

describe('createTokenBridge utils function', () => {
it(`successfully deploys token bridge contracts through token bridge creator`, async () => {
Expand Down
5 changes: 4 additions & 1 deletion src/createTokenBridgeEnoughCustomFeeTokenAllowance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ export async function createTokenBridgeEnoughCustomFeeTokenAllowance<
const decimals = await getNativeTokenDecimals({ publicClient, nativeTokenAddress: nativeToken });
return (
allowance >=
scaleToNativeTokenDecimals({ amount: createTokenBridgeDefaultRetryablesFees, decimals })
scaleToNativeTokenDecimals({
amount: createTokenBridgeDefaultRetryablesFees,
decimals: Number(decimals),
})
);
}

0 comments on commit 36d5f96

Please sign in to comment.