# IApproveAndCall

### Functions <a href="#functions" id="functions"></a>

#### getApprovalType <a href="#getapprovaltype" id="getapprovaltype"></a>

*Lens to be called off-chain to determine which (if any) of the relevant approval functions should be called*

```solidity
function getApprovalType(address token, uint256 amount) external returns (ApprovalType);
```

**Parameters**

| Name     | Type      | Description           |
| -------- | --------- | --------------------- |
| `token`  | `address` | The token to approve  |
| `amount` | `uint256` | The amount to approve |

**Returns**

| Name     | Type           | Description                |
| -------- | -------------- | -------------------------- |
| `<none>` | `ApprovalType` | The required approval type |

#### approveMax <a href="#approvemax" id="approvemax"></a>

Approves a token for the maximum possible amount

```solidity
function approveMax(address token) external payable;
```

**Parameters**

| Name    | Type      | Description          |
| ------- | --------- | -------------------- |
| `token` | `address` | The token to approve |

#### approveMaxMinusOne <a href="#approvemaxminusone" id="approvemaxminusone"></a>

Approves a token for the maximum possible amount minus one

```solidity
function approveMaxMinusOne(address token) external payable;
```

**Parameters**

| Name    | Type      | Description          |
| ------- | --------- | -------------------- |
| `token` | `address` | The token to approve |

#### approveZeroThenMax <a href="#approvezerothenmax" id="approvezerothenmax"></a>

Approves a token for zero, then the maximum possible amount

```solidity
function approveZeroThenMax(address token) external payable;
```

**Parameters**

| Name    | Type      | Description          |
| ------- | --------- | -------------------- |
| `token` | `address` | The token to approve |

#### approveZeroThenMaxMinusOne <a href="#approvezerothenmaxminusone" id="approvezerothenmaxminusone"></a>

Approves a token for zero, then the maximum possible amount minus one

```solidity
function approveZeroThenMaxMinusOne(address token) external payable;
```

**Parameters**

| Name    | Type      | Description          |
| ------- | --------- | -------------------- |
| `token` | `address` | The token to approve |

#### callPositionManager <a href="#callpositionmanager" id="callpositionmanager"></a>

Calls the position manager with arbitrary calldata

```solidity
function callPositionManager(bytes memory data) external payable returns (bytes memory result);
```

**Parameters**

| Name   | Type    | Description                                    |
| ------ | ------- | ---------------------------------------------- |
| `data` | `bytes` | Calldata to pass along to the position manager |

**Returns**

| Name     | Type    | Description              |
| -------- | ------- | ------------------------ |
| `result` | `bytes` | The result from the call |

#### mint <a href="#mint" id="mint"></a>

Calls the position manager's mint function

```solidity
function mint(MintParams calldata params) external payable returns (bytes memory result);
```

**Parameters**

| Name     | Type         | Description                                    |
| -------- | ------------ | ---------------------------------------------- |
| `params` | `MintParams` | Calldata to pass along to the position manager |

**Returns**

| Name     | Type    | Description              |
| -------- | ------- | ------------------------ |
| `result` | `bytes` | The result from the call |

#### increaseLiquidity <a href="#increaseliquidity" id="increaseliquidity"></a>

Calls the position manager's increaseLiquidity function

```solidity
function increaseLiquidity(IncreaseLiquidityParams calldata params) external payable returns (bytes memory result);
```

**Parameters**

| Name     | Type                      | Description                                    |
| -------- | ------------------------- | ---------------------------------------------- |
| `params` | `IncreaseLiquidityParams` | Calldata to pass along to the position manager |

**Returns**

| Name     | Type    | Description              |
| -------- | ------- | ------------------------ |
| `result` | `bytes` | The result from the call |

### Structs <a href="#structs" id="structs"></a>

#### MintParams <a href="#mintparams" id="mintparams"></a>

```solidity
struct MintParams {
    address token0;
    address token1;
    uint24 fee;
    int24 tickLower;
    int24 tickUpper;
    uint256 amount0Min;
    uint256 amount1Min;
    address recipient;
}
```

#### IncreaseLiquidityParams <a href="#increaseliquidityparams" id="increaseliquidityparams"></a>

```solidity
struct IncreaseLiquidityParams {
    address token0;
    address token1;
    uint256 tokenId;
    uint256 amount0Min;
    uint256 amount1Min;
}
```

### Enums <a href="#enums" id="enums"></a>

#### ApprovalType <a href="#approvaltype" id="approvaltype"></a>

```solidity
enum ApprovalType {
    NOT_REQUIRED,
    MAX,
    MAX_MINUS_ONE,
    ZERO_THEN_MAX,
    ZERO_THEN_MAX_MINUS_ONE
}
```


---

# 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.dragonswap.app/dragonswap/resources/developer-resources/smart-contracts/dragonswapv2/smart-router/interfaces/iapproveandcall.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.
