Gain & Loss in DeFi!
To position Islander as a learn-to-earn & affiliate marketing platform promoting crypto adoption, Islander is not only a place where retail investors can find and learn from potential projects but also provides informative news. Currently, our primary goal is to serve as a springboard for the top initiatives in the Avalanche ecosystem. So, with this “Avalanche How-to” series, we will provide you with the fundamentals of this potential ecosystem.
The next post in our “Avalanche How To’’ series is about Gain & Loss in DeFi.
It all started in 2018 in a Telegram group chat where a group of software developers and entrepreneurs were looking for the right name for the new financial model they were about to launch. Specifically, it would operate the blockchain and compete directly with traditional banks. Nowadays, DeFi has grown into a thriving financial industry with more than $90 billion in locked-up collateral.
The question is: what will one gain and lose from DeFi, and how has it attracted such a large number of investors?
1. Token purchase offerings from new projects.
Though a token purchase offering does not guarantee a return, early access is clearly an advantage to any DeFi investors.
Even though it is theoretically possible, it is unlikely that public investors will be able to compete for early offers of stocks or other assets in the traditional market. Because of the high level of competition, transparency, and relationships in that market, private sales, public sales, or even IEOs are unthinkable things to individual investors. Prior to DeFi, the same was true for the crypto market: ICOs or token sales on centralized exchanges (CEXs) always suffered from fierce competition due to the supply and demand gap. CEX also had a very limited list of mature projects to offer to investors. Thus prior to the appearance of DeFi, purchase offerings were inconceivable to the crypto community.
With the advent of decentralized exchanges (DEX) like UniSwap, SushiSwap, and PancakeSwap, a slew of new projects could afford easy token distributions to public investors. Public investors, on the other side, had more options, more diverse purchasing power, and were able to invest in a wide range of projects as soon as possible.
Addressing this market issue, the nine largest DEX exchanges have reached a trading volume of up to 30 billion USD in 2020. The swap itself has also accounted for the lion’s share of the DeFi market.
2. Automatic Market Maker & Liquidity Provider
But, more specifically, how do DEXs function decentralized?
To ensure smooth buying and selling of investors on centralized exchanges, an intermediary role known as a market maker exists. Buyers and sellers register their buy/sell orders on an order book, resulting in price mismatches. At this point, market makers act as intermediaries for buying and selling, ensuring that the market always runs smoothly and enjoying price differences, by the way.
Instead of using Market Maker (MM), DEXs employ an intelligent algorithm known as Automatic Market Maker (AMM, a game-changing solution for DEX exchanges. In essence, it uses an intermediary fund known as a liquidity pool which then distributes tokens directly to buyers and sellers. Unlike CEXs that always statistics buy orders and display the highest price to buyers; when you participate in a DEX, tokens are stored in sellers’ wallets, as are other people’s tokens. For example, when a lot of investors are willing to pay 100,000 USD for a BTC, which is the lowest price sellers are willing to sell at, a BTC will be worth 100,000 USD. As a result, the DEX itself will be unable to price tokens or manipulate swap rates. DEXs are, therefore, a venue for peer-to-peer exchange, so buyers and sellers can easily find each other, making transactions effortless.
Determining the price necessitates using a liquidity pool, in which liquidity providers provide liquidity for token pairs that other investors would trade. Typically, a new token will be paired with a powerful coin (like stable coins or layer-1 coins). AMMs will then price tokens based on the liquidity ratio when the pair is added. If someone wants to exchange token B for token A, even if no one is selling A at the time, the transaction will still take place: AMM will get A from the liquidity pool for the buyer. When someone exchanges A for B, AMM will give that investor B and place A in the pool. Regardless of the token ratio in the pool, they are always considered to be of equal value (usually 50:50, as may be the case with other formulas), and this is how the value of tokens is determined on DEXs.
According to the most popular algorithm (50:50 ratio and the value of A x B always equals a constant), if the number of transactions from A to B is too large, A’s price will decrease, and those swapping A for B will suffer from price slippage in subsequent transactions.
- MEOW is a new token in the market. If the project owner wants to create liquidity for investors, he will set up a liquidity pool on the Trader Joe’s exchange.
- He then provides liquidity at this ratio: 1,000,000 MEOW for 1000 USDC. This step immediately determines the value of the MEOW token: 1,000,000 MEOW is now equal to 1000 USD, meaning 1 MEOW costs 0.001 USDC, which is roughly 0.001 USD.
- John is an investor who wants to exchange 100 USDC for the same number of MEOWs and believes he is the only one in the market who can do so. After transacting, AMM provides John with 100,000 MEOW. At this time, the liquidity pool will contain 900000 MEOW and 1100 USDC. MEOW’s price is then = 1100/90000 = 0.0012 USDC a token.
- When another investor, such as Rose, who already owns MEOW prior to the private sale, wishes to exchange 900000 MEOW for USDC, the process is similar.
This example, however, excludes the two fees that both John and Rose must accept in DEX transactions:
- Slippage: Because both John’s and Rose’s buying/selling actions affect the value of MEOW (an increase of 20% in value in John’s case), John should have received fewer tokens than he would in the above example. Slippage occurs when a large volume of buying/selling occurs, causing the liquidity pool to skew the number of tokens in the pair, hence affecting their value.
- Transaction fees: For most DEXs today, buyers and sellers must deduct a percentage of total trading volume (typically 0.3 percent) to pay the exchange and liquidity providers. John, for example, would lose some USDC, whereas Rose would lose some MEOW.
Based on this liquidity mechanism, liquidity providers will gain commission from buyers and sellers.
- The value of the MEOW-USDC liquidity pool is currently 2000 USD, with 1000 USDC and 1000000 MEOW.
- An investor adds an additional 1000 USDC and 1000000 MEOW to the pool, whose value rises to 4000 USD. He will then be holding 50% of the pool shares worth a total of 2000 USD.
- If the trading volume of this MEOW/USDC pair reaches 1,000,000 USD in a single day, the LP will receive a total commission of: 1.000.000 x (0.3% — 0.05%) x 50% = 1250 USD per day.
(Where 1,000,000 is the total trading volume, 0.3% is the percentage of transaction fees that DEX collects from users, keeping 0.05% for its owner and distributing 0.25% to LPs; and 50% is the percentage of shares the above LP owns in that liquidity pool.
Assume MEOW has a daily trading volume of up to 500,000,000 USD, and one owns about 10% of the liquidity pool: his daily earnings could be up to 125,000 USD!
Because the price determination mechanism is entirely based on liquidity pools, token prices between decentralized exchanges and centralized exchanges can differ significantly. However, there are always a lot of professional investors in the market who use their bots to do arbitrage. Wherever MEOW’s price in CEXs is higher than that at DEXs, those arbitrageurs will buy MEOW at DEXs to sell at CEXs. Because of the liquidity pool-based pricing mechanism, this sale will lower the price of MEOW at the exchanges where MEOW’s price is higher. This arbitrage will continue until the price on all exchanges is equal, at which point there will be no incentive for anyone to practice arbitrage.
3. Staking, Farming & Airdrop
Project owners always want to incentivize users to hold their tokens and provide liquidity on DEX exchanges to sustain the project, so they must have a budget to encourage sustainability. For this reason, most projects secure a dedicated token fund to reward hodlers or LPs. So, in addition to the fee commission mentioned above, LPs also earn from staking their Liquidity Pool (LP) tokens and farming.
A liquidity provider of the MEOW-USDC pair, for example, can deposit MEOW-USDC LPs into farms and receive real-time interest. The APY can range from several to over a thousand percent, and the more stakers a pool has, the lower the APY each staker receives from staking. Alternatively, some projects open farms where investors can stake A in exchange for more A tokens, thereby encouraging the hodling behavior.
At the same time, DEXs also want to encourage investors to provide liquidity for trading pairs to diversify their market, so they issue their own tokens and use it to reward LPs. This serves as another incentive, especially for projects having no token fund to reward LPs. PancakeSwap, for example, has issued CAKE and SushiSwap SUSHI, and both are being used for similar reasons.
Furthermore, another mechanism promoted on DeFi is airdropping, which means distributing free tokens to the community. These airdrops are also funded by the project’s development funds as a means of self-marketing. By demonstrating their contribution to the project, investors can then receive free tokens from new or even old projects.
Essentially, the rewards for staking, farming, or airdrops come directly from the projects or DEXs. Instead of using the money for marketing or other purposes, they give it to users as a form of self-promotion. This is similar to how Uber used venture capital funding to finance users’ first rides.
4. Profit from your peers
Finally, DeFi generates profits for its users in the same way that banks do: by saving, lending, and selling insurance. Users can lend their idle tokens to the platforms, which will in turn lend them to investors. The borrower’s interest will be transferred to individual lenders (with a small amount deducted to compensate the platform).
Following the introduction of DEXs, almost any project’s token has been assigned a value since it was added to a liquidity pool. As a result, the emergence of DeFi also has resulted in an explosion of scams, rugpulls, and the like, with the total number of scams reaching an all-time high. Purchasing a diversified and early token, therefore, carries a higher risk of falling for a scam project.
Furthermore, there is a possibility that DEXs or DeFi projects themselves — where users directly lock their tokens — are scam projects that will steal all investors’ money.
Orders on DEX are public and fulfilled by AMMs, which get tokens from the liquidity pools for traders (which affects the price); some of which will use bots to perform front-running. When normal investors place a 10,000 MEOW order with low or medium gas fees (which will result in queuing after transactions with higher gas fees), front-running bots automatically pre-purchase 10,000 MEOW by placing the same order with higher gas fees so that the latter will execute before the former. This action will cause a change in MEOW’s price, and because the user must always buy the MEOW on the exchange at the market price (which is not fixed), 10,000 MEOW in the subsequent order will actually cost more USDC, pushing the MEOW price up. At this point, the bot will immediately place a sell order to take advantage of the difference between the old and new MEOW prices, causing the MEOW price to fall, and this discount will be borne by normal investors.
3. Impermanent loss
When providing liquidity, investors must consider the opportunity cost if the market fluctuates. Specifically, the number of tokens deposited into the pool and the withdrawn amount will not be the same for arbitrageurs who will seize the opportunity. Therefore, the greater the difference between the value of tokens held in the wallet and in the pool, the greater the opportunity cost loss will incur.
Assume an investor provides 1000 USDC and 1,000,000 MEOW to the MEOW/USDC pool on Trader Joe.
At the time, 1 MEOW = 0.001 USDC
The pool contains 1,000 USDC and 1,000,000 MEOW.
Using the pool balance formula: USDC*MEOW = constant k => 1000 x 1,000,000 = 1,000,000,000
Assume MEOW price outside the pool doubles to 0.002 USDC.
Arbitrage traders will arbitrage with MEOW on Trader Joe until it reaches 0.002 USDC, as it has in other markets.
The reserve ratio will be rebalanced until it matches the initial k constant of 1,000,000,000.
The new pool ratio will be 1414 USDC x 707106 MEOW.
To calculate the impermanent loss, compare the difference between pulling out the entire liquidity pool and selling versus keeping it in the wallet and selling.
The investor’s initial capital is 2000 USD, with the initial price of MEOW being 0.001.
When the MEOW price reaches 0.002, his pool’s assets values: (707106 x 0.002) + 1414 = $2828 (excluding interest from trading fees).
On the other hand, his wallet value is: (1 000 000 x 0.02) + 1000 = 3000 USD
As a result, he will be suffering from an impermanent loss of 5.7 percent.
The greater the increase in the price of the token, the greater the impermanent loss, and investors should consider that if the return on liquidity provision is not greater than this amount, they are in fact losing money. It is “impermanent”, for it only becomes a permanent loss after the investor has made a final decision.
There will be a risk associated with the rewards LPs gain from projects or DEX exchanges (usually, DEX exchanges will reward farming/staking profits with their own tokens or tokens of their partners). In this case, any farmer or staker will earn a very high APY, so there will be a large number of tokens distributed to the market.
Returning to the liquidity pool’s mechanism, if investors swap reward tokens for stable or more valuable coins, the number of tokens in the liquidity pool will eventually be greater than the paired token. If there is no pump from new investors, the price will steadily decrease over time. As a result, the initial high APY number may be correct for the number of tokens LPs receive, but not for the actual value (in USD or stable coins).
This inflationary phenomenon is common on many DEXs and other decentralized platforms, and it will continue as long as this financial product is not appealing to new users, or is so unappealing that more and more LPs will turn into holders. For the supply will be increasing while demand is decreasing, the asset value will gradually decrease as a means of self-correction.
5. Hacking, payday loans, and exploit
Last but not least, DeFi is just getting started, and there are still a lot of critical issues. Regardless of the project, any commitment to safety and security carries the risk of being attacked, resulting in asset loss. In fact, DeFi is currently the most attacked sector, with billions of dollars stolen or lost.
As a result, investors must stay cautious before making investment decisions in this market.