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

Flow Theory

Bringing Real Cashflow to On-Chain Lending with Real-Time Interest Payments

Flow Theory

Created At

ETHOnline 2022

Winner of

trophy

🏆 ETHOnline Finalist

trophy

📈 The Graph — 🥇 Best use of Existing Subgraph

Project Description

Flow Theory is revolutionizing fixed-rate credit by bringing real cashflow to on-chain lending with real-time interest payments. Right now when you borrow on Aave, Compound, etc, interest starts formulaically accruing on your debt, but lenders don’t get timely compensation for the risk they’re taking on by lending to you AND they don’t get timely compensation for the risk they’re taking on by lending to you.

This results in: Higher interest rates for borrowers and lower rates for lenders on these protocols

Yet, it’s very real in TradFi where We pay down our loans in instalments and lenders realize cash flow continuously.

Our "Flow Theory" is that the continuous repayment of on-chain debt will incentivize better terms of credit and improve the experience of on-chain credit markets.

The Flow Theory Offering is about fixed-interest borrowing and lending where:

  • Interest must be paid in a continuous Superfluid money stream 🌊
  • Lenders don’t have to claim interest - it shows up directly in their wallets ✨

Because Flow Theory routes interest payments straight to the wallets of lenders, none of The Flow Theory’s TVL is from accrued interest (🔥)

We used:

  • Superfluid for money streaming and distribution
  • Polygon and Optimism for L2 deployment and scaling
  • The Graph to query for superfluid streams and IDA indices. This allows us to show real-time streams of money to the user

Let’s bring real and direct cashflow to Web3 lending. Let’s bring real and direct cashflow to Web3 credit.

How it's Made

Backend:

Our backend was entirely smart contracts powered by the Superfluid real-time finance framework. This made extensive use of both the CFAv1 and IDAv1 libraries. These were written in Solidity and developed/deployed/verified/tested using Hardhat with help from Superfluid's Javascript SDK-Core.

We deployed our protocol to Optimistic Goerli, Polygon Mumbai, and Ethereum Goerli testnets and aimed to use Tellor as our collateral/debt token pricing oracle, however fell short of time on the integration.

We interestingly used a dual-contract model where one contract handles the dispersion of interest payments and another contract manages the basic borrow/lend functionality. This was in response to the accounting challenge presented by inbound by-the-second Superfluid money streams.

Frontend:

we used React and Next.js to develop a SPA that has been deployed to Vercel. RainbowKit was used to allow the user to connect their wallet in a simple way. For interacting with the smart contracts, we used wagmi React hooks as well as ethers utils for formatting data appropriately.

When retrieving the state of the streams, we queried Superfluid directly using GraphQL pointed at the Superfluid Graph. The superfluid SDK was also used for approving streaming of super tokens as well as allowing the lender to subscribe to the instant deposit agreement.

The site uses modals which have all been made accessible using ReachUI. Finally, styles and components were built from scratch using TailwindCSS

background image mobile

Join the mailing list

Get the latest news and updates