The AtlasConstants contract centralizes the definition of various internal constants used throughout the Atlas Protocol. By consolidating these constants, the protocol ensures consistency, maintainability, and clarity across its contracts and libraries.
Constants
Atlas Constants
Constant Name | Type | Value | Description |
---|
_GAS_VALUE_DECIMALS_TO_DROP | uint256 | 1e9 | Represents the number of decimals to drop from gas values, measured in gwei. |
_UNLOCKED | uint256 | 0 | Represents an unlocked state or default value. |
_BITS_FOR_INDEX | uint256 | 16 | Number of bits reserved for indexing in bid finding iterations. |
Escrow Constants
Constant Name | Type | Value | Description |
---|
_VALIDATION_GAS_LIMIT | uint256 | 500,000 | Maximum gas limit allocated for validation processes. |
_FASTLANE_GAS_BUFFER | uint256 | 125,000 | Buffer gas allocated for FastLane operations. |
Gas Accounting Constants
Constant Name | Type | Value | Description |
---|
_CALLDATA_LENGTH_PREMIUM | uint256 | 32 | Additional calldata length premium, calculated as double the default (16 bits). |
_BASE_TRANSACTION_GAS_USED | uint256 | 21,000 | Base gas used for a standard Ethereum transaction. |
_SOLVER_OP_BASE_CALLDATA | uint256 | 608 | Calldata length for a SolverOperation excluding the data field. |
_SOLVER_BASE_GAS_USED | uint256 | 5,000 | Base gas charged to solvers in _handleSolverAccounting(). |
_BUNDLER_GAS_PENALTY_BUFFER | uint256 | 500,000 | Gas penalty buffer allocated for bundler-related operations. |
Solver Lock Masks
Constant Name | Type | Value | Description |
---|
_SOLVER_CALLED_BACK_MASK | uint256 | 1 << 161 | Mask to check if the solver has called back via reconcile. |
_SOLVER_FULFILLED_MASK | uint256 | 1 << 162 | Mask to check if the solver's outstanding debt has been repaid via reconcile. |
Phase Lock Mask
Constant Name | Type | Value | Description |
---|
_LOCK_PHASE_MASK | bytes32 | 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 | Used to set the Lock phase without altering activeEnvironment or callConfig. |
Error Threshold
Constant Name | Type | Value | Description |
---|
_GRACEFUL_RETURN_THRESHOLD | uint8 | 20 | Threshold for ValidCallsResult after which metacall will gracefully return instead of reverting. |
Atlas Verification Constants
Constant Name | Type | Value | Description |
---|
_FULL_BITMAP | uint256 | _FIRST_240_BITS_TRUE_MASK | Represents a full bitmap for nonce tracking. |
_NONCES_PER_BITMAP | uint256 | 240 | Number of nonces tracked per bitmap. |
_MAX_SOLVERS | uint8 | 254 | Maximum number of solvers allowed (255 - 1). |
Shared Constants
Constant Name | Type | Value | Description |
---|
_FIRST_240_BITS_TRUE_MASK | uint256 | 0x0000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF | Mask to represent the first 240 bits set to true. |
_FIRST_16_BITS_TRUE_MASK | uint256 | 0xFFFF | Mask to represent the first 16 bits set to true. |
_FIRST_4_BITS_TRUE_MASK | uint256 | 0xF | Mask to represent the first 4 bits set to true. |
Usage Notes
- Centralized Configuration: By defining constants in a centralized contract, the protocol ensures that all components reference the same values, preventing discrepancies and enhancing maintainability.
- Gas Optimization: Constants related to gas usage and accounting help in optimizing contract operations, ensuring efficient resource utilization.
- Security Enhancements: Masks and thresholds are used to enforce security rules and operational constraints, safeguarding the protocol against malicious activities and unintended behaviors.