💗
CoreBorrow - Access Control Manager
Integrity of the Borrowing Module
- Contract Name:
CoreBorrow
CoreBorrow.json
9KB
Code
CoreBorrow ABI
Introduced at the launch of the Borrowing module, 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.
Implements
ICoreBorrow
, Initializable
and AccessControlEnumerableUpgradeable
. This contract is upgradeable.flashLoanModule
: Reference to the flashloan module for the stablecoin
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.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
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