Multi-Token Support
The GasCreditVault contract supports multiple ERC-20 tokens as collateral for gas credits, enabling users to pay for transaction fees using their preferred tokens. This flexible system integrates with Chainlink price feeds to ensure fair and accurate conversion rates across different tokens.
Overview
Multi-token support in GasCreditVault provides:
Flexible token options for gas credit deposits
Real-time price conversion using Chainlink oracles
Secure token management with proper validation
Dynamic token addition/removal by administrators
Per-token configuration for limits and parameters
Architecture
Token Configuration
Supported Token Structure
struct TokenInfo {
AggregatorV3Interface priceFeed;
bool isStablecoin;
}
// Storage mapping
mapping(address => TokenInfo) public tokenInfo;
mapping(address => uint256) public credits;
function isTokenWhitelisted(address token) external view returns (bool);Price Conversion Logic
Deposit Management
Multi-Token Deposits
Withdrawal Management
Token-Specific Withdrawals
Transfer Credits
Administrative Functions
Token Management
Emergency Functions
View Functions
Token Information
User Balances
Events
Best Practices
For Administrators
Validate price feeds thoroughly before adding tokens
Set appropriate limits based on token volatility
Monitor daily deposits for unusual activity
Keep fallback oracles for critical tokens
Regular security audits of token contracts
For Users
Check token prices before large deposits
Understand conversion fees for each token
Monitor price staleness indicators
Use batch deposits for multiple tokens
Keep diversified token holdings for flexibility
For Developers
Handle price feed failures gracefully
Implement proper slippage protection
Cache token information for better UX
Monitor gas costs for multi-token operations
Test with various token configurations
Related Topics:
Chainlink Integration - Price feed implementation
Credit Management - Credit lifecycle management
GasCreditVault Overview - Main contract documentation
Last updated