Git Source

Inherits: RuleAdministratorOnly, ActionTypesArray, ITokenHandlerEvents, IAssetHandlerErrors

Author: @ShaneDuncan602 @oscarsernarosero @TJ-Everett

Setters and getters for the rule in the handler. Meant to be inherited by a handler facet to easily support the rule.

Functions

setAccountApproveDenyOracleId

Rule Setters and Getters

that setting a rule will automatically activate it.

Set the AccountApproveDenyOracle. Restricted to rule administrators only.

function setAccountApproveDenyOracleId(ActionTypes[] calldata _actions, uint32 _ruleId)
    external
    ruleAdministratorOnly(lib.handlerBaseStorage().appManager);

Parameters

NameTypeDescription
_actionsActionTypes[]the action types
_ruleIduint32Rule Id to set

setAccountApproveDenyOracleIdFull

that setting a rule will automatically activate it.

This function does not check that the array length is greater than zero to allow for clearing out of the action types data

Set the AccountApproveDenyOracle suite. This function works differently since the rule allows multiples per action. The actions are repeated to account for multiple oracle rules per action. Restricted to rule administrators only.

function setAccountApproveDenyOracleIdFull(ActionTypes[] calldata _actions, uint32[] calldata _ruleIds)
    external
    ruleAdministratorOnly(lib.handlerBaseStorage().appManager);

Parameters

NameTypeDescription
_actionsActionTypes[]actions to have the rule applied to
_ruleIdsuint32[]Rule Id corresponding to the actions

clearAccountApproveDenyOracle

Clear the rule data structure

function clearAccountApproveDenyOracle() internal;

setAccountApproveDenyOracleIdUpdate

that setting a rule will automatically activate it.

Set the AccountApproveDenyOracle.

function setAccountApproveDenyOracleIdUpdate(ActionTypes _action, uint32 _ruleId) internal;

Parameters

NameTypeDescription
_actionActionTypesthe action type to set the rule
_ruleIduint32Rule Id to set

_doesAccountApproveDenyOracleIdExist

Check to see if the oracle rule already exists in the array. If it does, return the index

function _doesAccountApproveDenyOracleIdExist(ActionTypes _action, uint32 _ruleId)
    internal
    view
    returns (uint256 _index, bool _found);

Parameters

NameTypeDescription
_actionActionTypesthe corresponding action
_ruleIduint32the rule’s identifier

Returns

NameTypeDescription
_indexuint256the index of the found oracle rule
_foundbooltrue if found

activateAccountApproveDenyOracle

enable/disable rule. Disabling a rule will save gas on transfer transactions.

function activateAccountApproveDenyOracle(ActionTypes[] calldata _actions, bool _on, uint32 ruleId)
    external
    ruleAdministratorOnly(lib.handlerBaseStorage().appManager);

Parameters

NameTypeDescription
_actionsActionTypes[]the action types
_onboolboolean representing if a rule must be checked or not.
ruleIduint32the id of the rule to activate/deactivate

getAccountApproveDenyOracleIds

Retrieve the account approve deny oracle rule id

function getAccountApproveDenyOracleIds(ActionTypes _action) external view returns (uint32[] memory);

Parameters

NameTypeDescription
_actionActionTypesthe action type

Returns

NameTypeDescription
<none>uint32[]oracleRuleId

isAccountApproveDenyOracleActive

Tells you if the Accont Approve Deny Oracle Rule is active or not.

function isAccountApproveDenyOracleActive(ActionTypes _action, uint32 ruleId) external view returns (bool);

Parameters

NameTypeDescription
_actionActionTypesthe action type
ruleIduint32the id of the rule to check

Returns

NameTypeDescription
<none>boolboolean representing if the rule is active

removeAccountApproveDenyOracle

Removes an account approve deny oracle rule from the list.

function removeAccountApproveDenyOracle(ActionTypes[] calldata _actions, uint32 ruleId)
    external
    ruleAdministratorOnly(lib.handlerBaseStorage().appManager);

Parameters

NameTypeDescription
_actionsActionTypes[]the action types
ruleIduint32the id of the rule to remove