Skip to content

Commit

Permalink
linting
Browse files Browse the repository at this point in the history
  • Loading branch information
saucepoint committed Nov 14, 2023
1 parent 2eb4461 commit 04a1d92
Show file tree
Hide file tree
Showing 12 changed files with 110 additions and 178 deletions.
11 changes: 7 additions & 4 deletions src/components/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,7 @@ function Footer() {
</div>
</div> */}
<div className={styles.row}>
<a
href="https://github.com/uniswapfoundation/v4-by-example"
target="__blank"
>
<a href="https://github.com/uniswapfoundation/v4-by-example" target="__blank">
source
</a>
<div className={styles.bar}>|</div>
Expand All @@ -52,6 +49,12 @@ function Footer() {
license
</a>
</div>
<div className={styles.row}>
(fork of&nbsp;
<a href="https://solidity-by-example.org" target="__blank">
solidity-by-example)
</a>
</div>
</div>
)
}
Expand Down
26 changes: 4 additions & 22 deletions src/keywords.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,5 @@
{
"/swap": [
"swap",
"trade",
"swapping"
],
"/initialize": [
"pool",
"initialize",
"init",
"create",
"pair",
"factory"
],
"/create-liquidity": [
"liquidity",
"LP",
"lp",
"provide",
"provision",
"supply"
]
}
"/swap": ["swap", "trade", "swapping"],
"/initialize": ["pool", "initialize", "init", "create", "pair", "factory"],
"/create-liquidity": ["liquidity", "LP", "lp", "provide", "provision", "supply"]
}
22 changes: 8 additions & 14 deletions src/nav.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,36 +8,30 @@ export interface Translation {
url: string
}

export const TRANSLATIONS: Translation[] = [

]
export const TRANSLATIONS: Translation[] = []

export const SOL_ROUTES: Route[] = [
{
path: "initialize",
title: "Initialize Pool"
title: "Initialize Pool",
},
{
path: "create-liquidity",
title: "Create Liquidity"
title: "Create Liquidity",
},
{
path: "swap",
title: "Swap"
title: "Swap",
},
]

export const APP_ROUTES: Route[] = [
]
export const APP_ROUTES: Route[] = []

const HACK_ROUTES: Route[] = [
]
const HACK_ROUTES: Route[] = []

export const TEST_ROUTES: Route[] = [
]
export const TEST_ROUTES: Route[] = []

export const DEFI_ROUTES = [
]
export const DEFI_ROUTES = []

export const ROUTES_BY_CATEGORY = [
{
Expand Down
25 changes: 9 additions & 16 deletions src/pages/create-liquidity/index.html.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,17 @@ export const version = "0.8.20"
export const title = "Create Liquidity"
export const description = "Providing Liquidity to a Uniswap V4 Pool"

export const keywords = [
"liquidity",
"LP",
"lp",
"provide",
"provision",
"supply",
]
export const keywords = ["liquidity", "LP", "lp", "provide", "provision", "supply"]

export const codes = [
{
fileName: "CreateLiquidity.sol",
code: "Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yMDsKCmltcG9ydCB7SVBvb2xNYW5hZ2VyfSBmcm9tICJAdW5pc3dhcC92NC1jb3JlL2NvbnRyYWN0cy9pbnRlcmZhY2VzL0lQb29sTWFuYWdlci5zb2wiOwppbXBvcnQge1Bvb2xLZXl9IGZyb20gIkB1bmlzd2FwL3Y0LWNvcmUvY29udHJhY3RzL3R5cGVzL1Bvb2xLZXkuc29sIjsKaW1wb3J0IHtQb29sTW9kaWZ5UG9zaXRpb25UZXN0fSBmcm9tICJAdW5pc3dhcC92NC1jb3JlL2NvbnRyYWN0cy90ZXN0L1Bvb2xNb2RpZnlQb3NpdGlvblRlc3Quc29sIjsKCmNvbnRyYWN0IENyZWF0ZUxpcXVpZGl0eSB7CiAgICAvLyBzZXQgdGhlIHJvdXRlciBhZGRyZXNzCiAgICBQb29sTW9kaWZ5UG9zaXRpb25UZXN0IGxwUm91dGVyID0gUG9vbE1vZGlmeVBvc2l0aW9uVGVzdCgweDAxKTsKCiAgICBmdW5jdGlvbiBjcmVhdGVMaXF1aWRpdHkoCiAgICAgICAgUG9vbEtleSBtZW1vcnkgcG9vbEtleSwKICAgICAgICBpbnQyNCB0aWNrTG93ZXIsCiAgICAgICAgaW50MjQgdGlja1VwcGVyLAogICAgICAgIGludDI1NiB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expand Down
11 changes: 6 additions & 5 deletions src/pages/create-liquidity/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,28 @@ description: Providing Liquidity to a Uniswap V4 Pool
keywords: [liquidity, LP, lp, provide, provision, supply]
---

* Provide Liquidity to a Uniswap v4 Pool
- Provide Liquidity to a Uniswap v4 Pool

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

---

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

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

---

Providing liquidity involves 3 primary arguments:

* Which pool to LP on
* The range of the the liquidity, i.e. the upper and lower bounds
* A `liquidity` value that determines input token amounts
- Which pool to LP on
- The range of the the liquidity, i.e. the upper and lower bounds
- A `liquidity` value that determines input token amounts

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}}}
```
Expand Down
9 changes: 4 additions & 5 deletions src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ import styles from "./index.module.css"
import youTube from "../components/youtube.png"
import { ROUTES, ROUTES_BY_CATEGORY, TRANSLATIONS } from "../nav"

const UPDATES = [
"2023/10/18 - Initial V4 Snippets",
]
const UPDATES = ["2023/10/18 - Initial V4 Snippets"]

export default function HomePage() {
const [query, setQuery] = useState("")
Expand Down Expand Up @@ -120,8 +118,9 @@ export default function HomePage() {
<div className={styles.subHeader}>v0.8.22</div>
<div className={styles.main}>
<p>
An introduction to integrating and using <a href="https://github.com/uniswap/v4-core">Uniswap v4</a> through
simple examples
An introduction to integrating and using{" "}
<a href="https://github.com/uniswap/v4-core">Uniswap v4</a> through simple
examples
</p>

<div className={styles.updates}>
Expand Down
33 changes: 13 additions & 20 deletions src/pages/initialize/index.html.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,21 @@ export const version = "0.8.20"
export const title = "Initialize a Pool"
export const description = "Initializing a pool in Uniswap v4"

export const keywords = [
"pool",
"initialize",
"init",
"create",
"pair",
"factory",
]
export const keywords = ["pool", "initialize", "init", "create", "pair", "factory"]

export const codes = [
{
fileName: "HookDataInit.sol",
code: "SVBvb2xNYW5hZ2VyIG1hbmFnZXIgPSBJUG9vbE1hbmFnZXIoMHgwMSk7CgphZGRyZXNzIGhvb2sgPSBhZGRyZXNzKDB4ODApOyAvLyBwcmVmaXggaW5kaWNhdGVzIHRoZSBob29rIG9ubHkgaGFzIGEgYmVmb3JlSW5pdGlhbGl6ZSgpIGZ1bmN0aW9uCmFkZHJlc3MgdG9rZW4wID0gYWRkcmVzcygweDExKTsKYWRkcmVzcyB0b2tlbjEgPSBhZGRyZXNzKDB4MjIpOwp1aW50MjQgc3dhcEZlZSA9IDMwMDA7IC8vIDAuMDUlIGZlZSB0aWVyCmludDI0IHRpY2tTcGFjaW5nID0gNjA7CgovLyBmbG9vcihzcXJ0KDEpICogMl45NikKdWludDE2MCBzdGFydGluZ1ByaWNlID0gNzkyMjgxNjI1MTQyNjQzMzc1OTM1NDM5NTAzMzY7CgovLyBBc3N1bWUgdGhlIGN1c3RvbSBob29rIHJlcXVpcmVzIGEgdGltZXN0YW1wIHdoZW4gaW5pdGlhbGl6aW5nIGl0CmJ5dGVzIG1lbW9yeSBob29rRGF0YSA9IGFiaS5lbmNvZGUoYmxvY2sudGltZXN0YW1wKTsKClBvb2xLZXkgbWVtb3J5IHBvb2wgPSBQb29sS2V5KHsKICAgIGN1cnJlbmN5MDogQ3VycmVuY3kud3JhcCh0b2tlbjApLAogICAgY3VycmVuY3kxOiBDdXJyZW5jeS53cmFwKHRva2VuMSksCiAgICBmZWU6IHN3YXBGZWUsCiAgICB0aWNrU3BhY2luZzogdGlja1NwYWNpbmcsCiAgICBob29rczogSUhvb2tzKGhvb2spCn0pOwptYW5hZ2VyLmluaXRpYWxpemUocG9vbCwgc3RhcnRpbmdQcmljZSwgaG9va0RhdGEpOw==",
},
{
fileName: "Hookless.sol",
code: "SVBvb2xNYW5hZ2VyIG1hbmFnZXIgPSBJUG9vbE1hbmFnZXIoMHgwMSk7CgphZGRyZXNzIHRva2VuMCA9IGFkZHJlc3MoMHgxMSk7CmFkZHJlc3MgdG9rZW4xID0gYWRkcmVzcygweDIyKTsKdWludDI0IHN3YXBGZWUgPSA1MDA7IC8vIDAuMDUlIGZlZSB0aWVyCmludDI0IHRpY2tTcGFjaW5nID0gMTA7CgovLyBmbG9vcihzcXJ0KDEpICogMl45NikKdWludDE2MCBzdGFydGluZ1ByaWNlID0gNzkyMjgxNjI1MTQyNjQzMzc1OTM1NDM5NTAzMzY7CgovLyBob29rbGVzcyBwb29sIGRvZXNudCBleHBlY3QgYW55IGluaXRpYWxpemF0aW9uIGRhdGEKYnl0ZXMgbWVtb3J5IGhvb2tEYXRhID0gbmV3IGJ5dGVzKDApOwoKUG9vbEtleSBtZW1vcnkgcG9vbCA9IFBvb2xLZXkoewogICAgY3VycmVuY3kwOiBDdXJyZW5jeS53cmFwKHRva2VuMCksCiAgICBjdXJyZW5jeTE6IEN1cnJlbmN5LndyYXAodG9rZW4xKSwKICAgIGZlZTogc3dhcEZlZSwKICAgIHRpY2tTcGFjaW5nOiB0aWNrU3BhY2luZywKICAgIGhvb2tzOiBJSG9va3MoYWRkcmVzcygweDApKSAvLyAhISEgSG9va2xlc3MgcG9vbCBpcyBhZGRyZXNzKDB4MCkKfSk7Cm1hbmFnZXIuaW5pdGlhbGl6ZShwb29sLCBzdGFydGluZ1ByaWNlLCBob29rRGF0YSk7",
},
{
fileName: "PoolInitialize.sol",
code: "Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yMDsKCmltcG9ydCB7SVBvb2xNYW5hZ2VyfSBmcm9tICJAdW5pc3dh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IHRva2VuMQogICAgICAgIGlmICh0b2tlbjAgPiB0b2tlbjEpIHsKICAgICAgICAgICAgKHRva2VuMCwgdG9rZW4xKSA9ICh0b2tlbjEsIHRva2VuMCk7CiAgICAgICAgfQoKICAgICAgICBQb29sS2V5IG1lbW9yeSBwb29sID0gUG9vbEtleSh7CiAgICAgICAgICAgIGN1cnJlbmN5MDogQ3VycmVuY3kud3JhcCh0b2tlbjApLAogICAgICAgICAgICBjdXJyZW5jeTE6IEN1cnJlbmN5LndyYXAodG9rZW4xKSwKICAgICAgICAgICAgZmVlOiBzd2FwRmVlLAogICAgICAgICAgICB0aWNrU3BhY2luZzogdGlja1NwYWNpbmcsCiAgICAgICAgICAgIGhvb2tzOiBJSG9va3MoaG9vaykKICAgICAgICB9KTsKICAgICAgICBtYW5hZ2VyLmluaXRpYWxpemUocG9vbCwgc3FydFByaWNlWDk2LCBob29rRGF0YSk7CiAgICB9Cn0K",
},
]

const html = `<ul>
Expand Down
22 changes: 11 additions & 11 deletions src/pages/initialize/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,36 +5,36 @@ description: Initializing a pool in Uniswap v4
keywords: [pool, initialize, init, create, pair, factory]
---

* Create a Uniswap v4 Pool
- 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%. A trading pair exists as many pools, but one *pool* has one *hook contract*
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%. A trading pair exists as many pools, but one _pool_ has one _hook contract_

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*
_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
- 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*
_Hooks are not mandatory, you can create a pool without a hook_

```solidity
{{{Hookless}}}
```

*Some hooks may require initialization data, i.e. `block.timestamp`*
_Some hooks may require initialization data, i.e. `block.timestamp`_

```solidity
{{{HookDataInit}}}
```
```
Loading

0 comments on commit 04a1d92

Please sign in to comment.