Skip to content

Commit

Permalink
update: documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
berzanorg committed Dec 28, 2023
1 parent a2cb355 commit 776c72a
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 48 deletions.
103 changes: 57 additions & 46 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,108 +1,119 @@
# Xane 📈

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

> Currently, only creating your own token is live. <br>
> It allows you to deploy your own token contract via your browser.
**Xane** is live at [xane.berzan.org](https://xane.berzan.org/).

**Xane** is live at [xane.pages.dev/tools](https://xane.pages.dev/tools).
> **Note**: Currently, the user interface is not functioning because there is no <br> backend server running on the web and there are issues with Mina nodes. <br>
> However you can visit it and see how it looks like.
## Prerequirements
You need [TypeScript](https://www.typescriptlang.org/) knowledge for smart contract development.
<br>
You need [Svelte](https://svelte.dev/) knowledge for user interface development.

You need [o1js](https://docs.minaprotocol.com/zkapps/o1js) knowledge for smart contract development.
<br>
You need [Rust](https://www.rust-lang.org/) knowledge for backend development.
You need [~~Rust~~](https://www.rust-lang.org/), (currently) [TypeScript](https://www.typescriptlang.org/) knowledge for backend development.
<br>
You also need [zkApps](https://docs.minaprotocol.com/zkapps) knowledge to have a general understanding of zkApps.



You need [Astro.js](https://astro.build/) & [Solid.js](https://www.solidjs.com/) knowledge for user interface development.

## Resources
[TypeScript](https://www.typescriptlang.org/) resource: [https://www.typescriptlang.org/docs/](https://www.typescriptlang.org/docs/)

[o1js](https://docs.minaprotocol.com/zkapps/o1js) resource: [https://docs.minaprotocol.com/zkapps/o1js](https://docs.minaprotocol.com/zkapps/o1js)
<br>
[Svelte](https://svelte.dev/) resource: [https://learn.svelte.dev/tutorial/welcome-to-svelte](https://learn.svelte.dev/tutorial/welcome-to-svelte)
[TypeScript](https://www.typescriptlang.org/) resource: [https://www.typescriptlang.org/docs/](https://www.typescriptlang.org/docs/)
<br>
[Rust](https://www.rust-lang.org/) resource: [https://doc.rust-lang.org/stable/book/](https://doc.rust-lang.org/stable/book/)
[Astro.js](https://astro.build/) resource: [https://docs.astro.build/en/getting-started/](https://docs.astro.build/en/getting-started/)
<br>
[zkApps](https://docs.minaprotocol.com/zkapps) resource: [https://docs.minaprotocol.com/zkapps](https://docs.minaprotocol.com/zkapps)



[Solid.js](https://www.solidjs.com/) resource: [https://www.solidjs.com/guides/getting-started#learn-solid](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](https://containers.dev/). <br>
You just need [Docker](https://www.docker.com/) and [VS Code](https://code.visualstudio.com/) installed to use [Dev Containers](https://containers.dev/). <br>
When you open the project in [VS Code](https://code.visualstudio.com/), it will warn you to repeon it in a container. <br>
It also contains six different [VS Code](https://code.visualstudio.com/) 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](https://nodejs.org/) and [Rust](https://www.rust-lang.org/).



If you prefer a more traditional way to setup a development environment, you only need to install the latest version of [NodeJS](https://nodejs.org/).

## Project Structure
This repository is a monorepo for the smart contracts, the user interface, and the backend of **Xane**.


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

## Smart Contracts
It currently contains both `Token` contract, and `Exchange` contract (which is not complete).

`Token` contract is a simple token standard.
It currently contains [`Token`](contracts/src/Token.ts), [`Exchange`](contracts/src/Exchange.ts) and [`Vault`](contracts/src/Vault.ts) smart contracts.
<br>
All the smart contracts are working as expected even tho they are non-secure implementations.

[`Token`](contracts/src/Token.ts) contract is a simple token standard implementation for Mina.
<br>
It has all the basic methods a token needs such as `mint`, `burn`, `transfer`, `approveUpdate`, `approveCallbackAndTransfer`, `approveUpdateAndTransfer`, etc.
<br>
Its unit tests reside in [`Token.test.ts`](contracts/src/Token.test.ts) file.

[`Exchange`](contracts/src/Exchange.ts) contract is a decentralized exchange
<br>
that currently allows placing, cancelling and executing a single order at a time.
<br>
It has methods such as `createPair`, `placeBuyOrder`, `cancelSellOrder`, `executeBuyOrder`, etc.
<br>
Its unit tests reside in [`Exchange.test.ts`](contracts/src/Exchange.test.ts) file.

`Exchange` contract is an order book based exchange (which is not complete).
[`Vault`](contracts/src/Vault.ts) contract is a vault that holds a specific token on behalf of the exchange.
<br>
It is created to support unlimited kind of tokens on the exchange.
<br>
Its unit tests reside in [`Vault.test.ts`](contracts/src/Vault.test.ts) file.

Smart contracts of **Xane** reside in [`contracts/`](https://github.com/BerzanXYZ/xane/tree/main/contracts) folder.
Smart contracts of **Xane** reside in [`contracts/`](contracts) folder.
<br>
So you have to change the current working directory before working with them.

```sh
cd contracts/
```

You can run all the tests by running the command below.
```sh
npm run test
```

You can also run a specific test by running the command below.
```sh
npm run test -- Token # or <TEST_NAME>
npm run test
```


## User Interface
The user interface of **Xane** is built using [SvelteKit](https://kit.svelte.dev/).

It resides in [`ui/`](https://github.com/BerzanXYZ/xane/tree/main/ui) folder.
The user interface of **Xane** is built using [Astro.js](https://astro.build/) & [Solid.js](https://www.solidjs.com/).

It resides in [`ui/`](ui) folder.
<br>
So you have to change the current working directory before working with it.

```sh
cd ui/
```

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

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


## Backend
The backend of **Xane** is built using [Rust Language](https://www.rust-lang.org/)

It resides in [`backend/`](https://github.com/BerzanXYZ/xane/tree/main/backend) folder.
The backend of **Xane** is built using [TypeScript](https://www.typescriptlang.org/) & [tinyhttp](https://tinyhttp.v1rtl.site/).

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

It resides in [`backend/`](backend) folder.
<br>
So you have to change the current working directory before working with them.
So you have to change the current working directory before working with it.

```sh
cd backend/
```

You can build the backend by running the command below.

```sh
cargo build # --release for production
npm run start # then the backend server will be live on localhost:3000
```


**Made with sweat 💦 and love ❤️ by [Berzan](https://twitter.com/BerzanXYZ).**
**Made with sweat 💦 and love ❤️ by [Berzan](https://berzan.org/).**
5 changes: 4 additions & 1 deletion ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

> Xane is an order book decentralized exchange on Mina Protocol.
> **Update:** All of the goals are implemented. However a long fixing session is required to make the UI functioning due to problems with Mina nodes.
## Goals For December, 2023.

- Use [`Astro.js`](https://astro.build/) & [`Solid.js`](https://www.solidjs.com/) instead of [`Svelte`](https://svelte.dev/) for the UI.
- Make `Exchange` smart contract work as expected.
- Implement storage of contract addresses of the tokens created by users on the backend.
Expand All @@ -14,4 +17,4 @@
- Implement order placing & execution.
- Make the UI display order-book.

> Xane is being developed by [Berzan](https://github.com/BerzanXyz).
> Xane is being developed by [Berzan](https://github.com/BerzanXyz).
2 changes: 1 addition & 1 deletion ui/src/pages/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import Layout from '../layouts/Layout.astro'
Trade
</a>
<a
href="/docs"
href="https://github.com/BerzanOrg/xane/blob/main/README.md"
class="flex items-center justify-center w-24 font-semibold bg-blue-500 rounded-full md:w-36 lg:w-40 xl:w-48 sm:w-28 h-9 sm:h-10 duration-75 text-lg md:h-12 md:text-xl lg:text-2xl lg:h-14 xl:text-3xl xl:h-16 hover:bg-blue-400"
>
Docs
Expand Down

0 comments on commit 776c72a

Please sign in to comment.