Skip to content
πŸ’ Interest Swaps with a Cherry on Top πŸ’
Vue JavaScript Shell Other
Branch: master
Clone or download
Latest commit 0957700 Nov 10, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci modify circleci config Nov 10, 2019
additionalResources add front-end package Oct 24, 2019
packages modify circleci config Nov 10, 2019
.gitignore update gitignore Nov 1, 2019
.travis.yml update tarvis config Nov 4, 2019
LICENSE Initial commit Aug 23, 2019 add markdown Nov 4, 2019
lerna.json lerna config Oct 23, 2019
package.json modify circleci config Nov 10, 2019
yarn.lock commit Nov 1, 2019

Cherryswap-monorepo Build Status

Cherry Swap is an autonomous, open-source platform for interest rate swaps on Compound Finance markets.

This monorepo contains the following packages:




Smart Contracts:

How it works

Every market on Compound has an interest rate, which fluctuates according to supply and demand of credit and debt within that market. With Cherry Swap, users can hedge against these fluctuations - or speculate on them - by participating in pooled interest rate swaps.

With Cherry Swap, users predict interest rate trends and then commit funds into a fixed-term 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 to be 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.

Our Team

  • πŸ‡ΏπŸ‡¦ Chris Maree - Integrations
  • πŸ‡©πŸ‡ͺ Sabine Bertram - Vyper contracts
  • πŸ‡ΉπŸ‡³ Haythem Sellami - Solidity contracts
  • πŸ‡¬πŸ‡§ Chris Fulford - Front-end development
  • πŸ‡³πŸ‡Ώ Liesl Eichholz - Design, UX/UI

Technical Description

Individuals are able to jointly swap a fixed interest rate (in our case the observed interest rate per block on cDAI at time point t_1) with the floating interest per block of cDAI between t_1 and t_2. Individual payouts at time t_2 are dependent on the following ratios for long (swap fixed for float) and short (swap float for fixed) positions:

Due to the pooling, we circumvent the market matching of individuals wanting to swap, however, the ratio of long and short positions increases the swap risk.

Smart Contracts

Our code base consists of two main contract files: Cherryswap.sol and SwapMath.vy.

The Cherryswap.sol contract handles the different swap periods, which are fixed. A swap period consists of a collection phase t1 - t0 and an active period t2 - t1. During the collection phase, participants are allowed to transfer DAI into either the long pool or the short pool. At t1,the start of the active period, the combined funds in the long and the short pool, P_t1, are converted into cDAI, where they are locked until t2. At that time, P_t2 is split among the participants relative to their position and whether they were invested into the long or the short pool, and transferred back to them.

The SwapMath.vy contract serves as a library for the CherrySwap.sol contract and computes the payout ratios for long and short positions that are used to compute the payouts within the Cherryswap.sol contract.

Development Setup

Node.js LTS or greater required.

# Bootstrap project dependencies:
$ yarn install

# Compile @smart-contracts 
$ yarn run contracts:compile

# Compile @swap-math
$ yarn run swapmath:compile

# Build @front-end
$ yarn run frontend:build

# Run solidity contracts tests
$ yarn run contracts:test

# Run swap math contracts tests
# To run the python test, see packages/swap-math/
$ yarn run swapmath:test

# Run coverage
$ yarn run packageName:coverage

# current package name aliases: {frontend, contracts, swapmath}


Deploy the SwapMath contract:

yarn run swapmath:deploy

Copy the deployed address to the @smart-contract deployment config file


If you are deploying on testnet or mainnet, make sure to config the ERC20 token and the ctoken addresses.

Deploy the solidity contracts:

yarn run contracts:deploy

Front end:

! Needs to know the contract addresses

yarn run frontend:serve

Additional Resources

You can’t perform that action at this time.