Credit accounts
Architecture

Architecture

Gearbox V3 separates logic for utilizing Credit Accounts into several contracts for increased modularity. These include:

ContractResponsibility
CreditAccountThe Credit Account itself, which has simple logic for transferring assets and executing calls with a target and calldata passed to it by the Credit Manager.
CreditManagerA "backend" for all Credit Account operations, which performs collateral checks and facilitates execution of both external and internal (account management) calls. It also stores important parameters and provides a unified interface for computing CA health.
CreditFacadeA "frontend" contract that CA owners directly interact with. To manage CAs, users submit arrays of MultiCall structs that the Credit Facade parses, orchestrating the requested internal and external actions. There is always a one-to-one relationship between the Credit Facade and Credit Manager.
CreditConfiguratorA contract that is used to change important Credit Manager and Credit Facade parameters. Can only be directly interacted with by the Gearbox DAO and some assigned controllers. There is always a one-to-one relationship between the Credit Configurator and Credit Manager.
AdaptersA set of contracts that are used as interfaces to interact with external protocols. Adapters build the calldata that is then passed by the Credit Manager to CA for execution. Cannot be called directly; instead, calls to them must be included into Credit Facade multicalls.
PoolThe pool is the contract that stores liquidity available for borrowing. There is always only one pool per Credit Manager, but several Credit Managers can be connected to a single pool
PoolQuotaKeeperPoolQuotaKeeper is a contract that stores quotas set by CA owners and tracks quota interest and quota increase fees. There is one PoolQuotaKeeper per pool.
AccountFactoryAccountFactory is a contract that stores reusable Credit Accounts. Credit Accounts are handed off to Credit Managers on account opening, and returned on account closure.
PriceOracle and price feedsPriceOracle is a contract that supplies prices for collateral calculations. There are many price feeds connected to a single PriceOracle, which serves as the main entry point for all price retrieval.
GaugeThe Gauge is a contract that computes quota interest rates and supplies them to the PoolQuotaKeeper. It is not directly involved with Credit Account operations, but can be useful for the purposes of data analysis and planning
Last updated on November 16, 2023