Note: This specification is an initial draft and may contain incomplete, ambiguous, or incorrect details. Certain aspects may be included in the implementation but not documented here, while others may be described but not implemented. This document will be continuously updated as development progresses and my understanding of the subject expands.
GnoLend is a non-custodial lending protocol on Gno.land that facilitates lending and overcollateralized borrowing of crypto assets. The protocol operates through isolated lending pools, where each pool contains a single GRC20 token.
When users deposit assets into a pool, they receive interest-bearing gTokens, which represent their share of the lending pool. These gTokens accrue interest via a static rate mechanism and are transferable as GRC20 tokens. Users can borrow assets from any pool by providing collateral that exceeds their borrowed position value, with borrowing limits determined by asset-specific Loan-to-Value (LTV) ratios.
Each lending pool maintains the following key data:
GnoLend uses an interest-bearing token model, where users receive gTokens upon depositing assets into lending pools. These gTokens represent the user's share of the pool, including accrued interest. The system functions similarly to Aave’s aTokens, ensuring that depositors earn yield passively while maintaining liquidity through transferable GRC20-compliant gTokens.
Interest accrues continuously per block for both suppliers and borrowers. The protocol initially applies static interest rates, set through governance for each asset. Interest is compounded using the following formulas:
Supply Interest = Principal * (1 + supplyRate)^blocks
Borrow Interest = Principal * (1 + borrowRate)^blocks
When users supply assets, they receive gTokens at a 1:1 ratio to their deposit. Interest accrues over time, but instead of increasing the gToken balance, the Liquidity Index grows, which increases the redeemable value of gTokens.
Each user’s claimable amount is determined as:
redeemableAmount = gTokenBalance * (currentLiquidityIndex / initialLiquidityIndex)
This eliminates the need for an exchange rate mechanism, as gTokens always represent a proportional share of the lending pool, with accrued interest embedded in the Liquidity Index.
Users can manage their positions through the following actions:
The maximum amount a user can borrow is determined by the value of their supplied collateral and the asset-specific LTV ratio:
maxBorrow = collateralValue * LTV
Ensuring that all loans remain overcollateralized helps maintain protocol security and mitigates liquidation risks.
Currently, Gno.land lacks a reliable Oracle for token price feeds; therefore, the protocol relies on Gnoswap's liquidity pools for price discovery.
Prices are derived from Gnoswap's concentrated liquidity pools, where prices are stored in the sqrtPriceX96 format—a fixed-point representation commonly used in automated market makers (AMMs). The actual price is extracted and adjusted for token decimals through the following calculations:
sqrtPriceX96
to Actual PriceSince the price is stored in a square root format, we first square the sqrtPriceX96
value to obtain the raw price. However, because sqrtPriceX96
is a Q96 fixed-point number (meaning it has 96 fractional bits), squaring it results in a Q192 fixed-point number. To bring it back to a standard integer format, we divide by 2^192:
price = (sqrtPriceX96 * sqrtPriceX96) / (2^192)
Different tokens have different decimal precisions (e.g., USDC has 6 decimals, while GNOT has 12). To correctly scale the price, we adjust by the difference in decimals between token0 and token1:
adjustedPrice = price * (10^(token0Decimals - token1Decimals))
This ensures that the computed price is properly denominated based on the token pair's decimal format.
Through this approach, the protocol extracts reliable price data directly from Gnoswap's liquidity pools, making it functional even without an external Oracle.
The protocol uses a health factor to determine position safety. If a user's health factor falls below 1, their position becomes eligible for liquidation.
The health factor represents the ratio of collateral value to borrowed value, adjusted by the liquidation threshold:
healthFactor = (collateralValue * liquidationThreshold) / borrowValue
When liquidation occurs:
The amount of collateral liquidators receive is determined as follows:
collateralReceived = debtRepaid * (1 + liquidationBonus) / collateralPrice
Where:
debtRepaid
= Amount of debt the liquidator covers.liquidationBonus
= Additional collateral received as an incentive.collateralPrice
= Market price of the collateral asset.This mechanism ensures that undercollateralized positions are efficiently liquidated, maintaining protocol solvency and protecting lender funds.
The protocol continuously tracks key metrics for each user position to ensure accurate risk assessment and prevent undercollateralized borrowing. All values update dynamically with every user action.
Collateral Value = Sum(Asset Amount * Price)
Borrowed Value = Sum(Borrowed Amount * Price)
Health Factor = (Collateral Value * Liquidation Threshold) / Borrowed Value
Max Borrowable = (Collateral Value * LTV) - Borrowed Value
Liquidation Price = (Borrowed Value / Collateral Amount) * Liquidation Threshold
These metrics ensure that user positions are accurately monitored and that risk is managed dynamically, preventing protocol insolvency.
The protocol operates under a decentralized governance model, enabling GNL token holders to actively participate in decision-making processes. This governance framework extends GnoSwap's existing system to accommodate lending-specific parameters. Token holders engage in protocol governance by voting on various aspects, including:
For more details on how the GnoSwap governance model works, refer to GnoSwap Governance Documentation and Implementation.
The protocol's user interface provides functionality similar to other lending platforms like Aave and Compound on Ethereum. It allows users to monitor and manage their positions.
The interface is designed to provide essential data and controls for managing lending and borrowing operations.
The initial version of GnoLend implements core lending functionality with static interest rates and Gnoswap price feeds. Future updates will focus on improving capital efficiency, risk management, and user functionality.
Once a reliable Oracle system becomes available on Gno.land, the protocol will integrate a more robust price feed system using Volume-Weighted Average Price (VWAP) from Gnoswap pools. This will aggregate price data over multiple time windows to reduce price manipulation risks. The VWAP calculation will incorporate trading volume and liquidity depth to improve accuracy.
For more information on VWAP, refer to GnoSwap VWAP implementation.
The current static interest rate model will transition to a utilization-based dynamic interest rate system. Interest rates will adjust automatically based on pool utilization, ensuring more efficient capital allocation and better liquidity management.
Flash loans will allow users to execute atomic transactions such as arbitrage, collateral swaps, and liquidations without upfront capital. These loans must be borrowed and repaid within the same block, with a small fee contributing to protocol revenue.
An incentive system will be introduced to support protocol sustainability and efficiency by:
These improvements will enhance GnoLend’s functionality and adaptability as the ecosystem evolves.