Skip to content

Commit

Permalink
improve(API): Apply gas mark up to base fee rather than gas cost
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholaspai committed Dec 19, 2024
1 parent 0dfe7fb commit 1a21394
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions api/_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -594,9 +594,12 @@ export const getGasMarkup = (chainId: string | number) => {
return gasMarkup[chainId];
}

return sdk.utils.chainIsOPStack(Number(chainId))
? gasMarkup[CHAIN_IDs.OPTIMISM] ?? DEFAULT_GAS_MARKUP
: DEFAULT_GAS_MARKUP;
return (
1 +
(sdk.utils.chainIsOPStack(Number(chainId))
? gasMarkup[CHAIN_IDs.OPTIMISM] ?? DEFAULT_GAS_MARKUP
: DEFAULT_GAS_MARKUP)
);
};

/**
Expand Down Expand Up @@ -641,8 +644,7 @@ const getRelayerFeeCalculatorQueries = (
overrides.spokePoolAddress || getSpokePoolAddress(destinationChainId),
overrides.relayerAddress,
REACT_APP_COINGECKO_PRO_API_KEY,
getLogger(),
getGasMarkup(destinationChainId)
getLogger()
);
};

Expand Down Expand Up @@ -1972,7 +1974,8 @@ export async function getMaxFeePerGas(chainId: number): Promise<BigNumber> {
}
const { maxFeePerGas } = await sdk.gasPriceOracle.getGasPriceEstimate(
getProvider(chainId),
chainId
chainId,
getGasMarkup(chainId)
);
return maxFeePerGas;
}
Expand Down

0 comments on commit 1a21394

Please sign in to comment.