[Proposal] Liquidation protection & Airdrops automation

This is a proposal for implementing liquidation protection for Anchor collateral in AutoTerra along with automatic Airdrop collection functionality.

What is AutoTerra?

AutoTerra is a cross platform desktop application that aims to automate routinely performed operations on various protocols present in the Terra ecosystem. It can be run as a background/tray application, which allows 24/7 execution.

For its first major features, it aims to implement two functionalities for the Anchor protocol.

  1. The Liquidation protection functionality in AutoTerra aims to monitor a user’s collateral ratio and repay the loan partially or add more collateral based on parameters set by the user in the settings.

  2. The airdrop collection functionality automatically claims the user’s anchor airdrop to their wallet and stakes/lends/swaps the airdrop tokens based on configured settings.

Project page & Source code


Liquidation protection allows Anchor borrowers to safely borrow UST without worrying about liquidations and having to constantly monitor their collateral ratios. Configurations can be set to automatically repay UST or add more collateral when a certain threshold is hit. Of course, the user should have adequate UST/Luna/BLuna balance in their wallet for protection to work.

Benefit And Impact Towards Anchor Protocol And Anchor Community

Liquidation protection can incentivize more borrowing as users do not have to worry about manually repaying/adding collateral during sharp price swings of
Luna. This should be a net benefit for the Anchor protocol community as more collateral will be staked leading to an increase in reserves.

Automatic airdrop collection is a time saver, especially as more protocols are added to the Terra ecosystem.

How It Works


  1. The user enables liquidation protection on their local AutoTerra installation and sets the parameters based on their preference.
  2. A script that uses Anchor.js will run in the background and constantly monitor the user’s wallet address in Anchor and see if its collateral ratio is below the configured threshold.
  3. If it is below the threshold, it will either repay a part of the loan or add more collateral based on the settings.
  4. It will then log an entry for the actions taken in the local database and trigger a desktop notification.

Airdrop collection:

  1. A script will run every hour and see if any airdrops can be claimed for the current user. If so, it will claim the airdrop.
  2. If any post-actions such as “Swap to UST”, “Swap to UST & deposit” etc. are configured, the appropriate action will be taken.
  3. An entry will be logged and displayed in the history along with a desktop notification.

The screenshots below display some of the configurable parameters(they may change based on feedback):

Liquidation protection:

Airdrop collector:

Status Of The Project:

The frontend UI of the screens are almost complete and the code can be accessed on GitHub. The backend functionality, wiring, build artifacts, tests etc. have not commenced yet.

Team Profile And Likeliness To Deliver By The Described Deadline

The team consists of a full stack developer with many years of front-end and backend development experience. The developer is an avid LUNAtic since January of this year. Two milestones have been defined so that users can get to play with the application quickly and report their feedback:

The developer has allocated enough time for the successful completion of the project. Due to a milestone based approach, the airdrop collection should be available for production while liquidation protection is being worked on.

Potential Of The Proposal

The proposal has potential to address a feature that is very broadly applicable to Anchor users i.e all borrowers.

Breakdown Of Costs:

Software estimation is an inexact science, the following is a crack at the breakdown:

UI Design & implementation - 750 ANC
Airdrop collection implementation - 750 ANC
Airdrop collection tests(manual + integration) - 250 ANC
Liquidation protection implementation - 2000 ANC
Liquidation protection tests(manual + integration) - 750 ANC
Ongoing bug fixes/maintenance for remainder of 2021 - 500 ANC (Rather than create new proposals, this should cover costs for 2021)

Total: 5000 ANC

We feel that the above is a fair estimate that will allow development and continued maintenance of the features along with sufficient developer incentivization.


  1. Airdrop collection BETA release(ETA - May end)
  2. Liquidation protection BETA release(ETA - July start/mid month)


The proposal is technically feasible and can be completed within the deadline( barring any unnatural events). The Terra.js & Anchor.js libraries implement much of the required library calls. Electron.js allows cross
platform desktop apps to be built with required functionality(background/tray apps, notifications etc.)


Terra.js, Anchor.js, Electron.js, Webix(UI library).


We haven’t gathered in depth feedback yet but plan to do so and engage with the community through Twitter & Telegram if/when the proposal passes.

For audits, we plan to gather feedback as to the levels necessary and also may apply to Terraform capital if required.


The developer has the skills required for implementing the features listed in the proposal. Specifically, the dev has extensive JS, React experience(along with around 8 years Python experience). The project is open source and should be accessible for contributions from developers familiar with Javascript.

Future Prospects & Development

The features listed in the proposal are only a starting point, feedback for enhancements and new features will be taken into account and implemented based
on demand and congruence with existing features/other projects in the Terra ecosystem.

Please let us know if you have any questions.


Great idea! This would be very handy and offer great convenience to users.

The idea of automated Airdrop collection is simple yet brilliant. It would be even better if it was broadened to every Terra app (e.g., to collect Mirror Airdrops, etc.).

Liquidation protection is absolutely needed for Anchors’ borrowers, and the community has been begging for it for quite some time. Lack thereof discourages users from borrowing at all, simply because it can seem too risky. That being said, liquidation protection also undermines the incentive to over-collateralize on loans; this is problematic because over-collateralization fuels Anchor’s savings growth and other rewards.
I was hoping that Anchor would implement this themselves (as ‘backup collateral’) so they could take an Activation fee, which would still incentivize some over-collateralization, earn revenue from Activation fees, increase bAsset demand, and encourage more borrowing by reducing fears of liquidation. Perhaps if AutoTerra also charged an Activation fee and gave most of it to Anchor, then I could see many of those benefits remain.

It seems to me like AutoTerra should be generalized to many Terra applications, and not just Anchor. Judging by the UI, it seems like the nav pane could easily add more dropdowns for other applications, which is great, but also begs the question why Anchor should be funding this over others.

Despite these concerns, AutoTerra seems to be providing conveniences and solving problems that currently don’t have any better solution.
If this goes ahead, I’d be interested in offering feedback on code, mechanism, design, and future for AutoTerra.

Good Luck.


This is great! Would there be a way to generalize this automation not just for manual user operations but also for a diverse range of manual operations that are present in the Terra ecosystem? Something around the lines of Keep3r Network for Terra.


Thank you for the feedback. AutoTerra definitely aims to be generalized across all protocols in the Terra ecosystem but it is starting first with Anchor. To clarify, this proposal is only for liquidation protection and airdrop collection in Anchor. Features for other protocols in the ecosystem will be developed by opening separate community spend proposals in the respective protocols.

Thanks for the feedback. Since this is a desktop client app and not a smart contract web app like Keep3r, I don’t think AutoTerra could generalize to add functionality provided by Keep3r. That being said, I am open to ideas on potential ideas/architectures that would make implementation of said functionality possible for AutoTerra.

Bump! Very relevant thread now! I was thinking we need access anchor from mobile app to make payments, however an automated function to pay back loan would be great as well!

Great work. Two comments:

  1. Holding assets in the account which are not collateral shouldn’t be absolutely necessary; a setting could allow liquidation protection that withdraws bLUNA collateral, swaps it to UST, and repays with that UST. This is the only way to provide protection if a severe drop overpowers the free assets in a user’s account.

  2. Ultimately this should probably be a proxy contract wallet that only has the ability to take certain actions with funds, eliminating the need for the user to have a desktop running AutoTerra. (However, the regular checking of current price does need to be automated somehow. Eventually I believe someone will propose that validators run an incentivized scheduled/recurring task service. In the meantime, could be an action anyone can call and cron jobs set up targeting it.)


Thank you, I’ll look into the proxy wallet based solution once col-5 is released.

To be sure I understand this proposal - do we need to unlock/authorize the wallet in order for the client side app to take actions (e.g., collect airdrops, repay debts, etc.)?

Or the permission for possible actions could be provided upfront, so later the regular running client side app could trigger the action without invoking the user’s wallet in any way?

Call me greedy… but why do you need 2k ANC for implementing a repayment function that has already been made by someone else, and the language (NodeJS) is even the same as well…
Money shouldn’t be spent reinventing the wheel…


A fellow community member has pointed me to GitHub - unl1k3ly/AnchorHODL: Anchor Protocol Script that can save you from being liquidated!, which is equally good. I have been running it over the past few days (with a new wallet holding bLuna only), via a standard Docker image on Linux. Very satisfied …

Looking forward to seeing some DeFi saver equivalent platform in Terra ecosystem.


I second this.

Many people, including myself, already developed and provided FOR FREE a bot to avoid being liquidated (and more).

There is no need to spend money to develop a GUI on top of it.

1 Like

I actually made a compilation of 4 of these tools on Anchor’s Discord server.

I hope that’ll be useful to someone.


@Chinoman10, @johnsongw, @RomainLanz Thanks for the details about the other projects that implement the auto repayment functionality.

Indeed, this proposal would be redundant given the other projects already present. I’ll not go ahead with the proposal.

Hey Romain,

i tried to get your code running, but couldn’t do it tho.
Everything seems fine but the wallet is always the wrong one. No idea where the wallet id’s are coming from since they are totally made up. Any idea how to solve this? Pretty much read every data in the folder.

I am on main net with my private key in the config.


1 Like

To be fair with you, a desktop GUI application still hasn’t been made.
You can still go ahead with a proposal to build a UI-wrapper :slight_smile: , instead of charging 5k ANC where 2k are for the repayment function alone, maybe charge 3.5k for the design and implementation, maintenance, etc.
I don’t know if any of the other devs are willing to already develop it for free however :man_shrugging: .

Thanks I would like to see an integrated version instead of having to add code.

Hello Romain,

I am a newby in cryptoland/Terra.
Main priority for me is to secure my capital.
I don’t have experience with programming software but with good instructions I can manage it.

Do you have an instruction paper or can you tell me where I can find a good programming instruction?

Kind regards from the Netherlands,


I realise this is the anchor community, but has anyone developed or is in the process of developing liquidation protection for Mirror Finance? Would be super useful to avoid unnecessary liquidations from an inability to monitor.

  • List item

Automated airdrops would defeat the marketing / awareness purpose of airdrops. The point is to trigger a target audience to proactively engage with a new platform, sort of like a free trial in that the act of using and learning something is an investment that a consumer psychologically will want a return on. Maybe automated SMS notifications, that would be beautiful.