Slippage Optimization
Last updated
Last updated
Crypto trading typically involves dealing with volatility and unpredictability. Prices of crypto assets on exchanges are constantly changing, and sometimes, users are forced to endure failed transactions due to slippages. The bid-ask spread determines slippage, and relatively large transactions attract higher slippages. One of the strengths of the ELEMENT protocol is lower slippage levels. The sections below describe how the internal dynamics of the protocol function to de-risk capital risk and increase security.
Withdrawal arbitrage is a risk that manifests as an input in the slippage function that translates into the coverage ratio. ELEMENT has a security mechanism to mitigate this risk, as described below.
Let us assume a liquidity pool contains deposits of assets and liabilities of 100, as shown in fig 8. And there is a whale who owns 20 percent of the pool and can generate risk-free profit by making a series of transactions as described in step 1.
The whale acquires 20 percent of the pool tokens by trading with another token, causing the coverage ratio to fall to 0.8 since assets in the pool have reduced to 80. The pool still has 100 tokens for liquidity providers, but users undertaking transactions in the new situation will suffer a certain degree of slippage.
The whale withdraws all the liquidity (20 tokens), causing the coverage ratio to reduce to 0.75
The whale reverses the transaction in step 1, swapping back 20 percent of the tokens he acquired. The coverage ratio is reverted to 1 from 0.75. Since the protocol rewards transactions that pull the coverage ratio to the equilibrium, the whale is awarded a favorable exchange in the form of positive slippage.
Swap slippage charged in step 1 is for a coverage ratio from 1 to 0.8, while the slippage fee in step 3 is for a coverage ratio from 0.75 to 1. Due to the slippage curve convexity, the reward for step 3 is more significant than the penalty for step 1, thus generating a risk-free profit. The exact process can be continuously executed multiple times until the pool is drained. This type of attack on the system is called withdrawal arbitrage. ELEMENT protocol seals this attack by introducing a withdrawal fee. Even though withdrawal fees can be punitive for liquidity providers, they are harmless to users and still effective at curbing withdrawal arbitrage when kept minimal. For example, when the coverage ratio in ELEMENT is 0.8, the withdrawal fee will be 0.01 percent. The ELEMENT operating dynamics is designed to make the marginal slippage more significant at any coverage ratio than the withdrawal fee.
Let us assume the withdrawal amount equals 1 percent of the pool.
Figure 12 shows that users whose transactions restore the systems coverage ratio to a healthy position will always have a more significant financial incentive than those who withdraw. It is important to note that ELEMENT can support withdrawal transactions even when the coverage ratio is below one because of banking’s fractional reserve assumption – it is rare for all liquidity providers to withdraw their assets at once. This assumption is anchored on trust among users remaining intact and withdrawals from a few individuals unable to drain a significant portion of the pool. Lastly, it is essential to note that ELEMENT has deposit arbitrage/deposit fees to prevent unnecessary flash loans.
Conventionally when transacting two tokens, the coverage ratio for one token increases while for the other decreases. The balance for the from-token increases, and that of the to-token drops. Consider the case below without slippage.
The figures above describe a mechanism similar to the constant sum market maker (CSMM) that does not penalize large volume transactions, thus encouraging users to drain the pool. For example, a swap of 100 USDT for USDC would drain the USDC pool.
ELEMENT protocol penalizes all transactions that increase the coverage ratio irrespective of their volume. The protocol defines the swapping slippage using the formula in figure 15.
Si and Sj must be negatives, implying Si is the reward for the swap, Sj is the penalty, and Si→j is the fee. Because of the convexity of the slippage function, transactions that diminish the coverage ratio between the two tokens are rewarded since Si→j is negative. In contrast, transactions that widen the coverage ratio of the two tokens are penalized since Si→j is positive.
From the previous example, we can deduce that.
Consequently,
Since swap slippage is 0.0121 percent, the user who swaps 10 USDT will get
When users swap 10 USDT for USDC, they are given 9.9988 USDC. The protocol charges 0.0121 USDC as slippage. It is important to note that the protocol keeps the slippage as a transient reserve until the reverse action is done to revert the system to equilibrium. This approach is referred to as a “Path-independent” property. The new liquidity pools will look as shown in figure 16 below.
The interest rate model is the only model that auto balances pools based on variable interest rates that allow automated market maker users to earn handsomely from their staked assets. This model can be described as ‘the higher the coverage ratio, the greater the reward to the stablecoin account.’ One of the model’s key strengths is protecting against coverage ration manipulation. DeFi 1.0 protocols that use this model use arbitrage activities to rebalance their pools.
ELEMENT leverages a new approach that is based on ELE emission to rebalance its pools. This model is designed to bar unscrupulous users from tricking the system into claiming disproportionately huge rewards with abundant capital. This new model incentivizes balance across pools; all users are guaranteed stable yields on their investments. Users can earn more from their deposits by taking advantage of natural market movements. The protocol rewards existing liquidity providers who shift their liquidities to restore stable coin accounts’ coverage ratios to healthy positions.