Under the Hood of a Lending Network

Examining the Parameters Used to Configure a Lending Network

There are many parameters that go into the creation of a custom lending network. These parameters can broadly be divided into two categories:

  • Tunable Parameters: those that can be customized and changed to fit the creator's needs

  • State Parameters: those that apply to each Money Market and define their overall state

This section goes over all the parameters in these two categories and their definitions.

Tunable Parameters of a MM

Parameter NameDescription

collateralFactor

A multiplier representing the amount you can borrow against your collateral (eg. collateralFactor of 0.8 to allow borrowing 80% of collateral value). Must be between 0 and 1.

liquidationFactor

A multiplier representing the liquidation threshold. For example, liquidationFactor of 0.9 means that if the amount you borrow is worth (at least) 0.9 of your collateral, your position is subject to liquidation. Must follow: collateralFactor <= liquidationFactor< 1.

liquidationIncentive

A multiplier representing the additional percent value that a user calling liquidate receives, eg. 1.05 for a 5% bonus. This discount applies to the asset being seized (that is, what was used as collateral).

reserveFactor

The portion of borrower-paid interest (per block) that goes to the reserve. The remainder of the borrower-paid interest goes to the MM's suppliers.

activeCollateralCapUSD

The maximum value (in USD) that can be used as collateral to borrow against. To be used as collateral, the total active collateral in said asset must be smaller than activeCollateralCapUSD.

borrowCap

The maximum number of tokens that can be borrowed from a MM (best thought of in terms of a percentage of tokens in circulation, eg. if there are 100,000,000 tokens in circulation, then a borrowCap of 5,000,000 is 5%)

closeFactor

The maximum percentage of the loan that the liquidator can repay; in Ola, the closeFactor is a constant set at 50% across all lending networks.

State Parameters of a MM

At this time, there is a maximum of 30 Money Markets allowed per lending network. Every MM's smart contract includes the following components:

Parameter NameDescription

underlyingToken

The token that can be lent/borrowed in the MM .

cash

The amount of underlyingToken held by the MM. The balance increases whenever tokens are deposited into the MM, and decreases whenever tokens are borrowed from the MM.

borrowedBalance

The total amount of underlyingToken that has been lent to borrowers. This amount grows, on a per-block basis, according to the interest rate that borrowers need to pay.

reserveBalance

The total amount of underlyingToken that the MM has set aside as a protocol fee. This amount increases as borrowers pay interest and decreases when the admin withdraws these tokens. The reserve can be used, among other things, as an insurance fund to cover bad debt incurred by the MM.

oToken

A receipt token that's minted and credited to the depositor of underlyingToken in a MM. Whoever holds oToken can claim the underlyingToken from the MM. The conversion rate from oToken to underlyingToken absorbs the interest that borrowers pay. This means that 1 oToken is worth more underlyingToken as time passes.

In addition to the parameters found in the MM's smart contract, other variables pertaining to each MM must be determined before launching a Lending Network.

Interest Rate Model

The interest rate model is a function implemented in each MM; it takes the utilization rate of the MM as input and outputs the interest rate (per block) that borrowers pay.

  • Utilization Rate: The ratio between the total amount deposited into a MM and the amount borrowed from it, calculated as: borrowedBalance / (underlyingBalance + borrowedBalance - reserveBalance)

An interest rate model needs to make sense, so Ola has pre-approved a few interest rate models from which LeN creators can choose. You can view the approved Interest Rate Models and see which model is used by each money market here: Whitelisted Interest Rate Models

Price Oracles

A price oracle is a smart contract that can be queried for the real-time price of the underlyingToken. The comptroller can this way get the updated price whenever it's needed. Some oracles rely on off-chain services that regularly report the asset's price and write it on-chain. Other oracles are purely on-chain, relying on an AMM.

At Ola, there are three options for oracles to enable an accurate price feed for a MM:

  • A responsive price feed system from an oracle provider with which Ola is integrated:

    • Chainlink

    • Band

    • Witnet

    • DIA

    • More coming soon

  • A low-resolution period TWAP price oracle, based on on-chain AMMs (eg. UniswapV2 Pairs)

  • A combination of an oracle provider backed by an anchor price

    • Coinbase Pro price feed with a UniswapV2 Pair TWAP as anchor price.

Oracle Provider

Using data feeds from reliable oracle providers, Ola's smart contracts can retrieve the latest pricing data of an asset by querying the provider's data registry.

TWAP

When possible, using one of Ola's integrated oracle providers is preferred. When a token is not supported by one of these oracles, a TWAP from a token pair containing sufficient liquidity can be used instead. The period is a configurable parameter per asset; for example, stablecoins might have a longer period of time (eg. 3 hours) and more volatile tokens might have a shorter period (eg. 20-30 minutes). We can use any type of UniswapV2 Pair clone in order to calculate TWAPs. UniswapV3 and BalancerV2 Pools will be supported soon.

Oracle Provider + Anchor Price

Compound's Open Price Feed is a system that "allows Reporters to sign price data using a known public key, which Posters (any Ethereum address) can submit on-chain." At present, the only accepted reporter is Coinbase Pro, but we intend to add more reporters soon.

The price indicated by the price feed is not accepted automatically; rather, it must be within a predefined range across the anchor price. The band is a configurable parameter per asset; for example, stablecoins might have a tighter band (eg. 1%) and more volatile tokens a wider band (eg. 10-15%). Every time a poster reports the price of an asset, the system checks the anchor price, and if within the accepted band, the official price of the asset updates.

Last updated