From 776c72ae7b66fed2452c640ebad4cae148af68ac Mon Sep 17 00:00:00 2001 From: Berzan Date: Thu, 28 Dec 2023 13:24:59 +0000 Subject: [PATCH] update: documentation --- README.md | 103 ++++++++++++++++++++++----------------- ROADMAP.md | 5 +- ui/src/pages/index.astro | 2 +- 3 files changed, 62 insertions(+), 48 deletions(-) diff --git a/README.md b/README.md index 7cc30a8..bde1d62 100644 --- a/README.md +++ b/README.md @@ -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.
-> 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
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 [TypeScript](https://www.typescriptlang.org/) knowledge for smart contract development. -
-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.
-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.
-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)
-[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/)
-[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/)
-[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/).
You just need [Docker](https://www.docker.com/) and [VS Code](https://code.visualstudio.com/) installed to use [Dev Containers](https://containers.dev/).
When you open the project in [VS Code](https://code.visualstudio.com/), it will warn you to repeon it in a container.
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. +
+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. +
+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`](contracts/src/Token.test.ts) file. + +[`Exchange`](contracts/src/Exchange.ts) 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`](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. +
+It is created to support unlimited kind of tokens on the exchange. +
+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.
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 +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.
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.
-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/).** diff --git a/ROADMAP.md b/ROADMAP.md index 0f5084b..5716f6e 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -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. @@ -14,4 +17,4 @@ - Implement order placing & execution. - Make the UI display order-book. -> Xane is being developed by [Berzan](https://github.com/BerzanXyz). \ No newline at end of file +> Xane is being developed by [Berzan](https://github.com/BerzanXyz). diff --git a/ui/src/pages/index.astro b/ui/src/pages/index.astro index 58a64ed..0c7b34f 100644 --- a/ui/src/pages/index.astro +++ b/ui/src/pages/index.astro @@ -23,7 +23,7 @@ import Layout from '../layouts/Layout.astro' Trade Docs