With the removal of intermediaries, decentralized finance (DeFi) has opened the door to many opportunities. Anyone on the planet now has access to cutting-edge financial products, all while maintaining self-custody over their own funds. However, with this self custody comes risk, and a greater responsibility to prevent any loss of capital.
That said, here are several of the most common ways you can lose money while swapping in DeFi.
Slippage and Front-running (MEV)
Slippage is an inherent dynamic across all markets, and can be defined (in DeFi terms) by the difference in price between the time a market order is placed and the time it completes on the blockchain. Slippage can either be positive or negative, depending on the direction of price change.
MEV (Maximum Extractable Value) is what happens when blockchain validators manipulate transactions within a block to extract maximum value from a sender. Front-running is a closely related strategy, where an attacker (either miner or other bot) sees a sizable transaction waiting in the mempool, then places a significantly larger transaction with the same tokens directly before and after the victim’s transaction. This drives the rate of the victim’s transaction up, effectively allowing the front runner to extract the difference in value. Transactions with a high slippage tolerance typically have a higher chance of being targeted by front-runners, as there is a higher margin for them to manipulate the victim's "minimum amount returned".
***By default, 1inch utilizes an "auto-slippage" feature which detects token pair volatility and adjusts the slippage tolerance accordingly.
How to prevent loss from slippage or front-running:
Decrease your selected slippage tolerance:
The first option is to simply decrease your slippage tolerance in swap settings. Please know that if the price moves beyond your allotted slippage tolerance, your transaction could fail. So an extremely low slippage tolerance my increase the chance of a failed transaction for illiquid token pairs. However, the cost of a failed transaction often is less than the cost of a front-running attack.
Keep in mind, a front-runner will only be able to take up to the full % of your selected slippage tolerance, so set it accordingly.
***The default slippage tolerance on 1inch is 1%.
Flashbots
In additional effort to prevent front-running, 1inch has released a flashbots feature, which greatly reduces the chances of your transaction being targeted. This, in combination with using a lower slippage tolerance can also help prevent loss of funds.
OTC Mode
Yet another protection built into 1inch is OTC mode, which routes your trade through professional market makers with a 0 slippage transaction. You can read more about this here, How 1inch protects users from front-running.
Please note: OTC mode is only available on IPFS.
Negative Price Impact
Price impact is the influence that your trade has over the market price of the underlying asset pair. It is directly correlated with the amount of liquidity/volume in the pool. The larger your transaction is the more it will ‘displace’ the pool’s price, ultimately giving you fewer tokens than originally desired.
How to avoid it:
If you are swapping an illiquid token, the only thing that can be done to minimize negative price impact is to reduce the amount swapped. As a courtesy, 1inch provides a warning that will show how much you will lose (in percentage terms) to price impact before you make the swap.
Failed transactions
Failed transactions are yet another way to lose money while swapping in DeFi. Many failed transactions are caused by the token rate dropping below the allotted slippage tolerance for a swap. A transaction can also fail if it was sent with too little gas. If gas prices (or limits) are higher than what was provided, the transaction can also fail. All gas fees for failed transactions go directly to validators, who are paid to record the event on the blockchain. These fees cannot be refunded.
How to avoid them:
1inch provides several options to help users avoid transaction failures:
Increase Slippage tolerance
Enable the “Partial Fill” option
Send the transaction with a high gas amount (“Instant” setting)
Send an “Over the counter” (OTC) transaction
Scam tokens
Since anyone can create a token, scam tokens are very common in DeFi and come in a wide variety of flavors. Countless people have fallen victim to these traps, which are purely designed to take your money. Two popular tactics are “Rug pulls” and “Honey Pots”. A rugpull happens when an initial liquidity provider (or token creator) suddenly withdraws a majority of their liquidity from the pool, effectively stealing funds from speculators who bought the now worthless token.
A honeypot happens when the contract creator places elaborate traps within the contract code to prevent speculators from selling their recently purchased token. This can come in the form of heavy internal commission upon transfers, or extreme limits on selling (both time based and % based).
*How to avoid them:
1inch has a system of whitelisting tokens, to help filter out the noise (so you don’t have to). Any token that doesn’t have to be custom added has gone through this whitelisting process.
However, if you decide to trade the riskier custom tokens, here are some things to look out for:
Check the reputation of the token contract creator
Only swap tokens with locked liquidity / renounced ownership (so the owner can’t mint new tokens, set high fees, change transfers etc)
Don't swap brand new tokens with little/no reputation
Use these tools to help identify a scam before buying
***The above list is not exhaustive, and does guarantee that a certain token is not a scam. This includes the 1inch Whitelisting process. Please DYOR on every asset and trade at your own risk!