← Back to home

ZeroSwap

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

Problem Statement

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 tokensBurn LP tokens to withdraw liquidityPerform swaps between the two tokens in the pairSkim extra fundsSynchronize reserve with current balance

Solution

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.

Hackathon

Scaling Ethereum

2024

Contributors