Git Source

Inherits: Context, RuleAdministratorOnly, IEconomicEvents, IInputErrors, ITagInputErrors, ITagRuleInputErrors, IZeroAddressError

Author: @ShaneDuncan602 @oscarsernarosero @TJ-Everett

This contract sets and gets the Tagged Rules for the protocol. Rules will be applied via General Tags to accounts.

setters and getters for Tagged token specific rules

Functions

addAccountMaxTradeSize

Account Max Trade Size **************

Function add an Account Max Trade Size rule

Function has RuleAdministratorOnly Modifier and takes AppManager Address Param

function addAccountMaxTradeSize(
    address _appManagerAddr,
    bytes32[] calldata _accountTypes,
    uint240[] calldata _maxSizes,
    uint16[] calldata _periods,
    uint64 _startTime
) external ruleAdministratorOnly(_appManagerAddr) returns (uint32);

Parameters

NameTypeDescription
_appManagerAddraddressAddress of App Manager
_accountTypesbytes32[]Types of Accounts
_maxSizesuint240[]Allowed total purchase limits
_periodsuint16[]Hours purhchases allowed
_startTimeuint64timestamp period to start

Returns

NameTypeDescription
<none>uint32position of new rule in array

_addAccountMaxTradeSize

since all the arrays must have matching lengths, it is only necessary to check for one of them being empty.

Internal Function to avoid stack too deep error

function _addAccountMaxTradeSize(
    bytes32[] calldata _accountTypes,
    uint240[] calldata _maxSizes,
    uint16[] calldata _periods,
    uint64 _startTime
) internal returns (uint32);

Parameters

NameTypeDescription
_accountTypesbytes32[]Types of Accounts
_maxSizesuint240[]Allowed total buy sizes
_periodsuint16[]Amount of hours that define the periods
_startTimeuint64timestamp for first period to start

Returns

NameTypeDescription
<none>uint32position of new rule in array

addAccountMinMaxTokenBalance

Account Min Max Token Balance **************

Function adds Account Min Max Token Balance Rule

function addAccountMinMaxTokenBalance(
    address _appManagerAddr,
    bytes32[] calldata _accountTypes,
    uint256[] calldata _min,
    uint256[] calldata _max,
    uint16[] calldata _periods,
    uint64 _startTime
) external ruleAdministratorOnly(_appManagerAddr) returns (uint32);

Parameters

NameTypeDescription
_appManagerAddraddressApp Manager Address
_accountTypesbytes32[]Types of Accounts
_minuint256[]Minimum Balance allowed for tagged accounts
_maxuint256[]Maximum Balance allowed for tagged accounts
_periodsuint16[]Amount of hours that define the periods
_startTimeuint64Timestamp that the check should start

Returns

NameTypeDescription
<none>uint32_addAccountMinMaxTokenBalance which returns location of rule in array

_addAccountMinMaxTokenBalance

since all the arrays must have matching lengths, it is only necessary to check for one of them being empty.

Internal Function to avoid stack too deep error

function _addAccountMinMaxTokenBalance(
    bytes32[] calldata _accountTypes,
    uint256[] calldata _min,
    uint256[] calldata _max,
    uint16[] calldata _periods,
    uint64 _startTime
) internal returns (uint32);

Parameters

NameTypeDescription
_accountTypesbytes32[]Types of Accounts
_minuint256[]Minimum Balance allowed for tagged accounts
_maxuint256[]Maximum Balance allowed for tagged accounts
_periodsuint16[]Amount of hours that define the periods
_startTimeuint64Timestamp that the check should start

Returns

NameTypeDescription
<none>uint32position of new rule in array

addTokenMaxDailyTrades

Token Max Daily Trades ******

Function adds Token Max Daily Trades Rule

function addTokenMaxDailyTrades(
    address _appManagerAddr,
    bytes32[] calldata _nftTags,
    uint8[] calldata _tradesAllowed,
    uint64 _startTime
) external ruleAdministratorOnly(_appManagerAddr) returns (uint32);

Parameters

NameTypeDescription
_appManagerAddraddressApp Manager Address
_nftTagsbytes32[]Tags of NFTs
_tradesAlloweduint8[]Maximum trades allowed within 24 hours
_startTimeuint64starting timestamp for the rule

Returns

NameTypeDescription
<none>uint32_nftTransferCounterRules which returns location of rule in array

_addTokenMaxDailyTrades

Internal Function to avoid stack too deep error

function _addTokenMaxDailyTrades(bytes32[] calldata _nftTags, uint8[] calldata _tradesAllowed, uint64 _startTime)
    internal
    returns (uint32);

Parameters

NameTypeDescription
_nftTagsbytes32[]Tags of NFTs
_tradesAlloweduint8[]Maximum trades allowed within 24 hours
_startTimeuint64starting timestamp for the rule

Returns

NameTypeDescription
<none>uint32position of new rule in array