Extending Kandel: How to Source Liquidity from Any DeFi Protocol

Kandel extends Mangrove’s decentralized liquidity model by enabling users to source liquidity directly from any DeFi protocol without pre-locking assets. Leveraging Mangrove’s unique “Offer-is-Code” architecture, Kandel activates liquidity precisely at execution, allowing users to seamlessly tap into multiple yield sources like Aave or AMM pools. This reactive approach not only optimizes capital use but also enhances profitability and flexibility, setting new standards in DeFi liquidity management that outperform traditional AMMs under specific strategies.

Customize offers for maximum efficiency and control

Mangrove distinguishes itself through its innovative "Offer-is-Code" architecture, which allows for embedding code directly into each offer. This unique design enables the inclusion of custom code that can enhance offers with advanced functionalities like liquidity sourcing.

Makers create smart offers with embedded code. When Takers initiate market orders, Mangrove’s system executes and finalizes transactions seamlessly.
Makers create smart offers with embedded code. When Takers initiate market orders, Mangrove’s system executes and finalizes transactions seamlessly.

Liquidity sourcing is a feature of Mangrove's reactive liquidity model, allowing liquidity to be drawn from external DeFi protocols and mobilized precisely at the moment of trade execution. This approach maximizes efficiency and flexibility, highlighting Mangrove's role as a non-rival, highly adaptable liquidity platform.

Mangrove Liquidity Sourcing: Makers post smart offers, while Mangrove’s router pulls liquidity just-in-time from DeFi protocols only when an offer is taken. This approach enables flexible, efficient liquidity management across multiple DeFi platforms.
Mangrove Liquidity Sourcing: Makers post smart offers, while Mangrove’s router pulls liquidity just-in-time from DeFi protocols only when an offer is taken. This approach enables flexible, efficient liquidity management across multiple DeFi platforms.

The Mangrove team has implemented several liquidity routers available to developers, some of which are integrated into the dApp UI. By adding your own code to your offers, you can source liquidity from any permissionless DeFi protocol.

Maximize earnings through Kandel’s liquidity sourcing

Imagine that your assets are deposited in a DeFi protocol. You can use this capital on a Kandel grid, and it will only mobilize your liquidity when an order is executed. There's no need to move or lock up your funds in anticipation of a transaction.

This optimizes your capital use and addresses a major issue in DeFi: interoperability between protocols. By using Kandel’s liquidity sourcing, you can take advantage of opportunities across multiple protocols without having to lock your assets on each one.

Practical example on Mangrove’s DEX: Alice and her loan on Aave

Let's begin with a simple example of liquidity sourcing on Mangrove's order book.

Imagine Alice, who has supplied 1 WETH on Aave. She wishes to sell 1 WETH if the price reaches 3,000 USDC. During the configuration of her order, she selects Aave as her liquidity source [Step 1]. On Mangrove, a limit order is placed to sell 1 WETH at that price [Step 2].

Yield-Bearing Limit Orders with Aave Balance: Makers can post WETH/USDC limit orders on Mangrove’s order book while keeping their WETH balance in Aave. Liquidity is sourced from Aave only when the order is executed, allowing the maker to earn yield on their WETH until the moment of trade.
Yield-Bearing Limit Orders with Aave Balance: Makers can post WETH/USDC limit orders on Mangrove’s order book while keeping their WETH balance in Aave. Liquidity is sourced from Aave only when the order is executed, allowing the maker to earn yield on their WETH until the moment of trade.

When the price of WETH reaches 3,000 USDC and the order is executed, Mangrove automatically retrieves the WETH from Aave, sends it to the taker, and Alice receives 3,000 USDC in exchange.

This way, Alice was able to keep her WETH on Aave—earning yield for supplying liquidity—until the exact moment the transaction took place.

Extension to Kandel

Alice can also set up a Kandel strategy and source liquidity from her loans on Aave. For example, she might supply USDC to one Aave market to earn supply rates and incentives, and supply WETH, benefiting from both supply rates and additional incentives. She can then create a Kandel strategy using the WETH/USDC pair, where each asset sources its liquidity directly from each respective Aave loan.

Maker deposits WETH and USDC into AaveKandel, which manages liquidity on Mangrove’s order book. The AaveKandel smart contract sources liquidity from Aave.
Maker deposits WETH and USDC into AaveKandel, which manages liquidity on Mangrove’s order book. The AaveKandel smart contract sources liquidity from Aave.
When a taker posts an order on Mangrove, AaveKandel sources liquidity directly from Aave. WETH and USDC are transferred just-in-time.
When a taker posts an order on Mangrove, AaveKandel sources liquidity directly from Aave. WETH and USDC are transferred just-in-time.

The liquidity, along with the profits, will then be reposted through the Kandel process.

The AaveKandel smart contract sources liquidity from Aave as needed, allowing WETH/USDC offers to be posted without locking assets upfront, thereby maximizing returns through Aave’s yield-bearing assets.

This Kandel strategy with Aave has been fully coded and audited, ensuring secure and reliable performance.

Below is a summary of the profits made:

Aave-Kandel Setup: Mangrove’s Kandel Liquidity Manager directs both USDC and WETH to Aave, earning supply rates and additional incentives. This strategy capitalizes on Kandel incentives and profit from the spread, optimizing returns for liquidity providers by leveraging Aave’s yield-generating capabilities.
Aave-Kandel Setup: Mangrove’s Kandel Liquidity Manager directs both USDC and WETH to Aave, earning supply rates and additional incentives. This strategy capitalizes on Kandel incentives and profit from the spread, optimizing returns for liquidity providers by leveraging Aave’s yield-generating capabilities.

Another example: a price-neutral loop connected to Kandel

In a lending/borrowing-based carry trade strategy, the idea revolves around taking advantage of the platform’s collaterals native yield while leveraging the position.

The concept remains rooted in the classic carry trade principle: "borrow low, lend high." Here’s how it would work:

  1. Borrowing: You borrow an asset, such as ETH, from a lending/borrowing platform at a certain borrowing rate b.

  2. Supplying Collateral: You simultaneously supply another asset, such as wstETH, back to the platform, earning a supply rate s0, along with additional rewards on the collateral provided.

The key aspect in this loopy strategy is that it allows leverage (i.e., "loops" of borrowing and supplying), AND the collateral itself earns rewards. This means the gap between the supply rate and borrow rate:

δs := s0 − b > 0

also leads to profitability thanks to the added collateral rewards.

Even if the supply rate s0​ is not significantly higher than the borrowing rate b, additional platform incentives on the collateral can enhance total returns, making this strategy viable.

The position is built using USDC as initial capital, with a long position in wstETH and a short position in ETH. This setup is designed to be neutral to fluctuations in the USD price of ETH, although interest flows are in ETH, making it sensitive to ETH price variations if calculated in USD.

Steps to Build the Position:

  1. Deposit USDC at t0

  2. Borrow ETH creating an initial credit line (A).

A = (x : USDC | y : ETH)

  1. Stake and wrap ETH into wstETH on Lido: y : ETH to obtain

y ' : wstETH with q(t0)y ' = y

  1. Deposit wstETH into wstETH/ETH lending/borrowing market, using loop-borrowing to amplify the position and create a larger credit line (A’).

A' = (fy ' : wstETH | z : ETH)

with f, the amplification of the initial position,

and with z=(f-1)y to make sure that the position is self-financing.

The additional return per unit of time is the ‘spread’ i.e. the difference between the stacking yield and cost of borrowing. All this can be managed with a customized Kandel strategy using Mangrove’s liquidity sourcing.

In this strategy, the Kandel AMM leverages an ETH-wstETH loop to capture staking yield, supply rate, and incentives.
In this strategy, the Kandel AMM leverages an ETH-wstETH loop to capture staking yield, supply rate, and incentives.

Connect and amplify any DeFi yield source to Kandel

The mechanisms behind Kandel liquidity sourcing can be extended to other areas:

  • AMM Pools: You can source liquidity from an Automated Market Maker (AMM) pool, earning fees and potentially farming incentives.

  • Multi market Kandel: You can also duplicate an existing Uniswap v3 AMM pool on Kandel in order to profit from orderflows coming from both exchanges (Uniswap and Mangrove).

  • For Token Issuers: Your liquidity can be multiplied by sourcing from both a liquidity pool and Mangrove. This dual sourcing improves liquidity depth and availability for the token, benefiting both the issuer and the traders.

  • Kandel with a single side deposit : You can deposit the quote token then borrow, and source the liquidity for the other token. It can be very useful if the second one is the most volatile.

  • An hedged Kandel: You can use options or other hedging instruments in order to limit losses.

Indeed, any source of yield that can be unwound within a block time can be connected to Mangrove and associated with a Kandel strategy. This includes various DeFi protocols and yield-generating assets. By integrating these sources, you can enhance your strategy's profitability and flexibility. You can therefore further refine your strategy and make your capital more efficient.

An Invitation to DeFi Strategists

We invite DeFi strategists to explore the extensive possibilities of developing new Kandel strategies on Mangrove. The Kandel codebase is open-source, providing a flexible foundation for innovation. There are numerous ways to enhance their yield—such as advanced liquidity sourcing—and improve performance through features like exit bots and hedging mechanisms.

Moreover, there's an opportunity to be remunerated for designing and implementing new routers for Kandel or creating new versions of the strategy. Your contributions can significantly impact the DeFi ecosystem by advancing liquidity provision techniques and optimizing capital efficiency.

Next Steps

  • Dive into Mangrove's Documentation: Learn how to develop custom Kandel strategies and integrate various yield sources.

  • Collaborate with Us: Reach out to our team for support and guidance in your development efforts. We're here to assist you in bringing your innovative ideas to life.

  • Contribute and Earn: Explore opportunities to be compensated for your work on new Kandel routers and strategy enhancements.

  • Join the Community: Connect with other DeFi strategists, share insights, and contribute to the interoperable DeFi ecosystem.

Get in Touch

If you're interested in developing new Kandel strategies or have ideas to enhance existing ones, we'd love to hear from you.

🌐 Contact us on Twitter and join our community on Telegram and Discord.

Subscribe to MangroveDAO
Receive the latest updates directly to your inbox.
Mint this entry as an NFT to add it to your collection.
Verification
This entry has been permanently stored onchain and signed by its creator.