These are the primary, non-negotiable variables set by protocol governance that define the risk and operational boundaries for all lending and borrowing activity.
Risk Parameters Used in On-Chain Margin Trading
Core Risk Parameters
Loan-to-Value (LTV) Ratio
The maximum borrowing power against a specific collateral asset, expressed as a percentage. For example, an LTV of 75% on ETH means a $100 deposit allows borrowing up to $75 in other assets.
- Defines initial leverage and collateral efficiency.
- Directly sets the liquidation threshold buffer.
- A primary lever for managing collateral risk concentration.
- Higher LTV increases capital efficiency but also liquidation risk.
Liquidation Threshold
The collateral value ratio at which a position becomes eligible for liquidation. It is always set higher than the LTV to create a safety buffer.
- Determines the point of insolvency risk for the protocol.
- The buffer between LTV and this threshold is the user's safety margin.
- Forced liquidations occur to protect protocol solvency.
- A critical parameter for managing systemic risk in volatile markets.
Liquidation Penalty
A fee applied to liquidated collateral that compensates liquidators and disincentivizes unhealthy positions. It is typically a percentage of the collateral or debt size.
- Incentivizes third-party liquidators to participate.
- Directly impacts the cost of being liquidated for users.
- The penalty is often distributed between the protocol treasury and liquidators.
- Must be balanced to ensure liquidation markets remain active.
Health Factor
A real-time numeric representation of a position's safety, calculated as (Collateral Value * Liquidation Threshold) / Total Borrowed Value.
- A value below 1.0 triggers liquidation eligibility.
- Users must monitor this to manage their leverage and avoid liquidation.
- Dynamic updates with market price movements.
- The core user-facing metric for risk management.
Reserve Factor
The percentage of protocol interest revenue that is diverted to a treasury or reserve fund instead of being distributed to depositors.
- Creates a capital reserve for covering bad debt or future development.
- Affects the net yield for liquidity providers.
- A key parameter for protocol sustainability and risk mitigation.
- Governance uses this to balance growth incentives with financial resilience.
Debt Ceiling
A hard cap on the total borrowable amount for a specific asset across the entire protocol or per collateral type.
- Limits protocol exposure to any single asset's devaluation or failure.
- Prevents over-concentration and manages systemic risk.
- Once reached, new borrowing of that asset is disabled until repaid.
- Essential for risk diversification and capital preservation.
Protocol Implementation Comparison
Comparison of key risk parameter implementations across major on-chain margin trading protocols.
| Risk Parameter | dYdX v3 (StarkEx) | GMX v1 (Arbitrum) | Aave v3 (Ethereum) |
|---|---|---|---|
Initial Margin Requirement | 1.25x (80% max leverage) | 10x max leverage (varies by asset) | Varies by asset, e.g., ETH: 82.5% LTV |
Liquidation Threshold | ~115% maintenance margin | Liquidation at 100% of position size | Varies, e.g., ETH: 86% threshold |
Liquidation Penalty | 2% of position size | 0.5% of position size + 10bps to liquidator | 5-15% bonus to liquidator (no direct penalty) |
Oracle Configuration | StarkEx price feed + Pyth fallback | Chainlink primary + Binance fallback | Chainlink primary + internal TWAP |
Health Factor Update Frequency | Per trade, real-time | Per price update (seconds) | Per block (~12 seconds) |
Isolated/Cross Margin | Isolated per position | Isolated per position | Cross-collateral across portfolio |
Maximum Position Size | Governance-set global caps | Dynamic based on pool liquidity | Governance-set asset debt ceilings |
Liquidation Process Step-by-Step
A detailed walkthrough of the automated liquidation sequence for an undercollateralized position in an on-chain margin protocol.
Health Factor Breaches Threshold
The protocol's automated monitoring identifies a position that has become undercollateralized.
Detailed Instructions
A position's health factor is continuously calculated based on the current market price of its collateral and debt. This value is derived from the formula: Health Factor = (Collateral Value * Liquidation Threshold) / Total Borrowed Value. When market volatility causes the collateral value to drop or the borrowed value to rise, this factor decreases. The protocol's smart contracts, or an external keeper network, constantly poll this data. The critical moment occurs when the health factor falls below the protocol's liquidation threshold, typically a value of 1.0. For example, a health factor of 0.95 signals the position is eligible for liquidation. This check is permissionless and can be triggered by any network participant seeking the liquidation incentive.
solidity// Simplified check in a smart contract function checkLiquidation(address user) public view returns (bool) { uint256 healthFactor = calculateHealthFactor(user); return healthFactor < LIQUIDATION_THRESHOLD; // e.g., 1.0 * 10**18 }
Tip: Positions often have a liquidation buffer (e.g., health factor between 1.0 and 1.1) where they are at risk but not yet liquidatable. Monitoring tools can alert you in this zone.
Liquidator Initiates Transaction
A liquidator calls the protocol's liquidation function, providing the necessary capital.
Detailed Instructions
Any external address can act as a liquidator by submitting a transaction to the protocol's main liquidation function, such as liquidate(address user, uint256 debtToCover, address collateralAsset). The liquidator must specify the undercollateralized user's address and the amount of the borrowed asset they wish to repay. Crucially, the liquidator must already hold, or have approved the protocol to spend, the required amount of the debt asset (e.g., USDC, DAI). This capital is used to pay off a portion of the user's debt. The transaction includes a gas fee, and liquidators often run bots to compete for profitable opportunities. The function call will revert if the position's health factor is now above the threshold, a condition known as a failed liquidation.
solidity// Example function call via ethers.js const tx = await lendingContract.liquidate( underwaterUserAddress, ethers.utils.parseUnits("500", 6), // Repay 500 USDC wethAddress // Receive WETH as collateral );
Tip: Liquidators calculate profitability by comparing the liquidation bonus (discount on collateral) against gas costs and price slippage. They often use flash loans to source the debt asset capital.
Debt Repayment and Collateral Seizure
The protocol executes the atomic swap of debt for discounted collateral.
Detailed Instructions
Upon a valid liquidation call, the protocol's smart contract performs several atomic state changes. First, it transfers the specified amount of the debt asset from the liquidator's balance to the protocol's treasury, reducing the target user's total debt. In return, the contract calculates the amount of collateral asset to seize and transfer to the liquidator. This amount is the value of the repaid debt, plus a liquidation bonus (or penalty), divided by the current oracle price of the collateral. For instance, with a 5% bonus, repaying $1000 of debt might grant the liquidator $1050 worth of collateral. The contract updates the user's debt and collateral balances internally and transfers the seized tokens. This step is non-custodial and requires no intermediary.
solidity// Core logic snippet for collateral calculation uint256 collateralPrice = oracle.getPrice(collateralAsset); uint256 bonusAmount = (debtRepaid * LIQUIDATION_BONUS) / 10000; // Bonus in basis points uint256 collateralToSeize = (debtRepaid + bonusAmount) / collateralPrice; // State updates userDebt[user] -= debtRepaid; userCollateral[user] -= collateralToSeize; safeTransfer(collateralAsset, liquidator, collateralToSeize);
Tip: The liquidation bonus is a key risk parameter. A higher bonus incentivizes faster liquidations but increases the loss for the position holder.
Position Health Restoration and Remaining Debt
The system recalculates the position's health, potentially leaving residual debt or collateral.
Detailed Instructions
After the liquidation transaction is mined, the protocol recalculates the position's health factor. The primary goal is to bring this factor back above the liquidation threshold (e.g., 1.0). However, a partial liquidation may not fully restore health to a safe level (e.g., >1.5). The remaining debt and collateral are adjusted accordingly. If the health factor is still below the threshold, the position remains eligible for further liquidation by other liquidators. The user retains ownership of any remaining collateral and is still responsible for the remaining debt plus accrued interest. The protocol's event logs will emit the new health factor, allowing users and monitoring services to track the updated state. This step ensures the system's solvency is maintained incrementally.
- Check new health factor: Query the user's updated health via a view function.
- Assess remaining risk: Determine if the position is still at immediate risk of another liquidation.
- User options: The position holder can now add more collateral or repay debt manually to improve their health factor.
Tip: In volatile markets, a position can undergo multiple, rapid liquidation waves from different liquidators until its health is restored or it is fully liquidated.
Liquidation Incentive Distribution
Protocol fees and incentives are allocated to various stakeholders.
Detailed Instructions
The liquidation mechanism includes an incentive structure to ensure system stability. The liquidation bonus awarded to the liquidator is the primary incentive. Additionally, the protocol may take a liquidation fee from the seized collateral, which is often directed to a protocol treasury or a safety module. Some protocols also use a portion of the fee to buy back and burn their native governance token. The exact breakdown is defined in the protocol's risk parameters and smart contract logic. For example, a liquidation might involve a total penalty of 10% on the repaid debt, with 8% going to the liquidator and 2% to the protocol treasury. This step finalizes the economic redistribution, ensuring keepers are compensated and the protocol captures value for managing risk.
solidity// Example incentive distribution uint256 totalLiquidationPenalty = (debtRepaid * TOTAL_PENALTY_BPS) / 10000; // 10% uint256 liquidatorBonus = (debtRepaid * LIQUIDATOR_BONUS_BPS) / 10000; // 8% uint256 protocolFee = totalLiquidationPenalty - liquidatorBonus; // 2% // Distribute collateralToSeize = (debtRepaid + totalLiquidationPenalty) / price; transferCollateral(liquidator, liquidatorBonusPortion); transferCollateral(protocolTreasury, protocolFeePortion);
Tip: The size of the liquidation bonus is a critical parameter balancing incentive for liquidators against excessive penalty for users. Protocols may adjust it via governance.
Parameter Governance and Adjustment
Understanding Governance in DeFi
Parameter governance is the process by which a decentralized community decides on and implements changes to a protocol's rules, such as adjusting risk settings. In on-chain margin trading, these parameters control how much users can borrow, the penalties for liquidation, and the safety of the system.
Key Points
- Proposal and Voting: Changes are typically suggested by community members via a governance forum, then voted on by token holders. For example, a proposal on Aave might suggest lowering the Loan-to-Value (LTV) ratio for a volatile asset.
- Timelocks and Execution: After a vote passes, changes are not immediate. A timelock period (often 1-2 days) allows users to react before the new parameters are executed on-chain.
- Delegation: Most users don't vote directly. They delegate their voting power to experts or entities they trust to make informed decisions about risk.
Example
When the MakerDAO community voted to adjust the Stability Fee for DAI, it was a parameter change aimed at maintaining the peg. Users who had delegated their MKR tokens saw their voting power used in the decision, which was executed after a timelock.
Advanced Risk Metrics
Key quantitative parameters used by lending protocols and traders to assess and manage risk in leveraged positions.
Health Factor
The Health Factor is a numerical representation of a position's safety margin. It is calculated as (Collateral Value * Liquidation Threshold) / Total Borrowed Value.
- A value below 1.0 triggers automatic liquidation.
- Protocols like Aave display this metric per user wallet.
- Traders must monitor this to avoid forced position closure during market volatility.
Loan-to-Value (LTV) Ratio
The Loan-to-Value Ratio defines the maximum borrowing power against posted collateral. For example, a 75% LTV on ETH means you can borrow up to $0.75 for every $1 of ETH collateral.
- Set per asset by protocol governance.
- A primary determinant of initial position risk.
- Directly influences the Health Factor calculation.
Liquidation Threshold
The Liquidation Threshold is the collateral value ratio at which a position becomes eligible for liquidation. It is always lower than the LTV, creating a safety buffer.
- On Compound, ETH may have an 82% LTV but a 75% threshold.
- This buffer protects the protocol from undercollateralization.
- Determines the point of no return for a declining position.
Liquidation Penalty
A Liquidation Penalty is an additional fee charged to a borrower when their position is liquidated, paid to the liquidator as an incentive.
- Typically ranges from 5% to 15% of the borrowed amount.
- This penalty increases the effective loss for the borrower.
- It is a critical cost to factor into risk management strategies.
Utilization Rate
The Utilization Rate measures the proportion of total supplied assets that are currently borrowed in a pool. It is calculated as Total Borrows / Total Supply.
- High utilization (>80%) can indicate capital efficiency but also liquidity risk.
- Directly influences variable interest rates via rate models.
- Affects the ability to withdraw or borrow assets instantly.
Volatility-Adjusted Collateral
This metric accounts for an asset's price volatility when determining its risk profile. Protocols assign higher risk weights to more volatile assets.
- Stablecoins like USDC have lower volatility penalties than altcoins.
- Results in lower LTV ratios for volatile collateral.
- Essential for understanding cross-margin portfolio risk.
Common Questions on Risk Parameters
Initial margin is the minimum collateral required to open a new leveraged position, acting as a deposit against initial price volatility. Maintenance margin is the minimum collateral required to keep an existing position open; if your collateral value falls below this level, you face liquidation. For example, a protocol might require 20% initial margin (5x leverage) but only 10% maintenance margin. The maintenance level is always lower, creating a buffer zone where you can be warned or have time to add funds before the liquidation price is hit.