Git Source

Inherits: FacetCommonImports

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

This contract is a critical component of the Rules Engine

This contract contains worker functions and initialization functions.

State Variables

initialized

bool private initialized;

Functions

initialize

Initializes the Rules Engine with the specified owner.

This function sets the initial owner of the diamond and ensures the contract is only initialized once.

function initialize(address owner) external onlyOnce;

Parameters

NameTypeDescription
owneraddressThe initial owner of the diamond.

retrieveRawStringFromInstructionSet

Retrieves the raw string associated with a specific instruction set within a rule and policy.

This function is used to fetch a StringVerificationStruct containing the raw string data.

function retrieveRawStringFromInstructionSet(uint256 policyId, uint256 ruleId, uint256 instructionSetId)
    public
    view
    returns (StringVerificationStruct memory retVal);

Parameters

NameTypeDescription
policyIduint256The ID of the policy containing the rule.
ruleIduint256The ID of the rule containing the instruction set.
instructionSetIduint256The ID of the instruction set to retrieve the raw string from.

Returns

NameTypeDescription
retValStringVerificationStructA StringVerificationStruct containing the raw string data for the specified instruction set.

retrieveRawAddressFromInstructionSet

Retrieves the raw address from a specific instruction set.

This function is used to fetch the raw address associated with a given policy ID, rule ID, and instruction set ID.

function retrieveRawAddressFromInstructionSet(uint256 policyId, uint256 ruleId, uint256 instructionSetId)
    public
    view
    returns (AddressVerificationStruct memory retVal);

Parameters

NameTypeDescription
policyIduint256The ID of the policy to which the rule belongs.
ruleIduint256The ID of the rule within the policy.
instructionSetIduint256The ID of the instruction set to retrieve the address verification structure from.

Returns

NameTypeDescription
retValAddressVerificationStructThe AddressVerificationStruct containing the raw address data.

_retreiveRawEncodedFromInstructionSet

Retrieves the raw encoded data and instruction set value from a given instruction set ID.

function _retreiveRawEncodedFromInstructionSet(
    uint256 _policyId,
    uint256 _ruleId,
    uint256 _instructionSetId,
    ParamTypes _pType
) internal view returns (uint256 instructionSetValue, bytes memory encoded);

Parameters

NameTypeDescription
_policyIduint256The ID of the policy associated with the instruction set.
_ruleIduint256The ID of the rule associated with the instruction set.
_instructionSetIduint256The ID of the instruction set to retrieve data from.
_pTypeParamTypesThe parameter type (PT) associated with the instruction set.

Returns

NameTypeDescription
instructionSetValueuint256The value of the instruction set.
encodedbytesThe raw encoded data associated with the instruction set.

onlyOnce

Ensures that the function it modifies can only be executed once.

This modifier checks if the contract has already been initialized and prevents re-initialization. If the contract is already initialized, it reverts with “Already initialized”.

modifier onlyOnce();