There are a ton of really amazing decentralized loan platforms on Ethereum, but the volatility of the interest rates deter many borrowers. We wanted to create a system where risk averse users could still make use of these loans and the risk could move to those who are more interested in the upside.

What it does

The smart contract system is comprised of 3 contracts. There is a matching market which matches potential loans to the users who are looking for a fixed loan, a loan token contract which allows for a loan to be backed by multiple counter-parties (so that whales can still take out fixed loans), and the collateralized debt position contract which handles interaction with When users are matched, a token contract is created and lenders are given their share of the collateral in an ERC20 token. After the term of the loan has ended, the loan is payed back, the fixed rate fee is paid to the lenders from the borrowers collateralized debt, and then the rest of the stake holders are paid out based on how much debt was due at the time of the loan closing.

How we built it

The core fo the protocol is all smart contracts. It took a large amount of iterating and debugging since we were working with some external interfaces. Alongside those smart contracts, we built a react.js based UI. This ui allows for users to interact with the protocol with just a wallet provider.

Challenges we ran into

We originally wanted to support multiple lending protocols (MakerDao and DyDx), but due to time restrictions we were forced to limit ourselves to just one protocol. We also had to spend a large amount of time working with the logic of how rate swaps work and what was the best way to implement them on chain. We dabbled with around 5 implementations, but landed on our final one as the most feasible while also being robust.

Accomplishments that we're proud of

Honestly, this was really really hard. We didn't think we were going to be able to finish it. We are proud we got it to work in general. To be more specific, this is a need that has been pretty publicly recognized in DeFi, but we have not seen many people combat it. A big part of this is most likely the challenges that we faced this weekend. Building an on chain order book, percentage based claims to an unknown sum of both ETH and DAI and a system with think is actually thought out enough that people would want to use it are 3 of the things we are most proud of.

What we learned

We learned a ton about of rate swaps work. We had to read a lot about how they work in the real world and how they could potentially be implemented on chain before we really knew how to attack this. We also learned a lot more about Compound, as none of us had experience developing with it in the past.

What's next for RateSwap

We would love to build out the system to be more robust and to support all of the major lending protocols. The majority of the code was written to be very contract agnostic so with some more time we could realistically see this work for MakerDao, DyDx, Fulcrum and any other new lending protocols that pop up.

Built With

Share this project: