๐Ÿ‘ฉโ€๐Ÿ’ป
Galactica Network Dev Documentation
  • ๐Ÿ“™Galactica Network Overview
  • ๐ŸงฌGalactica Concepts
    • โ›“๏ธBlockchain Base
    • ๐ŸงพZero-Knowledge KYC
      • Holder Commitment
      • DApp specific HumanID
      • Verification SBT
      • KYC Guardian
      • Galactica Investigation Module
      • Privacy Precautions
    • ๐ŸŒŸReputation
    • ๐Ÿ›‚Contingent Transactions
  • โš™๏ธGalactica Components
    • ๐ŸฆŠGalactica Snap for Metamask
    • ๐ŸŒณRoot Contracts
  • ๐Ÿ—๏ธBuilding a Galactica DApp
    • Example DApps
      • Compliant ERC20
      • Cypherbook
      • Compliant DEX
      • Sybil resistant airdrop
    • Front End
      • Guided Example
        • Connect to Galactica Snap
        • Prepare ZK proof generation
        • Generate and submit ZK proof
        • Handle Verification SBTs
      • Galactica Snap JSON-RPC API
    • Smart Contracts
    • Custom Zero Knowledge Disclosures
  • ๐Ÿ“Guardian Guide
    • Setup to become a Guardian
    • Create and issue ZK certificate
      • ๐ŸชชzkKYC (GIP-1)
      • Arbitrary ZK data certificate (GIP-2)
      • X/Twitter ZK certificate (GIP-3)
      • REY X/Twitter Score ZK certificate (GIP-4)
      • Decentralised Exchange (DEX) ZK certificate (GIP-5)
      • Centralised Exchange (CEX) ZK certificate (GIP-6)
      • Telegram ZK certificate (GIP-7)
  • โ›๏ธValidator Guide
    • ๐Ÿ”งInstallation
    • ๐Ÿ”—Become a Validator
    • ๐Ÿš€galacticad CLI Usage Cheat Sheet
    • ๐Ÿ”’Security Best Practices
  • ๐ŸงชTestNet: Reticulum
    • Release Notes
  • ๐ŸงชDevNet: Andromeda
    • Release Notes
  • ๐Ÿ“ŽChangelog
Powered by GitBook
On this page

Was this helpful?

  1. Building a Galactica DApp
  2. Example DApps

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.

PreviousCypherbookNextSybil resistant airdrop

Last updated 6 months ago

Was this helpful?

๐Ÿ—๏ธ