📖Introduction

This technical section of the whitepaper explains in detail how the MTVSwap automated market maker (AMM) contracts work. It covers main the contract features: a hardened price oracle that allows other contracts to estimate the time-weighted average price (TWAP) over a given interval, “flash swaps” that allow traders to receive assets and use them elsewhere before paying for them later in the transaction, and a protocol fee that can be adjusted as required in the future.

MTVSwap has taken the tried and tested Uniswap v2 contracts and implemented them on the MultiVAC blockchain. This section describes, in some detail, the mechanics of the core contracts and, as such, utilises content from the Uniswap v2 Whitepaper.

Uniswap v1 was the original decentralized automatic market maker (AMM). It was an on-chain system of smart contracts on the Ethereum blockchain, implementing an automated liquidity protocol based on a “constant product formula”. This is often referred to as the ‘price curve’. [Hayden Adams. 2018]. Each Uniswap v1 pair stored pooled reserves of two assets, and provided liquidity for those two assets, whilst maintaining the invariant that the product of the reserves cannot decrease. Traders paid a 30-basis-point fee on trades, which was distributed to liquidity providers. The contracts were non-upgradeable.

Uniswap v2 was a new implementation based on the same formula, with several new highly desirable features. Most significantly, it enabled the creation of arbitrary ERC20/ERC20 pairs, rather than supporting only pairs between ERC20 and ETH. It also provided a hardened price oracle that accumulates the relative price of the two assets at the beginning of each block. This allowed other contracts on Ethereum to estimate the TWAP for the two assets over any time period. Version 2 also enabled “flash swaps” where users can receive assets freely and use them elsewhere on the chain, only paying for (or returning) those assets at the end of the transaction.

By using the Uniswap v2 contracts in the back-end MTVSwap is able to take advantage of all these improvements, as well as benefiting from the tried and trusted nature of the system.

Last updated