Introducing the Alpaca Guard

Samsara NotALlama
Alpaca Finance
Published in
4 min readMay 20, 2021

The markets are getting dangerous, my fellow Alpacas, which is why we’ve introduced something to protect you in the worst of times, from potential price manipulation, flash liquidation, and market failure. You may get nervous with other farms, but at Alpaca, you’ll never have anything to be nervous about, because this is much more than a new feature; this, is your new protector — the Alpaca Guard.

Some of you who used our platform today may have noticed that certain functions were temporarily grayed-out such as opening positions on certain pairs. This was the Alpaca Guard in Protection Mode, keeping you safe from the dangers of the market.

To be specific, when the price of an asset in your farming pair has its on-chain price from the exchange that pair is on(PancakeSwap) differ more than 10% from the median of a batch of off-chain oracles we verify with, the Alpaca Guard enters Protection Mode; This consists of disabling liquidations, and opening/closing positions; all in order to protect you from trading at bad prices and taking an unjust loss.

Do note that you can still add collateral to positions while Alpaca Guard is activated, in case you find your Safety Buffer running low, though you will not be able to borrow more capital. You should also be aware that if you do not add collateral in a 50:50 ratio, the swap may happen at a sub-optimal price since Alpaca Guard activation implies prices may be misaligned.

So as you can see, the Alpaca Guard exists to protect you, and in fact, the Alpaca Guard saved a lot of users’ funds today.

When the entire market flash crashed, the Alpaca Guard went into action, protecting many users’ positions from flash liquidations, allowing them to stay safe and keep farming once prices realigned and the Guard lifted Protection Mode. During this chaotic time, many users were prevented from losing their positions and trading at bad prices.

Feeling safer already? You should. 😄 The Alpaca Guard’s Protection Mode acts as an oracle delay, verifying price feeds every 5–30 minutes after activation(variable time depending on overall market volatility), which prevents large market orders from engaging in price manipulation(such as flash loans or margin orders). When the on-chain price moves far off from where it should be, this delay gives enough time for arb bots to push back that price to realignment either with other exchanges or a peg in the case of stablecoins and other pegged tokens.

In summary, the Alpaca Guard is watching your back. Yet, when he does activate Protection Mode, you don’t have to be worried either, because it’s also unlikely to stay on for long. Inevitably, arb bots will soon close the price divergence, letting the Alpaca Guard remove his protections and you to return to customizing your position, if you’d like.

The Venus Incident vs. Alpaca Guard

Today, Venus had a major incident that created $200M+ USD in liquidations and $100M in bad debt. We won’t go into the details and there are differing accounts of what happened but you can read about it here and here. In any case, what we do know is that the ultimate culprit that caused the market dump on XVS was a series of cascading liquidations. Integrating Chainlink wasn’t enough to protect them. So it’s interesting to note that, in fact, if Venus had the Alpaca Guard, he would’ve blocked this incident from ever happening!

The Alpaca Guard would’ve frozen the system when price took the first drop, blocking this chain of liquidations from the start! What’s more is he may have even stopped the original price pump that allowed several users(attackers depending on who you ask) to over-borrow against an inflated XVS price.

How about PancakeBunny’s exploit today? A flash loan attack. As it stands, that wouldn’t have gotten past the Alpaca Guard either! Not only does Alpaca Finance not work with flash loans, but the Alpaca Guard would’ve frozen the attack as soon as price made a drastic movement!

Well, it’s very unfortunate he wasn’t at either of those platforms, but that’s because he’s dedicated to his current job and thus, can only guarantee that one place is safe— Alpaca Finance.

So luckily for us, we don’t have to worry about any of these dangers, because the Alpaca Guard is also an Alpaca that lives on the farm, and he’ll never let the Llamas hurt you! 😄

Yet, even though the Alpaca Guard has demonstrated his strength today, he never stops going to the gym and becoming stronger, so that he can protect us even better. In reality, you could say our devs are his personal trainers.

By that I mean, our team is working on adding even more mechanisms to his program, making his supreme defense all-powerful. One of these boosts is a debt cap on farming pools, one that varies per pool depending on liquidity, which would further block someone trying to manipulate price by opening a huge position. In the future, we’re even considering adding trailing debt caps. Ok, so what would that mean for Alpaca Guard? Imagine Arnold Schwarzenegger+Bruce Lee+Optimus Prime…

Yea, you can feel safe.

In summary, we hope you’ve enjoyed meeting your new Alpaca bodyguard, protecting your assets from external threats.‌ Hence, if you ever find the Alpaca Guard in Protection Mode, you can rest assured that your assets are secured from any external factors until the markets realign, because that’s the Alpaca Guard’s job: standing guard over the herd, watching, and protecting all you young Alpacas.

--

--