Functions
createRule
Creates a rule in storage. Adds a new rule to the specified policy. Only accessible by policy admins.Name | Type | Description |
---|---|---|
policyId | uint256 | ID of the policy the rule will be added to. |
rule | Rule | The rule to create. |
ruleName | string | The name of the rule |
ruleDescription | string | The description of the rule |
Name | Type | Description |
---|---|---|
<none> | uint256 | ruleId The generated rule ID. |
updateRule
Updates a rule in storage. Modifies an existing rule in the specified policy. Only accessible by policy admins.Name | Type | Description |
---|---|---|
policyId | uint256 | ID of the policy the rule belongs to. |
ruleId | uint256 | The ID of the rule to update. |
rule | Rule | The updated rule data. |
ruleName | string | |
ruleDescription | string |
Name | Type | Description |
---|---|---|
<none> | uint256 | ruleId The updated rule ID. |
getAllRules
Retrieves all rules associated with a specific policy.Name | Type | Description |
---|---|---|
policyId | uint256 | The ID of the policy. |
Name | Type | Description |
---|---|---|
<none> | Rule[][] | rules A two-dimensional array of rules grouped by calling functions. |
getRuleMetadata
Retrieves the metadata of a rule.Name | Type | Description |
---|---|---|
policyId | uint256 | The ID of the policy the rule belongs to. |
ruleId | uint256 | The ID of the rule to retrieve metadata for. |
Name | Type | Description |
---|---|---|
<none> | RuleMetadata | RuleMetadata The metadata of the specified rule. |
deleteRule
Deletes a rule from storage.Name | Type | Description |
---|---|---|
policyId | uint256 | The ID of the policy the rule belongs to. |
ruleId | uint256 | The ID of the rule to delete. |
getRule
Retrieves a rule from storage.Name | Type | Description |
---|---|---|
policyId | uint256 | The ID of the policy the rule belongs to. |
ruleId | uint256 | The ID of the rule to retrieve. |
Name | Type | Description |
---|---|---|
<none> | RuleStorageSet | ruleStorageSets The rule data. |
getMemorySize
getMaxLoopSize
getOpsSize1
getOpsSizeUpTo2
getOpsSizeUpTo3
getOpsTotalSize
_storeRuleData
Stores rule data in storage. This function is used to store the rule and its metadata.Name | Type | Description |
---|---|---|
data | RuleStorage | The rule storage structure. |
policyId | uint256 | The ID of the policy the rule belongs to. |
ruleId | uint256 | The ID of the rule to store. |
rule | Rule | The rule to store. |
ruleName | string | The name of the rule. |
ruleDescription | string | The description of the rule. |
_storeRule
Stores a rule in storage. Validates the policy existence before storing the rule.Name | Type | Description |
---|---|---|
_data | RuleStorage | The rule storage structure. |
_policyId | uint256 | The ID of the policy the rule belongs to. |
_ruleId | uint256 | The ID of the rule to store. |
_rule | Rule | The rule to store. |
Name | Type | Description |
---|---|---|
<none> | uint256 | ruleId The stored rule ID. |
_updateTrackerIdMapping
Updates the mapping of tracker IDs to rule IDs for a specific policy. This function checks if a tracker is used in the instruction set of the rule and updates the mapping accordingly.Name | Type | Description |
---|---|---|
_data | RuleStorage | The rule storage structure. |
_policyId | uint256 | The ID of the policy to update the mapping for. |
_ruleId | uint256 | The ID of the rule to check for tracker usage. |
_removeRuleFromTrackerIdMapping
Removes a rule from the tracker ID mapping. This function checks if a tracker is used in the instruction set of the rule and removes the rule ID from the mapping.Name | Type | Description |
---|---|---|
_policyId | uint256 | The ID of the policy to update the mapping for. |
_ruleId | uint256 | The ID of the rule to check for tracker usage. |
_incrementRuleId
Increments the rule ID counter for a specific policy. This function is used to generate a new rule ID for a policy.Name | Type | Description |
---|---|---|
data | RuleStorage | The rule storage structure. |
_policyId | uint256 | The ID of the policy to increment the rule ID for. |
Name | Type | Description |
---|---|---|
<none> | uint256 | The incremented rule ID. |
_storeRuleMetadata
function to store the metadata for a rule. This function is used to store the metadata for a rule, such as its name and description.Name | Type | Description |
---|---|---|
_policyId | uint256 | The ID of the policy the rule belongs to. |
_ruleId | uint256 | The ID of the rule to store metadata for. |
_ruleName | string | The name of the rule. |
_description | string | The description of the rule. |
_validateRule
_validateEffects
Validates an array of effects.Name | Type | Description |
---|---|---|
effects | Effect[] | The effects to validate. |
policyId | uint256 | The policyId |
_validatePlaceholders
Validates an array of placeholders.Name | Type | Description |
---|---|---|
placeholders | Placeholder[] | The placeholders to validate. |
_validateInstructionSet
Validates an instruction set.Name | Type | Description |
---|---|---|
instructionSet | uint256[] | The instructionSet to validate. |
policyId | uint256 | The policyId. |
_isLessLimitedOpCode
Determines whether the given operation code’s data is considered “less limited” and can be upwards of the max loop sizeName | Type | Description |
---|---|---|
opCode | uint256 | The operation code to evaluate. |
Name | Type | Description |
---|---|---|
<none> | bool | bool Returns true if the operation code is less limited, otherwise false . |
_validateParamType
Validates a paramType.Name | Type | Description |
---|---|---|
paramType | ParamTypes | The paramType to validate. |
_validateEffectType
Validates an effect type.Name | Type | Description |
---|---|---|
effectType | EffectTypes | The effectType to validate. |
_policyAdminOnly
Checks that the caller is a policy adminName | Type | Description |
---|---|---|
_policyId | uint256 | The ID of the policy. |
_address | address | The address to check for policy admin status. |