Tempo enables users to pay transaction fees in any USD-denominated TIP-20 stablecoin. This eliminates the need to acquire and manage a separate gas token, simplifying the payment experience.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/tempoxyz/tempo/llms.txt
Use this file to discover all available pages before exploring further.
Supported Fee Tokens
Any TIP-20 token withcurrency() == "USD" can be used as a fee token, including:
- pathUSD (
0x20C0000000000000000000000000000000000000) - Tempo’s native stablecoin - USDC - Circle’s USD Coin
- USDT - Tether USD
- Any other USD-denominated TIP-20 token with sufficient Fee AMM liquidity
All TIP-20 stablecoins use 6 decimals (matching USDC). One token unit = 1 microdollar (μUSD) = $0.000001.
Setting Your Fee Token Preference
Users specify which token they want to pay fees in by calling the FeeManager precompile:Using Cast
0x123...ABC with your preferred TIP-20 stablecoin address.
Using viem
Using Foundry
Your fee token preference persists across all future transactions until you change it. You only need to set it once.
Fee Token Requirements
To use a token as a fee payment method, it must:- Be a TIP-20 token deployed via the TIP20Factory
- Be USD-denominated:
ITIP20(token).currency()must return"USD" - Have sufficient balance in your account to cover
gasLimit × baseFee - Allow FeeManager transfers: Your TIP-403 policy must authorize both:
- You as a sender
- The FeeManager as a recipient
- Have Fee AMM liquidity (if validator prefers a different token)
Checking Your Balance
Checking TIP-403 Authorization
The FeeManager checks authorization duringcollectFeePreTx:
How Fee Payment Works
1. Fee Token Resolution
Before executing a transaction, the protocol resolves which token will be used:2. Maximum Fee Calculation
The protocol calculates the maximum fee the user might pay:3. Pre-Transaction Collection
The FeeManager callscollectFeePreTx to lock the maximum fee:
- Transfers
maxAmountfrom user to FeeManager - Checks Fee AMM liquidity (if conversion needed)
- Reverts if insufficient balance or liquidity
FeeManager.sol:38-60.
4. Transaction Execution
The transaction runs normally, consuming gas based on actual operations.5. Post-Transaction Settlement
After execution,collectFeePostTx settles the actual fee:
- Calculates refund:
maxAmount - actualUsed - Returns excess tokens to user
- Converts
actualUsedvia Fee AMM (if needed) - Credits validator with converted tokens
FeeManager.sol:62-87.
Example:
Fee Conversion via AMM
When your fee token differs from the validator’s preferred token, the Fee AMM automatically converts:Conversion Rate
Insufficient Liquidity
If the Fee AMM lacks sufficient liquidity for the conversion, the transaction validation fails:- Switch fee tokens to one with liquidity (e.g., pathUSD)
- Wait for the pool to be rebalanced
- Provide liquidity yourself to the relevant pool
Cost Examples
Assuming base fee = 2,000 aUSD/gas:Simple Transfer
Operation: Send 100 USDC to a friendTransfer to New Address
Operation: Send 100 USDT to a new recipient (creates their balance storage)With Conversion
Operation: Send 100 USDC, but validator prefers pathUSDSmart Contract Interaction
Operation: Call a DEX swap functionFee Token Introspection
Smart contracts can query which fee token is being used:- Adjusting pricing based on fee token
- Routing decisions that minimize total costs
- Event logging for fee analytics
Best Practices
For Users
- Set fee token once: Your preference persists, no need to set it repeatedly
- Use pathUSD for lowest costs: Native token typically has best liquidity and no conversion spread
- Maintain buffer balance: Keep 2-3x expected fees to handle gas price spikes
- Check authorization: Ensure your TIP-403 policy allows FeeManager transfers
For Validators
- Set preferred token: Use
setValidatorTokento receive fees in your chosen stablecoin - Provide liquidity: Add liquidity to
(userToken → yourToken)pools to enable conversions - Monitor collection: Call
distributeFeesperiodically to claim accumulated fees - Consider pathUSD: Default token simplifies liquidity management
For Developers
- Estimate gas accurately: Use
eth_estimateGasto avoid over-locking user funds - Handle conversion failures: Catch
InsufficientLiquidityand suggest alternative fee tokens - Display costs in dollars: Convert microdollars to human-readable amounts
- Support multiple tokens: Let users choose their preferred stablecoin
Common Issues
”Insufficient Balance”
Problem: Transaction reverts during fee validation Solutions:- Check balance:
cast call $TOKEN "balanceOf(address)" $YOUR_ADDRESS - Ensure you have enough for both transfer amount AND gas fees
- Remember: max fee is locked, not actual fee
”PolicyForbids”
Problem: TIP-403 policy blocks the fee transfer Solutions:- Verify you’re authorized sender: Check your address against token’s policy
- Verify FeeManager is authorized recipient: Check
0xfeeC...0000against policy - If using a restricted token, contact the issuer
”InsufficientLiquidity”
Problem: Fee AMM lacks liquidity for conversion Solutions:- Switch to pathUSD (best liquidity)
- Wait for pool rebalancing
- Provide liquidity to the pool
- Check current pool reserves:
FeeAMM.getPool(yourToken, validatorToken)
”CANNOT_CHANGE_WITHIN_BLOCK”
Problem: Validator trying to change fee token while producing a block Solution: Wait until the next block, then callsetValidatorToken
Transaction Lifecycle Example
Here’s a complete example of paying fees in USDC:Setup
Transaction Submission
What Happened Behind the Scenes
-
Validation:
-
Pre-execution:
-
Execution:
-
Post-execution:
-
Validator collection:
Next Steps
Fee AMM
Learn how stablecoin conversion works
Gas Pricing
Understand gas cost calculations
Fee System Overview
High-level overview of fee mechanics
TIP-1007
Fee token introspection specification