Currently on Ethereum Mainnet Gelato charges a small % premium on top of the ethereum gas fees for every transaction on the network. For example, if a transaction costs $10, Gelato will charge ~$11 (~10% premium), where the profit goes to the bot operator.
In order to calculate the fee that bots can charge for transaction, Gelato’s ExecFacet.sol implements a function which a) measures the gas consumed by a certain execution and b) multiplies that by the current fast gas price (chainlink).
Now, for most use cases this works pretty well on mainnet. However on Polygon for example, there is no fast gas price oracle to my understanding and thus we have to use a fixed (e.g. 1 MATIC per tx) or dynamic (e.g. 0.2% of value which flows through tx) fee model to incentivize bot operators to execute the tasks.
Moreover, having an external oracle be used in the calculation of the “fair fees” adds an additional dependency to Gelato which we cannot control as well as adds some additional gas costs for state reads.
After EIP1559 gets merged, smart contracts will be able to access the
BaseFee in solidity which we could potentially be used instead of the Chainlink Fast Gas Price Oracle. We should investigate whether we can use this BaseFee and if it actually represents (most of the time) the actual execution cost that the bot used to get a transaction mined in time.
Let’s build a first PoC that implement that and test it out to see whether fee payments can be made cheaper, more accurate and require less dependencies. It might turn out to be a worse implementation than the current one using Chainlink, in which case I am happy to just remain with our current “proven” system, but lets experiment