Inspiration

Mars and I both wrestled with the obstructions of traditional finance in our day jobs. At his startup, Mars created an accounting system that now powers $100M in GMV but runs on slow ACH rails. At Robinhood, I helped synchronize siloed ledgers with millions of transactions. Our frustrations with traditional finance led us to Solana. When we were poking around in lending protocols, we discovered that there were massive differences in their APY offerings.

What it does

Radar is a website that gives lenders the data to make better investment decisions. Autopilot is a smart contract that will make the best investment decisions for lenders on Solana. And Jet Stream is a cross-chain mutual fund that will give Solana users access to the whole world of DeFi. So far, we've created Radar and have written the foundational code for Autopilot. In the video, we explain how these products benefit Serum, Wormhole, and Terra.

How we built it

Radar - We built Radar with Node.js and React. The backend is hosted on Render and the frontend on Vercel. Our cron job runs on Redis and captures snapshots of APY data every 5 minutes, which are stored in our Postgres DB. We then compute the average APY for each hour and serve this data to our web app via GraphQL.

Autopilot - We wrote a smart contract that has instructions to initialize a vault, deposit, and withdraw. It mints a new token that represents a depositor’s ownership in the vault. We wrote 48 tests to make this program indestructible and used anchor as a competitive advantage to increase our development speed. (Huge shoutout to cqfd (alan) from anchor for answering our many questions!)

Challenges we ran into

We wanted to make Radar highly reliable and extensible.

Reliable. We can never go back in time and recover missed data, since nobody is publicly tracking historical APYs except us. We could have just used web scrapers to capture APY data, but we wanted to optimize for reliability. We ingest data directly from accounts on the blockchain or via a protocol’s API that reads data on-chain (expect Solend). For Tulip, we spent several hours asking questions in their Discord to translating their interest rate calculations into code that used on-chain reserves.

Extensible. Long term, we see Radar becoming an aggregator for dozens of protocols and hundreds of assets. On the backend, we used the factory pattern to abstract away all protocol-specific logic and to standardize return types. Each of our lending protocol integrations is a class that inherits from a common interface. For example, Francium and Solend are separate classes with different lending reserve types and different interest rate curves. Using the factory pattern will allow us to rapidly integrate more lending protocols in the future.

Accomplishments that we're proud of

In the first week of launching Radar, 200 people joined our Discord and over 500 unique visitors navigated to our website. This all happened before we spent our first dollar on marketing. It's been awesome getting to know our users, who have joined us from all around the world (Ukraine, Philippines, etc).

Mars and I built this entire product ourselves, except the logo and font. We did the website design, frontend, backend, infrastructure, marketing, partnerships, community engagement, etc. We are thankful for the advice we received from our mentors and the Solana community.

What we learned

  • How to write a robust smart contract with anchor
  • How spl-lending works (e.g. reserves, obligations, liquidations)
  • How to calculate APYs
  • How to serialize/deserialize data from the Solana blockchain (e.g. reserves → JSON objects)
  • How to build a discord community (still a work in progress, but 220 discord users strong 💪)

What's next for Accrue Finance

We're spending around 20% of our time building out new features on Radar, and 80% of our time writing the smart contract code for Autopilot. Then, we'll integrate Wormhole to provide cross-chain opportunities to our users.

+ 14 more
Share this project:

Updates