This is a submission for the Build Better on Stellar: Smart Contract Challenge : Build a dApp
What I Built
I built something called Stacker. Its a collection of vaults that allow allow someone to deposit yield-bearing assets. The yield is periodically claimed and reinvested to receive more of the yield-bearing asset.
The vault takes a fee for its service.
Currently there is one vault. It allows you to deposit Aquarius AQUA/USDC LP shares. Some Aquarius pools are receive aqua rewards. Everyday, A bot (or a person 🤔) claims the rewards, sells them and deposits back into the lp.
Demo
The app is live on mainnet and can be found here: https://stacker.rahimklaber.me/.
My Code
The code can be found here: https://github.com/rahimklaber/stacker. Some more implentation details can be found there.
The repo contains a frontend and the contract. The frontend is written in Kotlin and uses https://github.com/rahimklaber/stellar_kt to interact with Stellar.
Journey
I came up with the idea last week while claiming my blend rewards. I always forget to claim them and thought it would be cool if it was automagic.
Initially, i spent quite a bit of time understanding how vaults work. After that, the hard part of integrating with aquarius and understanding how the lp pools work.
I'm quite happy that I was able to use my own Stellar SDK for this and that it worked correctly 😁.
What I learned
Cross contracts calls involving token transfers (or any kind of deep auth) is extremely annoying. You have to explicityly authorize the deep contract call. On one hand, this is nice because it limits the risk of exploits. On the other hand, it is very annoying while programming.
I now kinda know how vaults work and about some attacks against them. Hopefully, the safeguards I coded are good enough 😅.
Top comments (0)