About 1 year ago I became interested in ethereum and started building an options platform, Feldmex options, (which remains in stealth) and realised the power of off chain price data on chain. About one month ago I saw an ad on etherscan.io for this hackathon and started thinking about types of derivatives I could build using Chainlink. I soon realised that there are no volatility/variance swaps built on ethereum so that was what I chose to work on.
What it does
Feldmex is the first ever on-chain pure volatility product (meaning it has no delta exposure). Feldmex allows users to mint, burn, buy and sell long and short variance(variance is equal to volatility squared) tokens, to get exposure to variance products directly from their ethereum wallets. At the same time Feldmex has a fee/reward structure that rewards early liquidity providers of variance tokens.
How I built it
I created an oracle that interacts with Chainlink aggregators to find the price of an given asset pair at a given point in time. I then read the daily prices into the variance handler contract(handles minting, burning, and payout of variance tokens) where they are used to calculate the payout of the variance tokens. There is a cap for payout of long variance tokens, short variance tokens payout the cap minus the payout of the long variance token, and users can mint an equal number of long and short variance tokens by depositing an amount of collateral equal to the maximum payout multiplied by the number of swaps they wish to mint. I also built a staking program through which users may stake Uniswap liquidity tokens from pools of either long/short variance token and the payout asset. Liquidity token stakers are rewarded with the fees generated by the platform based on the amount of time staked squared. Thus incentivizing staking early and staking longer.
It should be noted that in the github repository the master branch includes a dummy oracle that makes testing easier. The branch kovan contains the oracle that interacts with Chainlink aggregator contracts and consists of the contracts that were deployed on the kovan test network.
Challenges I ran into
I had to spend quite a bit of time wrapping my head around how a variance swap works. The first time I deployed my contracts, though I had written tests, my understanding of how to calculated variance was wrong. When I read the term log returns I thought of the natural log of today's price divided by yesterday's price and didn't understand that it was a reference to percentage returns. I quickly went back, fixed all my errors and redeployed my contracts. Also building a simple front end took up more time than I had expected.
Accomplishments that I'm proud of
I am most proud of the fact that, as far as know, I have built the first ever on-chain pure volatility product. Also I am proud of the fact that I participated in this hackathon while my senior year of high school was starting. When I started high school I had never written a line of code but I proved to be a quick learner and it is a great feeling to build something of value from your keyboard.
What I learned
Before this hackathon I had thought of using Chainlink price feeds but never really got around to doing a deep dive because I was busy iterating the core functionality of my options platform. This hackathon helped me to better understand how Chainlink works and I have a new-found appreciation for how amazing the service they provide is.
What's next for Feldmex Variance Swaps
Next I would like to get an audit for my variance swap product and deploy it on mainnet. I also will likely expand Feldmex to support other types of swaps. Once I have some funds I would like to have the options platform that I built audited and deploy it on layer 2, most likely the ovm.
Log in or sign up for Devpost to join the conversation.