Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert gasPriceMultiplier to BigNumber #1073

Merged
merged 3 commits into from
May 7, 2022
Merged
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const parsePriorityFee = ({ value, unit }: PriorityFee) =>
ethers.utils.parseUnits(value.toString(), unit ?? 'wei');

export const multiplyGasPrice = (gasPrice: BigNumber, gasPriceMultiplier: number) =>
gasPrice.mul(Math.round(gasPriceMultiplier * 100)).div(BigNumber.from(100));
gasPrice.mul(BigNumber.from(Math.round(gasPriceMultiplier * 100))).div(BigNumber.from(100));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this needed? Afaik BigNumber accepts regular numbers as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is mostly for consistency (pointed out in #1043) as all the other numbers are converted to BigNumber in gas-prices (and mostly elsewhere in Airnode I believe).


export const getLegacyGasPrice = async (options: FetchOptions): Promise<LogsData<GasTarget | null>> => {
const { provider, chainOptions } = options;
Expand Down