# ApproveAndCall

Allows callers to approve the DragonswapV2 position manager from this contract, for any token, and then make calls into the position manager

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

#### tryApprove <a href="#tryapprove" id="tryapprove"></a>

```solidity
function tryApprove(address token, uint256 amount) private returns (bool);
```

#### 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 override 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 override;
```

**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 override;
```

**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 override;
```

**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 override;
```

**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) public payable override 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 |

#### balanceOf <a href="#balanceof" id="balanceof"></a>

```solidity
function balanceOf(address token) private view returns (uint256);
```

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

Calls the position manager's mint function

```solidity
function mint(MintParams calldata params) external payable override 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
    override
    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 |


---

# 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/base/approveandcall.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.
