Compared to Ethereum, Tezos' DeFi ecosystem is still in its very stages. So, coming up with a good project idea was a bit tricky. Right now some of the hottest upcoming DeFi protocols like Maple and Goldfinch are in the space of Under-collateralized loans. As soon as I read this the movie "The Big Short" came to my mind😁 in which I learned about "Credit Default Swaps".
A credit default swap (CDS) is a financial derivative or contract that allows an investor to "swap" or offset his or her credit risk with that of another investor. For example, if a lender is worried that a borrower is going to default on a loan, the lender could use a CDS to offset or swap that risk.
The size of the US Insurance market is $1.28 trillion on the other hand size of the US CDS market is a whopping $4 trillion, which is astounding to realize that what CDS "ensures" are almost 1/4th its size. And that's the exact reason why 2008's housing market crash saw its exponential rise. But with DeFi we have the potential to make these complex derivatives transparent and that is what Omni-Swap does.
As we have witnessed being first in blockchain really matters. Currently, all the major DeFi protocols are on Ethereum Network so protocols built on Tezos won't get any traction if they do the same thing. Either protocol should drastically improve on the existing protocol or it should be the first one in the market. Under-collateralized loans are the next big protocols that are getting traction e.g. Maple and Goldfinch so as of now Decentralized CDS protocol was not needed as all loans were over-collateralized but with this next big wave of under-collateralized protocol, Tezos could get traction with a protocol like Omni-Swap as it will be the first in the market.
Coming with a high level design of AMM for the protocol and the overall flow of tokens in the protocol.
Writing contract in SmartPy
It was my first time writing smart contract with SmartPy so I had some trouble as the contract's logic got more complex. Shout out to Smartpy dev community they were very helpful.
So, fa1.2 tokens metadata have a decimals field which is quite important while I was testing with Smartpy, Smartpy handled the conversion implicitly so I didn't notice that and had some trouble calling smart contract functions
I know this is a difficulties section but as I have no space left to write in the above section I am writing here. First of all, Taquito- This is an awesome tool that Tezos has built I faced almost no troubles while integrating web3 stuff with Tezos. Also huge thanks to @Anshu Jalan he helped me quite a lot with bugs in my dapp.
Technologies used
Discussion