MetaLend Litepaper
Version 2.0, November 2nd 2023
Authors: Sudjeev Singh, Nikhil Bhardwaj, Tegjeev Singh, Jan Smrza
Abstract
In this paper we introduce a protocol which leverages liquidity pools with algorithmically set interest rates to enable lending against yield generating ERC-20 and ERC-721 assets, while keeping these assets in a productive state. MetaLend is a fork of and has been inspired by the Compound protocol.
Table of Contents
MetaLend <> Sky Mavis Partnership
Borrowing Assets
MetaLend enables borrowers to take out ERC-20 based loans against yield-generating ERC-20 (Staked RON and Staked AXS) and ERC-721 assets (specifically Axie Lands). Borrowers still have full rights to any yield that is generated by those assets.
Collateral Value & Max LTV
All MetaLend loans are over-collateralized to protect the protocol from the risk of borrowers being unable or unwilling to pay back their loans.
If a borrower crosses the max loan-to-value, their collateral is subject to liquidation as defined by the rules in the ‘Risk and Liquidation’ section below.
Current Max Loan-To-Value: 30% for NFTs, 50% for Tokens
The Max LTV is set by ERC-721 asset category (e.g. Axie Land) and will initially be set by the centralized authority MetaLend, Inc. before eventually passing over to the owners of governance tokens upon decentralization.
Payback Period
There is no defined payback period for loans - if a borrower’s collateral value drops or their interest accrues to the point where they’ve crossed the max LTV the protocol will initiate asset liquidation to pay down the loan.
MetaLend <> Sky Mavis Partnership
The MetaLend protocol is deployed directly on the Ronin chain and all loans are processed via smart contracts on Ronin with no change of custody taking place, the only way a user can lose ownership of an asset is if the conditions of shortfall are met (see section on LTV/liquidations below).
MetaLend enables for asset owners to continue earning staking rewards during an active loan (e.g. Staked Land, AXS) - not only does it enable, but also has functionality to automate re-staking for the user directly via the dapp. In the future - MetaLend is working with the Ronin team to enable gameplay while an asset is being used as collateral for a loan.
Deployed Ronin Smart Contracts
Name | Address |
---|---|
Metalend Comptroller | |
Metalend MetaComptroller | |
Metalend WETH Market | |
Metalend cAxie | |
Metalend Interest Rate Model | |
Metalend Liquidity Assessor | |
Metalend Price Oracle | |
Metalend Appraisal Oracle | |
Metalend cAxieLand | |
Metalend Staking Manager | |
Metalend cAXS | |
Metalend cRON | |
Metalend Maximillion | |
Metalend Axie Mystic Validator |
Appraisal Engine
ERC-721
All ERC-721 collateral that is locked within the MetaLend protocol is ascribed a value based on it’s specific appraisal engine. A specific appraisal engine is built for each ERC-721 category that is accepted as collateral, and all collateralized assets are re-appraised hourly (frequency will increase over time). These models are subject to update as we improve the system and push appraisals on chain.
MetaLend only supports Axie Lands as collateral and no longer supports Axies or Mystic Axies.
Model Version 2 (deployed May 23rd, 2023):
Each appraisal engine computes the floor price of its category. In the case of Axie Land, each land type defines a category (Savannah, Mystic, Forest and Arctic are the only types supported as collateral at this time). Metalend's floor price model, adapted from the Coinbase Cloud floor price model, is used in the calculation and can be accessed here.
This update was made over Model Version 1 in order to provide users with more accurate and stable appraisals, while maintaining protocol stability.
Model Version 1 (Deprecated):
The appraisal engines are currently run off-chain and are expected to move on-chain at a future date when MetaLend, Inc. verifies it is secure and feasible at scale.
Each appraisal engine uses a K-Nearest Neighbor Classifier to learn about token pricing from real-time marketplace transactions. Upon receiving a token ID, it effectively locates comparable ERC-721 tokens of the same type that have been sold or listed for sale. The appraisal is then calculated by weighting these transaction prices with the category's floor price, in proportion to the available pricing data for the token. Metalend's floor price model, adapted from the Coinbase Cloud floor price model, is used in the calculation and can be accessed here.
Protecting Appraisals Against Market Manipulation
Metalend applies well-established outlier detection techniques during the data preprocessing phase of modeling. Specifically, a median absolute deviation threshold on the log of transaction prices as well as an interquartile range on all transactions are used to identify and remove anomalous transactions from consideration in the appraisal process.
In simpler terms, the appraisal process eliminates unusual transaction prices by examining the average deviation from the typical price of similar transactions, aka outliers. We have also added caps to certain collateral categories to ensure that the protocol does not grow to the point where there are so many assets within the protocol that it could influence market pricing.
ERC-20
MetaLend now accepts Staked AXS as collateral for loans. Users can add their AXS to MetaLend, it will automatically be Staked for them and they can claim any rewards once every 24 hours (MetaLend takes a 1% service fee of the rewards claimed). Users can borrow up to 50% of the value of their Staked AXS in WETH. MetaLend does currently have a 50,000 Staked AXS collateral limit within the protocol, this is to ensure financial stability and gradual growth of the protocol. We'll be working to hopefully raise this cap much higher soon!
For more details on this cap, please see the following analysis:
Compounding AXS Rewards
MetaLend provides automatic “compounding” (restaking) of staked rewards for supported assets including AXS and Axie Land. This is achieved through a “mediator” mechanism where a Ronin contract is created only once for each user EOA upon their first deposit of any stake-eligible asset. All transactions to the mediator are proxied directly to the Ronin official staking contracts (AXS, Axie Land) for managing accrual and payout of rewards.
The increased APR that MetaLend is able to provide through compounding is a result of daily restaking. Our offchain service layer checks whether a user is eligible to restake (claim + redeposit) based on Ronin’s 24 hour cooldown rule and facilitates this transaction, charging a 1% service fee on the daily accrued rewards.
Let’s consider Ronin’s official staking pool rewards (found on their staking dashboard), for example 37% APR as of May 8 2023 - note that this is subject to change.
Staked RON
Similar to AXS, Metalend allows users to stake their RON (currently through governing validators) and maximize yield through daily compounding. This supplied RON can also be used as collateral to take out a borrow against in any of our supported markets (RON, USDC, WETH).
Transfer In of Non-Collateralized RON
Transferring-in of non-collateralized RON can be done towards any validator which you currently do not use to hold collateralized RON. You can increase the balance at any time. We automatically re-stake the rewards from this validator to itself. For this, you have to supply RON to our re-staking admin address which sends the transactions on your behalf.
Transfer In of Collateralized RON
Transferring-in of collateralized RON can be done in two ways:
Move existing stake towards a given validator to the protocol as a collateral. This does not refresh the lockup period and the collateral is available as soon as the lockup expires (or immediately if the lockup has already expired).
Stake a new amount towards a validator. If the validator is already used to hold a non-collateralized stake amount, both the existing amount + the new amount are transferred to the protocol as a collateral. This amount is available as a collateral after 3 days once the lockup expires.
In both cases, the transfer can be done only to empty validators or validators which currently hold non-collateralized RON. At no point in time can the balance of a validator which holds collateralized RON be increased.
During this transfer, you have to select an empty validator or a validator which currently holds non-collateralized RON as a target for re-staking of the rewards.
In edge-case if you have all validators except the last one used to hold collateralized RON, you cannot use the last available validator as a collateral, because at least one validator must be available at all times as the target for re-staking rewards of validators which hold collateralized RON.
If a validator is used as a target for re-staking rewards of other validators and you would like to stake collateralized RON towards this validator, the target of all the validators will shift to the newly selected target.
Delegation lock-up (transfer out of non-col RON)
Since we re-stake rewards on your behalf daily, the lockup period is being refreshed continuously. This means as long as re-staking is being done for a given validator, it is not possible to transfer out the assets. Thus, in order to withdraw, you have to opt-out of the rewards (or select a new target for re-staking of the rewards) so that the lockup period can expire. After opting-out, you will be available to transfer out after 3 days at maximum. Re-staking is being done daily at approximately ~00:30 which refreshes the period for next 72 hours.
If the validator which holds non-collateralized RON is being used as a target for re-staking rewards you have to select a new target for re-staking of the rewards for this validator and all other validators which are currently re-staking towards it.
Delegation lock-up (transfer out of principal)
Due to the existing 3 day lockup period it takes at maximum 3 days for RON transferred to the protocol to become collateral. Once the period is over, your liquidity increases as well as your maximum available borrow. At this point the RON amount can be:
Withdrawn by yourself (if you have sufficiently enough liquidity so that withdrawing the amount would not trigger shortfall)
Liquidated (if you get into shortfall)
Working with multiple validators
Each validator which holds collateralized RON must have a different re-staking target (empty or validator with existing non-collateralized RON).
Each non-collateralized validator can re-staking rewards into itself or to a different empty validator or validator with existing non-collateralized RON.
If you would like to have some RON available to become a collateral at all times immediately (with no 3 days wait), we recommend staking a certain non-collateralized amount with a validator and opting-out of rewards (or selecting a different target for this validator). This means that the lockup period expires after 3 days and in the future, you can move the assets to the protocol which will be available to use as collateral immediately.
Risk and Liquidation
What happens if a borrower goes over the Max LTV (Borrow Limit)?
If a borrower exceeds their borrow limit, MetaLend will immediately list their collateral for sale with a 10% liquidation discount - liquidators will be able to repay up to 10% of the loan at a time. If the protocol is forced to sell a larger asset to pay down the loan, the difference (minus gas fees) will always go back to the borrower. MetaLend leverages this liquidation strategy to mitigate risk during a market crash.
Example:
If the max LTV is 30% and a user has 50 Axie Lands with a total worth of $100,000 as collateral - their max loan amount will be $30,000.
If said user takes out a $20,000 loan, they’re below the max loan - but if the Axie Land market drops and their collateral goes from being worth $100,000 to being worth $65,000 they are now above your max loan by $500. As their collateral is dropping in value the borrower will receive notifications from MetaLend (if they’ve provided their email/phone) and if the borrower doesn't pay back part of their loan or add more collateral to get back below the 30% mark then the protocol will sell Axie Lands needed to get them under the 30% threshold. Liquidators can pay back 10% of the loan at a time.
For example in this case a liquidators may buy a single Axie Land for $1000 and use that to pay off the underwater part of the loan. This would bring the loan to $19,000 and the collateral value to $64,000 - the borrower can still pay off the entire remainder of the loan and remove collateral if they wish.
Communication
MetaLend will communicate via email and/or text notifications (if user information is provided) to ensure users are aware as they approach their max LTV threshold.
Supplying Assets
MetaLend enables suppliers to stake their ERC-20 tokens into “lending pools” in order to earn APY. The funds in these liquidity pools are then used to provide loans to the borrowers. Upon adding funds into the pool, the lenders receive a mToken which represents their deposit and tracks their interest earned.
Lenders are paid out 85% of the total borrower interest, 15% goes to the protocol.
Functionally speaking, suppliers interest is accrued per ETH block mined and they can remove their deposited ERC-21 plus interest at any point.
Interest Rate Calculations
MetaLend leverages algorithmically set APYs to incentivize borrowers and lenders to behave in a way that ensures a base set of liquidity to remain within the MetaLend liquidity pools.
APY is variable and is a function of the Utilization of the liquidity pool - the higher the utilization of the pool, the higher the APY. We leverage two curves and an inflection point known as the ‘Kink’. The function of the kink is to define the utilization rate at which APY rapidly rises to incentivize borrowers and lenders to add more liquidity to the pool.
The exact APY curves for launch of the ETH pool to provide liquidity for Axie’s can be seen below:
Borrower Curve 1: y = 0.43x
Kink: 70%
Borrower Curve 2 Slope: y = 9x - 6
Lender APY Calculation: Borrow APY * Utilization Rate * Lender Rev Share
The APY curves are set by liquidity pool (e.g. ETH) and will initially be set by the centralized authority MetaLend, Inc. before eventually passing over to the owners of governance tokens upon decentralization.
Calculating the APY Using Rate Per Block
The Annual Percentage Yield (APY) for supplying or borrowing in each market can be calculated using the value of supplyRatePerBlock
(for supply APY) or borrowRatePerBlock
(for borrow APY) in this formula:
Here is an example of calculating the supply and borrow APY with Web3.js JavaScript:
Calculating the APR Using Rate Per Block
Here is an example of calculating the supply and borrow APR with Web3.js JavaScript:
Governance & Decentralization
MetaLend will begin with centralized control of the protocol (such as choosing the interest rate model per asset), and over time, will transition to complete community and stakeholder control. Admin Currently the protocol admin is a secure Gnosis multisig EOA on the Ronin chain with secure participation by core contributors, ensuring that no single actor can perform nefarious actions against the protocol.
The following rights in the protocol are controlled by the admin:
● The ability to list a new mToken market
● The ability to update the interest rate model per market
● The ability to update the appraisal engine per market
● The ability to withdraw the reserve of an mToken
● The ability to choose a new admin, such as a DAO controlled by the community; because this DAO can itself choose a new admin, the administration has the ability to evolve over time, based on the decisions of the stakeholders.
Last updated