Developers
Searchโ€ฆ
๐Ÿ’—
CoreBorrow - Integrity of the Borrowing Module
Integrity of the Borrowing Module
This contract associated to Angle Borrowing Module is not yet available and will soon be open-sourced.

1. Introduction

The CoreBorrow contract is the contract responsible for handling the access control across all the borrowing module: it is what is read by all Treasury contracts. 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, regardless of how many stablecoins are handled by this module.

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 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 Treasury contracts to verify roles of addresses calling it:
  • 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