Exchange Flex is the winner of the Free TON exchange contest. Now its public testing has been launched and every member of the community can take part in it. We will tell you about the features of the exchange and how to work on it.
About Flex Exchange
Flex Exchange was created by TON Labs as a distributed order book. The exchange is unique in its speed, comparable to the speed of the Free TON blockchain, which is the fastest blockchain in the world. Work with the exchange is done using the deBot interface.
After launching, deBot will start a dialog with you, in which you perform all interactions with the exchange.
The order book is a list of orders to buy, sell and trade TIP-3 tokens with each other.
While the exchange works in test mode, TIP-3 TEST1 and TEST2 are available for trade. These are conditional tokens, which allow you to test the work of the exchange. When the exchange switches to working mode, instead of TEST1 and TEST2, we will see WETH, WBTC, and others.
The FLEX exchange is based on the fact that any user of the exchange can select one of the orders and make an instant trade of tokens at the offered price. Or create their own order to buy or sell an asset of interest at their own price for a certain period of time. Such an order will be instantly added to the general order book of the exchange.
Then the trade will happen when the other user is ready to buy or sell tokens at the price specified in the order, or when the order expires.
The main thing is that on Flex, the token trade rate is fixed and set by users. When you buy tokens offered by other users, their price does not increase depending on the purchased amount, as it happens on exchanges working on the AMM principle. This is called slippage. Because of its absence, it is more profitable to trade a large amount of tokens on exchanges based on the order book principle.
Flex exchange smart contracts are created for each new token pair and for each order. This makes multithreaded smart contracts possible, and trade transactions are as fast as the suitable orders are found.
Getting Started With the Flex Exchange
The exchange is launched using the TON Surf blockchain communicator.
For testing, Flex must be run in test mode. The trade operations in this case are performed not for Crystals, but for test tokens — Rubies.
So first of all, do not forget to switch the wallet network mode from the main to the test network.
To run Flex you need to:
Launch Flex DeBot by tapping on the link or entering the address: 0:e57e4fa3f5ab829c12ce145ce24c0a9b4aa666a0e60d5b00f8bfd6aa1d90d64f — in the Browse DeBots field on the Surf main page
To perform trade transactions on the exchange, you need to deploy your Flex client smart contract, which will require paying a few small fees.
How to Deploy Flex Client
Before making the first transaction on the exchange:
1. You need to send a few Rubies on the exchange balance to pay fees
2. Specify the amount of Rubies and confirm the transaction, including the fee
3. Perform transactions to deploy the Flex Client, set config and wallet code
4. After paying all fees, deBot informs you that the actions with the order book are available
How to Deploy TIP-3 Wallet
Flex exchange allows you to trade TIP-3 tokens with each other and trade TIP-3 for TON.
Below we describe the available transactions between TIP-3 and TON. Transactions with TIP-3 are similar.
To start TON/TIP-3 exchange transactions:
1. Select Trade TIP-3 for TON in the trade options menu
2. In the opened menu select which tokens you want to buy TEST2 or TEST1. In the future, after the end of the exchange testing, here will be the names of existing tokens, not test tokens
3. A message appears that you need to deploy the TIP-3 TEST2 wallet to work with it. To do this you need to send a certain amount of Rubies to the exchange address
4. Then you need to make a transaction, including the wallet deployment fee
How to Create a TIP-3 Buy Order
To create a buy order for a specified amount of TIP-3 tokens for TON (Rubies will be used):
1. From the TEST2 menu select Buy TIP-3 TEST2
2. Specify the desired amount of TEST2 tokens to buy, in our case — 1
3. Specify the price in TON for the desired amount of TEST2, in our case — 2
4. Set the order time in hours, in our case, it is an hour
5. Make sure that the cost in TON matches the planned trade, including exchange fees, tap YES
6. Finish sending the order
7. Then the order book appears with a created order at the top
8. To verify that the transaction has been made, you need to update the order book. To do this tap More/Update order book and wait for the updated balance to appear
9. If the transaction did not complete immediately, it means that there is no offer corresponding to the order. In this case, the order can be executed within the time that you specified when placing it.
10. You can cancel an order before it has been completed by tapping Cancel Buy tip-3 order.
Buying TIP-3 Using an Existing Order
TIP-3 tokens for sale are displayed at the top of the Order Book on the list of orders. Their rate is shown by the first number, the amount available for purchase is the number after Sell. The TIP-3 tokens that other exchange users want to buy are listed below. The purchase rate and the desired quantity are shown after Buy.
If there is that TIP-3 token that you want to buy — the amount is specified after Sell — then the trade is done as follows:
1. Tap on the suitable order and specify the amount of TIP-3 you need
2. Check the amount in TON, which is specified for payment, including the fee, and tap Yes
3. Perform the trade transaction by pressing Confirm
4. Update the order book. Press More/Update order book and wait for the updated balance, including the trade
5. The amount of TIP-3 on your wallet balance is shown after TIP-3 TEST2
How to Sell And Trade TIP-3
When there are TIP-3 tokens on the wallet balance, they can be sold for TON Crystal or traded among themselves.
To sell TIP-3 tokens, you can select an existing order or place your own order to sell tokens by tapping Sell TIP-3 TEST2. All actions are similar to those described above. However, you can select any TIP-3 selling exchange rate.
To access the TIP-3 trade, exit the TEST2 section by tapping Back and open the Trade TIP-3 for TIP-3 section. The TIP-3 trade is similar to the TIP-3 and TON trade described above.
How to Withdraw TON Crystal From the Exchange
Transactions on the Flex exchange are done for tokens (Rubies for now), which are on the exchange account.
To send TON Crystal (after the start of the exchange working mode) from the exchange account to the address of your Surf account:
1. In the main menu of the exchange select Trade TIP-3 for TON
2. In the proposed list of operations stop at Withdraw Tons
3. Specify the amount of TON you want to send to the wallet balance
4. Select the method of entering the wallet address. In our case, My Crystals
5. Verify the address and the amount of TON to withdraw and tap Yes
6. Finish the transaction
7. Check that it has been completed successfully