Skip to content

Latest commit

 

History

History
121 lines (85 loc) · 4.66 KB

README.md

File metadata and controls

121 lines (85 loc) · 4.66 KB

Xane 📈

Xane (IPA: /seɪn/) is a zero knowledge order book decentralized exchange.

Xane is live at xane.berzan.org.

Xane banner

Note: Currently, the user interface is not functioning because there is no
backend server running on the web and there are issues with Mina nodes.
However you can visit it and see how it looks like.

Prerequirements

You need o1js knowledge for smart contract development.
You need Rust, (currently) TypeScript knowledge for backend development.
You need Astro.js & Solid.js knowledge for user interface development.

Resources

o1js resource: https://docs.minaprotocol.com/zkapps/o1js
TypeScript resource: https://www.typescriptlang.org/docs/
Astro.js resource: https://docs.astro.build/en/getting-started/
Solid.js resource: https://www.solidjs.com/guides/getting-started#learn-solid

Setup A Development Environment

The easiest way to setup a development environment is to use Dev Containers.
You just need Docker and VS Code installed to use Dev Containers.
When you open the project in VS Code, it will warn you to repeon it in a container.
It also contains six different VS Code extensions that will help you during the development.

If you prefer a more traditional way to setup a development environment, you only need to install the latest version of NodeJS.

Project Structure

This repository is a monorepo for the smart contracts, the user interface, and the backend server of Xane.

Smart Contracts

It currently contains Token, Exchange and Vault smart contracts.
All the smart contracts are working as expected even tho they are non-secure implementations.

Token contract is a simple token standard implementation for Mina.
It has all the basic methods a token needs such as mint, burn, transfer, approveUpdate, approveCallbackAndTransfer, approveUpdateAndTransfer, etc.
Its unit tests reside in Token.test.ts file.

Exchange contract is a decentralized exchange
that currently allows placing, cancelling and executing a single order at a time.
It has methods such as createPair, placeBuyOrder, cancelSellOrder, executeBuyOrder, etc.
Its unit tests reside in Exchange.test.ts file.

Vault contract is a vault that holds a specific token on behalf of the exchange.
It is created to support unlimited kind of tokens on the exchange.
Its unit tests reside in Vault.test.ts file.

Smart contracts of Xane reside in contracts/ folder.
So you have to change the current working directory before working with them.

cd contracts/

You can run all the tests by running the command below.

npm run test

User Interface

The user interface of Xane is built using Astro.js & Solid.js.

It resides in ui/ folder.
So you have to change the current working directory before working with it.

cd ui/

You can start a development server by running the command below.

npm run dev #  then visit localhost:4321 too see the preview

Backend

The backend of Xane is built using TypeScript & tinyhttp.

It acts like an authority that is responsible for storing data and generating proofs.

It resides in backend/ folder.
So you have to change the current working directory before working with it.

cd backend/

You can build the backend by running the command below.

npm run start # then the backend server will be live on localhost:3000

Made with sweat 💦 and love ❤️ by Berzan.