Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
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