Accelxr

Posted on Aug 13, 2021Read on Mirror.xyz

Tutorial: How to Swap on Uniswap (Optimism)

What is Uniswap? šŸ¦„

Uniswap is a decentralized finance (DeFi) protocol for pooling liquidity and trading ERC-20 tokens on Ethereum. Uniswap removes the need for trusted intermediaries when exchanging assets via its automated market maker (AMM) model. This means anyone can permissionlessly trade any ERC-20 token using the Uniswap protocol 24 hours a day, 7 days a week.

As the leading decentralized exchange (DEX) in DeFi, Uniswap has facilitated over $300 billion of trading volume since inception. It is essential economic machinery, enabling peer-to-peer value transfer across all of Web3.

What is Optimism? ā›“ļø

Optimism is an EVM-compatible Optimistic Rollup chain that is designed to be a fast, simple, and secure scaling solution for Ethereum.

Optimism is a glimpse into what the future of Ethereum has in store for us. Transactions are nearly instant and gas fees are negligible. For newer entrants to DeFi, Layer 2 solutions like Optimism allows experimentation with protocols such as Uniswap with minimal transaction costs.

Uniswap x Optimism Swap Tutorial šŸ“š

In this tutorial, weā€™ll walkthrough how to perform a simple token swap using Uniswap on the Optimism network.

First, youā€™ll need to set up your MetaMask for Optimism.

  • Login to MetaMask on your browser and click on ā€˜Ethereum Mainnetā€™.
  • From the dropdown, select ā€˜Custom RPCā€™.
  • Enter the following information into the available fields:
  • Click ā€˜Saveā€™.

Next, bridge some assets from the Ethereum Mainnet to Optimism.

  • Go to https://gateway.optimism.io/welcome?chainId=1 and connect your MetaMask wallet. Make sure you are currently connected to the Ethereum Mainnet by selecting it from the network dropdown list in MetaMask (the same list where you found ā€˜Custom RPCā€™ earlier).
  • Once connected, select the token you would like to transfer to Optimism and the token you would like to receive on Optimism from the dropdown menus. Then, enter the amount you would like to transfer.

  • Click ā€˜Depositā€™ and follow the prompts, confirming the transaction on MetaMask.
  • Shortly after confirmation on Ethereum, your assets will arrive on the Optimism network. You can check this by switching back to the Optimism network in MetaMask and verifying the tokens are in your wallet (Note: if you don't see your assets, try adding the token to MetaMask).

Now, it's time to swap some tokens.

  • Head over to https://uniswap.org/ and click the ā€˜Launch Appā€™ button in the top-right corner.

  • If you havenā€™t already, switch over to the Optimism network in MetaMask. You can confirm that you are correctly connected by verifying that it says 'Optimism' in the upper right corner of the page.

  • Select the assets you would like to swap to and from, and fill in the desired amount.

  • Once you are ready to swap, select ā€˜Allow the Uniswap Protocol to use your Xā€™ and confirm the transaction in MetaMask. This will allow Uniswap to spend your tokens during the swap.
  • Finally, hit ā€˜Swapā€™. You will be asked to verify the details one more time. After verifying, click 'Confirm Swap' and approve the transaction in MetaMask.

Congratulations! šŸ„³

You have performed your first swap using Uniswap on Optimism. Make sure you add the new token to MetaMask if it isn't already there. After a few minutes, you should see the correct balance in your wallet.

You've now successfully executed a permissionless exchange of crypto assets through Uniswap on one of the most advanced Ethereum scaling solutions available.

What skill will you level up next on your web3 journey? šŸ‡šŸ•³ļø