Git Source

Author: @mpetersoCode55, @ShaneDuncan602, @TJ-Everett, @VoR0220

This library is a critical component of the Rules Engine, enabling modular and efficient storage management.

This library provides functions to access and manage storage positions for various components of the Rules Engine. It defines fixed storage slots for initialized flags, foreign calls, trackers, function signatures, rules, policies, and policy associations. These storage slots are used to ensure consistent and conflict-free storage management across the diamond proxy pattern.

State Variables

DIAMOND_CUT_STORAGE_ENGINE_POS

bytes32 constant DIAMOND_CUT_STORAGE_ENGINE_POS = bytes32(uint256(keccak256("diamond-cut.storage-engine")) - 1);

INITIALIZED_POSITION

bytes32 constant INITIALIZED_POSITION = bytes32(uint256(keccak256("initialized-position")) - 1);

FOREIGN_CALL_POSITION

bytes32 constant FOREIGN_CALL_POSITION = bytes32(uint256(keccak256("foreign-call-position")) - 1);

TRACKER_POSITION

bytes32 constant TRACKER_POSITION = bytes32(uint256(keccak256("tracker-position")) - 1);

FUNCTION_SIGNATURE_POSITION

bytes32 constant FUNCTION_SIGNATURE_POSITION = bytes32(uint256(keccak256("function-signature-position")) - 1);

RULE_POSITION

bytes32 constant RULE_POSITION = bytes32(uint256(keccak256("rule-position")) - 1);

POLICY_POSITION

bytes32 constant POLICY_POSITION = bytes32(uint256(keccak256("policy-position")) - 1);

POLICY_ASSOCIATION_POSITION

bytes32 constant POLICY_ASSOCIATION_POSITION = bytes32(uint256(keccak256("policy-association-position")) - 1);

Functions

initializedStorage

Retrieves the storage for the initialized flag.

Uses a fixed storage slot to avoid conflicts with other contracts.

function initializedStorage() internal pure returns (InitializedS storage ds);

Returns

NameTypeDescription
dsInitializedSThe storage structure for the initialized flag.

getForeignCallStorage

Retrieves the storage for foreign calls.

Uses a fixed storage slot to avoid conflicts with other contracts.

function getForeignCallStorage() internal pure returns (ForeignCallS storage ds);

Returns

NameTypeDescription
dsForeignCallSThe storage structure for the foreign call map.

getTrackerStorage

Retrieves the storage for trackers.

Uses a fixed storage slot to avoid conflicts with other contracts.

function getTrackerStorage() internal pure returns (TrackerS storage ds);

Returns

NameTypeDescription
dsTrackerSThe storage structure for the tracker map.

getFunctionSignatureStorage

Retrieves the storage for function signatures.

Uses a fixed storage slot to avoid conflicts with other contracts.

function getFunctionSignatureStorage() internal pure returns (FunctionSignatureS storage ds);

Returns

NameTypeDescription
dsFunctionSignatureSThe storage structure for the function signature map.

getRuleStorage

Retrieves the storage for rules.

Uses a fixed storage slot to avoid conflicts with other contracts.

function getRuleStorage() internal pure returns (RuleS storage ds);

Returns

NameTypeDescription
dsRuleSThe storage structure for the rule map.

getPolicyStorage

Retrieves the storage for policies.

Uses a fixed storage slot to avoid conflicts with other contracts.

function getPolicyStorage() internal pure returns (PolicyS storage ds);

Returns

NameTypeDescription
dsPolicySThe storage structure for the policy map.

getPolicyAssociationStorage

Retrieves the storage for policy associations.

Uses a fixed storage slot to avoid conflicts with other contracts.

function getPolicyAssociationStorage() internal pure returns (PolicyAssociationS storage ds);

Returns

NameTypeDescription
dsPolicyAssociationSThe storage structure for the policy association map.