diff --git a/op-deployer/pkg/deployer/pipeline/l2genesis.go b/op-deployer/pkg/deployer/pipeline/l2genesis.go index f2f312dc0a6..cdafc262b42 100644 --- a/op-deployer/pkg/deployer/pipeline/l2genesis.go +++ b/op-deployer/pkg/deployer/pipeline/l2genesis.go @@ -102,10 +102,10 @@ func GenerateL2Genesis(pEnv *Env, intent *state.Intent, bundle ArtifactsBundle, EnableGovernance: overrides.EnableGovernance, FundDevAccounts: overrides.FundDevAccounts, // Custom Gas Token (CGT) configuration passed to L2Genesis script - UseCustomGasToken: thisIntent.CustomGasToken.Enabled, // CGT: Enable/disable custom gas token - GasPayingTokenName: thisIntent.CustomGasToken.Name, // CGT: Token name (e.g., "Custom Gas Token") - GasPayingTokenSymbol: thisIntent.CustomGasToken.Symbol, // CGT: Token symbol (e.g., "CGT") - NativeAssetLiquidityAmount: thisIntent.CustomGasToken.NativeAssetLiquidityAmount.ToInt(), // CGT: Liquidity amount for NativeAssetLiquidity contract + UseCustomGasToken: thisIntent.CustomGasToken.Enabled, // CGT: Enable/disable custom gas token + GasPayingTokenName: thisIntent.CustomGasToken.Name, // CGT: Token name (e.g., "Custom Gas Token") + GasPayingTokenSymbol: thisIntent.CustomGasToken.Symbol, // CGT: Token symbol (e.g., "CGT") + NativeAssetLiquidityAmount: thisIntent.GetNativeAssetLiquidityAmount(), // CGT: Liquidity amount for NativeAssetLiquidity contract }); err != nil { return fmt.Errorf("failed to call L2Genesis script: %w", err) } diff --git a/op-deployer/pkg/deployer/state/chain_intent.go b/op-deployer/pkg/deployer/state/chain_intent.go index 71497dfed38..7b4e6727ad7 100644 --- a/op-deployer/pkg/deployer/state/chain_intent.go +++ b/op-deployer/pkg/deployer/state/chain_intent.go @@ -2,6 +2,7 @@ package state import ( "fmt" + "math/big" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" @@ -145,3 +146,13 @@ func (c *ChainIntent) Check() error { return nil } + +// GetNativeAssetLiquidityAmount returns the native asset liquidity amount for the chain. +// If not set, returns the default value of zero. +func (c *ChainIntent) GetNativeAssetLiquidityAmount() *big.Int { + if c.CustomGasToken != nil && c.CustomGasToken.NativeAssetLiquidityAmount != nil { + return c.CustomGasToken.NativeAssetLiquidityAmount.ToInt() + } + + return (*hexutil.Big)(big.NewInt(0)).ToInt() +}