5/5
### Exercise 2 Solution Let's go over the solution for exercise two. To deploy a pool, we'll need to call the `factory.createPool` function. The three inputs that we need to pass are `tokenA`, `tokenB`, and `fee`. For tokenA, we'll pass in `address(tokenA)`, `address(tokenB)` for tokenB, and `100` which is equivalent to 0.1% fee. ```javascript address pool = factory.createPool(address(tokenA), address(tokenB), 100); ``` That completes the exercise. Now, let's execute exercise 2. Inside the terminal, we'll execute the same test command: ```bash forge test --fork-url $FORK_URL --match-path test/uniswap-v3/exercises/UniswapV3Factory.test.sol ``` And our test passed again.
Let's go over the solution for exercise two. To deploy a pool, we'll need to call the factory.createPool
function. The three inputs that we need to pass are tokenA
, tokenB
, and fee
.
For tokenA, we'll pass in address(tokenA)
, address(tokenB)
for tokenB, and 100
which is equivalent to 0.1% fee.
That completes the exercise.
Now, let's execute exercise 2. Inside the terminal, we'll execute the same test command:
And our test passed again.
A short and comprehensive tutorial on deploying a pool in Uniswap V3. This lesson shows how to use the 'createPool' function in the Uniswap V3 Factory contract to deploy a pool with two tokens and a set fee.
Previous lesson
Previous
Next lesson
Next
Give us feedback
Course Overview
About the course
Concentrated liquidity and derive its equations
Uniswap V3 math
How to calculate the spot price of tokens
Single and multi position swapping
Factory contract architecture
How to calculate liquidity requirements
Uniswap V3 fee algorithm
Flash loans
TWAP price oracle
Smart Contract Auditor
$100,000 - $200,000 (avg. salary)
Blockchain Financial Analyst
$100,000 - $150,000 (avg. salary)
DeFi Developer
$75,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 August 11, 2025
Duration: 3min
Duration: 35min
Duration: 25min
Duration: 22min
Duration: 1h 43min
Duration: 11min
Duration: 1h 03min
Duration: 12min
Duration: 51min
Duration: 41min
Duration: 10min
Duration: 7min
Course Overview
About the course
Concentrated liquidity and derive its equations
Uniswap V3 math
How to calculate the spot price of tokens
Single and multi position swapping
Factory contract architecture
How to calculate liquidity requirements
Uniswap V3 fee algorithm
Flash loans
TWAP price oracle
Smart Contract Auditor
$100,000 - $200,000 (avg. salary)
Blockchain Financial Analyst
$100,000 - $150,000 (avg. salary)
DeFi Developer
$75,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 August 11, 2025