From 52ae2a3f48ab39797ffe4e6eb24adb9fe66c3c73 Mon Sep 17 00:00:00 2001 From: saucepoint Date: Thu, 12 Sep 2024 15:47:39 -0400 Subject: [PATCH] setup guide --- .../00-setup-liquidity.mdx | 29 +++++++++++++++++++ .../02-manage-liquidity/01-mint-position.mdx | 26 +++++++---------- 2 files changed, 40 insertions(+), 15 deletions(-) create mode 100644 docs/contracts/v4/guides/02-manage-liquidity/00-setup-liquidity.mdx diff --git a/docs/contracts/v4/guides/02-manage-liquidity/00-setup-liquidity.mdx b/docs/contracts/v4/guides/02-manage-liquidity/00-setup-liquidity.mdx new file mode 100644 index 000000000..8ef5b891b --- /dev/null +++ b/docs/contracts/v4/guides/02-manage-liquidity/00-setup-liquidity.mdx @@ -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// +``` + +Install dependencies +```bash +forge install +``` + +--- + +## Manual + +(TODO: Add instructions for manual setup) \ No newline at end of file diff --git a/docs/contracts/v4/guides/02-manage-liquidity/01-mint-position.mdx b/docs/contracts/v4/guides/02-manage-liquidity/01-mint-position.mdx index 601496ba6..8a4dab3d3 100644 --- a/docs/contracts/v4/guides/02-manage-liquidity/01-mint-position.mdx +++ b/docs/contracts/v4/guides/02-manage-liquidity/01-mint-position.mdx @@ -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 @@ -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);