project screenshot 1
project screenshot 2
project screenshot 3
project screenshot 4
project screenshot 5

Open Finance

Open Finance is democratizing access to stocks by using synthetic assets tradable for anyone on Base.

Open Finance

Created At

ETHGlobal Brussels

Project Description

Open Finance is democratizing access to stocks.

Lots of people don't have access to the stock market because you need a bank account or a broker account where you have to do KYC and they might not be able to do that depending on their country. So we're changing this by being able to buy assets that track the price of those stocks.

To achieve the project we used Pyth, Circle and Base.

The idea is to use synthetic assets for stocks like Amazon (AMZN), Apple (AAPL) and Nike (NKE). Those assets can be easily bought via app using USDC and the new EURC. A simple toggle (for the demo) makes the switch between USDC and EURC. Onchain the synthetic assets are recognized by a ``` s` in front of the symbol e.g. sAMZN.

The swapping is faciliated by the OracleSwap contracts which have a simple swap function (not production ready) by using Pyth prices feeds to make sure the prices and exchange rates are correct, to swap the baseToken e.g. sAMZN with USDC or EURC. As this happening on Base fast execution and cheap gas fees are guaranteed.

The app starts with a simple intro transitioning to the dashboard. The dashboard is the main screen with the user's balance in USDC and EURC. All positions can be seen here including charts (which are fake data, due to timing reasons but could be fetched from Pyth as well). From the dashboard each stock could be picked and a detail view opens. In the detail view we see the pricing info and exchange rate plus a bigger chart. It also offers to ability to buy and sell.

In reality, many more things would have to be taken into account e.g. that exchanges are closed on the weekend or using smart accounts approval transactions could be bundled in a batch with the swap transactions - improving the ux for the user. So this app should be seen as a proof of concept.

Unfortunately, there was a problem with the video demo's audio, so it couldn't be uploaded. Please check out screenshots in the README: https://github.com/janndriessen/openfinance/tree/main?tab=readme-ov-file#screenshots.

How it's Made

For the smart contracts solidity and foundry was used. The synthetic assets are just normal ERC20 mocks which is sufficient enough for the demo. The SwapOracles for USDC and EURC are based on on an example from Pyth. The contracts determine the swap price by using Pyth's oracles.

To make it more easy for the hack the backend manages the interactions with the blockchain by exposing an API. Those endpoints are retrieved/used by the iOS app. The backend is written in TypeScript and Next.js. I would have hosted on vercel but the latest Next.js version seems to have a bug with caching routes/endpoints. So all testing had to be done using localhost.

The native iOS app is written in Swift and SwiftUI. Additionally, I used my small Swift helper library for web3: Based Utils (https://github.com/basedxyz/based-utils).

background image mobile

Join the mailing list

Get the latest news and updates