# Compliant DEX

Galactica example project for a compliant DEX. It is a fork of UniswapV2 and extends it with compliant privacy through Galactica's zkCertificates.

## Changes compared to UniswapV2

* The compliant dex code is available here: <https://github.com/Galactica-corp/Compliant-DEX>
* It's a fork of UniswapV2 with modifications to allowed only ZkKYC holders interact with it. The changes are in the following contracts:
  * UniswapV2Router02: every function that interacts with the DEX has a `hasValidVerificationSBT` modifier
  * UniswapV2Pair:
    * mint, burn and swap functions are restricted to be only callable by the router to enforce the SBT requirement
    * the transfer function is also subjected to the same SBT requirement as the router
  * UniswapV2Factory: now also contains the router address, so that the pair can have access to the router's SBT requirement
* In addition to the DEX contracts we also need the following contracts that check compliancy:
  * A Dapp that combines compliancy check and SBT minting, for example KYCRequirementsDemoDApp
  * VerifierWrapper: to check public inputs
  * Verifier: generated by circom framework to check the Zk proof
  * VerificationSBT: to mint the SBT when the check is passed, can be 1 or several depending on the number of requirements. The list of required SBTs is then stored in the router contract.
* Before interacting with the DEX, the user needs to call the `checkRequirements` function in KYCRequirementsDemoDApp submitting the usual (a, b, c, inputs) proof parameters. If the check is passed he will receive an SBT and can use the DEX as a normal UniswapV2.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.galactica.com/galactica-developer-documentation/building-a-galactica-dapp/example-dapps/compliant-dex.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
