We could charge the exact amount of GRT to the stale Indexer. This could be done using the BASEFEE opcode, a flash loan, Chainlink for an ETH-GRT oracle, and a few DEX swaps.
@Sam Is it actually possible to determine the exact cost of closeAllocation()
from within a contract if the assumption is that Flashbots could be used to submit the tx? If a Flashbots searcher could opt to pay the miner through coinbase transfers and/or gas fees, a contract could determine the base fee (via the BASEFEE opcode), but I’m not sure the contract can determine the value of the coinbase transfer and/or priority fee ahead of time to calculate the amount of GRT that should be taken from the stale allocation.
The way to factor in the cost of closeAllocation()
seems to be the described workflow where closeAllocation()
sends the caller the GRT which can then be swapped into ETH to cover a coinbase.transfer()
- the searcher would then simulate locally before sending a bundle to determine whether the amount of GRT will be sufficient to cover the bundle gas price that it wants to bid. But, the calculation of the amount of GRT wouldn’t have as inputs the bundle gas price.
One possible workaround would be to have two phases where in the first phase anyone can close with 0x0 and there is a second phase where the penalty increases over time. The reason this may work is that the grantor of a vesting contract could revoke and then call 0x0 to retrieve their funds, preventing others from obtaining them.
@That3Percent IIUC grantor would only be able to retrieve its funds if it also participates as a searcher and out bids all other searchers for tx priority to call closeAllocation()
right? So, the grantor wouldn’t necessarily have a guarantee here.
FWIW looks like Maker’s Liquidation 2.0 module uses a DAI reward with a constant component that is meant to cover gas costs and that is adjustable via governance as well as a component that grows linearly with the debt size of a vault so it could be worthwhile to take a look at how that incentive structure has fared for the system thus far.