GasFeeThrottler Contract
Last Update: February 2023
Last updated
Was this helpful?
Last Update: February 2023
Last updated
Was this helpful?
The (formerly GasThrottler) is a smart contract device used to ensure that gas prices for child contract transactions always fall below a fixed maximum, or otherwise causes the transaction to be reverted. To do so, it points to a specific , where the maximum gas price can be configured by the contract's owner. The GasFeeThrottler is incorporated into every Strategy Contract.
The throttler contract has three main elements which are inherited by its child contracts:
the shouldGasThrottle variable - which is boolean fixed to "true" to indicate that a child contract has inherited gas throttling;
the gasPrice variable - which connects the throttler to GasPrice.sol to identify the max gas price fixed by that contract; and
the gasThrottle() modifier - which requires that gas prices for transactions arising from the child contract's modified functions always are equal to or below the fixed max gas price.
The GasPrice contract provides three core elements to facilitate its purpose:
a NewMaxGasPrice event - which is triggered on changes to the maxGasPrice variable, and returns the old and new prices for external reference; and
the setMaxGasPrice function - which accepts an integer value for the new _maxGasPrice as an argument, emits the NewMaxGasPrice event and updates the maxGasPrice variable.
the maxGasPrice variable - which stores the current maximum gas price value set by the contract, and can be called externally using the interface;