Website Landing Page
How It Works
Phase 1: Commit
Phase 2: Lock
Phase 3: Payout (Modal)
From the beginning, we knew wanted to build something on top of the existing DeFi stack, because who doesn't love DeFi? As users of tools like DAI and Compound, we quickly arrived at the topic of interest rates. In crypto markets, interest rates are much more volatile than traditional financial markets, which makes for great derivative products.
Interest rates on Compound are constantly fluctuating as different market events precipitate massive changes in supply and demand. For users who think they can predict these changes, participating in interest rate swaps is a juicy proposition.
We also drew inspiration from prediction markets - we thought: what if you could combine interest rate swaps with crowd-based predictions via pooled positions on Compound market interest rates? And so, Cherry Swap was born.
What it does
Cherry Swap is an autonomous, open-source platform for interest rate swaps on Compound markets. We offer a crypto-flavoured version of traditional vanilla swaps, which are usually done to hedge exposure to floating interest rates.
With Cherry Swap, we have created a new type of derivative based on pooling these interest rate swaps, allowing users to hedge against - or speculate on - interest rate fluctuations. On the platform, users can predict interest rate trends and then commit funds into a fixed-term pooled deposit into a Compound market, taking a position on future interest rates. Long positions gamble on the interest rate increasing, while short positions anticipate a decrease.
Any interest accrued while funds are locked up in Compound is pooled and returned to participants at the end of the lock-up. Participants who predicted the correct trend in interest rates will earn more than they would have if they had invested directly into the Compound market, subsidised by those who predicted against the correct trend.
How we built it
We built on Ethereum, leveraging the functionality of Maker’s DAI and Compound’s cDAI. Using Vyper, we implemented a contract that acts as a library to compute the payout for our novel DeFi product. The business logic is stored in a Solidity smart contract.
The front-end was built using the Vue.js framework. To enhance the the user experience, we used web3.js to enable interactions with any web3 wallet.
Challenges we ran into
Our main struggle was the library that computes the payout for each individual that invested in the pool. First, Solidity doesn’t support decimals, and one cannot compute a decimal to the power of an integer in Vyper. One solve was to scale it to a uint, but then we run out of space fast because the power is the number of blocks mined within a swap period, which become large quite fast. The formula that we used to scale to a uint is functional, but still needs to be refined to work for longer swap periods.
Accomplishments that we're proud of
- We derived a novel DeFi formula to compute payouts.
- We were able to integrate Vyper and Solidity smart contracts.
- We have an awesome animated front-end!
What we learned
- Coding in Vyper
- Scaling uints up and down
- Integrating Vyper and Solidity Smart Contracts
- New tooling in Figma
What's next for Cherry Swap
We're keen to build this product out properly, get it audited, and launch it on mainnet as a fun and potentially quite profitable tool for the community and an addition to the ever-growing DeFi stack.