ZeroSwap

Automatic market maker written in Zinc for zkSync, based on Uniswap v2

ZeroSwap

Created At

Scaling Ethereum

Project Description

I have written a Uniswap v2 style AMM contract in Zinc. More specifically, I have written a trading pair contract (ZeroSwapPair) that has the following features:

  • Provide liquidity and receive LP tokens
  • Burn LP tokens to withdraw liquidity
  • Perform swaps between the two tokens in the pair
  • Skim extra funds
  • Synchronize reserve with current balance

How it's Made

This project is developed for zkSync. I have used the Zinc language to write the smart contracts and the zargo cli to compile the contracts.

I added a deposit & withdraw mechanism to deal with the restriction in zkSync that each transaction can only transfer a single token. In order to provide liquidity, the user first sends two deposit transactions that transfers the two tokens into the contract, and then calls mint() to use the deposited funds to provide liquidity.

background image mobile

Join the mailing list

Get the latest news and updates