Sumedha Chattree
6 min readAug 2, 2023

DEEP DIVE INTO CURVE FINANCE

curve-finance-jpg

Curve Finance is a decentralized finance (DeFi) platform that facilitates efficient and low-slippage trading of stablecoins and other similar assets. It is designed to operate on the Ethereum blockchain and provides users with the ability to swap different stablecoins with minimal price impact and low fees.

Too many heavy words clubbed together? Let’s break it down in layman’s terms.

What is a Decentralized Finance (DeFi)?

It is a rapidly growing sector within the cryptocurrency and blockchain industry. It aims to recreate traditional financial services and applications in a decentralized and open manner. Its decentralized nature breaks the dependency on centralized institutions removing the need for intermediaries like banks, brokers, or others. As it operates on Blockchain networks like Ethereum and utilizes smart contracts it enables trustless and transparent transactions. As it uses smart contracts it is highly programmable, automating various financial processes and enabling the creation of custom financial products and services. It is open source and permissionless, allowing global access to financial services for individuals who are unbanked or underserved by traditional financial systems, encouraging equality and transparency.

What is a liquidity pool?

Liquidity pools are created and maintained by users who contribute their funds to the pool, enabling others to trade and swap assets without the need for traditional order books or centralized intermediaries. Curve Finance operates on the concept of liquidity pools, where users can deposit their stablecoins (stablecoins are cryptocurrencies that are designed to have a stable value, often pegged to the value of a fiat currency like the US dollar) into specific pools. These pools consist of similar assets pegged to the same value, such as different types of stablecoins like Tether (USDT), USD Coin (USDC), and Dai (DAI).

liquidity-pool-token-exchange

What is low-slippage trading?

The unique algorithm of Curve Finance allows for efficient trading within these pools. Low slippage is a term commonly used in financial markets and trading on decentralized exchanges (DEXs — decentralized apps for trading). Slippage is the discrepancy between the price at which a trade is requested and the price at which it is actually filled. It is a desirable characteristic in trading because it means that traders can execute their trades at prices close to the ones they intended, resulting in a more accurate and efficient trading experience.

Example: In the context of DeFi and DEXs, low slippage is achieved through liquidity pools, where users deposit their assets to facilitate trading. When users swap tokens on a DEX, the price is determined by the ratio of assets in the liquidity pool, as opposed to traditional order books in centralized exchanges. If the liquidity pool contains a substantial amount of assets, the impact of the trade on the price is minimal, resulting in low slippage.

Gain in Curve Finance?

Curve Finance has its native governance token called CRV. A governance token is a digital token used in decentralized governance systems, typically within a blockchain protocol. Users who provide liquidity to the pools receive CRV tokens as rewards, giving them voting rights in the protocol’s governance decisions.

The mechanism behind the functioning of Curve Finance:

automated-market-maker-formula

It operates on AMM, which stands for Automated Market Maker, it facilitates the trading of digital assets without the need for traditional order books or centralized intermediaries. AMMs use mathematical algorithms and liquidity pools to determine asset prices and enable seamless asset swapping. It works on liquidity pools by applying a constant product formula (x*y=k), to calculate asset prices within the pool. The formula ensures that the product of the quantity of each asset (x and y) in the pool remains constant. As a result, when one asset is traded for another, the amount of each asset changes, and the exchange rate adjusts automatically. They can then, swap assets, when a user wants to make a trade, they interact directly with the AMM’s smart contract and provide the desired input asset. The AMM’s algorithm calculates the number of output assets the user will receive based on the current pool’s state and exchange rate. In the process, slippage is generated, and Liquidity Provider Tokens are given. These tokens represent the LPs’ share in the total pool liquidity. LPs can use these tokens to withdraw their pooled assets or to earn a portion of the trading fees generated by the platform.

All these processes contribute to the functioning of Curve Finance making it an efficient way for trading.

Moving onto the Curve Hack that took place:

curve-hack

The DeFi sector experienced a significant setback as Curve Finance, suffered an exploit on July 30, resulting in losses exceeding $47 million. The exploit in Curve Finance was primarily caused by a malfunction in the reentrancy locks of specific versions of Vyper, a programming language used in the protocol. Reentrancy attacks occur when a contract is not locked correctly, allowing multiple functions to be executed simultaneously, potentially leading to the draining of funds from the contract. This vulnerability affected several DeFi projects, causing significant financial losses.

Ellipsis, a decentralized exchange, also reported being impacted by the exploit in some of its stable pools with BNB tokens, which were using an outdated Vyper compiler.

As a result of the attack, more than $22 million worth of CRV tokens (over 32 million CRV tokens) were drained from Curve Finance’s swap pool. This event caused panic across the DeFi ecosystem. However, the crvUSD contracts and associated pools remained unaffected.

In response to the incident, the founder of Curve Finance took prompt action and repaid 4.63 million USDT and deposited 16 million CRV (equivalent to $10.12 million) on Aave, a DeFi lending platform. Currently, the founder holds 293 million CRV tokens (valued at $181 million) as collateral and owes 59.68 million USDT, resulting in a health rate of 1.69.

The hack caused a tremendous loss to Curve Finance, tri crypto liquidity pool users on various DeFi platforms, but it was balanced out with deposits in the DeFi platform using CRVs and USDTs. A crypto user returned 2,879 ETH (approximately $5.4m) to the Curve deployer mitigating some of the loss that occurred and stabilizing the scenario.

In conclusion, Curve Finance will continue to be a safe ground for DEXs or DeFi, apart from the losses that occurred as it works on stablecoins and AMMs mechanisms providing a strong supporting backbone to the crypto-trading users.

References:

No responses yet