# TokenValidator

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.*

### State Variables <a href="#state-variables" id="state-variables"></a>

#### FOT\_REVERT\_STRING <a href="#fot_revert_string" id="fot_revert_string"></a>

```solidity
string internal constant FOT_REVERT_STRING = "FOT";
```

#### STF\_REVERT\_STRING\_SUFFIX <a href="#stf_revert_string_suffix" id="stf_revert_string_suffix"></a>

```solidity
string internal constant STF_REVERT_STRING_SUFFIX = "TRANSFER_FAILED";
```

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

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

```solidity
constructor(address _factoryV1, address _positionManager) ImmutableState(_factoryV1, _positionManager);
```

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

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

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

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

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

```solidity
function _validate(address token, address baseToken, uint256 amountToBorrow) internal returns (Status);
```

#### isFotFailed <a href="#isfotfailed" id="isfotfailed"></a>

```solidity
function isFotFailed(string memory reason) internal pure returns (bool);
```

#### isTransferFailed <a href="#istransferfailed" id="istransferfailed"></a>

```solidity
function isTransferFailed(string memory reason) internal pure returns (bool);
```

#### dragonswapCall <a href="#dragonswapcall" id="dragonswapcall"></a>

```solidity
function dragonswapCall(address, uint256 amount0, uint256, bytes calldata data) external view override;
```
