makerdao / auction-demo-keeper

Apache License 2.0
33 stars 19 forks source link

Dynamic gas pricing strategy (GeometricGasPrice) #5

Closed KentonPrescott closed 3 years ago

KentonPrescott commented 3 years ago

Implemented pymaker's GeometricGasPrice strategy in Javascript.

In short, the GeometricGasPrice JS class takes an initial price, bumps the price every_secs, by some coefficient (defaults to 12.5%, OpenEthereum's minimum for txn replacement) and continues until a max_price is reached (if defined). Gas price is in wei.

GeometricGasPrice exposes a get_gas_price(time_elapsed) function, which takes in the seconds elapsed since the original transaction and returns the appropriate gas price.