Automated balance management for Polymarket, Kalshi, Opinion, and Telegram bots using ERC-7715 Advanced Permissions
Advanced Permissions Usage: src/lib/smartAccount.js (Lines 48-117) src/lib/smartAccount.js (Lines 127-193) app/page.jsx (Lines 108-128)
OpiPoliX AutoTopUp is an automated balance management system that monitors your prediction market bots and wallets, automatically topping them up when balances run low. Built on ERC-7715 Advanced Permissions, it enables gasless, autonomous top-ups with a single permission grant.
- β‘ Smart Monitoring: Automatically monitors bot balances every 3 seconds
- π One Permission: Grant once, automate forever (30-day permissions)
- π° Zero Gas Fees: All top-ups are gasless via Pimlico Paymaster
- π€ Multi-Platform: Supports Polymarket, Kalshi, Opinion, and Telegram bots
- π USDC-Only: Focused on USDC transfers (ETH support available)
- βοΈ Configurable: Set custom thresholds and top-up amounts
- Frontend: Next.js 15, React, Tailwind CSS
- Blockchain: Ethereum Sepolia (testnet)
- Smart Accounts: MetaMask Smart Accounts Kit (Hybrid Implementation)
- Permissions: ERC-7715 Advanced Permissions
- Wallet: wagmi, viem
- Gasless Transactions: Pimlico Paymaster & Bundler
- Account Abstraction: ERC-4337 UserOperations
- MetaMask Flask (required for ERC-7715 support)
- Download: metamask.io/flask
- Node.js 18+ and npm
# Clone repository
git clone https://github.com/yourusername/opipolix-autotopup.git
cd opipolix-autotopup
# Install dependencies
npm install
# Set up environment variables
cp .env.example .env.local
# Add your Pimlico API key to .env.local
NEXT_PUBLIC_PIMLICO_API_KEY=your_key_here
# Run development server
npm run devWhen you connect, OpiPoliX creates a session account (Hybrid Smart Account). This session account will execute top-ups on your behalf.
You grant the session account two permissions using ERC-7715:
- ETH Permission: 0.1 ETH per day
- USDC Permission: 100 USDC per day
These permissions allow the session account to transfer tokens without requiring approval for each transaction.
The dashboard monitors your bot's balance every 3 seconds. When the balance drops below your configured threshold, it automatically triggers a top-up.
Top-ups are executed as UserOperations with delegation:
- The session account sends the operation
- Pimlico Paymaster sponsors the gas
- Your bot receives USDC instantly
# Pimlico API Key (required)
NEXT_PUBLIC_PIMLICO_API_KEY=pim_xxxxx
# RPC URLs (optional, has defaults)
NEXT_PUBLIC_SEPOLIA_RPC_URL=https://ethereum-sepolia-rpc.publicnode.com- USDC Threshold: Minimum balance before top-up triggers (default: 1 USDC)
- USDC Top-Up Amount: Amount to send per top-up (default: 1 USDC)
- Cooldown: 30 seconds between top-ups (prevents spam)
opipolix-autotopup/
βββ app/
β βββ page.jsx # Landing page + config modal
βββ src/
β βββ components/
β β βββ Dashboard.jsx # Monitoring dashboard
β βββ lib/
β β βββ smartAccount.js # Session accounts & permissions
β β βββ networks.js # Network configurations
β βββ services/
β β βββ bundlerClient.js # Pimlico bundler
β β βββ pimlicoClient.js # Pimlico paymaster
β βββ providers/
β βββ AppProvider.jsx # wagmi configuration
βββ .env.local # Environment variables
βββ package.json
β
Only grant permissions on Sepolia testnet for testing
β
Use small amounts for production testing
β
Monitor the Activity Log for all operations
β
Revoke permissions when not in use
- Connect MetaMask Flask to Sepolia
- Configure bot address (use a test wallet)
- Grant permissions (approve in MetaMask Flask)
- Fund your main wallet with Sepolia USDC
- Set threshold to trigger top-up
- Start monitoring and watch Activity Log
0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238
Get test USDC from Sepolia faucets
- Polygon Mainnet: Production deployment with real USDC
- Multi-Token Support: Add support for other ERC-20 tokens
- Email/Telegram Alerts: Notifications for top-ups and low balance
- Historical Analytics: Charts and stats for top-up history
- Mobile App: React Native version
Contributions welcome! Please:
- Fork the repo
- Create a feature branch (
git checkout -b feature/amazing) - Commit changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing) - Open a Pull Request
MIT License - see LICENSE file
- MetaMask for ERC-7715 Advanced Permissions support
- Pimlico for gasless transaction infrastructure
- viem and wagmi for excellent developer tools
- Project: github.com/yourusername/opipolix-autotopup
- Demo: opipolix-autotopup.vercel.app
- Twitter: @OpiPoliX