Buy and Sell Orders workflow
From the previous page(Liquidity pools) we discussed how to create Buy and Sell Orders for Market and Limit order type. We also discussed how to Edit, Cancel and Claim/Settle Orders.
All the actions/functions above are all connected with a simple Buy and Sell Orders workflow, For both Buy and Sell orders the asset/token out is VPT (Verified Pool Token). VPT is Verified Pool Token it has the same address as the pool address, and for every pool created on verified network a VPT is created. So all Verified pools have 3 tokens/assets:
VPT(Verified Pool Token): created when the pool is created and have same address with pool address.
Security Token
Currency Token
You can consider VPT as a reward token for a particular pool because for every Buy and Sell orders/swaps in the pool the token given out/received like a reward is VPT(Verified Pool Token).
For example if I intended to buy some Verified Security from a Verified Pool using the paired Currency in the pool. I will need to:
Have the paired currency I want to buy security with in my wallet(faucets can be used to get this for testnet, for mainnet various ways can be used).
Create a Buy order by calling swap or batchSwap function on Verified Pool Contract using Verified SDK as explained in previous page. The Buy Order can either be Market(order without price, it will buy at market price) or Limit(order with price, will only buy at the maximum price specified or at price below specified price).
A successful Buy Order will deposit the amount of paired currency i specified when creating the order in the Verified Pool and equivalent amount(done by series of calculation) of VPT will be sent to me, hence why the token/asset out is VPT and token/asset in is Currency for all Buy orders.
Similarly if I intended to sell some Verified Security from a Verified Pool to get back the paired currency. I will need to:
Have the security to sell in my wallet, this can be achieved through 2 different ways:
i. Get it transferred to me from the issuer/creator of the security or any other allowed(whitelisted) parties.
ii. Claim Security with the VPT: this is the ideal way most users/investors will get verified securities, by claiming security using VPT(Verified Pool Token), hence why VPT can be called a reward token in the sense that it can redeemed to get either security or currency to complete an order. To claim Security using VPT a claim order will be created by calling swap or batchSwap on Verified Pool Contract using Verified SDK as explain in previous page. A successful claim trade order will deposit the VPT Pool and withdraw/send security token to user's wallet.
Create a Sell order by calling swap or batchSwap function on Verified Pool Contract using Verified SDK as explained in previous page.
A successful Sell Order will deposit the amount security i specified when creating the order in the Verified Pool and equivalent amount(done by series of calculation) of VPT will be sent to me, hence why the token/asset out is VPT and token/asset in is Security for all Sell orders. The Sell Order can either be Market(order without price, it will sell at market price) or Limit(order with price, will only sell at the minimum price specified or price above specified price).
Examples above shows that Buy/Sell Orders are not complete orders, because you get VPT(Verified Pool Token) instead of the desired tokens you wanted to buy or sell. To complete the order a Claim trade order needs to be done which will deposit received VPT to give out either Currency or Security depending on the type of trade claimed, then the trade is Completed(Settled). For every trades claimed on Verified Networks they are marked as Settled trades, hence why Settle trade can be used in place of Claim trade. If you noticed 'trade/trades' were used in place of 'order/orders' in the summary above, this is because for an order to be claimed/settled it needed to first become a trade. A trade is a matched order on Verified network. The normal Buy/Sell orders created are orders waiting to be matched.
Just like most regular orderbooks, a buy order is matched with a sell order and the orders are filled if they meet their respective requirement(prices and amount). Buy and Sell orders are matched on Verified networks and when this happens the orders are marked as Matched orders(trade) because a trade occurs when 2 orders matched with each other. After a trade occurs users can then claim such trade using VPT to get any desired token from the trade as explained above. In summary, a complete swap on Verified Network takes places in 3 steps:
User will need to have Currency/Security to create Buy/Sell order respectively and VPT will be sent to the user.
The created order will matched with opposite orders to create a Trade.
The received VPT from step 1 will be used to settle the Trade in step 2 to complete swap and receive either Security/Currency.
Other actions/functions on Verified Pool Contract are Edit and Cancel Order. These are used to edit and cancel an existing Buy/Sell Order before they are matched.
Last updated