DeFi in brief
DeFi is an ecosystem of financial applications based on Blockchain technology that operates without any third-party or central administration intervention. This system is transparent and permissionless and Smart contracts are the foundation of them.
Example: John wants to pay 100 USD to Alan, this involves below listed entities
John’s and Alan’s bank
Payment network (like VISA or Mastercard)
Basically, it's centralized and has a risk of mutability, with DeFi we can perform some transactions where John’s wallet interacts with Alan’s.v Introduction of DeFi added new concepts like Lending, Swaps, AMM, DEX, etc.
Who introduced DeFi?
MakerDao was the first to introduce DeFi, it was a basic concept for Lending and Borrowing stable coin with crypto. This opened up a stagnant market. (Everybody had crypto, but in wallet doing nothing!)
Before DEX — Let's check Centralized Exchange
Centralized Exchange work on Order book matching where buyer request (as low as possible) is matched with seller’s request (as high as possible). Many times when there are no matching Market Makers come into the picture to provide liquidity. So, without Market Makers exchange is unusable.
What is DEX ?
DEX works on real-time buy and sells request matching, this was a boon in DeFi but led to a problem of having low volume and Liquidity. This caused a road block in trade and conversion on Crypto to Fiat due to lack of Liquidity. Also, no margin trading or stop loss.
Uniswap solved this in May 2020 by adding Liquidity pool.
Uniswap and Liquidity
Uniswap creates a new market by creating a Liquidity Pool for token pairs, where a PAIR of Token/Coin is man mandatory to added of the same value.
Simple example with USD and INR. If I need to create a Liquidity Pool for USD/INR at Uniswap I will do below steps
1. Select pair as USD and INR.
2. As I am first one to add this, I will set initial price 1 USD = 73 INR.
3. So I must give 1 USD and 73 INR to this pool.
Any user who come next must provide same value i.e. 2 USD = 146 INR. (Demo)
The investor gets a profit of 0.3% on his pool size on every transaction. Also, create a chance for arbitrage.
Algorithm of Uniswap
Every DEX has a separate algorithm to maintain liquidity Uniswap has below
Curve and Balancer
Other than Uniswap some top DEX are Curve and Balancer using a base idea from Uniswap they have built more enhanced (algorithms) Liquidity Pools.
Curve has an algorithm for assets with similar prices and stable coins.
Like Balancer can have 8 tokens (Like Uniswap has 2).