Siren and The Graph bring a better user experience to DeFi

Siren
6 min readApr 15, 2022

--

Illustration by Christine Foltzer

Siren is a DeFi options protocol that currently generates high, sustainable APYs for Liquidity Providers by selling options to market makers in a DeFi Options Vault. Siren uses The Graph’s hosted service to power its user interface, including data visualizations that allow users to understand how they make money using Siren.

The goal of Siren is to elevate the user experience of using a decentralized product to the standards that users expect from Web2. Traction and a significant user base will only come to the blockchain ecosystem when using a DeFi product is as simple as using Robinhood or another centralized Web2 finance platform.

The Graph is critical to creating a fluid user experience for a DeFi product. Accustomed to Web2 UX, users expect fast loading times, charts of historical data, and clear, personalized summary data. Siren relies extensively on The Graph’s hosted service in order to make the historical APYs of Siren’s vaults clear to Liquidity Providers. Data from The Graph also helps traders visualize the profits in their Siren portfolio. Integrating The Graph’s hosted service also reduces Siren loading times and helps contributors do exploratory data analysis.

In this post we’ll go into the specific ways that Siren is using The Graph to make a great user experience. As adoption in the DeFi space grows, the Siren protocol will be able to support many more flavors of products than simple DOVs, including project treasury reinvestment, structured products, and user-created pools. The Graph will continue to be instrumental in making sure Siren provides the highest-quality UX as we create the new frontier of DeFi.

Earning APY with Siren

Siren’s Earnings page displays in-depth data on each yield-generating vault, such as ETH Covered Calls. Using queries to subgraphs (open APIs) on The Graph, each pool displays a historical performance chart which tracks the change in returns generated by the pool over time.

Every time someone makes a trade, deposit, or withdrawal, Siren records a snapshot of the total pool value using subgraphs. This historical record of the value of the pool lets us create this sweet informational chart that helps users understand how their APY is generated over time.

Subgraphs retrieve historical information from Ethereum and store that information in a form that Siren can query in a simple way to fetch user information. Without utilizing subgraphs, Siren would need to constantly scan and index the blockchain and store all of that information in a centralized location, increasing the infrastructure necessary to run Siren and reducing the decentralization of the project. Storing and fetching the data would also require complicated querying logic. Subgraphs allow apps to easily organize data in almost real time in a format that is easy and fast to query later without additional off-chain infrastructure overhead.

Trading Call and Put Options using Siren

At any given time, Siren has many strikes and expiration dates available for options that traders can buy. Each of those options series has its own date, strike, and premium price, which we currently retrieve using The Graph’s hosted service with a single request.

Sourcing this data on-chain without The Graph would require multiple calls, slowing loading times to an unusable crawl.

Portfolio screen

On the Portfolio screen, traders can view their open positions and their Profit and Loss (PnL). We also use The Graph to source this data. Calculating a position’s PnL requires the history of all user’s trades in that options series. Subgraph query filters allow us to do this easily, filtering all trades by user account and option series ID. Users are able to see all positions in realtime from one screen.

Apollo Client makes Page Loading Fast

Subgraphs are queried using GraphQL, which means we can use the extensive GraphQL ecosystem of open source libraries. One of them is Apollo Client, which is a comprehensive state-management library that lets the user interface automatically cache information to improve the loading speed, as well as simplify state management across the app.

Using Apollo Client also improves Siren performance by adding a layer of client-side caching in addition to the preprocessing that happens in subgraph mappings.

Manual querying

Another useful aspect of GraphQL is that it is quite easy to get data manually, unlike more traditional REST APIs which are best suited for programmatic access. Using a GraphQL explorer like GraphiQL or the web UI on The Graph, anyone can easily construct complex queries to retrieve and analyze data from Siren.

Siren’s contributors often use The Graph to manually get data on the option pools, series, user activity, and much more. These tools come in handy when contributors are exploring the effectiveness of various strategies and doing back-testing when creating new products. As Siren grows and expands into new product lines, we expect contributors to lean on The Graph heavily to create reports and analyze the potential profitability of new cool products.

Conclusion

Siren relies on The Graph’s hosted service to provide a streamlined, visual user experience for its yield-generating options pools and trading interface. Subgraphs are critical to helping users understand how they make money using Siren.

A full-featured financial product, with clear returns, prices, user-specific portfolios, and exploratory data requires a robust indexing tool like The Graph. Siren uses a smart-contract based architecture for anti-censorship, resilience, and an autonomous, user-controlled protocol, and its front end is built for the best user experience possible while still upholding those values.

Siren is using The Graph technology to push the boundaries of decentralized finance, with the goal of liberating everyone from centralized finance and bringing autonomous, user-driven finance to all.

About Siren

Siren is elevating the experience of sourcing sustainable yield and building smart portfolios by bringing battle-tested financial primitives to the world of DeFi.

Liquidity providers can rest easy knowing that they are earning yield on a financial product with sustainable demand. Meanwhile, traders can dive deep into market upside while minimizing risk by buying options on crypto with unprecedented ease, control, and protection from liquidation.

Start earning and trading by visiting Siren.xyz

Join our community on Discord

Follow us on Twitter

About The Graph

The Graph is the indexing and query layer of web3. Developers build and publish open APIs, called subgraphs, that applications can query using GraphQL. The Graph currently supports indexing data from 32 different networks including Ethereum, NEAR, Arbitrum, Optimism, Polygon, Avalanche, Celo, Fantom, Moonbeam, IPFS, and PoA with more networks coming soon. To date, over 38,000+ subgraphs have been deployed on the hosted service and now subgraphs can be deployed directly on the network. Over 28,000 developers have built subgraphs for applications such as Uniswap, Synthetix, KnownOrigin, Art Blocks, Gnosis, Balancer, Livepeer, DAOstack, Audius, Decentraland, and many others.

If you are a developer building an application or web3 application, you can use subgraphs for indexing and querying data from blockchains. The Graph allows applications to efficiently and performantly present data in a UI and allows other developers to use your subgraph too! You can deploy a subgraph to the network using the newly launched Subgraph Studio or query existing subgraphs that are in the Graph Explorer. The Graph would love to welcome you to be Indexers, Curators and/or Delegators on The Graph’s mainnet. Join The Graph community by introducing yourself in The Graph Discord for technical discussions, join The Graph’s Telegram chat, and follow The Graph on Twitter, LinkedIn, Instagram, Facebook, Reddit, and Medium! The Graph’s developers and members of the community are always eager to chat with you, and The Graph ecosystem has a growing community of developers who support each other.

--

--

Siren
Siren

Written by Siren

A distributed protocol for creating, trading, and redeeming fully-collateralized options contracts for any ERC-20 token on Ethereum.

No responses yet