diff --git a/libs/tx-builder/src/utils/constants.ts b/libs/tx-builder/src/utils/constants.ts index bef71f99..c73cf36a 100644 --- a/libs/tx-builder/src/utils/constants.ts +++ b/libs/tx-builder/src/utils/constants.ts @@ -4,7 +4,7 @@ import { LOCAL_ABI } from '@daohaus/abis'; export const EXPIRY = '.proposalExpiry'; export const FORM = '.formValues'; export const CURRENT_DAO = '.daoId'; -export const gasBufferMultiplier = 3; +export const gasBufferMultiplier = 5; export const BaalContractBase = { type: 'local', contractName: 'Baal', diff --git a/libs/utils/src/constants/proposals.ts b/libs/utils/src/constants/proposals.ts index d3369f9e..21c578b1 100644 --- a/libs/utils/src/constants/proposals.ts +++ b/libs/utils/src/constants/proposals.ts @@ -105,3 +105,8 @@ export const PROPOSAL_FILTERS: Record = { failed: 'Defeated', expired: 'Expired', }; + +export const GAS_BUFFER_MULTIPLIER = 5; +// Adding to the gas limit to account for cost of processProposal +export const PROCESS_PROPOSAL_GAS_LIMIT_ADDITION = 150000; +export const L2_ADDITIONAL_GAS = 5000000; diff --git a/libs/utils/src/utils/gas.ts b/libs/utils/src/utils/gas.ts index db914c8d..8cfd470e 100644 --- a/libs/utils/src/utils/gas.ts +++ b/libs/utils/src/utils/gas.ts @@ -1,10 +1,11 @@ import { ValidNetwork } from '@daohaus/keychain-utils'; import { weiUnits, formatUnits, parseGwei } from 'viem'; import { createViemClient } from './viem'; - -// Adding to the gas limit to account for cost of processProposal -export const PROCESS_PROPOSAL_GAS_LIMIT_ADDITION = 150000; -export const L2_ADDITIONAL_GAS = 5000000; +import { + GAS_BUFFER_MULTIPLIER, + L2_ADDITIONAL_GAS, + PROCESS_PROPOSAL_GAS_LIMIT_ADDITION, +} from '../constants'; // OPTIMISM challenge - how to display this estimated gas fee like we do on other networks. // ethers.js getFeeData returns maxFeePerGas as undefined, might need to use gasPrice some how, then fetch the L1 amount @@ -32,13 +33,14 @@ export const getProcessingGasLimit = ( ? Number(actionGasEstimate) + PROCESS_PROPOSAL_GAS_LIMIT_ADDITION + L2_ADDITIONAL_GAS - : PROCESS_PROPOSAL_GAS_LIMIT_ADDITION * 3.6 + L2_ADDITIONAL_GAS + : PROCESS_PROPOSAL_GAS_LIMIT_ADDITION * GAS_BUFFER_MULTIPLIER + + L2_ADDITIONAL_GAS ); } return BigInt( Number(actionGasEstimate) > 0 ? Number(actionGasEstimate) + PROCESS_PROPOSAL_GAS_LIMIT_ADDITION - : PROCESS_PROPOSAL_GAS_LIMIT_ADDITION * 3.6 + : PROCESS_PROPOSAL_GAS_LIMIT_ADDITION * GAS_BUFFER_MULTIPLIER ); };