A barebones implementation of a gasback contract that implements RIP-7767.
- The
baseFeeVaultis deployed at0x4200000000000000000000000000000000000019. - The
WITHDRAWAL_NETWORKof thebaseFeeVaultis set to1.
See script/Delegate7702.s.sol for an automated script that can help you deploy.
This script requires you to have the private key of the baseFeeVault recipient in your environment.
For more information on how to run a foundry script, see https://getfoundry.sh/guides/scripting-with-solidity.
-
Deploy the
gasbackcontract which will be used as an implementation via EIP-7702. -
Use EIP-7702 to make the EOA
RECIPIENTof thebaseFeeVaultdelegated to thegasbackimplementation.
After delegating, use the EOA to call functions on itself to initialize the parameters:setGasbackRatioNumerator(uint256)
900000000000000000setGasbackMaxBaseFee(uint256)
115792089237316195423570985008687907853269984665640564039457584007913129639935setBaseFeeVault(address)
0x4200000000000000000000000000000000000019
-
Put or leave some ETH into the EOA
RECIPIENT, which will be the actualgasbackcontract. The ETH will act as a buffer that will be temporarily dished out to contracts calling the EOARECIPIENTin the span of a single block. The base fees collected in a block will only be accrued into thebaseFeeVaultat the end of a block. Try not to empty ETH from theRECIPIENTwhen you are actually taking out ETH from it. -
For better discoverabiity (for the devX), deploy the
gasbackBeaconand use the system address to set the EOARECIPIENT.
The exact CREATE2 instructions are in./deployments.md.