# Tokens with taxes

For tokens subject to taxes, specific adaptations are essential in trading workflows:

1. **Disable Exact Out Feature**:
   * Disable the exact out feature for these tokens since they are predominantly traded with the exact in trade type. Trade involving taxed tokens and using Exact Out will result in an error message.
2. **Increase Slippage**:
   * Elevate the slippage tolerance to compensate for reduced proceeds when selling taxed tokens.
   * Recommend increasing slippage directly on the UI when dealing with taxed tokens, with adjustments corresponding to the tax rates.
   * Dynamically adjust slippage based on the tax amount provided for each token in the trade to ensure successful transactions despite the tax implications (we provide a recommended slippage on each quote, as we describe at the end of this article)

**Tax Information is included in Quotes Endpoint and Information Endpoints**:

Tax details for each token involved in a trade are included in the quotes endpoint response. Attributes such as buyTax and sellTax for each tokenFrom and tokenTo are present in the information, facilitating users' understanding of tax implications and aiding informed decision-making.

For instance, when querying the quotes endpoint, the UI should will return tax-related information for each token involved, such as buyTax and sellTax. Additionally, the UI should dynamically adapt the slippage settings based on the tax amount associated with each token, promoting seamless trading experiences despite tax considerations.

```json
"tokenFrom": {
      "name": "ZCX",
      "symbol": "ZCX",
      "decimals": 18,
      "contractAddress": "0xc52c326331e9ce41f04484d3b5e5648158028804",
      "chainId": 1,
      "buyTax": 0,
      "sellTax": 0
    }
```

You can also find the tax information in the endpoints that return information about tokens (popular tokens, search, token information).

**A recommended slippage value is included with each quote**

We’ve added a *recommendedSlippage* field, allowing you to see the suggested slippage for a specific token pair. By default, the recommended slippage is set to 0.5%. However, if token taxes apply, this value may be adjusted to prevent failed trades caused by insufficient amounts.

**Setting the Appropriate Slippage Before Requesting a Quote**

To ensure a correct slippage value before making a quote request, you can calculate it directly using the token information, rather than waiting for a recommendation from the API. The process involves checking the tax information for both the token you are sending (tokenFrom) and the token you are receiving (tokenTo):

1. **Check Token Taxes**:
   * For the **tokenFrom**, you need to inspect the `sellTax`.
   * For the **tokenTo**, look at the `buyTax`.
2. **Calculate Slippage**:

   * If either token has taxes applied, you can calculate a proper slippage based on the sum of the buy and sell taxes. For example:

   ```typescript
   const tokenToHasTax = tokenToBuyTax > 0;
   const isNeedOneTimeSlippage = tokenFromHasTax || tokenToHasTax;
   const recommendedSlippage = isNeedOneTimeSlippage 
       ? 0.5 + (tokenFromSellTax + tokenToBuyTax) * 100 
       : defaultSlippage;
   ```

   * If taxes are present, the slippage should be set higher to account for these fees, starting with a base value of `0.5%` plus the combined taxes from both tokens. If no taxes are applied, the **default slippage** is used.

By calculating slippage this way, you ensure that your transaction has enough tolerance to account for token taxes and prevent failed swaps. In the example code, the slippage increases by adding the tax percentages to a base of **0.5%** when taxes are applied.


---

# 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.unizen.io/api-introduction/before-you-get-started/tokens-with-taxes.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.
