project screenshot 1
project screenshot 2
project screenshot 3

RangeDex

A minimalistic implementation of tick-based ERC20 DEX based on Uniswap V3

RangeDex

Created At

FVM Space Warp

Project Description

The project uses the tick-based DEX logic leveraged in uniswap v3 and implements a minimal version of it. The features supported is two-way swap (both input or output amount can be entered/calculated), multi-way swap.

The v3 version of uniswap supports specifying liquidity within a certain price range instead of zero to infinity to make it more capital efficient. It does so by storing ticks (corresponding to certain specific token prices) and storing the amount of liquidity provided within two ticks. The core of the tick logic is implemented here. That includes storing the current range the respective token prices are in, the liquidity available on either side of the price range, and changing the liquidity value as the price shifts over different price ranges.

Fee calculation, pricing oracles, or NFT position managers were not implemented in this project.

How it's Made

The smart contracts are written in solidity and a react frontend is created to test out the swapping of tokens. The application has been tested on foundry as of now and not on a testnet. Fevm foundry started kit was referenced for testing using foundry (https://github.com/xBalbinus/fevm-foundry-kit). The following solidity math libraries are used for complex mathematical operations not available in solidity directly: abdk-libraries-solidity prb-math solidity-bytes-utils solmate

background image mobile

Join the mailing list

Get the latest news and updates