Curve's crvUSD uses a Lending-Liquidating AMM Algorithm (LLAMMA) that replaces discrete, binary liquidations with a continuous process of 'soft-liquidations.' When a borrower's collateral price falls, their position is not immediately liquidated at a single price point. Instead, their collateral is algorithmically converted to crvUSD across a series of price bands, effectively dollar-cost averaging the exit. This mechanism creates a persistent, on-chain arbitrage opportunity: the LLAMMA offers the depreciating collateral at a discount relative to the external market price to incentivize arbitrageurs to absorb it, protecting the protocol from bad debt.

Building a crvUSD Soft-Liquidation Bot
The Soft-Liquidation Opportunity
Soft-liquidations in crvUSD create a continuous arbitrage opportunity for bots that can atomically trade a borrower's devalued collateral for the stablecoin at a discount.
For searchers and MEV teams, this is a technical challenge of monitoring, simulation, and atomic execution. A bot must continuously monitor the health of all active crvUSD loans by reading each user's deposited collateral range from the Controller and the current price from the LLAMMA's internal oracle. The bot calculates the profitability of calling the liquidate function, which allows it to withdraw a portion of the user's devalued collateral by repaying an equivalent amount of crvUSD. The core of the opportunity lies in the price discrepancy: the bot repays crvUSD at the LLAMMA's internal, discounted rate and can immediately sell the acquired collateral for a profit on an external market, such as a Curve stableswap or Tricrypto pool.
The most sophisticated implementations bundle the liquidation and the subsequent sale into a single atomic transaction using flashloans or multi-hop swaps. A bot can borrow crvUSD from a PegKeeper pool, call liquidate to acquire the discounted collateral, swap that collateral back to crvUSD in a liquid Curve pool, and repay the loan, all within one block. The profitability of this operation is highly sensitive to gas costs, the depth of the collateral's liquidity pool, and the speed of the bot relative to competitors. A poorly designed bot risks being front-run or failing to cover its gas costs, while a well-architected one performs a critical keeper function that directly contributes to the solvency and stability of the crvUSD protocol.
Building a reliable soft-liquidation bot requires deep integration with the LLAMMA's get_p and bands state, the Controller's loan data, and the atomic composability of the Curve ecosystem. Teams undertaking this must model the precise gas budget for each liquidation path, implement robust fallback logic for periods of high network congestion or low liquidity, and continuously simulate the profitability of candidate positions. Chainscore Labs can review bot logic for profitability under various market conditions, audit the atomic execution path for security and economic soundness, and help model the impact of bot competition on expected returns.
Bot Architecture Quick Facts
Key architectural decisions, risk factors, and operational requirements for searchers and MEV teams building arbitrage bots that execute crvUSD soft-liquidations.
| Area | What changes | Who is affected | Action |
|---|---|---|---|
Position Monitoring | Borrower health is calculated from LLAMMA band state, not a single liquidation price. Bots must read active bands and collateral distribution. | Searchers, MEV teams, keeper network operators | Implement on-chain monitoring of UserInfo and read active bands via the Controller contract. Validate health calculation logic against the canonical LLAMMA implementation. |
Profitability Calculation | Profitability depends on atomic arbitrage between the borrower's collateral bands and the crvUSD PegKeeper pools. Gas costs and MEV competition erode margins. | Searchers, quantitative strategy teams | Simulate profitability across a range of band states and pool depths. Model gas consumption for the full liquidation transaction. Chainscore can review profitability models for edge cases. |
Execution Atomicity | Soft-liquidation must be executed atomically. Partial execution leaves the bot holding collateral at a loss or fails to capture the arbitrage spread. | Smart contract engineers, searchers | Design the bot's smart contract to use a single multicall or custom executor that reverts entirely if the arbitrage condition is not met. Audit the execution path for reentrancy and slippage. |
PegKeeper Pool Interaction | The bot must swap liquidated collateral for crvUSD in the relevant PegKeeper pool. Pool depth and imbalance directly impact realized profit. | Arbitrageurs, DeFi protocol architects | Monitor PegKeeper pool balances and fees. Incorporate pool state into the profitability check. Ensure the bot's swap routing handles low-liquidity scenarios without reverting. |
Gas and MEV Competition | Soft-liquidations are a competitive MEV opportunity. Bots compete on gas price and bundle inclusion. Private order flow can be decisive. | Searchers, MEV researchers, validator operators | Use a performant RPC and consider private transaction submission via services like Flashbots Protect or MEV-Share. Model the priority fee required to outbid competitors. |
Collateral Handling | The bot receives the borrower's collateral in the LLAMMA bands. It must be able to handle and swap any collateral type approved by the Controller. | Smart contract engineers, risk teams | Build a modular swap interface that can route any collateral token through its PegKeeper pool. Implement a fallback to prevent dust accumulation. Chainscore can audit collateral-handling logic. |
Controller Contract Authorization | The bot must be authorized or interact permissionlessly with the Controller's | Smart contract engineers, protocol architects | Verify the Controller's liquidation interface and any role-based restrictions. Ensure the bot's contract correctly encodes the call to |
Monitoring and Alerting | A profitable soft-liquidation opportunity can appear and disappear within a single block. Reliable, low-latency monitoring is essential. | DevOps engineers, data teams, searchers | Set up a dedicated monitoring service that tracks LLAMMA band movements and PegKeeper pool rebalancing. Alert on opportunities that exceed a minimum profitability threshold after gas costs. |
LLAMMA Mechanics and Health Calculation
A technical breakdown of the Lending-Liquidating AMM Algorithm (LLAMMA) health metric and its role in triggering profitable soft-liquidations for crvUSD.
The core of a crvUSD soft-liquidation bot is the continuous monitoring of borrower health, which is fundamentally different from the discrete health factor used in protocols like Aave. Curve's LLAMMA does not have a single liquidation point. Instead, a user's collateral is deposited across a continuous range of bands, and a soft-liquidation occurs automatically when the price of the collateral moves through these bands. The bot's primary signal is the calculation of a position's health, which represents the proportion of the user's collateral that has not yet been converted into crvUSD by the LLAMMA's internal AMM.
The health of a crvUSD loan is calculated by calling the health_calculator method on the Controller contract, which internally queries the LLAMMA. The calculation sums the user's collateral across all active bands and compares it to their total debt. A health value of 1.0 indicates the position is fully collateralized and no soft-liquidation has occurred. As the collateral price drops and the LLAMMA automatically trades the user's collateral for crvUSD, the health metric decreases. A health value approaching 0.0 signals that the user's collateral has been almost entirely converted, and the position is nearing a hard liquidation state where remaining collateral can be seized. For a bot operator, this metric is the primary trigger for action.
The arbitrage opportunity for a soft-liquidation bot arises from the price discrepancy between the LLAMMA's internal bands and external markets. When the LLAMMA is actively converting collateral to crvUSD, it does so at a price that may be slightly worse than the external market price, creating a spread. A bot can atomically call the liquidate function on the Controller, which repays a portion of the user's debt and receives the user's collateral at the LLAMMA's internal band price. The bot then immediately sells this collateral on an external venue like the crvUSD/USDC pool or a PegKeeper pool to capture the spread. The profitability of this operation is a direct function of the user's health, the depth of the LLAMMA bands, and external market liquidity. Chainscore can review a bot's health monitoring logic and arbitrage execution model to ensure it correctly identifies profitable opportunities without exposing the operator to adverse selection or gas-inefficient execution.
Affected Actors
Searchers and MEV Teams
Soft-liquidations are a competitive, atomic arbitrage opportunity. Searchers must monitor borrower health via LLAMMA's health_calculator to identify positions where the collateral price has entered soft-liquidation mode. The bot must atomically call liquidate on the Controller, receive the borrower's collateral, and swap it for crvUSD in the relevant PegKeeper pool to repay the debt and capture the spread.
Key challenges include gas optimization for mempool competition, accurate simulation of the LLAMMA band-based loss function, and managing inventory risk if the arbitrage leg cannot be completed atomically. Teams must model the profitability threshold precisely, accounting for the dynamic debt reduction across liquidation bands.
Bot Implementation Components
The core components required to build a reliable and profitable crvUSD soft-liquidation bot, from position discovery to atomic arbitrage execution.
LLAMMA Position Monitor
The bot must continuously index Borrow and RemoveCollateral events from the Controller to maintain a local database of active loans. For each loan, query the LLAMMA contract's health_calculator to compute the current health factor based on the user's collateral distribution across bands and the oracle price. A position is eligible for soft-liquidation when its health drops below a configurable threshold, signaling that the user's collateral has shifted into bands where the AMM can absorb it. This component is the bot's primary signal generator.
Band Profitability Simulator
Before submitting a transaction, the bot must simulate the soft-liquidation call against the LLAMMA contract. This involves reading the user's active bands and calculating the amount of crvUSD debt that can be repaid in exchange for the collateral available at the current AMM price. The simulation must account for the liquidation_discount and the dynamic exchange rate within each band to ensure the extracted collateral value exceeds the debt repaid plus gas costs. This prevents unprofitable or reverting transactions from landing on-chain.
Atomic Arbitrage Executor
The core execution logic bundles the soft-liquidation with an immediate swap of the acquired collateral for the crvUSD needed to repay the debt, or vice-versa, to realize profit. This typically routes through the crvUSD PegKeeper pools or a Tricrypto pool. The contract must use flash loans or hold sufficient inventory to atomically repay the user's debt, receive the collateral, and execute the exit swap in a single transaction. This eliminates inventory risk and ensures the bot's profitability is locked in at execution time.
Gas and MEV Strategy
Soft-liquidations are a competitive, permissionless action. The bot must implement a robust transaction submission strategy to avoid being front-run or sandwiched. This includes using a private relay like Flashbots Protect or a direct connection to block builders. The gas pricing logic must dynamically bid based on the simulated profit margin, ensuring the transaction is included without overpaying. The bot should also monitor the mempool for competing liquidate calls to avoid reverting due to a race condition on the same position.
Controller and AMM State Fetcher
A high-performance state-fetching module is critical for latency-sensitive operations. The bot must batch eth_call requests to the Controller, LLAMMA, and relevant liquidity pools to get real-time data on user debt, collateral distribution, oracle prices, and pool reserves. Using a dedicated RPC endpoint or a local archive node is recommended to minimize stale data risk. This component must also handle multicall patterns to aggregate these reads efficiently, reducing the time between opportunity detection and transaction submission.
Chainscore Bot Logic Review
Chainscore Labs can perform a comprehensive review of your soft-liquidation bot's architecture and implementation. Our assessment covers the correctness of the health factor calculation, the profitability simulation's accuracy against the LLAMMA AMM math, the atomic execution path's security against reentrancy and sandwich attacks, and the gas strategy's efficiency under competitive conditions. We help searchers and keeper networks ensure their bots are safe, profitable, and resilient against protocol changes.
Bot Operational Risk Matrix
Evaluates operational, technical, and economic risks that can cause a soft-liquidation bot to fail, lose funds, or miss profitable opportunities. Helps searchers, MEV teams, and keeper network operators design robust bot architectures.
| Risk Area | Failure Mode | Severity | Affected Actor | Mitigation |
|---|---|---|---|---|
Health Calculation | Bot misreads LLAMMA band structure or uses stale oracle price, causing premature or missed liquidation trigger | Critical | Searcher / Keeper Operator | Validate on-chain health calculation against Controller.liquidate() revert conditions; use multiple price sources for redundancy |
Atomic Execution | Transaction sandwiching or front-running causes bot to receive unfavorable rate in crvUSD/USDC pool | High | Searcher / MEV Operator | Use flashbots or equivalent MEV-protection RPC; simulate bundle profitability with strict slippage tolerance |
Peg-Keeper Pool Liquidity | Insufficient USDC or crvUSD depth in PegKeeper pool prevents atomic arbitrage completion | High | Searcher / Keeper Operator | Monitor pool balances and TVL before submission; set minimum pool depth thresholds for bot activation |
Gas Volatility | Base fee spike makes soft-liquidation unprofitable, causing bot to skip execution or lose money | Medium | Searcher / Keeper Operator | Implement dynamic gas pricing with profitability floor; use EIP-1559 priority fee estimation |
Collateral Volatility | Rapid collateral price drop pushes borrower into hard-liquidation zone before soft-liquidation completes | Medium | Searcher / Keeper Operator | Monitor collateral price deviation; abort if price moves beyond band range during execution window |
Controller Parameter Change | Curve governance alters liquidation_discount or other Controller parameters, invalidating bot profitability model | Medium | Searcher / Keeper Operator | Subscribe to Curve governance events; implement parameter-change detection with automatic bot pause |
Node Reliability | RPC node lag or failure causes bot to miss block window for profitable liquidation opportunity | Low | Searcher / Keeper Operator | Use redundant node providers with failover; monitor block arrival latency and mempool visibility |
Bot Deployment and Monitoring Checklist
A systematic checklist for deploying and monitoring a crvUSD soft-liquidation bot. Each item defines a critical operational requirement, the rationale behind it, and the specific signal or artifact that confirms the bot is ready for production.
What to check: The bot must accurately calculate the health of a borrower's position based on the LLAMMA (Lending-Liquidating AMM) algorithm, not a simple collateral-to-debt ratio. This involves reading the active bands from the Controller, calculating the liquidation discount for each band, and determining if the position is in soft-liquidation mode.
Why it matters: A miscalculation will cause the bot to either miss profitable liquidations or, worse, execute unprofitable transactions that lose ETH on gas. The LLAMMA's band-based liquidation is fundamentally different from a fixed-threshold liquidation model.
Readiness signal: A backtesting script that replays historical blocks and correctly identifies all positions that entered soft-liquidation mode, matching on-chain Borrow and RemoveCollateral events within a 1-block tolerance.
Canonical Resources
Building a crvUSD soft-liquidation bot requires reading Curve’s LLAMMA, Controller, pool, and governance sources directly. Use these resources to pin interfaces, verify market addresses, model band state, and monitor operational changes before deploying capital.
Looking to build on a specific blockchain?
We build smart contracts, DeFi applications, wallets, tokenization platforms, and blockchain infrastructure across the major ecosystems teams choose today. That includes Ethereum, Arbitrum, Optimism, Polygon, Avalanche, Solana, Sui, Aptos, Hedera, Stellar, and NEAR, with support for additional EVM and non-EVM networks based on your product requirements.
EVM ecosystems
- Ethereum
- Arbitrum
- Optimism
- Polygon
- Avalanche
- Cronos

Non-EVM ecosystems
- Solana
- Sui
- Aptos
- Hedera
- Stellar
- NEAR
Additional ecosystems
- Polkadot
- Cosmos
- TON
- Cardano
- Algorand
- Tempo
Also available for Base, appchains, custom EVM networks, and cross-chain product architecture.
Frequently Asked Questions
Common questions from searchers, MEV teams, and keeper network operators building bots to execute soft-liquidations in the crvUSD LLAMMA system.
A soft-liquidation is a gradual, automated process where a borrower's collateral is continuously converted to crvUSD as the collateral price drops within the LLAMMA's (Lending-Liquidating AMM Algorithm) bonding curve. Unlike a hard liquidation in protocols like Aave, there is no single liquidation event or penalty. The borrower's position is spread across multiple bands, and as the price falls through these bands, the collateral is atomically swapped for crvUSD. If the price recovers, the crvUSD is swapped back, allowing the position to 'heal.' A hard liquidation only occurs if the price falls below the lowest band, at which point the remaining collateral is subject to a penalty. Bots profit by arbitraging the price difference between the LLAMMA bands and external markets.
Delivering blockchain solutions for 5+ years.
We have partnered with 50+ leading DeFi protocols, NFT ecosystems, and fintech innovators to build secure, scalable, and capital-efficient blockchain products.
Selected Partners & Clients
“I've been working with Chainscore Labs for last 3+ years, they've consistently delivered with strong ownership across multiple projects. The team is reliable and detail-oriented.”
How to get started?
If you're looking for blockchain integration, ChainScore Labs has 5+ years of experience helping teams build and integrate exchanges, wallets, smart contracts, tokenization solutions, and protocol-connected products, we can help you choose the right path, integrate securely, and get to production faster. Our team consists of experienced blockchain developers and architects who can help you with your blockchain integration needs.
Exploration & Strategy
Define your product goals and choose the right blockchain architecture for your use case.
Architecture & Design
Design the smart contracts, tokenomics, and security parameters of your system.
Development & Integration
Build and integrate with wallets, oracles, and front-end dApps for a seamless experience.
Security & Launch
Comprehensive audits followed by a risk-managed mainnet deployment to protect your users.
Discover our
blockchain development services.
We build production-grade blockchain solutions for top-tier projects across DeFi and Web3.
Need a blockchain engineering team?
Send the project context and we will respond with next steps, scope questions, and a practical path to delivery.


