Inspiration

The idea came from the RFP named 'Interest rate swaps'.

Within cosmos, there have been recent addtions of single asset yield generating protocols such as Liquid staking using Stride, Quicksilver and StakeEasy, lending/borrowing using Mars and Umee, which created a strong need to have a generalised protocol to convert the variable yield from these to fixed yield. Fixed yield has real utility to the end user as it makes passive yield from crypto assets more predictable and controlled.

There is higher yield from liquid staking within cosmos that DeFi protocols can produce (such is not seen in Ethereum ecosystem). This makes the fixed yield not just useful for end user but also to these DeFi protocols in providing better yield for their liquidity providers.

What it does

FixedFi is a DeFi protocol built using CosmWasm contracts that lets anyone access to fixed yield on their assets.

Split a yield bearing asset into principle token (pToken) and yield token (yToken) and yToken can be sold at a fixed price to fix the future yield and to get it now.

Users can even buy the pToken at discount w.r.t. undelying asset to get fixed yield without holding a yield bearing asset or having exposure to the yield or source of yield (the protocol).

How we built it

I started off with understanding for the different approaches to fixed yield protocols such as fyToken using CDP from Yield finance, pToken/yToken split with expiry from Pendle finance, pToken/yToken split without expiry from Prism finance and pToken/yToken split with concentrated liquidity from Voltz protocol.

In my findings, I found that the pTokn/yTokn split with expiry from Pendle is the most successful and capital efficient. I further read about the potential balancer like AMM with time decay for 3 tokens pair mentioned in the RFP here. I further dig deeper into the Pendle approach to their AMM and found that there is substential amount of IL present as the ratio of tokens changes quite a lot till expiry.

I came up with the optimization in the AMM pair where the two tokens are ybToken/pToken stable pair where ybToken is increasing in value with the slope of variable yield and pToken is increasing in value with a fixed slope represnting fixed yield. Since the fixed yield is an expected average of variable yield, both tokens appretiate in value at roughly same pace over a period of time. The only change required in stable swap is the price ratio won't be 1:1 but somehwere near to 1.02:0.98 or higher depening upon the yield amount, but this ratio remains roughly same till expiry.

I started the implementation with OSMO token deposit to mars protocol issuing ybOSMOmars as yield bearing token. Then I implemented the splitter which splits the ybOSMOmars into yOSMOmars and pOSMOmars, pOSMOmars after 6 months can be redeemed for ybOSMOmars and yOSMOmars holder can claim the OMSO lending yield from mars over time while just holding it.

Challenges we ran into

Understanding different approaches to fixed yield initially caused some confusion as they go mixed together.

Getting the mars contract queried and executed through a contract was a bit tricky at first but the mars docs with the rust structures helped make it simpler.

Accomplishments that we're proud of

Being able to understand a relatively complex DeFi primitive and able to implement that into contracts within a short time was exciting and quite a learning experience.

What we learned

I learned how a DeFi protocol is designed mathematically and translated into form of contracts.

Also learned how fixed yield protocols work and pros/cons of several approaches for the same.

What's next for FixedFi

The longer term goal is to make it generalised and permissionless for any yield bearing asset to be integrated into the protocol.

More polished UI and higher testing coverage is in the works too.

Built With

Share this project:

Updates

Submission history