# CalldataReaderLib

**Authors:** Aera <https://github.com/aera-finance>, philogy <https://github.com/philogy>

Modified version of the original CalldataReaderLib

No functions were changed, only added new functions

## Functions

### from

```solidity
function from(bytes calldata data) internal pure returns (CalldataReader reader);
```

### requireAtEndOf

```solidity
function requireAtEndOf(CalldataReader self, bytes calldata data) internal pure;
```

### requireAtEndOf

```solidity
function requireAtEndOf(CalldataReader self, CalldataReader end) internal pure;
```

### offset

```solidity
function offset(CalldataReader self) internal pure returns (uint256);
```

### readBool

```solidity
function readBool(CalldataReader self) internal pure returns (CalldataReader, bool value);
```

### readU8

```solidity
function readU8(CalldataReader self) internal pure returns (CalldataReader, uint8 value);
```

### readU16

```solidity
function readU16(CalldataReader self) internal pure returns (CalldataReader, uint16 value);
```

### readU32

```solidity
function readU32(CalldataReader self) internal pure returns (CalldataReader, uint32 value);
```

### readI24

```solidity
function readI24(CalldataReader self) internal pure returns (CalldataReader, int24 value);
```

### readU40

```solidity
function readU40(CalldataReader self) internal pure returns (CalldataReader, uint40 value);
```

### readU64

```solidity
function readU64(CalldataReader self) internal pure returns (CalldataReader, uint64 value);
```

### readU128

```solidity
function readU128(CalldataReader self) internal pure returns (CalldataReader, uint128 value);
```

### readAddr

```solidity
function readAddr(CalldataReader self) internal pure returns (CalldataReader, address addr);
```

### readU256

```solidity
function readU256(CalldataReader self) internal pure returns (CalldataReader, uint256 value);
```

### readU24End

```solidity
function readU24End(CalldataReader self) internal pure returns (CalldataReader, CalldataReader end);
```

### readBytes

```solidity
function readBytes(CalldataReader self) internal pure returns (CalldataReader, bytes calldata slice);
```

### readU208

ADDED BY AERA

```solidity
function readU208(CalldataReader self) internal pure returns (CalldataReader, uint208 value);
```

### readOptionalU256

```solidity
function readOptionalU256(CalldataReader reader) internal pure returns (CalldataReader, uint256 u256);
```

### readBytes32Array

```solidity
function readBytes32Array(CalldataReader self) internal pure returns (CalldataReader, bytes32[] memory array);
```

### readBytesEnd

```solidity
function readBytesEnd(CalldataReader self) internal pure returns (CalldataReader end);
```

### readBytesEnd

```solidity
function readBytesEnd(CalldataReader self, bytes calldata data) internal pure returns (CalldataReader end);
```

### readBytesToMemory

```solidity
function readBytesToMemory(CalldataReader self) internal pure returns (CalldataReader, bytes memory data);
```

### readBytesToMemory

```solidity
function readBytesToMemory(CalldataReader self, uint256 length)
    internal
    pure
    returns (CalldataReader, bytes memory data);
```

## Errors

### ReaderNotAtEnd

```solidity
error ReaderNotAtEnd();
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.aera.finance/the-protocol/core/calldatareaderlib.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
