💗CoreBorrow - Access Control Manager
Integrity of the Borrowing Module
Contract Name:
CoreBorrow
1. Introduction
The CoreBorrow
contract is the contract responsible for handling the access control across all the modules of the protocol. It is notably what is read by all Treasury
contracts in the Borrowing module. It also manages the flashloan module. It has no minting rights though over stablecoin contracts.
Apart from some external view function, this contract only contains functions accessible to governance.
Only one version of this contract should be deployed per chain.
2. Contract Details
Interfaces
Implements ICoreBorrow
, Initializable
and AccessControlEnumerableUpgradeable
. This contract is upgradeable.
References
flashLoanModule
: Reference to the flashloan module for the stablecoin
Access Control
This contract is the only contract of the module which implements the AccessControl
logic from OpenZeppelin. The enumerable logic is even implemented which enables to easily track which addresses have which role.
3. Key Mechanisms & Concepts
State-Changing Functions
The external state-changing functions of this protocol are only available to addresses (normally only one) with a governor role on the protocol:
addFlashLoanerTreasuryRole
: To allow flash loans on a stablecoin of the protocoladdGovernor
: To add a governor within the protocolremoveFlashLoanerTreasuryRole
: To revoke the flash loan ability for a stablecoinremoveGovernor
: Revokes a governor from the protocolsetFlashLoanModule
: Changes theflashLoanModule
of the protocolsetCore
: Changes the core contract of the protocol
View Functions
There are some view functions for contracts to verify roles of addresses calling it within the Borrowing Module (through the Treasury
contract in this case), or within any other protocol module:
isFlashLoanerTreasury
: Checks whether a treasury contract is whitelisted so that flash loans can be taken on its associated stablecoinisGovernor
: Checks whether an address has theGOVERNOR_ROLE
isGovernorOrGuardian
: Checks whether an address has theGUARDIAN_ROLE
: by construction, all governors should also be guardian of the protocol
Last updated