GainsNetwork-org / nft-bot-v3

Bot that executes limit orders of gTrade v6, the decentralized leveraged trading platform on Polygon.
46 stars 39 forks source link

Small refactor to gas price fetching/setting + fixes #16

Closed drub0y closed 1 year ago

drub0y commented 1 year ago

Refactored gas price fetching/setting to address a startup timing issue with fetching gas from web3client instance before it's necessarily ready, but also reduced a lot of repetitive code.

Also fix bug related to multiple, overlapping fetches for trading variables as there are scenarios that could have triggered it and the logic that existed previously was insufficient to prevent. Considering how costly the act of refreshing is RPC wise, we want to try to avoid this by debouncing subsequent calls when there is already an outstanding fetch in progress.