# ITokenValidator

Validates tokens by flash borrowing from the token/ pool on V1.

Returns Status.FOT if we detected a fee is taken on transfer. Status.STF if transfer failed for the token. Status.UNKN if we did not detect any issues with the token.

A return value of Status.UNKN does not mean the token is definitely not a fee on transfer token or definitely has no problems with its transfer. It just means we cant say for sure that it has any issues.

*We can not guarantee the result of this lens is correct for a few reasons:*

*1/ Some tokens take fees or allow transfers under specific conditions, for example some have an allowlist*

*of addresses that do/dont require fees. Therefore the result is not guaranteed to be correct*

*in all circumstances.*

*2/ It is possible that the token does not have any pools on V1 therefore we are not able to perform*

*a flashloan to test the token.*

*These functions are not marked view because they rely on calling non-view functions and reverting to compute the result.*

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

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

Validates a token by detecting if its transferable or takes a fee on transfer

```solidity
function validate(address token, address[] calldata baseTokens, uint256 amountToBorrow) external returns (Status);
```

**Parameters**

| Name             | Type        | Description                                                                                       |
| ---------------- | ----------- | ------------------------------------------------------------------------------------------------- |
| `token`          | `address`   | The address of the token to check for fee on transfer                                             |
| `baseTokens`     | `address[]` | The addresses of the tokens to try pairing with token when looking for a pool to flash loan from. |
| `amountToBorrow` | `uint256`   | The amount to try flash borrowing from the pools                                                  |

**Returns**

| Name     | Type     | Description             |
| -------- | -------- | ----------------------- |
| `<none>` | `Status` | The status of the token |

#### batchValidate <a href="#batchvalidate" id="batchvalidate"></a>

Validates each token by detecting if its transferable or takes a fee on transfer

```solidity
function batchValidate(address[] calldata tokens, address[] calldata baseTokens, uint256 amountToBorrow)
    external
    returns (Status[] memory);
```

**Parameters**

| Name             | Type        | Description                                                                                       |
| ---------------- | ----------- | ------------------------------------------------------------------------------------------------- |
| `tokens`         | `address[]` | The addresses of the tokens to check for fee on transfer                                          |
| `baseTokens`     | `address[]` | The addresses of the tokens to try pairing with token when looking for a pool to flash loan from. |
| `amountToBorrow` | `uint256`   | The amount to try flash borrowing from the pools                                                  |

**Returns**

| Name     | Type       | Description             |
| -------- | ---------- | ----------------------- |
| `<none>` | `Status[]` | The status of the token |

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

#### Status <a href="#status" id="status"></a>

```solidity
enum Status {
    UNKN,
    FOT,
    STF
}
```


---

# 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/itokenvalidator.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.
