![UNISWAP logo on coinmarketcap](https://tokenist.com/wp-content/uploads/2023/06/169002954_m_normal_none.jpg)
On Tuesday, Uniswap’s CEO Hayden Adams released the draft technical whitepaper for Uniswap v4. As Uniswap’s inventor and core developer, Adams introduced several improvements that build upon the liquidity customization of Uniswap v3.
Namely, Uniswap v4’s “hooks” and a “flash accounting” system for the new singleton contract architecture. The latest open-sourced version is hailed as an entirely new protocol that coexists with v3, leaving it up to developers to choose which features to adopt.
What does that mean for Uniswap’s liquidity providers, given its domineering market share of 72% among decentralized exchanges (DEXes)?
The Role of Hooks in Liquidity Pools
Instead of relying on traditional order books, DEXes like Uniswap rely on liquidity pools. These smart contracts track the balances of token pairs, such as USDT/ETH, for swaps. Users act as liquidity providers (LPs) to fill these pools with deposits.
Traders then drain liquidity pools when they need a token swapped, giving LPs fees based on the amount of liquidity provided. With v4, Uniswap is introducing plugins called “hooks.” They aim to customize the relationship between LP positions, fees, and swaps.
So far, Adams has released four hooks examples to showcase what is possible:
- Customized on-chain oracles, as token price-feeding mechanisms that enable liquidity pools to act as oracles. This could apply to v3’s geomean oracles, with “geomean” referring to geometric mean – the average price of an asset over some time.
- On-chain limit orders.
- Time-weighted average market maker (TWAMM) a new type of automated market maker (AMM) that breaks long-term orders into infinitely small virtual orders. This allows for the execution of huge orders without succumbing to sandwich attacks.
- Dynamic fees based on volatility oracles. For instance, earning LP fees on swapping and withdrawing liquidity would be possible by giving hook contracts those permissions.
Among other possible hook novelties are auto-compounded LP fees that provide feedback into LP positions. Likewise, internalized MEV (Maximal Extractable Value) profits are distributed back to LPs. In essence, Uniswap v4’s hooks allow dApp developers to externally deploy contracts that execute a customized logic in the liquidity pool’s lifecycle.
![](https://tokenist.com/wp-content/uploads/2023/06/Screenshot-2023-06-13-175353.png)
Adams forecasts that many hook designs “will be as complex as protocols themselves.”
Join our Telegram group and never miss a breaking digital asset story.
Singleton Architecture and Flash Accounting
While hooks expand Uniswap v4 customizability, the newly introduced singleton design allows liquidity pool management with a single contract. This makes pool deployment 99% cheaper. The singleton architecture goes hand-in-hand with flash accounting.
Flash accounting simplifies more complex liquidity pool executions, such as atomic swapping or adding liquidity. Previously, such operations ended by token transfers in and out of pools for every swap. In contrast, flash accounting in v4 updates pools’ internal net balance (delta).
“It’s essentially just a new cool way of doing balance accounting and it ensures that the pool’s balance is safe and the user’s balance is safe,”
Uniswap Labs smart contract engineer, Sara Reynolds, to The Block
Therefore, external transfers happen only at the end of the token pair lock via transient storage specified in EIP-1153. With singleton contracts, flash accounting saves gas fees as liquidity fragmentation costs are reduced. These savings are needed as hooks will “greatly increase the number of pools.”
Native ETH Support and ERC1155 Accounting
Ethereum blockchain is Uniswap’s main host, so the DEX relies on Ethereum’s smart contract standard, such as ERC-20. Although Ether (ETH) is Ethereum’s native cryptocurrency, it is not an ERC-20 token. The Uniswap v4 upgrade is bringing back native ETH in token swaps from Uniswap v1.
In v2, such a feature was removed because of liquidity fragmentation concerns for Wrapped Ether (WETH) trading. However, as singleton architecture and flash accounting reduce liquidity fragmentation impact, native ETH support is back. This is significant, as native ETH transfers cost half as much as ERC-20 token transfers.
Lastly, v4’s singleton architecture will support the minting and burning of ERC-1155 tokens. Enjin, a Singapore-based blockchain firm, built this new token standard for creating fungible (altcoins) and non-fungible assets, known as NFTs. As with flash accounting, this allows users to avoid costly ERC-20 transfers in and out of liquidity pools, bringing extra efficiency for high-frequency swappers or LPs.
Do you trade cryptocurrencies more on traditional CEXes, like Binance or Coinbase, or on DEXes, like Uniswap? Let us know in the comments below.
The post What’s New for Uniswap? Devs Release v4 Whitepaper for Feedback appeared first on Tokenist.