Skip to content

manugildev/solend-apy-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


Logo

Solend APY Twitter Bot

Solana Ignition Hackathon 2021

View Demo · Report Bug · Request Feature


Table of Contents


About The Project

@SolendAPY_bot is an autonomous Twitter bot that posts analytics of the APYs available in the Solend Protocol. Since a picture is worth a thousand words, instead of posting the APYs as a text we built an image generator to make the data more appealing for the followers. On Sundays, a weekly chart is automatically sent to better show the trend of the data for each token. Discord and Telegram bots can automatically mirror tweets right into a channel, making data accessible for users on other platforms.

The idea came from a tweet where the Solend creators proposed valuable projects for the community.

screenshot

Go to @SolendAPY_bot to see the bot in action

Motivation

  • Give Solend users updated and transparent APY information on their Twitter feed, so that they can make decisions on how to efficiently lend and borrow their tokens
  • Build the foundation of an analytics website for Solend to show the trends on APYs and other stats. Solend does not currently provide any official solution for this.
  • Contribute to Solend's growth
  • Learn new technologies by building a project
apy_table apy_table

Example images generated by the bot

Challenges

Generating images programatically can be quite challenging, most of the tools and libraries available are not very flexible and definitely not as responsive as the web can be. That's why we decided to go the extra mile, create a frontend, launch a server locally and take screenshots of the tables and charts using headless chrome. This choice increased the dependencies the bot relies on, hence the needed of dockerizing it to make it robust and portable.

Architecture

The bot lives inside a docker image for portability and simplicity reasons. The container has all the required dependencies for the ./solend-apy-bot rust binary to run successfully, such as the static files for the frontend or headless chrome to take the screenshots. Once execution has finished, all the artifacts generated by the bot are thrown away. In order to save the data points needed to generate the weekly summary chart, a mongodb database is hosted outside of the docker container.

diagram

Future work

  • Retrieve other useful information such as TVL, total borrow and supply quantities, etc.
  • Eventually evolve into an interactive analytics website for Solend
  • Keep adding new tokens as soon as they are listed on solend.fi
  • Clean the code and make it bulletproof since some errors are currently not being handled

Feel free to submit any feature request you would like to see implemented


Installation

To get a local copy up and running follow these simple steps.

Prerequisites

Building

  1. Clone the repo
    git clone https://github.com/manugildev/solend-apy-bot.git
  2. Build docker image
    docker build -t solend-apy-bot:1.0 .

Usage

Once the docker image has been built, run it with the .env file.

docker run -it --env-file=.env solend-apy-bot:1.0 <args>

Possible arguments that you can pass when running the docker image:

FLAGS:
    -h, --help                Prints help information
    -s, --screenshot          Takes screenshot and saves it locally
    -c, --chart               Generates a chart and saves it locally
    -t, --twitter             Posts screenshot to Twitter
    --server                  Launches a local server for debugging purposes

OPTIONS:
    -d, --data <data_type>    Saves data in database [default: MINUTE]
                              [possible values: MINUTE, HOUR, DAY, WEEK]

You can checkout how we are running the bot in our server using cron jobs

License

Distributed under the MIT License. See LICENSE for more information.

Acknowledgements


Made with 💜 by HyperManu