Skip to content

Commit f4bd91c

Browse files
authored
Reapply "feat: custom gas token (#10143)" (#10384) (#10395)
Now that the fault proof contracts release has happened, we can merge in the custom gas token changes. This reverts commit 2b1c99b.
1 parent a6d4eed commit f4bd91c

File tree

69 files changed

+5006
-1370
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+5006
-1370
lines changed

op-bindings/bindings/l1block.go

Lines changed: 316 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

op-bindings/bindings/l1crossdomainmessenger.go

Lines changed: 45 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

op-bindings/bindings/l1standardbridge.go

Lines changed: 45 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

op-bindings/bindings/l2crossdomainmessenger.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

op-bindings/bindings/l2standardbridge.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

op-bindings/bindings/optimismportal.go

Lines changed: 120 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

op-bindings/bindings/systemconfig.go

Lines changed: 147 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

op-bindings/bindings/weth.go

Lines changed: 1133 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

op-bindings/predeploys/addresses.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import "github.com/ethereum/go-ethereum/common"
88
const (
99
L2ToL1MessagePasser = "0x4200000000000000000000000000000000000016"
1010
DeployerWhitelist = "0x4200000000000000000000000000000000000002"
11-
WETH9 = "0x4200000000000000000000000000000000000006"
11+
WETH = "0x4200000000000000000000000000000000000006"
1212
L2CrossDomainMessenger = "0x4200000000000000000000000000000000000007"
1313
L2StandardBridge = "0x4200000000000000000000000000000000000010"
1414
SequencerFeeVault = "0x4200000000000000000000000000000000000011"
@@ -41,7 +41,7 @@ const (
4141
var (
4242
L2ToL1MessagePasserAddr = common.HexToAddress(L2ToL1MessagePasser)
4343
DeployerWhitelistAddr = common.HexToAddress(DeployerWhitelist)
44-
WETH9Addr = common.HexToAddress(WETH9)
44+
WETHAddr = common.HexToAddress(WETH)
4545
L2CrossDomainMessengerAddr = common.HexToAddress(L2CrossDomainMessenger)
4646
L2StandardBridgeAddr = common.HexToAddress(L2StandardBridge)
4747
SequencerFeeVaultAddr = common.HexToAddress(SequencerFeeVault)
@@ -77,7 +77,7 @@ var (
7777
func init() {
7878
Predeploys["L2ToL1MessagePasser"] = &Predeploy{Address: L2ToL1MessagePasserAddr}
7979
Predeploys["DeployerWhitelist"] = &Predeploy{Address: DeployerWhitelistAddr}
80-
Predeploys["WETH9"] = &Predeploy{Address: WETH9Addr, ProxyDisabled: true}
80+
Predeploys["WETH"] = &Predeploy{Address: WETHAddr, ProxyDisabled: true}
8181
Predeploys["L2CrossDomainMessenger"] = &Predeploy{Address: L2CrossDomainMessengerAddr}
8282
Predeploys["L2StandardBridge"] = &Predeploy{Address: L2StandardBridgeAddr}
8383
Predeploys["SequencerFeeVault"] = &Predeploy{Address: SequencerFeeVaultAddr}

op-chain-ops/genesis/config.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,10 @@ type DeployConfig struct {
247247
// UseFaultProofs is a flag that indicates if the system is using fault
248248
// proofs instead of the older output oracle mechanism.
249249
UseFaultProofs bool `json:"useFaultProofs"`
250-
250+
// UseCustomGasToken is a flag to indicate that a custom gas token should be used
251+
UseCustomGasToken bool `json:"useCustomGasToken"`
252+
// CustomGasTokenAddress is the address of the ERC20 token to be used to pay for gas on L2.
253+
CustomGasTokenAddress common.Address `json:"customGasTokenAddress"`
251254
// UsePlasma is a flag that indicates if the system is using op-plasma
252255
UsePlasma bool `json:"usePlasma"`
253256
// DAChallengeWindow represents the block interval during which the availability of a data commitment can be challenged.
@@ -426,6 +429,12 @@ func (d *DeployConfig) Check() error {
426429
return fmt.Errorf("%w: DAResolveWindow cannot be 0 when using plasma mode", ErrInvalidDeployConfig)
427430
}
428431
}
432+
if d.UseCustomGasToken {
433+
if d.CustomGasTokenAddress == (common.Address{}) {
434+
return fmt.Errorf("%w: CustomGasTokenAddress cannot be address(0)", ErrInvalidDeployConfig)
435+
}
436+
log.Info("Using custom gas token", "address", d.CustomGasTokenAddress)
437+
}
429438
// checkFork checks that fork A is before or at the same time as fork B
430439
checkFork := func(a, b *hexutil.Uint64, aName, bName string) error {
431440
if a == nil && b == nil {

0 commit comments

Comments
 (0)