We present WaveFlow, an exchange platform on which the exchange rate is self-regulating and liquidity of tokens is constant, written in the Ride programming language
Up to this point, Waves DEX has been the only valid place in the Waves ecosystem where users could add liquidity to their tokens, by implementing a trading bot with a custom algorithm. But there is a problem — special skills and knowledge are required. WaveFlow was created to solve this problem.
WaveFlow is a platform where people can both exchange tokens and easily create an automated exchange, earning fees. Each exchange is a smart contract that is replenished with both tokens by the owner. The exchange rate is determined by algorithmic pricing.
Self-regulated price
The exchange rate is calculated by the formula:
(X + a) * (Y — b) = X * Y
X * Y = const
Terminology:
- X — an amount of token X, stored in the exchange contract
- Y — an amount of token Y, stored in the exchange contract
- a — an amount of token X that the user pays
- b — an amount of token Y that the user receives
To make it clear, let’s assume that our exchange smart contract stores 1,000 token X and 100 token Y (X = 1,000; Y = 100). Take a look at three examples. In each of them, the amount of X and Y tokens is the same.
In each case, we increased the amount of tokens we want to buy. As you can see, the bigger amount of tokens we exchange, the greater the calculated price.
WaveFlow isn’t suited to large trades. The market price is designed for small trades, e.g. for interacting with dApps.
Exchange creation
The creation of an exchange takes just a couple of clicks. All you need is to have Waves Keeper installed and tokens to deposit.
- Click on the ‘Create New Exchange’ button.
- Enter the token IDs, the deposit amount, address and fee you want to receive. Currently, WaveFlow is under testing so you can only have pairs that include Liquid. In the future, you’ll be able to create any pair of assets.
- Approve the transactions using Waves Keeper.
Congratulations! Your exchange will be listed on the platform.
Feedback is welcome
As we mentioned before, the platform is still in the testing phase, so there could be bugs. If you find any issues or have any suggestions for adding new features, please let us know on the Waves forum.
Read Waves News channel
Follow Waves Twitter
Watch Waves Youtube
Subscribe to Waves Subreddit
WaveFlow: instant token exchange on Waves Platform was originally published in Waves Platform on Medium, where people are continuing the conversation by highlighting and responding to this story.