Skip to content

Commit

Permalink
Uniswap v4 Technical Reference (#781)
Browse files Browse the repository at this point in the history
  • Loading branch information
saucepoint authored Sep 30, 2024
1 parent 29192a3 commit dcce743
Show file tree
Hide file tree
Showing 125 changed files with 12,510 additions and 5 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ typechain/

.env

# ignore forge-doc artifacts as they are copied to the proper location
forge-docs/v4-core/*
forge-docs/v4-periphery/*

# Debugging logs
npm-debug.log*
yarn-debug.log*
Expand Down
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[submodule "submodules/v4-core"]
path = submodules/v4-core
url = https://github.com/uniswap/v4-core
[submodule "submodules/v4-periphery"]
path = submodules/v4-periphery
url = https://github.com/uniswap/v4-periphery
89 changes: 89 additions & 0 deletions docs/contracts/v4/reference/core/ERC6909.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# ERC6909
[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/ERC6909.sol)
| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc)

**Inherits:**
[IERC6909Claims](contracts/v4/reference/core/interfaces/IERC6909Claims.md)

**Author:**
Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC6909.sol)

Minimalist and gas efficient standard ERC6909 implementation.

*Copied from the commit at 4b47a19038b798b4a33d9749d25e570443520647*

*This contract has been modified from the implementation at the above link.*


## State Variables
### isOperator

```solidity
mapping(address owner => mapping(address operator => bool isOperator)) public isOperator;
```


### balanceOf

```solidity
mapping(address owner => mapping(uint256 id => uint256 balance)) public balanceOf;
```


### allowance

```solidity
mapping(address owner => mapping(address spender => mapping(uint256 id => uint256 amount))) public allowance;
```


## Functions
### transfer


```solidity
function transfer(address receiver, uint256 id, uint256 amount) public virtual returns (bool);
```

### transferFrom


```solidity
function transferFrom(address sender, address receiver, uint256 id, uint256 amount) public virtual returns (bool);
```

### approve


```solidity
function approve(address spender, uint256 id, uint256 amount) public virtual returns (bool);
```

### setOperator


```solidity
function setOperator(address operator, bool approved) public virtual returns (bool);
```

### supportsInterface


```solidity
function supportsInterface(bytes4 interfaceId) public view virtual returns (bool);
```

### _mint


```solidity
function _mint(address receiver, uint256 id, uint256 amount) internal virtual;
```

### _burn


```solidity
function _burn(address sender, uint256 id, uint256 amount) internal virtual;
```

30 changes: 30 additions & 0 deletions docs/contracts/v4/reference/core/ERC6909Claims.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# ERC6909Claims
[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/ERC6909Claims.sol)
| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc)

**Inherits:**
[ERC6909](contracts/v4/reference/core/ERC6909.md)

ERC6909Claims inherits ERC6909 and implements an internal burnFrom function


## Functions
### _burnFrom

Burn `amount` tokens of token type `id` from `from`.

*if sender is not `from` they must be an operator or have sufficient allowance.*


```solidity
function _burnFrom(address from, uint256 id, uint256 amount) internal;
```
**Parameters**

|Name|Type|Description|
|----|----|-----------|
|`from`|`address`|The address to burn tokens from.|
|`id`|`uint256`|The currency to burn.|
|`amount`|`uint256`|The amount to burn.|


76 changes: 76 additions & 0 deletions docs/contracts/v4/reference/core/Extsload.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Extsload
[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/Extsload.sol)
| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc)

**Inherits:**
[IExtsload](contracts/v4/reference/core/interfaces/IExtsload.md)

Enables public storage access for efficient state retrieval by external contracts.
https://eips.ethereum.org/EIPS/eip-2330#rationale


## Functions
### extsload

Called by external contracts to access granular pool state


```solidity
function extsload(bytes32 slot) external view returns (bytes32);
```
**Parameters**

|Name|Type|Description|
|----|----|-----------|
|`slot`|`bytes32`|Key of slot to sload|

**Returns**

|Name|Type|Description|
|----|----|-----------|
|`<none>`|`bytes32`|value The value of the slot as bytes32|


### extsload

Called by external contracts to access granular pool state


```solidity
function extsload(bytes32 startSlot, uint256 nSlots) external view returns (bytes32[] memory);
```
**Parameters**

|Name|Type|Description|
|----|----|-----------|
|`startSlot`|`bytes32`||
|`nSlots`|`uint256`||

**Returns**

|Name|Type|Description|
|----|----|-----------|
|`<none>`|`bytes32[]`|value The value of the slot as bytes32|


### extsload

Called by external contracts to access granular pool state


```solidity
function extsload(bytes32[] calldata slots) external view returns (bytes32[] memory);
```
**Parameters**

|Name|Type|Description|
|----|----|-----------|
|`slots`|`bytes32[]`||

**Returns**

|Name|Type|Description|
|----|----|-----------|
|`<none>`|`bytes32[]`|value The value of the slot as bytes32|


54 changes: 54 additions & 0 deletions docs/contracts/v4/reference/core/Exttload.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Exttload
[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/Exttload.sol)
| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc)

**Inherits:**
[IExttload](contracts/v4/reference/core/interfaces/IExttload.md)

Enables public transient storage access for efficient state retrieval by external contracts.
https://eips.ethereum.org/EIPS/eip-2330#rationale


## Functions
### exttload

Called by external contracts to access transient storage of the contract


```solidity
function exttload(bytes32 slot) external view returns (bytes32);
```
**Parameters**

|Name|Type|Description|
|----|----|-----------|
|`slot`|`bytes32`|Key of slot to tload|

**Returns**

|Name|Type|Description|
|----|----|-----------|
|`<none>`|`bytes32`|value The value of the slot as bytes32|


### exttload

Called by external contracts to access transient storage of the contract


```solidity
function exttload(bytes32[] calldata slots) external view returns (bytes32[] memory);
```
**Parameters**

|Name|Type|Description|
|----|----|-----------|
|`slots`|`bytes32[]`||

**Returns**

|Name|Type|Description|
|----|----|-----------|
|`<none>`|`bytes32[]`|value The value of the slot as bytes32|


51 changes: 51 additions & 0 deletions docs/contracts/v4/reference/core/NoDelegateCall.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# NoDelegateCall
[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/NoDelegateCall.sol)
| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc)

Base contract that provides a modifier for preventing delegatecall to methods in a child contract


## State Variables
### original
*The original address of this contract*


```solidity
address private immutable original;
```


## Functions
### constructor


```solidity
constructor();
```

### checkNotDelegateCall

*Private method is used instead of inlining into modifier because modifiers are copied into each method,
and the use of immutable means the address bytes are copied in every place the modifier is used.*


```solidity
function checkNotDelegateCall() private view;
```

### noDelegateCall

Prevents delegatecall into the modified method


```solidity
modifier noDelegateCall();
```

## Errors
### DelegateCallNotAllowed

```solidity
error DelegateCallNotAllowed();
```

Loading

0 comments on commit dcce743

Please sign in to comment.