diff --git a/src/keywords.json b/src/keywords.json index 00fe0566..a7c01221 100644 --- a/src/keywords.json +++ b/src/keywords.json @@ -15,6 +15,8 @@ "/create-liquidity": [ "liquidity", "LP", + "lp", + "provide", "provision", "supply" ] diff --git a/src/nav.ts b/src/nav.ts index cc679652..947a376f 100644 --- a/src/nav.ts +++ b/src/nav.ts @@ -15,7 +15,7 @@ export const TRANSLATIONS: Translation[] = [ export const SOL_ROUTES: Route[] = [ { path: "initialize", - title: "Pool Initialize" + title: "Initialize Pool" }, { path: "create-liquidity", diff --git a/src/pages/create-liquidity/index.html.ts b/src/pages/create-liquidity/index.html.ts index 5c6ccd31..d5c76707 100644 --- a/src/pages/create-liquidity/index.html.ts +++ b/src/pages/create-liquidity/index.html.ts @@ -6,6 +6,8 @@ export const description = "Providing Liquidity to a Uniswap V4 Pool" export const keywords = [ "liquidity", "LP", + "lp", + "provide", "provision", "supply", ] @@ -21,14 +23,20 @@ export const codes = [ }, ] -const html = `
-

Expect Uniswap Labs to release an official contract around launch

-
-
-

⚠️ Using the test router in production will lead to a loss of funds ⚠️

-
-

Using the v4-core provided test router, we can provide liquidity to a pool. This should only be used for non-production testing purposes

+const html = ` +

⚠️ Using the test router in production will lead to a loss of funds ⚠️

+

Using the v4-core provided test router, we can provide liquidity to a pool. These snippets should only be used for non-production, testing purposes

Creating liquidity involves using periphery contracts. It is not recommended to directly provide liquidity with poolManager.modifyPosition

+

Providing liquidity involves 3 primary arguments:

+ +

Please see LiquidityAmounts for calculating the liquidity value

+

Expect Uniswap Labs to release an official contract around launch

// SPDX-License-Identifier: MIT
 pragma solidity ^0.8.20;
 
diff --git a/src/pages/create-liquidity/index.md b/src/pages/create-liquidity/index.md
index 21b7794b..5cd0b1e1 100644
--- a/src/pages/create-liquidity/index.md
+++ b/src/pages/create-liquidity/index.md
@@ -2,20 +2,26 @@
 title: Create Liquidity
 version: 0.8.20
 description: Providing Liquidity to a Uniswap V4 Pool
-keywords: [liquidity, LP, provision, supply]
+keywords: [liquidity, LP, lp, provide, provision, supply]
 ---
 
-> Expect Uniswap Labs to release an official contract around launch
+* Provide Liquidity to a Uniswap v4 Pool
 
-> ⚠️ Using the test router in production will lead to a loss of funds ⚠️ 
+⚠️ Using the test router in production **will lead to a loss of funds** ⚠️ 
 
-Using the `v4-core` provided *test* router, we can provide liquidity to a pool. This should only be used for non-production testing purposes
+Using the `v4-core` provided *test* router, we can provide liquidity to a pool. These snippets should only be used for non-production, testing purposes
 
+Creating liquidity involves using periphery contracts. It is **not** recommended to directly provide liquidity with `poolManager.modifyPosition`
 
+Providing liquidity involves 3 primary arguments:
 
+* Which pool to swap on
+* The range of the the liquidity, i.e. the upper and lower bounds
+* A `liquidity` value that determines input token amounts
 
-Creating liquidity involves using periphery contracts. It is **not** recommended to directly provide liquidity with `poolManager.modifyPosition`
+Please see [LiquidityAmounts](https://github.com/Uniswap/v4-periphery/blob/main/contracts/libraries/LiquidityAmounts.sol) for calculating the `liquidity` value
 
+#### Expect Uniswap Labs to release an official contract around launch
 ```solidity
 {{{CreateLiquidity}}}
 ```
diff --git a/src/pages/initialize/PoolInitialize.sol b/src/pages/initialize/PoolInitialize.sol
index 52e59cc9..2dacd753 100644
--- a/src/pages/initialize/PoolInitialize.sol
+++ b/src/pages/initialize/PoolInitialize.sol
@@ -21,7 +21,7 @@ contract PoolInitialize {
         uint160 sqrtPriceX96,
         bytes calldata hookData
     ) external {
-        // sort your tokens! v4 expects: token0 < token1
+        // sort your tokens! v4 requires token0 < token1
         if (token0 > token1) {
             (token0, token1) = (token1, token0);
         }
diff --git a/src/pages/initialize/PoolInitializeExampleInputs.sol b/src/pages/initialize/PoolInitializeExampleInputs.sol
index da602622..17d0363e 100644
--- a/src/pages/initialize/PoolInitializeExampleInputs.sol
+++ b/src/pages/initialize/PoolInitializeExampleInputs.sol
@@ -53,7 +53,7 @@ contract PoolInitializeExampleInputs {
         // floor(sqrt(1) * 2^96)
         uint160 startingPrice = 79228162514264337593543950336;
 
-        // Custom hook requires a timestamp when initializing it
+        // Assume the custom hook requires a timestamp when initializing it
         bytes memory hookData = abi.encode(block.timestamp);
 
         PoolKey memory pool = PoolKey({
diff --git a/src/pages/initialize/index.html.ts b/src/pages/initialize/index.html.ts
index 0de73daf..1a6ad564 100644
--- a/src/pages/initialize/index.html.ts
+++ b/src/pages/initialize/index.html.ts
@@ -1,6 +1,6 @@
 // metadata
 export const version = "0.8.20"
-export const title = "Pool Initialization"
+export const title = "Initialize a Pool"
 export const description = "Initializing a pool in Uniswap v4"
 
 export const keywords = [
@@ -15,16 +15,28 @@ export const keywords = [
 export const codes = [
     {
         fileName: "PoolInitialize.sol",
-        code: "Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yMDsKCmltcG9ydCB7SVBvb2xNYW5hZ2VyfSBmcm9tICJAdW5pc3dhcC92NC1jb3JlL2NvbnRyYWN0cy9pbnRlcmZhY2VzL0lQb29sTWFuYWdlci5zb2wiOwppbXBvcnQge0lIb29rc30gZnJvbSAiQHVuaXN3YXAvdjQtY29yZS9jb250cmFjdHMvaW50ZXJmYWNlcy9JSG9va3Muc29sIjsKaW1wb3J0IHtQb29sS2V5fSBmcm9tICJAdW5pc3dhcC92NC1jb3JlL2NvbnRyYWN0cy90eXBlcy9Qb29sS2V5LnNvbCI7CmltcG9ydCB7Q3VycmVuY3lMaWJyYXJ5LCBDdXJyZW5jeX0gZnJvbSAiQHVuaXN3YXAvdjQtY29yZS9jb250cmFjdHMvdHlwZXMvQ3VycmVuY3kuc29sIjsKCmNvbnRyYWN0IFBvb2xJbml0aWFsaXplIHsKICAgIHVzaW5nIEN1cnJlbmN5TGlicmFyeSBmb3IgQ3VycmVuY3k7CgogICAgLy8gc2V0IHRoZSBwb29sIG1hbmFnZXIgYWRkcmVzcwogICAgSVBvb2xNYW5hZ2VyIG1hbmFnZXIgPSBJUG9vbE1hbmFnZXIoMHgwMSk7CgogICAgZnVuY3Rpb24gaW5pdCgKICAgICAgICBhZGRyZXNzIHRva2VuMCwKICAgICAgICBhZGRyZXNzIHRva2VuMSwKICAgICAgICB1aW50MjQgc3dhcEZlZSwKICAgICAgICBpbnQyNCB0aWNrU3BhY2luZywKICAgICAgICBhZGRyZXNzIGhvb2ssCiAgICAgICAgdWludDE2MCBzcXJ0UHJpY2VYOTYsCiAgICAgICAgYnl0ZXMgY2FsbGRhdGEgaG9va0RhdGEKICAgICkgZXh0ZXJuYWwgewogICAgICAgIC8vIHNvcnQgeW91ciB0b2tlbnMhIHY0IGV4cGVjdHM6IHRva2VuMCA8IHRva2VuMQogICAgICAgIGlmICh0b2tlbjAgPiB0b2tlbjEpIHsKICAgICAgICAgICAgKHRva2VuMCwgdG9rZW4xKSA9ICh0b2tlbjEsIHRva2VuMCk7CiAgICAgICAgfQoKICAgICAgICBQb29sS2V5IG1lbW9yeSBwb29sID0gUG9vbEtleSh7CiAgICAgICAgICAgIGN1cnJlbmN5MDogQ3VycmVuY3kodG9rZW4wKSwKICAgICAgICAgICAgY3VycmVuY3kxOiBDdXJyZW5jeSh0b2tlbjEpLAogICAgICAgICAgICBmZWU6IHN3YXBGZWUsCiAgICAgICAgICAgIHRpY2tTcGFjaW5nOiB0aWNrU3BhY2luZywKICAgICAgICAgICAgaG9va3M6IElIb29rcyhob29rKQogICAgICAgIH0pOwogICAgICAgIG1hbmFnZXIuaW5pdGlhbGl6ZShwb29sLCBzcXJ0UHJpY2VYOTYsIGhvb2tEYXRhKTsKICAgIH0KfQo=",
+        code: "Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yMDsKCmltcG9ydCB7SVBvb2xNYW5hZ2VyfSBmcm9tICJAdW5pc3dhcC92NC1jb3JlL2NvbnRyYWN0cy9pbnRlcmZhY2VzL0lQb29sTWFuYWdlci5zb2wiOwppbXBvcnQge0lIb29rc30gZnJvbSAiQHVuaXN3YXAvdjQtY29yZS9jb250cmFjdHMvaW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ICBmZWU6IHN3YXBGZWUsCiAgICAgICAgICAgIHRpY2tTcGFjaW5nOiB0aWNrU3BhY2luZywKICAgICAgICAgICAgaG9va3M6IElIb29rcyhob29rKQogICAgICAgIH0pOwogICAgICAgIG1hbmFnZXIuaW5pdGlhbGl6ZShwb29sLCBzcXJ0UHJpY2VYOTYsIGhvb2tEYXRhKTsKICAgIH0KfQo=",
     },
     {
         fileName: "PoolInitializeExampleInputs.sol",
-        code: "Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yMDsKCmltcG9ydCB7SVBvb2xNYW5hZ2VyfSBmcm9tICJAdW5pc3dhcC92NC1jb3JlL2NvbnRyYWN0cy9pbnRlcmZhY2VzL0lQb29sTWFuYWdlci5zb2wiOwppbXBvcnQge0lIb29rc30gZnJvbSAiQHVuaXN3YXAvdjQtY29yZS9jb250cmFjdHMvaW50ZXJmYWNlcy9JSG9va3Muc29sIjsKaW1wb3J0IHtQb29sS2V5fSBmcm9tICJAdW5pc3dhcC92NC1jb3JlL2NvbnRyYWN0cy90eXBlcy9Qb29sS2V5LnNvbCI7CmltcG9ydCB7Q3VycmVuY3lMaWJyYXJ5LCBDdXJyZW5jeX0gZnJvbSAiQHVuaXN3YXAvdjQtY29yZS9jb250cmFjdHMvdHlwZXMvQ3VycmVuY3kuc29sIjsKCmNvbnRyYWN0IFBvb2xJbml0aWFsaXplRXhhbXBsZUlucHV0cyB7CiAgICB1c2luZyBDdXJyZW5jeUxpYnJhcnkgZm9yIEN1cnJlbmN5OwoKICAgIC8vIHNldCB0aGUgcG9vbCBtYW5hZ2VyIGFkZHJlc3MKICAgIElQb29sTWFuYWdlciBtYW5hZ2VyID0gSVBvb2xNYW5hZ2VyKDB4MDEpOwoKICAgIC8vLyBAbm90aWNlIEluaXRpYWxpemUgYSBob29rbGVzcyBwb29sOgogICAgLy8vICAgICAwLjA1JSBzd2FwIGZlZQogICAgLy8vICAgICB0aWNrIHNwYWNpbmcgb2YgMTAKICAgIC8vLyAgICAgc3RhcnRpbmcgcHJpY2Ugb2YgMToxCiAgICBmdW5jdGlvbiBleGFtcGxlQSgpIGV4dGVybmFsIHsKICAgICAgICBhZGRyZXNzIHRva2VuMCA9IGFkZHJlc3MoMHgxMSk7CiAgICAgICAgYWRkcmVzcyB0b2tlbjEgPSBhZGRyZXNzKDB4MjIpOwogICAgICAgIHVpbnQyNCBzd2FwRmVlID0gNTAwOwogICAgICAgIGludDI0IHRpY2tTcGFjaW5nID0gMTA7CgogICAgICAgIC8vIGZsb29yKHNxcnQoMSkgKiAyXjk2KQogICAgICAgIHVpbnQxNjAgc3RhcnRpbmdQcmljZSA9IDc5MjI4MTYyNTE0MjY0MzM3NTkzNTQzOTUwMzM2OwoKICAgICAgICAvLyBob29rbGVzcyBwb29sIGRvZXNudCBleHBlY3QgYW55IGluaXRpYWxpemF0aW9uIGRhdGEKICAgICAgICBieXRlcyBtZW1vcnkgaG9va0RhdGEgPSBuZXcgYnl0ZXMoMCk7CgogICAgICAgIFBvb2xLZXkgbWVtb3J5IHBvb2wgPSBQb29sS2V5KHsKICAgICAgICAgICAgY3VycmVuY3kwOiBDdXJyZW5jeSh0b2tlbjApLAogICAgICAgICAgICBjdXJyZW5jeTE6IEN1cnJlbmN5KHRva2VuMSksCiAgICAgICAgICAgIGZlZTogc3dhcEZlZSwKICAgICAgICAgICAgdGlja1NwYWNpbmc6IHRpY2tTcGFjaW5nLAogICAgICAgICAgICBob29rczogSUhvb2tzKGFkZHJlc3MoMHgwKSkKICAgICAgICB9KTsKICAgICAgICBtYW5hZ2VyLmluaXRpYWxpemUocG9vbCwgc3RhcnRpbmdQcmljZSwgaG9va0RhdGEpOwogICAgfQoKICAgIC8vLyBAbm90aWNlIEluaXRpYWxpemUgYSBwb29sIHdpdGggYSBjdXN0b20gaG9vazoKICAgIC8vLyAgICAgMC4zMCUgc3dhcCBmZWUKICAgIC8vLyAgICAgdGljayBzcGFjaW5nIG9mIDYwCiAgICAvLy8gICAgIHN0YXJ0aW5nIHByaWNlIG9mIDE6MQogICAgLy8vICAgICBob29rJ3MgYmVmb3JlSW5pdGlhbGl6ZSgpIHJlcXVpcmVzIHByb3ZpZGluZyBhIHRpbWVzdGFtcAogICAgZnVuY3Rpb24gZXhhbXBsZUIoKSBleHRlcm5hbCB7CiAgICAgICAgYWRkcmVzcyBob29rID0gYWRkcmVzcygweDgwKTsgLy8gcHJlZml4IGluZGljYXRlcyB0aGUgaG9vayBvbmx5IGhhcyBhIGJlZm9yZUluaXRpYWxpemUoKSBmdW5jdGlvbgogICAgICAgIGFkZHJlc3MgdG9rZW4wID0gYWRkcmVzcygweDExKTsKICAgICAgICBhZGRyZXNzIHRva2VuMSA9IGFkZHJlc3MoMHgyMik7CiAgICAgICAgdWludDI0IHN3YXBGZWUgPSAzMDAwOwogICAgICAgIGludDI0IHRpY2tTcGFjaW5nID0gNjA7CgogICAgICAgIC8vIGZsb29yKHNxcnQoMSkgKiAyXjk2KQogICAgICAgIHVpbnQxNjAgc3RhcnRpbmdQcmljZSA9IDc5MjI4MTYyNTE0MjY0MzM3NTkzNTQzOTUwMzM2OwoKICAgICAgICAvLyBDdXN0b20gaG9vayByZXF1aXJlcyBhIHRpbWVzdGFtcCB3aGVuIGluaXRpYWxpemluZyBpdAogICAgICAgIGJ5dGVzIG1lbW9yeSBob29rRGF0YSA9IGFiaS5lbmNvZGUoYmxvY2sudGltZXN0YW1wKTsKCiAgICAgICAgUG9vbEtleSBtZW1vcnkgcG9vbCA9IFBvb2xLZXkoewogICAgICAgICAgICBjdXJyZW5jeTA6IEN1cnJlbmN5KHRva2VuMCksCiAgICAgICAgICAgIGN1cnJlbmN5MTogQ3VycmVuY3kodG9rZW4xKSwKICAgICAgICAgICAgZmVlOiBzd2FwRmVlLAogICAgICAgICAgICB0aWNrU3BhY2luZzogdGlja1NwYWNpbmcsCiAgICAgICAgICAgIGhvb2tzOiBJSG9va3MoaG9vaykKICAgICAgICB9KTsKICA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HgxMSk7CiAgICAgICAgYWRkcmVzcyB0b2tlbjEgPSBhZGRyZXNzKDB4MjIpOwogICAgICAgIHVpbnQyNCBzd2FwRmVlID0gNTAwOwogICAgICAgIGludDI0IHRpY2tTcGFjaW5nID0gMTA7CgogICAgICAgIC8vIGZsb29yKHNxcnQoMSkgKiAyXjk2KQogICAgICAgIHVpbnQxNjAgc3RhcnRpbmdQcmljZSA9IDc5MjI4MTYyNTE0MjY0MzM3NTkzNTQzOTUwMzM2OwoKICAgICAgICAvLyBob29rbGVzcyBwb29sIGRvZXNudCBleHBlY3QgYW55IGluaXRpYWxpemF0aW9uIGRhdGEKICAgICAgICBieXRlcyBtZW1vcnkgaG9va0RhdGEgPSBuZXcgYnl0ZXMoMCk7CgogICAgICAgIFBvb2xLZXkgbWVtb3J5IHBvb2wgPSBQb29sS2V5KHsKICAgICAgICAgICAgY3VycmVuY3kwOiBDdXJyZW5jeSh0b2tlbjApLAogICAgICAgICAgICBjdXJyZW5jeTE6IEN1cnJlbmN5KHRva2VuMSksCiAgICAgICAgICAgIGZlZTogc3dhcEZlZSwKICAgICAgICAgICAgdGlja1NwYWNpbmc6IHRpY2tTcGFjaW5nLAogICAgICAgICAgICBob29rczogSUhvb2tzKGFkZHJlc3MoMHgwKSkKICAgICAgICB9KTsKICAgICAgICBtYW5hZ2VyLmluaXRpYWxpemUocG9vbCwgc3RhcnRpbmdQcmljZSwgaG9va0RhdGEpOwogICAgfQoKICAgIC8vLyBAbm90aWNlIEluaXRpYWxpemUgYSBwb29sIHdpdGggYSBjdXN0b20gaG9vazoKICAgIC8vLyAgICAgMC4zMCUgc3dhcCBmZWUKICAgIC8vLyAgICAgdGljayBzcGFjaW5nIG9mIDYwCiAgICAvLy8gICAgIHN0YXJ0aW5nIHByaWNlIG9mIDE6MQogICAgLy8vICAgICBob29rJ3MgYmVmb3JlSW5pdGlhbGl6ZSgpIHJlcXVpcmVzIHByb3ZpZGluZyBhIHRpbWVzdGFtcAogICAgZnVuY3Rpb24gZXhhbXBsZUIoKSBleHRlcm5hbCB7CiAgICAgICAgYWRkcmVzcyBob29rID0gYWRkcmVzcygweDgwKTsgLy8gcHJlZml4IGluZGljYXRlcyB0aGUgaG9vayBvbmx5IGhhcyBhIGJlZm9yZUluaXRpYWxpemUoKSBmdW5jdGlvbgogICAgICAgIGFkZHJlc3MgdG9rZW4wID0gYWRkcmVzcygweDExKTsKICAgICAgICBhZGRyZXNzIHRva2VuMSA9IGFkZHJlc3MoMHgyMik7CiAgICAgICAgdWludDI0IHN3YXBGZWUgPSAzMDAwOwogICAgICAgIGludDI0IHRpY2tTcGFjaW5nID0gNjA7CgogICAgICAgIC8vIGZsb29yKHNxcnQoMSkgKiAyXjk2KQogICAgICAgIHVpbnQxNjAgc3RhcnRpbmdQcmljZSA9IDc5MjI4MTYyNTE0MjY0MzM3NTkzNTQzOTUwMzM2OwoKICAgICAgICAvLyBBc3N1bWUgdGhlIGN1c3RvbSBob29rIHJlcXVpcmVzIGEgdGltZXN0YW1wIHdoZW4gaW5pdGlhbGl6aW5nIGl0CiAgICAgICAgYnl0ZXMgbWVtb3J5IGhvb2tEYXRhID0gYWJpLmVuY29kZShibG9jay50aW1lc3RhbXApOwoKICAgICAgICBQb29sS2V5IG1lbW9yeSBwb29sID0gUG9vbEtleSh7CiAgICAgICAgICAgIGN1cnJlbmN5MDogQ3VycmVuY3kodG9rZW4wKSwKICAgICAgICAgICAgY3VycmVuY3kxOiBDdXJyZW5jeSh0b2tlbjEpLAogICAgICAgICAgICBmZWU6IHN3YXBGZWUsCiAgICAgICAgICAgIHRpY2tTcGFjaW5nOiB0aWNrU3BhY2luZywKICAgICAgICAgICAgaG9va3M6IElIb29rcyhob29rKQogICAgICAgIH0pOwogICAgICAgIG1hbmFnZXIuaW5pdGlhbGl6ZShwb29sLCBzdGFydGluZ1ByaWNlLCBob29rRGF0YSk7CiAgICB9Cn0K",
     },
 ]
 
-const html = `

A single trading pair (ETH/USDC), can exist as an infinite number of pools in v4. Uniswap v4 does not restrict fee tiers to 1%, 0.30%, or 0.05%. The same trading pair can also have an infinite number of hooks.

+const html = ` +

A single trading pair (ETH/USDC), can exist as an infinite number of pools in v4. Uniswap v4 does not restrict fee tiers to 1%, 0.30%, or 0.05%. The same trading pair can also have an infinite number of hooks.

Initializing a V3 Pair involved deploying a contract via the factory. In V4, pools are initialized and managed by a single contract: PoolManager

+

Think of a PoolKey as the unique identifier for a pool, i.e. like a v3 pair's contract address

+

Creating a Pool is determined by 5 primary arguments:

+
// SPDX-License-Identifier: MIT
 pragma solidity ^0.8.20;
 
@@ -48,7 +60,7 @@ const html = `

A single trading pair (ETH/USDC), can exist as an infinite numb uint160 sqrtPriceX96, bytes calldata hookData ) external { - // sort your tokens! v4 expects: token0 < token1 + // sort your tokens! v4 requires token0 < token1 if (token0 > token1) { (token0, token1) = (token1, token0); } @@ -64,7 +76,7 @@ const html = `

A single trading pair (ETH/USDC), can exist as an infinite numb } }

Examples of Initializing a V4 Pool

-

Remove array element by shifting elements from right to left

+

Hooks are not mandatory, you can create a pool without a hook

// SPDX-License-Identifier: MIT
 pragma solidity ^0.8.20;
 
@@ -120,7 +132,7 @@ const html = `

A single trading pair (ETH/USDC), can exist as an infinite numb // floor(sqrt(1) * 2^96) uint160 startingPrice = 79228162514264337593543950336; - // Custom hook requires a timestamp when initializing it + // Assume the custom hook requires a timestamp when initializing it bytes memory hookData = abi.encode(block.timestamp); PoolKey memory pool = PoolKey({ diff --git a/src/pages/initialize/index.md b/src/pages/initialize/index.md index a3a6095d..79053779 100644 --- a/src/pages/initialize/index.md +++ b/src/pages/initialize/index.md @@ -1,20 +1,34 @@ --- -title: Pool Initialization +title: Initialize a Pool version: 0.8.20 description: Initializing a pool in Uniswap v4 keywords: [pool, initialize, init, create, pair, factory] --- -A single trading pair (ETH/USDC), can exist as an infinite number of pools in v4. Uniswap v4 does **not** restrict fee tiers to 1%, 0.30%, or 0.05%. The same trading pair can also have an infinite number of hooks. +* Create a Uniswap v4 Pool + +A single trading pair (*ETH/USDC*), can exist as an infinite number of pools in v4. Uniswap v4 does **not** restrict fee tiers to 1%, 0.30%, or 0.05%. The same trading pair can also have an infinite number of hooks. Initializing a V3 Pair involved deploying a contract via the factory. In V4, pools are initialized and managed by a single contract: `PoolManager` +*Think of a `PoolKey` as the unique identifier for a pool, i.e. like a v3 pair's contract address* + +Creating a Pool is determined by 5 primary arguments: + +* Trading pair *currency0, currency1* +* Fee tier +* Tick spacing +* Hook +* Starting Price + ```solidity {{{PoolInitialize}}} ``` ### Examples of Initializing a V4 Pool +*Hooks are not mandatory, you can create a pool without a hook* + ```solidity {{{PoolInitializeExampleInputs}}} ``` diff --git a/src/pages/swap/index.html.ts b/src/pages/swap/index.html.ts index fc2f6700..7fb6d391 100644 --- a/src/pages/swap/index.html.ts +++ b/src/pages/swap/index.html.ts @@ -20,18 +20,19 @@ export const codes = [ }, ] -const html = `

-

Expect Uniswap Labs to release an official contract around launch

-
+const html = `
    +
  • Swap between tokens on a single pool
  • +

Using the v4-core provided test router, we can swap on a single pool. These snippets should only be used for non-production, testing purposes

-

Swapping, in production, will typically use a periphery contract. It is not recommended to directly swap with poolManager.swap

-

Swapping will require 3 arguments:

+

Swapping will typically make use of a periphery contract. It is not recommended to directly swap with poolManager.swap

+

Swapping involves 3 primary arguments:

    -
  • Which pool/hook to swap on
  • -
  • The direction of the swap, token0 -> token1 or token1 -> token0
  • +
  • Which pool to swap on
  • +
  • The direction of the swap, token0 -> token1 or token1 -> token0
  • The input token amount

(Note: A quoter contract is unavailable at this time)

+

Expect Uniswap Labs to release an official contract around launch

// SPDX-License-Identifier: MIT
 pragma solidity ^0.8.20;
 
diff --git a/src/pages/swap/index.md b/src/pages/swap/index.md
index 1819ef82..28316b0c 100644
--- a/src/pages/swap/index.md
+++ b/src/pages/swap/index.md
@@ -5,20 +5,21 @@ description: Swapping on a single pool
 keywords: [swap, trade, swapping]
 ---
 
-> Expect Uniswap Labs to release an official contract around launch
+* Swap between tokens on a single pool
 
 Using the `v4-core` provided *test* router, we can swap on a single pool. These snippets should only be used for non-production, testing purposes
 
-Swapping, in production, will typically use a periphery contract. It is **not** recommended to directly swap with `poolManager.swap`
+Swapping will typically make use of a periphery contract. It is **not** recommended to directly swap with `poolManager.swap`
 
 Swapping involves 3 primary arguments:
 
-* Which pool/hook to swap on
-* The direction of the swap, token0 -> token1 or token1 -> token0
+* Which pool to swap on
+* The direction of the swap, `token0 -> token1` or `token1 -> token0`
 * The input token amount
 
 (Note: A quoter contract is unavailable at this time)
 
+#### Expect Uniswap Labs to release an official contract around launch
 ```solidity
 {{{Swap}}}
 ```
diff --git a/src/search.json b/src/search.json
index 45f17701..5a0b7cf6 100644
--- a/src/search.json
+++ b/src/search.json
@@ -32,6 +32,12 @@
   "LP": [
     "/create-liquidity"
   ],
+  "lp": [
+    "/create-liquidity"
+  ],
+  "provide": [
+    "/create-liquidity"
+  ],
   "provision": [
     "/create-liquidity"
   ],