-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
62 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/).** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters