# Position Manager Exercises In this exercise, you'll learn how to use the [`PositionManager`](https://github.com/Uniswap/v4-periphery/blob/main/src/PositionManager.sol) contract. The starter code for this exercise is provided in [`foundry/src/exercises/Posm.sol`](https://github.com/Cyfrin/defi-uniswap-v4/blob/main/foundry/src/exercises/Posm.sol) Solution is in [`foundry/src/solutions/Posm.sol`](https://github.com/Cyfrin/defi-uniswap-v4/blob/main/foundry/src/solutions/Posm.sol) ## Task 1 - Increase liquidity ```solidity function increaseLiquidity( uint256 tokenId, uint256 liquidity, uint128 amount0Max, uint128 amount1Max ) external payable { // Write your code here } ``` Complete the function to increase liquidity for the position identified by `tokenId`. ## Task 2 - Decrease liquidity ```solidity function decreaseLiquidity( uint256 tokenId, uint256 liquidity, uint128 amount0Min, uint128 amount1Min ) external { // Write your code here } ``` Complete the function to decrease liquidity for the position identified by `tokenId`. ## Task 3 - Burn ```solidity function burn(uint256 tokenId, uint128 amount0Min, uint128 amount1Min) external { // Write your code here } ``` Complete the function to burn the position identified by `tokenId`. ## Test ```shell forge test --fork-url $FORK_URL --match-path test/Posm.test.sol -vvv ```
In this exercise, you'll learn how to use the PositionManager contract.
The starter code for this exercise is provided in foundry/src/exercises/Posm.sol
Solution is in foundry/src/solutions/Posm.sol
Complete the function to increase liquidity for the position identified by tokenId.
Complete the function to decrease liquidity for the position identified by tokenId.
Complete the function to burn the position identified by tokenId.
Previous lesson
Previous
Next lesson
Next
Course Overview
About the course
Difference between Uniswap v3 and v4
Uniswap v4 PoolManager
Uniswap v4 Hooks
Uniswap v4 PositionManager
Uniswap v4 Universal Router
Uniswap v4 Singleton architecture and flash accounting
Uniswap v4 operations and lifecycle
Uniswap v4 multihopping and quoting
How to build a Uniswap v4 swap router
How to build a smart contract a liquidation bot executes
Last updated on November 6, 2025
Duration: 5min
Duration: 7min
Duration: 39min
Duration: 35min
Duration: 34min
Duration: 31min
Course Overview
About the course
Difference between Uniswap v3 and v4
Uniswap v4 PoolManager
Uniswap v4 Hooks
Uniswap v4 PositionManager
Uniswap v4 Universal Router
Uniswap v4 Singleton architecture and flash accounting
Uniswap v4 operations and lifecycle
Uniswap v4 multihopping and quoting
How to build a Uniswap v4 swap router
How to build a smart contract a liquidation bot executes
Last updated on November 6, 2025