# CalldataExtractor

Library for extracting specific chunks of calldata based on configured offsets used in configurable hooks to extract 32 byte chunks from calldata and check them against expected values in the merkle tree

## Functions

### extract

Extract 32-byte chunks from calldata based on config offsets

*Number of provided offsets must be <= 16 because that's how many fit in uint256*

*Calldata must be at least 36 bytes long to be considered valid*

*All math is unchecked because we validate everything before doing any operations*

```solidity
function extract(bytes memory callData, uint256 calldataOffsetsPacked, uint256 calldataOffsetsCount)
    internal
    pure
    returns (bytes memory);
```

**Parameters**

| Name                    | Type      | Description                      |
| ----------------------- | --------- | -------------------------------- |
| `callData`              | `bytes`   | The calldata to extract from     |
| `calldataOffsetsPacked` | `uint256` | Packed 16-bit extraction offsets |
| `calldataOffsetsCount`  | `uint256` | Number of extractions to perform |

**Returns**

| Name     | Type    | Description                                         |
| -------- | ------- | --------------------------------------------------- |
| `<none>` | `bytes` | result Concatenated byte values at specific offsets |

## Errors

### Aera\_\_ExtractionNumberTooLarge

```solidity
error Aera__ExtractionNumberTooLarge();
```

### Aera\_\_CalldataTooShort

```solidity
error Aera__CalldataTooShort();
```

### Aera\_\_OffsetOutOfBounds

```solidity
error Aera__OffsetOutOfBounds();
```
