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.
At this time, there is a maximum of 30 Money Markets allowed per lending network. Every MM's smart contract includes the following components:
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.
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
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:
- 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.
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.
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.
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.