Inspiration

Personally we are big fans of index funds, ETFs and passive trading in general. We believe that for the average person like us, it is almost impossible to outperform the financial markets. Betting on the markets averages is our financial approach. Besides that, the associated trading fees are very low and fund investors don't have a lot of work managing their portfolios.

Going DeFi

Using index funds in a DeFi environment brings a couple of benefits with it.

  • Possibility to turn fund into a tradable token
  • Participants can passively invest but also actively decide about the portfolio strategy e.g. through a DAO
  • Brings more stability to crypto invests through diversification ("To-the-moon swings are fun, but that is not a retirement strategy")

We feel like the Solana blockchain together with Pyth pricing, Serum as a DEX and Wormwhole, giving access to all possible Crypto assets, is a great home for DeFi index funds.

What it does

Anyone can create her/his own index based on 30 different assets provided by the Pyth network. The selection of the assets as well as the name of the created index will be stored on the Solana blockchain. The index is calculated by averaging the prices of the assets over time. Updated price information are received every 30 seconds through the Pyth network. The results are shown in a plot using the dynamically calculated data.

How we built it

First we started with pen and paper to get the basic functionality defined. Then we used the amazing Anchor framework to create the base of our little project. We started with the backend in Rust trying to get a connection going with the Pyth network. After a week of glass chewing we tossed the idea to interact with Pyth on the backend. We decided to do it through the frontend client which turned out to be the right move. So we stripped down our backend part, deployed it to the Solana devnet and focused on the React part. Finally we picked up some pace here and made it happen to deliver something before the hackathon deadline.

Challenges we ran into

We don't know where to start ... there were sooo many. We'll try to focus on the really big ones only:

  • We heard of Solana for the first time in 11/2021 :D -- The account concept of Solana gave us the biggest headache (thinking of an account just as a piece of memory with some extra stuff untied the knot in our brains though) -- Lack of beginner friendly documentation when it comes to Solana
  • No prior knowledge of Solidity
  • Background in embedded systems (C/C++) -- Almost no web developer knowledge
  • Pyth account structure and where/how to interact with the Pyth network

Accomplishments that we're proud of

  • Having a working on-chain program on the Solana devnet
  • Not tooo bad looking react part (keeping in mind that we are no web developers)
  • Making use of real market data provided by Pyth

What we learned

  • One cannot pass an array or vector of AccountInfo items through the RPC interface (at least we haven't figured it out)
  • Working on Solana can be painful but very rewarding
  • React is very cool
  • Anchor is just great. Wouldn't have accomplished anything without it.

What's next for Create your own index fund using Pyth products and prices

  • Fund the index account
  • Configure different average calculations like weighted average e.g.
  • Connect created funds with Serum to perform the buy/sell operations
  • Implement the trading bot
  • Make it possible for others to participate in the fund
  • Create a DAO

Built With

+ 1 more
Share this project:

Updates