State Variables
VERSION
appPricing
appPricingAddress
appManager
appManagerAddress
ruleProcessor
ruleProcessorAddress
accountMaxValueByAccessLevel
accountMaxReceivedByAccessLevel
accountMaxReceivedByRiskScore
accountMaxValueByRiskScore
accountMaxTxValueByRiskScore
accountMaxValueOutByAccessLevel
accountDenyForNoAccessLevel
Account Max Received by Access Level Accumulator
pauseRuleActive
Pause Rule on-off switchusdValueTransactedInRiskPeriod
MaxTxSizePerPeriodByRisk datalastTxDateRiskRule
usdValueTotalWithrawals
usdValueAccountMaxReceived
Account Max Received by Access Level AccumulatorFunctions
constructor
Initializes the contract setting the AppManager address as the one provided and setting the ruleProcessor for protocol accessName | Type | Description |
---|---|---|
_ruleProcessorProxyAddress | address | of the protocol’s Rule Processor contract. |
_appManagerAddress | address | address of the application AppManager. |
_checkWhichApplicationRulesActive
_checkNonCustodialRules
requireApplicationRulesChecked
checks if any of the Application level rules are activeName | Type | Description |
---|---|---|
_action | ActionTypes | the current action type |
_sender | address |
Name | Type | Description |
---|---|---|
<none> | bool | true if one or more rules are active |
checkApplicationRules
Check Application Rules for valid transaction.Name | Type | Description |
---|---|---|
_tokenAddress | address | address of the token |
_sender | address | address of the calling account passed through from the token |
_from | address | address of the from account |
_to | address | address of the to account |
_amount | uint256 | amount of tokens to be transferred |
_nftValuationLimit | uint16 | number of tokenID’s per collection before checking collection price vs individual token price |
_tokenId | uint256 | tokenId of the NFT token |
_action | ActionTypes | Action to be checked. This param is intentially added for future enhancements. |
_handlerType | HandlerTypes | the type of handler, used to direct to correct token pricing |
_checkRiskRules
Based on the Handler Type retrieve pricing valuations This function consolidates all the Risk rule checks.Name | Type | Description |
---|---|---|
_from | address | address of the from account |
_to | address | address of the to account |
_sender | address | address of the caller |
_balanceValuation | uint128 | recepient address current total application valuation in USD with 18 decimals of precision |
_transferValuation | uint128 | valuation of the token being transferred in USD with 18 decimals of precision |
_action | ActionTypes | the current user action |
_checkAccessLevelRules
non custodial buy non custodial sell This function consolidates all the Access Level rule checks.Name | Type | Description |
---|---|---|
_from | address | address of the from account |
_to | address | address of the to account |
_sender | address | address of the to caller |
_balanceValuation | uint128 | recepient address current total application valuation in USD with 18 decimals of precision |
_transferValuation | uint128 | valuation of the token being transferred in USD with 18 decimals of precision |
_action | ActionTypes | the current user action |
_checkAccountMaxTxValueByRiskScore
Non custodial buy Non custodial sell This function consolidates the MaxTXValueByRiskScore rule checks for the from address.Name | Type | Description |
---|---|---|
_action | ActionTypes | the current user action |
_address | address | address of the account |
_riskScoreFrom | uint8 | sender address risk score |
_transferValuation | uint128 | valuation of the token being transferred in USD with 18 decimals of precision |
setNFTPricingAddress
-------------- Pricing Module Configurations --------------- Sets the address of the nft pricing contract and loads the contract.Name | Type | Description |
---|---|---|
_address | address | Nft Pricing Contract address. |
setERC20PricingAddress
Sets the address of the erc20 pricing contract and loads the contract.Name | Type | Description |
---|---|---|
_address | address | ERC20 Pricing Contract address. |
getAccTotalValuation
This gets the account’s balance in dollars. Get the account’s balance in dollars. It uses the registered tokens in the app manager.Name | Type | Description |
---|---|---|
_account | address | address to get the balance for |
_nftValuationLimit | uint256 |
Name | Type | Description |
---|---|---|
totalValuation | uint256 | of the account in dollars |
_getERC20Price
check if _account is zero address. If zero address we return a valuation of zero to allow for burning tokens when rules that need valuations are active. Loop through all Nfts and ERC20s and add values to balance for account valuation Check to see if user owns the asset This gets the token’s value in dollars. Get the value for a specific ERC20. This is done by interacting with the pricing moduleName | Type | Description |
---|---|---|
_tokenAddress | address | the address of the token |
Name | Type | Description |
---|---|---|
<none> | uint256 | price the price of 1 in dollars |
getERC20PricingAddress
getERC721PricingAddress
_getNFTValuePerCollection
This gets the token’s value in dollars. Get the value for a specific ERC721. This is done by interacting with the pricing moduleName | Type | Description |
---|---|---|
_tokenAddress | address | the address of the token |
_account | address | of the token holder |
_tokenAmount | uint256 | amount of NFTs from _tokenAddress contract |
Name | Type | Description |
---|---|---|
totalValueInThisContract | uint256 | in whole USD |
_getNFTCollectionValue
This function gets the total token value in dollars of all tokens owned in each collection by address. Get the total value for all tokens held by a wallet for a specific collection. This is done by interacting with the pricing moduleName | Type | Description |
---|---|---|
_tokenAddress | address | the address of the token |
_tokenAmount | uint256 | amount of NFTs from _tokenAddress contract |
Name | Type | Description |
---|---|---|
totalValueInThisContract | uint256 | total valuation of tokens by collection in whole USD |
setAccountMaxValueByRiskScoreId
that setting a rule will automatically activate it. Set the accountMaxValueByRiskScoreRule. Restricted to app administrators only.Name | Type | Description |
---|---|---|
_actions | ActionTypes[] | action types in which to apply the rules |
_ruleId | uint32 | Rule Id to set |
setAccountMaxValueByRiskScoreIdFull
that setting a rule will automatically activate it. Set the accountMaxValueByRiskScoreRule. Restricted to app administrators only.Name | Type | Description |
---|---|---|
_actions | ActionTypes[] | actions to have the rule applied to |
_ruleIds | uint32[] | Rule Id corresponding to the actions |
clearAccountMaxValueByRiskScore
Clear the rule data structuresetAccountMaxValueByRiskScoreIdUpdate
that setting a rule will automatically activate it. Set the AccountMaxValuebyRiskSCoreRuleId.Name | Type | Description |
---|---|---|
_action | ActionTypes | the action type to set the rule |
_ruleId | uint32 | Rule Id to set |
activateAccountMaxValueByRiskScore
enable/disable rule. Disabling a rule will save gas on transfer transactions.Name | Type | Description |
---|---|---|
_actions | ActionTypes[] | action types |
_on | bool | boolean representing if a rule must be checked or not. |
isAccountMaxValueByRiskScoreActive
Tells you if the accountMaxValueByRiskScore Rule is active or not.Name | Type | Description |
---|---|---|
_action | ActionTypes | the action type |
Name | Type | Description |
---|---|---|
<none> | bool | boolean representing if the rule is active |
getAccountMaxValueByRiskScoreId
Retrieve the accountMaxValueByRiskScore rule idName | Type | Description |
---|---|---|
_action | ActionTypes | action type |
Name | Type | Description |
---|---|---|
<none> | uint32 | accountMaxValueByRiskScoreId rule id |
setAccountDenyForNoAccessLevelId
that setting a rule will automatically activate it. Set the activateAccountDenyForNoAccessLevel. Restricted to app administrators only.Name | Type | Description |
---|---|---|
_actions | ActionTypes[] | action types in which to apply the rules |
setAccountDenyForNoAccessLevelIdFull
that setting a rule will automatically activate it. Set the activateAccountDenyForNoAccessLevel. Restricted to app administrators only.Name | Type | Description |
---|---|---|
_actions | ActionTypes[] | actions to have the rule applied to |
clearAccountDenyForNoAccessLevel
Clear the rule data structuresetAccountDenyForNoAccessLevelIdUpdate
that setting a rule will automatically activate it. Set the AccountDenyForNoAccessLevelRuleId.Name | Type | Description |
---|---|---|
_action | ActionTypes | the action type to set the rule |
activateAccountDenyForNoAccessLevelRule
enable/disable rule. Disabling a rule will save gas on transfer transactions.Name | Type | Description |
---|---|---|
_actions | ActionTypes[] | action types |
_on | bool | boolean representing if a rule must be checked or not. |
isAccountDenyForNoAccessLevelActive
Tells you if the AccountDenyForNoAccessLevel Rule is active or not.Name | Type | Description |
---|---|---|
_action | ActionTypes | the action type |
Name | Type | Description |
---|---|---|
<none> | bool | boolean representing if the rule is active |
setAccountMaxReceivedByAccessLevelId
that setting a rule will automatically activate it. Set the accountMaxReceivedByAccessLevelRule. Restricted to app administrators only.Name | Type | Description |
---|---|---|
_actions | ActionTypes[] | action types in which to apply the rules |
_ruleId | uint32 | Rule Id to set |
setAccountMaxReceivedByAccessLevelIdFull
that setting a rule will automatically activate it. Set the accountMaxReceivedByAccessLevelRule. Restricted to app administrators only.Name | Type | Description |
---|---|---|
_actions | ActionTypes[] | actions to have the rule applied to |
_ruleIds | uint32[] | Rule Id corresponding to the actions |
clearAccountMaxReceivedByAccessLevel
Clear the rule data structuresetAccountMaxReceivedbyAccessLevelIdUpdate
that setting a rule will automatically activate it. Set the AccountMaxReceivedbyAccessLevelRuleId.Name | Type | Description |
---|---|---|
_action | ActionTypes | the action type to set the rule |
_ruleId | uint32 | Rule Id to set |
activateAccountMaxReceivedByAccessLevel
enable/disable rule. Disabling a rule will save gas on transfer transactions.Name | Type | Description |
---|---|---|
_actions | ActionTypes[] | action types |
_on | bool | boolean representing if a rule must be checked or not. |
isAccountMaxReceivedByAccessLevelActive
Tells you if the accountMaxReceivedByAccessLevel Rule is active or not.Name | Type | Description |
---|---|---|
_action | ActionTypes | the action type |
Name | Type | Description |
---|---|---|
<none> | bool | boolean representing if the rule is active |
getAccountMaxReceivedByAccessLevelId
Retrieve the accountMaxReceivedByAccessLevel rule idName | Type | Description |
---|---|---|
_action | ActionTypes | action type |
Name | Type | Description |
---|---|---|
<none> | uint32 | accountMaxReceivedByAccessLevelId rule id |
setAccountMaxValueByAccessLevelId
that setting a rule will automatically activate it. Set the accountMaxValueByAccessLevelRule. Restricted to app administrators only.Name | Type | Description |
---|---|---|
_actions | ActionTypes[] | action types in which to apply the rules |
_ruleId | uint32 | Rule Id to set |
setAccountMaxValueByAccessLevelIdFull
that setting a rule will automatically activate it. Set the accountMaxValueByAccessLevelRule. Restricted to app administrators only.Name | Type | Description |
---|---|---|
_actions | ActionTypes[] | actions to have the rule applied to |
_ruleIds | uint32[] | Rule Id corresponding to the actions |
clearAccountMaxValueByAccessLevel
Clear the rule data structuresetAccountMaxValuebyAccessLevelIdUpdate
that setting a rule will automatically activate it. Set the AccountMaxValuebyAccessLevelRuleId.Name | Type | Description |
---|---|---|
_action | ActionTypes | the action type to set the rule |
_ruleId | uint32 | Rule Id to set |
activateAccountMaxValueByAccessLevel
enable/disable rule. Disabling a rule will save gas on transfer transactions.Name | Type | Description |
---|---|---|
_actions | ActionTypes[] | action types |
_on | bool | boolean representing if a rule must be checked or not. |
isAccountMaxValueByAccessLevelActive
Tells you if the accountMaxValueByAccessLevel Rule is active or not.Name | Type | Description |
---|---|---|
_action | ActionTypes | the action type |
Name | Type | Description |
---|---|---|
<none> | bool | boolean representing if the rule is active |
getAccountMaxValueByAccessLevelId
Retrieve the accountMaxValueByAccessLevel rule idName | Type | Description |
---|---|---|
_action | ActionTypes | action type |
Name | Type | Description |
---|---|---|
<none> | uint32 | accountMaxValueByAccessLevelId rule id |
setAccountMaxValueOutByAccessLevelId
that setting a rule will automatically activate it. Set the AccountMaxValueOutByAccessLevel. Restricted to app administrators only.Name | Type | Description |
---|---|---|
_actions | ActionTypes[] | action types in which to apply the rules |
_ruleId | uint32 | Rule Id to set |
setAccountMaxValueOutByAccessLevelIdFull
that setting a rule will automatically activate it. Set the AccountMaxValueOutByAccessLevel. Restricted to app administrators only.Name | Type | Description |
---|---|---|
_actions | ActionTypes[] | actions to have the rule applied to |
_ruleIds | uint32[] | Rule Id corresponding to the actions |
clearAccountMaxValueOutByAccessLevel
Clear the rule data structuresetAccountMaxValueOutByAccessLevelIdUpdate
that setting a rule will automatically activate it. Set the AccountMaxValueOutByAccessLevelRuleId.Name | Type | Description |
---|---|---|
_action | ActionTypes | the action type to set the rule |
_ruleId | uint32 | Rule Id to set |
activateAccountMaxValueOutByAccessLevel
enable/disable rule. Disabling a rule will save gas on transfer transactions.Name | Type | Description |
---|---|---|
_actions | ActionTypes[] | action types |
_on | bool | boolean representing if a rule must be checked or not. |
isAccountMaxValueOutByAccessLevelActive
Tells you if the AccountMaxValueOutByAccessLevel Rule is active or not.Name | Type | Description |
---|---|---|
_action | ActionTypes | the action type |
Name | Type | Description |
---|---|---|
<none> | bool | boolean representing if the rule is active |
getAccountMaxValueOutByAccessLevelId
Retrieve the accountMaxValueOutByAccessLevel rule idName | Type | Description |
---|---|---|
_action | ActionTypes | action type |
Name | Type | Description |
---|---|---|
<none> | uint32 | accountMaxValueOutByAccessLevelId rule id |
setAccountMaxTxValueByRiskScoreId
that setting a rule will automatically activate it. Set the accountMaxTxValueByRiskScore. Restricted to app administrators only.Name | Type | Description |
---|---|---|
_actions | ActionTypes[] | action types in which to apply the rules |
_ruleId | uint32 | Rule Id to set |
setAccountMaxTxValueByRiskScoreIdFull
that setting a rule will automatically activate it. Set the accountMaxTxValueByRiskScore. Restricted to app administrators only.Name | Type | Description |
---|---|---|
_actions | ActionTypes[] | actions to have the rule applied to |
_ruleIds | uint32[] | Rule Id corresponding to the actions |
clearAccountMaxTxValueByRiskScore
Clear the rule data structuresetAccountMaxTxValueByRiskScoreIdUpdate
that setting a rule will automatically activate it. Set the AccountMaxTxValueByRiskScoreRuleId.Name | Type | Description |
---|---|---|
_action | ActionTypes | the action type to set the rule |
_ruleId | uint32 | Rule Id to set |
activateAccountMaxTxValueByRiskScore
enable/disable rule. Disabling a rule will save gas on transfer transactions.Name | Type | Description |
---|---|---|
_actions | ActionTypes[] | action types |
_on | bool | boolean representing if a rule must be checked or not. |
isAccountMaxTxValueByRiskScoreActive
Tells you if the accountMaxTxValueByRiskScore Rule is active or not.Name | Type | Description |
---|---|---|
_action | ActionTypes | the action type |
Name | Type | Description |
---|---|---|
<none> | bool | boolean representing if the rule is active |
getAccountMaxTxValueByRiskScoreId
Retrieve the AccountMaxTxValueByRiskScore rule idName | Type | Description |
---|---|---|
_action | ActionTypes | action type |
Name | Type | Description |
---|---|---|
<none> | uint32 | accountMaxTxValueByRiskScoreId rule id |
activatePauseRule
This function uses the onlyOwner modifier since the appManager contract is calling this function when adding a pause rule or removing the final pause rule of the array. enable/disable rule. Disabling a rule will save gas on transfer transactions. This function does not use ruleAdministratorOnly modifier, the onlyOwner modifier checks that the caller is the appManager contract.Name | Type | Description |
---|---|---|
_on | bool | boolean representing if a rule must be checked or not. |