privx-exchange / privx-exchange-contract

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

privx-exchange-contract

PrivX, a decentralized exchange built on Aleo, will bring immense value to the ecosystem. By leveraging Aleo's privacy features, PrivX ensures anonymous and secure crypto trading, eliminating the concern for centralization. It enhances liquidity, and attracts privacy-conscious users, positioning Aleo as a leading blockchain platform for private and secured trading. Additionally, there are some other benefits that PrivX may bring to the Aleo ecosystem.

  • Attract new users: The privacy features of PrivX can attract new users to the Aleo ecosystem, who are looking for a secure and private way to trade crypto.
  • Increased adoption: The adoption of Aleo can be increased by the presence of a privacy-preserving DEX like PrivX. This is because PrivX will make it easier for users to access and trade Aleo-based assets.
  • Development of new privacy-preserving applications: The development of new privacy-preserving applications can be facilitated by the presence of PrivX, and our team will work and collaborate with these new projects to boost the ecosystem growth together.

We are still in developing stage & will publish plan and roadmap recently. Feel free to contact us via email: privx.exchange.lab@gmail.com, in case of any questions. Thanks for your interest!

Build Guide

To compile this Aleo program, run:

aleo build

Intruduction

You can trade in privx, which protects your privacy!

image

mapping

  • credits_balance: store the credits balance of users
  • credits_deposited: store the deposit credits amount of users, can be used to buy other token.
  • credits_locked: store the locked credits amount of users, the locked amount is buy Orders' credits amount.
  • token_balances: store the token balance of users
  • token_deposited: store the deposit token amount of users, can be used to buy other token.
  • token_locked: store the locked token amount of users, the locked token amount is sell Orders' token amount.
  • sequence: workaround to generate a seq id

struct

  • Order: the required data of an order

function

1.mint_credits

Params

  • address: the address to receive the credits
  • amount: the quantity of credits to mint

Description

Mint specify amount credits to an address.

2.deposit_credits

Params

  • amount: the amount of credits to move from credits_balance to credits_deposited

Description

Move specific amount credits from credits_balance to credits_deposited

3.withdraw_credits

Params

  • amount: the amount to move from credits_deposited to credits_balance

Description

Move specific amount credits from credits_deposited to credits_balance

4.mint_token

Params

  • address: the address to receive the token
  • amount: the amount of token to mint

Description

Mint specify amount arc20's token to an address.

5.deposit_token

Params

  • amount: the amount of credits to move from token_balance to token_deposited

Description

Move specific amount credits from token_balance to token_deposited

6.withdraw_credits

Params

  • amount: the amount to move from token_deposited to token_balance

Description

Move specific amount credits from token_deposited to token_balance

7.buy

Params

  • quantity: the order's quantity
  • price: the price willing to pay for single quantity of token

Description

decrease the credits_deposited, increase the credits_locked and generate a new buy Order with a seq id

8.sell

Params

  • quantity: the order's quantity
  • price: the price wiiling to sell for single quantity of token

Description

decrease the token_deposited, increaase the token_locked and genarate a new sell Order with a seq id

9.knockdown

Params

  • sell_order_id: the transaction's sell order id
  • buy_order_id: the transaction's buy order id

Description

Specify a sell order's id and a buy order's id and check whether the transaction conditions are met and if so, the transaction is completed.

10.cancel

Params

  • order_id: indicates which order to be canceled

Description

Cancel an order belongs to the caller, return back the locked amount to deposited amount

About

License:MIT License