project screenshot
project screenshot
project screenshot

Nested AMM

The ERPPS (Exchange Rate, Pricing, and Price Slippage) Protocol implements a nested Automated Market Maker to effectively normalize price slippage through exponential smoothing methods. Compared to the most implemented Automated Market Makers, the Constant Product Market Maker (C

Nested AMM

Created At

HackMoney 2022

Project Description

Drawing inspiration from Anthony Zhang’s whitepaper published in September 2021, the ERPPS Protocol implements the theoretical, nested AMM detailed in this paper. The invariant model is similar to the Constant Product Market Makers commonly used - in that it enforces a constant ratio between assets within the liquidity pool, it is different in the process it follows in executed asset swaps. Drawing on the economic theory of Constant Elasticity of Substitution Curves, the NAMM has additional parameters that encapsulates how easily assets can be traded for one another - essentially distinguishing how much price slippage will be present. This enforces a well-behaved exchange rate between two assets, maintaining a near 1:1 exchange rate , while simultaneously smoothing the price-slippage path and exchange rates between two disjoint assets into predictable, low volatile behavior.

Going into the dynamics of the implementation, we started with the nested function presented in the whitepaper. To visualize what this was accomplishing, we ran a simulation using data analysis in Python.

Although our demo only implemented one nest and exterior asset, it can be further generalized into n number of assets within nests and n number of nested nests. This would further curtail volatile price-slippage behavior with large quantity trades. In our current implementation, we have already found ways to increase the efficiency of our backend such as minimizing the gas fees for calculating exchange rates between assets.

How it's Made

The “Backend” of our DAPP is composed of Solidity Smart Contracts deployed on the Mumbai Testnet. The events emitted by the contracts are read into The Graph using their hosted-services deployment scheme. The frontend queries The Graph and displays all of the Pools deployed by users who can then deposit liquidity and receive Pool specific LP tokens in return. The frontend is made using a standard React App, in conjunction with Tailwind for styling (even tho we may not have used it that much). The frontend < – – > blockchain connection is made using Ethers.js. The app also supports swapping using a standard ethers.js integration.

background image mobile

Join the mailing list

Get the latest news and updates