System Config

Table of Contents

Feature Flag System

Bitmap-based Feature Detection

The CGT implementation uses a bitmap-based feature flag system that provides efficient storage and allows multiple features to be tracked in a single storage slot.

Implementation:

  • Uses isFeatureEnabled[Features.CUSTOM_GAS_TOKEN] bitmap approach
  • Enables efficient checking of multiple features
  • Provides gas-optimized feature detection across contracts

Feature Checking

Contracts check for CGT mode by querying the SystemConfig contract:

systemConfig.isFeatureEnabled(Features.CUSTOM_GAS_TOKEN)

Definitions

Feature Flag Bitmap

The SystemConfig contract contains a mapping isFeatureEnabled that uses bitmaps to efficiently track multiple features including Custom Gas Token mode.

mapping(uint256 => bool) public isFeatureEnabled;

Function Specification

isFeatureEnabled

Returns true if the specified feature is enabled, false otherwise.

function isFeatureEnabled(uint256 _feature) external view returns (bool)

For Custom Gas Token mode, contracts check:

  • isFeatureEnabled[Features.CUSTOM_GAS_TOKEN]

This provides an efficient way to query feature states across the system.