I finally stopped getting rekt by gas fees long enough to write this Python script to track the costs. It's pretty hacky right now, so please roast my code or tell me where I messed up. Looking for any feedback to make it less garbage.
your script looks solid, i can see you're monitoring multiple chains and even handling some edge cases pretty smoothly. just one nitpick - you might want to consider adding some error handling for situations where the API request fails, would make it more robust. also, how are you planning on handling variable gas fees across different chains?
I'd be happy to help you out, but I'm more of a JS guy myself. That being said, just a random question, are you storing the gas prices in a database or just caching them in memory? Either way, would be helpful to know what kind of scalability you're planning for.
just skimmed over the code, looks clean, but you might want to consider using a more robust gas price API like EthGasStation, also you could add some error handling for cases where the API is down.
Bold move asking for a roast on main, hope you're ready for the comments lol. Make sure you're using async or that script is gonna choke when gas actually spikes.