We're seasoned engineers with web2 tech backgrounds who've been diving into crypto together. Building a liquidation bot seemed like a great way to educate ourselves on DeFi and Solana while leveraging our experience building scalable systems, and contributing to the robustness of the Solend protocol. We also chose the project because Solana's speed means there's no MEV, so designing the bot for liquidation speed was the primary factor.
What it does
The bot continuously monitors thousands of obligations on the Solend platform in parallel, and validates their health based on realtime price movements streamed from Pyth. If an obligation's borrow utilization threshold is hit, it repays the loan
How we built it
- Poseidon is written in Golang, a language that lends itself very well to performance and parallelisation. The app runs as an elastic container that can be vertically scaled up. A watcher loads Solend data and dispatches jobs to a worker pool responsible for checking the health of obligations. These workers reference price stores that we keep in sync with the price oracle Pyth via websockets.
- Developing for Solana in Go was a little tough as libraries are nascent and not well documented
- We didn't have a good way to simulate oracle price changes and test our work
- We couldn't run our own version of Solend to test out our bot offline, so we had to learn as we went
What we learned
- We learned a ton about interfacing with Solana - credit goes to its great documentation.
- We taught ourselves about the mechanics of lending platforms on DeFi by building a key component of the lending system.
- Developing against devnet was super help - kudos to Solend for their support.
- We internalized a major crypto technology paradigm: designing systems to incentivize other actors to perform work that benefits the greater health and efficiency.
What's next for Poseidon
- Further optimizing the bot to win a larger percentage of liquidations on the platform
- Open-sourcing parts of the codebase to the ecosystem, such as Golang clients for the Solend API and Pyth
- Implement automatic wallet rebalancing so that the bot can run independently without needing to to refund depleted currencies.
- Implement "flash loans" so that we can liquidate larger positions without requiring upfront capital
Log in or sign up for Devpost to join the conversation.