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

Feature request: Allow for setting custom eth price 🙏 #65

Closed
DenhamPreen opened this issue May 21, 2021 · 8 comments
Closed

Feature request: Allow for setting custom eth price 🙏 #65

DenhamPreen opened this issue May 21, 2021 · 8 comments

Comments

@DenhamPreen
Copy link

Feature request

It would be a nice configuration to be able to set the price of eth when doing gas price calculations.

This would allow users to view the gas costs for a given eth price.

A side benefit would allow approx usage when using on EVM layer2's. Ie. Could set the price of 'eth' to the price of Matic when testing on Polygon.

@cgewecke
Copy link
Owner

cgewecke commented May 21, 2021

If a new option called cryptoCurrency were added that let you specify the crypto side of the crypto/fiat pair would that work for your use case?

The coinmarketcap API is flexible about this and the gas reporter could make it configurable in the code here

    const coinmarketcap =
      `https://pro-api.coinmarketcap.com/v1/cryptocurrency/quotes/` +
      `latest?symbol=ETH&CMC_PRO_API_KEY=${config.coinmarketcap}&convert=`;


    const currencyKey = config.currency.toUpperCase();
    const currencyPath = `${coinmarketcap}${currencyKey}`;

The execution costs on Polygon are so low that the gas reporter (w/ 2 decimals of precision for fiat) might not show data for a lot of smaller calls...

If the math below is correct, the worst case cost on Polygon right now (for a whole block at fastest) is $0.25

> (7.5 gwei / 1e9) * ($1.70) * 20_000_000 gas
0.25499999999999995

A 300k tx at standard is $0.00051

> (1 gwei / 1e9) * ($1.70) * 300_000 gas
0.00051

Resources

  • Polygon gas prices: curl https://gasstation-mainnet.matic.network

@cgewecke
Copy link
Owner

@DenhamPreen

Out of curiosity, would adding more decimal places of precision for fiat pricing be useful to you?

If so, could you describe how you're using this data?

@DenhamPreen
Copy link
Author

@cgewecke! Thank you for such a detailed response.

Yes, this would work for our use case.

Additional decimal places would be useful in this scenario.

Our use case is a purely nice to have, in our https://docs.float.capital we are displaying the approx gas prices to users for different contract calls.

Less critical with polygon due to the low gas prices making the need or cost to user mostly negligible.

@DenhamPreen
Copy link
Author

The math on max possible usd cost of a tx on polygon really emphasizes this 😆

@pasevin
Copy link

pasevin commented Jul 23, 2021

Any updates on this, it would be very useful.

@stevyhacker
Copy link
Contributor

This would be very useful, I'd like to try to implement it and open a PR for this if this feature is not already in development?

@tolstenko
Copy link

I am in the same boat. Any updates? @stevyhacker did you make it?

@cgewecke
Copy link
Owner

This is supported in v1.0.5. You can now pick any token to denominate the cost in and configure an endpoint to fetch network specific gas prices for.

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

No branches or pull requests

5 participants