PermanentLoss.finance

PermanentLoss allows liquidity providers of ETH/Stable pairs to hedge against impermanent loss by utilizing options. The tool will help the user visually construct options strategies like strangles and straddles.

Demo Video Live Demo Source Code

Prizes

Opyn: Best Hack using Opyn v2

Technologies

Ethereum

Solidity

The Graph API

Opyn

Chainlink

USDC

Description

PermanentLoss.finance is a platform where liquidity providers can use options to hedge against impermanent (divergence) loss. With the intent of making creating strategies like straddles and strangles as easy as possible, we provide users with an interactive graph that shows all the currently available PUT and CALL options and how much cover they will give LPs if they were to buy them. After choosing his desired combination of options, the user is presented with data about the protection the chosen options will give him. This data is related to the amount of ETH selected for protection and a given Uniswap APY over the period between options purchase and the earliest expiry. Once the user is satisfied with his selection, he can then buy the options through Uniswap.

How It's Made

We bootstrapped the interface with create-eth-app (https://github.com/PaulRBerg/create-eth-app) to get us a solid foundation to build from, and then started figuring out how to plot lines with PlotlyJs. Then we worked to graph out impermanent loss (IP) and have it match with Uniswap docs (https://uniswap.org/docs/v2/advanced-topics/understanding-returns/) with static points. With that in place, we could start to layer on the options -- first, we needed to fetch all options using their subgraph and filter for ones that haven’t expired yet. From there we needed a way to get fresh price data -- Uniswap was the clear option but we needed to figure out how. The flow was: option address from subgraph -> read Opyn.getExchange(address) from contract to get Uniswap -> Uniswap.getEthToTokenInputPrice() -> convert units (depending on whether option is a put (priced in ETH) or call (priced in stable-coin). Now we had open options and their prices to plot on the graph once we converted the scale to match with IP and do relevant APY calculations when the user selected an option. Finally, we needed to provide the user a way to purchase the options so we had to reverse engineer the correct Uniswap URL structure for the correct pair and volume.

Team

Jacob Mortensen Andre Korol
← click here to see all projects