# Algodex Documentation

Decentralized Exchange Built on Algorand

## Welcome to the official documentation of Algodex!

[Algodex](https://app.algodex.com/about) is a decentralized order book exchange built on the Algorand blockchain. Our platform offers users a way to trade multiple different Algorand Standard Assets using limit or market orders. The funds on the platform are held escrows via smart contracts on the blockchain, and the order book itself is also on-chain. Algodex is currently compatible with MyAlgo Wallet and Pera Wallet.

[Algodex Mailbox](https://mailbox.algodex.com/) is a decentralized web application that allows users to send Algorand Standard Assets even if recipients have not opted into the asset. View our guide on Algodex Mailbox [here](/algodex-mailbox/mailbox-user-guide).

### Why Algodex?

**Community Focused**&#x20;

52% of our token, ALGX, is allocated to community-related distributions such as rewards, airdrops, and more! Community is extremely important in the crypto world, and since day one, we have wanted to build a strong community, not just a product. Learn more about how our token (ALGX) is [distributed](/rewards-program/algx-tokenomics).

**Open Source**

Our source code is 100% open source and our repositories be found here: <https://www.github.com/algodex>

**Innovative Rewards Program**

Our liquidity rewards program greatly rewards and incentivizes users to provide high quality liquidity on Algodex. Learn more about [Liquidity Provider Rewards.](/rewards-program/algx-liquidity-rewards-program)

**Risk Management**

Our team works hard to ensure that users are safe to use our platform. In December of 2021, we underwent a Security Audit Report for Algodex contracts. Learn more about this [here](https://github.com/runtimeverification/publications/blob/main/reports/smart-contracts/Algodex_Dec.pdf).

**User Friendly**

Since the beginning, we envisioned our platform being as user-friendly as possible, so that anyone can trade Algorand Standard Assets. We are constantly working to improve our UIX. We also understand that market making is a difficult task, and many users want to reap the rewards of providing high level liquidity, so we built a market maker bot. By using our Market Maker bot, users can easily provide high quality liquidity to the Algodex! Learn more about the Market Maker Bot [here](/algodex/trading-bot-guide).


# Algodex FAQ

Updated October 11th, 2022

### What is Algodex?

[Algodex](https://app.algodex.com/about) is a decentralized marketplace where users can trade Algorand Standard Assets (ASAs). Our order-book model is the first of its kind on the Algorand blockchain, which gives users full control over their trades. Algodex's feature-packed platform brings a unique way of trading to the Algorand ecosystem.

### How does Algodex work?

Algodex uses Algorand smart contracts to create an order book mechanism for Algorand Standard Assets (ASA) that allows users to transact any ASA at a price the user chooses. Users can add or fulfill orders from the order book using Algodex's online interface. Learn more about Algodex and how it works by reading our [whitepaper](/archives/algodex-whitepaper-v1).

### What Algorand Standard Assets can be traded on Algodex?

All Algorand Standard Assets can be listed on Algodex, except for scam tokens that are proven fraudulent or illegal. These measures are in place to protect users from known scams while maintaining decentralization.

### How do I list my token on Algodex?

Newly created Algorand Standard Assets (ASA) will be available for immediate trading on Algodex. You can add liquidity to your ASA on Algodex by searching for it by the asset ID and placing a buy or sell order.

### **I am from North America. Why are some tokens restricted?**

The legislation in the U.S does not allow peer-to-peer trading for securities, so only projects that have legal opinions stating that their tokens are not securities can be listed and traded on Algodex. Currently, $USDC, $USDt, $STBL, $goBTC, $goETH, $gALGO, $goMINT, all non-fungible tokens (NFTs), and wrapped assets ($STBL2, $GARD, $pBTC, $xSOL, $goUSD, $gALGO3, $rUSD, and $wALGO) are tradeable for users residing in North America.

### **Where can I apply for a North American token listing?**

Please fill out [this form](https://docs.google.com/forms/d/1u-FEsfuVuGvindWUiTbPjGZ-5KgRHGWNtUNnRiUf1FY/viewform?edit_requested=true) to apply to be listed on the Algodex exchange for North American trading. This form is only required for tokens that want to be listed and tradeable in North America, as the rest of the world can currently trade ASAs without restrictions.

### Where can I follow Algodex and keep up with announcements?

You can follow Algodex on the following social media websites:

* Twitter: [@AlgodexOfficial](https://twitter.com/AlgodexOfficial/)
* Telegram:
  * [t.me/AlgodexAnnouncements](https://t.me/algodexannouncements)
  * [t.me/algodex](https://t.me/algodex)
* Reddit: [reddit.com/r/Algodex](https://www.reddit.com/r/algodex)
* Discord: [discord.gg/qS3Q7AqwF6](https://t.co/bNVOpvAx5B)

### What Algorand wallets are supported?

Currently, only MyAlgo Wallet is supported. Pera Wallet support is in the works and will be available soon.

### Are there fees for using Algodex?

Currently, there are no trading fees on Algodex. The only fee currently is the Algorand network fee which applies to all Algorand transactions.

### Who can use Algodex?

Currently, users can connect to Algodex from all regions.

### Is Algodex safe to use?

Trading on Algodex is secure. Using Algorand smart contracts, all order placements and executions are handled entirely on the Algorand blockchain. Funds are never directly held or processed by Algodex. Additionally, we have been [fully audited](https://github.com/runtimeverification/publications/blob/main/reports/smart-contracts/Algodex_Dec.pdf) by Runtime Verification Inc. This ensures that the platform's safety and user experience is of highest quality.

### How do I trade on Algodex?

Learn to place a trade on Algodex using our [guide](/algodex/trading-guide).

### What's the difference between Testnet and Mainnet?

Algorand Standard Assets (ASAs) on Testnet are priced using Testnet ALGO, a currency that has no value. ASAs on Mainnet are priced in ALGO, which have real value. A user can use Testnet to try new features or learn about Algodex.

### **How long did the incentivized Testnet last?**

The incentivized Testnet started on August 26, 2021, and ended at 23:59:59, February 09, 2022 (EDT).

### **How can I receive ALGX rewards?**

Users can receive rewards by providing [high-quality liquidity](/rewards-program/algx-liquidity-rewards-program) to Mainnet, or by participating in community events.

### **What can I do on Mainnet to be eligible for rewards?**

* Have tight spreads
* Consistent market maker uptime (keep consistent liquidity on the order book)
* Keep enough liquidity on the platform
* Hold ALGX in your wallet
* Make sure there is plenty of order book depth
* Trade verified pairs only

You can refer to our [Liquidity Rewards Program](/rewards-program/algx-liquidity-rewards-program) for more details.

### What if I have an issue or suggestion?

You can submit issues or suggestions to our [support page](https://app.algodex.com/support).

### Does Algodex support NFTs?

NFTs can be listed and traded on Algodex like any Algorand Standard Asset. Algodex intends to launch a dedicated interface for NFT trading in the future.

### What is Algodex Token (ALGX)?

The Algodex Token, symbol ALGX, is an ASA that has been publicly tradeable since May 31, 2022. ALGX functions as a form of governance for all token holders. Voting rights on future Algodex policies will be given through a decentralized autonomous organization, or DAO. Votes per token holder will be proportional to the amount of ALGX they hold. Learn more about ALGX by viewing our [whitepaper](/archives/algodex-whitepaper-v1), [tokenomics](/rewards-program/algx-tokenomics), or [archived airdrop plan](/archives/algx-airdrop-plan).

### **Where can I buy Algodex Token (ALGX)?**

You can buy ALGX tokens on these exchanges: [Algodex](https://app.algodex.com/trade/724480511?cc=HK), [Tinyman](https://app.tinyman.org/#/swap?asset_in=0\&asset_out=724480511), [Algotrade](http://algotrade.app/asa/724480511), and [BitMart](http://bitmart.com/trade/en?layout=basic\&symbol=ALGX_USDT). We plan to list ALGX tokens for trading on other exchanges in the future.


# Trading Guide

#### Accessing Mainnet:

Navigate to [app.algodex.com](https://app.algodex.com/about) to trade on Mainnet. Please note that these are real assets and your money could become lost. It is advised that you read over the [Terms of Service](https://app.algodex.com/algodex_tos.pdf). US and Canadian users will be restricted to certain assets only.

#### Connecting a Wallet:

*Note: Cursor is represented by yellow indicator in photos*

1. Create a [MyAlgo](https://wallet.myalgo.com/new-account) wallet. If you already have a wallet, ignore this step.
2. Go to [app.algodex.com](https://app.algodex.com/about)
3. Click the "CONNECT WALLET" button.

![](https://user-images.githubusercontent.com/107652076/178598747-6037b1ad-810f-4326-a83d-3c60b65d3f26.png)

4\. Ensure popup blocker is disabled so MyAlgo wallet can prompt a login.

5\. Login and select the wallet you wish to connect.

![](https://user-images.githubusercontent.com/107652076/178598762-e0b91e3e-d254-4b4f-ad6d-cdf949020cbf.png)

#### Placing a Limit Order:

1. Find the asset you want to trade in the navigation pane.

![](https://user-images.githubusercontent.com/107652076/178598774-93285d47-58e5-4112-9301-6c47ceca27dd.png)

2\. Click the "LIMIT" button.

![](https://user-images.githubusercontent.com/107652076/178598793-94c99094-afd9-4b35-aab2-050905592d0a.png)

3\. Enter your order information in the bottom right. (Tip: you can select an open order in the order book tab to autofill the price)

![](https://user-images.githubusercontent.com/107652076/178598802-0b7c9202-eb4b-4bb0-ad3d-5a413cd3fa48.png)

4\. Click the "BUY" or "SELL" button.

![](https://user-images.githubusercontent.com/107652076/178598813-a834fb38-e6dc-4242-84e2-9ad20e05c3ca.png)

5\. Sign the transaction in the MyAlgo wallet popup.

![](https://user-images.githubusercontent.com/107652076/178598832-34b04cc1-4b04-405d-8e9d-3053777bae32.png)

6\. Once made, view your order in the "OPEN ORDERS" button. If your order executes immediately, see your assets change in the "ASSETS" menu.

#### Placing a Market Order:

1. Find the asset you want to trade in the navigation pane.

![](https://user-images.githubusercontent.com/107652076/178598847-e3cc10c9-97b6-4c28-9001-cb7ba211223c.png)

2\. Click the "MARKET" button.

3\. Enter your order information in the bottom right. (Tip: you can select an open order in the order book tab to autofill the price).

![](https://user-images.githubusercontent.com/107652076/178598855-34cc577d-4f75-4db0-a14d-730c1717a467.png)

4\. Click the “BUY …” or “SELL …” button.

![](https://user-images.githubusercontent.com/107652076/178598869-abb2a3a8-7bc0-44e3-9c6c-efe5bccb50fd.png)

5\. Sign the transaction in the MyAlgo wallet popup.

![](https://user-images.githubusercontent.com/107652076/178598883-c9341a3e-1109-494c-81ba-680fdb033f94.png)

6\. Once made, see your assets change in the “ASSETS” menu. Market orders usually execute immediately so nothing will change in the “OPEN ORDERS” menu.

#### Cancelling an Order:

1. Click the “OPEN ORDERS” button.
2. Click the “X” button on the order you wish to cancel.

![](https://user-images.githubusercontent.com/107652076/178598899-f8f41d25-bac9-45ac-a4dd-dd59f2a75794.png)

3\. Sign the transaction in the MyAlgo wallet popup.


# Trading Bot Guide

Updated: November 23rd, 2022

## **Overview**

The [Algodex Trading Bot](https://tradingbot.algodex.com/) allows users to automatically place orders onto Algodex and accrue ALGX rewards over time by providing high-quality liquidity. The bot currently uses [Tinyman](https://tinyman.org/) as a price oracle. Please refer to the [ALGX Liquidity Rewards Program docs](/rewards-program/algx-liquidity-rewards-program) to understand how rewards get calculated before market making.

The bot is fully open source can be run via CLI or GUI. For CLI instructions please navigate to the [Github repository](https://github.com/algodex/trading-bot). For GUI instructions, see below. The bot is hosted [here](https://tradingbot.algodex.com/en/mainnet).

## Connecting a Wallet

Users connect to the bot with a wallet by clicking the “INPUT MNEMONIC” button. Afterwards, a second screen will appear where the user must import their wallet using the Mnemonic Phrase. Finally, the user will create a passphrase that allows them to quickly log into their wallet. This passphrase is stored locally, and if it is forgotten, users will have to clear and re-enter the Mnemonic Phrase.

![](/files/nqW1CGoYIQFdKd1F2xfO)

![](/files/hv6UCYtLMW9U1ev03sCF)

![](/files/xw0d0hPJIuiVBCpmLm6U)

## Select an Asset

Users will select an asset by entering an asset ID or an asset name and selecting the corresponding asset from the dropdown menu. It is recommended you enter the asset ID to ensure you market make on the correct asset. Please be cautioned that Algodex is not responsible for refunding users on lost funds from usage of the bot. To use the bot, a user must have both ALGO and the selected asset in their wallet.

<img src="/files/SD6tsYXEvRc8CWS2Af3v" alt="" data-size="original">

## Selecting an Order Size

Next, users will select an order size (in ALGO). Users can input an order size by using the numerical entry box or they can click and drag the slider. A notification will appear that will tell a user if they are eligible or are not eligible for ALGX rewards based on their current settings.

The order size is equal to the order size placed on one side of the market. For example, if a user is trading an Algorand Standard Asset (ASA) currently worth 0.50 ALGO, and the order size is set to 50, an order of 100 of the ASA and 50 ALGO will occur – totaling 100 ALGO. These amounts are supposed to be adjusted based on asset price changes.

![](/files/faq1KeFxMKvs8zatbzmC)

## Selecting a Spread Percentage

Next, a user will select a spread percentage to place their orders at. Users can input a spread percentage in the numerical entry box or they can click and drag the slider. The spread percentage is defined as the percent difference between a users Bid and Ask order with the mid-market price. A smaller spread percentage will result in qualification for greater ALGX rewards; however, they are more likely to fill – therefore there is a trade-off between spread percentage and uptime. A notification will appear that will tell a user if they are or are not eligible for ALGX rewards based on their current settings.

![](/files/Ak7wf1ZkFtzx3NVcbWXx)

## Selecting Number of Orders

Users will select the number of orders they would like to place on each side of the market. For example, if a user inputs the number 2, then 2 bids and 2 asks will be placed for the selected asset. Users can input an integer in the numerical entry box or they can click and drag the slider.

![](/files/lP1FwLUgIRP0EqMDtmF9)

## Advanced Options

Advanced options are not necessary to configure. The default setting for Nearest Neighbor Keep is half of the spread percentage. It is not recommended to adjust these settings unless you are an experienced market maker.

#### **Nearest Neighbor Keep**

Nearest Neighbor Keep allows a user to select the tolerance of the bot regarding cancelling and replacing orders as the selected asset's price changes. This setting is based on the user's specified spread percentage. If a user’s current order is not within the percentage set for Nearest Neighbor Keep, the bot will not cancel and replace until the selected asset price goes above the threshold set. For example, if a user has a spread percentage of 1.0%, and a Nearest Neighbor Keep of 0.5, then the asset price change threshold is 0.5% - meaning that the price of the selected asset must move at least 0.5% before an order is cancelled and replaced.

![](/files/l2ylDEm42Ru9EgQvEFkm)

## Starting and Stopping the Bot

To start the bot, simply press the “START BOT” button.

![](/files/4WpIVAp1lg2YuOIsdzxT)

To stop the bot, simply press the “STOP BOT” button.

![](/files/GRXS2Re1ao8wIwsgnDRS)

## Logs

The logs list will populate with information on each placed and cancelled order.

Users can change the logs settings to specify how many messages they would like to view. This is done by entering a number in the numerical entry box or clicking and dragging the slider. This defaults to 1000 messages.

![](/files/2fELGPs17MdkVYXSMKhJ)


# Token Listing Guide

Updated: November 16th, 2022

Token listing is an easy and free method for projects to list any token on Algodex — plus, it's completely free and permissionless!

## Creating a Token

The first step is to create an Algorand Standard Asset (ASA) if your project has not done so already. The Algorand Foundation has guides for the creation of each type of Token:

* [NFTs](https://developer.algorand.org/docs/get-started/tokenization/nft/)
* [Fungible Tokens](https://developer.algorand.org/docs/get-started/tokenization/ft/)
* [Securitized Tokens](https://developer.algorand.org/docs/get-started/tokenization/security_token/)

## Allocating Tokens to Algodex

The next step is to allocate tokens to Algodex by placing limit sell orders of your project's token at varying price points. To do this, first connect the wallet with the tokens to Algodex. Next, use the search bar to search for your projects token ID.&#x20;

![](/files/L4FambQisPsL9gwLoxuv)

Finally, use panel on the right side of the screen to set a price in ALGO, and set how many tokens you would like to list at that price point.

![](/files/tcYhi80hc8gNjPtQ0WZ4)

Once successfully completing those steps, you will see the order placed in the order book.

![](/files/VmHxR4f94OpnG6KdItm9)

Your projects token will now be listed on Algodex and will be tradable in countries that do not have restrictions. The next step is to share the Algodex trading link (URL) to social media and to your projects website or documentation so users know that trading is active!&#x20;

![URL of an example token on Algodex (Testnet)](/files/s9KhQb317KbBk27G827K)


# Mailbox FAQ

Updated March 30, 2022

### What is Algodex Mailbox?

[Algodex Mailbox](https://mailbox.algodex.com/) is a decentralized web application that allows users to batch send any Algorand Standard Asset (ASA) to other users even if the recipient has not opted into the ASA. Users who have been sent ASAs through Algodex Mailbox can redeem the ASAs via the website.

### How do I use the Algodex Mailbox?

Learn to use Algodex Mailbox using our [guide](/algodex-mailbox/mailbox-user-guide).

### How does Algodex Mailbox Work?

Algodex Mailbox uses Algorand smart contracts to create an escrow that holds sent Algorand Standard Assets before they are redeemed. The smart contract escrow exists entirely on the Algorand blockchain so nobody, including Algodex Mailbox, can access the escrow except for the sender and recipient.

### What Algorand Standard Assets can be sent using Algodex Mailbox?

All Algorand Standard Assets (ASAs) on both Testnet and Mainnet can be sent via Algodex Mailbox.

### **How many Algorand Standard Assets can I send to one or more recipients at a time?**

Users can send one asset to one or as many recipients as you want at a time. Currently, Algodex Mailbox does not support sending multiple assets to one or more recipients at once.

### Are there fees for using Algodex Mailbox?

A fee of 0.05 ALGO is applied to the sender of a transaction for each recipient that redeems the Algorand Standard Assets (ASA) received. If the recipient does not redeem the ASAs, the 0.05 ALGO fee will not be applied. In addition, the Algorand network fee applies to all Algorand transactions.

### **How many ALGOs do I have to spend when sending a token to a recipient who has not added the asset to the wallet?**

You will need 0.25 ALGO per recipient who has not opted in the asset for the minimum escrow balance. 0.2 ALGO will be returned to you after the recipient redeems the asset, and 0.05 ALGO will be paid as a fee.

### Who can use Algodex Mailbox?

Users from all countries and regions can use Algodex Mailbox.

### What if the recipient of a transaction never redeems the Algorand Standard Assets?

The sender of Algorand Standard Assets (ASA) can reclaim any unredeemed ASAs using Algodex Mailbox's Return Assets feature. Only the ASA sender can return assets to themselves. ASAs that have been redeemed by the recipient cannot be reclaimed by the sender.

### How many recipients can I send to at one time?

As many as you like! Algodex Mailbox allows you to configure a CSV file to specify the recipient(s) of an Algorand Standard Asset (ASA) and what quantity each recipient should receive. Learn how to send ASAs using a configurable CSV file using our [guide](/algodex-mailbox/mailbox-user-guide).

### Is Algodex Mailbox safe to use?

Using Algodex Mailbox is secure. Using Algorand smart contracts, all order placements and executions are handled entirely on the Algorand blockchain. Funds or Algorand Standard Assets (ASA) are never directly held or processed by Algodex. Once a recipient redeems any ASAs sent to them via Algodex Mailbox, it is not possible for the sender to reverse the transaction.

Please be aware that Algodex Mailbox has not yet been audited, however, extensive contract testing was done to ensure safety.

### What Algorand wallets are supported?

Currently, only MyAlgo Wallet is supported. Pera Wallet support is in the works and will be available soon.

### Where can I follow Algodex and keep up with announcements?

You can follow Algodex on the following social media websites:

* Twitter: [@AlgodexOfficial](https://twitter.com/AlgodexOfficial/)
* Telegram:
  * [t.me/AlgodexAnnouncements](https://t.me/algodexannouncements)
  * [t.me/algodex](https://t.me/algodex)
* Reddit: [reddit.com/r/Algodex](https://www.reddit.com/r/algodex)
* Discord: [discord.gg/qS3Q7AqwF6](https://t.co/bNVOpvAx5B)

### What's the difference between Testnet and Mainnet?

Algorand Standard Assets (ASAs) on Testnet are priced using Testnet ALGO, a currency that has no value. ASAs on Mainnet are priced in ALGO, which have real value. A user can use Testnet to try new features or learn about Algodex.

### What if I have an issue or suggestion?

You can submit issues or suggestions to our [support page](https://app.algodex.com/support).


# Mailbox User Guide

Updated July 28th, 2022

### Introduction

Algodex Mailbox is a decentralized web application that allows users to send Algorand Standard Assets (ASAs) on the Algorand blockchain to other users. Unlike alternative methods, Algodex Mailbox allows the sender to transfer an ASA to recipients, even if they are not opted into the ASA in their wallet. Algodex Mailbox achieves this by placing the ASA into a smart contract escrow that holds it until it is redeemed by the recipient. In order for a recipient to redeem the ASA from the smart contract escrow, the recipient must first opt-into the ASA, and then redeem it from our website.

You can try Algodex Mailbox on [Mainnet](https://mailbox.algodex.com/) or on [Testnet](https://mailbox-testnet.algodex.com).

### User Guide

{% embed url="<https://www.youtube.com/watch?t=1s&v=f_YZeqcvwq8>" %}

#### Sending an ASA

Send an Algorand Standard Asset to a list of Algorand wallet recipients. Tokens will be sent directly to recipients if they have opted in. Otherwise, the tokens will be held in escrow.

1. Click the "Send Assets" button.&#x20;

![](/files/tbz38cCU2sW9DCPt3cnF)

2\. Connect a MyAlgo Wallet by clicking the "CONNECT WALLET" button. &#x20;

![](/files/h7sm0xmAZhsot51CSWIN)

3\. Select the wallet you wish to connect.

4\. Enter the Asset ID of the ASA you wish to send in the "Asset ID" field.

5\. Send to either a single address or multiple addresses.

* If you send to a **single address**:&#x20;
  * Enter the address you wish to send the ASA to.
* If you send to **multiple addresses**:&#x20;
  * Download the template CSV by clicking the "Download CSV Example" button.
  * Open the downloaded CSV file.
  * Replace the sample data with the wallet addresses of your recipients and the amount you wish to send each recipient in the "ToWallet" field and the "Amount" field, respectively.
  * Upload your saved CSV file.

6\. Click the "SEND ASSETS" button.

{% hint style="warning" %}
Please be aware that you will need 0.25 ALGO per recipient who has not opted in for the minimum escrow balance.
{% endhint %}

{% hint style="warning" %}
0.2 ALGO will be returned to you after the recipient redeems the asset, and 0.05 ALGO will be paid as a fee.
{% endhint %}

#### Redeeming an ASA:

Redeem assets that have been sent to you via Algodex Mailbox.

1. Communicate with the ASA sender and record their wallet address and the asset ID of the ASA they sent you.
2. Opt-in to the ASA you wish to redeem in your MyAlgo Wallet.

![](https://user-images.githubusercontent.com/107652076/178599198-b2738853-92e4-4be4-9725-2bca09626041.png)

3\. Click the "Redeem Assets" button.

![](https://user-images.githubusercontent.com/107652076/178599207-e196503e-d707-4620-bd4d-04162a830d09.png)

4\. Enter the Asset ID of the ASA you wish to redeem in the "Asset ID" field.

5\. Enter the Algorand wallet address of the ASA sender in the "Sender Address" field.

6\. Enter your Algorand wallet address in the "Receiver Address" field.

7\. Click the "REDEEM" button.

![](https://user-images.githubusercontent.com/107652076/178599227-3c1b6113-2a39-43db-9b79-dabd0cfb7858.png)

{% hint style="info" %}
Please be aware that currently, a 0.05 Algo fee is paid during redemption by the sender to the dApp operator. The rest of the Algo balance is returned to the sender.
{% endhint %}

#### Viewing your ASA mail history:

View the transactions you have sent via Algodex Mailbox

1. Click the "Send History" button.

![](https://user-images.githubusercontent.com/107652076/178599242-4ea39ba2-ef0a-42fc-9998-d21e85f63a5d.png)

2\. Enter the Asset ID of the ASA you wish to view the transaction history of in the "Asset ID" field.

3\. Enter the Algorand wallet address of the ASA sender in the "Sender Address" field.

#### Return Assets:

Unsend and return any unredeemed ASA you have sent via Algodex Mailbox. Only the ASA\
sender can return assets to themselves. ASAs that have been redeemed by the recipient cannot be unsent and returned.

1. Click the "Return Assets" button.

![](/files/ts76JwRYCo2tzbFXkjk8)

2\. Connect a MyAlgo Wallet by clicking the "CONNECT WALLET" button.&#x20;

![](/files/vKFYfHyJ8WBnQdvAEPef)

3\. Select the wallet you wish to connect.

4\. Enter the Asset ID of the ASA you wish to send in the "Asset ID" field. &#x20;

![](/files/tK3iaDvlt4HxMKlEg3CL)

5\. Select if you want to return to a single address or return to multiple addresses.

* If you want to return to a **single address**:
  * Enter the receiver address.
* If you want to return to **multiple addresses**:
  * Download the template CSV by clicking the "Download CSV Example" button.&#x20;
  * Open the template CSV file.
  * Replace the sample data with the wallet addresses of your recipients and the amount you wish to return to each recipient in the "ToWallet" field and the "Amount" field, respectively.
  * Save the CSV file and return to the Algodex Mailbox webpage.
  * Click the "Upload CSV" button.
  * Select your saved CSV file.

{% hint style="info" %}
Tip: The template CSV file can be found at the bottom of the page.
{% endhint %}

![](/files/OCGJgoN56Xf91GF934pY)

6\. Click the "RETURN ASSETS" button.


# ALGX Liquidity Rewards Program

Updated: December 23rd, 2022

### Overview

This program incentivizes users to provide high quality liquidity to the [Algodex](https://app.algodex.com/about) platform.

The Mainnet rewards program is available to users who trade or have traded verified asset pairs on [Algodex](https://app.algodex.com/about). The Mainnet rewards is currently in version 2, and is ongoing.

Users can sign up for rewards on [rewards.algodex.com](https://rewards.algodex.com/). After a user connects their wallet, they will be eligible to receive rewards distributions, as well as view rewards earned in historical periods.

{% hint style="info" %}
Users who have high market maker uptimes and keep orders close to the current bid/ask spread will receive the most rewards. Total liquidity is a factor, however it is weighted less as a factor in the calculation of rewards.
{% endhint %}

### Liquidity Rewards Formula

Liquidity provider performance is calculated on a minute-by-minute basis using random sampling and is aggregated into a score ($$Q\_{MARKET}$$) for a given asset pair. Scores of asset pairs are then aggregated into a $$Q\_{FINAL}$$ score that depicts a users score across all assets. Liquidity providers earn weekly rewards based on their relative $$Q\_{FINAL}$$ proportion per week.

$$Q\_{MARKET} = SpreadGrade \times \sum\_{N=1}^{10,080}{Q\_{MIN(N)}=\[\frac {BidDepth\_{1}}{Spread\_{1}}+\frac {BidDepth\_{2}}{Spread\_{2}}+...+\frac {BidDepth\_{N}}{Spread\_{N}},\frac {AskDepth\_{1}}{Spread\_{1}}+\frac {AskDepth\_{2}}{Spread\_{2}}+...+\frac {AskDepth\_{N}}{Spread\_{N}}] }^{0.5}\times\[\sum\_{N=1}^{10,080}Count(Q\_{MIN(N)}>0)]^{5}$$

$$\times \[ALGX]^{0.2} \times\[\sum\_{N=1}^{10,080}(\frac{ProvidedLiquidity\_{N}}{AssetLiquidity\_{N}-ProvidedLiquidity\_{N}}+...+\frac{ProvidedLiquidity\_{N}}{AssetLiquidity\_{N}-ProvidedLiquidity\_{N}})]^{0.3}\times AssetGrade \times GlobalAlgorandDEXLiquidity^{0.65}$$

$$Q\_{MARKET} = SpreadTier \times {Q\_{PERIOD}}^{0.5} \times {Uptime\_{PERIOD}}^{5} \times ALGX^{0.2} \times LiquidityShare^{0.3} \times AssetGrade \times GlobalAlgorandDEXLiquidity^{0.65}$$

### Liquidity Rewards Details

<table data-header-hidden><thead><tr><th width="211"></th><th></th></tr></thead><tbody><tr><td><strong>Variable/Term</strong></td><td><strong>Description</strong></td></tr><tr><td><span class="math">BidDepth</span></td><td>The <span class="math">BidDepth</span> at a given price is defined as <span class="math">BidDepth = OrderVolume \times Bid Price</span>.</td></tr><tr><td><span class="math">AskDepth</span></td><td>The <span class="math">AskDepth</span> at a given price is defined as <span class="math">AskDepth = OrderVolume \times Ask Price</span>.</td></tr><tr><td><span class="math">Spread</span></td><td>The <span class="math">Spread</span> is the difference between the bid and ask prices.</td></tr><tr><td><span class="math">Q_{MIN}</span></td><td><span class="math">Q_{MIN}</span> is calculated every minute and rewards 2-sided liquidity by taking the minimum of <span class="math">Q_{BID}</span> and <span class="math">Q_{ASK}</span>.</td></tr><tr><td><span class="math">Q_{BID}</span></td><td>Calculated every minute using random sampling. <span class="math">Q_{BID}=\frac {BidDepth_{1}}{Spread_{1}}+\frac {BidDepth_{2}}{Spread_{2}}+...+\frac {BidDepth_{N}}{Spread_{N}}</span></td></tr><tr><td><span class="math">Q_{ASK}</span></td><td>Calculated every minute using random sampling. <span class="math">Q_{ASK}=\frac {AskDepth_{1}}{Spread_{1}}+\frac {AskDepth_{2}}{Spread_{2}}+...+\frac {AskDepth_{N}}{Spread_{N}}</span></td></tr><tr><td><span class="math">ALGX</span></td><td>Users must hold a minimum balance of 3,000 ALGX to accumulate rewards. Users that hold over 3,000 ALGX earn additional rewards according to the formula (<span class="math">ALGX^{0.2}</span>). This applies to Mainnet Version 2 only.</td></tr><tr><td><span class="math">SpreadTier</span></td><td>Users will receive a multiplier based on the grade their spread is in. This is described in further detail under the "<strong>Initial Maximum Spreads</strong>" section. This only applies to Mainnet Version 2.</td></tr><tr><td><span class="math">Q_{PERIOD}</span></td><td>The sum of all <span class="math">Q_{MIN}</span> in a given period (1 week). <span class="math">Q_{PERIOD}=\sum_{N=1}^{10,080} (Q_{MIN})_{N}</span>.</td></tr><tr><td><span class="math">Uptime_{PERIOD}</span></td><td>The time in a period that a given market maker was live and quoting on both the bid and ask sides with order sizes greater than the stated order minimum and spreads smaller than the stated maximum spread. Multiplying this factor by <span class="math">Q_{PERIOD}</span>normalizes it to account for uptime. An exponent of 5 is applied to <span class="math">Uptime_{PERIOD}</span> to greatly incentivize users to be as active as possible. For more about the <span class="math">Uptime_{PERIOD}</span> requirements, see the <a href="#additional-information-on">FAQ</a>.</td></tr><tr><td><span class="math">Q_{MARKET}</span></td><td>The score assigned to an individual address for a given market in one week.</td></tr><tr><td><span class="math">Q_{FINAL}</span></td><td>The final score assigned to an individual address for all eligible asset pairs in one week. It is the sum of all <span class="math">Q_{MARKET}</span>'s for an individual address in a given week.</td></tr><tr><td><span class="math">LiquidityShare</span></td><td>Calculated every minute using random sampling. The sum of<span class="math">ProvidedLiquidity</span> over <span class="math">AssetLiquidity</span>. This factor incentivizes users to provide liquidity to less-liquid pairs on Algodex. <span class="math">\sum_{N=1}^{10,080}(\frac{ProvidedBidLiquidity_{1}}{AssetBidLiquidity}+\frac{ProvidedAskLiquidity_{1}}{AssetBidLiquidity}+...+\frac{ProvidedBidLiquidity_{N}}{AssetBidLiquidity}+\frac{ProvidedAskLiquidity_{N}}{AssetBidLiquidity})</span></td></tr><tr><td><span class="math">AssetLiquidity</span></td><td>The total amount of liquidity on a given asset either on the bid or ask side.</td></tr><tr><td><span class="math">ProvidedLiquidity</span></td><td>The amount of liquidity a user provides to any given asset on either the bid or ask side. Limit orders that are not immediately filled with an existing order on the order book. Calculated every minute using random sampling.</td></tr><tr><td><span class="math">AssetGrade</span>​</td><td>Certain markets that are unrestricted in the US and Canada will receive a multiplier of <span class="math">3\times</span>. Providing liquidity to the ALGX/ALGO pair will receive a multiplier of <span class="math">2\times</span>. Other asset pairs will not receive a multiplier. More details on multipliers can be found <a href="#undefined">here</a>.</td></tr><tr><td>​<span class="math">GlobalAlgorand...</span></td><td><span class="math">GlobalAlgorandDEXLiquidity</span> takes the absolute amount of an asset's TVL (sourced from <a href="https://vestige.fi/">Vestige.fi</a> and is observed at the time rewards are calculated). This incentivizes users to provide liquidity to larger, well-known projects.</td></tr></tbody></table>

#### **Minimum Depth**

Orders below a certain minimum depth size per market are excluded. The US dollar amounts are calculated by applying the current ALGO-USD exchange rate.

<table data-header-hidden><thead><tr><th width="249.33333333333331"></th><th></th><th></th></tr></thead><tbody><tr><td><em>(in $USD)</em></td><td><strong>Minimum BidDepth</strong></td><td><strong>Minimum AskDepth</strong></td></tr><tr><td><strong>Mainnet Version 1</strong></td><td>$15</td><td>$30</td></tr><tr><td><strong>Mainnet Version 2</strong></td><td>$50</td><td>$100</td></tr></tbody></table>

#### **Initial Maximum Spreads**

Orders above a maximum mid-market spread will be excluded. $$Q\_{ASK}$$ and $$Q\_{BID}$$ will not be generated when the spread is above a given market's maximum spread. The initial maximum spreads are listed below and are subject to change. Spreads are measured in basis points (bps). One basis point is one-hundredth of one percent.

For Mainnet Version 1 the maximum spreads are 1000 bps (10%).

Mainnet Version 2 is broken up into grades and are applied to each order:

| $$SpreadTier$$ | **Range**              | **Multiplier** |
| -------------- | ---------------------- | -------------- |
| **A**          | 0-50 bps (0%-0.5%)     | $$10\times$$   |
| **B**          | 51-100 bps (0.51%-1%)  | $$2.5\times$$  |
| **C**          | 101-500 bps (1.01%-5%) | $$1\times$$    |

#### **Liquidity Rewards Tiers & Corresponding Rates**

<table data-header-hidden><thead><tr><th width="150"></th><th width="277.83747927031504"></th><th></th></tr></thead><tbody><tr><td><strong>Tier</strong></td><td><strong>Date Range</strong></td><td><strong>Amount</strong></td></tr><tr><td>Tier 1</td><td>February 10 - February 24 [0-2 weeks]</td><td>18,000,000 ALGX per week</td></tr><tr><td>Tier 2</td><td>February 25 - April 29 [3-12 weeks]</td><td>9,000,000 ALGX per week</td></tr><tr><td>Tier 3</td><td>April 30 - Present</td><td>3,819,600 ALGX per week</td></tr></tbody></table>

These rates apply to both versions of the Mainnet reward plans.

#### **Reward Calculation**

$$Q\_{FINAL}$$ is the final score assigned to an individual address for all eligible asset pairs. It is taken by summing up all $$Q\_{MARKET}$$ scores for a user. The rewards are distributed based on a simple formula:

$$Reward = \frac{Q\_{FINAL}}{Q\_{PLATFORM}}\times TierRate \times 360,000,000$$

$$Q\_{PLATFORM}$$ is the sum of all users $$Q\_{FINAL}$$ scores for the platform in a given period.

$$TierRate$$ is the rate described above (5%, 2.5%, 1.061%) which varies depending on the week of the program.

360,000,000 is the total supply of ALGX allocated to the rewards program.

### Liquidity Rewards FAQ

**How can I claim my rewards?**

Rewards will be automatically calculated and distributed to eligible wallets.

**Where can I sign up and track my rewards?**

The official rewards app has launched, and can be found at [rewards.algodex.com](https://rewards.algodex.com/). Users will be required to complete a simple sign-up process on the app after connecting their wallet. This sign-up process will require users to send an amount of 0 ALGO to themselves as proof of their participation.

Each week, liquidity providers earn a yield based on their relative $$Q\_{FINAL}$$ score. The Algodex rewards web app will show users how many rewards they have earned in each week, total earnings, and other statistics regarding rewards.

**What is mid-market spread?**

The spread between the highest qualifying bid price, and the lowest qualifying ask price in a given market. The mid-market spread takes the midpoint of the market. Qualifying criteria on bid and ask depth can be found[ here](#minimum-depth).

i.e., A bid price is $4,000 and the ask price is $4,100. The bid-ask spread is therefore $100, and the mid-market price is $4,050. Therefore, the mid-market spread is $50.

A user's spread is defined as the distance between their order's price and the midpoint of the lowest ask and highest bid on the orderbook.

**Exchange Rate**

Due to the volatile nature of cryptocurrency, this document provides details in terms of US dollars. The Algodex platform does not use US dollars, and instead uses Algo. Therefore, ALGO prices will be compared with the most current ALGO-USD exchange rate while calculating user eligibility.

**Vesting and Reward Distributions**

There is no vesting schedule for rewards. Once the rewards app launches, users will receive their rewards within 2 days of the end of the most recent period. Historical rewards that were earned before the release of the app will be distributed when the app launches.

The official rewards launch date is TBD, however, it will coincide with the rewards web app launch.

#### **Additional Information on** $$Uptime\_{PERIOD}$$

Score from $$Uptime\_{PERIOD}$$ will only count on orders in $$SpreadTier$$ A or $$SpreadTier$$ B. Orders that are in $$SpreadTier$$ C are still able to accrue score, but will not receive score from the factor $$Uptime\_{PERIOD}$$.&#x20;

*Note: Having* $$SpreadTier$$ *C orders will only accrue rewards if you have at least 1* $$SpreadTier$$ *A or* $$SpreadTier$$ *B order on both the bid and ask side of the market. This is necessary, as otherwise* $$Uptime\_{PERIOD}$$ *would be equal to 0, resulting in an overall score of 0.*

**Is the rewards code open source? If so, where is it located?**

The code is open-source, written in Rust, and can be found on GitHub [here](https://github.com/algodex/algodex-service/tree/development/rewards-calc).

#### AssetGrade Multipliers

This is the current list of assets that receive multipliers:

* USDC/ALGO = 3x
* STBL/ALGO = 3x
* STBL2/ALGO = 3x
* goBTC/ALGO = 3x
* goETH/ALGO = 3x
* gALGO/ALGO = 3x
* goMINT/ALGO = 3x
* USDT/ALGO = 3x
* GARD/ALGO = 3x
* pTokens BTC/ALGO = 3x
* xSOL/ALGO = 3x
* goUSD/ALGO = 3x
* ALGX/ALGO = 2x

All other assets eligible for rewards receive no multiplier.&#x20;

### Example Calculations

**1.** Calculating $$Q\_{BID}$$

Assume a liquidity providers has multiple open bid orders in the goETH market: 1goETH at $3,900; 5 goETH at $3,850; 10 goETH at $3,500. Assume goETH is currently trading at $4,000 (based on mid-market). Assume the minimum depth (for both bid and ask) is $100. Assume maximum spread is 100 bps (1%) and mid-market is $25; therefore, maximum spread vs. mid-market is $$\frac {$25}{$4,000}=62.5$$ bps.

$$Q\_{BID} = (\frac{1\times $3,900}{\frac{$100}{$4,000}})+(\frac{5\times $3,850}{\frac{$150}{$4,000}})+(\frac{10\times $3,500}{\frac{$500}{$4,000}}) = 949,333$$

{% hint style="info" %}
Note that all terms are included, as no term violates the maximum spread or minimum depths rules.
{% endhint %}

**2.** Calculating $$Q\_{ASK}$$

Assume a liquidity providers has multiple open ask orders in the goETH market: 1goETH at $4,100; 5 goETH at $4,150; 10 goETH at $4,175. Assume goETH is currently trading at $4,000 (based on mid-market). Assume the minimum depth (for both bid and ask) is $100. Assume maximum spread is 100 bps (1%) and mid-market is $25; therefore, maximum spread vs. mid-market is $$\frac {$25}{$4,000}=62.5$$ bps.

$$Q\_{ASK} = (\frac{1\times $4,100}{\frac{$100}{$4,000}})+(\frac{5\times $4,150}{\frac{$150}{$4,000}})+(\frac{10\times $4,175}{\frac{$175}{$4,000}}) = 1,524,019$$

{% hint style="info" %}
Note that all terms are included, as no term violates the maximum spread or minimum depths rules.
{% endhint %}

### 1. Mainnet Rewards - Version 1 \[February 10, 9:00:00, 2022 - June 2, 23:59:59, 2022]

Rewards are calculated using a modified version of the Liquidity Rewards Formula. Holding ALGX in a wallet is not a factor, therefore the term $$ALGX^{0.18}$$ is removed from the equation. Factor weights on $$Q\_{PERIOD}$$ and $$LiquidityShare$$ were increased by 25%. Additionally, having both buy and sell orders is not a factor in reward eligibility. The modified version of the Liquidity Rewards Formula is below:

$$Q\_{MARKET}={Q\_{PERIOD}}^{0.5625} \times {Uptime\_{PERIOD}}^{5} \times LiquidityShare^{0.3375} \times GlobalAlgorandDEXLiquidity^{0.1}$$

If a user did not place both a bid and ask order, the minimum function would return 0. Therefore, the median of 0 and $$MAX(Q\_{BID},Q\_{ASK})$$ will be used instead.

$$Q\_{PERIOD} = \sum\_{N=1}^{10,080}\[\frac {MAX(\frac{BidDepth\_{1}}{Spread\_{1}}+...+\frac{BidDepth\_{N}}{Spread\_{N}}, \frac{AskDepth\_{1}}{Spread\_{1}}+...+\frac{AskDepth\_{N}}{Spread\_{N}})}{2}]$$

### 2. Mainnet Rewards - Version 2 \[June 3, 0:00:00, 2022 – ongoing]

Rewards are calculated using the Liquidity Rewards Formula. June 3 is the 16th week of rewards, therefore the $$TierRate$$ will be a constant 1.061% until the end of the program (December 22, 2022). ALGX Held in a wallet is a contributing factor to the reward calculation. Having both buy and sell orders is another eligibility criteria.

### Eligibility

To be eligible for Mainnet rewards, the user must trade, or have traded verified asset pairs on Algodex between February 10, 9:00:00 and June 2, 23:59:59, for the original rewards system, or June 3, 0:00:00 and ongoing, for the improved rewards system. The rewards from Mainnet can be accrued by anyone committing the criteria.

### Terms

All specifics outlined in the above rewards plan are subject to change without notice.


# Community Leadership

Updated July 22nd, 2022

## Regional Leaders

### Why a diverse community?

Community is an essential part of every blockchain or crypto project. It is vital for a project to have a vibrant and diversified global community. While many can speak English, many others cannot or can only communicate a limited amount. Therefore, they need to join a community where they can speak freely in their native language. This demands establishing regional communities. As a result, these communities need leadership - therefore, we have Regional Leaders. Our project wants feedback from everyone!

### Who are Regional Leaders?

Regional Leaders are responsible, hard-working, enthusiastic, and eager-to-learn individuals that work on the front lines of communication and community support in regards to the Algodex.

### **Roles of a Regional Leader**

* Be in the forefront to lead communications and convey messages from the project to the community.
* Be a bridge to connect members with the project.
* Be a translator for any documents or announcements.
* Be an educator to educate the users, especially newcomers, about the project.
* Be a marketer promoting the project to the whole world.
* ... and so much more!

### **Tasks of a Regional Leader**

1. Manage and moderate a regional community.
2. Grow the member-base of the community.
3. Engage people to trust and praise the project (run events, games, quizzes, etc.).
4. Translate and spread all announcements, articles, and posts to the community.
5. Use designs, videos, photos, articles, or GIFs to educate people about Algodex and advertise the project on social media.
6. Q\&A and/or AMAs with the community on a regular basis.

### **Rewards Formula**

$$FinalComp = (TotalMembers\times 0.1\times%MonthlyChange+ActiveMembers\times1.5+ActiveDays\times(\frac{TierBaseComp}{30})\times 0.5 + NoOfMessages\times 0.1)\times Qualification$$

This is the mechanism that ranks regional leaders each month based on their relative performance.

### **How to become a Regional Leader of Algodex?**

Fill out this [application form](https://forms.gle/nf1HTRtVn9KAi8JT7) to apply for the role of regional leader, and you can lead a community of your language. Algodex will review the applications and reserves the right to select the most suitable candidates.

If you are chosen to become a leader, a member from the Algodex team will contact and onboard you with the process and other related details.

### **Growing regional communities**

:flag\_vn:Vietnam: <https://t.me/Algodex_VN>

:flag\_id:Indonesia: <https://t.me/algodexindonesia>

:flag\_tr:Turkey: <https://t.me/AlgodexTR>

:flag\_ru:Russia: <https://t.me/AlgodexRussia>

:flag\_pl:Poland: <https://t.me/algodex_poland>&#x20;

:flag\_ng:Nigeria: <https://t.me/AlgodexNigeria>

:flag\_cn:China: <https://t.me/AlgodexChinese>&#x20;

:flag\_in:India: <https://t.me/Algodex_India>

## Evangelists

Evangelists are the community's most active members other than the listed regional leaders. They actively help other members, market the project on social media, or have valuable suggestions for its development. Algodex will promote members to Evangelists manually according to their contributions and give them roles on the [Discord server](https://discord.com/invite/ngNzV8bBhy).

Compensation for these individuals will vary between $50 and $100 per month, depending on the contribution level.

As of July 1, 2022, Evangelists will be required to fill out an application form each month in which they will provide proof of the support to qualify for the rewards.


# ALGX Tokenomics

February 2, 2022

The Tokenomics for the Algodex Token (ALGX) can be found below.

![](https://user-images.githubusercontent.com/107652076/178598519-cf82bac8-5f4b-42bf-ae02-952698f8e74e.PNG)

![](https://user-images.githubusercontent.com/107652076/178598540-8ad3e1da-7e18-42ab-b019-24e442644534.PNG)


# Algodex SDK v2

Updated July 28th, 2022

### Overview

The Algodex Software Development Kit (SDK) 2.0 is for developers who wish to programmatically interact with Algodex. The SDK enables developers to integrate Algodex's exchange logic into their own DApp&#x73;**.** A robust description of the SDK can be found [**here**](https://docs-sdk.algodex.com), and the Github and setup instructions can be found [**here**](https://github.com/algodex/algodex-sdk).&#x20;

### Tutorials

1. [**Placing Orders**](/developer-tools/algodex-sdk-v2/tutorial-placing-orders)&#x20;
2. [**Order book**](/developer-tools/algodex-sdk-v2/tutorial-order-book)
3. [**Closing Orders**](/developer-tools/algodex-sdk-v2/tutorial-closing-orders)

### Setup

#### NPM

`npm install @algodex/algodex-sdk`

#### Yarn

yarn add @algodex/algodex-sdk

### Examples

#### \[WIP] Example Testnet Configuration \[config.json]

```
{
  "config": {
    "algod": {
      "uri": "https://testnet-algorand.api.purestake.io/ps2",
      "token": "<TOKEN>"
    },
    "indexer": {
      "uri": "https://algoindexer.testnet.algoexplorerapi.io",
      "token": ""
    },
    "explorer": {
      "uri": "https://indexer.testnet.algoexplorerapi.io",
      "port": ""
    },
    "dexd": {
      "uri": "https://api-testnet-public.algodex.com/algodex-backend",
      "token": ""
    }
  }
}
```

#### Example Mainnet Configuration \[config.json]

```
{
  "config": {
    "algod": {
      "uri": "https://mainnet-algorand.api.purestake.io/ps2",
      "token": "<TOKEN>"
    },
    "indexer": {
      "uri": "https://algoindexer.algoexplorerapi.io",
      "token": ""
    },
    "explorer": {
      "uri": "https://indexer.algoexplorerapi.io",
      "port": ""
    },
    "dexd": {
      "uri": "https://app.algodex.com/algodex-backend",
      "token": ""
    }
  }
}
```


# Tutorial : Placing Orders

You can think of [AlgodexApi#placeOrder](https://docs-sdk.algodex.com/AlgodexApi.html#placeOrder) as a toolbox: it's got everything you need to tackle order execution.

### Steps

1. Create a `new` instance of the [AlgodexApi](https://docs-sdk.algodex.com/AlgodexApi.html).
2. Set a default [Wallet](https://docs-sdk.algodex.com/Wallet.html) using [AlgodexApi#setWallet](https://docs-sdk.algodex.com/AlgodexApi.html#setWallet).
3. Generate an [Order](https://docs-sdk.algodex.com/Order.html) compatible object.
4. Pass in the [Order](https://docs-sdk.algodex.com/Order.html) object to [AlgodexApi#placeOrder](https://docs-sdk.algodex.com/AlgodexApi.html#placeOrder).

## Order Executions

{% hint style="info" %}
If you are unsure of which execution type to choose input `execution:'both'` and we'll handle the rest!
{% endhint %}

#### Details:

The [Order](https://docs-sdk.algodex.com/Order.html) object has an `execution` key that determines how the SDK will handle the [Order](https://docs-sdk.algodex.com/Order.html). Each `execution` will interact with the [Order book](/developer-tools/algodex-sdk-v2/tutorial-order-book) in different ways. Algodex supports the following executions: [Maker](#maker), [Taker](#taker), [Both](#both).

## Maker Order <a href="#maker" id="maker"></a>

A Maker Order will always be placed into the [Order book](/developer-tools/algodex-sdk-v2/tutorial-order-book). They can be either Buy or Sell order types.

### What is a Maker Order?

A Maker Order is an order that **does not** execute instantly. A maker order has no active takers, therefore it "makes" its own order to be fulfilled at a later date.

### Condition

When a user places an order, if no one immediately agrees to the terms of the order, the order is considered a Maker Order.

### Walkthrough

1. There are no existing orders in the [Algodex Order book](/developer-tools/algodex-sdk-v2/tutorial-order-book) that fulfill the user's criteria so they decide to "make" their own order.
2. The users submitted order is added to the [Algodex Order book](/developer-tools/algodex-sdk-v2/tutorial-order-book).
3. The order is now visible to other users of Algodex and will be fulfilled when another user agrees to "take" the order.

#### Buy Order \[<mark style="color:red;">JavaScript</mark>]

```javascript
//Buy Example:
const res = await api.placeOrder({
'asset': {
  'id': 15322902,
  'decimals': 6,
},
'address': 'WYWRYK42XADLY3O62N52BOLT27DMPRA3WNBT2OBRT65N6OEZQWD4OSH6PI',
'price': 3.22, // Limit price for the asset
'amount': 1, // Amount willing to purchase (The total amount sent will be price * amount)
'execution': 'maker',
'type': 'buy',
});
```

#### Sell Order \[<mark style="color:red;">JavaScript</mark>]

```javascript
// Sell Example:
const res = await api.placeOrder({
  'asset': {
    'id': 15322902,
    'decimals': 6,
  },
  'address': 'WYWRYK42XADLY3O62N52BOLT27DMPRA3WNBT2OBRT65N6OEZQWD4OSH6PI',
  'price': 80000, // Limit price for the asset to sell
  'amount': 1, // Amount of the asset for sale
  'execution': 'maker',
  'type': 'sell',
});
```

## Taker Order <a href="#taker" id="taker"></a>

A Taker Order will always execute existing orders in the [Order book](/developer-tools/algodex-sdk-v2/tutorial-order-book). They can be either Buy or Sell order types.

### What is a Taker Order?

A Taker Order is an order that executes instantly. A taker order closes or modifies an existing order in the [Algodex Order book](/developer-tools/algodex-sdk-v2/tutorial-order-book).

### Condition

There must be at least one existing order in the order book that fulfills the user's criteria. Therefore, the user "takes" from an existing order.

### Walkthrough

The user submitted order changes the state of the Order book in 1 of 3 ways:

1. The user does not "take" the entire order. The remainder of the order remains open.
2. The user takes the entire order removing it from the order book.
3. The user takes multiple orders, removing them from the order book.

#### Buy Order \[<mark style="color:red;">JavaScript</mark>]

```javascript
// Buy Example
const res = await api.placeOrder({
  'asset': {
    'id': 15322902,
    'decimals': 6,
  },
  'address': 'WYWRYK42XADLY3O62N52BOLT27DMPRA3WNBT2OBRT65N6OEZQWD4OSH6PI',
  'price': 3.22,
  'amount': 1,
  'execution': 'taker',
  'type': 'buy',
});
```

#### Sell Order \[<mark style="color:red;">JavaScript</mark>]

```javascript
// Sell Example
const res = await api.placeOrder({
  'asset': {
    'id': 15322902,
    'decimals': 6,
  },
  'address': 'WYWRYK42XADLY3O62N52BOLT27DMPRA3WNBT2OBRT65N6OEZQWD4OSH6PI',
  'price': 80000,
  'amount': 1,
  'execution': 'taker',
  'type': 'sell',
});
```

## Maker/Taker Order <a href="#both" id="both"></a>

Maker/Taker will first check the [Order book](/developer-tools/algodex-sdk-v2/tutorial-order-book) for existing orders that match the current order.

#### Buy Order \[<mark style="color:red;">JavaScript</mark>]

```javascript
  const res = await api.placeOrder({
    'asset': {
      'id': 15322902,
      'decimals': 6,
    },
    'address': 'WYWRYK42XADLY3O62N52BOLT27DMPRA3WNBT2OBRT65N6OEZQWD4OSH6PI',
    'price': 3.22,
    'amount': 1,
    'execution': 'both',
    'type': 'buy',
  });
```

#### Sell Order \[<mark style="color:red;">JavaScript</mark>]

```javascript
  const res = await api.placeOrder({
    'asset': {
      'id': 15322902,
      'decimals': 6,
    },
    'address': 'WYWRYK42XADLY3O62N52BOLT27DMPRA3WNBT2OBRT65N6OEZQWD4OSH6PI',
    'price': 80000,
    'amount': 1,
    'execution': 'both',
    'type': 'sell',
  });
```

## Advanced

#### There are multiple ways to place an order using our SDK.

If you are curious about the internal processes of placing an order and how they relate to the different execution types, the [Structure Module](https://docs-sdk.algodex.com/module-order_structure.html) is a great place to start.

Some users find it clunky to lug around a toolbox if they only need one or two tools.

If that sounds like you, we recommend checking out the [Buy](https://docs-sdk.algodex.com/module-txns_buy.html) & [Sell](https://docs-sdk.algodex.com/module-txns_sell.html) modules to get a better sense of what methods fit your use case.


# Tutorial: Order book

### What is an Order book?

An orderbook is a collection of Buy and Sell orders that were originally placed using a Maker execution type.

### Condition

If Algodex supports an asset then a unique orderbook exists for that asset.

### Walkthrough

1. A user is interested in the price of a particular asset so they fetch the Algodex orderbook related to that asset.
2. The Algodex order book contains the most recent unfulfilled Buy and Sell order's related to that asset.
3. An order remains in the order book until someone places an order using a Taker execution type.

#### Fetch Order book \[<mark style="color:red;">JavaScript</mark>]

When using `api.placeOrder()` if an orderbook is not provided we fetch the orderbook based off the asset id specified in the order object. However, it is possible to fetch the orderbook ahead of time, as shown in the example below.

```
order = {
  'asset': {
    'id': 15322902,
    'decimals': 6,
  },
  'address': 'WYWRYK42XADLY3O62N52BOLT27DMPRA3WNBT2OBRT65N6OEZQWD4OSH6PI',
  'price': 3.22,
  'amount': 1,
  'execution': 'taker',
  'type': 'buy',
}


const res = await api.http.dexd.fetchAssetOrders(order.asset.id)
const orderbook = api.http.dexd.mapToAllEscrowOrders({
  buy: res.buyASAOrdersInEscrow,
  sell: res.sellASAOrdersInEscrow,
 })

await api.placeOrder(order, {orderbook})
```


# Tutorial: Closing Orders

### Closing an Order from the [Order book](/developer-tools/algodex-sdk-v2/tutorial-order-book)

To close an order from the order book, a user must be connected to the wallet that created the order.

#### Cancel a Maker Order \[<mark style="color:red;">JavaScript</mark>]

```
const orders = await api.placeOrder({
'asset': {
  'id': 15322902,
  'decimals': 6,
},
'address': 'WYWRYK42XADLY3O62N52BOLT27DMPRA3WNBT2OBRT65N6OEZQWD4OSH6PI',
'price': 3.22,
'amount': 1,
'execution': 'maker',
'type': 'buy',
});
await api.closeOrder(orders[0])
```

**Finding a Single Open Order to Cancel \[**<mark style="color:red;">**JavaScript**</mark>**]**

If you do not have the order that you want to cancel, you can find all open orders under your wallet address by calling the internal method below. From there, cancelling an order is as simple as finding the specific order you would like to cancel, attaching your wallet to the order under the `wallet` property, and passing it into the `closeOrder` function.

This process is demonstrated in the example below.&#x20;

```
  const openOrders = await api.http.dexd.fetchOrders("wallet", api.wallet.address)

  const mappedOpenOrders = openOrders.map((order) => {
    return { ...order, wallet: api.wallet }
  })

  await api.closeOrder(mappedOpenOrders[0])
}
```

{% hint style="info" %}
Keep in mind that in this example, we are cancelling the first order in the open order's array. It is up to you to filter the specific order you wish to cancel.
{% endhint %}

**Cancelling All Existing Orders \[**<mark style="color:red;">**JavaScript**</mark>**]**

```
const openOrders = await api.http.dexd.fetchOrders("wallet", order.address)

  const mappedOpenOrders = openOrders.map((order) => {
    return { ...order, wallet: api.wallet }
  })

  await Promise.all(
    mappedOpenOrders.map((order) => {
      api.closeOrder(order)
    })
  )
```


# Algodex API v1

## 💱 Algodex API

[![algodex-php](https://github.com/algodex/algodex-api/actions/workflows/docker-image.yml/badge.svg?branch=main)](https://github.com/algodex/algodex-api/actions/workflows/docker-image.yml)

The following is the 1.0 backend API for Algodex. This is a DeFi service to allow users to trade assets on the Algorand network directly between each other, with wallets hosted elsewhere on MyAlgo Wallet.

The 2.0 backend is a major architectural refactoring and is currently under development.

### Endpoints

Algodex Mainnet: `https://app.algodex.com/[api here]`

Algodex Testnet: `https://testnet.algodex.com/[api here]`

## 📝 API Documentation

#### Fetching a list of all orders for an ASA

**Params**

* assetId: the asset ID to search orders for
* getAssetInfo (optional): set to true to also return asset information

**Example**

<https://testnet.algodex.com/algodex-backend/orders.php?assetId=15322902>

## Fetch Asset Orders

<mark style="color:blue;">`GET`</mark> `https://testnet.algodex.com/algodex-backend/orders.php`

Returns orders for an asset

#### Query Parameters

| Name                                      | Type     | Description |
| ----------------------------------------- | -------- | ----------- |
| assetID<mark style="color:red;">\*</mark> | 22295876 |             |

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
   "sellASAOrdersInEscrow":[
      {
         "assetLimitPriceInAlgos":"9000.000000000000",
         "asaPrice":"9000.000000000000",
         "assetLimitPriceD":9000,
         "assetLimitPriceN":1,
         "algoAmount":498000,
         "asaAmount":987,
         "assetId":22295876,
         "appId":22045522,
         "escrowAddress":"ZJO7QGK3KASYG35D5N4CSX76OKPQLLTLJ6CZ6YTEG4GGT2OC235UJI3U6M",
         "ownerAddress":"ACWISBRHEYQKVILSCEDNWCNOSTMIOQIHV3KLPBXHDZAJHVZT7AYM6PE6ZE",
         "version":6,
         "minimumExecutionSizeInAlgo":0,
         "round":20353010,
         "unix_time":1647328756,
         "formattedPrice":"900.000000",
         "formattedASAAmount":"0.00987",
         "decimals":5
      },
      // More...
   ],
   "buyASAOrdersInEscrow":[
      {
         "assetLimitPriceInAlgos":"10.000000000000",
         "asaPrice":"10.000000000000",
         "assetLimitPriceD":10,
         "assetLimitPriceN":1,
         "algoAmount":4530000,
         "asaAmount":0,
         "assetId":22295876,
         "appId":22045503,
         "escrowAddress":"7ULXUOXU5XQ76G2QZL5ZGQZMCFJBBXU72ZCDIS5KCCDHAOLZDW4XS5HNBQ",
         "ownerAddress":"AK6WGVO34V2QPTXCJYNDZC32ZQQCZMTC3SRYPWQR4CCW266YX2CKL6H3W4",
         "version":6,
         "minimumExecutionSizeInAlgo":0,
         "round":22651961,
         "unix_time":1657060128,
         "formattedPrice":"1.000000",
         "formattedASAAmount":"4.53000",
         "decimals":5
      },
      // More...
   ]
}
```

{% endtab %}
{% endtabs %}

#### Fetching a list of orders for a wallet

**Params**

* ownerAddr: the owner address to search orders for
* getAssetInfo (optional): set to true to also return asset information

**Example**

<https://testnet.algodex.com/algodex-backend/orders.php?ownerAddr=SPFRPFCZR4OSKKTCNGY5KOCS55RXWC6VJYU7SGQ4EUEVFIDUPAL4EKLJ3Q>

## Fetch Wallet Orders

<mark style="color:blue;">`GET`</mark> `https://testnet.algodex.com/algodex-backend/orders.php`

Returns orders for a wallet

#### Query Parameters

| Name                                        | Type      | Description |
| ------------------------------------------- | --------- | ----------- |
| ownerAddr<mark style="color:red;">\*</mark> | {address} |             |

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
    // Response
    
    "sellASAOrdersInEscrow":[],
    "buyASAOrdersInEscrow":[]
}

```

{% endtab %}
{% endtabs %}

#### Fetching the trade history for an ASA

**Params**

* assetId: the asset ID to search the trade history for
* getAssetInfo (optional): set to true to also return asset information

**Example**

<https://testnet.algodex.com/algodex-backend/trade_history.php?assetId=15322902>

## Fetch Asset TradeHistory

<mark style="color:blue;">`GET`</mark> `https://testnet.algodex.com/algodex-backend/trade_history.php`

Returns trade history for asset

#### Query Parameters

| Name    | Type     | Description |
| ------- | -------- | ----------- |
| assetId | 22295876 |             |

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
   "transactions":[
      {
         "PK_trade_history_id":666370,
         "transaction_id":null,
         "group_id":"jBVPEG4TgT8yxfC24lIqX6uKuo1nXy9tTX3b\/zlp8jk=",
         "unix_time":1657975266,
         "block_round":22863925,
         "application_id":22045503,
         "asset_id":22295876,
         "asaPrice":"10.000000000000",
         "algoAmount":2000,
         "asaAmount":200,
         "asaBuyerAddress":"AK6WGVO34V2QPTXCJYNDZC32ZQQCZMTC3SRYPWQR4CCW266YX2CKL6H3W4",
         "asaSellerAddress":"WE3IEXZEVEM63WYRA352BKEYN3F5I3ITNCJMKGUUROCNA3G5LEGDGJJDMQ",
         "tradeType":"sellASA",
         "formattedPrice":"1.000000",
         "formattedASAAmount":"0.00200"
      },
      // More...
   ]
}
```

{% endtab %}
{% endtabs %}

#### Fetching the trade history for a wallet

**Params**

* ownerAddr: the owner address to search the trade history for
* getAssetInfo (optional): set to true to also return asset information

**Example**

<https://testnet.algodex.com/algodex-backend/trade_history.php?ownerAddr=SPFRPFCZR4OSKKTCNGY5KOCS55RXWC6VJYU7SGQ4EUEVFIDUPAL4EKLJ3Q>

## Fetch Wallet TradeHistory

<mark style="color:blue;">`GET`</mark> `https://testnet.algodex.com/algodex-backend/trade_history.php`

#### Query Parameters

| Name                                        | Type      | Description         |
| ------------------------------------------- | --------- | ------------------- |
| ownerAddr<mark style="color:red;">\*</mark> | {address} | Wallet address      |
| getAssetInfo                                | true      | Boolean Query param |

{% tabs %}
{% tab title="200: OK " %}

```javascript
// Example response
{
   "allAssets": [
      {
         "created-at-round":15917936,
         "deleted":false,
         "index":22060777,
         "params":{
            "clawback":"XTEI2ZFNQJVFNOKZIS5WN7OVOKCUKGVL5MEBYSIVUXI76NAPR4G3KPFOJI",
            "creator":"XTEI2ZFNQJVFNOKZIS5WN7OVOKCUKGVL5MEBYSIVUXI76NAPR4G3KPFOJI",
            "decimals":2,
            "default-frozen":false,
            "freeze":"XTEI2ZFNQJVFNOKZIS5WN7OVOKCUKGVL5MEBYSIVUXI76NAPR4G3KPFOJI",
            "manager":"XTEI2ZFNQJVFNOKZIS5WN7OVOKCUKGVL5MEBYSIVUXI76NAPR4G3KPFOJI",
            "name":"WaveCoin",
            "name-b64":"V2F2ZUNvaW4=",
            "reserve":"XTEI2ZFNQJVFNOKZIS5WN7OVOKCUKGVL5MEBYSIVUXI76NAPR4G3KPFOJI",
            "total":20000000,
            "unit-name":"WAVE",
            "unit-name-b64":"V0FWRQ==",
            "url":"https:\/\/glasswave.co\/wavecoin",
            "url-b64":"aHR0cHM6Ly9nbGFzc3dhdmUuY28vd2F2ZWNvaW4="
         }
      }
    ],
    "transactions": [
        {
            "PK_trade_history_id": 666444,
            "transaction_id": null,
            "group_id": "B8kNQ9\/V\/GesMBDGLpfA69jOxZM2TBaC5B6VkFFcWT0=",
            "unix_time": 1658130896,
            "block_round": 22900760,
            "application_id": 22045503,
            "asset_id": 22060777,
            "asaPrice": "90000.000000000000",
            "algoAmount": 900000,
            "asaAmount": 10,
            "asaBuyerAddress": "ZXPEYJMWFLULILWJHWB3Y6DFI4ADE7XVMGARAH734ZJ5ECXAR4YVMRZ4EM",
            "asaSellerAddress": "TQS4D62BRXX6XQY72EESMUPYVNN45MP2UYHNXP7UTFKOMINDTJCC3N5XWU",
            "tradeType": "buyASA",
            "formattedPrice": "9.000000",
            "formattedASAAmount": "0.10"
        },
    ]
}
```

{% endtab %}
{% endtabs %}

#### Fetching all recently traded ASAs, their prices, and information

**Params**

None currently. This will eventually have different sort parameters.

#### Fetching chart info for an ASA

This currently returns the trades aggregated for the daily frequency. This will eventually different chart options

**Params**

assetId: the asset ID to get the chart information for chartTime: Time interval to pick from \['1m', '5m', '15m', '1h', '4h', '1d']

**Example**

<https://testnet.algodex.com/algodex-backend/charts2.php?assetId=15322902&chartTime=15m>

## Fetch Asset Chart

<mark style="color:blue;">`GET`</mark> `https://testnet.algodex.com/algodex-backend/charts2.php`

Returns chart for an Asset

#### Query Parameters

| Name                                        | Type     | Description                                              |
| ------------------------------------------- | -------- | -------------------------------------------------------- |
| assetId<mark style="color:red;">\*</mark>   | 15322902 | Asset ID                                                 |
| chartTime<mark style="color:red;">\*</mark> | 15m      | Can be either of `['1m', '5m', '15m', '1h', '4h', '1d']` |

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
   // Response
   "current_price":"758.006622516556",
   "previous_trade_price":"758.006622516556",
   "last_period_closing_price":"758.006622516556",
   "asset_info":{
      "asset":{
         "created-at-round":13596306,
         "deleted":false,
         "index":15322902,
         "params":{
            "clawback":"PBSSJ2W6FDXVRPT4L4FGHTX2IHY3VREI44SB7VJTVT75UT6ER3CTVD6B74",
            "creator":"PBSSJ2W6FDXVRPT4L4FGHTX2IHY3VREI44SB7VJTVT75UT6ER3CTVD6B74",
            "decimals":6,
            "default-frozen":false,
            "freeze":"PBSSJ2W6FDXVRPT4L4FGHTX2IHY3VREI44SB7VJTVT75UT6ER3CTVD6B74",
            "manager":"PBSSJ2W6FDXVRPT4L4FGHTX2IHY3VREI44SB7VJTVT75UT6ER3CTVD6B74",
            "name":"Lamps",
            "name-b64":"TGFtcHM=",
            "reserve":"PBSSJ2W6FDXVRPT4L4FGHTX2IHY3VREI44SB7VJTVT75UT6ER3CTVD6B74",
            "total":100000000000,
            "unit-name":"LAMP",
            "unit-name-b64":"TEFNUA=="
         }
      }
   },
   "chart_data":[
      {
         "asaVolume":0.000604,
         "algoVolume":0.457836,
         "low":"758.006622516556",
         "formatted_low":"758.006623",
         "high":"758.006622516556",
         "formatted_high":"758.006623",
         "close":"758.006622516556",
         "formatted_close":"758.006623",
         "open":"758.006622516556",
         "formatted_open":"758.006623",
         "dateTime":"2022-07-26T16:30:00Z",
         "unixTime":1658853000,
         "date":"2022-07-26"
      },
      {
         "asaVolume":0.000604,
         "algoVolume":0.457836,
         "low":"758.006622516556",
         "formatted_low":"758.006623",
         "high":"758.006622516556",
         "formatted_high":"758.006623",
         "close":"758.006622516556",
         "formatted_close":"758.006623",
         "open":"758.006622516556",
         "formatted_open":"758.006623",
         "dateTime":"2022-07-26T14:30:00Z",
         "unixTime":1658845800,
         "date":"2022-07-26"
      },
      // More...
   ],
   "spread_info":{
      "max_bid":"1801.0000",
      "min_sell":"953.0302",
      "spread":-847.9698
   }
}
```

{% endtab %}
{% endtabs %}

#### Getting complete asset information for an asset that is traded or untraded

This will fetch asset for an information that is either traded or untraded

**Params**

* assetId: the assetId of the asset

#### Searching Asset information by name or ID

This will query both Algodex and Algoexplorer and present results for both

**Params**

query: The query string. This can be an integer (for the asset id), or a string to search for the asset name or unit name. Partial name matches work as well.

**Examples**

* <https://testnet.algodex.com/algodex-backend/asset_search.php?query=15322902>
* <https://testnet.algodex.com/algodex-backend/asset_search.php?query=LAMP>
* [https://testnet.algodex.com/algodex-backend/asset\_search.php?query=DOUG](https://testnet.algodex.com/algodex-backend/asset_search.php?query=doug)
* [https://testnet.algodex.com/algodex-backend/asset\_search.php?query=LAM](https://testnet.algodex.com/algodex-backend/asset_search.php?query=LAMP)

## Search Assets

<mark style="color:blue;">`GET`</mark> `https://testnet.algodex.com/algodex-backend/asset_search.php`

Search for an asset

#### Query Parameters

| Name                                    | Type     | Description                                |
| --------------------------------------- | -------- | ------------------------------------------ |
| query<mark style="color:red;">\*</mark> | 15322902 | User can query by `[Asset ID, Asset Name]` |

{% tabs %}
{% tab title="200: OK " %}

```javascript
[
    {
        "assetName": "Lamps",
        "unitName": "LAMP",
        "verified": false,
        "destroyed": false,
        "assetId": 15322902,
        "isTraded": true,
        "decimals": 6,
        "total": 100000000000,
        "priceChg24Pct": 0.0007417558230212168,
        "price": "758.006622516556",
        "formattedPrice": "758.006623",
        "hasOrders": true,
        "formattedASALiquidity": "140.339924",
        "formattedAlgoLiquidity": "234882.457618"
    }
]
```

{% endtab %}
{% endtabs %}

#### Getting package and smart contract version

This is for checking compatibility between the client and the server. If the escrowContractVersion is different, then any orders placed into the order book will *not* show up in the UI!

#### Getting asset information for a wallet address

This will query Algodex and return all the assets belonging to a wallet, along with price information and how many are in orders

**Params**

* ownerAddr: the owner address to retrieve the assets for.

**Examples**

* <https://testnet.algodex.com/algodex-backend/wallet_assets.php?ownerAddr=WYWRYK42XADLY3O62N52BOLT27DMPRA3WNBT2OBRT65N6OEZQWD4OSH6PI>

## Fetch Wallet Assets

<mark style="color:blue;">`GET`</mark> `https://testnet.algodex.com/algodex-backend/wallet_assets.php`

Returns asset for a wallet

#### Query Parameters

| Name                                        | Type      | Description    |
| ------------------------------------------- | --------- | -------------- |
| ownerAddr<mark style="color:red;">\*</mark> | {address} | Wallet Address |

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
    "allAssets": [
        {
            "assetId": 16525344,
            "amount": 48596878092,
            "asaInOrder": 0,
            "name": "Alex Play 1",
            "unit_name": "ALEX1",
            "decimals": 5,
            "formattedTotalASAAmount": "485968.78092",
            "formattedASAInOrder": "0",
            "formattedASAAvailable": "485968.78092",
            "formattedPrice": null,
            "formattedTotalAlgoEquiv": null
        },
        {
            "assetId": 24253358,
            "amount": 1,
            "asaInOrder": 0,
            "name": "AlgoDesk Test ASA",
            "unit_name": "AD-TEST",
            "decimals": 0,
            "formattedTotalASAAmount": "1",
            "formattedASAInOrder": "0",
            "formattedASAAvailable": "1",
            "formattedPrice": null,
            "formattedTotalAlgoEquiv": null
        },
    ]
}
```

{% endtab %}
{% endtabs %}

#### Getting asset information for all assets

**Examples**

{% embed url="<https://api-testnet-public.algodex.com/algodex-backend/assets.php>" %}

## Fetch Assets

<mark style="color:blue;">`GET`</mark> `https://api-testnet-public.algodex.com/algodex-backend/assets.php`

Return assets list

#### Query Parameters

| Name | Type     | Description                      |
| ---- | -------- | -------------------------------- |
| id   | 22295876 | Asset ID (Returns single object} |

{% tabs %}
{% tab title="200: OK " %}

```javascript

// Example response without ID Query
{
   "ok":true,
   "rows":366,
   "data":[
      {
         "id":15322902,
         "unix_time":1658853136,
         "price":758.006622516556,
         "priceBefore":758.001,
         "price24Change":0.0007417558230212168,
         "isTraded":true
      },
      {
         "id":33698417,
         "unix_time":1658331321,
         "price":0.760032540259,
         "priceBefore":0.760032540259,
         "price24Change":0,
         "isTraded":true
      },
   ]
}

// Example response with ID Query
{
   "ok":true,
   "rows":1,
   "data":[
      {
         "id":22295876,
         "unix_time":1657975266,
         "price":10,
         "priceBefore":10,
         "price24Change":0,
         "isTraded":true
      }
   ]
}

```

{% endtab %}
{% endtabs %}


# Algodex Whitepaper v1

Version 1.0 - January 28, 2022      Authors: Armaan Mamdani & Alexander Trefonas

### 1 - Introduction <a href="#introduction" id="introduction"></a>

Algodex is a peer-to-peer marketplace that allows users to trade user-made tokens on the Algorand blockchain called Algorand Standard Assets (ASA). Algorand Standard Assets are created by users and companies alike to serve purposes such as software utility, asset representation, rewards tokens, and more. All ASAs exist on the Algorand blockchain and are priced in Algorand's cryptocurrency, ALGO. Algodex allows users to interact with the Algorand blockchain to facilitate the transfer of ASAs.

Using the powerful Algorand blockchain and its smart contract capabilities, Algodex provides a unique order book model and interface that gives users the ability to trade Algorand Standard Assets at prices they choose.

### 2 - Background: <a href="#background" id="background"></a>

#### 2.1 - Algorand:

Algorand is a fully decentralized blockchain protocol that aims to allow for efficient, transparent, and secure value exchange. The cryptocurrency that natively trades on the Algorand blockchain is called ALGO. Through proof of stake and consensus algorithms, the blockchain is able to compute transactions reliably and efficiently.

The Algorand blockchain is so efficient that it can process 1,000 transactions per second (TPS), with future upgrades planned to bring it to 46,000 TPS. The final settlement time per transaction is roughly four seconds each, at a cost of only 0.001 ALGOs. Each transaction is immensely faster and more affordable using Algorand compared to other alternatives such as Ethereum.

As of January 28, 2022, Algorand has 21.25 million created wallets and a fully diluted market capitalization of USD$9.61 billion.

#### 2.2 - Algorand Standard Assets

One of the most innovative functions of the Algorand blockchain is the ability for anyone to create a token called an Algorand Standard Asset (ASA). Any item, tangible or intangible, can be represented by an ASA. All ASAs are hosted and transacted on the Algorand blockchain and are price in ALGOs, Algorand's cryptocurrency.

As of now, Algorand Standard Assets have been used to create video game rewards, financial utilities, air pollution monitoring, representations of other assets, digital art NFTs, and speculative investments. The use cases for ASAs have many unexplored potentials.

#### 2.3 - Algorand Standard Assets

Algorand Smart Contracts are logic statements that exist on the Algorand blockchain. These logic statements can be applied to create ASA or ALGO transactions that execute under certain conditions. Some applications of smart contracts are for the use of escrows and atomic transactions. Escrows allow for money to be held on the blockchain with withdrawal rules encoded, such that they programmatically allow withdrawals directly on the blockchain. Escrow withdrawals can only be performed when the release conditions of the smart contract are met. Atomic transactions are logic statements that mandate the execution of a set of smart contracts at the same time. If one or more of the smart contracts in the set are unable to execute, all contracts in the set remain unexecuted. This can be implemented to prevent counter-party risk in peer to peer transactions.

Smart contracts exist and are executed entirely on the Algorand blockchain. For users to create smart contracts, they must be written and submitted in the Transaction Execution Approval Language, or TEAL.

### 3 - Purpose: <a href="#purpose" id="purpose"></a>

With several thousand Algorand Standard Assets in existence, there is a significant lack of places where ASAs can be traded. On the trading platforms that are currently available, users are unable to place trades at set prices using limit orders, and the liquidity details are more opaque.

Algodex solves this issue by creating an interface where users can transact ASAs directly with other users on the Algorand blockchain. Algodex utilizes Algorand Smart Contracts to allow users to create limit orders, giving the creator the ability to set the price they wish to sell their ASAs at.

### 4 - Platform Mechanics: <a href="#platform-mechanics" id="platform-mechanics"></a>

#### 4.1 - Introduction:

Algodex has the ability to receive information from the Algorand blockchain, compile user orders for the orderbook, and write smart contracts to the Algorand blockchain. The Algodex platform provides a user-friendly interface that also shows price charts, orders, trade history, and other asset information.

#### 4.2 - Order Book:

Algodex utilizes Algorand Smart Contracts and their escrow function to create a buy or sell order for ASAs on behalf of the user. When creating a limit buy or sell order, the user selects what ASA, how much ASA, and the price in ALGOs at which they want to transact. All user limit orders are compiled into a ledger called an order book. The order book is accessible on Algodex and is filtered by price; many orders at the same price will be summed into one for display purposes. However, each order remains within its own escrow contract.

When a limit order to sell an ASA for ALGOs is submitted by a user, an Algorand Smart Contract is created by Algodex. The user's funds are transferred into the smart contract which holds it in escrow on the Algorand blockchain. No party, including Algodex, has access to this on-chain escrow except for the user, who can cancel their order at any time before completion. A certain price must be met on Algodex before the smart contract exercises. The sell order contracts contain an inequality to accept any price above the price limit.

Buy orders have a similar mechanism. An Algorand Smart Contract is created when a user wants to buy an ASA for ALGOs. The smart contract then debits the correct amount of ALGOs from the user's wallet and holds it in escrow. The buy order contracts contain an inequality to accept any price below the price limit.

Once a limit order is submitted to Algodex, if it satisfies any existing order in the order book in terms of price, the smart contract logic will exercise and the transaction completes. This process is called 'taking,' as new orders are satisfied by taking existing orders from the order book. If there are not enough existing orders to fully satisfy the new order at the set price, the existing orders will be executed and the remaining amount of the new order will create an open limit order at the set price on the order book.

If a new order submitted by a user does not satisfy any existing orders in the order book, it will be added to the book. This process is called 'making.' The order will not be satisfied until it is taken from the order book by a newer order. Until the order is satisfied, it can be cancelled by the user, and ASA or ALGOs are returned to the user's wallet.

The order book mechanism for limit orders is as follows in *Diagram 1:*

![DIAGRAM 1](https://user-images.githubusercontent.com/107652076/178524735-b4e9b0ba-e6e9-46f0-b1c2-a1b820807299.PNG)

When an order is satisfied, the price that it was transacted at becomes the 'last price.' The last price is considered the market value of the ASA. This also introduces the sell order closest to the last price called the 'ask price' and the buy order closest to the last price called the 'bid price.' As new orders are always being placed and exercised, the last price, ask price, and bid price are always changing.

Users can also enter market orders instead of limit orders. While limit orders are capable of both making and taking orders from the order book, and a fixed transaction price is set by the user, a market order will only take orders from the book at the closest bid or ask price depending on if you are selling or buying. If the difference between the last price and the bid or ask price is too large, the user can adjust what percentage difference they are willing to allow their market order to deviate from the last price, or slippage tolerance.

Refer to the Appendix for further technical diagrams on transaction operation and execution.

#### 4.3 - Liquidity:

ASA liquidity is necessary for users to buy and sell ASAs easily. The liquidity is based on the depth of the order book and amount of funds in each order. Users placing orders and keeping them open builds liquidity on the platform. Incentives for doing so include airdrops and the future rewards system.

#### 4.4 - Asset Data:

The data displayed to the user on Algodex includes the order book of open orders, the last price, the bid price, the ask price, ASA trade history, user open orders, user order history, and user assets. All this data is collected by Algodex's backend from the Algorand blockchain, which is cached onto servers and databases and then delivered to the user interface.

#### 4.5 - Listed Assets:

Algodex supports listing every asset on the Algorand chain. Asset creators can list their assets by creating sell and buy orders. Furthermore, the default sorting of assets is based on the liquidity and presence of both buy and sell orders in the order book. More popular assets are automatically more visisble as a result.

#### 4.6 - Access:

The Algodex marketplace platofmr is web based and can be accessed at [www.algodex.com](http://www.algodex.com). The web platform is accessible via a wide range of desktop and mobile browsers, but Google Chrome is recommended for the best experience. The launch of the platform as a downloadable application is intended in the future.

Algodex also allows users to try out Algodex in Testnet mode. While Mainnet mode will be active by default and trades in real ALGOs, Testnet mode uses Testnet ALGOs that have no value. This allows users to try out Algodex without the commitment of transacting real value.

At launch, internet connections to Algodex from the United States and Canada will be denied access. Algodex intends to launch in both the United States and Canada in the future after legal compliance requirements are resolved.

Algodex currently supports 24 different languages to accommodate our global user base.

### 5 - Fees: <a href="#fees" id="fees"></a>

Algodex, as well as all Algorand Decentralized Applications, have Algorand network fees of 0.001 ALGOs per transaction. The second Mainnet launch of Algodex will introduce trading fees and a newly integrated user rewards system.

When trading fees are implemented, they are expected to be 0.20% of each trade paid in ALGOs.

The usage of trading fees collected is as follows in *Diagram 2:*

![DIAGRAM 2](https://user-images.githubusercontent.com/107652076/178524762-42750245-0197-42c1-8d79-800f811c10b2.PNG)

### 6 - Rewards: (updated 7/26/2022)

#### 6.1 Rewards Program:

The rewards will accrue based on high quality liquidity as discussed in the [ALGX Liquidity Rewards Program](/rewards-program/algx-liquidity-rewards-program)

6.2 - Donations:

Users, such as asset creators, may also donate assets into the Liquidity Rewards pools. This will incentivize people to provide more liquidity via open orders, as they will pay out a larger rewards rate if the pool contains more assets. Furthermore, assets that have larger rewards pools will be ranked higher in the search and default asset sorting.

### 7 - Algodex Token:

#### 7.1 - Purpose:

The Algodex Token, symbol ALGX, will launch as an ASA shortly after the Mainnet release of Algodex.

The Algodex Token will function as a form of governance for all token holders. Voting rights on future Algodex policies will be given through the use of a decentralized autonomous organizations, or DAO. Votes per token holder will be proportional to the amount of ALGX they hold.

#### 7.2 - Distribution:

The distribution of ALGX is as follows in *Diagram 3* and *Diagram 4:*

![DIAGRAM 3](https://user-images.githubusercontent.com/107652076/178524813-b1fffb9b-dd10-4007-96b9-f9bcde63f686.PNG)

![DIAGRAM 4](https://user-images.githubusercontent.com/107652076/178524828-70f06360-4c48-4b06-9480-ff752c10376f.PNG)

#### 7.3 - Integration with Algodex:

The Algodex Token will be backed by the Algodex platform via a profit pool. Once fees are implemented, 17% of all fees collected from Algodex via all trading pairs will be held in the ALGX Liquidity Rewards pool. One exception is ALGX, where 100% of trading fees collected from ALGX trading will be held in the ALGX Liquidity Rewards pool. The ALGX Liquidity Rewards pool otherwise follows the same mechanism of the other rewards pools.

### Appendix:

Algodex's process when a buyer places a limit order is as follows in *Diagram 5:*

![DIAGRAM 5](https://user-images.githubusercontent.com/107652076/178524858-67266847-f3b5-4718-b32a-30436db627c1.png)

Algodex's process when a buyer's limit order fully executes is as follows in *Diagram 6:*

![DIAGRAM 6](https://user-images.githubusercontent.com/107652076/178524880-eac99c9b-7121-4fd8-951f-3689af0af6f0.PNG)

Algodex's process when a buyer's limit order partially executes is as follows in *Diagram 7:*

![DIAGRAM 7](https://user-images.githubusercontent.com/107652076/178524895-d6ca5d8b-9f95-4ce8-a2c4-88ea125b2e87.PNG)

Algodex's process when a buyer cancels a limit order is as follows in *Diagram 8:*

![DIAGRAM 8](https://user-images.githubusercontent.com/107652076/178524910-6ce3faca-c6d1-457a-b07f-527f931903cc.PNG)

Algodex's process when a seller places a limit order is as follows in *Diagram 9:*

![DIAGRAM 9](https://user-images.githubusercontent.com/107652076/178524916-180a3354-f7a4-47de-bffb-f977ecce2e8f.PNG)

Algodex's process when a seller's limit order fully executes is as follows in *Diagram 10:*

![DIAGRAM 10](https://user-images.githubusercontent.com/107652076/178524926-ba6edfbf-7c7f-4b02-a728-496b850334cb.PNG)

Algodex's process when a seller's limit order partially executes is as follows in *Diagram 11:*

![DIAGRAM 11](https://user-images.githubusercontent.com/107652076/178524934-a00f1572-e497-43da-9a5d-ee94213c13a6.PNG)

Algodex's process when a seller cancels a limit order as follows in *Diagram 12:*

![DIAGRAM 12](https://user-images.githubusercontent.com/107652076/178524951-3cdcab4a-1d67-4b71-adba-27e8058a6fa3.PNG)


# ALGX Airdrop Plan

Version 1.0 - March 7, 2022

Introduction

Algodex Token, symbol ALGX, is the token created by a subsidiary of Algonaut Capital Corporation, Algodex's parent company. ALGX is not yet minted, and its token generation event will occur within the next 30 days. ALGX will be created as an Algorand Standard Asset.

ALGX will function as a form of governance for all token holders. Voting rights on future Algodex policies will be given through the use of a Decentralized Autonomous Organization, or DAO. Casted votes per token holder will be proportional to the amount of ALGX they hold.

Algonaut Capital will implement an Algodex Token airdrop program. The airdrop will give payments of ALGX to users as a reward for contributing to and improving the Algodex platform.

The total supply of ALGX will be 6 billion tokens. A target of 6% of the total supply, or 360 million tokens, is allocated for the ALGX airdrop.

Certain details of the airdrop will not be published publicly to prevent reward harvesting and abuse to the airdrop program.

### Distribution:

The distribution of the airdrop is as follows in *Diagram 1:*

![DIAGRAM 1](https://user-images.githubusercontent.com/107652076/178525117-ec4c080f-14b6-4867-b460-0f879428da02.PNG)

Users who receive large ALGX airdrops will have their ALGX subject to a vesting period where portions of their ALGX will be issued according to a schedule. If the user is set to receive less than 3 thousand ALGX, no vesting period will be implemented. If the user is set to receive more than 3 thousand ALGX, 3 thousand ALGX will be available immediately and the remainder will be subject to a vesting period. 3% of the user's airdrop subject to the vesting period will be issued every month for the first 12 months. Thereafter, 5.3333% of the user's airdrop subject to the vesting period will be issues every month for the next 12 months. All ALGX subject to the vesting period will be received by the user after a period of 24 months after the commencement of the airdrop program.

Once the ALGX airdrop program commences, a website will be available for eligible airdrop participants to claim their ALGX airdrop.

### Testnet Rewards:

Users who used Algodex's Testnet will receive up to 22.5% of the airdrop. Airdrop distribution to Testnet users will be calculated accordingly to how many transactions the user placed and the quality of liquidity provided.

### Mainnet Rewards:

Up to 75% of the airdrop is allocated towards rewarding Mainnet users. Mainnet users can receive rewards by providing liquidity on Algodex. Airdrop distribution to Mainnet users will be automatically calculated according to the quality of the liquidity that the user provides. The quality of liquidity will be calculated by accounting for the length of time liquidity was provided, how close the liquidity is to the current bid/ask price, and how much liquidity was provided.

The liquidity rewards airdrop will be split into three sections by timeframe. The first section will run between 0 to 2 weeks from the airdrop initiation, the second between 3 to 12 weeks, and the third between 13 to 45 weeks. The rate of rewards distribution will change for each timeframe. Airdrop initiation will commence shortly after the ALGX Token Generation Event.

The first liquidity rewards airdrop timeframe of 0 to 2 weeks is allocated up to 10% of the total airdrop, or a maximum of 5% of the total airdrop per week.

The second liquidity rewards airdrop timeframe of 3 to 12 weeks is allocated up to 25% of the total airdrop, or a maximum of 2.5% of the total airdrop per week.

The third liquidity rewards airdrop timeframe of 13 to 45 weeks is allocated up to 35% of the total airdrop, or a maximum of 1.061% of the total airdrop per week.

In addition to liquidity rewards, up to 5% of the airdrop will be reserved for other Mainnet rewards. More airdrop details for other Mainnet rewards will be published in the future.

### Community Leader Rewards:

Community leaders who have supported Algodex will receive up to 2.5% of the airdrop. Community leaders who have supported Algodex through the means of community building and user support will be contacted directly by the Algonaut team, Algodex's parent company.

### Eligibility:

Users who use, or have used, either the Testnet or Mainnet version of the Algodex platform will be eligible for the ALGX airdrop. The Algodex development team and insiders are excluded from all airdrops.


# Testnet Liquidity Rewards

Added to Archive on September 2nd, 2022

### Testnet Rewards&#x20;

*\[August 26 0:00:00, 2021 – February 9, 23:59:59, 2022]*

Testnet rewards were accrued by completing certain tasks (referred to as checklists below). Wallets that completed these criteria checklists (Tier A, Tier B+, Tier B) shared the allocated ALGX rewards (81 million ALGX) without vesting or ALGX holding requirements. A wallet could only be eligible for one of the three checklists described below.

Users had until July 25th, 2022, at 23:59:59 EST to opt-in to the ALGX token (**724480511**). Users did not receive rewards unless they opted-in to ALGX.

**Criteria Checklist Tier A:** By completing this checklist, 15,710.57 ALGX without vesting or ALGX holding requirements.

* Complete ALGX opt-in
* Have at least 5 maker orders placed
* Have at least 10 taker orders placed
* Wallet must have been active on at least 5 different calendar days
* Wallet must have been active on at least 2 different calendar months

**Criteria Checklist Tier B+:** By completing this checklist, 8,500 ALGX without vesting or ALGX holding requirements.

* Complete ALGX opt-in
* Have at least 20 total actions or more (maker or taker orders combined)
* Wallet must have been active on at least 10 different calendar days

**Criteria Checklist Tier B:** By completing this checklist, 3,000 without ALGX holding requirements.

* Complete ALGX opt-in
* Have at least 5 maker orders placed
* Have at least 10 taker orders placed
* Wallet must have been active on at least 2 different calendar days

### Reward distribution

Testnet Rewards          22.5% of total reward pool; 81 million ALGX

*See* [**ALGX Liquidity Rewards Program**](/rewards-program/algx-liquidity-rewards-program) *for more information on Mainnet Reward distribution.*

### Eligibility

Testnet rewards were eligible to anyone who completed any checklist (Tier A, Tier B+, Tier B) on Algodex between August 26, 0:00:00, 2021 and February 9, 23:59:59, 2022. The Algodex development team and insiders are excluded from all Testnet rewards.


