The new version of Uniswap will introduce direct ERC20 pairings, flash loans, and a decentralized price oracle.
Automated liquidity protocol Uniswap yesterday announced that a new version of its platform, Uniswap V2, will go live in April. It will introduce several hotly anticipated features, including flash loans, ERC20 direct swaps, and a more secure price oracle.
“It’s a natural progessive upgrade,” Stani Kulechov, founder and CEO of DeFi lending protocol Aave, whose platform offers similar products, told Decrypt.
Uniswap is essentially a decentralized market maker. Liquidity providers (people with spare cash) can contribute two tokens to a pool and let Uniswap automatically manage the price. Traders swap one token for the other at a price determined by the Uniswap formula, and the liquidity providers get a fee whenever anyone trades.
Most intriguing is the introduction of flash swaps, a new feature whereby users can withdraw ERC20 tokens from Uniswap that are paired with other tokens, do whatever they want with them, then immediately return the ERC20 tokens—minus a fee, or the equivalent amount of the other token that it’s paired with.
Kulechov said flash swaps are similar to flash loans—another popular DeFi product—but Hayden Adams, CEO of Uniswap, told Decrypt there’s a slight difference: “Flash swaps let you withdraw a token and use it before you pay for it (or return it), and flash loans let you withdraw a token and use it before returning it,” he said.
One step ahead
The new upgrade also includes countermeasures to prevent hackers from exploiting flash swaps.
Flash loans are popular among hackers because they can raise money quickly and cheaply. Last month, the Fulcrum protocol—which is maintained by bZx—briefly went offline after hackers exploited it for almost $1 million.
Kyle Kistner, bZx’s co-founder, confirmed on the company’s Telegram group that at least one of the exploits took place due to an “oracle manipulation attack.”
That’s why the latest version of Uniswap features “highly decentralized and manipulation-resistant on-chain price feeds,” according to its announcement. This is achieved by “measuring prices when they are expensive to manipulate, and cleverly accumulating historical data.”
Vitalik Buterin, co-founder of Ethereum, tweeted last month that Uniswap’s upgrade will make the protocol resistant to recent attacks on DeFi projects.
The planned uniswap v2 price oracle design is resistant to the recent flash loan attacks. https://t.co/Qd7Z3Vqgk9
— vitalik.eth (@VitalikButerin) February 18, 2020
Uniswap has also added a feature that lets any ERC20 token be swapped directly for any other token—right now, all tokens can only be swapped for ETH.
This feature is useful for liquidity providers, who can “maintain more diverse ERC20 token denominated positions, without mandatory exposure to ETH,” wrote Uniswap.
This can also “improve prices,” said Uniswap, because swapping an ERC20 token for ETH and then swapping ETH to another token “involves paying fees and slippage on two separate pairs instead of one.”
Uniswap’s rival, Bancor, already offers ERC20-ERC20 token pairs. Nate Hindman, who heads growth at Bancor spoke to Decrypt of the wonders of his own company’s platform, where “Bancor liquidity providers can set the fee to any number (unlike Uniswap’s fixed 0.3%).”
Of Hindman’s remarks, Adams said, “there are trade-offs here.” Bancor fees change per pool because “there are pool managers who can change those fees.” Uniswap fixes the fees to “remove the need for active governance,” he said, though said he’d like to explore different sorts of fees in the future.
Those who still don’t like version 2 or Bancor needn’t worry. “Uniswap V1 will continue to work for as long as Ethereum exists,” said Uniswap in its announcement.