Skip to content

Commit

Permalink
fix(payablegaslimit): fix payable gas limit bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Brenzee committed Nov 21, 2024
1 parent 397397d commit 453d0de
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/batchMultiSigCall/versions/v020201/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,13 @@ export class Version_020201 extends Version_old {
}

getLimitsMessage(FCT: BatchMultiSigCall): Record<string, any> {
const FCTOptions = FCT.generatedOptions;
const FCTOptions = FCT.options;
return {
valid_from: FCTOptions.validFrom,
expires_at: FCTOptions.expiresAt,
tx_data_limit: "0",
payable_gas_limit: FCTOptions.payableGasLimit,
payable_gas_limit:
FCTOptions.payableGasLimit === undefined ? FCT.utils.getMaxGasIgnoreCalldata() : FCTOptions.payableGasLimit,
max_payable_gas_price: FCTOptions.maxGasPrice,
purgeable: FCTOptions.purgeable,
blockable: FCTOptions.blockable,
Expand All @@ -93,7 +94,6 @@ export class Version_020201 extends Version_old {
throw new Error("No calls added to FCT");
}
const options = FCT.options;
const maxGas = FCT.utils.getMaxGasIgnoreCalldata();
const initialGasLimits: Record<number, string> = {};

if ((FCT.isImported && strictGasLimits === false) || (!FCT.isImported && !strictGasLimits)) {
Expand All @@ -108,6 +108,8 @@ export class Version_020201 extends Version_old {
}

const typedData = new EIP712(FCT).getTypedData();
const payableGasLimit = typedData.message.limits.payable_gas_limit;

const FCTData = {
typedData,
typeHash: hexlify(TypedDataUtils.hashType(typedData.primaryType as string, typedData.types)),
Expand All @@ -127,7 +129,7 @@ export class Version_020201 extends Version_old {
variables: [],
txDataLimit: "0",
// payableGasLimit: "0",
payableGasLimit: options.payableGasLimit === undefined ? maxGas : options.payableGasLimit,
payableGasLimit,
};
if (!strictGasLimits) {
FCT.calls.forEach((call, i) => {
Expand Down

0 comments on commit 453d0de

Please sign in to comment.