Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions scripts/sendTokens.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {
bnZero,
ethers,
retrieveSignerFromCLIArgs,
getProvider,
Expand All @@ -8,7 +9,6 @@ import {
getGasPrice,
toGWei,
getNativeTokenSymbol,
LEGACY_TRANSACTION_CHAINS,
} from "../src/utils";
import { askYesNoQuestion } from "./utils";
import minimist from "minimist";
Expand Down Expand Up @@ -68,7 +68,7 @@ export async function run(): Promise<void> {
console.log(
`Submitting txn with maxFeePerGas ${gas.maxFeePerGas.toString()} and priority fee ${gas.maxPriorityFeePerGas.toString()} with overridden nonce ${nonce}`
);
const gasParams = LEGACY_TRANSACTION_CHAINS.includes(Number(args.chainId))
const gasParams = gas.maxPriorityFeePerGas.eq(bnZero)
? { gasPrice: gas.maxFeePerGas.add(gas.maxPriorityFeePerGas) }
: { ...gas };

Expand Down
7 changes: 2 additions & 5 deletions src/utils/TransactionUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ import {

dotenv.config();

// Define chains that require legacy (type 0) transactions
export const LEGACY_TRANSACTION_CHAINS = [CHAIN_IDs.BSC];

export type TransactionSimulationResult = {
transaction: AugmentedTransaction;
succeed: boolean;
Expand Down Expand Up @@ -339,8 +336,8 @@ function scaleGasPrice(
const scaler = toBNWei(retryScaler);
const flooredPriorityFeePerGas = parseUnits(process.env[`MIN_PRIORITY_FEE_PER_GAS_${chainId}`] || "0", 9);

// Check if the chain requires legacy transactions
if (LEGACY_TRANSACTION_CHAINS.includes(chainId)) {
// Legacy/type0 transactions are supplied as a type2 transaction with priority fee 0. Convert to type0 here.
if (gas.maxPriorityFeePerGas.eq(bnZero)) {
const gasPrice = sdkUtils.bnMax(gas.maxFeePerGas, flooredPriorityFeePerGas).mul(scaler).div(fixedPointAdjustment);
return { gasPrice };
}
Expand Down