You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/contracts/liquidity-launchpad/01-introduction.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -34,7 +34,7 @@ The Uniswap Liquidity Launchpad framework is built on three coordinated componen
34
34
35
35
1.**[Liquidity Launcher →](https://github.com/Uniswap/liquidity-launcher)** Central orchestration contract that coordinates distribution and liquidity deployment
36
36
2.**[Token Factory →](https://github.com/Uniswap/uerc20-factory)** (Optional) Creates new ERC-20 tokens with metadata, or integrates existing tokens
37
-
3.**Liquidity Strategies** - Modular contracts for different price discovery and liquidity mechanisms (prebuilt [LBP Strategy](https://github.com/Uniswap/liquidity-launcher) or [custom strategies](./05-strategies.md#writing-a-custom-strategy))
37
+
3.**Liquidity Strategies** - Modular contracts for different price discovery and liquidity mechanisms (prebuilt [LBP Strategy](./06-strategies.md#lbpstrategybase) or [custom strategies](./06-strategies.md#writing-a-custom-strategy))
38
38
39
39
Each component is designed to be composable and extensible, allowing you to customize your liquidity bootstrapping while maintaining security and fairness guarantees.
@@ -73,7 +73,7 @@ export const USDC_TOKEN = new Token(
73
73
74
74
## Computing the PoolId out of PoolKey
75
75
76
-
In this example, we will construct the **USDC - ETH** Pool with **LOW** fees and without hooks. The SDK provides a method to compute the `PoolId` for this pool:
76
+
In this example, we will construct the **ETH - USDC** Pool with **LOW** fees and without hooks. The SDK provides a method to compute the `PoolId` for this pool:
## Referencing the StateView contract and fetching metadata
87
87
88
-
Now that we have the `PoolId` of a **USDC - ETH** Pool, we need to call [StateView](/contracts/v4/guides/state-view) contract to get the pool state. In v4 you need to use `StateLibrary` to read pool state, but offchain systems—such as frontends or analytics services—require a deployed contract with view functions. This is where `StateView` comes in.
88
+
Now that we have the `PoolId` of a **ETH - USDC** Pool, we need to call [StateView](/contracts/v4/guides/state-view) contract to get the pool state. In v4 you need to use `StateLibrary` to read pool state, but offchain systems—such as frontends or analytics services—require a deployed contract with view functions. This is where `StateView` comes in.
89
89
To construct the Contract we need to provide the address of the contract, its ABI and a provider connected to an RPC endpoint.
90
90
91
91
```typescript
@@ -103,7 +103,7 @@ const stateViewContract = new ethers.Contract(
103
103
104
104
We get the `STATE_VIEW_ADDRESS` for our chain from [Uniswap Deployments](/contracts/v4/deployments).
105
105
Once we have set up our reference to the contract, we can proceed to access its methods. To construct our offchain representation of the Pool, we need to fetch its liquidity, sqrtPrice, currently active tick and the full Tick data.
106
-
We get the **liquidity**, **sqrtPrice** and **tick** directly from the blockchain by calling `getLiquidity()`and `getSlot0()` on the StateView contract:
106
+
We get the **liquidity**, **sqrtPrice** and **tick** directly from the blockchain by calling `getLiquidity()`and `getSlot0()` on the StateView contract:
107
107
108
108
```typescript
109
109
const [slot0, liquidity] =awaitPromise.all([
@@ -127,12 +127,12 @@ For our use case, we only need the `sqrtPriceX96` and the currently active `tick
127
127
## Fetching all Ticks
128
128
129
129
v4 pools use ticks to [concentrate liquidity](/concepts/protocol/concentrated-liquidity) in price ranges and allow for better pricing of trades.
130
-
Even though most Pools only have a couple of **initialized ticks**, it is possible that a pools liquidity is defined by thousands of **initialized ticks**.
130
+
Even though most Pools only have a couple of **initialized ticks**, it is possible that a pool's liquidity is defined by thousands of **initialized ticks**.
131
131
In that case, it can be very expensive or slow to get all of them with normal RPC calls.
132
132
133
133
If you are not familiar with the concept of ticks, check out the [`introduction`](/concepts/protocol/concentrated-liquidity#ticks).
134
134
135
-
To access tick data, we will use the `getTickInfo` function of the State View contract:
135
+
To access tick data, we will use the `getTickInfo` function of the StateView contract:
136
136
137
137
```solidity
138
138
function getTickInfo(PoolId poolId, int24 tick)
@@ -148,7 +148,7 @@ To access tick data, we will use the `getTickInfo` function of the State View co
148
148
149
149
The `tick` parameter that we provide the function with is the **index** (memory position) of the Tick we are trying to fetch.
150
150
To get the indices of all initialized Ticks of the Pool, we can calculate them from the **tickBitmaps**.
151
-
To fetch a `tickBitmap` we use a `getTickBitmap` function of the State View contract:
151
+
To fetch a `tickBitmap` we use a `getTickBitmap` function of the StateView contract:
152
152
153
153
```solidity
154
154
function getTickBitmap(
@@ -159,7 +159,7 @@ To fetch a `tickBitmap` we use a `getTickBitmap` function of the State View cont
159
159
160
160
A pool stores lots of bitmaps, each of which contain the status of 256 Ticks.
161
161
The parameter `int16 wordPosition` the function accepts is the position of the bitMap we want to fetch.
162
-
We can calculate all the position of bitMaps (or words as they are sometimes called) from the `tickSpacing` of the Pool, which is in turn dependant on the Fee tier.
162
+
We can calculate all the position of bitMaps (or words as they are sometimes called) from the `tickSpacing` of the Pool, which is in turn dependent on the Fee tier.
163
163
164
164
So to summarise we need 4 steps to fetch all initialized ticks:
165
165
@@ -176,7 +176,7 @@ Multicall contracts **aggregate results** from multiple contract calls and there
176
176
This can improve the **speed** of fetching large amounts of data significantly and ensures that the data fetched is all from the **same block**.
177
177
178
178
We will use the Multicall2 contract by MakerDAO.
179
-
We use the `ethers-muticall` npm package to easily interact with the Contract.
179
+
We use the `ethers-multicall` npm package to easily interact with the Contract.
180
180
181
181
## Calculating all bitMap positions
182
182
@@ -207,7 +207,7 @@ One word contains 256 ticks, so we can compress the ticks by right shifting 8 bi
207
207
208
208
Knowing the positions of words, we can now fetch them using multicall.
209
209
210
-
First we initialize our multicall providers and State View Contract:
210
+
First we initialize our multicall providers and StateView Contract:
A great visualization of what the bitMaps look like can be found in the [Uniswap v3 development book](https://uniswapv3book.com/docs/milestone_2/tick-bitmap-index/](https://uniswapv3book.com/milestone_2/tick-bitmap-index.html):
248
+
A great visualization of what the bitMaps look like can be found in the [Uniswap v3 development book](https://uniswapv3book.com/milestone_2/tick-bitmap-index.html):
If the tick is **initialized**, we revert the compression from tick to word we made earlier by multiplying the word index with 256, which is the same as left shifting by 8 bit, adding the position we are currently at, and multiplying with the tickSpacing:
265
+
If the tick is **initialized**, we revert the compression from tick to word we made earlier by multiplying the word index with 256, which is the same as left shifting by 8 bits, adding the position we are currently at, and multiplying with the tickSpacing:
266
266
267
267
```typescript
268
268
const tickIndex = (ind*256+i) *tickSpacing
@@ -333,9 +333,9 @@ We need to parse the response from our RPC provider to JSBI values that the v4-s
Copy file name to clipboardExpand all lines: docs/sdk/v4/guides/liquidity/collecting-fees.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -246,7 +246,7 @@ async function verifyFeeCollection(receipt, userAddress, positionDetails, ethBal
246
246
247
247
### Check Your Token Balances
248
248
249
-
You can simply measuring the balance change in your wallet before vs. after the call. For example, read your token balances (and ETH balance) prior to calling, then after the transaction confirm the increases. Because v4 might auto-wrap or unwrap ETH, if one of the tokens was ETH you should check your ETH balance difference. In ETH pools, no ERC-20 transfer event will fire for the ETH – the ETH will be sent directly to you (as an internal transfer), which is why checking the balance or the transaction's internal traces is necessary to confirm the amount.
249
+
You can simply measure the balance change in your wallet before vs. after the call. For example, read your token balances (and ETH balance) prior to calling, then after the transaction confirm the increases. Because v4 might auto-wrap or unwrap ETH, if one of the tokens was ETH you should check your ETH balance difference. In ETH pools, no ERC-20 transfer event will fire for the ETH – the ETH will be sent directly to you (as an internal transfer), which is why checking the balance or the transaction's internal traces is necessary to confirm the amount.
Copy file name to clipboardExpand all lines: docs/sdk/v4/guides/swaps/single-hop-swapping.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -167,4 +167,4 @@ The rest of the swap process remains the same.
167
167
168
168
## Next Steps
169
169
170
-
Now that you understand single-hop swaps, you might want to explore [multi-hop swaps](./03-multi-hop-swapping.md) for trading between tokens without direct pools or enough liquidity.
170
+
Now that you understand single-hop swaps, you might want to explore [multi-hop swaps](./multi-hop-swapping.md) for trading between tokens without direct pools or enough liquidity.
0 commit comments