Uniswap V2 Offers Better Price Feeds and Doubles Down on Flash Loan Concept
The Uniswap decentralized exchange announced on March 23 a planned release of its second major version, Uniswap V2. Among the major features, the new platform will feature flash swaps — a similar feature to the infamous flash loans that some blame for recent decentralized finance (DeFi) hacks.
The update’s release is tentatively scheduled for Q2 2020, though Uniswap’s blog post stresses that it is “not an announced release date.”
Uniswap is a decentralized cryptocurrency exchange platform that offers similar functionality to ShapeShift or Bancor. Unlike traditional decentralized exchanges, there is no order book. Trades rely on asset pairs where Ether (ETH) is always the base currency.
Uniswap V2 will allow direct token-to-token swaps, which is especially useful for swapping one U.S. dollar stablecoin for another. While this can be done right now by routing through ETH, a direct exchange reduces losses from fees and slippage.
Preventing DeFi oracle bugs
Uniswap was at the center of two back-to-back exploits conducted on the bZx platform. One of the reasons why the second hack was possible was bZx relying on Uniswap and Kyber as price oracles — despite their relatively low liquidity.
Uniswap V2 attempts to partially fix this issue by creating a time-averaged price feed. In order to influence the price values relayed by the platform, the attacker would need to affect at least two blocks in direct succession.
This design is said to prevent attacks based on flash loans, according to Vitalik Buterin, as the flash-lent funds can only exist for one block. Taking the time average of the prices also makes the protocol more resistant to any kind of manipulation in general.
Adding flash funding of its own
Flash loans were generally blamed for the hacks, despite the fact that many commentators pointed to critical vulnerabilities in bZx software. Despite their bad reputation, Uniswap V2 will feature a funding feature dubbed flash swap.
The swap allows users to withdraw an unlimited amount of ERC-20 tokens from a liquidity pool, provided that in the same block, either the tokens or their ETH equivalent are returned.
The feature would allow capital-less DeFi arbitrage — where traders play on the price difference of the same asset between various platforms. It could also make acquiring leverage through Maker (MKR) more efficient.
The lending platform is currently used by some traders to enter leveraged Ether positions by recursively purchasing ETH with the Dai (DAI) minted by the system.
With the flash swap, the desired leverage can be reached by simply borrowing ETH from Uniswap and returning it as DAI from Maker. While it simplifies the process, it does not make it risk-free as Maker suffered unfair liquidations recently.