# WX Token Protocol
WX is a core WX Network ecosystem token that is essential for WX Network Liquidity Pools investment product. WX token has 8 decimals and is non-reissuable. The originally emitted (issued) 1000,000,000 WX tokens will be locked on the contract. However, only a part of the total emitted amount will be released into circulation (during 2628000 blocks or about 5 years) in small portions according to release rate while a part of the amount will be burned. The release rate is based on community voting, so the users can decide what amount of WX will be released into circulation and what amount will be burned.
# WX Token Features
There are many ways to use WX token in Liquidity Pools investment product and other places:
You can stake your WX token (for a period from 2 weeks to 4 years) to get gWX and then use it to boost your passive income in a liquidity pool. The more is the amount and the longer is the duration of WX token being locked, the more gWX you receive in return.
You can invest (deposit) your WX token in a liquidity pool with WX as one of the tokens in pair.
You can pay trading fees in WX token at better rate.
You can trade WX token on WX Network just like any other verified token.
# How to Get WX Token?
There are few ways to get WX token:
You can become liquidity provider by investing in a liquidity pool. You will receive LP token in return. You can stake your LP token to receive regular rewards in WX.
If you already have WX, you can stake it to get gWX (boost) in return. When you have gWX, you can vote with it for a pool's WX emission to get increased amount of regular rewards in WX for staking LP token.
You can get WX token by trading on WX Network just like any other verified token.
A part of the emitted WX will be distributed among WX Network team.
# WX Token Global Distribution
WX tokens will be distributed among several smart contracts in the following percentages:
50% will be distributed to LP stakers. Community smart contract.
20% will be used as DAO fund for startups on the Waves blockchain. Users will decide which startups to fund. WX DAO smart contract (opens new window).
15% will be distributed to WX Network team. Team smart contract (opens new window).
9.9% will be used to finance WX Network marketing. Marketing costs smart contract (opens new window).
5% will be sold on IDO. Investors smart contract (opens new window).
0.1% will be distributed as early bird rewards. Early birds smart contract.
# WX Liquidity Pools
WX liquidity pools is an investment product that allows users to receive passive income for investing tokens in the pools that provide liquidity for smoother spot trading on WX Network. The service employs smart contract (opens new window) technology to speed up the trading process by means of AMM (Automated Market Making). The invested tokens are used to stabilize the prices of the corresponding token pairs on WX Network. The AMM algorithm automatically fills traders' orders using pools' liquidity provided by users. AMM controls the proportion of tokens in each pool depending on the price change. The more liquidity is in the pool, the less the exchange load affects the prices. AMM algorithm makes trading profits and collects them in the pools. This increases the liquidity of the pools and provides passive income for investors.
The service is based on the Waves blockchain that provides high transaction speed and low network fees.
# Liquidity Pools General Mechanics
There are liquidity pools with various token pairs such as WAVES/XTN, BTC/XTN, USDT/XTN, WX/XTN, ETH/XTN etc. Users can also create pools with tokens that have 'Community Verified' label (opens new window).
To become liquidity provider a user needs to invest (deposit) proportional amounts of 2 tokens, for example WAVES and XTN in WAVES/XTN liquidity pool. Also, it is possible to make a deposit with one of the two tokens of a pool.
Based on the deposited amounts, in return the user receives an amount of LP token of the pool. For example, for depositing WAVES and XTN in WAVES/XTN pool the user receives WAVESXTNLP (LP token) in return.
A liquidity provider (holder of LP token) can withdraw the deposit at any time - in this case the LP token will be exchanged to the 2 original tokens at a new price depending on the current price of the LP token and the prices of the tokens in the pool.
Depositing and withdrawing is an atomic operation (with slippage*), meaning that it consists of only one transaction that either happens or it does not.
Slippage is an option with several presets (0.5%, 1% and 3% etc.). During deposit/withdrawal operation, the price of LP token may change significantly. If the price change exceeds the selected Slippage %, then the transaction will not happen and tokens will be returned. See example of slippage when entering a pool.
# Entering a Liquidity Pool
When entering a liquidity pool (depositing tokens in a liquidity pool) the amount of the received LP token is calculated by the formula:
LPmy
=LPall
*(TOKENinvest
/TOKENpool
)
Where:
LPmy
is the amount of LP that you get.LPall
is the total amount of emitted LP.TOKENinvest
is the amount that you invest.TOKENpool
is the amount of the token in the pool.
For example, you want to deposit tokens in WAVES/XTN pool that currently contains 200000 WAVES and 1000000 XTN. This means that the price of 1 WAVES is 5 XTN by the following formula: PRICE
=(XTN amount in pool
)/(WAVES amount in pool
).
Important: Depositing tokens in a pool can be done only in the same proportion as the pool currently has.
For example, if you want to deposit 2000 WAVES, taking into consideration that 1 WAVES is priced 5 XTN, then you will also have to deposit 10000 XTN.
# Slippage When Entering a Liquidity Pool
Let's review the case of slippage when entering (depositing tokens to) a liquidity pool.
For example, the pool contains 200000 WAVES and 1000000 XTN and the price for 1 WAVES is 5 XTN. Let's imagine that someone placed trading order to exchange 10000 XTN to WAVES and the pool filled the order.
WAVES amount in the pool | XTN amount in the pool | price | constant (WAVESamount*XTNamount) | |
---|---|---|---|---|
before exchange | 200 000 | 1 000 000 | 5 | 200000000000 |
after exchange | 198 019,802 | 1 010 000 | 5,1005 | 200000000000 |
As you can see, after the exchange the price changed by 2.1%
(by the formula: Percent
=(Pricemax
-Pricemin
)/Pricemax
*100
).
If during the price change a user was depositing tokens to the pool and selected slippage less than 3%, the deposit transaction will not happen.
If during the price change a user was depositing tokens to the pool and selected Slippage 3%, then if we calculate by the invested WAVES token, the user should get 4040 LP token, and if we calculate by the invested XTN token, then the user should get 3960,39604 LP token. The amounts are not the same because after the price change (caused by the exchange transaction) the invested tokens are no longer in the same proportion as in the pool. In this case the user will get the least of the two amounts.
So, when depositing 2000 WAVES and 10000 XTN the price for 1 WAVES was 5 XTN, but it suddenly changed by 2.1%
.
WAVES amount in the pool | XTN amount in the pool | price | |
---|---|---|---|
before investing | 198019,802 | 1010000 | 5,1005 |
after investing | 200019,802 | 1020000 | 5,099495099 |
In this case the user will receive 3960,39604 LP token. The total invested amount in XTN will stay the same - 20 000 XTN, while the lost profit will be 199,0098034 XTN. If the user decides to exit the pool immediately after investing with this LP token amount, the user will get 10000 XTN and 1960,978451 WAVES.
# Exiting a Liquidity Pool
Let's review the case of withdrawing tokens from a liquidity pool.
For example, the pool contains 202000 WAVES and 1010000 XTN and the price for 1 WAVES is 5 XTN. We want to exit (withdraw tokens from) the pool and exchange 4000 LP tokens back to WAVES and XTN. The total amount of emitted LP token is 404000 LP.
Then the 4000 LP tokens will be burned and what you get in WAVES is:
WAVESmy
=WAVESpool
*(LPmy
/LPall
)
2000 WAVES
= 202000 WAVES
*(4000 LP
/404000 LP
)
and what you get in XTN is:
XTNmy
=XTNpool
*(LPmy
/LPall
)
10000 XTN
= 1010000 XTN
*(4000 LP
/404000 LP
).
Where:
WAVESmy
(XTNmy
) is the amount of WAVES/XTN that you get.WAVESpool
(XTNpool
) is the amount of WAVES/XTN in the pool.LPmy
is the amount of LP token that you have.LPall
is the total amount of emitted LP.
# How the Tokens Deposited in a Pool are Used in Trading?
Tokens invested in the pools are used by automatic market making (AMM)trading algorithms that place orders in the corresponding trading pairs on WX Network. This way the pools provide liquidity for trading pairs and make trading profits.
The price spread of the orders is specified in a pool' config. Currently all pools use the following formulas:
ask.price
=contract.price
(1
+spread
/2
)
x
=(ask.price
/contract.price
-1
)2
ask.amount
=contract.amountAssets
x
/(4
+2
x
)
bid.price
=contract.price
(1
-spread
/2
)
x
=(1
-bid.price
/contract.price
)2
bid.amount
=contract.amountAssets
x
/(4
-2
x
)
Where:
ask
is sell order.amount
(price
) is the amount (price) in order.bid
is buy order.spread
is spread of the order prices. Currently spread is0.2%
contract.price
is the price on the LP contract. For example, to calculate LP contract price of WAVES/XTN pool: divide the amount of XTN (contract.priceAssets
) by the amount of WAVES (contract.amountAssets
):contract.price
=contract.priceAssets
/contract.amountAssets
.
The algorithm places buy and sell orders in a "ladder" manner, meaning that every next level (order) is placed as if the previous one is already filled (with all the consequential balance changes).
Trading profits made by means of the orders spread are accumulated in the pool which makes the price of the pool's LP token grow over time. This forms Base vAPY*
Base vAPY - the variable annual percentage yield based on today's trading activity. Profits made by AMM trades can be calculated by the formula:
Read full description of AMM algorithm in WX_lightpaper.PDF (opens new window)
# Staking LP Token
A liquidity provider (holder of LP token) can stake LP tokens to receive regular rewards in WX token according to release rate. LP staking rewards in WX token will be accumulated on the contract and can be claimed by the user at any time. Staked LP tokens get locked (similar to XTN staking) and cannot be used in any other way until they are unstaked.
LP stakers can increase (boost) their staking reward in WX token.
Read full description of how LP staking rewards are calculated in WX_lightpaper.PDF (opens new window)
# WX Release Rate
Release rate indicates the amount of WX released every time a new block is added in the Waves blockchain.
ReleaseRateMAX is the set value of max possible release rate - 190.2587519 WX per block.
ReleaseRate is the current release rate value that is set every 131400 blocks (~ once per quarter of a year) by means of community voting with gWX. ReleaseRate cannot be more than ReleaseRateMAX.
The difference between ReleaseRateMAX and ReleaseRate is burned by the smart contract.
Example of release (blue area) and burns (red area):
ReleaseRate consists of:
ReleaseRateBase - this rate indicates the amount of WX reward that is distributed among liquidity pools based on their pool weights. Then the pools distribute the rewards among LP stakers based on their shares. This rate forms the RewardAPYmin.
ReleaseRateBoost - this rate indicates the amount of WX reward for users that applied boosting to their RewardAPYmin. This rate forms RewardAPYmax.
The relation of ReleaseRateBase to ReleaseRateBoost is always 1/2, so that:
ReleaseRateBase = (1/3)* ReleaseRate
ReleaseRateBoost = (2/3)* ReleaseRate
So the graph of WX release looks as follows:
Please note that the ReleaseRateBoost is 100% utilized only if all liquidity providers apply maximum boosting. In reality this is not likely to happen, so the realistic release graph would look as follows:
# WX Distribution to Pools and Users
WX rewards are distributed to liquidity pools based on their pool weights. For the first quarter of the year after launch of the liquidity pools every pool' weight W was constant. The sum of weights of all the existing pools equaled 1.
Now that the voting feature is implemented, users can change pool weights every 10080 blocks (every week) by voting with their gWX.
Every pool gets WX reward (poolReward) based on its share of Wi :
# Pool Weight
Every liquidity pool has its weight. Pool weight indicates a share of the pool in the WX tokens release. That share determines the amount of newly released WX token that the pool will get and then distribute among LP stakers. The bigger pool weight is, the more WX tokens the pool receives and the higher Reward tAPY* this pool has. Pool weight can be changed by voting or when new pools are launched.
Reward tAPY - the variable annual percentage yield that is based on the current price of the reward token (WX) and the reward rates.
# gWX (boost)
gWX is the unit in which the voting power is measured. Boosting is a mechanism that is activated for liquidity providers who vote for the pool's WX emission with their gWX. The amount of gWX for maximum boosting in a pool depends on the share of the staked LP token in that pool. The bigger is the user's share, the more gWX the user needs for max boosting. Max possible boost coefficient is x5.
A user can get gWX by staking WX token for a period from 2 weeks to 4 years and then use gWX to boost passive income in a pool by voting for it. The more is the amount and the longer is the duration of WX token being locked, the more gWX the user receives in return.
The amount of gWX that a user gets at the start of WX locking period is calculated by the formula:
gWXstartAmount
= (1
/1000
) * (lockingPeriodInBlocks
/(30
* 1440
))²*wxAmountForLock
Important: gWX balance gradually decreases starting from the moment when WX token was locked until it reaches 0 at the end of the selected locking period.
A user can lock more WX to get more gWX even if the current lock isn't expired.
Read more about gWX and how the boosted WX rewards are calculated in WX_lightpaper.PDF (opens new window)
# WX Staking Rewards
Until December 13 2022, all gWX holders (not only liquidity providers) were entitled to claim regular rewards in WX. The amount of rewards was based on the user's gWX share and the amount of fees (all the trading fees collected by WX Network during a period of time). The payout of the rewards took place every week.