VLIQUID Specifications Open for Review
We are releasing the specifications for the Valis Liquidity (VLIQUID) Smart Contract, the first liquidity pool for Qubic. Join the discussion and help shape the future of DeFi on Qubic.
Qsilver, Jul 23, 2024.
We are happy to announce the publication of the Valis Liquidity Smart Contract Specifications. This comprehensive document outlines the technical aspects of VLIQUID, our rebranded smart contract, formerly known as QPOOL, that brings core DeFi functions to the Qubic platform.
VLIQUID Overview
VLIQUID, formerly known as QPOOL, aims to implement a robust liquidity pool on the Qubic platform, allowing users to swap tokens without needing a direct counterparty. Liquidity providers who lock their tokens for these swaps will earn a portion of the swap fees.
Core Objective: VLIQUID seeks to bring core DeFi functions to Qubic, providing a seamless and efficient way to manage token swaps and liquidity.
Key Features of VLIQUID
- Liquidity Pools: Users can swap tokens anytime, with liquidity providers earning a percentage of the swap fee. The fee breakdown includes shareholders, liquidity providers, and a burn component.
- MicroTokens: To address the challenge of non-decimal tokens, VLIQUID introduces microTokens. This system allows users to lock any SC share or token and receive microTokens in return, making transactions more manageable.
- Fractional Token Handling: By enabling pools to include QU (Qubic Units), we can handle fractional values during swaps, reducing potential losses from rounding errors.
- Anti-Inflation Measures: To mitigate artificial inflation from fractional QU depletion, VLIQUID ensures a low-value token is always available to cover part of the fractional value. This encourages arbitrage, maintaining balanced pool prices.
- Token Identification: Tokens are identified by specifying each token via its name and public key, allowing them to be used in pools. This compresses the token data, making it easier to manage and integrate into liquidity pools.
- Bonding Curve Pricing: The price of tokens within a pool is determined using a bonding curve, balancing reserves and weights to ensure fair pricing.
Addressing the Decimal Challenge
The absence of decimals in Qubic tokens presents unique challenges. For instance, swapping a high-value token for a lower-value one could result in significant losses due to rounding errors. VLIQUID tackles this with a multi-step approach:
The Decimal Problem
Currently, all tokens in Qubic have no decimals, and none of the existing DeFi solutions support tokens without decimals. Imagine a pool with tokenA worth 20 QU and tokenB worth 30 QU. If you swap 1 tokenB for tokenA, you would get just 1 tokenA and lose 10 QU of value due to rounding. This is a significant loss for a rounding error.
Steps to Mitigate the Problem
- MicroTokens: By creating microTokens, VLIQUID reduces the problem scale. This allows people to lock any SC share (or normal token) and receive one million microTokens in return. For example, if a QX token is worth 25 billion QU, a microQX is worth 25,000 QU. While still high, it is more manageable. To withdraw the full QX token, users need to return one million microQX. These microQX are transferable and can be used to fund liquidity pools.
- Fractional QU Handling: Pools include QU to provide change for fractional values. Since all pools must have QU, this ensures there is QU available to match the fractional amount of a token during swaps. For instance, if the fractional value is 10 QU when swapping a 30 QU token for a 20 QU token, the QU can be provided as change. However, for higher fractional amounts, like 24,000 QU for a microQX, the QU can be rapidly depleted, artificially inflating the microQX price.
- Low-Value Token Buffer: To mitigate artificial inflation, a low-value token is always available to cover part of the fractional value. Users might choose to receive most of the change in the low-value token or QU. This reduces the inflation effect and creates arbitrage opportunities. When price imbalances reach a certain point (e.g., >1%), arbitrageurs can profit by rebalancing. This direct 50% reduction, combined with increased arbitrage opportunities, helps maintain stable prices.
VLIQUID Mechanics
Bonding Curve Formula
- is the price of token A in terms of token B.
- and are the reserves of tokens A and B in the pool.
- and are the weights of tokens A and B.
Swap Fee Structure
There will be three parts of the swap fee: VLIQUID shareholders, liquidity providers, and burns. While the exact breakdown can be configured, let us assume a total fee of 1%. This is relatively high compared to ETH pools, but Qubic has no gas fee. On Ethereum, gas fees can often be many times more than 1%, making a flat 1% fee on VLIQUID swaps a significant improvement. Additionally, VLIQUID offers zero slippage swaps, further enhancing the efficiency of the trading process.
Example Scenarios
Scenario 1: Swapping High-Value Tokens Without Decimals
In this scenario, swapping high-value tokens without using decimals can result in significant value loss. For example, swapping 1 unit of Token A for Token B results in a loss of 10 QU due to the lack of precision in the swap process.
Token A
(QU) | Token B
(QU) | Swap
Amount | Value Lost
(QU) |
20 | 30 | 1 | 10 |
Scenario 2: Using MicroTokens
This scenario illustrates the use of MicroTokens to handle large values more efficiently. Here, 25 billion QU of the original token QX is represented as 1 million microQX, which simplifies the handling and transactions by converting it to an equivalent value of 2,500 QU per microQX.
Original Token
(QU) | MicroToken
(microQU) | Equivalent Value
(QU) |
QX (25 billion QU) | microQX (1 million microQX) | 2,500 QU (1 microQX = 2,500 QU) |
Scenario 3: Fractional Loss Mitigation
This scenario demonstrates how fractional losses can be mitigated by using MicroTokens. Swapping Token A for Token B at a price of 10.5 results in a fractional loss of 0.5 microQU. This loss translates to 155.5 units in the QWALLET. By using MicroTokens, the equivalent loss is reduced to 0.3 QU, minimizing the impact on the user's balance.
Token A
(QU) | Token B
(microQU) | Swap
Price | Fractional Loss
(microQU) | Equivalent Loss
(QWALLET) | Reduced Loss
(QU) |
RANDOM | QX | 10.5 | 0.5 | 155.5 | 0.3 |
This mechanism ensures efficient swaps with minimal losses, even with high-value microTokens.
The Path Forward
Our goal is to have VLIQUID running on the testnet, with a fully testable version expected later this summer. Liquidity providers are vital for token success, and VLIQUID offers additional incentives, such as bonus tokens for providing liquidity.
As tokens and SC shares are deposited, users can collect dividends and other distributions. These will be passed on as VLIQUID dividends. Any non-QU bonuses received will be integrated into the respective pool reserves, enhancing overall liquidity.
Invitation for Public Feedback
We are excited to share version 1 of the VLIQUID specifications with the community. These specifications enable different teams to create their own liquidity pools, further expanding the Qubic ecosystem. The development of multiprecision math functions for VLIQUID also benefits the broader Qubic ecosystem, providing essential tools for future SC development. Please note that these specs are a work in progress and, therefore, subject to change.
We invite everyone to provide feedback and help shape the future of VLIQUID. Your thoughts and suggestions are valuable to us. If you have any comments, please send a DM to Spelunker for an invitation to the document.
Some may question the inclusion of $QWALLET as the default token in VLIQUID. However, this choice is a strategic decision to leverage the liquidity from QWALLET's fundraiser, making $QWALLET more usable and funding further development.
Stay tuned for more updates as we continue to innovate and build on the Qubic platform.
Together, we can shape the future of DeFi on Qubic.
For the latest updates, join the Valis Discord, follow us on X, and bookmark our blog.