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

Conversation

vponline
Copy link
Contributor

@vponline vponline commented May 5, 2022

Small fix to change gasPriceMultiplier into a BigNumber before using in calculations.

@vponline vponline self-assigned this May 5, 2022
@@ -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).

@vponline vponline requested a review from acenolaza May 5, 2022 19:04
Copy link
Contributor

@acenolaza acenolaza left a comment

Choose a reason for hiding this comment

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

Thanks 😁

@vponline vponline merged commit 04d15a5 into master May 7, 2022
@vponline vponline deleted the gas-price-multiplier branch May 7, 2022 13:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants