Introducing Vexchange 2

  • VIP180 / VIP180 Pairs
  • Variable Swap and Platform Fee
  • Price Oracles
  • Flash Swaps
  • Core/Helper Architecture
  • Technical Improvements
  • Auditors
  • Testnet and Launch Details

VIP180 / VIP180 Pairs

In Vexchange V2, any VIP180 token can be pooled directly with any other VIP180 token. Wrapped VET (WVET) is used instead of native VET in the core contracts, although end users can still use VET through helper contracts.

Variable Swap and Platform Fee

Vexchange V2 has the ability to adjust swap fees up and down through governance. Swap fees can be set from 0.05% to 2%, and platform fee can be up to 50%. This feature was present in V1 but underutilized as no active governance mechanism was developed. In V2, we plan to deploy and encourage active governance over the platform to ensure Vexchange meets its goals of providing the best VIP180 swap experience possible. Uniswap V3 has also moved towards multiple fee levels, which reinforces the value variable swap & platform fees will add to the Vexchange ecosystem.

Price Oracles

Vexchange V2 implements new functionality that enables highly decentralized and manipulation-resistant on-chain price feeds. This is achieved by measuring prices when they are expensive to manipulate, and cleverly accumulating historical data. This allows external smart contracts to create gas-efficient, time-weighted averages of Vexchange prices across any time interval.

  • For a 10-minute TWAP, sample once every 10 minutes. For a 1-week TWAP, sample once every week.
  • For a simple TWAP, the cost of manipulation increases (approx. linear) with liquidity on Vexchange, as well as (approx. linear) with the length of time over which you average.
  • Cost of an attack is relatively simple to estimate. Moving the price 5% on a 1-hour TWAP is approximately equal to the amount lost to arbitrage and fees for moving the price 5% every block for 1 hour.

Flash Swaps

Vexchange V2 flash swaps allow you to withdraw as much as you want of any VIP180 token on Vexchange at no upfront cost and do anything you want with them (execute arbitrary code), provided that by the end of the transaction execution, you either:

  • pay for all VIP180 tokens withdrawn
  • pay for a percentage of VIP180 tokens and return the rest
  • return all VIP180 tokens withdrawn

Core/Helper Architecture

Vexchange V2 Core is the essential Vexchange V2 smart contracts, consisting of:

  • Core uses WVET instead of VET. Routers can convert between VET and WVET allowing users to use VET directly
  • Core stores VIP180 token balances internally instead of relying on the balances stored in the VIP180 token contract
  • Core no longer calls transferFrom on msg.sender. Instead, VIP180 tokens should be sent to core directly by a router before calling the swap, mint, or burn functions.
  • Core will determine the number of VIP180 tokens sent to it based on the difference between its current and stored balances.
  • Core no longer returns the maximum number of VIP180 tokens for a given input amount. Instead, a router must specify the number of VIP180 tokens it wants. Core will send this number as long as the invariant is preserved after accounting for the pair’s swap fee.
  • Routers should handle logic around slippage safety checks and multihop trades.

Technical Improvements

Vexchange V2 contains many other significant changes and improvements including the following:

  • Smart contracts are written in Solidity instead of Vyper
  • Use CREATE2 to make the pool address deterministic based on the VIP180 token pair
  • Built-in meta transaction “approve” function for liquidity tokens
  • Increase re-entrancy protection using mutex (adds support for non-standard VIP180 tokens)
  • Fix bug from Vexchange V1 that uses all remaining gas on failing transactions
  • More descriptive error messages. The above bug caused failing transactions to only return the error “Bad Jump Destination”


We engaged tier 1 auditing firm Certik to help verify our new implementation before deployment. You can see our Vexchange V2 audit details here on their site.

Testnet and Launch Details

We are now live on mainnet, and developers and interested users can begin playing with Vexchange V2 on testnet as needed.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store