Git Source

Inherits: IAppManager, AccessControlEnumerable, IAppLevelEvents, IApplicationEvents, IIntegrationEvents, ReentrancyGuard

Author: @ShaneDuncan602, @oscarsernarosero, @TJ-Everett

This contract is the permissions contract

This uses AccessControlEnumerable to maintain user permissions, handles metadata storage, and checks application level rules via the application handler.

State Variables

VERSION

string private constant VERSION = "2.1.0";

SUPER_ADMIN_ROLE

bytes32 constant SUPER_ADMIN_ROLE = keccak256("SUPER_ADMIN_ROLE");

APP_ADMIN_ROLE

bytes32 constant APP_ADMIN_ROLE = keccak256("APP_ADMIN_ROLE");

RULE_ADMIN_ROLE

bytes32 constant RULE_ADMIN_ROLE = keccak256("RULE_ADMIN_ROLE");

ACCESS_LEVEL_ADMIN_ROLE

bytes32 constant ACCESS_LEVEL_ADMIN_ROLE = keccak256("ACCESS_LEVEL_ADMIN_ROLE");

RISK_ADMIN_ROLE

bytes32 constant RISK_ADMIN_ROLE = keccak256("RISK_ADMIN_ROLE");

TREASURY_ACCOUNT

bytes32 constant TREASURY_ACCOUNT = keccak256("TREASURY_ACCOUNT");

PROPOSED_SUPER_ADMIN_ROLE

bytes32 constant PROPOSED_SUPER_ADMIN_ROLE = keccak256("PROPOSED_SUPER_ADMIN_ROLE");

accessLevels

Data contracts

IAccessLevels accessLevels;

riskScores

IRiskScores riskScores;

tags

ITags tags;

pauseRules

IPauseRules pauseRules;

newAccessLevelsProviderAddress

Data provider proposed addresses

address newAccessLevelsProviderAddress;

newTagsProviderAddress

address newTagsProviderAddress;

newPauseRulesProviderAddress

address newPauseRulesProviderAddress;

newRiskScoresProviderAddress

address newRiskScoresProviderAddress;

appName

Application name string

string appName;

applicationHandler

Application Handler Contract

ProtocolApplicationHandler public applicationHandler;

applicationHandlerAddress

address applicationHandlerAddress;

tokenToAddress

mapping(string => address) tokenToAddress;

addressToToken

mapping(address => string) addressToToken;

registeredHandlers

mapping(address => bool) registeredHandlers;

tokenList

Token array (for balance tallying)

address[] tokenList;

tokenToIndex

mapping(address => uint256) tokenToIndex;

isTokenRegistered

mapping(address => bool) isTokenRegistered;

tradingRuleAllowList

Allowlist for trading rule exceptions

address[] tradingRuleAllowList;

isTradingRuleAllowlisted

mapping(address => bool) isTradingRuleAllowlisted;

tradingRuleAllowlistAddressToIndex

mapping(address => uint256) tradingRuleAllowlistAddressToIndex;

Functions

constructor

This constructor sets up the super admin and app administrator roles while also forming the hierarchy of roles and deploying data contracts. App Admins are the top tier. They may assign all admins, including other app admins.

constructor(address root, string memory _appName, bool upgradeMode);

Parameters

NameTypeDescription
rootaddressaddress to set as the super admin and first app administrator
_appNamestringApplication Name String
upgradeModeboolspecifies whether this is a fresh AppManager or an upgrade replacement.

grantRole

This is purposely going to fail every time it will be invoked in order to force users to only use the appropiate channels to grant roles, and therefore enforce the special rules in an app.

This function overrides the parent’s grantRole function. This disables its public nature to make it private.

function grantRole(bytes32 role, address account) public virtual override(AccessControl, IAccessControl);

Parameters

NameTypeDescription
rolebytes32the role to grant to an acount.
accountaddressaddress being granted the role.

renounceRole

this is done to funnel all the role granting functions through the app manager functions since the superAdmins could add other superAdmins through this back door

This function overrides the parent’s renounceRole function. Its purpose is to prevent superAdmins from renouncing through this “backdoor”, so they are forced to set another superAdmin through the function proposeNewSuperAdmin.

function renounceRole(bytes32 role, address account) public virtual override(AccessControl, IAccessControl);

Parameters

NameTypeDescription
rolebytes32the role to renounce.
accountaddressaddress renouncing to the role.

revokeRole

enforcing the min-1-admin requirement. Only PROPOSED_SUPER_ADMIN_ROLE should be able to bypass this rule

This function overrides the parent’s revokeRole function. Its purpose is to prevent superAdmins from being revoked through this “backdoor” which would effectively leave the app in a superAdmin-orphan state.

function revokeRole(bytes32 role, address account)
    public
    virtual
    override(AccessControl, IAccessControl)
    nonReentrant;

Parameters

NameTypeDescription
rolebytes32the role to revoke.
accountaddressaddress of revoked role.

isSuperAdmin

enforcing the min-1-admin requirement. -------------SUPER ADMIN---------------

This function is where the Super admin role is actually checked

function isSuperAdmin(address account) public view returns (bool);

Parameters

NameTypeDescription
accountaddressaddress to be checked

Returns

NameTypeDescription
<none>boolsuccess true if admin, false if not

proposeNewSuperAdmin

-------------- PROPOSE NEW SUPER ADMIN ------------------

We should only have 1 proposed superAdmin. If there is one already in this role, we should remove it to replace it.

Propose a new super admin. Restricted to super admins.

function proposeNewSuperAdmin(address account) external onlyRole(SUPER_ADMIN_ROLE);

Parameters

NameTypeDescription
accountaddressaddress to be added (Cannot be zero address and cannot be current super admin)

updateProposedRole

A function used specifically for moving the proposed super admin from one account to another. Allows revoke and grant to be called in the same function without the possibility of re-entrancy.

function updateProposedRole(address newAddress) private onlyRole(SUPER_ADMIN_ROLE);

Parameters

NameTypeDescription
newAddressaddressthe new Proposed Super Admin account.

confirmSuperAdmin

only the proposed account can accept this role.

confirm the superAdmin role.

function confirmSuperAdmin() external;

isAppAdministrator

-------------APP ADMIN---------------

This function is where the app administrator role is actually checked

function isAppAdministrator(address account) public view returns (bool);

Parameters

NameTypeDescription
accountaddressaddress to be checked

Returns

NameTypeDescription
<none>boolsuccess true if app administrator, false if not

addAppAdministrator

Add an account to the app administrator role. Restricted to super admins.

function addAppAdministrator(address account) public onlyRole(SUPER_ADMIN_ROLE);

Parameters

NameTypeDescription
accountaddressaddress to be added

addMultipleAppAdministrator

Add an array of accounts to the app administrator role. Restricted to admins.

function addMultipleAppAdministrator(address[] memory _accounts) external onlyRole(SUPER_ADMIN_ROLE);

Parameters

NameTypeDescription
_accountsaddress[]address array to be added

isRuleAdministrator

-------------RULE ADMIN---------------

This function is where the rule admin role is actually checked

function isRuleAdministrator(address account) public view returns (bool);

Parameters

NameTypeDescription
accountaddressaddress to be checked

Returns

NameTypeDescription
<none>boolsuccess true if RULE_ADMIN_ROLE, false if not

addRuleAdministrator

Add an account to the rule admin role. Restricted to app administrators.

function addRuleAdministrator(address account) public onlyRole(APP_ADMIN_ROLE);

Parameters

NameTypeDescription
accountaddressaddress to be added as a rule admin

addMultipleRuleAdministrator

Add a list of accounts to the rule admin role. Restricted to app administrators.

function addMultipleRuleAdministrator(address[] memory account) external onlyRole(APP_ADMIN_ROLE);

Parameters

NameTypeDescription
accountaddress[]address to be added as a rule admin

isTreasuryAccount

-------------TREASURY ACCOUNT ---------------

This function is where the Treasury account role is actually checked

function isTreasuryAccount(address account) public view returns (bool);

Parameters

NameTypeDescription
accountaddressaddress to be checked

Returns

NameTypeDescription
<none>boolsuccess true if TREASURY_ACCOUNT, false if not

addTreasuryAccount

Add an account to the Treasury account role. Restricted to app administrators.

function addTreasuryAccount(address account) public onlyRole(APP_ADMIN_ROLE);

Parameters

NameTypeDescription
accountaddressaddress to be added as a Treasury account

addMultipleTreasuryAccounts

Add a list of accounts to the Treasury account role. Restricted to app administrators.

function addMultipleTreasuryAccounts(address[] memory _accounts) external onlyRole(APP_ADMIN_ROLE);

Parameters

NameTypeDescription
_accountsaddress[]addresses to be added as a Treasury account

isAccessLevelAdmin

-------------ACCESS LEVEL---------------

This function is where the access level admin role is actually checked

function isAccessLevelAdmin(address account) public view returns (bool);

Parameters

NameTypeDescription
accountaddressaddress to be checked

Returns

NameTypeDescription
<none>boolsuccess true if ACCESS_LEVEL_ADMIN_ROLE, false if not

addAccessLevelAdmin

Add an account to the access level role. Restricted to app administrators.

function addAccessLevelAdmin(address account) public onlyRole(APP_ADMIN_ROLE);

Parameters

NameTypeDescription
accountaddressaddress to be added as a access level

addMultipleAccessLevelAdmins

Add a list of accounts to the access level role. Restricted to app administrators.

function addMultipleAccessLevelAdmins(address[] memory account) external onlyRole(APP_ADMIN_ROLE);

Parameters

NameTypeDescription
accountaddress[]address to be added as a access level

isRiskAdmin

-------------RISK ADMIN---------------

This function is where the risk admin role is actually checked

function isRiskAdmin(address account) public view returns (bool);

Parameters

NameTypeDescription
accountaddressaddress to be checked

Returns

NameTypeDescription
<none>boolsuccess true if RISK_ADMIN_ROLE, false if not

addRiskAdmin

Add an account to the risk admin role. Restricted to app administrators.

function addRiskAdmin(address account) public onlyRole(APP_ADMIN_ROLE);

Parameters

NameTypeDescription
accountaddressaddress to be added

addMultipleRiskAdmin

Add a list of accounts to the risk admin role. Restricted to app administrators.

function addMultipleRiskAdmin(address[] memory account) external onlyRole(APP_ADMIN_ROLE);

Parameters

NameTypeDescription
accountaddress[]address to be added

addAccessLevel

-------------MAINTAIN ACCESS LEVELS---------------

Add the Access Level(0-4) to the account. Restricted to Access Level Admins.

function addAccessLevel(address _account, uint8 _level) public onlyRole(ACCESS_LEVEL_ADMIN_ROLE);

Parameters

NameTypeDescription
_accountaddressaddress upon which to apply the Access Level
_leveluint8Access Level to add

addAccessLevelToMultipleAccounts

Add the Access Level(0-4) to multiple accounts. Restricted to Access Level Admins.

function addAccessLevelToMultipleAccounts(address[] memory _accounts, uint8 _level)
    external
    onlyRole(ACCESS_LEVEL_ADMIN_ROLE);

Parameters

NameTypeDescription
_accountsaddress[]address upon which to apply the Access Level
_leveluint8Access Level to add

addMultipleAccessLevels

Add the Access Level(0-4) to the list of account. Restricted to Access Level Admins.

function addMultipleAccessLevels(address[] memory _accounts, uint8[] memory _level)
    external
    onlyRole(ACCESS_LEVEL_ADMIN_ROLE);

Parameters

NameTypeDescription
_accountsaddress[]address array upon which to apply the Access Level
_leveluint8[]Access Level array to add

getAccessLevel

Get the Access Level for the specified account

function getAccessLevel(address _account) external view returns (uint8);

Parameters

NameTypeDescription
_accountaddressaddress of the user

Returns

NameTypeDescription
<none>uint8

removeAccessLevel

Remove the Access Level for an account.

function removeAccessLevel(address _account) external onlyRole(ACCESS_LEVEL_ADMIN_ROLE);

Parameters

NameTypeDescription
_accountaddressaddress which the Access Level will be removed from

addRiskScore

-------------MAINTAIN RISK SCORES---------------

Add the Risk Score. Restricted to Risk Admins.

function addRiskScore(address _account, uint8 _score) public onlyRole(RISK_ADMIN_ROLE);

Parameters

NameTypeDescription
_accountaddressaddress upon which to apply the Risk Score
_scoreuint8Risk Score(0-100)

addRiskScoreToMultipleAccounts

Add the Risk Score to each address in array. Restricted to Risk Admins.

function addRiskScoreToMultipleAccounts(address[] memory _accounts, uint8 _score) external onlyRole(RISK_ADMIN_ROLE);

Parameters

NameTypeDescription
_accountsaddress[]address array upon which to apply the Risk Score
_scoreuint8Risk Score(0-100)

addMultipleRiskScores

Add the Risk Score at index to Account at index in array. Restricted to Risk Admins.

function addMultipleRiskScores(address[] memory _accounts, uint8[] memory _scores) external onlyRole(RISK_ADMIN_ROLE);

Parameters

NameTypeDescription
_accountsaddress[]address array upon which to apply the Risk Score
_scoresuint8[]Risk Score array (0-100)

getRiskScore

Get the Risk Score for an account.

function getRiskScore(address _account) external view returns (uint8);

Parameters

NameTypeDescription
_accountaddressaddress upon which the risk score was set

Returns

NameTypeDescription
<none>uint8score risk score(0-100)

removeRiskScore

Remove the Risk Score for an account.

function removeRiskScore(address _account) external onlyRole(RISK_ADMIN_ROLE);

Parameters

NameTypeDescription
_accountaddressaddress which the risk score will be removed from

addPauseRule

--------------MAINTAIN PAUSE RULES---------------

Adding a pause rule will change the bool to true in the hanlder contract and pause rules will be checked.

Add a pause rule. Restricted to Application Administrators

function addPauseRule(uint64 _pauseStart, uint64 _pauseStop) external onlyRole(RULE_ADMIN_ROLE);

Parameters

NameTypeDescription
_pauseStartuint64Beginning of the pause window
_pauseStopuint64End of the pause window

removePauseRule

If no pause rules exist after removal bool is set to false in handler and pause rules will not be checked until new rule is added.

Remove a pause rule. Restricted to Application Administrators

function removePauseRule(uint64 _pauseStart, uint64 _pauseStop) external onlyRole(RULE_ADMIN_ROLE);

Parameters

NameTypeDescription
_pauseStartuint64Beginning of the pause window
_pauseStopuint64End of the pause window

activatePauseRuleCheck

set handler bool to false to save gas and prevent pause rule checks when non exist

enable/disable rule. Disabling a rule will save gas on transfer transactions. This function calls the appHandler contract to enable/disable this check.

function activatePauseRuleCheck(bool _on) external onlyRole(RULE_ADMIN_ROLE);

Parameters

NameTypeDescription
_onboolboolean representing if a rule must be checked or not.

getPauseRules

Get all pause rules for the token

function getPauseRules() external view returns (PauseRule[] memory);

Returns

NameTypeDescription
<none>PauseRule[]PauseRule An array of all the pause rules

cleanOutdatedRules

Remove any expired pause windows.

function cleanOutdatedRules() external;

addTag

-------------MAINTAIN TAGS---------------

there is a hard limit of 10 tags per address.

_Add a tag to an account. Restricted to Application Administrators. Loops through existing tags on accounts and will emit an event if tag is _ already applied.*

function addTag(address _account, bytes32 _tag) external onlyRole(APP_ADMIN_ROLE);

Parameters

NameTypeDescription
_accountaddressAddress to be tagged
_tagbytes32Tag for the account. Can be any allowed string variant

addTagToMultipleAccounts

there is a hard limit of 10 tags per address.

_Add a tag to an account. Restricted to Application Administrators. Loops through existing tags on accounts and will emit an event if tag is _ already applied.*

function addTagToMultipleAccounts(address[] memory _accounts, bytes32 _tag) external onlyRole(APP_ADMIN_ROLE);

Parameters

NameTypeDescription
_accountsaddress[]Address array to be tagged
_tagbytes32Tag for the account. Can be any allowed string variant

addMultipleTagToMultipleAccounts

there is a hard limit of 10 tags per address.

Add a general tag to an account at index in array. Restricted to Application Administrators. Loops through existing tags on accounts and will emit an event if tag is already applied.

function addMultipleTagToMultipleAccounts(address[] memory _accounts, bytes32[] memory _tags)
    external
    onlyRole(APP_ADMIN_ROLE);

Parameters

NameTypeDescription
_accountsaddress[]Address array to be tagged
_tagsbytes32[]Tag array for the account at index. Can be any allowed string variant

removeTag

Remove a tag. Restricted to Application Administrators.

function removeTag(address _account, bytes32 _tag) external onlyRole(APP_ADMIN_ROLE);

Parameters

NameTypeDescription
_accountaddressAddress to have its tag removed
_tagbytes32The tag to remove

hasTag

Check to see if an account has a specific tag

function hasTag(address _account, bytes32 _tag) public view returns (bool);

Parameters

NameTypeDescription
_accountaddressAddress to check
_tagbytes32Tag to be checked for

Returns

NameTypeDescription
<none>boolsuccess true if account has the tag, false if it does not

getAllTags

Get all the tags for the address

function getAllTags(address _address) external view returns (bytes32[] memory);

Parameters

NameTypeDescription
_addressaddressAddress to retrieve the tags

Returns

NameTypeDescription
<none>bytes32[]tags Array of all tags for the account

proposeRiskScoresProvider

First part of the 2 step process to set a new risk score provider. First, the new provider address is proposed and saved, then it is confirmed by invoking a confirmation function in the new provider that invokes the corresponding function in this contract.

function proposeRiskScoresProvider(address _newProvider) external onlyRole(APP_ADMIN_ROLE);

Parameters

NameTypeDescription
_newProvideraddressAddress of the new provider

getRiskScoresProvider

Get the address of the risk score provider

function getRiskScoresProvider() external view returns (address);

Returns

NameTypeDescription
<none>addressprovider Address of the provider

proposeTagsProvider

First part of the 2 step process to set a new tag provider. First, the new provider address is proposed and saved, then it is confirmed by invoking a confirmation function in the new provider that invokes the corresponding function in this contract.

function proposeTagsProvider(address _newProvider) external onlyRole(APP_ADMIN_ROLE);

Parameters

NameTypeDescription
_newProvideraddressAddress of the new provider

getTagProvider

Get the address of the tag provider

function getTagProvider() external view returns (address);

Returns

NameTypeDescription
<none>addressprovider Address of the provider

proposePauseRulesProvider

First part of the 2 step process to set a new pause rule provider. First, the new provider address is proposed and saved, then it is confirmed by invoking a confirmation function in the new provider that invokes the corresponding function in this contract.

function proposePauseRulesProvider(address _newProvider) external onlyRole(APP_ADMIN_ROLE);

Parameters

NameTypeDescription
_newProvideraddressAddress of the new provider

getPauseRulesProvider

Get the address of the pause rules provider

function getPauseRulesProvider() external view returns (address);

Returns

NameTypeDescription
<none>addressprovider Address of the provider

proposeAccessLevelsProvider

First part of the 2 step process to set a new access level provider. First, the new provider address is proposed and saved, then it is confirmed by invoking a confirmation function in the new provider that invokes the corresponding function in this contract.

function proposeAccessLevelsProvider(address _newProvider) external onlyRole(APP_ADMIN_ROLE);

Parameters

NameTypeDescription
_newProvideraddressAddress of the new provider

getAccessLevelProvider

Get the address of the Access Level provider

function getAccessLevelProvider() external view returns (address);

Returns

NameTypeDescription
<none>addressaccessLevelProvider Address of the Access Level provider

checkApplicationRules

Check Application Rules for valid transactions.

function checkApplicationRules(
    address _tokenAddress,
    address _sender,
    address _from,
    address _to,
    uint256 _amount,
    uint16 _nftValuationLimit,
    uint256 _tokenId,
    ActionTypes _action,
    HandlerTypes _handlerType
) external onlyHandler;

Parameters

NameTypeDescription
_tokenAddressaddressaddress of the token calling the rule check
_senderaddressaddress of the calling account passed through from the token
_fromaddressaddress of the from account
_toaddressaddress of the to account
_amountuint256number of tokens to be transferred
_nftValuationLimituint16number of tokenID’s per collection before checking collection price vs individual token price
_tokenIduint256tokenId of the NFT token
_actionActionTypesAction to be checked
_handlerTypeHandlerTypestype of handler calling checkApplicationRules function

isRegisteredHandler

This function checks if the address is a registered handler within one of the registered protocol supported entities

function isRegisteredHandler(address _address) public view returns (bool);

Parameters

NameTypeDescription
_addressaddressaddress to be checked

Returns

NameTypeDescription
<none>boolisHandler true if handler, false if not

onlyHandler

Checks if _msgSender() is a registered handler

modifier onlyHandler();

registerToken

This function will try to call supportsInterface on registered address. If token does not support ERC165 it is assumed to be ERC20. Use UpdateRegisteredToken() to register an ERC721 token that does not support ERC165 interface.

This function allows the devs to register their token contract addresses. This keeps everything in sync and will aid with the token factory and application level balance checks.

function registerToken(string calldata _token, address _tokenAddress) public onlyRole(APP_ADMIN_ROLE);

Parameters

NameTypeDescription
_tokenstringThe token identifier(may be NFT or ERC20)
_tokenAddressaddressAddress corresponding to the tokenId

updateRegisteredToken

check that the registering token supports the ERC165 interface ID for IERC721

Token type is not stored on chain and is only to update events parameters for off chain databasing.

This function Updates the Registered Token to an ERC721 token that does not support ERC165 interface.

function updateRegisteredToken(string calldata _token, address _tokenAddress, uint8 _tokenType)
    external
    onlyRole(APP_ADMIN_ROLE);

Parameters

NameTypeDescription
_tokenstringThe token identifier of registered token
_tokenAddressaddressAddress corresponding to the tokenId
_tokenTypeuint8The token type to update registered token

getTokenAddress

This function gets token contract address.

function getTokenAddress(string calldata _tokenId) external view returns (address);

Parameters

NameTypeDescription
_tokenIdstringThe token id(may be NFT or ERC20)

Returns

NameTypeDescription
<none>addresstokenAddress the address corresponding to the tokenId

getTokenID

This function gets token identification string.

function getTokenID(address _tokenAddress) external view returns (string memory);

Parameters

NameTypeDescription
_tokenAddressaddressthe address of the contract of the token to query

Returns

NameTypeDescription
<none>stringthe identification string.

deregisterToken

This function allows the devs to deregister a token contract address. This keeps everything in sync and will aid with the token factory and application level balance checks.

function deregisterToken(string calldata _tokenId) external onlyRole(APP_ADMIN_ROLE);

Parameters

NameTypeDescription
_tokenIdstringThe token id(may be NFT or ERC20)

_removeAddressWithMapping

also remove its handler from the registration

This function removes an address from a dynamic address array by putting the last element in the one to remove and then removing last element.

function _removeAddressWithMapping(
    address[] storage _addressArray,
    mapping(address => uint256) storage _addressToIndex,
    mapping(address => bool) storage _registerFlag,
    address _address
) private;

Parameters

NameTypeDescription
_addressArrayaddress[]The array to have an address removed
_addressToIndexmapping(address => uint256)mapping that keeps track of the indexes in the list by address
_registerFlagmapping(address => bool)mapping that keeps track of the addresses that are members of the list
_addressaddressThe address to remove

_addAddressWithMapping

we store the last address in the array on a local variable to avoid unnecessary costly memory reads we check if we’re trying to remove the last address in the array since this means we can skip some steps if it is not the last address in the array, then we store the index of the address to remove we remove the address by replacing it in the array with the last address of the array (now duplicated) we update the last address index to its new position (the removed-address index) we remove the last element of the _addressArray since it is now duplicated we set to false the membership mapping for this address in _addressArray we set the index to zero for this address in _addressArray

This function adds an address to a dynamic address array and takes care of the mappings.

function _addAddressWithMapping(
    address[] storage _addressArray,
    mapping(address => uint256) storage _addressToIndex,
    mapping(address => bool) storage _registerFlag,
    address _address
) private;

Parameters

NameTypeDescription
_addressArrayaddress[]The array to have an address added
_addressToIndexmapping(address => uint256)mapping that keeps track of the indexes in the list by address
_registerFlagmapping(address => bool)mapping that keeps track of the addresses that are members of the list
_addressaddressThe address to add

approveAddressToTradingRuleAllowlist

manage the approve list for trading-rule bypasser accounts

function approveAddressToTradingRuleAllowlist(address _address, bool isApproved) external onlyRole(APP_ADMIN_ROLE);

Parameters

NameTypeDescription
_addressaddressaccount in the list to manage
isApprovedboolset to true to indicate that _address can bypass trading rules.

isTradingRuleBypasser

tells if an address can bypass trading rules

function isTradingRuleBypasser(address _address) public view returns (bool);

Parameters

NameTypeDescription
_addressaddressthe address to check for

Returns

NameTypeDescription
<none>booltrue if the address can bypass trading rules, or false otherwise.

getAccessLevelDataAddress

Getter for the access level contract address

function getAccessLevelDataAddress() external view returns (address);

Returns

NameTypeDescription
<none>addressAccessLevelDataAddress

getRiskDataAddress

Getter for the risk data contract address

function getRiskDataAddress() external view returns (address);

Returns

NameTypeDescription
<none>addressriskDataAddress

getTagsDataAddress

Getter for the general tags data contract address

function getTagsDataAddress() external view returns (address);

Returns

NameTypeDescription
<none>addresstagsDataAddress

getPauseRulesDataAddress

Getter for the pause rules data contract address

function getPauseRulesDataAddress() external view returns (address);

Returns

NameTypeDescription
<none>addresspauseRulesDataAddress

getTokenList

Return the token list for calculation purposes

function getTokenList() external view returns (address[] memory);

Returns

NameTypeDescription
<none>address[]tokenList list of all tokens registered

version

gets the version of the contract

function version() external pure returns (string memory);

Returns

NameTypeDescription
<none>stringVERSION

setNewApplicationHandlerAddress

this is for upgrading to a new ApplicationHandler contract

Update the Application Handler Contract Address

function setNewApplicationHandlerAddress(address _newApplicationHandler) external onlyRole(APP_ADMIN_ROLE);

Parameters

NameTypeDescription
_newApplicationHandleraddressaddress of new Application Handler contract

getHandlerAddress

this function returns the application handler address

function getHandlerAddress() external view returns (address);

Returns

NameTypeDescription
<none>addresshandlerAddress

setAppName

Setter for application Name

function setAppName(string calldata _appName) external onlyRole(APP_ADMIN_ROLE);

Parameters

NameTypeDescription
_appNamestringapplication name string

getAppName

Getter for application Name

function getAppName() external view returns (string memory);

Returns

NameTypeDescription
<none>stringappName

confirmAppManager

Part of the two step process to set a new AppManager within a Protocol Entity

function confirmAppManager(address _assetAddress) external onlyRole(APP_ADMIN_ROLE);

Parameters

NameTypeDescription
_assetAddressaddressaddress of a protocol entity that uses AppManager

deployDataContracts

-------------DATA CONTRACT DEPLOYMENT---------------

Deploy all the child data contracts. Only called internally from the constructor.

function deployDataContracts() private;

proposeDataContractMigration

This function is used to propose the new owner for data contracts.

function proposeDataContractMigration(address _newOwner) external nonReentrant onlyRole(APP_ADMIN_ROLE);

Parameters

NameTypeDescription
_newOwneraddressaddress of the new AppManager

confirmDataContractMigration

This function is used to confirm this contract as the new owner for data contracts.

function confirmDataContractMigration(address _oldAppManagerAddress) external nonReentrant onlyRole(APP_ADMIN_ROLE);

confirmNewDataProvider

Part of the two step process to set a new Data Provider within a Protocol AppManager. Final confirmation called by new provider

function confirmNewDataProvider(IDataEnum.ProviderType _providerType) external;

Parameters

NameTypeDescription
_providerTypeIDataEnum.ProviderTypethe type of data provider