Fee-on-Transfer Token Support Guide
Overview
Fee-on-Transfer tokens are a class of ERC-20 tokens that automatically deduct a certain fee during transfers. JAMM DEX supports trading these tokens through specialized functions, ensuring accuracy and reliability in the swap process.
Characteristics of Fee-on-Transfer Tokens
How They Work
Fee-on-transfer tokens deduct a certain percentage of tokens as fees during each transfer or transferFrom call:
// Regular ERC-20 transfer
function transfer(address to, uint256 amount) external returns (bool) {
_transfer(msg.sender, to, amount);
return true;
}
// Fee-on-transfer token transfer
function transfer(address to, uint256 amount) external returns (bool) {
uint256 fee = amount * feeRate / 10000; // Calculate fee
uint256 actualAmount = amount - fee; // Actual transfer amount
_transfer(msg.sender, to, actualAmount);
_transfer(msg.sender, feeRecipient, fee); // Transfer fee
return true;
}Common Types
Deflationary tokens: Burn a certain percentage of tokens on each transfer
Reflection tokens: Distribute transfer fees to all holders
Tax tokens: Send transfer fees to a specified address
Dynamic fee tokens: Dynamically adjust fee rates based on conditions
JAMM DEX Support Mechanism
Standard Swaps vs Fee-on-Transfer Support Swaps
Standard swap functions:
Pre-calculate exact input/output amounts
Assume transfer amount equals actual received amount
Not suitable for fee-on-transfer tokens
Fee-on-transfer support functions:
Calculate based on actual received amounts
Dynamically adjust swap logic
Specifically handle fee-on-transfer tokens
Supported Functions
JAMM DEX provides the following fee-on-transfer support functions:
Implementation Principles
Internal Swap Logic
Key Differences:
Don't pre-calculate input amounts
Calculate based on actual balance changes in trading pairs
Recalculate input amount for each hop
Usage Guide
Token to Token Swaps
JU to Fee-on-Transfer Token
Fee-on-Transfer Token to JU
Fee-on-Transfer Token Detection
Automatic Detection Methods
Known Fee-on-Transfer Token List
Best Practices
1. Slippage Management
2. Pre-Swap Validation
3. Swap Result Analysis
4. Multi-Hop Fee-on-Transfer Token Swaps
Monitoring and Debugging
Swap Monitoring
Debugging Tools
Summary
Fee-on-transfer token support is an important feature of JAMM DEX. This guide covers:
Fee-on-Transfer Token Principles: Working mechanisms and common types
JAMM DEX Support: Specialized support functions and implementation principles
Usage Methods: Swap implementations in various scenarios
Token Detection: Methods to automatically identify fee-on-transfer tokens
Best Practices: Slippage management, validation, analysis, etc.
Monitoring and Debugging: Swap monitoring and troubleshooting tools
By correctly using fee-on-transfer token support features, developers can ensure normal trading of these special tokens on JAMM DEX.