PancakeSwap announces v4 with custom pools and gas optimization
Decentralized exchange PancakeSwap released its version four codebase and white paper on March 15, according to an announcement from its team. The new version will allow for custom liquidity pools and flash accounting, intended to lower gas costs for users and prevent impermanent loss for liquidity providers (LPs). The team will also create a development fund to help pay for further development of the PancakeSwap protocol, the announcement stated.
PancakeSwap v4 logo. Source: PancakeSwap
PancakeSwap is the third-largest decentralized crypto exchange, measured by the total value of cryptocurrency locked within its contracts. It currently holds over $2.3 billion of assets spread across nine different networks, according to blockchain analytics platform DefiLlama.
According to the announcement, the new version will launch on the Ethereum and BNB networks in the third quarter of 2024.
The team stated that v4 integrates “hooks,” which are “customizable add-ons” that can be created by independent developers to add additional features for certain liquidity pools. For example, it allows pools to offer “dynamic fees […] custom oracles [and] active liquidity management modules.”
It also supports liquidity book pools, according to the announcement. Unlike traditional pools that follow the X*Y = K formula, liquidity book pools use the formula X + Y = K. PancakeSwap claimed that this new type of pool allows liquidity providers to experience no impermanent loss and traders to suffer no price impact when trading within a bin.
The developers also made changes to minimize gas costs, including a move to a “singleton” model where all pools are consolidated into a single contract. They claim this will reduce the cost of “multi-hop” trades that require more than one swap to complete. In addition, the v4 protocol implements “flash accounting,” which “optimizes the accounting process by computing net balances for a batch of transactions and settling them collectively,” purportedly further reducing gas costs.
The new code is being released under an open-source license, the team stated. Developers who want to fork the code can apply to become “affiliates” and gain official recognition from the team. In addition, PancakeSwap is launching a $500,000 developer program to fund independent developers to create hooks for v4.
As the crypto user base grows, decentralized exchanges are racing to implement new features to grab market share. On Feb. 27, Uniswap announced that it is releasing a web extension wallet with its exchange built in. In November 2023, the exchange announced a “gauges” voting feature allowing PancakeSwap’s (CAKE) tokenholders to vote on which polls would receive additional rewards.