From 21b201ad27f7392ae19a923c2610a615c64b1bc1 Mon Sep 17 00:00:00 2001 From: Jeremy Liu <31809888+NotJeremyLiu@users.noreply.github.com> Date: Thu, 12 Jan 2023 16:28:19 -0500 Subject: [PATCH] Change dockerfile to use main dir, update readme --- Dockerfile | 4 +- README.md | 125 ++++++++++++++++++++++++++++++++++++++++++++--------- 2 files changed, 107 insertions(+), 22 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0f3bace..14e6a65 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,10 +3,10 @@ FROM python:3.10 RUN apt-get update && apt-get install -y nano # Set the working directory to /app -WORKDIR /cyclic-arbitrage +WORKDIR / # Copy the current directory contents into the container at /app -COPY . /cyclic-arbitrage +COPY . / # Install any needed packages specified in requirements.txt RUN pip install -r requirements.txt diff --git a/README.md b/README.md index 459b7ef..86466ed 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# Skip Searchers +# Skipper -Example MEV searching bots for the Cosmos ecosystem, using Skip. +Example MEV searching bot for the Cosmos ecosystem, using Skip. ``` python """ @@ -24,11 +24,8 @@ Example MEV searching bots for the Cosmos ecosystem, using Skip. # Overview -This repository contains example MEV bots that search for and executes on -profitable MEV opportunities throughout the Interchain, starting with Juno. - -Each subdirectory corresponds to a different bot. The README in each subdirectory -contains more information about the bot and a quickstart guide for using it. +This repository contains an example MEV bot that searches for and executes on +profitable MEV opportunities throughout the Interchain, starting with Juno and Terra 2. * If you're new to MEV or searching, use this repo as an educational tool to help you learn the what and how of searching. @@ -42,10 +39,7 @@ For an overview of Skip, please see: https://woolen-background-b64.notion.site/S # About our bots -* `juno-arb`: A Python bot for JUNO that captures cyclic arbitrage opportunities across -JUNO's two major DEXes--JunoSwap and Loop DEX--by backrunning transactions -that trade against particular pools. You can read more about JUNO, Loop DEX, and JunoSwap -in our [state of JUNO MEV report](https://medium.com/@skip_protocol/skips-state-of-mev-juno-667a51a17b70) +Skipper is a Python-based bot for Cosmos that captures cyclic arbitrage opportunities across all major DEXs on Juno and Terra 2 by backrunning transactions that trade against particular pools. You can read more about JUNO, Loop DEX, and JunoSwap in our [state of JUNO MEV report](https://medium.com/@skip_protocol/skips-state-of-mev-juno-667a51a17b70) # Quick Start @@ -54,26 +48,117 @@ This bot requires: - Python 3.10 -Check your python version by entering: +### **Install Python 3.10** ### +``` +sudo apt update && sudo apt upgrade -y +sudo apt-get install software-properties-common +sudo add-apt-repository ppa:deadsnakes/ppa +sudo apt install python3.10 python3-pip python3-virtualenv python3.10-distutils +``` -```bash -python3 --version +Check your Python 3.10 is functioning: + +``` +python3.10 --version ``` -Once you have python 3.10, install all the dependencies: -```bash +Clone the repository: +``` +git clone https://github.com/skip-mev/skipper.git +``` + +Move into the directory: +``` +cd skipper +``` + +Create a virtual environment +``` +python3.10 -m virtualenv venv +``` + +Activate virtual Environment, (venv) will show on left-hand side of shell +``` +source venv/bin/activate +``` + +Once you have python 3.10 and are in the directory, install all the dependencies: +``` pip install -r requirements.txt ``` -Then, edit the global variables in the main.py file to -your liking. The most important being your mnemonic. -```python +Edit files in envs/ to your liking (specifiying your mnemonic, profit as bid %, choosing node to query from). + +The most important being your mnemonic, creating a new wallet is highly suggested for security, and for this wallet to only be used for this bot, as your mnemonic must be entered. +``` MNEMONIC = "" ``` +Choose the specific .env file you want to target in `main.py` (change based on network run) +``` +# Load environment variables +load_dotenv('envs/juno.env') +#load_dotenv('envs/terra.env') +``` + Lastly, run the bot: ```python -python main.py +python3.10 main.py +``` +To leave the virtual environment use command +``` +deactivate +``` + +# Run bot with docker + +### **Install pre-requisites** ### +``` +sudo apt update -y && apt upgrade -y && apt autoremove -y +sudo apt install docker.io docker-compose -y +``` + +Edit files in envs/ to your liking (specifiying your mnemonic, profit as bid %, choosing node to query from). + +The most important being your mnemonic, creating a new wallet is highly suggested for security, and for this wallet to only be used for this bot, as your mnemonic must be entered. +``` +MNEMONIC = "" +``` + +Choose the specific .env file you want to target in `main.py` (change based on network run) +``` +# Load environment variables +load_dotenv('envs/juno.env') +#load_dotenv('envs/terra.env') +``` + +Build the docker image +``` +docker build -t mevbot . +``` + +Run the docker image +``` +docker run -d --name mevbot mevbot:latest +``` + +Shell into container & check logs (if running on terra, log will be logs/terra.log) +``` +docker exec -it mevbot cat logs/juno.log +``` + +Change env variables after image is built +``` +docker exec -it mevbot /bin/sh +``` +``` +cd envs && nano juno.env -> edit to your liking +``` +``` +exit +``` +``` +docker restart mevbot ``` # How the Bot Works