Apricot Assist: How to Stay Protected with X-Farm

5 min readSep 29, 2021


Auto-deleveraging to reduce liquidation risks

At Apricot, we strongly believe next-gen DeFi protocols should offer integrated tools to help users manage their positions so they can better sleep at night! 🍑

⚠️Do you know…

Leveraged yield farming (LFY) is inherently complicated, volatile and tricky, with many of its risks poorly understood and returns misleadingly advertised.

One of such risks is impermanent loss, which happens when the prices of your deposits assets change compared to when you deposited them as a liquidity provider. With LFY, not only are you taking a position on each asset’s price, but you are also betting on their “relative” prices. (To that end, X-Farm 1.0 will start with supporting stablecoin pairs like USDC-USDT and pegged pairs like SOL-mSOL to mitigate such impermanent loss risks)

Another inevitable and major risk that comes with leverage is, of course, liquidation risks. Nobody likes to be liquidated, period.

That’s why we have built Apricot Assist, an automated self-deleveraging assistant that you can configure to help you reduce your account’s leverage with your specific risk profile in mind. With Apricot Assist, you will be able to control:

  • WHEN to start selling or redeeming your collateral assets
  • WHAT and HOW MUCH assets should be sold or redeemed

Now, let’s take a closer look.

How does Assist 1.0 work? 🛡️📝

Before we start, let’s first explain the concept of “Borrow Limit Used”. Basically, the Borrow Limit Used is the ratio between your current borrow value and the maximum borrow value that is allowed on your account. When the market moves against you, and your account’s Borrow Limit Used reaches 100%, your account would be subject to liquidation.

So how does Apricot Assist help here? Well, you can configure Apricot Assist to help you redeem/sell some of the tokens in your deposit before your Borrow Limit Used reaches 100%.

The parameter you can set here is called Trigger Level. When your Borrow Limit Used reaches the Trigger Level (e.g. you can set it to 95%), Apricot Assist will help you take actions to automatically reduce your Borrow Limit Used to a lower level called the Target Level, which is also configured by you.

When triggered, Apricot Assist will attempt to do the following in order:

Step 1: Redeem LP tokens to repay corresponding stablecoin debt
Step 2: Sell stablecoins in deposits to repay stablecoin debt
Step 3: Sell non-stable tokens in deposits to repay stablecoin debt

In step 1, Apricot Assist starts with redeeming the LP token with maximum “corresponding repayable debt”. The reason is that we try to redeem both sides equally to avoid any swap fee. Note that this step will not generate an excess deposit.

For example, if you have $1,000 USDT-USDC LP in deposits, and you have borrowed $500 USDT and $200 USDC, Apricot Assist will help you redeem at most $400 USDT-USDC LP ($200 on both sides to avoid generating excess deposit in USDC).

In step 2 and step 3, we will start with repaying stablecoin and non-stable tokens with maximum deposit value first, respectively. Any excess stablecoins generated in the action steps will be cleared to bring the “Borrow Limit Used” down to as close as possible to the “Target Level”.

A little too much? Remember you can see the exact action sequence under Assist Simulator!

Recommendation 🍑💖

Be careful, the greater the difference between “Trigger Level” and “Target Level”, the more tokens Apricot Assist will help you sell/redeem when it is triggered. It is recommended to keep the difference small (e.g. <5%) especially if you have large positions that can create non-trivial slippage when deleveraging.

Limitations of Apricot Assist 1.0 🚫

Apricot Assist 1.0 currently cannot help you repay your non-stablecoin debt unless the non-stable token is borrowed for X-farming, and is backed by a corresponding LP token.

For example, if you borrow mSOL and SOL to X-Farm mSOL-SOL LP, Apricot Assist will be able to help you redeem the mSOL-SOL LP tokens to repay your debt in mSOL and SOL. However, if you are just borrowing SOL tokens from Apricot Lend to short it on another exchange, Assist 1.0 currently will not be able to help you repay your debt in SOL.

Another limitation is that Assist 1.0 supports 1 deleveraging action within a single trigger event at this moment (due to current mainnet account limit). When you configured Apricot Assist to a sensible level, most of the time there should only be 1 to 2 deleveraging actions needed. Nevertheless, there is no limit to how many times Assist can be triggered. So if Assist can’t do its job fully in one triggering event, it will just continue its job whenever it’s triggered again to try to bring down the Borrow Limit Used to the Target Level.

What to Expect in Assist 2.0 and 3.0…. 🚀

We know, we can and we do plan to improve Apricot Assist in future versions to enable greater coverage and configurability for our users! The following items are already on our roadmap:

  • Allow users to alter or specify sell / redeem sequence
  • Expand protection to support repayment of non-stable tokens
  • Allow users to disable the selling of any particular stable/non-stable/LP tokens
  • Allow users to fully configure Assist Trigger (e.g. if they want to cover short positions)

… and more.

Let us hear you, and stay tuned! 🔔

At Apricot, we value our users and community members. Please join our discord and telegram groups to let us know what features you would like us to add or prioritize, and we’ll really try our best!

In our upcoming article, we will be sharing some best ways to tap into what Apricot really has to offer, i.e. how to max alpha in a downside-protected way through Apricot Lend, X-Farm, and Apricot Assist!

Follow us on:

Twitter: https://www.twitter.com/ApricotFinance
Discord: https://discord.gg/C6JrtqZF5U
Telegram: https://t.me/ApricotOfficial
Telegram Announcement: https://t.me/apricotfinanceann
Website: https://apricot.one/#/




A next-generation lending protocol that offers cross-margin leveraged yield farming with downside protection