Docs
  • ⛵Lodestar Finance
  • Getting Started
    • 👨‍🌾User Guide
    • ❓FAQ
    • 🏗️Deployed Contracts
  • Documentation
    • 👩‍🔬Technical Overview
      • Supply
      • Collateral
        • Collateral Factors
      • Borrow
      • Interest
        • Interest Rate Model 1
        • Interest Rate Model 2
        • Interest Rate Model 3
        • Interest Rate Model 4
        • Interest Rate Model 5
      • Reserves
        • Reserve Factors
        • Rake
      • Liquidation
      • Staking
        • Emission Gauge Voting
      • Looping
    • 🤖Contracts
      • Lens
      • Comptroller
        • LODE Emissions
        • Events
        • Error Reporting
      • Oracles
      • Interest Rate Models
        • Constructor Arguments
      • lTokens
        • Market and Account State
        • Events
        • Error Reporting
    • ⚙️API
    • 🔐Security
    • 🗺️Roadmap
    • 🥚Inception
  • Tokenomics
    • 🧭LODE
  • Links
    • Twitter
    • Discord
    • Medium
    • Github
    • Lodestar Website
    • Lodestar dApp
    • Lodestar Liquidity Mining
    • LODE Token Claim for Aelin Supporters
Powered by GitBook
On this page
  • Introduction
  • Market Functions
  • Enter Markets
  • Exit Markets
  • Account Functions
  • Get Assets In
  • Get Account Liquidity
  • Collateral Factor
  • Close Factor
  • Liquidation Incentive
  • Market Metadata
  1. Documentation
  2. Contracts

Comptroller

The risk management layer of the protocol.

Introduction

The Comptroller is the heart and soul of all of the risk-management related business logic within the protocol. It determines multiple things, including but not limited to:

  • How much collateral a user is required to maintain

  • Whether a user can be liquidated.

  • How much a user can be liquidated for.

  • What markets are supported.

  • Mapping user balances to prices and their respective collateral factors.

  • Quantifies risk based off assets that a user is using in the protocol.

The Comptroller is also implemented as an upgradeable proxy, and the proxy contract is called the Unitroller. The Unitroller acts as a proxy for all logic and delegate calls the contract methods of the Comptroller contract and state parameters are stored in the Unitroller contract.

To properly call Comptroller functions, please use the Comptroller ABI on the Unitroller address.

Market Functions

Enter Markets

When a user supplies assets to the protocol, the enterMarkets function is called with the associated cToken address. By calling this function, the respective asset is marked as collateral and is able to be borrowed against.

Exit Markets

A user can remove supplied assets from account health calculations by calling the exitMarkets function.

Account Functions

Get Assets In

In order to decide how much account liquidity a user has and which markets they have entered, the Comptroller calls the getAssetsIn function. All entered markets count towards the total liquidity an account has available.

Get Account Liquidity

Overview

Comptroller logic

Each time an asset is supplied, borrowed, withdrawn or repaid, an accounts overall liquidity will change accordingly.

  • Supplying increases the Account Liquidity of an account.

  • Borrowing reduces the Account Liquidity of an account.

  • Withdrawing reduces Account Liquidity by refactoring the account's overall liquidity per the equation listed above.

  • Repaying increases Account Liquidity of an account by refactoring the account's overall liquidity per the equation listed above.

Collateral Factor

Large, blue chip, liquid assets will have high Collateral Factors and will be able to be used as prime-collateral. Small, more niche, illiquid assets will have low Collateral Factors. Some assets may not have a Collateral Factor, which means they cannot be used as collateral and borrowed against.

Close Factor

The Comptroller applies the closeFactor to a single borrowed asset, not the aggregated value of all of the assets a user has borrowed.

Liquidation Incentive

This value is represented by the liquidationIncentiveMantissa parameter and acts as an incentive for liquidators to liquidate unhealthy accounts. The protocols default liquidation incentive for V0 is 8%.

Market Metadata

The Comptroller provides a useful function, getAllMarkets , that can be used to retrieve all of the currently supported lToken markets and their corresponding addresses.

PreviousLensNextLODE Emissions

Last updated 1 year ago

As stated in the Account Liquidity paragraph on the section, this value can be used to see the maximum USD value borrowable for a particular account before it reaches liquidation. Any users that have a negative Account Liquidity are subject to liquidation. In addition, a user will not be able to use the protocol to withdraw assets or borrow additional assets until their Account Liquidity is positive again.

After a user has entered a market and the comptroller knows what assets they are in, it will then compute the available liquidity in the account. The Comptroller looks at each market a user has entered into and multiplies their balance by the respective assets , sums it up and then subtracts the balances; this yields Account Liquidity.

For additional more information, please see the Account Liquidity paragraph on the section.

Within the protocol, a lToken's Collateral Factor can currently fall within a range of 15-85% (subject to change by governance or with the addition of new markets). As described in our section, Lodestar places assets into different buckets based on their level of risk.

For more information on Collateral Factors, please see the and sections.

As outlined in the Close Factor paragraph on the section, the protocol has a default Close Factor of 0.5 and this represents the maximum amount (50%) of a user's borrow balance that can be liquidated in a single transaction. If a user's account is still insolvent after liquidation, the account can be liquidated again until the account is back in good standing.

For an example of how this breaks down and for more information on Liquidations, please see the section for additional information.

🤖
Collateral
Supply
Collateral Factor
Borrow
Collateral
Interest Rate Models
Collateral
Collateral Factors
Liquidation
Liquidation