💗CoreBorrow - Access Control Manager

Integrity of the Borrowing Module

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


Implements ICoreBorrow, Initializable and AccessControlEnumerableUpgradeable. This contract is upgradeable.


  • 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 protocol

  • addGovernor: To add a governor within the protocol

  • removeFlashLoanerTreasuryRole: To revoke the flash loan ability for a stablecoin

  • removeGovernor: Revokes a governor from the protocol

  • setFlashLoanModule: Changes the flashLoanModule of the protocol

  • setCore: 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 stablecoin

  • isGovernor: Checks whether an address has the GOVERNOR_ROLE

  • isGovernorOrGuardian: Checks whether an address has the GUARDIAN_ROLE: by construction, all governors should also be guardian of the protocol

Last updated