A decentralized exchange (also known as DEX) is a type of exchange where transactions occur between the user and a smart contract, without any intermediary party. Among other things, DEXes allows users to trade or swap their assets, become liquidity providers and earn incentives for it.
Currently, one of the biggest and most important DEXes is Uniswap. Thanks to Oasis.app integration with Uniswap widget, now you can use their services without leaving our site.
What can I use this feature for?
Let’s see some use cases:
- You are managing your vaults, and you notice the collateralization ratio of one of them is too low. You want to pay back part of your debt, but you have no Dai, only USDC. You can use the widget to swap your USDC for Dai, and save your vault from liquidation.
- You want to open a new MATIC-A Multiply Vault, but you only have ETH in your wallet. You can use the widget to swap part of your ETH to MATIC to open your vault.
How to use it?
In the top navigation bar of Oasis.app, between the “My Positions” icon and the wallet address, you can find a double arrow icon. When clicked, you will see a popup dialog similar to the one shown in Figure 1.
Figure 1: Uniswap widget
There are three things you can do in this dialog:
- Select the asset you want to swap from: You should already have this asset in your connected wallet.
- Select the asset you want to swap to: You will receive this asset in your wallet if the swap succeeds.
- Insert the amount of the asset you want to swap.
Once all values are set, the widget will show the current value of your assets in USD, and it will also estimate how much of the other asset you will receive. This can be seen in Figure 2.
Figure 2: Swap simulation.
If the asset you’re trying to swap is a token, you will need to allow the contract to spend your tokens. Once the allowance is set, you can click on the “Review swap” button, and a final screen will show the summary of the operation.
If you agree with the trade, you can click “Confirm swap”, and in a few seconds you should see your updated wallet balance with the new asset.
You can watch the whole process in the video below:
Please keep in mind that this is an Ethereum Mainnet transaction, so there will be gas costs associated with the swap. You will need ether in your wallet to pay these gas costs.
You can control two additional options for your swap:
- Maximum slippage: This allows you to control the maximum price difference you’re willing to accept when the swap is completed. If for some reason (lack of liquidity in the contract, size of the swap, or others) the difference is bigger than this setting, the transaction will revert.
- Transaction deadline: If the swap transaction doesn’t get confirmed in this period of time, it will automatically revert.
You can access this configuration screen by clicking on the gear icon located at the top right of the popup widget.
Figure 3: Advanced settings.
Are there any additional costs?
This service is provided by Uniswap, who charges fees for swapping. You can read more about these fees here.
On top of this, there’s a convenience fee for using the widget that goes to Oasis.app. It is currently set at 20 bps (0.2 %).