Overview
GweAI’s Swap page enables direct token-to-token exchanges without intermediate steps. Swap any supported token for another using real-time market prices and automated routing.Direct Swaps
Trade tokens directly without selling to USDC first
Real-Time Quotes
Live pricing from smart contract router
Automatic Routing
Optimal paths via USDC when needed
Transaction History
Complete record of all your swaps
Accessing Swap
Network: All swaps execute on Base Sepolia Testnet with USDC gas fees.
Swap Interface
Token Selection

From Token (Sell)
- Input: Amount to swap
- Selector: Click to choose token
- Balance: Shows available balance
- USD Value: Calculated from input amount
To Token (Buy)
- Output: Estimated amount you’ll receive
- Selector: Click to choose token
- Balance: Shows current holdings
- USD Value: Calculated from output amount
Swap Button
The center button between panels:- Swap Direction: Click 🔄 to reverse FROM/TO tokens
- Quick Toggle: Instantly flips your swap
Executing a Swap
Choose FROM Token
Click the FROM token dropdownSelect the token you want to swap (e.g., BTC)Your Balance: Shows how much you have
Choose TO Token
Click the TO token dropdownSelect the token you want to receive (e.g., SOL)Cannot be same as FROM token
Enter Amount
Type the amount of FROM token to swapExample:
0.5 (for 0.5 BTC)Auto-Calculation: TO amount updates automaticallySmart Contract Integration
Router Contract
Swaps execute through the verified Router smart contract:Approval Flow
First-Time Approval
First-Time Approval
Why Needed:ERC-20 tokens require explicit permission for contracts to transfer them.Process:Benefit: You only approve once, then future swaps skip this step.
Swap Execution
Swap Execution
After Approval:The actual swap transaction:
Confirmation & Balance Update
Confirmation & Balance Update
Post-Swap:
Pricing & Quotes
Real-Time Quote Fetching
Quotes are fetched from the router contract:Slippage Protection
All swaps include automatic slippage protection:Price Updates
Prices refresh automatically:- On Amount Change: New quote fetched with 500ms debounce
- Every 30 Seconds: Background price refresh
- Manual Refresh: Click the 🔄 button
Supported Tokens
You can swap between these tokens:| Token | Symbol | Decimals | Notes |
|---|---|---|---|
| Bitcoin | BTC | 8 | Wrapped BTC |
| Ethereum | ETH | 18 | Display only |
| Solana | SOL | 9 | |
| BNB Chain | BNB | 18 | |
| Ripple | XRP | 6 | |
| Toncoin | TON | 9 | |
| Avalanche | AVAX | 18 | |
| TRON | TRX | 6 | |
| Cardano | ADA | 6 | |
| Dogecoin | DOGE | 8 | |
| USD Coin | USDC | 6 | Stablecoin |
ETH Status: Ethereum is currently display-only and cannot be traded. If you select ETH, you’ll see an error message.
Routing Logic
Direct Swaps
Some pairs swap directly:- BTC ↔ USDC - Direct pool
- SOL ↔ USDC - Direct pool
- Any Token ↔ USDC - Direct pool
Routed Swaps
Other pairs route through USDC:- Swap 0.5 BTC for SOL
- Router converts: 0.5 BTC → 22,500 USDC → 161.87 SOL
- You receive: ~161.87 SOL (minus fees)
Transaction History
Your Swap Records
The Swap page shows your complete transaction history:
- Pair: Token symbols with direction arrow
- Amount In: Tokens you swapped
- Amount Out: Tokens you received
- Time: Transaction timestamp
- Tx Hash: Link to blockchain explorer
Fetching History
History is fetched directly from the blockchain:Pagination
- 10 swaps per page
- Previous/Next navigation
- Total count displayed
Fees & Costs
Fee Breakdown
| Fee Type | Amount | Description |
|---|---|---|
| Protocol Fee | 0.3% | Taken from output amount |
| Gas Fee | ~$0.01-0.50 | Paid in USDC |
| Slippage | Up to 0.5% | Price protection buffer |
Fee Optimization
Unlimited Approvals
Approve once, swap forever - saves gas
Batch Swaps
Combine multiple small swaps into larger ones
Direct Routes
Token ↔ USDC swaps are cheapest
Off-Peak Trading
Lower gas during low network activity
Buy USDC Modal
If you don’t have USDC for swaps or gas:Buy USDC Modal Opens
Shows options to acquire USDC:
- On-ramp providers (MoonPay, Transak)
- Exchange transfers
- Faucets (testnet only)
Security Features
Verified Contracts
All token and router contracts verified on BaseScan
Token Whitelist
Only approved tokens can be swapped
Slippage Guards
Transactions revert if price moves unfavorably
Non-Custodial
You always control your private keys
Contract Validation
Troubleshooting
”Insufficient Balance” Error
Cause: Not enough of the FROM token Solution:- Check balance shown under FROM token
- Reduce swap amount
- Buy or deposit more tokens
”ETH Trading Disabled” Error
Cause: ETH is currently not supported for swaps Solution:- Choose a different token (BTC, SOL, etc.)
- Use the Trading page for ETH (view-only)
“Swap Failed” - Slippage Error
Cause: Price moved beyond 0.5% tolerance Solution:- Wait a few seconds and retry
- Reduce swap amount
- If persistent, market is highly volatile
Quote Not Updating
Cause: Network or API issue Solution:- Click the refresh 🔄 button
- Change amount slightly to trigger recalculation
- Check internet connection
Best Practices
Check Quotes First
Check Quotes First
Always review the estimated output before swappingCompare with current market prices
Start Small
Start Small
Test with small amounts firstVerify the swap process works as expected
Monitor Fees
Monitor Fees
Protocol fees add up on frequent swapsBatch swaps when possible
Understand Routing
Understand Routing
Direct swaps (to/from USDC) are cheaperToken → Token may cost more due to routing
Save Transaction Hashes
Save Transaction Hashes
Keep records for tax purposesDownload or screenshot swap confirmations
Advanced Features
Token Logos & Metadata
All tokens use centralized configuration:Amount Formatting
Amounts are formatted based on token decimals:Next Steps
Trading
Advanced trading with charts
Portfolio
Track your holdings
AI Chat
Swap using natural language
Vault Staking
Earn yield on swapped tokens