[Proposal] Anchor Guardians of the Galaxy and Protector of Collateral

Anchor Guardians of the Galaxy and Protector of Collateral

In my opinion one of the best ways to increase the borrowing side of Anchor would be the introduction of Guardians for your Collateral. Failing to manage your LTV is expensive. You pay (thanks to the liquidation queue) now 5-7% in the last weeks but you still sell valuable collateral. When the market is down that sometimes adds up to another 5-10% on top depending on the flash crash size. Understandably not many want to join this game without the possibility to manage this risk automatically.

Introducing the Guardians. Whitelisted positions that can be used to automatically repay the loan or increase the collateral to bring back your LTV when you would have been liquidated.

This is a prototype of a possible UI just to illustrate this idea better. A guardian is a LP or Vault Position(s) which you can deploy in an anchor Guardian contract. If your LTV reaches the liquidation threshold, a “unwind strategy” is used. This strategy either increases the collateral or repays your loan. It calculates the size so that you are back to a safe LTV.

What are useful Guardians?

Useful is everything that you might use to earn with your borrowed money and provides a receipt token. In general it should include everything that is UST, bLuna or bETH related.

Here are some ideas with corresponding “unwind strategy” that came to my mind.

Guardian: aUST
Strategy : “the obvious” - removed from earn and used to repay the loan

Guardian: Any xxx/UST LP
Strategy : withdrawn from dex, UST part used to repay loan, xxx part send to depositor

Guardian: bluna/LUNA LP
Strategy : withdrawn from dex, bLUNA part used to increase the collateral, Luna part send to depositor

Guardian: xxx/UST from Spectrum or Apollo vaults
Strategy : withdrawn from vault, UST part used to repay loan, Luna part send to depositor

I’m sure there can be more Guardians and many protocols will request integration to attract more UST capital.

Difference between Guardians and Collateral

Due to the unique way Anchor is working, it accepts only interest bearing collateral where this interest can be redirected to UST Earn side (bAssets). This is in general for the borrower only attractive if he can use the UST loan somewhere else where the sum of paid UST interest and lost interest on collateral is lower than the interest earned.

Guardians are positions that can’t be used as collateral for Anchor, because the interest can’t be redirected. While the Guardian position is staked in the Guardian contract it will still earn all the interest and fees it normally would.

There can be multiple Guardians deployed in the contract and a priority can be assigned. The one with the highest (or lowest ?) priority gets unwinded first and used to repay the loan or raise collateral. Positions are partly unwinded until the LTV is back to a defined level (e.g. -10% below Max)

Guardian Positions can be withdrawn at any time. But having a list of possible attractive Guardians also allows to market Anchor Loans to interested investors. In general it will make taking a loan more attractive for a bigger group of investors that today don’t have an option/knowledge to manage their LTV via bots or scripts and are scared to get liquidated.

Lower risk, more borrowers. Would you use it ?

But Guardians don’t come for free. To not rely on external bots that trigger the unwind process at the right time they need to be integrated into the liquidation process from anchor protocol.

Difference between Guardians and Liquidation

Before any position is due for liquidation, the process will check with the guardian contract if any Guardians are deployed. If so, it will use the Guardian positions to avoid liquidation. To make sure all are handled the same this needs to have the identical costs otherwise no one will trigger the liquidation for a collateral that is protected by Guardians. The unwinding process will also create fees that need to be paid. But the 1% of the required capital represents a far lower risk than in normal cases and it does not require a sale of any token in a negative market environment.

What could a contract architecture look like?

I was also thinking about the architecture and technical feasibility of this idea and came up with the following, possible setup. I’m not yet a smart contract expert so if there are mistakes, feel free to improve my proposal.

Currently the liquidate_collateral function is called on the overseer contract, when someone’s LTV gets too low.This function then calls the liquidation_queue contract to sell the collateral.

In the new setup the liquidation_collateral is still called but then either within the overseer or the liquidation_queue contract the new Guardian contract will be asked if any Guardians are deployed. If Guardians are deployed the contract will “unwind” the position.

To make this flexible there are special “unwind” contracts for different kinds of Guardians. After unwinding the Guardian contract returns either additional collateral (bLuna, bEth) or UST to repay some loan. If successful the liquidation is avoided and the loan is back to a safe LTV.

What are limitations and challenges?

In the beginning, I see the challenge that probably only auto compounding positions will work as Guardians e.g. aUST or LP positions without external incentives. Everything that requires manual compounding will be difficult to integrate or the interfaces for the “unwind” contracts could support the “claim” function of corresponding positions. Also the Guardian contract will only work with receipt tokens that he can use to “unwind” the position. If the receipt token cant be transferred to the guardian contract it can’t be used. But as liquid staking and vaults are becoming the new norm I think these issues can be solved. Auto Compounding is also something that could be integrated at later stages if the demand for such Guardians is there.

So now I’ll ask you ! Would you borrow or would you borrow more when you know your save from liquidations and there are Guardian positions available that allow you to make net positive profits ?

Dr.Make

3 Likes

Maybe I missed something or got something wrong.

The problem I see is that in the event of big liquidations those LP pools could be drastically imbalanced thus leading to an decrease in bLUNA price. This would in turn be indirectly pricing the liquidation “discount” in the same way kuji works.

So… How would it exactly differ from simply having more competitive liquidation market?

If the guardians were to only be allowed participate in small amounts liquidations they would not have a real economic incentive to participate as it would be the same as any other LP pool

If you provide Luna/Bluna and you withdraw your LP but keep both sides there is no imbalance possible.
Lets say its 10/10 before and bLuna gets sold…you end up with 9/11 …you now withdraw your LP you still get overall 9 Luna and 11 bLuna value 20 Luna what you put in… you just lose 21 days worst for converting your bLuna back to Luna. In the meanwhile your 11 bLuna prevents liquidation.

Its gets better if you have Luna/UST…and Luna gets sold…you automatically buy the dip ! when markets recover you can sell your Luna for profit and enter the LP Position again in the new price range.

As long as the strategy does not sell anything you should be well of when the market recovers…! Liquidations typical happens when the market crash so fast that your are not able to manage the LTV yourself. Here they are a good protection and give you more time to react.

the word “automatically” needs a lot more elaboration; what will trigger these rebalances?

Need to elaborate here a bit…currently “liquidators” can call anchor overseer contract if there are Loans below the LTV. If they find them they call the overseer contract and trigger the liquidation. Here the Guardian contract could be in line and before its handed over to the liquidation queue its checking the guardian contract. If guardians are available they are used to lower the LTV if not the code continues and executes the liquidation.

In summary guardian contract will be triggered the same way as the liquidation_queue via the overseer when LTV is to low.
You could also setup something like nexus and have external contracts observing the oracles but this would be muss less secure and might not be battle tested enough yet.

@Dr.Make - super interesting idea to think about, and it seems to take the pressures off of everyday users.

Are there limitations to what the guardian can protect / positions it can keep safe?

It reminds me a bit of this conversation in the forum a few months back:

“Guardians” feels like a more developed product and I am appreciative of the UI prototype shared above.

Do you mind providing a bit more context for your quote below:

What are the costs for this integration? Who supports the bot infrastructure and would it be able to handle an increased workload?

1 Like

I like the idea of the aUST guardian. This should be a no-brainer to implement with a toggle option.

this is a good idea

the liquidator would invoke the same execute msg on the overseer contract, but the underlying logic will first check whether a guardian-strat is in-place. the liquidator won’t care, he’ll still get his 1%, and a liquidation is avoided.

this is probably a nontrivial update to the existing contract architecture; i wonder how to get some form of this idea prioritized.

Well there are cost for developing the contracts and ui. But that not what i meant here. The savest way to integrate this to add the logic into the liquidation process but the liquidator becomes 1% fee for triggering a liquidation. To not ignore the protected loans they would also get the same 1% when they unwind a guardians. I think that’s fair they need to pay for infrastructure and transaction costs.

1 Like

Well nontrivial for sure, but as the liquidation process was already changed once … it can be done again. I wonder how we get anyone here to work on this :smiley: … its one thing to create a prototype but another to get this production ready and i just started with learning rust and react …

1 Like

I absolutely LOVE this idea and fully support an integration of this type. This is one of the main reasons I don’t barrow on Anchor and this feature would completely change things for me. I have seen this integrated one other place Apricot on solona defi lend/barrow platform apricot. Another link here on details: Apricot Assist - Apricot Finance. Again I can’t stress the importance of this and how much this type of thing is needed across the industry.

1 Like

Another guardian i would love is integration with liquidation bidding. If i have UST deposited into a liquidation contract that should be visible by the guardian, as well as any bLUNA won at auction being automatically deposited into the collateral portion of anchor. This way one could safely borrow to fund liquidation activity.

Very good idea for a guardian as well. At least you then buy your own loan before buying others :D. Thinking about this…it is even financially reasonable to borrow UST to put it in the bidding queue because you can make there way more then the 20% per year.

Exactly. It becomes a game of being more responsible with your debt than others, if you are, you take their bLUNA.

Love the idea. I think this is something that could go up for a community grant. But please let’s not make another token lol

Long-term it would be great to build in flashloans to make it easier to flash in and out and do it within one block…is this something you are thinking about with these strategies?

1 Like

I don’t see how a flash loan could help with preventing liquidation. A flash loan would be only useful if you LTV is to low for a single block.

But that gets me to another idea…we could not just unwind in some strategies but also take loans and invest again in the guardian at hand when the LTV does allow it.

But i would make the first step first :smiley: what keeps most users from borrowing is the fear to get liquidated.

Btw: I spend some time to draft some contract interfaces for this … Overview - Draft Contracts Interface - Anchor Guardian but if this should become a community project i would need some experts here. I have 2 days experience in react (with them i build the UI prototype) and 2 days experience with RUST and smart contracts ( with them i drafted the interfaces ). I would not want me to build this without serious help.

1 Like

glanced at the doc, i really like that you’re wrapping the execute message on the overseer (vs a whole new liquidation contract).

this removes the anchor dependency (meaning relying on anchor gov or devs to do something); just offering a better yield opportunity for the liquidation keepers.

are you thinking a separate guardian exec/custody instance per strategy?

Yes i think this is easier to maintain and to managed the strategies. Not sure if a custody instance for each strategy or one for all… but definitely separate exec strategies . First its easy to add/remove one strategy without impacting the others and also for audits. If there is a new kind of strategies only the exec contract needs a new audit.

1 Like

In the light of last weeks liquidations i think we need to push this topic on the agenda as fast as possible.
Sure there are many people making a lot of money from the liquidations but those that pay the price are those that also pay the bill for Anchor. We should better protect them.
This would not just be better for the Anchor itself. It would also better for the whole terra luna.

Every Guardian that protects Bluna Loans, is potential less Luna sold on the market.
Every Guardian also allows ANC increase the LTV for loans to 80%+ without worries.

I’m working on some contracts already but could use some dev support and frontend experts that want to help.

I love the idea… But you are going to run into what we are running into, which is the shortage of developers. If you can try to source a team of a few ppl and put a budget together, I would think we can get some community funds for this via a poll.