Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
LABS
Guides

How to Architect a LST Integration with Major DeFi Lending Protocols

This guide provides a technical blueprint for integrating a new Liquid Staking Token as collateral into protocols like Aave, Compound, or MakerDAO. It covers the risk parameter submission process, oracle integration for price feeds, and the development of custom adapters for reward claiming within the lending environment.
Chainscore © 2026
introduction
ARCHITECTURE GUIDE

Introduction: LSTs as DeFi Collateral

Liquid Staking Tokens (LSTs) like Lido's stETH and Rocket Pool's rETH have become foundational collateral assets. This guide details the technical architecture for integrating them into lending protocols.

Liquid Staking Tokens represent staked assets (e.g., ETH) while providing liquidity and yield. Their dual nature as collateral and yield-bearing assets creates unique integration challenges. A successful architecture must account for price oracles, reward accrual, liquidation logic, and the underlying staking pool's slashing risk. Protocols like Aave, Compound, and Euler each implement these mechanisms differently, offering lessons for new integrations.

The core integration involves three smart contract layers: the LST token contract, the price feed oracle, and the lending market's logic. The LST's rebasing or reward-bearing mechanism dictates how the protocol tracks a user's collateral balance. For rebasing tokens like stETH, the balance in the lending contract increases automatically, requiring the protocol to calculate the owed debt against a growing collateral base. For reward-bearing tokens like rETH, the exchange rate against the base asset appreciates, which the oracle must reflect.

Accurate, resilient price oracles are critical. Using a decentralized oracle like Chainlink that provides the LST/underlying asset exchange rate (e.g., stETH/ETH) is standard. The architecture must also define a liquidation threshold and loan-to-value (LTV) ratio specific to the LST, often lower than for the native asset due to smart contract and slashing risks. For example, Aave V3 lists stETH with a 79% LTV, compared to 82.5% for wrapped ETH.

Handling slashing events is a key risk parameter. While rare, a slashing event reduces the value of the LST pool. Lending protocols typically do not automatically adjust user collateral balances for slashing; instead, they manage this systemic risk through conservative LTV ratios, liquidity caps, and potentially pausing borrows during extreme events. The architecture should include guardian functions to freeze markets if the underlying staking protocol reports a major incident.

Finally, consider the composability of LST collateral. Users may leverage LSTs across multiple protocols (e.g., using stETH as collateral on Aave to borrow USDC, then providing that to a Curve pool). Your architecture should be resilient to cascading liquidations that could arise from price volatility in these interconnected systems. Implementing robust health check mechanisms and circuit breakers can mitigate this risk.

prerequisites
ARCHITECTURE

Prerequisites for LST Integration

A systematic guide to the technical and strategic requirements for integrating Liquid Staking Tokens (LSTs) with major DeFi lending platforms like Aave, Compound, and Euler.

Integrating a Liquid Staking Token (LST) like Lido's stETH, Rocket Pool's rETH, or Coinbase's cbETH into a major lending protocol is a complex, multi-stage process. It begins with a thorough protocol-level analysis of the target lending market. You must audit the LST's smart contracts for security, review its oracle configuration for price feeds, and understand its unique rebasing or reward distribution mechanics. This foundational due diligence ensures the asset's behavior is compatible with the lending platform's risk models and liquidation engines.

The core architectural decision involves selecting the appropriate collateral and debt integration model. Most protocols support LSTs as collateral, allowing users to borrow against their staked assets. A more advanced integration involves enabling the LST as a borrowable asset, which requires a deep liquidity analysis and careful consideration of interest rate models. You must also plan for oracle integration, determining whether to use the LST's native price feed (e.g., Chainlink's stETH/ETH feed) or a custom calculation based on the underlying stake and reward accrual.

Technical prerequisites require a robust development environment. You'll need to fork the target lending protocol's repository (e.g., the Aave V3 GitHub), set up a local testnet with tools like Foundry or Hardhat, and secure testnet tokens for the LST. Writing and testing the integration involves creating a new asset configuration—a data structure defining the loan-to-value ratio, liquidation threshold, reserve factor, and other risk parameters specific to the LST. This is where you implement the logic for handling staking rewards, whether they accrue via a rebasing balance or a rising exchange rate.

A critical, non-technical prerequisite is governance preparation. Proposing an LST integration on Aave or Compound requires a formal Aave Request for Comment (ARC) or Compound Governance Proposal (CGP). Your technical documentation must be accompanied by a comprehensive risk assessment covering market, smart contract, and oracle risks, often prepared in collaboration with dedicated risk providers like Gauntlet or Chaos Labs. Building community consensus through forum discussions is essential before any on-chain vote.

Finally, you must plan for the deployment and upgrade path. This includes scheduling a security audit for your configuration code, preparing multi-sig transactions for the governance proposal execution, and establishing a monitoring plan post-launch. Key metrics to track include the LST's utilization rate, collateral factor efficiency, and the health of the oracle price feed. A successful integration is not a one-time event but requires ongoing management aligned with the lending protocol's risk parameters and the LST's evolving ecosystem.

key-concepts
LST INTEGRATION

Core Technical Concepts

Architecting Liquid Staking Token (LST) integrations requires understanding collateral mechanics, risk models, and protocol-specific hooks. These concepts are critical for developers building on Aave, Compound, or Morpho.

01

Collateralization & Risk Parameters

LSTs are volatile collateral assets. Key parameters to configure include:

  • Loan-to-Value (LTV) Ratio: Typically 60-75% for major LSTs like stETH, balancing utility with market risk.
  • Liquidation Threshold: Set 5-15% above LTV to create a safety buffer before automatic liquidation.
  • Liquidation Penalty: A fee (5-15%) applied during liquidation, paid to the liquidator.
  • Oracle Selection: Reliable price feeds (e.g., Chainlink) are non-negotiable to prevent oracle manipulation attacks.
02

Rebasing vs. Reward-Bearing Tokens

LSTs use two primary accounting models, each requiring different integration logic.

  • Rebasing Tokens (e.g., stETH): The token balance increases in the user's wallet. Lending protocols must track the rebasing balanceOf for accurate collateral valuation and debt calculations.
  • Reward-Bearing Tokens (e.g., rETH, cbETH): The exchange rate between the token and underlying ETH appreciates. Protocols must read the exchangeRate or convertToAssets function from the token contract to calculate the true collateral value.
04

Handling Protocol-Specific Hooks

Major protocols have unique extension points for custom collateral logic.

  • Aave V3: Implement the IEACAggregatorProxy interface for price feeds and configure assets via the PoolConfigurator.
  • Compound V3 (Comet): Set up the BaseToken price feed and configure CollateralFactor for the asset.
  • Morpho Blue: Define a custom IRM (Interest Rate Model) and LLTV (Loan-to-Value) for your market, offering maximal flexibility. Always test hooks on a testnet fork before mainnet deployment.
05

Slashing Risk & Depeg Scenarios

LSTs carry unique smart contract and validator slashing risks. Your integration must mitigate:

  • Depeg Events: Design liquidation engines to trigger efficiently if the LST price deviates significantly from native ETH (e.g., stETH traded at 0.94 ETH in June 2022).
  • Withdrawal Delays: Post-Merge, unstaking has a queue. Model this liquidity risk in your LTV and liquidation parameters.
  • Insurance/Reserve Funds: Some protocols (e.g., Aave's Safety Module) use staked AAVE as a backstop. Consider if your integration requires a similar mechanism.
06

Testing & Simulation Strategy

Rigorous testing is essential before mainnet launch.

  • Use fork testing with tools like Foundry or Hardhat to simulate interactions on a mainnet fork.
  • Run stress tests simulating extreme market conditions: 30%+ ETH price drops, LST depegs, and high network congestion.
  • Audit liquidator bot economics to ensure the liquidation incentive (liquidationBonus) is sufficient under high gas price scenarios.
  • Deploy first to a live testnet (Sepolia, Holesky) and conduct a battle-tested community audit.
risk-parameter-framework
FOUNDATION

Step 1: Defining Risk Parameters

The first step in architecting a Liquid Staking Token (LST) integration is establishing the core risk parameters that will govern its use within a lending protocol. This defines the protocol's risk tolerance and the economic safety of the LST collateral.

Risk parameters are the programmable rules that determine how an asset behaves as collateral. For an LST like Lido's stETH or Rocket Pool's rETH, you must define: the Loan-to-Value (LTV) ratio, the liquidation threshold, the liquidation penalty, and whether the asset can be used as borrowable collateral. These values are not arbitrary; they are calculated based on the LST's price volatility, liquidity depth on decentralized exchanges, and the underlying consensus-layer security of its staked assets.

The Loan-to-Value (LTV) ratio is the maximum amount a user can borrow against their LST collateral. A lower LTV (e.g., 75% for stETH on Aave) provides a larger safety buffer against price drops. The liquidation threshold is the collateral value at which a position becomes eligible for liquidation, typically set a few percentage points above the LTV. The difference between these two values is the liquidation bonus, an incentive for liquidators. For LSTs, a key consideration is slashing risk; while rare, a slashing event on the beacon chain could devalue the underlying stake, necessitating conservative parameters.

You must also model oracle dependencies. LST prices are derived from oracles like Chainlink, which track the exchange rate between the LST and its native asset (e.g., stETH/ETH). The oracle's update frequency and deviation thresholds are critical. A slow oracle during a market crash could cause under-collateralized positions to go undetected. Furthermore, assess the liquidity of the LST/ETH trading pair on DEXs like Uniswap V3, as this impacts the cost and feasibility of liquidations.

Implementing these parameters requires interacting with the lending protocol's configuration module. For example, on a Compound-forks or Aave V3, you would call functions like configureReserveAsCollateral() or setReserveFactor(). The code snippet below illustrates a conceptual governance proposal to list a new LST, setting its risk parameters on a generic lending pool contract.

solidity
// Pseudo-code for a governance proposal action
function _listLSTAsCollateral(address lendingPool, address lstToken) internal {
  LendingPoolConfigurator configurator = LendingPoolConfigurator(lendingPool);
  
  // Define parameters: LTV, Liquidation Threshold, Liquidation Bonus
  uint256 ltv = 7500; // 75%
  uint256 liqThreshold = 7800; // 78%
  uint256 liqBonus = 10500; // 5% bonus for liquidators
  uint256 reserveFactor = 1000; // 10% reserve for protocol
  
  configurator.configureReserveAsCollateral(
    lstToken,
    ltv,
    liqThreshold,
    liqBonus
  );
  configurator.setReserveFactor(lstToken, reserveFactor);
}

Finally, parameter selection is an iterative process involving stress testing and sensitivity analysis. Use historical price data and liquidity metrics to simulate scenarios like a 30% ETH price drop combined with a DEX liquidity crunch. Tools like Gauntlet or Chaos Labs provide frameworks for this analysis. The goal is to balance capital efficiency for users with the protocol's solvency, ensuring the LST integration is both useful and secure from day one.

oracle-integration-blueprint
ARCHITECTING LST INTEGRATION

Oracle and Price Feed Integration

Secure and reliable price data is the cornerstone of any lending protocol integration. This step details how to source and implement oracles for Liquid Staking Tokens (LSTs).

A lending protocol's solvency depends on accurate collateral valuation. For Liquid Staking Tokens like Lido's stETH, Rocket Pool's rETH, or Coinbase's cbETH, you cannot rely on a simple spot price from a centralized exchange. These assets derive value from both their underlying staked ETH and the accrued staking rewards, which creates a dynamic exchange rate. A robust oracle solution must track this rebasing or reward-accruing mechanism to provide the true, up-to-date value of the collateral. Failing to do so can lead to under-collateralized loans and protocol insolvency during market stress.

The industry standard is to use a decentralized oracle network like Chainlink. For major LSTs, Chainlink provides dedicated price feeds (e.g., stETH/ETH, rETH/ETH) that are specifically designed to report the correct exchange rate, accounting for reward accrual. When architecting your integration, you will call the latestRoundData function from the appropriate feed contract. It's critical to implement circuit breakers and sanity checks: validate the returned answer against reasonable bounds (e.g., a 5% deviation from a spot price should trigger a pause), check the updatedAt timestamp to ensure data freshness, and confirm the answeredInRound is consistent to avoid stale data.

For LSTs without a dedicated Chainlink feed, you may need to construct a custom price using a TWAP (Time-Weighted Average Price) oracle from a deep liquidity pool, like a stETH/ETH pair on a DEX such as Uniswap V3. This smooths out short-term volatility and manipulation attempts. Your smart contract would calculate the average price over a defined window (e.g., 30 minutes). However, this method adds complexity and gas costs, and a dedicated feed is always preferable for security and simplicity. Always reference the official protocol documentation, like Lido's oracle guide, for the recommended integration pattern.

Your integration code must handle price feed decimals and rate conversion. LST/ETH feeds typically return an answer representing how much ETH one LST unit is worth, often with 18 decimals. To use this for collateral valuation in a USD-denominated system, you must multiply the LST/ETH rate by an ETH/USD feed. Ensure mathematical operations are performed with sufficient precision to avoid rounding errors that could be exploited. A common pattern is to use a price feed aggregator contract within your protocol that manages these multi-feed dependencies and exposes a single getCollateralPrice() view function for internal use.

Finally, design for failure resilience. What happens if the oracle feed is deprecated, hacked, or fails? Implement a robust governance mechanism to safely switch to a new feed address or a fallback oracle without requiring a full protocol upgrade. This often involves a timelock-controlled function that updates the feed address in your contract's storage after a community vote. Thorough testing with forked mainnet simulations is essential to validate the entire price flow under various market conditions before deployment.

adapter-development
ARCHITECTURE

Step 3: Developing Reward Claiming Adapters

This step details the design and implementation of smart contracts that autonomously claim and manage staking rewards from integrated protocols.

A reward claiming adapter is a smart contract that acts as a standardized interface between your Liquid Staking Token (LST) vault and a specific DeFi lending protocol like Aave or Compound. Its primary function is to automate the claiming of staking rewards (e.g., Aave's stkAAVE or Compound's COMP) earned by the LST's underlying collateral. This automation is critical for maintaining protocol solvency and ensuring rewards are captured for redistribution to LST holders or the protocol treasury. The adapter abstracts away the unique reward claiming mechanisms of each integrated protocol into a single, callable function.

The core architecture involves two key components: the Adapter Base Contract and Protocol-Specific Implementations. The base contract defines the universal interface, typically a function like claimRewards(), and handles common logic such as access control, reward token accounting, and safety checks. Each integrated protocol then requires a concrete implementation that inherits from this base. For example, an AaveV3RewardsAdapter would contain the logic to call claimRewards() on the Aave Incentives Controller, while a CompoundV3RewardsAdapter would interact with the CometRewards contract.

When implementing an adapter, you must handle several technical details. First, identify the correct reward token and distributor contract for the protocol and market. Second, design the function to accept necessary parameters, often the list of supplied and borrowed assets. The adapter must also manage gas efficiency and potential reward claiming failures, implementing retry logic or emitting events for manual intervention. Security is paramount; adapters should include reentrancy guards, validate all input parameters, and ensure only authorized vault contracts can trigger claims.

Here is a simplified code example for an Aave V3 adapter stub:

solidity
interface IAaveIncentivesController {
    function claimRewards(address[] calldata assets, uint256 amount, address to) external returns (uint256);
}

contract AaveV3RewardsAdapter is BaseRewardsAdapter {
    IAaveIncentivesController public immutable incentivesController;
    address public immutable rewardToken;

    constructor(address _incentivesController, address _rewardToken) {
        incentivesController = IAaveIncentivesController(_incentivesController);
        rewardToken = _rewardToken;
    }

    function claimRewards(address[] calldata assets, uint256 amount) external onlyVault returns (uint256) {
        uint256 balanceBefore = IERC20(rewardToken).balanceOf(address(this));
        incentivesController.claimRewards(assets, amount, address(this));
        uint256 balanceAfter = IERC20(rewardToken).balanceOf(address(this));
        return balanceAfter - balanceBefore;
    }
}

After deployment, adapters must be integrated into your LST vault's reward harvesting strategy. This often involves a keeper network or a permissionless function that periodically calls claimRewards() on all active adapters. The claimed tokens are then processed according to your protocol's economic model—swapped for more underlying asset to compound yields, distributed directly to stakers, or sent to a treasury. Proper adapter design ensures your LST protocol can seamlessly integrate new lending markets while reliably capturing the full yield generated by its assets.

CORE CONSIDERATIONS

Protocol Integration Requirements Comparison

Key technical and economic requirements for integrating Liquid Staking Tokens (LSTs) with major DeFi lending protocols.

Integration RequirementAave V3Compound V3Morpho Blue

Oracle Requirement

Chainlink or custom price feed

Chainlink price feed

Any oracle via market creator

Collateral Factor (LTV)

Up to 82.5% (configurable)

Up to 75% (configurable)

Set per market (0-100%)

Liquidation Bonus

5-15% (protocol-wide)

8% (protocol-wide)

Set per market

Interest Rate Model

U-shaped, governance-set

Jump-rate, governance-set

Custom, market creator-set

Isolated Market Support

Governance Upgrade Path

Aave DAO vote

Compound DAO vote

Market creator only

Integration Time Estimate

3-6 months

2-4 months

1-4 weeks

Base Integration Cost

$50k-$200k+

$30k-$150k+

< $10k

testing-and-auditing
ARCHITECTING LST INTEGRATIONS

Testing and Security Auditing

This guide covers the essential testing and auditing processes required to ensure your liquid staking token (LST) integration with protocols like Aave, Compound, and Euler is secure and robust.

A comprehensive testing strategy is the foundation of a secure LST integration. Begin by establishing a test environment that mirrors mainnet conditions as closely as possible. Use forked mainnet states from services like Tenderly or Foundry's anvil to test against the actual deployed contracts of your target lending protocol. Your test suite must cover core integration logic, including the priceOracle feed for your LST, the calculation of liquidationThreshold and loanToValue ratios, and the handling of the underlying staking rewards and slashing mechanisms. Simulate edge cases like oracle price manipulation, sudden de-pegging events, and validator slashing to assess system resilience.

Security audits are non-negotiable for DeFi integrations. Start with internal audits and formal verification using tools like Slither, MythX, or the Foundry-based forge inspect. Focus on the specific risks of LSTs: ensure your integration correctly handles rebasing or reward accrual without allowing inflation attacks, and verify that the collateral valuation logic cannot be gamed during periods of high volatility. A common pitfall is misinterpreting the LST's exchange rate; your code must query the canonical contract (e.g., stETH.getPooledEthByShares) rather than relying on a simplified assumption.

Following internal review, engage at least one reputable external audit firm with proven experience in both lending protocols and liquid staking. Firms like Trail of Bits, OpenZeppelin, or Spearbit should scrutinize your integration's adapter contracts, price feed logic, and any custom risk parameters. Provide auditors with detailed documentation, including integration specifications, threat models, and your test coverage report. Be prepared to address findings related to economic assumptions, such as the correlation risk between staked ETH and other crypto assets during market stress.

Finally, implement a gradual deployment and monitoring plan. Begin with a testnet deployment and a bug bounty program on platforms like Immunefi to crowdsource security insights. For mainnet launch, use a phased approach with conservative debt ceilings and isolation mode settings. Establish real-time monitoring for key metrics: the health of your price oracle, the utilization rate of your LST as collateral, and the protocol's overall exposure. This layered approach—from automated testing and expert audits to controlled production rollout—is essential for mitigating the unique risks of integrating novel, yield-bearing collateral into DeFi money markets.

governance-submission
FINALIZING THE INTEGRATION

Step 5: Governance Proposal and On-Chain Execution

This final step details the process of formalizing your Liquid Staking Token (LST) integration through a governance proposal and executing the necessary on-chain upgrades.

After completing technical development and security audits, the integration must be formally approved by the protocol's governance community. This involves drafting a Temperature Check or Request for Comments (RFC) on the protocol's governance forum (e.g., Aave Governance Forum, Compound Governance). The proposal should clearly articulate the integration's value proposition, covering key parameters like the LST's collateral factor, liquidation threshold, interest rate model, and any required oracle configuration. Transparency is critical; include links to the completed audit reports, the deployed Risk Parameter smart contract, and the integration's test suite.

Following community discussion and a successful signaling vote, a formal on-chain governance proposal is submitted. This is a transaction that calls the protocol's governance executor contract (e.g., Aave's ExecutorWithTimelock, Compound's GovernorBravo). The proposal payload contains the encoded function calls to execute the integration. For a typical lending protocol, this includes calls to the Configurator or Comptroller contract to: addMarket() for the new LST, setCollateralFactor(), setLiquidationThreshold(), and setReserveFactor(). Ensure the proposal includes a sufficient timelock delay to allow users to react to the new risk parameters before they take effect.

The execution phase begins after the proposal passes and the timelock expires. A designated proposer (often a multi-sig wallet controlled by a core team or delegate) submits the final execution transaction. This atomically updates the protocol's state. Immediately after execution, you must verify the integration on-chain. Check that the LST is listed as an active market, the configured parameters match the proposal, and the price feed from the oracle (e.g., Chainlink's LST/ETH feed) is live and accurate. It is a best practice to perform a final, small-scale test transaction—such as supplying a minimal amount of the LST and borrowing against it—to confirm all system interactions work as intended in the live environment.

LST INTEGRATION

Frequently Asked Questions (FAQ)

Common technical questions and solutions for developers integrating Liquid Staking Tokens (LSTs) into DeFi lending protocols like Aave, Compound, and Euler.

The core challenge is managing the LST's rebasing or reward-bearing mechanics within a lending protocol's accounting system. Most lending protocols track balances using static, non-rebasing internal accounting (e.g., scaledBalance). An LST like Lido's stETH increases a holder's balance via daily rebases, which the protocol's core contracts do not natively detect.

To solve this, integrations typically use a wrapper or adapter contract. This wrapper holds the LST, intercepts the rebasing rewards, and mints a non-rebasing derivative token (e.g., Aave's aStETH or Compound's cStETH) that represents the user's share of the growing LST pool. The lending protocol then uses this static-balance derivative for its debt calculations and liquidation logic.

conclusion
IMPLEMENTATION SUMMARY

Conclusion and Next Steps

This guide has outlined the architectural patterns for integrating Liquid Staking Tokens (LSTs) with DeFi lending protocols. The next steps involve rigorous testing, security audits, and strategic deployment.

Successfully architecting an LST integration requires a clear understanding of the core components: the collateral adapter, oracle strategy, and risk parameter configuration. Your implementation must handle the unique properties of LSTs, such as their rebasing or reward-accruing mechanics, to ensure accurate accounting of user collateral value. The choice between a direct integration with protocols like Aave or Compound, versus a wrapper-based approach using a vault, will define your system's complexity and upgradeability.

Before mainnet deployment, a comprehensive testing regimen is non-negotiable. This includes unit tests for your adapter logic, integration tests against a forked mainnet (using tools like Foundry or Hardhat), and scenario analysis for edge cases. Key scenarios to test are oracle failures, underlying consensus chain slashing events, and extreme market volatility affecting the LST/ETH peg. Formal verification and audits from reputable firms like Trail of Bits or OpenZeppelin are critical for mitigating smart contract risk.

Post-deployment, your focus shifts to monitoring and iteration. Implement off-chain monitoring for key metrics: collateralization ratios, liquidity depth of the LST on DEXs, and oracle deviation. Be prepared to adjust risk parameters like Loan-to-Value (LTV) ratios and liquidation thresholds based on real-world data. Engaging with the governance communities of both the lending protocol and the LST provider is essential for proposing parameter updates and fostering ecosystem alignment.

For further learning, explore the source code of live integrations. Study Aave's wstETH adapter or Compound's cETH market to see production patterns. The Ethereum Foundation's research on consensus-layer rewards provides essential context on LST economics. Your next project could involve architecting for LST derivatives (e.g., leveraging EigenLayer restaking) or building cross-chain lending strategies that utilize LSTs as collateral on non-Ethereum Virtual Machine (EVM) chains.

How to Integrate an LST as Collateral in Aave, Compound, Maker | ChainScore Guides