Quantillon Protocol

Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

AccessControlLibrary

Git Source

Author: Quantillon Labs - Nicolas Bellengé - @chewbaccoin

Access control functions for Quantillon Protocol

Main characteristics:

  • Role-based access control validation functions
  • Address and amount validation utilities
  • Reduces contract bytecode size through library extraction
  • Provides standardized error handling for access control

Note: security-contact: team@quantillon.money

Functions

onlyGovernance

Ensures the caller has governance role

Reverts with NotGovernance if caller lacks GOVERNANCE_ROLE

Notes:

  • security: Validates caller has GOVERNANCE_ROLE before allowing access

  • validation: No input validation required - view function

  • state-changes: No state changes - view function only

  • events: No events emitted

  • errors: Throws NotGovernance if caller lacks required role

  • reentrancy: Not applicable - view function

  • access: Internal function - no access restrictions

  • oracle: No oracle dependencies

function onlyGovernance(AccessControlUpgradeable accessControl) internal view;

Parameters

NameTypeDescription
accessControlAccessControlUpgradeableThe access control contract to check roles against

onlyVaultManager

Ensures the caller has vault manager role

Reverts with NotVaultManager if caller lacks VAULT_MANAGER_ROLE

Notes:

  • security: Validates caller has VAULT_MANAGER_ROLE before allowing access

  • validation: No input validation required - view function

  • state-changes: No state changes - view function only

  • events: No events emitted

  • errors: Throws NotVaultManager if caller lacks required role

  • reentrancy: Not applicable - view function

  • access: Internal function - no access restrictions

  • oracle: No oracle dependencies

function onlyVaultManager(AccessControlUpgradeable accessControl) internal view;

Parameters

NameTypeDescription
accessControlAccessControlUpgradeableThe access control contract to check roles against

onlyEmergencyRole

Ensures the caller has emergency role

Reverts with NotEmergencyRole if caller lacks EMERGENCY_ROLE

Notes:

  • security: Validates caller has EMERGENCY_ROLE before allowing access

  • validation: No input validation required - view function

  • state-changes: No state changes - view function only

  • events: No events emitted

  • errors: Throws NotEmergencyRole if caller lacks required role

  • reentrancy: Not applicable - view function

  • access: Internal function - no access restrictions

  • oracle: No oracle dependencies

function onlyEmergencyRole(AccessControlUpgradeable accessControl) internal view;

Parameters

NameTypeDescription
accessControlAccessControlUpgradeableThe access control contract to check roles against

onlyLiquidatorRole

Ensures the caller has liquidator role

Reverts with NotLiquidatorRole if caller lacks LIQUIDATOR_ROLE

Notes:

  • security: Validates caller has LIQUIDATOR_ROLE before allowing access

  • validation: No input validation required - view function

  • state-changes: No state changes - view function only

  • events: No events emitted

  • errors: Throws NotLiquidatorRole if caller lacks required role

  • reentrancy: Not applicable - view function

  • access: Internal function - no access restrictions

  • oracle: No oracle dependencies

function onlyLiquidatorRole(AccessControlUpgradeable accessControl) internal view;

Parameters

NameTypeDescription
accessControlAccessControlUpgradeableThe access control contract to check roles against

onlyYieldManager

Ensures the caller has yield manager role

Reverts with NotYieldManager if caller lacks YIELD_MANAGER_ROLE

Notes:

  • security: Validates caller has YIELD_MANAGER_ROLE before allowing access

  • validation: No input validation required - view function

  • state-changes: No state changes - view function only

  • events: No events emitted

  • errors: Throws NotYieldManager if caller lacks required role

  • reentrancy: Not applicable - view function

  • access: Internal function - no access restrictions

  • oracle: No oracle dependencies

function onlyYieldManager(AccessControlUpgradeable accessControl) internal view;

Parameters

NameTypeDescription
accessControlAccessControlUpgradeableThe access control contract to check roles against

onlyAdmin

Ensures the caller has admin role

Reverts with NotAdmin if caller lacks DEFAULT_ADMIN_ROLE

Notes:

  • security: Validates caller has DEFAULT_ADMIN_ROLE before allowing access

  • validation: No input validation required - view function

  • state-changes: No state changes - view function only

  • events: No events emitted

  • errors: Throws NotAdmin if caller lacks required role

  • reentrancy: Not applicable - view function

  • access: Internal function - no access restrictions

  • oracle: No oracle dependencies

function onlyAdmin(AccessControlUpgradeable accessControl) internal view;

Parameters

NameTypeDescription
accessControlAccessControlUpgradeableThe access control contract to check roles against

validateAddress

Validates that an address is not the zero address

Reverts with InvalidAddress if address is zero

Notes:

  • security: Prevents zero address usage which could cause loss of funds

  • validation: Validates addr != address(0)

  • state-changes: No state changes - pure function

  • events: No events emitted

  • errors: Throws InvalidAddress if address is zero

  • reentrancy: Not applicable - pure function

  • access: Internal function - no access restrictions

  • oracle: No oracle dependencies

function validateAddress(address addr) internal pure;

Parameters

NameTypeDescription
addraddressThe address to validate

validateAmount

Validates that an amount is not zero

Reverts with InvalidAmount if amount is zero

Notes:

  • security: Prevents zero amount operations which could cause unexpected behavior

  • validation: Validates amount > 0

  • state-changes: No state changes - pure function

  • events: No events emitted

  • errors: Throws InvalidAmount if amount is zero

  • reentrancy: Not applicable - pure function

  • access: Internal function - no access restrictions

  • oracle: No oracle dependencies

function validateAmount(uint256 amount) internal pure;

Parameters

NameTypeDescription
amountuint256The amount to validate

validatePositiveAmount

Validates that an amount is positive (> 0)

Reverts with InvalidAmount if amount is zero or negative

Notes:

  • security: Prevents zero or negative amount operations which could cause unexpected behavior

  • validation: Validates amount > 0

  • state-changes: No state changes - pure function

  • events: No events emitted

  • errors: Throws InvalidAmount if amount is zero or negative

  • reentrancy: Not applicable - pure function

  • access: Internal function - no access restrictions

  • oracle: No oracle dependencies

function validatePositiveAmount(uint256 amount) internal pure;

Parameters

NameTypeDescription
amountuint256The amount to validate