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.
- 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.
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? 🐇🕳️