Chaos Labs - Token Converter

Introduction

Following the introduction of the Venus Protocol’s innovative Token Converter, which has revolutionized how token conversions are automated and optimized, our focus now shifts to refining the process to enhance profitability and efficiency. Building on the principles of autonomy, efficiency, continuous operation, and transparency established in the original post, we now propose a targeted solution for the Token Converter. This solution involves a detailed analysis of historical data, gas costs, and liquidity positions to ensure that the conversion process is seamless and profitable enough for arbitrageurs without compromising the security of the protocol. By setting precise goals for token exposure and calculating optimal fee structures, we aim to create a more robust and effective system that aligns with Venus Protocol’s commitment to decentralized and efficient financial operations.

Suggested solution for WBNB/XVS converter

1. Collect Historical Values of Oracle Prices in the desired converter

2. Estimate Gas Cost Using Previous Data

Analyzing previous conversions allows us to adopt a conservative approach to estimating gas costs. Considering the 95th percentile of all conversions, we obtain an approximate gas fee of 0.0022 BNB.

Historical gas fee paid in the previous conversions
Historical gas fee paid in the previous conversions

3. Collect Historical positions of the main Liquidity Pool (PancakeSwapV3):

Examining the historical position of the pool allows us to compare its price to the Chainlink oracle price.

Historical prices in the Pancackeswap V3 pool and on chainlink oracle
Historical prices in the Pancackeswap V3 pool and on Chainlink oracle

However, the price alone is insufficient; we also record the slippage for various transfer sizes (1, 3, 5, 7, 9 WBNB) to precisely understand how much XVS the arbitrageur will receive in return.

4. Set Goals for Max Size of Tokens and max Time of exposure (depending on the converter)

To minimize exposure to different tokens, we can establish a discount that ensures conversions of size s will be profitable in less than a target time t.


Historical WBNB balance of on Venus treasury.

Analyzing the historical balance of WBNB, we observe that it can change drastically, though it has recently been increasing slowly. Therefore, we explore various combinations with sizes of 1,3,5,7,9 WBNB and long time targets of 12,24,48,72 hours.

5. Compute Estimated Cost/Profit for an Arbitrageur

First, we calculate the cost/profit for an arbitrageur who starts with s WBNB, purchases XVS on the PancakeSwap liquidity pool, and then uses the converter to reclaim their WBNB back. We assume a total fee of 0.0022 WBNB is paid.

The arbitrageur will not proceed with a conversion unless it is profitable; he will wait for a lucrative opportunity. The discount should be significant enough that a conversion of size s becomes profitable within the specified time target. The following plots display the maximum profit achievable from a conversion over the past t hours, for each size s .

We will discuss the recommended discount in the next step. However, our analysis reveals that a profitable conversion is achievable even without any discount if an arbitrageur waits long enough. Furthermore, as anticipated, larger transactions tend to be more profitable due to economies of scale in gas consumption, which typically does not increase with transaction size.

5. Set Fee at the 5th Percentile

If the goal for the Venus team is to provide arbitrageurs with an effective compensation of 0.2%, we compute the recommended discount for each combination of time and size at the 5th percentile of arbitrageur profit plus 0.2%. This approach ensures that 95% of the time, arbitrageurs will profit at least 0.02% from a conversion of size s within the next t hours, thereby limiting Venus’s exposure to holding more than s WBNB for longer than t hours. To finalize the parameters, let’s examine the following heat map:

Untitled (87)

Here, we observe that the most profitable conversion size is around 7 WBNB, requiring the smallest discount to achieve 0.2% profitability. Additionally, the historical balance suggests that this size is manageable for the team to hold and sufficient to cover all revenues within a 72-hour period. The disparity between the oracle price and the PancakeSwap pool price appears to create ample arbitrage opportunities. Nevertheless, to ensure somewhat faster transactions, we recommend setting the fee at a minimum of 0.01%. This fee will facilitate small and quick profitable conversions and, under adverse conditions, will also allow for the conversion of up to 7 WBNB in less than two days.

Conclusion

This analysis is contingent on the liquidity of each token but can be readily replicated. If the objective is to enable arbitrageurs to profit by 0.2%, we recommend a minimal discount of 0.01%. However, less liquid markets may necessitate a higher discount to maintain profitability.

3 Likes