Funding a CDP liquidation bot with community funds

Recognizing that the current MIR inflation schedule is not yet offset by the fees collected on the platform, I’d like to propose a mechanism to increase the buy pressure for MIR.

Essentially, the proposal is to issue a grant from the community fund, in order to develop a keeper bot.

The bot should be able to:

  1. Constantly watch for collateral positions that fall under the minimum C-ratio defined for a given mAsset
  2. Purchase collateral positions meeting the criteria above, at the auction discount rate set for the mAsset
  3. Sell the discounted collateral for the mAsset that is under collateralized
  4. Redeem (burn) the mAsset purchased on behalf of the user facing liquidation
  5. Repeat 1-4 until C-Ratio is above liquidation threshold

The UST profit netted from step 2 to 3 should be used to purchase MIR and send it to the community fund, effectively reducing the MIR circulating supply, while accruing funds for the community to decide on what’s the best ROI for these.

Relevant documentation on the process can be found at:

I have no data on the state of liquidations at the moment in Mirror but with the 40 new mAssets requested by the community, I would expect the liquidation opportunities to become aplenty.

This thread is open for comments and feedback on the proposal, but mostly to clarify the following:

- Amount of the community grant to develop the bot (i’m thinking 7500 MIR)
- Find interested candidates and their Terra wallet address
- Align on payment schedule vs deliverables roadmap

Let’s make it happen


This makes a lot of sense. Before this gets put up for proposal, a few questions:

  • Who will develop and run this bot? What makes this agent trustworthy & competent?
  • What transparency info will the community receive (format) and at what cadence?
  • Who will develop and run this bot? What makes this agent trustworthy & competent?

I’m thinking anyone can take up the task by signaling interest here, but the grant could only be fully released upon an audit and green light from the Terra team. Ideally we’d do a vested funding, like:

10% upon startup
30% upon test release on Tequila
40% upon launch
20% released x weeks after launch

  • What transparency info will the community receive (format) and at what cadence?

Good point, analytics dashboard should be part of the scope, ideally daily.
We could set up a recurring payment from the community fund to the developer wallet, to cover for maintenance costs + a small developer fee, conditional to the dashboard being live.

Just thinking out loud for now, there are probably better ways to incentivize this whole operation

Seb I think that’s a great idea. I also thought of community pool and CDP fees so well connected. Are you going to propose it? I will vote yes.

Great idea. Im 100% for this. As far as who will run the bot, it could in theory be built on the blockchain where someone calls an execute function then a contract executes the liquidation etc. We dont yet have a keeper type ecosystem on terra yet , so we would likely need to build this in to mirror. And since tx fees arnt terrible we can offer maybe 5 - 10% incentive to the executioner .

More work for sure and the talent is a bit limited for cosmowasm devs. But i think this approach brings all inclusive value to the protocol for users and for governance.

Crazy idea but as a decentralized governing body , as things progress i think governance should consider bringing on dedicated DAO employees who manage the DAO initiatives from a technical and community perspective.

For example this project a project manager could go out and find a developer , discuss requirements implementation, cost , do a bit of shopping around, maybe break up the front end and backend code and outsource each part. The PM would be responsible for communicating with the DAO stake holders and discussing design constraints and feasibility.

A. This is a more effective than putting up a grant or bounty for a feature.
B. We’ll likely better manage cost with a more strategic approach.
C. We control quality, or rather the DAO appointed PM proposes quality standards , the dao approves and the PM manages compliance of that standard with multiple levels of approval.
D. We create subject matter experts in the space , people who are focused on building the protocol and know the ins and out, people who are dedicated to the project as it is their job, they work for the DAO

This tangent probably needs it’s own thread. Still a bit early just now but definitely something we should consider long term .

1 Like

I’m interested in collaborating to built the bot. I have no experience with Terra blockchain, but I have traditional python, javascript, react experience and recently finished the Consensys Ethereum Developer Bootcamp.

I think there are a few ways to approach this, but the idea I have in mind currently is a bot running on a cloud service that interacts with Mirror via its javascript or graphql API.

I have a few questions though:

  1. How will the community built bot vs private bots compete (ie, why would the developer of the community bot want to share his profits, he could potentially keep it himself)
  2. The bot will need capital to start with, i’m not sure how to kick start that. A private bot could probably use the developers own funds to start with.
1 Like

he could do this, and I think having a lot of private bots would be healthy for the network as well. This bot would be funded by the community fund, so building this bot to get the grant would be in reach of developers that don’t have the capital to fund their own bots

Like i said above, the goal is to fund the bot with resources from the community pool

After having thought about this for a bit, think this system would much better if it was a terra side smart contract - this would give the community visibility into how the funds are being used & reduce agency risk


think this system would much better if it was a terra side smart contract

I think @Papi raised good points
Ideally we should build this as a keeper system that can liquidate on Mirror, and possibly on Anchor down the line (not sure how realistic this is, but I suppose a portion of the logic and dev work applies to both protocols).

That also means that the pool of talent is more limited and we may not find anyone in the community able to pull this off

What do you think @dokwon is it worth pursuing at the moment ?

What other way is available for us to do this? I think TFL resources are stretched quite thin at the moment across core products, so likely this should happen with the community sourcing a capable rust developer - costs should be offset by a grant from the community pool

If the MIR DAO is willing to employ a full time employee , match my current salary +10%, ill quit my job, become an expert rust developer and develop apps for mirror for the next year or so. I already have a bit of solidity experience , and have a background in software development , systems management and design. If there is any interest in this at all, i’ll work up a formal proposal as to what i would see my roles as and what value i would bring to the MIR project.

Seb, quick thoughts:

  • Do we need increased buy pressure right now? All the Terra prices greatly exceed Oracle prices at the moment…
  • There will be (and probably already are) private bots that will likely compete this community-funded bot. Why not just rely on those private bots to increase pressure? What is to say that this community-funded bot will actually beat the private bots?

Hi mate,

My original thread was to focus on something I thought was not fully explored at the moment (liquidating CDP positions under the CRatio) , but your question seem to relate to bots that would arbitrage Pool prices vs Oracle prices for mAssets.

One thing we can observe over the last 2 days is that there is far more demand for farming MIR as a LP than there is capital to arbitrage the opportunities created from this buying pressure.

So, I think the 180M UST sitting in the community fund could indeed be deployed to exploit these arbitrage opportunities

The key questions that Do raised on the trustlessness and security of the process are still relevant though , and we’d need to tackle that first .

But the mechanics could be similar : the proceeds from the bot could be used to market buy MIR and send it back to the community fund , effectively reducing the circulating supply.

Anyways, Do seems confident that when the UST peg is restored , there should be less reluctance to mint , so we should know more about this in a few days

@Papi if you’re real with your intentions and if we see a need past Feb 8th , let’s dig further on your idea - Mirror could use every talent available


Reupping this initiative now that UST peg is restored and we have more volatile assets on Mirror. I’d suggest that the profits are distributed to MIR governance stakers rather than the community pool.


+1 on rewarding gov stakers rather than community pool - community pool is very well funded and can take on pretty much any community task required - no more funding needed


Just and idea there. Should we have a cap on the community pool from where the funds go to governance stackers ? Might be one for v2.

Hello ! I’ve been coding for over 20 years. I’ve fallen in love with the terra protocol, and the community around it.

I’d be very interested in building this CDP liquidation bot. I have experience doing something similar with the Maker DAO (DAI 1.0) bite system for liquidating under collateralized CDPs.

Is there still a desire to have this project funded by a community grant ?

For more context on me - please visit my linkedin profile:


@mpretti that sounds like relevant experience! Have you looked at the developer documentation for Terra smart contracts? I found the getting started guide very useful: