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

fix(etherscan)!: change the GasOracle fields to be f64 #2325

Merged
merged 3 commits into from
Apr 5, 2023
Merged

fix(etherscan)!: change the GasOracle fields to be f64 #2325

merged 3 commits into from
Apr 5, 2023

Conversation

shekohex
Copy link
Contributor

@shekohex shekohex commented Apr 5, 2023

Motivation

Closes #2324

Solution

This updates the GasOracle's {safe_gase_price,propose_gas_price,fast_gas_price} from u64 to f64

BREAKING CHANGE: This considered a public api breaking change, since f64 and u64 is not compatible with each other.

PR Checklist

  • Added Tests
  • Added Documentation
  • Breaking changes

This updates the `GasOracle`'s {safe_gase_price,propose_gas_price,fast_gas_price} from `u64` to `f64` to fix [BUG] Failed to deserialize etherscan response: data did not match any variant of untagged enum ResponseData #2324

BREAKING CHANGE: This considered a public api breaking change, since `f64` and `u64` is not compatible with each other.
@shekohex shekohex marked this pull request as ready for review April 5, 2023 12:39
Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

judging from the json in the reference issue this lgtm,

would like to see a test with that json and ideally a client test for mainnet as well, see lib.rs test cases

This a required change after chaning the gas prices to be `f64`
@shekohex shekohex requested a review from mattsse April 5, 2023 13:10
@shekohex
Copy link
Contributor Author

shekohex commented Apr 5, 2023

Tested Locally with the repo in #2324 with my new updates and works correctly 🎉 !

INFO ethers_etherscan_issue: Gas Oracle Info, gas_oracle: Ok(GasOracle { safe_gas_price: 110.4, propose_gas_price: 127.4, fast_gas_price: 134.0, last_block: 41173362, suggested_base_fee: 80.380853619, gas_used_ratio: [0.447337990736135, 0.250362882144311, 0.414055028555671, 0.799576101506245, 0.419134294964152] })
    at src/main.rs:39

Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

lgtm

@prestwich prestwich merged commit 478e737 into gakonst:master Apr 5, 2023
15 of 16 checks passed
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.

[BUG] Failed to deserialize etherscan response: data did not match any variant of untagged enum ResponseData
3 participants