1/5
## Uniswap V2 Contracts We're going to look at the Uniswap V2 contracts that work behind the scenes to make the AMM function. We have three main contracts to understand. The first is the factory contract. The factory contract is a simple contract that's used to deploy the pair contracts. Pair contracts are used to lock up the tokens we want to trade. For example, we can have a pair contract of ETH/USDT, or DAI/ETH, or DAI/MKR. The factory contract allows us to create these pairs. We can also interact with the pair contracts directly, to add or remove liquidity or to swap tokens. This is a bit error-prone so we also have the router contract. The router contract is used as an intermediary to add or remove liquidity from the pairs and also to swap tokens. If we swap DAI to ETH the router will interact with the DAI/ETH pair contract. If we want to swap ETH for MKR the router will swap ETH to DAI, then DAI to MKR, then send the MKR over to us. The user can interact with the factory contract directly to deploy a pair contract, but the user can also interact with the router, which will then call the factory to deploy the pair contract. This completes our overview of the Uniswap V2 contracts. We will use these contracts to create, add and remove liquidity to the pairs, and to swap tokens.
A comprehensive guide to Uniswap V2 contracts - The lesson covers the three key contracts in Uniswap V2 - Factory, Router, and Pair, and the relationship between them. The video further explains how users can create, add liquidity, remove liquidity, and swap tokens.
Previous lesson
Previous
Next lesson
Next
Give us feedback
Course Overview
About the course
How to use Uniswap v2 dex and contracts
Interacting with the Uniswap v2 router and factory
How to create Uniswap v2 liquidity pools
How to add liquidity to Uniswap v2 pools
Swaps, flash swaps, flash swap arbitrage, and time-weighted average price (TWAP)
Security researcher
$49,999 - $120,000 (avg. salary)
Smart Contract Auditor
$100,000 - $200,000 (avg. salary)
Smart Contract Engineer
$100,000 - $150,000 (avg. salary)
Web3 developer
$60,000 - $150,000 (avg. salary)
Web3 Developer Relations
$85,000 - $125,000 (avg. salary)
Last updated on October 9, 2024
Solidity Developer
Uniswap V2Duration: 14min
Duration: 1h 20min
Duration: 10min
Duration: 54min
Duration: 25min
Duration: 26min
Duration: 1h 03min
Duration: 59min
Course Overview
About the course
How to use Uniswap v2 dex and contracts
Interacting with the Uniswap v2 router and factory
How to create Uniswap v2 liquidity pools
How to add liquidity to Uniswap v2 pools
Swaps, flash swaps, flash swap arbitrage, and time-weighted average price (TWAP)
Security researcher
$49,999 - $120,000 (avg. salary)
Smart Contract Auditor
$100,000 - $200,000 (avg. salary)
Smart Contract Engineer
$100,000 - $150,000 (avg. salary)
Web3 developer
$60,000 - $150,000 (avg. salary)
Web3 Developer Relations
$85,000 - $125,000 (avg. salary)
Last updated on October 9, 2024
Testimonials
Read what our students have to say about this course.
Chainlink
Chainlink
Gustavo Gonzalez
Solutions Engineer at OpenZeppelin
Francesco Andreoli
Lead Devrel at Metamask
Albert Hu
DeForm Founding Engineer
Radek
Senior Developer Advocate at Ceramic
Boidushya
WalletConnect
Idris
Developer Relations Engineer at Axelar