Lending Protocols
This guide outlines how lending protocols can integrate with Atlas to enhance their functionality, with a particular focus on liquidations as a key use case.
Lending protocols play a crucial role in the DeFi ecosystem, allowing users to lend and borrow assets. Integrating these protocols with Atlas can provide significant benefits, especially in the context of liquidations.
1. Liquidations as an Atlas Use Case
Liquidations are critical processes in lending protocols that help maintain system solvency by closing under-collateralized positions. Traditionally, liquidations are executed by external actors (solver bots) who monitor the protocol for liquidation opportunities, often capturing MEV (Maximal Extractable Value) in the process.
1.1 Current Liquidation Process (Without Atlas)
In the traditional setup, the liquidation flow proceeds as follows:
- Oracle Price Update: The oracle updates asset prices on-chain.
- Solver Bots Monitor: Solver bots continuously monitor the lending protocol for under-collateralized positions.
- Liquidation Execution: When a liquidation opportunity is detected, a solver bot submits a transaction to liquidate the position.
- MEV Extraction: Solver bots may compete in the mempool, leading to MEV extraction and potential front-running.
Sequence Diagram: Liquidations Without Atlas
1.2 Challenges in the Current Process
- MEV Leakage: Value is extracted by external actors, reducing the protocol's potential revenue.
- Inefficiencies: Competition among bots can lead to network congestion and higher gas fees.
- Security Risks: Potential for front-running and other malicious activities.
2. Benefits of Integrating Liquidations with Atlas
Integrating Atlas into the liquidation process addresses these challenges:
- Internalizing MEV: Capture the MEV generated from liquidation events and redirect this value back into your protocol.
- Efficient Liquidation Process: Utilize Atlas to execute liquidations more efficiently and securely through atomic transactions.
- Customizable Value Allocation: Define how the value from liquidations is allocated using custom modules (DAppControl), such as rewarding protocol participants or bolstering the protocol's treasury.
- Enhanced Security: Manage external liquidators through the Atlas framework, which enables the implementation of reputation systems, filtering out malicious actors and ensuring a more secure environment.
3. How It Works with Atlas
Atlas provides a flexible approach to integrating liquidations into your lending protocol. While traditionally, liquidations are triggered by solver bots monitoring for under-collateralized positions, Atlas allows for a similar setup where solver bots can trigger liquidations directly, possibly without requiring a User Operation. This flexibility enables you to integrate Atlas without significantly altering your existing liquidation flow.
3.1 Liquidation Process with Atlas
In this approach, liquidations are initiated by solver bots (solvers) who submit Solver Operations directly, without the need for a User Operation. This is made possible by configuring the Atlas module appropriately, allowing solvers to act as the auctioneer and initiate the process.
3.2 Liquidation Flow with Solver-Initiated Operations
The liquidation process proceeds as follows:
-
Solver Identifies Opportunity: A solver monitors the lending protocol and detects an under-collateralized position eligible for liquidation. The solver decides to initiate the liquidation process.
-
Auction Initiation and Coordination: The solver starts an auction by submitting the liquidation opportunity to the Auctioneer, who then starts the auction timer.
-
Solver Operations Submission: Solvers submit their Solver Operations (bids) to the Auctioneer.
-
Bundling and Submission: The Auctioneer selects the winning Solver Operation based on the bids received and provides the bundled operations (including all ordered Solver Operations) to the Bundler.
-
Atlas Metacall Transaction Creation: The Bundler creates an Atlas metacall transaction with the bundled operations and submits it to the Atlas contract.
-
On-Chain Execution with DAppControl Module: The transaction is executed on-chain via the Atlas entrypoint contract, which interacts with the custom DAppControl module deployed by your protocol. Atlas executes the liquidation on the LendingProtocol, starting with the winning Solver Operation, and allocates proceeds according to the rules defined in the DAppControl module.
Sequence Diagram: Solver-Initiated Liquidations With Atlas
3.3 Advantages of Solver-Initiated Liquidations
-
Flexibility: Allows solvers to initiate liquidations directly, maintaining a similar flow to traditional methods but within the Atlas framework.
-
Internalized MEV: the protocol can still capture MEV by defining allocation rules in the DAppControl module.
-
Enhanced Control: By using the DAppControl module, you can enforce protocol-specific rules and value allocation strategies.
3.4 Implementing Solver-Initiated Liquidations
To enable solver-initiated liquidations:
-
Leverage Atlas Flexibility: Adjust your DAppControl module to allow wide range of configurations.
-
Set Appropriate Permissions: Ensure that only authorized bundlers can initiate liquidations, implementing necessary authentication and validation.
3.5 Optional: Including User Operations
While this approach does not require a User Operation, Atlas supports configurations where both User Operations and Solver Operations are used. If your protocol benefits from user involvement in the liquidation process, you can adjust the configuration accordingly.
4. Integration Guide
4.1 Identify Liquidation Points
Determine where in your protocol the liquidations are triggered and how Atlas can be integrated at these points.
4.2 Backend Changes
- Auction Management: Implement logic to initiate auctions for liquidation opportunities and process solver bids.
- Operations Relay Integration: Connect with an Operations Relay to facilitate communication with solvers.
- Bundle Creation: Use the Atlas SDK to create and sign DAppOperations for secure bundling.
4.3 Develop Custom Modules
Create a LiquidationControl module that defines:
- Liquidation Logic: How liquidations are executed within your protocol.
- Value Allocation Rules: How proceeds from liquidations are distributed (e.g., to stakers, as rebates, to a treasury).
4.4 Auctioneer and Operations Relay Setup
- Auctioneer: Integrate with an Auctioneer (off-chain) that manages the bidding process for liquidation opportunities.
- Operations Relay: Choose an Operations Relay option to facilitate communication:
- Self-Hosted Atlas Operations Relay Repository
- bloXroute Intent Network Documentation
- FastLane Operations Relay (coming soon)
5. Benefits to Your Protocol
- Increased Protocol Revenue: By capturing MEV from liquidations, your protocol gains an additional revenue stream.
- Improved User Experience: Efficient liquidations lead to a more stable protocol, enhancing trust among users.
- Competitive Advantage: Offering more secure and profitable liquidation processes sets your protocol apart in the DeFi space.
6. Conclusion
Integrating your lending protocol with Atlas, especially for liquidation processes, can significantly enhance functionality, security, and profitability. While integration involves complexity, Atlas provides templates, standard modules, and support to assist you in this process.
Next Steps:
- Review the System Architecture to understand the components involved.
- Explore the Atlas SDK for building operations.
- Consult with FastLane's Mechanism Designers for assistance in developing custom modules.