# Create an Arb bot DPI via KeeperDAO

**URL:** <https://gov.indexcoop.com/t/create-an-arb-bot-dpi-via-keeperdao/264>\
**Category:** Products\
**Tags:** dpi\
**Created:** [3 November 2020 11:30 UTC](https://gov.indexcoop.com/t/create-an-arb-bot-dpi-via-keeperdao/264 "2020-11-03T11:30:34Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Etienne](https://yyz1.discourse-cdn.com/flex027/user_avatar/gov.indexcoop.com/etienne/32/66_2.png) [@Etienne](https://gov.indexcoop.com/u/Etienne)\
**Post date:** [3 November 2020 11:30 UTC](https://gov.indexcoop.com/t/create-an-arb-bot-dpi-via-keeperdao/264/1 "2020-11-03T11:30:34Z")

</div>

## Simple Summary

Create an arbitrage bot on the DPI / ETH market and launch it during the KeeperDAO liquidity mining program. This way, DPI is always well priced on the market, the Index Coop starts a new lucrative business to fund further developments, and we’re getting new connections with the DeFi ecosystem.

## Abstract

**What is KeeperDAO ?**  
[KeeperDAO](https://keeperdao.com) is an on-chain liquidity underwriter for DeFi. Using KeeperDAO, people can pool their assets to earn passive income through liquidations, arbitrage, and other opportunities from all across DeFi.

Keepers borrow funds from a communal pool of compatible assets. Anyone can borrow from the pool to leverage on-chain opportunities. Profits from the on-chain opportunity are returned to the pool. Profits are distributed between Keepers and Liquidity Providers (LPs).

_The mining incentive is live for 3 months only._

**How can we benefit from this ?**

- Setting up an arbitrage BOT (becoming a _Keeper_) will ensure that DPI is well priced compared to its components, and increase the trading volume on the secondary market.
- It will also allow us to mine ROOK (native KeeperDAO token) and benefit from a new source of income for the treasury. There is currently only one active Keeper per pool, mining 1 500 ROOK per day. There is a huge financial upside if we move fast.
- Using KeeperDAO funds to process flash loans is free of charge, compared to the 0,1% fees of other protocols, making it s way more profitable than standalone arb bots.

## High level specification

**Arb script**

Create a off-chain script that can do the following things:

**1.** Compare DPI price (DPIp) vs sum of its weighted components (WCp)

**2.** IF DPIp \> WCp, then

- Flash loan: borrow from KeeperDAO pool
- Optimize profits: algorithm to be defined later - should take into account available KeeperDAO pools, slippage and gas costs (instant)
- BUY WCp
- Mint DPI
- Sell DPI
- Profit

**3.** IF DPIp \< WCp, then

- Flash loan: borrow from KeeperDAO pool
- Optimize profits: algorithm to be defined later - should take into account available ETH pool, slippage and gas costs (instant)
- BUY DPI
- Redeem DPI
- Sell WCp
- Profit

**Arb smart contract**  
Create an arb smart contract that is able to:

- Process flash loans on the KeeperDAO pool
- Trade several pairs on Dex (Uniswap, 1inch…)
- Return profits to both KeeperDAO pool and Index Coop treasury

Here is an [example](https://github.com/keeperdao/example) of bot that is borrowing from the KeeperDAO pools. We just need to add the Uniswap connection and build the off-chain script. This will help us a lot in building the solution.

## Detailed specification

To be defined later if approved.

## How to ?

Let’s set up a small task force with product and dev ressources, and start as soon as possible.

## Poll

_Poll ([view on site](https://gov.indexcoop.com/t/create-an-arb-bot-dpi-via-keeperdao/264/1))_

---

<div class="post-metadata">

**Author:** ![richard](https://avatars.discourse-cdn.com/v4/letter/r/f0a364/32.png) [@richard](https://gov.indexcoop.com/u/richard)\
**Post date:** [3 November 2020 18:22 UTC](https://gov.indexcoop.com/t/create-an-arb-bot-dpi-via-keeperdao/264/3 "2020-11-03T18:22:15Z")

</div>

This could be pretty interesting as the Coop can bid at 0 spread. It will be just a matter of changing some code to point to KeeperDAO’s pool in the current arb bot (DeFi Pulse open sourced bot [here](https://github.com/ConcourseOpen/DPI_Arb_Bot_Example))

Does anyone else want to help take ownership of this initiative? Alex and I can help out from the Set team. We also know a few people from KeeperDAO pretty well so we can reach out if needed.

---

<div class="post-metadata">

**Author:** ![Etienne](https://yyz1.discourse-cdn.com/flex027/user_avatar/gov.indexcoop.com/etienne/32/66_2.png) [@Etienne](https://gov.indexcoop.com/u/Etienne)\
**Post date:** [3 November 2020 18:36 UTC](https://gov.indexcoop.com/t/create-an-arb-bot-dpi-via-keeperdao/264/4 "2020-11-03T18:36:06Z")

</div>

If everyone agrees to do so, i’m sure that you can lead the initiative since you’re already in contact with the KeeperDAO team 🙂 Would be awesome. It should start really fast otherwise we’re going to miss the mining opportunity. Big fan of KeeperDAO. Let me know if I can help @richard

---

<div class="post-metadata">

**Author:** ![Kiba](https://yyz1.discourse-cdn.com/flex027/user_avatar/gov.indexcoop.com/kiba/32/1436_2.png) [@Kiba](https://gov.indexcoop.com/u/Kiba)\
**Post date:** [5 November 2020 11:10 UTC](https://gov.indexcoop.com/t/create-an-arb-bot-dpi-via-keeperdao/264/5 "2020-11-05T11:10:02Z")

</div>

I have basically 0 solidity experience but have been wanting to run the arb bot for a couple weeks and keep deprioritizing it. I can’t get that source code to compile for me but if someone can help me with that then I can change the code.

I think that arb bot only uses flash loans in one direction so we’d either need to deploy two contracts or change the code a bit. I might be misunderstanding the code though, I only spent a bit of time when I couldn’t get it to compile, and was planning on writing my own in Vyper for fun.

---

<div class="post-metadata">

**Author:** ![richard](https://avatars.discourse-cdn.com/v4/letter/r/f0a364/32.png) [@richard](https://gov.indexcoop.com/u/richard)\
**Post date:** [6 November 2020 07:45 UTC](https://gov.indexcoop.com/t/create-an-arb-bot-dpi-via-keeperdao/264/6 "2020-11-06T07:45:19Z")

</div>

Yeah, let’s sync up. I wrote one that the Set team runs that uses a different implementation from this one

---

<div class="post-metadata">

**Author:** ![Kiba](https://yyz1.discourse-cdn.com/flex027/user_avatar/gov.indexcoop.com/kiba/32/1436_2.png) [@Kiba](https://gov.indexcoop.com/u/Kiba)\
**Post date:** [6 November 2020 09:24 UTC](https://gov.indexcoop.com/t/create-an-arb-bot-dpi-via-keeperdao/264/7 "2020-11-06T09:24:15Z")

</div>

Cool cool thanks 🙏 let me finish up some things on the UI and with CREAM over the weekend and I’ll message you Monday

---

<div class="post-metadata">

**Author:** ![MrMadila](https://yyz1.discourse-cdn.com/flex027/user_avatar/gov.indexcoop.com/mrmadila/32/4002_2.png) [@MrMadila](https://gov.indexcoop.com/u/MrMadila)\
**Post date:** [10 February 2021 22:01 UTC](https://gov.indexcoop.com/t/create-an-arb-bot-dpi-via-keeperdao/264/8 "2021-02-10T22:01:21Z")

</div>

Hi guys, just checking in to see if this is still being looked at? Thanks
