What are Swaps?
In the crypto world, a “swap” refers to the act of exchanging one cryptocurrency for the equivalent value of another. The difference between swaps and trades is swaps refer to the selling or buying of an asset from a liquidity pool where the price is managed by an automated market maker (AMM). Trades refer to selling or buying assets on an exchange using an order book. Swaps are a basic function of a decentralized exchange. You can even swap in some non-custodial wallets, like Solflare. Swaps are basically crypto-crypto market orders because an at-the-market bid is filled instantaneously.
Swaps have two key advantages over trades on centralized exchanges. First, on a centralized exchange, there must be sufficient “buys” in the exchange’s order book in order for your sell order to be executed. There’s never a guarantee that your buy or sell order will be filled. When swapping with a liquidity pool, the pool’s AMM algorithm guarantees that your order will be executed automatically, at or near the price you’re quoted.
And second, liquidity pools are completely decentralized, which means the assets in the pools you interact with during swap AND the wallet you connect to the pool are both non-custodial. Unlike centralized exchanges, where an organization holds custody over the exchange funds and the users’ wallet keys, liquidity pools’ non-custodial nature completely eliminates the risk of the malicious behavior and security vulnerabilities common with custodial exchanges.
How do Swaps work?
Swaps require you to input how much you want to buy or sell and the interface will show you how much you can sell or buy. For example, say you want to sell 1 SOL.
You’ll input the 1 SOL at the top of your swap interface.
At the time of writing, 1 SOL = 144.624125 USDC. I can choose to accept this price and execute the swap transaction or I can wait to see if the price changes in my favor and increases on the USDC end.
You can also flip the trade using the two arrows separating the top and bottom. The quoted price has changed and it now shows the same amount of USDC listed above only being able to purchase 0.994637261 SOL.
These quotes do not take into account the transaction fee you’ll be paying which usually amounts to 0.000005 SOL, or about $0.001, which is a godsend when you consider the $30-120 fees on Ethereum at the moment.
In Solflare’s swap interface, you’ll also see the quoted values for what you’re trading right above the swap button.
One important aspect of swaps to consider is slippage, which refers to the price of the asset you’re trying to buy changing while you’re trying to buy it. This is due to either volatility or volume issues. Usually, the faster the swap – the less slippage there will be.
Volatility based Slippage
If you swap $100 of SOL-SRM and there is $100 worth of SRM available within the swap interface you’re working with, the transaction will be confirmed. Let’s say SOL’s price quickly declines before your transaction goes through. This will result in the quoted amount of SRM you will receive to decline as well.
To alleviate this issue, some Swap services, like Solflare’s, have implemented a fixed rate swap mechanism that maintains your quoted price until the transaction has been finalized.
Volume based Slippage
Volume-based slippage is mainly an issue for ‘whales’ – wallets with large amounts of cryptocurrencies – and for low-liquidity markets.
Let’s say you want to purchase $100 million of SRM with your SOL. Although the SOL-SRM market is very liquid, there is probably not $100 million worth of SRM available at the same price. Due to the sheer size of the order, the beginning of the purchase will be priced lower than the remaining. You’ll end up with an order that moves the market in one way or another. If you’re buying $100 million, you’ll be incrementally raising the price of SRM until your order is filled and vice versa if you’re selling.
This same issue applies to trading securities and currencies. There always has to be a buyer or seller on the other side of your transaction, and they don’t have the same views of how things are priced. The way to get around slippage is a limit order, which only executes the trade when you can get the full trade filled at a specified price.
Adjust Slippage Tolerance in the Solflare wallet
Adjusting slippage tolerance with your Solflare wallet is very easy. All you have to do is click the settings button at the top of the Swap interface.
The default slippage setting is 0.5%. So the max slippage you would experience with a $100 trade is $0.50. You can try to lower the tolerance even more but you may be unable to get your swap filled if there is not sufficient liquidity or if there is too much volatility.
Atomic swaps enable users to trade tokens between two different blockchains once agreed upon, predefined conditions are met. Atomic refers to the idea that the swap is either completed or never happens.
They incorporate smart contracts using Hashed Timelock Contracts (HTLC) which sets time limits as to when the swap can occur. These swaps can also be reversed if the counterparty does not fulfill its predefined duties in the allotted time period.
Atomic swaps are becoming very important blockchain mechanisms as more chains are garnering their own communities of value that need to be transmitted. They remove the risk of the centralized intermediary bridging the two chains together.
Basically, they give more control to the swapper while eliminating counterparty risk.
Swaps are great. They save you time and money, while also providing the market with necessary liquidity.
Solflare’s in-wallet swap mechanism is the ideal location for you to manage your Solana holdings. There’s no need to even connect to a decentralized exchange, you can hold, send & receive, stake, and swap your assets directly within the wallet.