Skip to content

Commit

Permalink
setup guide
Browse files Browse the repository at this point in the history
  • Loading branch information
saucepoint committed Sep 12, 2024
1 parent c876be0 commit 52ae2a3
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
title: Setup
---

# Setup

For users looking to interact with the canonical Uniswap v4 `PositionManager`, _v4-periphery_ is a required dependency

Currently, developing with Uniswap v4 _requires [foundry](https://book.getfoundry.sh)_

## Quickstart

_Use [v4-template](https://github.com/new?template_name=v4-template&template_owner=uniswapfoundation)_, which has pre-configured dependencies and tests for Uniswap v4

Clone the repository made from _v4-template_
```bash
git clone https://github.com/<your_username>/<your_repo>
```

Install dependencies
```bash
forge install
```

---

## Manual

(TODO: Add instructions for manual setup)
26 changes: 11 additions & 15 deletions docs/contracts/v4/guides/02-manage-liquidity/01-mint-position.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,7 @@ parameters.

### Setup

Install [foundry](https://book.getfoundry.sh)

Add v4-periphery as a dependency to your project

```bash
forge install uniswap/v4-periphery
```
See the [setup guide](./00-setup-liquidity.mdx)

# Guide

Expand Down Expand Up @@ -54,14 +48,16 @@ bytes[] memory params = new bytes[](2);

The `MINT_POSITION` action requires the following parameters:

* `poolKey` - the `PoolKey` where the liquidity will be added to
* `tickLower` - _int24_, the lower tick boundary of the position
* `tickUpper` - _int24_, the upper tick boundary of the position
* `liquidity`- _uint256_, the amount of liquidity units to mint
* `amount0Max` - _uint256_, the maximum amount of currency0 msg.sender is willing to pay
* `amount1Max` - _uint256_, the maximum amount of currency1 msg.sender is willing to pay
* `recipient` - _address_, the address that will receive the liquidity position (ERC-721)
* `hookData` - _bytes_, arbitrary data that will be forwarded to hook functions
| Parameter | Type | Description |
|--------------|-----------|----------------------------------------------------------------|
| `poolKey` | _PoolKey_ | where the liquidity will be added to |
| `tickLower` | _int24_ | the lower tick boundary of the position |
| `tickUpper` | _int24_ | the upper tick boundary of the position |
| `liquidity` | _uint256_ | the amount of liquidity units to mint |
| `amount0Max` | _uint256_ | the maximum amount of currency0 msg.sender is willing to pay |
| `amount1Max` | _uint256_ | the maximum amount of currency1 msg.sender is willing to pay |
| `recipient` | _address_ | the address that will receive the liquidity position (ERC-721) |
| `hookData` | _bytes_ | arbitrary data that will be forwarded to hook functions |

```solidity
params[0] = abi.encode(poolKey, tickLower, tickUpper, liquidity, amount0Max, amount1Max, recipient, hookData);
Expand Down

0 comments on commit 52ae2a3

Please sign in to comment.