Tax Token V1
Overview
Flap supports Tax tokens. Since V5.4.0 (on BNB Chain & XLayer) , tax is not only applied to migrated tax tokens but also the ones that are still on the bonding curve.
When a tax token has already migrated DEX, it will charges a tax on every trade through the main pool and accumulate the tax in the token first. Once the accumulated token amount reaches a specifiy liquidation threshold, an automatic liquidation happens to sell the token for quote and sent the the beneficiary through the Tax Splitter. (Check below to learn more detaills)
When a tax token is still on the bonding curve, we don’t implement it as a “real tax” like a migrated one. To make it simple and easy to do an off-chain quote, we implement it as an extra fee added upon the current bonding curve fee.
For example:
For a non-tax token, the current bonding curve fee on BNB chain is 1%.
For a token with a tax of 3%, the effective trading fee becomes: 1% + 3% = 4%
For a token with a tax of 1%, the effective trading fee is 2%
Tax Splitter
To avoid DOS, we do not liquidate and distribute the Tax in the tax token directly. For each tax token, a "Tax Splitter" contract will be deployed on creation. Both the liquidated Tax and the Tax on the bonding curve will be directly sent to the "Tax Splitter" first. Then anyone could trigger the tax distribution by calling the "Tax Splitter" contract's split method. However, for most of the time you don't need to manually call "Tax Splitter" yourself , Flap will run a bot to automatically trigger the distribution when needed.

FAQ for Integrators
I am using quoteExactInput to get a quote, do I need any change?
quoteExactInput to get a quote, do I need any change?No. You don’t need make any changes. The quoteExactInput method will work as expected. For tax tokens, it will return the new quote result.
I am doing an off-chain quote, how can I change my current implementation?
💡
If you are not able to change your off-chain quote logics, you can also raise your slippage based on the tax rate of a token.
We assume that you have implemented your off-chain quote logic based on https://docs.flap.sh/flap/developers/trade-tokens#how-to-do-an-off-chain-quote. In https://docs.flap.sh/flap/developers/trade-tokens#how-to-do-an-off-chain-quote, we have two examples:
Swap 1 BNB for token
Swap 1M token for BNB
Here are the changes:
Instead of using the previous fixed 1% fee rate, we now use a new fee rate for tax token.
We can get the token’s tax rate using either
getTokenV6orgetTokenV7, Or we can index Portal’sFlapTokenTaxSetevent to get the token’s tax rate. (Note thatFlapTokenTaxSetis optional, if not presented, the tax rate is 0 by default).
Similarly for the sale:
Last updated