Charon

A pricacy enabled cross-chain AMM that allows parties to deposit on one chain, pass proof of the deposit to multiple chains and then withdraw on only one.

Charon

Created At

HackMoney 2022

Winner of

trophy

🏊‍♂️ Polygon — Pool Prize

Project Description

Charon is a decentralized protocol for a Privacy Enabled Cross-Chain AMM (PECCAMM). It achieves privacy by breaking the link between deposits on one chain and withdrawals on another. It works by having AMM's on seperate chains, but LP deposits in one of the assets and all orders are only achieved via depositing on the opposite chain and then withdrawing it as either an LP or trade with any address. To acheive cross-chain functionality, Charon utilizes tellor to trustlessly pass commitments(proof of deposits) between chains.

Example: we'll use Ethereum and Polygon, although the system can work on any two EVM chains with Tellor support. It also works with any tokens, but for this example, we'll use LUSD on mainnet and USDC on Polygon (two stablecoins for ease of math).

Flow

Setup done by controller:

 - Launch contract on Ethereum

 - Launch contract on Polygon

 - Deposit 100k LUSD in Ethereum contract and 100k USDC on Polygon to initialize pools



Functions for users 



(on Ethereum as example)

- LP deposit (deposit LUSD as an LP on the ETH contract, earn fees).  

- LP withdraw

- depositToOtherChain (deposit LUSD with zk commitment)

- oracleDeposit (oracle puts your information into the other chains contract)

- secretWithdraw( withdraw your deposit from Polygon)

    - can either withdraw as LP or as market order

How it's Made

So I originally just wanted to fork tornado cash, but of course, their tests and dependencies we're broken. I had to get deep into the weeds of the circom repository (zk proof generator) and then I used old logic from balancer for the AMM structure allowing single side withdrawals (none of the UNI v3 stuff). But obviously used hardhat, solidity, js for testing, and lots of vitaliks articles and zk hack workshops for understanding (or attempting to) the privacy stuff.

background image mobile

Join the mailing list

Get the latest news and updates