13 KiB
Admin Panel - Mainnet Tether & Transaction Mirror
Overview
A comprehensive web-based admin panel (dApp) for managing the MainnetTether, TransactionMirror, and TwoWayTokenBridge smart contracts on Ethereum Mainnet. This enhanced admin panel integrates advanced features from the Impersonator project including multi-signature wallet support, transaction management, impersonation mode, and comprehensive security features.
Features
Core Contract Administration
🎯 Mainnet Tether Admin
- View contract information (admin address, pause status, anchored block count)
- Pause/Unpause contract
- Change admin address
- Query state proofs by block number
- View contract on Etherscan
📋 Transaction Mirror Admin
- View contract information (admin address, pause status, mirrored transaction count)
- Pause/Unpause contract
- Change admin address
- Query mirrored transactions by transaction hash
- View contract on Etherscan
🌉 Two-Way Bridge Admin
- View contract information (admin, canonical token, fee token, destination chains)
- Change admin address
- Add/update/remove destination chains
- Update fee token address
- View configured destination chains
- View contract on Etherscan (when deployed)
Advanced Features
📊 Dashboard
- Real-time analytics and statistics
- Admin activity overview
- Contract health monitoring
- Transaction success rate tracking
- Recent actions and audit logs
👥 Multi-Signature Admin
- Create multi-sig proposals for admin actions
- Approval workflow (require multiple signatures)
- Visual approval status indicators
- Execute approved proposals
- Support for Gnosis Safe wallets
🎭 Wallet Impersonation
- Impersonate any Ethereum address for testing
- Test admin functions from different perspectives
- View contract state as different addresses
- Toggle impersonation on/off
- Address validation and checksumming
📝 Transaction Management
- Transaction queue with priority levels (LOW, NORMAL, HIGH, URGENT)
- Transaction history and status tracking
- Failed transaction retry mechanism
- Real-time status polling and confirmation tracking
- Batch operations for multiple actions
⛽ Gas Optimization
- Real-time gas price recommendations from Etherscan
- Gas estimation for transactions
- EIP-1559 support (maxFeePerGas, maxPriorityFeePerGas)
- Cost calculation and optimization suggestions
- Multiple urgency levels (slow, standard, fast)
📋 Transaction Templates
- Predefined action templates
- Custom template builder
- Scheduled recurring actions (daily, weekly)
- Template categories (maintenance, emergency, configuration)
- Quick execution from templates
🔄 Batch Operations
- Execute multiple admin actions in sequence
- Enable/disable individual actions
- Batch pause/unpause across contracts
- Sequential execution with delays
👁️ Transaction Preview & Simulation
- Preview transactions before execution
- Decode function parameters
- Gas estimation
- Dry run simulation
- Transaction details display
🔄 Transaction Retry
- Automatic retry for failed transactions
- Manual retry with updated parameters
- Retry history tracking
- Error analysis and resolution
🚨 Emergency Controls
- Emergency pause all contracts simultaneously
- Confirmation requirements (type "EMERGENCY")
- Circuit breakers
- Recovery procedures
- Emergency action logging
👤 Role-Based Access Control
- Multiple permission levels (Super Admin, Operator, Viewer)
- Granular permissions per function
- Role assignment and management
- Permission matrix display
- Access control enforcement
⏰ Time-Locked Actions
- Schedule sensitive operations with time delays
- Configurable delay periods
- Admin transfer protection
- Threshold change protection
- Scheduled execution tracking
💼 Wallet Management
- Deploy new Safe wallets for admin use
- Owner management (add/remove)
- Threshold configuration
- Wallet balance display
- Multi-wallet support
💰 Wallet Balances
- Real-time balance monitoring
- Multiple wallet tracking
- Native token balances (ETH)
- Token balance support (future)
- Balance history
💾 Wallet Backup & Export
- Encrypted wallet configuration backup
- Secure data export/import
- Password-protected backups
- Complete admin data backup
- Audit log export
🌐 Multi-Chain Admin
- Chain selector and switching
- Multi-chain contract management
- Unified admin interface
- Chain-specific configurations
- Cross-chain operations (future)
⏲️ Scheduled Actions
- Cron-like scheduling for recurring tasks
- Daily and weekly schedules
- Automatic execution
- Schedule management
- Next execution tracking
🔧 Off-Chain Services Integration
- State Anchoring Service status monitoring
- Transaction Mirroring Service status
- Service health checks
- Endpoint configuration
- Service information display
📜 Audit Logs
- Complete audit trail of all admin actions
- Searchable and filterable logs
- Export to JSON
- Status filtering (success/failure)
- Timestamp tracking
⚡ Priority Queue
- Transaction queuing with priority levels
- Queue management UI
- Priority-based execution
- Queue filtering
- Next execution tracking
🔐 Session Management
- Auto-logout after inactivity
- Session timeout (configurable, default 1 hour)
- Session time remaining display
- Activity tracking
- Secure session storage
📈 Analytics & Monitoring
- Admin activity metrics
- Contract health indicators
- Transaction analytics
- Success rate tracking
- Performance metrics
Prerequisites
- Wallet Connection: MetaMask, WalletConnect, or Coinbase Wallet
- Network: Must be connected to Ethereum Mainnet (Chain ID: 1)
- Admin Privileges: Your wallet address must be the admin of the contract
Contract Addresses
- MainnetTether:
0x15DF1D5BFDD8Aa4b380445D4e3E9B38d34283619 - TransactionMirror:
0x4CF42c4F1dBa748601b8938be3E7ABD732E87cE9 - TwoWayTokenBridge L1: Not deployed (will show warning if accessed)
Usage
Accessing the Admin Panel
-
Start the development server:
cd frontend-dapp npm run dev -
Navigate to
http://localhost:3002/admin(or click "Admin" in the navigation) -
Connect your wallet:
- Click the "Connect Wallet" button
- Select your wallet provider (MetaMask, WalletConnect, etc.)
- Ensure you're connected to Ethereum Mainnet
-
Verify you're the admin:
- The admin panel will show the current admin address
- Only the admin address can execute write operations
Common Operations
Pausing/Unpausing Contracts
- Navigate to the appropriate tab (Mainnet Tether or Transaction Mirror)
- Click "Pause Contract" to pause or "Unpause Contract" to resume
- Confirm the transaction in your wallet
- Wait for confirmation (transaction will be shown with Etherscan link)
Changing Admin Address
- Enter the new admin address in the "New Admin Address" field
- Click "Set Admin"
- Confirm the transaction in your wallet
- Important: Ensure the new admin address is correct - this cannot be undone without the new admin
Adding Destination Chain (TwoWay Bridge)
- Enter the chain selector (e.g.,
16015286601757825753for Chain 138) - Enter the L2 bridge contract address
- Click "Add Destination"
- Confirm the transaction
Security Features
Enhanced Security Measures
- Encrypted Storage: Sensitive wallet data encrypted using Web Crypto API (AES-GCM)
- Rate Limiting: Configurable rate limits for admin functions to prevent abuse
- Session Management: Auto-logout after inactivity (default 1 hour)
- Time-Locked Actions: Sensitive operations require time delays
- Multi-Signature Support: Support for Gnosis Safe multi-sig wallets
- Audit Logging: Complete audit trail of all admin actions
- Role-Based Access: Granular permissions and access control
- Emergency Procedures: Emergency pause controls with confirmation
Security Considerations
⚠️ CRITICAL: Admin functions have significant security implications:
- Admin Transfer: Changing the admin address transfers all control. Make sure the new address is correct and secure.
- Pause Function: Pausing a contract stops all operations. Only pause in emergency situations.
- Private Key Security: Never share your admin private key. Use hardware wallets for admin accounts when possible.
- Multi-sig Recommendation: Use multi-sig wallets (Gnosis Safe) for production deployments
- Impersonation Mode: Only use impersonation for testing - all actions are logged
- Time-Locked Actions: Use time locks for sensitive operations like admin changes
- Backup Security: Keep wallet backup passwords secure and stored separately
- Rate Limiting: Be aware of rate limits to avoid lockouts during emergencies
Technical Details
Technology Stack
- React + TypeScript: UI framework
- wagmi + viem: Web3 integration and contract interactions
- Tailwind CSS: Styling with utility-first approach
- React Router: Navigation
- react-hot-toast: Notifications
- @safe-global/protocol-kit: Gnosis Safe SDK integration (replaces deprecated safe-core-sdk)
- @safe-global/api-kit: Safe API client
- ethers.js: Additional Ethereum utilities (v5)
- Web Crypto API: Encryption for sensitive data storage
Contract Interaction
The admin panel uses wagmi hooks for contract interactions:
useReadContract: Read contract state (admin, paused, counts, etc.)useWriteContract: Execute write operations (pause, setAdmin, etc.)useWaitForTransactionReceipt: Monitor transaction confirmations
ABIs
Contract ABIs are located in:
src/abis/MainnetTether.tssrc/abis/TransactionMirror.tssrc/abis/TwoWayTokenBridge.ts
Configuration
Contract addresses are configured in:
src/config/contracts.ts
Development
Project Structure
frontend-dapp/
├── src/
│ ├── pages/
│ │ └── AdminPanel.tsx # Main admin panel page
│ ├── components/
│ │ └── admin/
│ │ ├── MainnetTetherAdmin.tsx
│ │ ├── TransactionMirrorAdmin.tsx
│ │ ├── TwoWayBridgeAdmin.tsx
│ │ ├── AdminDashboard.tsx
│ │ ├── MultiSigAdmin.tsx
│ │ ├── ImpersonationMode.tsx
│ │ ├── TransactionQueue.tsx
│ │ ├── TransactionRetry.tsx
│ │ ├── GasOptimizer.tsx
│ │ ├── BatchOperations.tsx
│ │ ├── TransactionTemplates.tsx
│ │ ├── TransactionPreview.tsx
│ │ ├── EmergencyControls.tsx
│ │ ├── RoleBasedAccess.tsx
│ │ ├── TimeLockedActions.tsx
│ │ ├── WalletDeployment.tsx
│ │ ├── WalletBalance.tsx
│ │ ├── WalletBackup.tsx
│ │ ├── MultiChainAdmin.tsx
│ │ ├── ScheduledActions.tsx
│ │ ├── OffChainServices.tsx
│ │ ├── AuditLogViewer.tsx
│ │ ├── TransactionQueuePriority.tsx
│ │ ├── OwnerManagement.tsx
│ │ ├── TransactionStatusPoller.tsx
│ │ └── SessionManager.tsx
│ ├── contexts/
│ │ └── AdminContext.tsx # Admin state management
│ ├── types/
│ │ └── admin.ts # TypeScript types
│ ├── utils/
│ │ ├── constants.ts # Constants and configuration
│ │ ├── encryption.ts # Encryption utilities
│ │ ├── security.ts # Security utilities
│ │ ├── rateLimiter.ts # Rate limiting
│ │ ├── sessionManager.ts # Session management
│ │ └── ens.ts # ENS utilities
│ ├── helpers/
│ │ └── admin/
│ │ └── gasOracle.ts # Gas price oracle
│ ├── abis/ # Contract ABIs
│ ├── config/
│ │ └── contracts.ts # Contract addresses
│ └── App.tsx # Routes configuration
Adding New Features
- New Contract Function: Add the function to the appropriate ABI file
- UI Component: Update the corresponding admin component
- Testing: Test on a testnet first before using on mainnet
Troubleshooting
"Please switch to Ethereum Mainnet"
- Ensure your wallet is connected to Mainnet (Chain ID: 1)
- Click your wallet extension and switch networks
"Transaction failed" or "User rejected"
- Verify you have sufficient ETH for gas fees
- Ensure you're the contract admin
- Check the transaction error details in your wallet
Contract not loading
- Verify contract addresses in
src/config/contracts.ts - Check RPC provider connectivity
- Ensure contracts are deployed on Mainnet
TwoWayTokenBridge shows "Not Deployed"
- This is expected if the contract hasn't been deployed yet
- Set the address in
src/config/contracts.tsonce deployed
Support
For issues or questions:
- Check contract addresses and network connection
- Verify admin privileges
- Review transaction errors in wallet
- Check Etherscan for contract state
Links
- MainnetTether on Etherscan: https://etherscan.io/address/0x15DF1D5BFDD8Aa4b380445D4e3E9B38d34283619
- TransactionMirror on Etherscan: https://etherscan.io/address/0x4CF42c4F1dBa748601b8938be3E7ABD732E87cE9
Last Updated: 2025-01-22